diff options
Diffstat (limited to 'js/vendors~editor~preview.js.map')
-rw-r--r-- | js/vendors~editor~preview.js.map | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/js/vendors~editor~preview.js.map b/js/vendors~editor~preview.js.map index 9012cf48e..67e4f4fc9 100644 --- a/js/vendors~editor~preview.js.map +++ b/js/vendors~editor~preview.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///./node_modules/markdown-it/lib/common/utils.js","webpack:///./node_modules/prosemirror-commands/dist/index.es.js","webpack:///./node_modules/prosemirror-state/dist/index.es.js","webpack:///./node_modules/prosemirror-dropcursor/dist/index.es.js","webpack:///./node_modules/prosemirror-gapcursor/dist/index.es.js","webpack:///./node_modules/tiptap/dist/tiptap.esm.js","webpack:///./node_modules/orderedmap/index.mjs","webpack:///./node_modules/prosemirror-model/dist/index.es.js","webpack:///./node_modules/prosemirror-transform/dist/index.es.js","webpack:///./node_modules/rope-sequence/dist/index.es.js","webpack:///./node_modules/prosemirror-history/dist/index.es.js","webpack:///./node_modules/tiptap-extensions/dist/extensions.esm.js","webpack:///./node_modules/prosemirror-schema-list/dist/index.es.js","webpack:///./node_modules/tiptap-commands/dist/commands.esm.js","webpack:///./node_modules/prosemirror-inputrules/dist/index.es.js","webpack:///./node_modules/prosemirror-utils/dist/index.js","webpack:///./node_modules/prosemirror-view/dist/index.es.js","webpack:///./node_modules/escape-html/index.js","webpack:///./node_modules/prosemirror-collab/dist/index.es.js","webpack:///./node_modules/tiptap-utils/dist/utils.esm.js","webpack:///./node_modules/markdown-it/index.js","webpack:///./node_modules/uc.micro/categories/P/regex.js","webpack:///./node_modules/markdown-it/lib/ruler.js","webpack:///./node_modules/markdown-it/lib/token.js","webpack:///./node_modules/w3c-keyname/index.es.js","webpack:///./node_modules/prosemirror-keymap/dist/index.es.js","webpack:///./node_modules/prosemirror-tables/dist/index.es.js","webpack:///./node_modules/markdown-it/lib/common/entities.js","webpack:///./node_modules/mdurl/index.js","webpack:///./node_modules/uc.micro/properties/Any/regex.js","webpack:///./node_modules/uc.micro/categories/Cc/regex.js","webpack:///./node_modules/uc.micro/categories/Z/regex.js","webpack:///./node_modules/markdown-it/lib/common/html_re.js","webpack:///./node_modules/markdown-it/lib/rules_inline/strikethrough.js","webpack:///./node_modules/markdown-it/lib/rules_inline/emphasis.js","webpack:///./node_modules/markdown-it-task-lists/index.js","webpack:///./node_modules/prosemirror-markdown/dist/index.es.js","webpack:///./node_modules/lowlight/lib/core.js","webpack:///./node_modules/highlight.js/lib/highlight.js","webpack:///./node_modules/fault/index.js","webpack:///./node_modules/format/format.js","webpack:///./node_modules/markdown-it/lib/index.js","webpack:///./node_modules/mdurl/encode.js","webpack:///./node_modules/mdurl/decode.js","webpack:///./node_modules/mdurl/format.js","webpack:///./node_modules/mdurl/parse.js","webpack:///./node_modules/uc.micro/index.js","webpack:///./node_modules/uc.micro/categories/Cf/regex.js","webpack:///./node_modules/markdown-it/lib/helpers/index.js","webpack:///./node_modules/markdown-it/lib/helpers/parse_link_label.js","webpack:///./node_modules/markdown-it/lib/helpers/parse_link_destination.js","webpack:///./node_modules/markdown-it/lib/helpers/parse_link_title.js","webpack:///./node_modules/markdown-it/lib/renderer.js","webpack:///./node_modules/markdown-it/lib/parser_core.js","webpack:///./node_modules/markdown-it/lib/rules_core/normalize.js","webpack:///./node_modules/markdown-it/lib/rules_core/block.js","webpack:///./node_modules/markdown-it/lib/rules_core/inline.js","webpack:///./node_modules/markdown-it/lib/rules_core/linkify.js","webpack:///./node_modules/markdown-it/lib/rules_core/replacements.js","webpack:///./node_modules/markdown-it/lib/rules_core/smartquotes.js","webpack:///./node_modules/markdown-it/lib/rules_core/state_core.js","webpack:///./node_modules/markdown-it/lib/parser_block.js","webpack:///./node_modules/markdown-it/lib/rules_block/table.js","webpack:///./node_modules/markdown-it/lib/rules_block/code.js","webpack:///./node_modules/markdown-it/lib/rules_block/fence.js","webpack:///./node_modules/markdown-it/lib/rules_block/blockquote.js","webpack:///./node_modules/markdown-it/lib/rules_block/hr.js","webpack:///./node_modules/markdown-it/lib/rules_block/list.js","webpack:///./node_modules/markdown-it/lib/rules_block/reference.js","webpack:///./node_modules/markdown-it/lib/rules_block/heading.js","webpack:///./node_modules/markdown-it/lib/rules_block/lheading.js","webpack:///./node_modules/markdown-it/lib/rules_block/html_block.js","webpack:///./node_modules/markdown-it/lib/common/html_blocks.js","webpack:///./node_modules/markdown-it/lib/rules_block/paragraph.js","webpack:///./node_modules/markdown-it/lib/rules_block/state_block.js","webpack:///./node_modules/markdown-it/lib/parser_inline.js","webpack:///./node_modules/markdown-it/lib/rules_inline/text.js","webpack:///./node_modules/markdown-it/lib/rules_inline/newline.js","webpack:///./node_modules/markdown-it/lib/rules_inline/escape.js","webpack:///./node_modules/markdown-it/lib/rules_inline/backticks.js","webpack:///./node_modules/markdown-it/lib/rules_inline/link.js","webpack:///./node_modules/markdown-it/lib/rules_inline/image.js","webpack:///./node_modules/markdown-it/lib/rules_inline/autolink.js","webpack:///./node_modules/markdown-it/lib/rules_inline/html_inline.js","webpack:///./node_modules/markdown-it/lib/rules_inline/entity.js","webpack:///./node_modules/markdown-it/lib/rules_inline/balance_pairs.js","webpack:///./node_modules/markdown-it/lib/rules_inline/text_collapse.js","webpack:///./node_modules/markdown-it/lib/rules_inline/state_inline.js","webpack:///./node_modules/linkify-it/index.js","webpack:///./node_modules/linkify-it/lib/re.js","webpack:///./node_modules/node-libs-browser/node_modules/punycode/punycode.js","webpack:///(webpack)/buildin/module.js","webpack:///./node_modules/markdown-it/lib/presets/default.js","webpack:///./node_modules/markdown-it/lib/presets/zero.js","webpack:///./node_modules/markdown-it/lib/presets/commonmark.js"],"names":["_hasOwnProperty","Object","prototype","hasOwnProperty","has","object","key","call","isValidEntityCode","c","fromCodePoint","surrogate1","surrogate2","String","fromCharCode","UNESCAPE_MD_RE","UNESCAPE_ALL_RE","RegExp","source","DIGITAL_ENTITY_TEST_RE","entities","HTML_ESCAPE_TEST_RE","HTML_ESCAPE_REPLACE_RE","HTML_REPLACEMENTS","replaceUnsafeChar","ch","REGEXP_ESCAPE_RE","UNICODE_PUNCT_RE","exports","lib","mdurl","ucmicro","assign","obj","sources","Array","slice","arguments","forEach","TypeError","keys","isString","toString","_class","unescapeMd","str","indexOf","replace","unescapeAll","match","escaped","entity","name","code","charCodeAt","test","toLowerCase","parseInt","replaceEntityPattern","escapeHtml","arrayReplaceAt","src","pos","newElements","concat","isSpace","isWhiteSpace","isMdAsciiPunct","isPunctChar","escapeRE","normalizeReference","trim","toUpperCase","deleteSelection","state","dispatch","selection","empty","tr","scrollIntoView","textblockAt","node","side","firstChild","lastChild","isTextblock","findCutBefore","$pos","parent","type","spec","isolating","i","depth","index","doc","resolve","before","findCutAfter","childCount","after","lift","ref","$from","$to","range","blockRange","target","exitCode","$head","$anchor","sameParent","above","indexAfter","contentMatchAt","defaultType","canReplaceWith","replaceWith","createAndFill","setSelection","near","splitBlock","isBlock","parentOffset","split","atEnd","content","size","deflt","types","can","mapping","map","canReplace","from","create","setNodeMarkup","deleteBarrier","$cut","conn","nodeBefore","nodeAfter","compatibleContent","delete","nodeSize","clearIncompatible","join","joinMaybeClear","findWrapping","matchType","validEnd","end","wrap","length","copy","step","joinAt","selAfter","findFrom","wrapIn","nodeType","attrs","wrapping","setBlockType","to","applicable","nodesBetween","hasMarkup","toggleMark","markType","$cursor","ranges","loop","allowsMarkType","inlineContent","v","returned","markApplies","isInSet","storedMarks","marks","removeStoredMark","addStoredMark","ref$1","rangeHasMark","i$1","ref$2","$from$1","$to$1","removeMark","addMark","chainCommands","commands","len","view","backspace","endOfTextblock","isSelectable","deleteRange","isAtom","del","pcBaseKeymap","insertText","insert","macBaseKeymap","baseKeymap","navigator","platform","os","classesById","Selection","this","SelectionRange","min","max","prototypeAccessors","anchor","configurable","head","get","lastNode","lastParent","openEnd","mapFrom","steps","replaceRange","selectionToInsertionEnd","isInline","replaceRangeWith","dir","textOnly","inner","TextSelection","findSelectionIn","found","bias","AllSelection","atStart","fromJSON","json","RangeError","cls","jsonID","id","selectionClass","getBookmark","between","defineProperties","visible","__proto__","constructor","prototypeAccessors$1","marksAcross","ensureMarks","eq","other","TextBookmark","toJSON","dPos","NodeSelection","$end","mapResult","deleted","NodeBookmark","isText","selectable","AllBookmark","text","child","startLen","last","maps","_from","_to","_newFrom","newTo","Transaction","Transform","time","Date","now","curSelection","curSelectionFor","updated","meta","selectionSet","storedMarksSet","isGeneric","scrolledIntoView","setStoredMarks","sameSet","mark","addToSet","removeFromSet","addStep","setTime","replaceSelection","replaceSelectionWith","inheritMarks","none","schema","setMeta","value","getMeta","_","bind","f","self","FieldDesc","desc","init","apply","baseFields","config","topNodeType","instance","_marks","_old","prev","Configuration","plugins","this$1","fields","pluginsByKey","plugin","push","EditorState","applyTransaction","filterTransaction","ignore","rootTr","transactions","trs","newState","applyInner","seen","haveNew","appendTransaction","n","oldState","j","newInstance","field","applyListeners","$config","reconfigure","pluginFields","result","m","prop","markFromJSON","addApplyListener","removeApplyListener","splice","Plugin","props","bindProps","val","Function","createKey","getState","PluginKey","DropCursorView","editorView","options","width","color","class","cursorPos","element","timeout","handlers","handler","e","dom","addEventListener","destroy","removeEventListener","update","prevState","updateOverlay","setCursor","parentNode","removeChild","rect","nodeRect","nodeDOM","getBoundingClientRect","top","bottom","left","right","coords","coordsAtPos","offsetParent","appendChild","document","createElement","className","style","cssText","parentRect","body","getComputedStyle","position","pageXOffset","pageYOffset","height","scheduleRemoval","clearTimeout","setTimeout","dragover","event","editable","posAtCoords","clientX","clientY","dragging","dragend","drop","dragleave","contains","relatedTarget","GapCursor","valid","GapBookmark","d","closedBefore","closedAfter","override","allowGapCursor","mustMove","next","maybeChild","$cur","$cur$1","handleKeyDown","arrow","axis","dirStr","sel","$start","$found","handleClick","inside","nodeAt","drawGapCursor","widget","_typeof","Symbol","iterator","_classCallCheck","Constructor","_defineProperties","descriptor","enumerable","writable","defineProperty","_createClass","protoProps","staticProps","_defineProperty","ownKeys","enumerableOnly","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","_objectSpread2","getOwnPropertyDescriptors","_inherits","subClass","superClass","_setPrototypeOf","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","p","_possibleConstructorReturn","ReferenceError","_assertThisInitialized","_slicedToArray","arr","isArray","_arrayWithHoles","_arr","_n","_d","_e","undefined","_s","_i","done","err","_iterableToArrayLimit","_nonIterableRest","_toConsumableArray","arr2","_arrayWithoutHoles","iter","_iterableToArray","_nonIterableSpread","camelCase","word","ComponentView","component","_ref","editor","extension","decorations","getPos","isNode","isMark","getMarkPos","captureEvents","createDOM","contentDOM","vm","$refs","_this","Component","extend","selected","updateAttrs","propsData","$mount","$el","updateComponentProps","_this2","_props","originalSilent","silent","entries","_ref2","_ref3","newAttrs","transaction","mutation","_this3","stopEvent","draggable","dragHandle","closest","once","isCopy","isPaste","isCut","isDrag","startsWith","posAtDOM","resolvedPos","$destroy","Emitter","fn","_callbacks","_len","args","_key","callbacks","callback","cb","Extension","defaultOptions","ExtensionManager","extensions","bindEditor","extensionKeymaps","includes","nodeMarkKeymaps","excludedExtensions","allowedExtensions","extensionInputRules","inputRules","nodeMarkInputRules","reduce","allInputRules","extensionPasteRules","pasteRules","nodeMarkPasteRules","allPasteRules","_ref4","allCommands","focus","handle","_name","_value","_ref5","_ref6","commandName","commandValue","nodes","_ref7","Proxy","set","changed","_ref8","allPlugins","_ref9","injectCSS","css","textContent","insertBefore","Mark","_Extension","minMax","Math","Node","Doc","_Node","Paragraph","group","parseDOM","tag","toDOM","Text","_Emitter","Editor","editorProps","autoFocus","topNode","emptyDocument","useBuiltInExtensions","disableInputRules","disablePasteRules","dropCursor","parseOptions","onInit","onTransaction","onUpdate","onFocus","onBlur","onPaste","onDrop","events","setOptions","focused","createExtensions","createNodes","createMarks","createSchema","createPlugins","keymaps","createKeymaps","createInputRules","createPasteRules","createView","createCommands","setActiveNodesAndMarks","on","emit","updateState","builtInExtensions","createDocument","rules","Backspace","createSelectionBetween","_view","attributes","tabindex","handleDOMEvents","blur","nodeFromJSON","error","console","warn","innerHTML","fromSchema","parse","_this4","createState","handlePaste","handleDrop","_len2","_key2","dispatchTransaction","setProps","nodeViews","initNodeViews","_this5","getHTML","getJSON","docChanged","emitUpdate","_this6","_this$resolveSelectio","resolveSelection","_this$state","resolvedFrom","resolvedEnd","JSON","stringify","div","fragment","serializeFragment","_this$state2","setContent","_this7","activeMarks","activeMarkAttrs","activeNodes","docView","EditorContent","default","watch","immediate","$nextTick","setParentComponent","render","beforeDestroy","Menu","preventHide","mousedownHandler","EditorMenuBar","data","registerPlugin","$scopedSlots","isActive","getMarkAttrs","textRange","createRange","setEnd","nodeValue","setStart","singleRect","rects","getClientRects","_view$docView$domFrom","domFromPos","offset","childNodes","_child","x","Menu$1","keepInBounds","hide","lastState","composing","_state$selection","start","box","el","round","sendUpdate","EditorMenuBubble","Boolean","menu","$emit","unregisterPlugin","OrderedMap","find","newKey","remove","addToStart","addToEnd","addBefore","place","without","prepend","subtract","append","Fragment","nodeStart","descendants","textBetween","blockSeparator","leafText","separated","isLeaf","first","sameMarkup","withText","cut","cutByIndex","replaceChild","current","findDiffStart","a","b","childA","childB","findDiffEnd","otherPos","posA","posB","iA","iB","same","minSize","findIndex","retIndex","curPos","toStringInner","fromArray","array","joined","compareDeep","p$1","ReplaceError","message","Error","placed","excludes","rank","setFrom","sort","Slice","openStart","replaceOuter","$along","extra","resolveNoCache","prepareSliceForReplace","replaceThreeWay","joinable","addRange","checkJoin","addNode","replaceTwoWay","main","sub","$before","$after","startIndex","endIndex","textOffset","validContent","insertAt","insertInto","dist","removeBetween","removeRange","indexTo","offsetTo","maxOpen","openIsolating","n$1","ResolvedPos","path","prototypeAccessors$2","resolveDepth","dOff","tmp","inclusive","sharedDepth","pred","NodeRange","rem","resolveCached","resolveCache","cached","resolveCachePos","resolveCacheSize","prototypeAccessors$1$1","emptyAttrs","prototypeAccessors$3","startPos","defaultAttrs","includeParents","childAfter","childBefore","toDebugString","wrapMarks","contentMatch","matchFragment","replacement","one","two","allowsMarks","canAppend","check","TextNode","base","ContentMatch","wrapCache","prototypeAccessors$4","edgeCount","string","nodeTypes","stream","TokenStream","expr","parseExpr","nfa","labeled","explore","states","out","term","known","nullFrom","states$1","cmp","dfa","connect","compile","exprs","edge","loop$1","cur","next$1","i$2","next$2","edges","work","dead","hasRequiredAttrs","checkForDeadEnds","frag","compatible","fillBefore","toEnd","search","finished","tp","computed","computeWrapping","active","via","shift","reverse","scan","inline","tokens","pop","unshift","prototypeAccessors$1$2","parseExprSeq","eat","parseExprSubscript","typeName","type$1","groups","resolveName","parseExprAtom","parseExprRange","parseNum","Number","defaults","attrName","attr","hasDefault","computeAttrs","built","given","initAttrs","Attribute","tok","SyntaxError","NodeType","markSet","prototypeAccessors$5","atom","isRequired","createChecked","allowedMarks","topType","prototypeAccessors$1$3","MarkType","excluded","contentExprCache","prop$1","contentExpr","markExpr","gatherMarks","prop$2","excl","wrappings","ok","mark$1","text$1","DOMParser","tags","styles","rule","context","ParseContext","addAll","finish","parseSlice","matchTag","matches","namespace","namespaceURI","matchesContext","getAttrs","matchStyle","schemaRules","priority","rules$1","name$1","domParser","blockTags","address","article","aside","blockquote","canvas","dd","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","noscript","ol","output","pre","section","table","tfoot","ul","ignoreTags","script","title","listTags","wsOptionsFor","preserveWhitespace","NodeContext","pendingMarks","solid","fill","exec","applyPending","nextType","pending","markMayApply","parser","open","isOpen","topContext","topOptions","topMatch","findPositions","needsBlock","prototypeAccessors$6","currentPos","selector","msMatchesSelector","webkitMatchesSelector","mozMatchesSelector","addDOM","addTextNode","getAttribute","readStyles","re","parseStyles","addPendingMark","addElement","removePendingMark","domNodeBefore","previousSibling","nodeName","insertNode","findInText","findInside","prevItem","nextSibling","normalizeList","ruleFromNode","skip","sync","oldNeedsBlock","leafFallback","addElementByRule","ownerDocument","createTextNode","enter","startIn","getContent","contentElement","querySelector","findAround","findAtPoint","findPlace","route","cx","enterInner","block","textblockFromContext","closeExtra","preserveWS","topOpen","compareDocumentPosition","textNode","some","parts","option","useRoot","minDepth","part","$context","upto","level","lastIndexOf","DOMSerializer","gatherToDOM","window","createDocumentFragment","keep","rendered","spanning","add","markDOM","serializeMark","serializeNode","renderSpec","onContent","serializeNodeAndMarks","structure","xmlNS","tagName","space","createElementNS","space$1","setAttributeNS","setAttribute","innerContent","domSerializer","nodesFromSchema","marksFromSchema","factor16","pow","recoverIndex","MapResult","recover","StepMap","inverted","diff","recoverOffset","assoc","_map","simple","oldIndex","newIndex","oldSize","newSize","touches","oldStart","newStart","invert","Mapping","mirror","TransformError","appendMap","mirrors","setMirror","appendMapping","startSize","mirr","getMirror","appendMappingInverted","totalSize","inverse","recoverables","rec","corr","docs","mustOverride","maybeStep","failed","getMap","stepsByID","Step","_doc","_mapping","merge","_other","stepType","stepClass","StepResult","fail","fromReplace","ReplaceStep","contentBetween","slice$1","ReplaceAroundStep","gapFrom","gapTo","gap","inserted","canCut","liftTarget","innerRange","around","outer","findWrappingOutside","innerMatch","findWrappingInside","withAttrs","canSplit","typesAfter","innerType","index$1","rest","baseType","canJoin","joinPoint","dropPoint","pass","insertPos","mapFragment","mapped","gapStart","gapEnd","splitting","d$1","splitting$1","wrappers","canChangeType","startM","endM","newNode","typeAfter","AddMarkStep","oldSlice","RemoveMarkStep","replaceStep","fitsTrivially","fittedLeft","fitLeftInner","placedBelow","placedHere","fitLeft","frontier","Frontier","placeSlice","closeNode","fitted","fitRight","nodeRight","canMoveText","fittedAfter","fitRightJoin","count","matchCount","toNode","joinable$1","toIndex","closed","fitRightClosed","fitRightSeparate","normalizeSlice","removed","added","removing","adding","newSet","s","matched","toRemove","found$1","parentType","delSteps","allowed","wrapper","closeNodeStart","closeFragment","oldOpen","newOpen","coveredDepths","placeContent","single","w","closeNodeEnd","targetDepths","preferredTarget","defining","preferredTargetIndex","leftNodes","preferredDepth","openDepth","targetDepth","expand","startSteps","point","insertPoint","covered","RopeSequence","leafAppend","leafPrepend","appendInner","Append","sliceInner","getInner","forEachInner","forEachInvertedInner","elt","values","Leaf","flatten","leftLen","Branch","items","eventCount","popEvent","preserveItems","remap","remapping","remaining","transform","addAfter","item","Item","addTransform","histOptions","newItems","oldItems","lastItem","merged","cutPoint","overflow","DEPTH_OVERFLOW","mirrorPos","mirrorOffset","addMaps","rebased","rebasedTransform","rebasedCount","rebasedItems","newUntil","iRebased","newMaps","branch","emptyItemCount","compress","newItem","HistoryState","undone","prevRanges","prevTime","rangesFor","mapRanges","histTransaction","history","redo","mustPreserveItems","historyKey","newHist","historyState","cachedPreserveItems","cachedPreserveItemsPlugins","historyPreserveItems","closeHistoryKey","newGroupDelay","hist","historyTr","appended","newGroup","adjacent","isAdjacentTo","undo","undoDepth","redoDepth","Blockquote","paragraph","BulletList","list_item","CodeBlock","getDecorations","blocks","list","parseNodes","classes","properties","children","highlightAuto","decoration","CodeBlockHighlight","languages","registerLanguage","decorationSet","previousNodeName","HardBreak","command","Heading","levels","HorizontalRule","IMAGE_INPUT_REGEX","Image","_match","alt","dataTransfer","files","images","file","preventDefault","coordinates","image","reader","FileReader","onload","readerEvent","readAsDataURL","ListItem","Enter","Tab","SuggestionsPlugin","_ref2$matcher","matcher","char","allowSpaces","startOfLine","_ref2$appendText","appendText","_ref2$suggestionClass","suggestionClass","_ref2$command","_command","_ref2$items","_ref2$onEnter","onEnter","_ref2$onChange","onChange","_ref2$onExit","onExit","_ref2$onKeyDown","onKeyDown","_ref2$onFilter","onFilter","searchItems","query","moved","started","stopped","handleStart","handleChange","handleExit","decorationNode","decorationId","virtualNode","clientWidth","clientHeight","_ref$char","_ref$allowSpaces","_ref$startOfLine","$position","escapedChar","suffix","prefix","regexp","textFrom","textTo","matchPrefix","input","random","substr","_this$getState","editorState","_this$getState2","OrderedList","order","hasAttribute","TableNodes","tableGroup","cellContent","cellAttributes","background","getFromDOM","backgroundColor","setDOMAttr","_Mark","Bold","fontWeight","Code","Italic","Link","href","url","openOnClick","rel","link","HTMLAnchorElement","stopPropagation","Strike","Collaboration","getSendableSteps","debounce","sendable","onSendable","version","clientID","delay","floor","_this2$editor","History","Placeholder","emptyEditorClass","emptyNodeClass","emptyNodeText","showOnlyWhenEditable","showOnlyCurrent","isEditorEmpty","hasAnchor","isNodeEmpty","wrapInList","listType","doJoin","outerRange","$insert","joinBefore","splitDepth","splitPos","doWrapInList","splitListItem","itemType","grandParent","keepItem","tr$1","liftListItem","endOfList","liftToOuterList","indexBefore","liftOutOfList","sinkListItem","nestedBefore","markInputRule","markEnd","markStart","matchStart","matchEnd","textStart","textEnd","getMarksBetween","nodeInputRule","pasteRule","transformPasted","markPasteRule","isLink","replaceText","splitToDefaultListItem","_tr","_index","toggleBlockType","toggletype","isList","bullet_list","ordered_list","todo_list","toggleList","parentList","toggleWrap","updateMark","InputRule","cutOff","stored","handleTextInput","run","compositionend","isInputRules","textBefore","undoInputRule","undoable","toUndo","wrappingInputRule","joinPredicate","textblockTypeInputRule","prosemirrorState","prosemirrorModel","prosemirrorTables","replaceParentNodeOfType","findParentNodeOfType","newTr","replaceNodeAtPos","replaceSelectedNode","isNodeSelection","_tr$selection","cloneTr","setTextSelection","nextSelection","isSelectableNode","shouldSelectNode","safeInsert","tryToReplace","hasPosition","$insertPos","isEmptyParagraph","canInsert","_pos","_pos2","equalNodeType","removeNodeAtPos","tableNodeTypes","roles","tableRole","createCell","cellType","isRectSelected","TableMap","$anchorCell","cells","cellsInRect","selectedCells","rectBetween","$headCell","transpose","column","convertTableNodeToArrayOfRows","tableNode","rows","rowIndex","rowCells","colIndex","cellPos","cell","findCell","convertArrayOfRowsToTableNode","arrayOfNodes","rowsPM","row","newCell","moveRowInArrayOfRows","indexesOrigin","indexesTarget","directionOverride","direction","rowsExtracted","positionOffset","checkInvalidMovements","originIndex","targetIndex","targets","errorMessage","findParentNode","predicate","findParentNodeClosestToPos","findParentDomRef","domAtPos","findDomRefAtPos","hasParentNode","findPositionOfNodeBefore","maybeSelection","TEXT_NODE","descend","findChildren","findChildrenByType","findTable","isCellSelection","CellSelection","isTableSelected","getCellsInColumn","columnIndex","acc","nodePos","getCellsInRow","select","isRowSelection","findCellClosestToPos","selRect","cellsInFirstRow","cellsInLastRow","selectColumn","selectRow","cloneRowAt","tableNodes","rowPos","cloneRow","rowWidth","rowspan","colspan","rowSpanCells","_loop","foundCells","filterCellsInRow","setCellAttrs","removeColumnAt","removeTable","removeColumn","tableStart","removeRowAt","removeRow","findCellRectClosestToPos","findTableClosestToPos","getSelectionRangeInColumn","_loop2","maybeEndIndex","_loop3","indexes","maybeCells","firstSelectedColumnCells","firstRowCells","headCell","_i3","columnCells","getSelectionRangeInRow","_loop4","_loop5","firstSelectedRowCells","firstColumnCells","_i4","findParentNodeOfTypeClosestToPos","hasParentNodeOfType","findParentDomRefOfType","findSelectedNodeOfType","findTextNodes","findInlineNodes","findBlockNodes","findChildrenByAttr","findChildrenByMark","getSelectionRect","isColumnSelected","isRowSelected","getCellsInTable","selectTable","emptyCell","addColumnAt","addColumn","moveRow","originRowIndex","targetRowIndex","opts","tryToFit","indexesOriginRow","indexesTargetRow","newTable","moveTableRow","moveColumn","originColumnIndex","targetColumnIndex","indexesOriginColumn","indexesTargetColumn","moveTableColumn","addRowAt","clonePreviousRow","cloneRowIndex","addRow","removeSelectedColumns","pmTableRect","removeSelectedRows","removeColumnClosestToPos","removeRowClosestToPos","forEachCellInColumn","cellTransform","setCursorToLastCell","forEachCellInRow","createTable","rowsCount","colsCount","withHeaderRow","_tableNodeTypes","tableCell","tableHeader","header_cell","tableRow","headerCells","_i2","removeParentNodeOfType","removeSelectedNode","setParentNodeMarkup","selectParentNodeOfType","removeNodeBefore","ie_edge","userAgent","ie_upto10","ie_11up","mac","ie","ie_version","documentMode","gecko","gecko_version","chrome","chrome_version","ios","android","webkit","documentElement","safari","vendor","webkit_version","domIndex","host","isEquivalentPosition","off","targetNode","targetOff","scanFor","atomElements","hasBlockDesc","contentEditable","pmViewDesc","selectionCollapsed","domSel","collapsed","isCollapsed","rangeCount","getRangeAt","keyEvent","keyCode","createEvent","initEvent","windowRect","win","innerWidth","innerHeight","getSide","scrollRectIntoView","startDOM","scrollThreshold","someProp","scrollMargin","defaultView","atTop","bounding","moveX","moveY","scrollBy","startX","scrollLeft","startY","scrollTop","dX","dY","scrollStack","stack","restoreScrollStack","dTop","preventScrollSupported","findOffsetInNode","coordsClosest","dxClosest","rowBot","rowTop","childIndex","dx","inRect","findOffsetInText","assign$1","root","caretPositionFromPoint","pos$1","offsetNode","caretRangeFromPoint","startContainer","startOffset","elementFromPoint","startI","targetKludge","box$1","outside","nearestDesc","posBefore","posAfter","posFromDOM","posFromCaret","posFromElement","posAtStart","border","rectBefore","rectAfter","flattenV","rect$1","y","flattenH","rect$2","target$1","rect$3","withFlushedState","viewState","activeElement","maybeRTL","cachedState","cachedDir","cachedResult","nearest","boxes","endOfTextblockVertical","getSelection","modify","oldRange","oldNode","focusNode","oldOff","focusOffset","oldBidiLevel","caretBidiLevel","domAfterPos","removeAllRanges","endOfTextblockHorizontal","ViewDesc","dirty","beforePosition","posAtEnd","contentLost","matchesWidget","matchesMark","matchesNode","matchesHack","parseRule","posBeforeChild","localPosFromDOM","domBefore","domAfter","desc$1","search$1","onlyNodes","getDesc","descAt","parseRange","fromOffset","toOffset","childBase","emptyChildAt","j$1","force","anchorDOM","headDOM","anchorNode","anchorOffset","collapse","ignoreMutation","markDirty","startInside","endInside","markParentsDirty","nothing","WidgetViewDesc","raw","classList","stop","ignoreSelection","CompositionViewDesc","textDOM","mut","oldValue","MarkViewDesc","custom","replaceNodes","NodeViewDesc","outerDeco","innerDeco","updateChildren","descObj","applyOuterDeco","CustomNodeViewDesc","TextViewDesc","reparseInView","sameOuterDeco","composition","localCompositionNode","updater","ViewTreeUpdater","deco","onWidget","onNode","locals","forChild","decoIndex","restNode","parentIndex","widgets","compareSide","child$1","cutAt","i$3","iterDeco","insideNode","syncToMarks","placeWidget","findNodeMatch","updateNextNode","addTextblockHacks","destroyRest","protectLocalComposition","renderChildren","renderDescs","parentDOM","descs","childDOM","rm","oldCSS","listStyle","iosHacks","nearbyTextNode","textPos","childStart","findTextInFragment","compositionNodes","updateInner","updateOuterDeco","needsWrap","oldDOM","patchOuterDeco","computeOuterDeco","selectNode","deselectNode","removeAttribute","docViewDesc","inParent","BRHackViewDesc","OuterDecoLevel","noDeco","outerDOM","prevComputed","curComputed","curDOM","patchAttributes","prevList","curList","removeProperty","lockedNode","lock","preMatch","preMatched","preMatchOffset","moveSelectionBlock","$side","selectHorizontally","mods","nodeLen","isIgnorable","skipIgnoredNodesLeft","moveNode","moveOffset","isBlockNode","setSelFocus","skipIgnoredNodesRight","domObserver","setCurSelection","selectVertically","beyond","stopNativeHorizontalDelete","nextNode","switchEditable","captureKeyDown","ctrlKey","metaKey","altKey","shiftKey","getMods","chromeDownArrowBug","selectionFromDOM","origin","inWidget","isOnEdge","selectionBetween","selectionToDOM","syncNodeSelection","hasFocus","hasSelection","disconnectSelection","cursorWrapper","img","disabled","selectCursorWrapper","resetEditableFrom","resetEditableTo","brokenSelectBetweenUneditable","temporarilyEditableNear","resetEditable","hideSelectionGuard","removeClassOnSelectionChange","connectSelection","getPreMatch","destroyBetween","maxKeep","markDesc","nextDOM","setEditable","wasDraggable","lastSelectedViewDesc","clearNodeSelection","readDOMChange","typeOver","addedNodes","lastSelectionTime","lastSelectionOrigin","newSel","shared","preferredPos","preferredSide","from_","to_","lastKeyCode","startDoc","editableContent","anchor$1","parseBetween","compare","lastKeyCodeTime","change","endA","endB","adjust","findDiff","sel$1","domChangeCount","nextSel","lastIOSEnter","old","$newStart","$newEnd","skipClosingAndOpening","$next","looksLikeJoin","suppressSelectionUpdates","markChange","$from1","chFrom","chTo","curMarks","prevMarks","isMarkChange","sel$2","parsedSel","fromEnd","mayOpen","serializeForClipboard","serializer","detachedDoc","wrapMap","parseFromClipboard","html","plainText","inCode","asText","parsed","metas","firstTag","readHTML","contextNode","sliceData","addContext","closeRange","closeSlice","lastWrap","inLast","addToSibling","sibling","withWrappers","closeRight","wrapped","normalizeSiblings","thead","tbody","caption","colgroup","col","td","th","_detachedDoc","implementation","createHTMLDocument","observeOptions","childList","characterData","characterDataOldValue","attributeOldValue","subtree","useCharData","SelectionState","DOMObserver","handleDOMChange","queue","flushingSoon","observer","MutationObserver","mutations","removedNodes","flushSoon","flush","currentSelection","onCharData","prevValue","onSelectionChange","suppressingSelectionUpdates","forceFlush","observe","take","takeRecords","disconnect","ignoreSelectionChange","container","commonAncestorContainer","result$1","registerMutation","brs","cssChecked","whiteSpace","checkCSS","attributeName","editHandlers","setSelectionOrigin","ensureListeners","currentHandlers","eventHandlers","runCustomHandler","defaultPrevented","eventCoords","runHandlerOnContext","propName","updateSelection","handleSingleClick","selectedNode","selectAt","selectClickedNode","selectClickedLeaf","handleDoubleClick","handleTripleClick","defaultTripleClick","forceDOMFlush","endComposition","keydown","inOrNearComposition","keyup","keypress","charCode","selectNodeModifier","mousedown","flushed","lastClick","click","dy","isNear","mouseDown","MouseDown","targetPos","allowDefault","mightDrag","targetDesc","addAttr","setUneditable","up","move","abs","timeStamp","compositionEndedAt","touchdown","contextmenu","timeoutComposition","scheduleComposeEnd","composingTimeout","forceUpdate","compositionstart","compositionupdate","markCursor","brokenClipboardAPI","doPaste","singleNode","sliceSingleNode","clipboardData","clearData","setData","selectNodeContents","captureCopy","paste","getData","capturePaste","Dragging","dragCopyModifier","dragstart","dragenter","eventPos","$mouse","beforeInsert","beforeinput","inputType","compareObjs","WidgetType","noSpec","span","oldOffset","Decoration","InlineType","inclusiveStart","inclusiveEnd","is","DecorationSet","local","buildTree","findInner","childOff","mapInner","newLocal","onRemove","oldChildren","oldEnd","newEnd","dSize","mustRebuild","fromLocal","toLocal","childOffset","childNode","gather","mapAndGatherRemainingDecorations","from$1","byPos","mapChildren","addInner","baseOffset","takeSpansForNode","moveSpans","withoutNulls","removeInner","span$1","dec","localSet","DecorationGroup","removeOverlap","localsInner","members","spans","hasNulls","localStart","working","insertAhead","viewDecorations","sorted","EditorView","_root","mount","mounted","getEditable","updateCursorWrapper","buildNodeViews","computeDocDeco","bubbles","eventBelongsToView","initInput","pluginViews","updatePluginViews","contenteditable","selectionContext","updateStateInner","reconfigured","redraw","nA","nB","changedNodeViews","sel1","sel2","refDOM","refTop","newRefTop","scroll","scrollToSelection","updateDoc","updateSel","oldScrollPos","overflowAnchor","localRect","storeScrollPos","forceSelUpdate","selContext","newContext","needChromeSelectionReset","destroyPluginViews","pluginView","setActive","preventScroll","focusPreventScroll","destroyInput","dispatchEvent","matchHtmlRegExp","module","escape","lastIndex","substring","Rebaseable","CollabState","unconfirmed","collabKey","collab","unconfirmedFrom","receiveTransaction","clientIDs","collabState","ourID","ours","nUnconfirmed","over","rebaseSteps","newCollabState","mapSelectionBackward","sendableSteps","_origins","getVersion","markItem","getMarkRange","endPos","markIsActive","nodeEqualsType","nodeIsActive","Ruler","__rules__","__cache__","__find__","__compile__","chains","enabled","altName","chain","at","opt","beforeName","ruleName","afterName","enable","ignoreInvalid","idx","enableOnly","disable","getRules","chainName","Token","nesting","markup","info","hidden","attrIndex","attrPush","attrData","attrSet","attrGet","attrJoin","8","9","10","12","13","16","17","18","20","27","32","33","34","35","36","37","38","39","40","44","45","46","59","61","91","92","106","107","108","109","110","111","144","145","160","161","162","163","164","165","173","186","187","188","189","190","191","192","219","220","221","222","229","base_1","48","49","50","51","52","53","54","55","56","57","brokenModifierNames","keyName","normalizeKeyName","ctrl","mod","modifiers","keymap","bindings","keydownHandler","normalize","baseName","isChar","direct","fromCode","withShift","readFromCache","addToCache","WeakMap","cache","cache$1","cachePos","Rect","problems","freshColWidth","colwidth","colCount","nextCell","leftA","rightA","topA","bottomA","leftB","rightB","topB","bottomB","positionAt","rowStart","rowEnd","rowEndIndex","hasRowSpan","rowNode","prevRow","cell$1","findWidth","mapPos","colWidths","cellNode","h","colW","widthIndex","expectedPos","missing","tableMap","badWidths","colWidth","findBadColWidths","computeMap","cellAround","isInTable","selectionCell","role","role$1","cellNear","pointsAtCell","moveCellForward","inSameTable","$a","$b","setAttr","rmColSpan","addColSpan","tableChanged","rowSelection","isColSelection","colSelection","rowContent","cellRect","extraLeft","extraRight","attrs$1","forEachCell","anchorTop","headTop","anchorBot","headBot","anchorRect","headRect","anchorLeft","headLeft","anchorRight","headRight","anchorCell","CellBookmark","drawCellSelection","getCellAttrs","extraAttrs","widthAttr","widths","getter","setter","cellAttrs","table_row","table_cell","table_header","pastedCells","fitSlice","r","r$1","r$2","ensureRectangular","clipCells","newWidth","newHeight","newRows","newRows$1","row$1","cells$1","isolateHorizontal","cellTop","cellLeft","isolateVertical","updatePos","insertCells","recomp","emptyHead","start$1","emptyRow","growTable","shiftArrow","deleteCellSelection","maybeSetSelection","atEndOfCell","$cell","baseContent","handleMouseDown","startEvent","startDOMCell","domInCell","setCellSelection","cellUnderMouse","starting","mousePos","fixTablesKey","fixTables","tablePos","mustAdd","prob","cell$2","tableNodeType","fixTable","changedDescendants","curSize","selectedRect","refColumn","headerCell","columnIsHeader","addColumnBefore","addColumnAfter","mapStart","deleteColumn","rowIsHeader","refRow","addRowBefore","addRowAfter","nextRow","newPos","deleteRow","isEmpty","mergeCells","indexTop","indexLeft","indexBottom","indexRight","cellsOverlapRectangle","mergedPos","mergedCell","splitCell","splitCellWithType","getCellType","cellWrapping","baseAttrs","lastCell","setCellAttr","isHeaderEnabledByType","cellPositions","toggleHeader","useDeprecatedLogic","deprecated_toggleHeader","isHeaderRowEnabled","isHeaderColumnEnabled","selectionStartsAt","cellsRect","newType","relativeCellPos","toggleHeaderRow","toggleHeaderColumn","toggleHeaderCell","goToNextCell","rowNode$1","findNextCell","deleteTable","TableView","cellMinWidth","updateColumns","overrideCol","overrideValue","totalWidth","fixedWidth","hasWidth","cssWidth","minWidth","record","key$1","columnResizing","handleWidth","View","lastColumnResizable","ResizeState","activeHandle","mousemove","pluginState","domCellAround","edgeCell","updateHandle","handleMouseMove","mouseleave","handleMouseLeave","domWidth","offsetWidth","currentColWidth","mapIndex","zeroes","updateColumnWidth","draggedWidth","setDragging","which","dragged","displayColumnWidth","startWidth","handleMouseDown$1","handleDecorations","setHandle","tableEditing","allowTableNodeSelection","afterFrom","beforeTo","isCellBoundarySelection","fromCellBoundaryNode","toCellBoundaryNode","node$1","isTextSelectionAcrossCells","normalizeSelection","action","encode","decode","format","open_tag","close_tag","HTML_TAG_RE","HTML_OPEN_CLOSE_TAG_RE","tokenize","scanned","marker","scanDelims","delimiters","jump","token","can_open","close","can_close","postProcess","startDelim","endDelim","loneMarkers","isStrong","disableCheckboxes","useLabelWrapper","useLabelAfter","parentToken","targetLevel","isTodoItem","isParagraph","isListItem","startsWithTodoMarkdown","todoify","TokenConstructor","checkbox","disabledAttr","makeCheckbox","ceil","for","afterLabel","beginLabel","endLabel","md","label","labelAfter","core","ruler","horizontal_rule","heading","code_block","params","tight","hard_break","em","strong","MarkdownParseState","tokenHandlers","noOpenClose","withoutTrailingNewline","noOp","addText","maybeMerge","openMark","closeMark","parseTokens","toks","openNode","MarkdownParser","tokenizer","nodeType$1","softbreak","fence","hardbreak","code_inline","MarkdownSerializer","serialize","MarkdownSerializerState","renderContent","defaultMarkdownSerializer","wrapBlock","write","ensureNewLine","closeBlock","repeat","renderInline","renderList","bullet","maxW","nStr","esc","quote","mixable","expelEnclosingWhitespace","_state","isPlainURL","_mark","backticksFor","ticks","delim","inTightList","tightLists","flushClose","atBlank","delimMin","firstDelim","lines","trailing","progress","leading","lead","inner$1","trail","noEsc","markString","isTight","prevTight","getEnclosingWhitespace","high","fault","High","low","highlight","language","coreHighlight","autoHighlight","syntax","lang","rawDefinition","languageNames","aliases","registerAlias","listLanguages","getLanguage","inherit","own","commonKeywords","secondBest","settings","subset","relevance","alias","continuation","currentChildren","lastMatch","continuations","modeBuffer","compileMode","mode","compiled","keywords","beginKeywords","caseInsensitive","pair","common","all","compileKeywords","lexemesRe","langRe","lexemes","begin","beginRe","endSameAsBegin","endsWithParent","endRe","illegal","illegalRe","contained","expandOrCloneMode","compileContains","starts","terminators","expression","indices","regexes","matchAt","addRule","separator","regex","backreferenceRe","captures","joinRe","terminator_end","buildModeRegex","global","compileLanguage","processLexeme","doBeginMatch","lexeme","newMode","escapeRe","excludeBegin","addSiblings","processBuffer","returnBegin","startNewMode","doEndMatch","matchPlusRemainder","endMode","endOfMode","endsParent","returnEnd","excludeEnd","subLanguage","textBeforeMatch","processed","build","subvalue","explicit","buildText","processSubLanguage","keyword","submatch","keywordMatch","processKeywords","siblings","tail","contents","noPrefix","variants","cached_variants","dependencyOnParent","factory","globalObject","hljs","ArrayProto","objectKeys","SAFE_MODE","noHighlightRe","languagePrefixRe","fixMarkupRe","LANGUAGE_NOT_FOUND","classPrefix","tabReplace","useBR","COMMON_KEYWORDS","isNotHighlighted","objects","nodeStream","_nodeStream","expand_or_clone_mode","variant","isFrozen","scoreForKeyword","providedScore","reStr","case_insensitive","matcherRe","matchIndexes","reCountMatchGroups","regexps","numCaptures","ret","rawKeywords","compiled_keywords","splitAndCompile","languageName","ignore_illegals","codeToHighlight","match_str","buildSpan","insideSpan","leaveOpen","openSpan","mode_buffer","keyword_match","last_index","new_mode","end_mode","testRe","text_before_match","errorRaised","languageSubset","second_best","autoDetection","fixMarkup","p1","highlightBlock","originalStream","resultNode","blockLanguage","original","highlighted","nodeStack","selectStream","mergeStreams","prevClassName","currentLang","resultLang","buildClassName","initHighlighting","called","querySelectorAll","PLAINTEXT_LANGUAGE","disableAutodetect","configure","user_options","initHighlightingOnLoad","requireLanguage","debugMode","IDENT_RE","UNDERSCORE_IDENT_RE","NUMBER_RE","C_NUMBER_RE","BINARY_NUMBER_RE","RE_STARTERS_RE","BACKSLASH_ESCAPE","APOS_STRING_MODE","QUOTE_STRING_MODE","PHRASAL_WORDS_MODE","COMMENT","inherits","C_LINE_COMMENT_MODE","C_BLOCK_COMMENT_MODE","HASH_COMMENT_MODE","NUMBER_MODE","C_NUMBER_MODE","BINARY_NUMBER_MODE","CSS_NUMBER_MODE","REGEXP_MODE","TITLE_MODE","UNDERSCORE_TITLE_MODE","METHOD_GUARD","deepFreeze","freeze","objIsFunction","getOwnPropertyNames","formatter","EConstructor","FormattedError","displayName","eval","EvalError","reference","uri","URIError","fmt","arg","precision","argIndex","leadingZero","nextArg","slurpNumber","digits","parseFloat","toFixed","vsprintf","replacements","log","printf","utils","helpers","Renderer","ParserCore","ParserBlock","ParserInline","LinkifyIt","punycode","zero","commonmark","BAD_PROTO_RE","GOOD_DATA_RE","validateLink","RECODE_HOSTNAME_FOR","normalizeLink","hostname","protocol","toASCII","er","normalizeLinkText","toUnicode","MarkdownIt","presetName","renderer","linkify","presets","components","rules2","ruler2","missed","use","env","State","process","parseInline","inlineMode","encodeCache","exclude","keepEscaped","l","nextCode","defaultChars","getEncodeCache","encodeURIComponent","componentChars","decodeCache","getDecodeCache","seq","b1","b2","b3","b4","chr","slashes","auth","port","pathname","hash","Url","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","hostlessProtocol","slashedProtocol","slashesDenoteHost","lowerProto","hec","simplePath","proto","atSign","hostEnd","parseHost","ipv6Hostname","hostparts","newpart","k","validParts","notHost","bit","qm","u","Any","Cc","Cf","P","Z","parseLinkLabel","parseLinkDestination","parseLinkTitle","disableNested","prevPos","labelEnd","posMax","oldPos","skipToken","default_rules","slf","renderAttrs","tmpAttrs","tmpToken","langName","langPrefix","renderInlineAsText","renderToken","xhtmlOut","breaks","html_block","html_inline","nextToken","needLf","_rules","Core","NEWLINES_RE","NULL_RE","isLinkClose","currentToken","ln","lastPos","htmlLinkLevel","fullUrl","urlText","links","blockTokens","pretest","RARE_RE","SCOPED_ABBR_TEST_RE","SCOPED_ABBR_RE","SCOPED_ABBR","tm","replaceFn","replace_scoped","inlineTokens","inside_autolink","replace_rare","blkIdx","typographer","QUOTE_TEST_RE","QUOTE_RE","replaceAt","process_inlines","t","thisLevel","lastChar","nextChar","isLastPunctChar","isNextPunctChar","isLastWhiteSpace","isNextWhiteSpace","canOpen","canClose","isSingle","openQuote","closeQuote","OUTER","quotes","StateCore","startLine","endLine","line","hasEmptyLines","maxNesting","skipEmptyLines","sCount","blkIndent","outTokens","lineMax","getLine","bMarks","eMarks","escapedSplit","escapes","backTicked","lastBackTick","lineText","nextLine","columns","columnCount","aligns","tableLines","tbodyLines","tShift","getLines","mem","haveEndMarker","skipChars","skipSpaces","adjustTab","initial","lastLineEmpty","oldBMarks","oldBSCount","oldIndent","oldParentType","oldSCount","oldTShift","spaceAfterMarker","terminate","terminatorRules","wasOutdented","oldLineMax","bsCount","cnt","skipBulletListMarker","skipOrderedListMarker","contentStart","indent","indentAfterMarker","isOrdered","itemLines","listLines","listTokIdx","markerCharCode","markerValue","oldLIndent","oldTight","posAfterMarker","prevEmptyEnd","isTerminatingParagraph","markTightParagraphs","_endLine","destEndPos","destEndLineNo","res","references","skipSpacesBack","skipCharsBack","block_names","HTML_SEQUENCES","StateBlock","indent_found","ddIndent","keepLastLF","lineIndent","lineStart","_rules2","pushPending","isTerminatorChar","pmax","ESCAPED","labelStart","parseReference","EMAIL_RE","AUTOLINK_RE","linkMatch","emailMatch","lc","isLetter","DIGITAL_RE","NAMED_RE","lastDelim","currDelim","curr","StateInline","pendingLevel","canSplitWord","left_flanking","right_flanking","isFunction","fuzzyLink","fuzzyEmail","fuzzyIP","defaultSchemas","validate","http","src_auth","src_host_port_strict","src_path","no_http","src_domain","src_domain_root","src_port","src_host_terminator","mailto","src_email_name","src_host_strict","tlds_default","__opts__","tlds","__tlds__","untpl","tpl","src_tlds","onCompile","__tlds_replaced__","src_xn","email_fuzzy","tpl_email_fuzzy","link_fuzzy","tpl_link_fuzzy","link_no_ip_fuzzy","tpl_link_no_ip_fuzzy","host_fuzzy_test","tpl_host_fuzzy_test","schemaError","__compiled__","__schemas__","isRegExp","createValidator","slist","schema_test","src_ZPCc","schema_search","__index__","__text_cache__","resetScanCache","Match","__last_index__","__schema__","createMatch","schemas","definition","ml","me","tld_pos","testSchemaAt","keepOld","src_Any","src_Cc","src_Z","src_P","src_ZCc","src_pseudo_letter","src_ip4","src_host","tpl_host_fuzzy","tpl_host_no_ip_fuzzy","tpl_host_fuzzy_strict","tpl_host_port_fuzzy_strict","tpl_host_port_no_ip_fuzzy_strict","freeGlobal","maxInt","regexPunycode","regexNonASCII","regexSeparators","errors","stringFromCharCode","mapDomain","ucs2decode","counter","ucs2encode","digitToBasic","digit","flag","adapt","delta","numPoints","firstTime","baseMinusTMin","basic","oldi","baseMinusT","codePoint","inputLength","handledCPCount","basicLength","q","currentValue","handledCPCountPlusOne","qMinusT","webpackPolyfill","deprecate","paths"],"mappings":"oGASA,IAAIA,EAAkBC,OAAOC,UAAUC,eAEvC,SAASC,EAAIC,EAAQC,GACnB,OAAON,EAAgBO,KAAKF,EAAQC,GA+BtC,SAASE,EAAkBC,GAGzB,QAAIA,GAAK,OAAUA,GAAK,WAEpBA,GAAK,OAAUA,GAAK,SACH,QAAZ,MAAJA,IAA2C,QAAZ,MAAJA,OAE5BA,GAAK,GAAQA,GAAK,KACZ,KAANA,MACAA,GAAK,IAAQA,GAAK,QAClBA,GAAK,KAAQA,GAAK,QAElBA,EAAI,eAIV,SAASC,EAAcD,GAErB,GAAIA,EAAI,MAAQ,CAEd,IAAIE,EAAa,QADjBF,GAAK,QAC2B,IAC5BG,EAAa,OAAc,KAAJH,GAE3B,OAAOI,OAAOC,aAAaH,EAAYC,GAEzC,OAAOC,OAAOC,aAAaL,GAI7B,IAAIM,EAAkB,8CAElBC,EAAkB,IAAIC,OAAOF,EAAeG,OAAS,IADnC,6BACmDA,OAAQ,MAE7EC,EAAyB,qCAEzBC,EAAW,EAAQ,KA4CvB,IAAIC,EAAsB,SACtBC,EAAyB,UACzBC,EAAoB,CACtB,IAAK,QACL,IAAK,OACL,IAAK,OACL,IAAK,UAGP,SAASC,EAAkBC,GACzB,OAAOF,EAAkBE,GAY3B,IAAIC,EAAmB,uBAwCvB,IAAIC,EAAmB,EAAQ,KAsE/BC,EAAQC,IAAs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KAEX0Y,WAAc,IAGhB5I,WAAY,CAEV1U,KAAM,CACJtlE,MAAO,CACL,YACA,QACA,WAIJmb,MAAO,CACLnb,MAAO,CACL,cAIJ4Q,OAAQ,CACN5Q,MAAO,CACL,QAEFi6E,OAAQ,CACN,gBACA,qB,iCCpDRjvB,EAAOnyE,QAAU,CACfgV,QAAS,CACPguD,MAAc,EACdujC,UAAc,EACdC,QAAc,EACdJ,WAAc,YACdnF,SAAc,EAGdqH,aAAc,EAOdmB,OAAQ,OAQRpY,UAAW,KAEX0Y,WAAc,IAGhB5I,WAAY,CAEV1U,KAAM,CACJtlE,MAAO,CACL,YACA,QACA,WAIJmb,MAAO,CACLnb,MAAO,CACL,aACA,OACA,QACA,UACA,KACA,aACA,WACA,OACA,YACA,cAIJ4Q,OAAQ,CACN5Q,MAAO,CACL,WACA,YACA,WACA,SACA,SACA,cACA,QACA,OACA,UACA,QAEFi6E,OAAQ,CACN,gBACA,WACA","file":"vendors~editor~preview.js?v=deb5c105167bb88cd8fb","sourcesContent":["// Utilities\n//\n'use strict';\n\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\n\nfunction isString(obj) { return _class(obj) === '[object String]'; }\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction has(object, key) {\n return _hasOwnProperty.call(object, key);\n}\n\n// Merge objects\n//\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n sources.forEach(function (source) {\n if (!source) { return; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be object');\n }\n\n Object.keys(source).forEach(function (key) {\n obj[key] = source[key];\n });\n });\n\n return obj;\n}\n\n// Remove element from array and put another array at those position.\n// Useful for some operations with tokens\nfunction arrayReplaceAt(src, pos, newElements) {\n return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction isValidEntityCode(c) {\n /*eslint no-bitwise:0*/\n // broken sequence\n if (c >= 0xD800 && c <= 0xDFFF) { return false; }\n // never used\n if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }\n if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }\n // control codes\n if (c >= 0x00 && c <= 0x08) { return false; }\n if (c === 0x0B) { return false; }\n if (c >= 0x0E && c <= 0x1F) { return false; }\n if (c >= 0x7F && c <= 0x9F) { return false; }\n // out of range\n if (c > 0x10FFFF) { return false; }\n return true;\n}\n\nfunction fromCodePoint(c) {\n /*eslint no-bitwise:0*/\n if (c > 0xffff) {\n c -= 0x10000;\n var surrogate1 = 0xd800 + (c >> 10),\n surrogate2 = 0xdc00 + (c & 0x3ff);\n\n return String.fromCharCode(surrogate1, surrogate2);\n }\n return String.fromCharCode(c);\n}\n\n\nvar UNESCAPE_MD_RE = /\\\\([!\"#$%&'()*+,\\-.\\/:;<=>?@[\\\\\\]^_`{|}~])/g;\nvar ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;\nvar UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');\n\nvar DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;\n\nvar entities = require('./entities');\n\nfunction replaceEntityPattern(match, name) {\n var code = 0;\n\n if (has(entities, name)) {\n return entities[name];\n }\n\n if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {\n code = name[1].toLowerCase() === 'x' ?\n parseInt(name.slice(2), 16)\n :\n parseInt(name.slice(1), 10);\n if (isValidEntityCode(code)) {\n return fromCodePoint(code);\n }\n }\n\n return match;\n}\n\n/*function replaceEntities(str) {\n if (str.indexOf('&') < 0) { return str; }\n\n return str.replace(ENTITY_RE, replaceEntityPattern);\n}*/\n\nfunction unescapeMd(str) {\n if (str.indexOf('\\\\') < 0) { return str; }\n return str.replace(UNESCAPE_MD_RE, '$1');\n}\n\nfunction unescapeAll(str) {\n if (str.indexOf('\\\\') < 0 && str.indexOf('&') < 0) { return str; }\n\n return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {\n if (escaped) { return escaped; }\n return replaceEntityPattern(match, entity);\n });\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar HTML_ESCAPE_TEST_RE = /[&<>\"]/;\nvar HTML_ESCAPE_REPLACE_RE = /[&<>\"]/g;\nvar HTML_REPLACEMENTS = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"'\n};\n\nfunction replaceUnsafeChar(ch) {\n return HTML_REPLACEMENTS[ch];\n}\n\nfunction escapeHtml(str) {\n if (HTML_ESCAPE_TEST_RE.test(str)) {\n return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);\n }\n return str;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar REGEXP_ESCAPE_RE = /[.?*+^$[\\]\\\\(){}|-]/g;\n\nfunction escapeRE(str) {\n return str.replace(REGEXP_ESCAPE_RE, '\\\\$&');\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction isSpace(code) {\n switch (code) {\n case 0x09:\n case 0x20:\n return true;\n }\n return false;\n}\n\n// Zs (unicode class) || [\\t\\f\\v\\r\\n]\nfunction isWhiteSpace(code) {\n if (code >= 0x2000 && code <= 0x200A) { return true; }\n switch (code) {\n case 0x09: // \\t\n case 0x0A: // \\n\n case 0x0B: // \\v\n case 0x0C: // \\f\n case 0x0D: // \\r\n case 0x20:\n case 0xA0:\n case 0x1680:\n case 0x202F:\n case 0x205F:\n case 0x3000:\n return true;\n }\n return false;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/*eslint-disable max-len*/\nvar UNICODE_PUNCT_RE = require('uc.micro/categories/P/regex');\n\n// Currently without astral characters support.\nfunction isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}\n\n\n// Markdown ASCII punctuation characters.\n//\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\n//\n// Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.\n//\nfunction isMdAsciiPunct(ch) {\n switch (ch) {\n case 0x21/* ! */:\n case 0x22/* \" */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x27/* ' */:\n case 0x28/* ( */:\n case 0x29/* ) */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2C/* , */:\n case 0x2D/* - */:\n case 0x2E/* . */:\n case 0x2F/* / */:\n case 0x3A/* : */:\n case 0x3B/* ; */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x3F/* ? */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7C/* | */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true;\n default:\n return false;\n }\n}\n\n// Hepler to unify [reference labels].\n//\nfunction normalizeReference(str) {\n // use .toUpperCase() instead of .toLowerCase()\n // here to avoid a conflict with Object.prototype\n // members (most notably, `__proto__`)\n return str.trim().replace(/\\s+/g, ' ').toUpperCase();\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Re-export libraries commonly used in both markdown-it and its plugins,\n// so plugins won't have to depend on them explicitly, which reduces their\n// bundled size (e.g. a browser build).\n//\nexports.lib = {};\nexports.lib.mdurl = require('mdurl');\nexports.lib.ucmicro = require('uc.micro');\n\nexports.assign = assign;\nexports.isString = isString;\nexports.has = has;\nexports.unescapeMd = unescapeMd;\nexports.unescapeAll = unescapeAll;\nexports.isValidEntityCode = isValidEntityCode;\nexports.fromCodePoint = fromCodePoint;\n// exports.replaceEntities = replaceEntities;\nexports.escapeHtml = escapeHtml;\nexports.arrayReplaceAt = arrayReplaceAt;\nexports.isSpace = isSpace;\nexports.isWhiteSpace = isWhiteSpace;\nexports.isMdAsciiPunct = isMdAsciiPunct;\nexports.isPunctChar = isPunctChar;\nexports.escapeRE = escapeRE;\nexports.normalizeReference = normalizeReference;\n","import { liftTarget, canJoin, joinPoint, canSplit, ReplaceAroundStep, findWrapping } from 'prosemirror-transform';\nimport { Fragment, Slice } from 'prosemirror-model';\nimport { NodeSelection, Selection, TextSelection, AllSelection } from 'prosemirror-state';\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Delete the selection, if there is one.\nfunction deleteSelection(state, dispatch) {\n if (state.selection.empty) { return false }\n if (dispatch) { dispatch(state.tr.deleteSelection().scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// If the selection is empty and at the start of a textblock, try to\n// reduce the distance between that block and the one before it—if\n// there's a block directly before it that can be joined, join them.\n// If not, try to move the selected block closer to the next one in\n// the document structure by lifting it out of its parent or moving it\n// into a parent of the previous block. Will use the view for accurate\n// (bidi-aware) start-of-textblock detection if given.\nfunction joinBackward(state, dispatch, view) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || (view ? !view.endOfTextblock(\"backward\", state)\n : $cursor.parentOffset > 0))\n { return false }\n\n var $cut = findCutBefore($cursor);\n\n // If there is no node before this, try to lift\n if (!$cut) {\n var range = $cursor.blockRange(), target = range && liftTarget(range);\n if (target == null) { return false }\n if (dispatch) { dispatch(state.tr.lift(range, target).scrollIntoView()); }\n return true\n }\n\n var before = $cut.nodeBefore;\n // Apply the joining algorithm\n if (!before.type.spec.isolating && deleteBarrier(state, $cut, dispatch))\n { return true }\n\n // If the node below has no content and the node above is\n // selectable, delete the node below and select the one above.\n if ($cursor.parent.content.size == 0 &&\n (textblockAt(before, \"end\") || NodeSelection.isSelectable(before))) {\n if (dispatch) {\n var tr = state.tr.deleteRange($cursor.before(), $cursor.after());\n tr.setSelection(textblockAt(before, \"end\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1)\n : NodeSelection.create(tr.doc, $cut.pos - before.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true\n }\n\n // If the node before is an atom, delete it\n if (before.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch) { dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView()); }\n return true\n }\n\n return false\n}\n\nfunction textblockAt(node, side) {\n for (; node; node = (side == \"start\" ? node.firstChild : node.lastChild))\n { if (node.isTextblock) { return true } }\n return false\n}\n\n// :: (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// When the selection is empty and at the start of a textblock, select\n// the node before that textblock, if possible. This is intended to be\n// bound to keys like backspace, after\n// [`joinBackward`](#commands.joinBackward) or other deleting\n// commands, as a fall-back behavior when the schema doesn't allow\n// deletion at the selected point.\nfunction selectNodeBackward(state, dispatch, view) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || (view ? !view.endOfTextblock(\"backward\", state)\n : $cursor.parentOffset > 0))\n { return false }\n\n var $cut = findCutBefore($cursor), node = $cut && $cut.nodeBefore;\n if (!node || !NodeSelection.isSelectable(node)) { return false }\n if (dispatch)\n { dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView()); }\n return true\n}\n\nfunction findCutBefore($pos) {\n if (!$pos.parent.type.spec.isolating) { for (var i = $pos.depth - 1; i >= 0; i--) {\n if ($pos.index(i) > 0) { return $pos.doc.resolve($pos.before(i + 1)) }\n if ($pos.node(i).type.spec.isolating) { break }\n } }\n return null\n}\n\n// :: (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// If the selection is empty and the cursor is at the end of a\n// textblock, try to reduce or remove the boundary between that block\n// and the one after it, either by joining them or by moving the other\n// block closer to this one in the tree structure. Will use the view\n// for accurate start-of-textblock detection if given.\nfunction joinForward(state, dispatch, view) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || (view ? !view.endOfTextblock(\"forward\", state)\n : $cursor.parentOffset < $cursor.parent.content.size))\n { return false }\n\n var $cut = findCutAfter($cursor);\n\n // If there is no node after this, there's nothing to do\n if (!$cut) { return false }\n\n var after = $cut.nodeAfter;\n // Try the joining algorithm\n if (deleteBarrier(state, $cut, dispatch)) { return true }\n\n // If the node above has no content and the node below is\n // selectable, delete the node above and select the one below.\n if ($cursor.parent.content.size == 0 &&\n (textblockAt(after, \"start\") || NodeSelection.isSelectable(after))) {\n if (dispatch) {\n var tr = state.tr.deleteRange($cursor.before(), $cursor.after());\n tr.setSelection(textblockAt(after, \"start\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1)\n : NodeSelection.create(tr.doc, tr.mapping.map($cut.pos)));\n dispatch(tr.scrollIntoView());\n }\n return true\n }\n\n // If the next node is an atom, delete it\n if (after.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch) { dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView()); }\n return true\n }\n\n return false\n}\n\n// :: (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// When the selection is empty and at the end of a textblock, select\n// the node coming after that textblock, if possible. This is intended\n// to be bound to keys like delete, after\n// [`joinForward`](#commands.joinForward) and similar deleting\n// commands, to provide a fall-back behavior when the schema doesn't\n// allow deletion at the selected point.\nfunction selectNodeForward(state, dispatch, view) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || (view ? !view.endOfTextblock(\"forward\", state)\n : $cursor.parentOffset < $cursor.parent.content.size))\n { return false }\n\n var $cut = findCutAfter($cursor), node = $cut && $cut.nodeAfter;\n if (!node || !NodeSelection.isSelectable(node)) { return false }\n if (dispatch)\n { dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos)).scrollIntoView()); }\n return true\n}\n\nfunction findCutAfter($pos) {\n if (!$pos.parent.type.spec.isolating) { for (var i = $pos.depth - 1; i >= 0; i--) {\n var parent = $pos.node(i);\n if ($pos.index(i) + 1 < parent.childCount) { return $pos.doc.resolve($pos.after(i + 1)) }\n if (parent.type.spec.isolating) { break }\n } }\n return null\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Join the selected block or, if there is a text selection, the\n// closest ancestor block of the selection that can be joined, with\n// the sibling above it.\nfunction joinUp(state, dispatch) {\n var sel = state.selection, nodeSel = sel instanceof NodeSelection, point;\n if (nodeSel) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.from)) { return false }\n point = sel.from;\n } else {\n point = joinPoint(state.doc, sel.from, -1);\n if (point == null) { return false }\n }\n if (dispatch) {\n var tr = state.tr.join(point);\n if (nodeSel) { tr.setSelection(NodeSelection.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize)); }\n dispatch(tr.scrollIntoView());\n }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Join the selected block, or the closest ancestor of the selection\n// that can be joined, with the sibling after it.\nfunction joinDown(state, dispatch) {\n var sel = state.selection, point;\n if (sel instanceof NodeSelection) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.to)) { return false }\n point = sel.to;\n } else {\n point = joinPoint(state.doc, sel.to, 1);\n if (point == null) { return false }\n }\n if (dispatch)\n { dispatch(state.tr.join(point).scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Lift the selected block, or the closest ancestor block of the\n// selection that can be lifted, out of its parent node.\nfunction lift(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to), target = range && liftTarget(range);\n if (target == null) { return false }\n if (dispatch) { dispatch(state.tr.lift(range, target).scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// If the selection is in a node whose type has a truthy\n// [`code`](#model.NodeSpec.code) property in its spec, replace the\n// selection with a newline character.\nfunction newlineInCode(state, dispatch) {\n var ref = state.selection;\n var $head = ref.$head;\n var $anchor = ref.$anchor;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) { return false }\n if (dispatch) { dispatch(state.tr.insertText(\"\\n\").scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// When the selection is in a node with a truthy\n// [`code`](#model.NodeSpec.code) property in its spec, create a\n// default block after the code block, and move the cursor there.\nfunction exitCode(state, dispatch) {\n var ref = state.selection;\n var $head = ref.$head;\n var $anchor = ref.$anchor;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) { return false }\n var above = $head.node(-1), after = $head.indexAfter(-1), type = above.contentMatchAt(after).defaultType;\n if (!above.canReplaceWith(after, after, type)) { return false }\n if (dispatch) {\n var pos = $head.after(), tr = state.tr.replaceWith(pos, pos, type.createAndFill());\n tr.setSelection(Selection.near(tr.doc.resolve(pos), 1));\n dispatch(tr.scrollIntoView());\n }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// If a block node is selected, create an empty paragraph before (if\n// it is its parent's first child) or after it.\nfunction createParagraphNear(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n if ($from.parent.inlineContent || $to.parent.inlineContent) { return false }\n var type = $from.parent.contentMatchAt($to.indexAfter()).defaultType;\n if (!type || !type.isTextblock) { return false }\n if (dispatch) {\n var side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;\n var tr = state.tr.insert(side, type.createAndFill());\n tr.setSelection(TextSelection.create(tr.doc, side + 1));\n dispatch(tr.scrollIntoView());\n }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// If the cursor is in an empty textblock that can be lifted, lift the\n// block.\nfunction liftEmptyBlock(state, dispatch) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || $cursor.parent.content.size) { return false }\n if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {\n var before = $cursor.before();\n if (canSplit(state.doc, before)) {\n if (dispatch) { dispatch(state.tr.split(before).scrollIntoView()); }\n return true\n }\n }\n var range = $cursor.blockRange(), target = range && liftTarget(range);\n if (target == null) { return false }\n if (dispatch) { dispatch(state.tr.lift(range, target).scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Split the parent block of the selection. If the selection is a text\n// selection, also delete its content.\nfunction splitBlock(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {\n if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) { return false }\n if (dispatch) { dispatch(state.tr.split($from.pos).scrollIntoView()); }\n return true\n }\n\n if (!$from.parent.isBlock) { return false }\n\n if (dispatch) {\n var atEnd = $to.parentOffset == $to.parent.content.size;\n var tr = state.tr;\n if (state.selection instanceof TextSelection) { tr.deleteSelection(); }\n var deflt = $from.depth == 0 ? null : $from.node(-1).contentMatchAt($from.indexAfter(-1)).defaultType;\n var types = atEnd && deflt ? [{type: deflt}] : null;\n var can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);\n if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt && [{type: deflt}])) {\n types = [{type: deflt}];\n can = true;\n }\n if (can) {\n tr.split(tr.mapping.map($from.pos), 1, types);\n if (!atEnd && !$from.parentOffset && $from.parent.type != deflt &&\n $from.node(-1).canReplace($from.index(-1), $from.indexAfter(-1), Fragment.from(deflt.create(), $from.parent)))\n { tr.setNodeMarkup(tr.mapping.map($from.before()), deflt); }\n }\n dispatch(tr.scrollIntoView());\n }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Acts like [`splitBlock`](#commands.splitBlock), but without\n// resetting the set of active marks at the cursor.\nfunction splitBlockKeepMarks(state, dispatch) {\n return splitBlock(state, dispatch && (function (tr) {\n var marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n if (marks) { tr.ensureMarks(marks); }\n dispatch(tr);\n }))\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Move the selection to the node wrapping the current selection, if\n// any. (Will not select the document node.)\nfunction selectParentNode(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var to = ref.to;\n var pos;\n var same = $from.sharedDepth(to);\n if (same == 0) { return false }\n pos = $from.before(same);\n if (dispatch) { dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos))); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Select the whole document.\nfunction selectAll(state, dispatch) {\n if (dispatch) { dispatch(state.tr.setSelection(new AllSelection(state.doc))); }\n return true\n}\n\nfunction joinMaybeClear(state, $pos, dispatch) {\n var before = $pos.nodeBefore, after = $pos.nodeAfter, index = $pos.index();\n if (!before || !after || !before.type.compatibleContent(after.type)) { return false }\n if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {\n if (dispatch) { dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView()); }\n return true\n }\n if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos)))\n { return false }\n if (dispatch)\n { dispatch(state.tr\n .clearIncompatible($pos.pos, before.type, before.contentMatchAt(before.childCount))\n .join($pos.pos)\n .scrollIntoView()); }\n return true\n}\n\nfunction deleteBarrier(state, $cut, dispatch) {\n var before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match;\n if (before.type.spec.isolating || after.type.spec.isolating) { return false }\n if (joinMaybeClear(state, $cut, dispatch)) { return true }\n\n if ($cut.parent.canReplace($cut.index(), $cut.index() + 1) &&\n (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) &&\n match.matchType(conn[0] || after.type).validEnd) {\n if (dispatch) {\n var end = $cut.pos + after.nodeSize, wrap = Fragment.empty;\n for (var i = conn.length - 1; i >= 0; i--)\n { wrap = Fragment.from(conn[i].create(null, wrap)); }\n wrap = Fragment.from(before.copy(wrap));\n var tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap, 1, 0), conn.length, true));\n var joinAt = end + 2 * conn.length;\n if (canJoin(tr.doc, joinAt)) { tr.join(joinAt); }\n dispatch(tr.scrollIntoView());\n }\n return true\n }\n\n var selAfter = Selection.findFrom($cut, 1);\n var range = selAfter && selAfter.$from.blockRange(selAfter.$to), target = range && liftTarget(range);\n if (target != null && target >= $cut.depth) {\n if (dispatch) { dispatch(state.tr.lift(range, target).scrollIntoView()); }\n return true\n }\n\n return false\n}\n\n// Parameterized commands\n\n// :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Wrap the selection in a node of the given type with the given\n// attributes.\nfunction wrapIn(nodeType, attrs) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to), wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping) { return false }\n if (dispatch) { dispatch(state.tr.wrap(range, wrapping).scrollIntoView()); }\n return true\n }\n}\n\n// :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Returns a command that tries to set the selected textblocks to the\n// given node type with the given attributes.\nfunction setBlockType(nodeType, attrs) {\n return function(state, dispatch) {\n var ref = state.selection;\n var from = ref.from;\n var to = ref.to;\n var applicable = false;\n state.doc.nodesBetween(from, to, function (node, pos) {\n if (applicable) { return false }\n if (!node.isTextblock || node.hasMarkup(nodeType, attrs)) { return }\n if (node.type == nodeType) {\n applicable = true;\n } else {\n var $pos = state.doc.resolve(pos), index = $pos.index();\n applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);\n }\n });\n if (!applicable) { return false }\n if (dispatch) { dispatch(state.tr.setBlockType(from, to, nodeType, attrs).scrollIntoView()); }\n return true\n }\n}\n\nfunction markApplies(doc, ranges, type) {\n var loop = function ( i ) {\n var ref = ranges[i];\n var $from = ref.$from;\n var $to = ref.$to;\n var can = $from.depth == 0 ? doc.type.allowsMarkType(type) : false;\n doc.nodesBetween($from.pos, $to.pos, function (node) {\n if (can) { return false }\n can = node.inlineContent && node.type.allowsMarkType(type);\n });\n if (can) { return { v: true } }\n };\n\n for (var i = 0; i < ranges.length; i++) {\n var returned = loop( i );\n\n if ( returned ) return returned.v;\n }\n return false\n}\n\n// :: (MarkType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Create a command function that toggles the given mark with the\n// given attributes. Will return `false` when the current selection\n// doesn't support that mark. This will remove the mark if any marks\n// of that type exist in the selection, or add it otherwise. If the\n// selection is empty, this applies to the [stored\n// marks](#state.EditorState.storedMarks) instead of a range of the\n// document.\nfunction toggleMark(markType, attrs) {\n return function(state, dispatch) {\n var ref = state.selection;\n var empty = ref.empty;\n var $cursor = ref.$cursor;\n var ranges = ref.ranges;\n if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType)) { return false }\n if (dispatch) {\n if ($cursor) {\n if (markType.isInSet(state.storedMarks || $cursor.marks()))\n { dispatch(state.tr.removeStoredMark(markType)); }\n else\n { dispatch(state.tr.addStoredMark(markType.create(attrs))); }\n } else {\n var has = false, tr = state.tr;\n for (var i = 0; !has && i < ranges.length; i++) {\n var ref$1 = ranges[i];\n var $from = ref$1.$from;\n var $to = ref$1.$to;\n has = state.doc.rangeHasMark($from.pos, $to.pos, markType);\n }\n for (var i$1 = 0; i$1 < ranges.length; i$1++) {\n var ref$2 = ranges[i$1];\n var $from$1 = ref$2.$from;\n var $to$1 = ref$2.$to;\n if (has) { tr.removeMark($from$1.pos, $to$1.pos, markType); }\n else { tr.addMark($from$1.pos, $to$1.pos, markType.create(attrs)); }\n }\n dispatch(tr.scrollIntoView());\n }\n }\n return true\n }\n}\n\nfunction wrapDispatchForJoin(dispatch, isJoinable) {\n return function (tr) {\n if (!tr.isGeneric) { return dispatch(tr) }\n\n var ranges = [];\n for (var i = 0; i < tr.mapping.maps.length; i++) {\n var map = tr.mapping.maps[i];\n for (var j = 0; j < ranges.length; j++)\n { ranges[j] = map.map(ranges[j]); }\n map.forEach(function (_s, _e, from, to) { return ranges.push(from, to); });\n }\n\n // Figure out which joinable points exist inside those ranges,\n // by checking all node boundaries in their parent nodes.\n var joinable = [];\n for (var i$1 = 0; i$1 < ranges.length; i$1 += 2) {\n var from = ranges[i$1], to = ranges[i$1 + 1];\n var $from = tr.doc.resolve(from), depth = $from.sharedDepth(to), parent = $from.node(depth);\n for (var index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {\n var after = parent.maybeChild(index);\n if (!after) { break }\n if (index && joinable.indexOf(pos) == -1) {\n var before = parent.child(index - 1);\n if (before.type == after.type && isJoinable(before, after))\n { joinable.push(pos); }\n }\n pos += after.nodeSize;\n }\n }\n // Join the joinable points\n joinable.sort(function (a, b) { return a - b; });\n for (var i$2 = joinable.length - 1; i$2 >= 0; i$2--) {\n if (canJoin(tr.doc, joinable[i$2])) { tr.join(joinable[i$2]); }\n }\n dispatch(tr);\n }\n}\n\n// :: ((state: EditorState, ?(tr: Transaction)) → bool, union<(before: Node, after: Node) → bool, [string]>) → (state: EditorState, ?(tr: Transaction)) → bool\n// Wrap a command so that, when it produces a transform that causes\n// two joinable nodes to end up next to each other, those are joined.\n// Nodes are considered joinable when they are of the same type and\n// when the `isJoinable` predicate returns true for them or, if an\n// array of strings was passed, if their node type name is in that\n// array.\nfunction autoJoin(command, isJoinable) {\n if (Array.isArray(isJoinable)) {\n var types = isJoinable;\n isJoinable = function (node) { return types.indexOf(node.type.name) > -1; };\n }\n return function (state, dispatch) { return command(state, dispatch && wrapDispatchForJoin(dispatch, isJoinable)); }\n}\n\n// :: (...[(EditorState, ?(tr: Transaction), ?EditorView) → bool]) → (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// Combine a number of command functions into a single function (which\n// calls them one by one until one returns true).\nfunction chainCommands() {\n var commands = [], len = arguments.length;\n while ( len-- ) commands[ len ] = arguments[ len ];\n\n return function(state, dispatch, view) {\n for (var i = 0; i < commands.length; i++)\n { if (commands[i](state, dispatch, view)) { return true } }\n return false\n }\n}\n\nvar backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward);\nvar del = chainCommands(deleteSelection, joinForward, selectNodeForward);\n\n// :: Object\n// A basic keymap containing bindings not specific to any schema.\n// Binds the following keys (when multiple commands are listed, they\n// are chained with [`chainCommands`](#commands.chainCommands)):\n//\n// * **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`\n// * **Mod-Enter** to `exitCode`\n// * **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`\n// * **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n// * **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n// * **Mod-a** to `selectAll`\nvar pcBaseKeymap = {\n \"Enter\": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock),\n \"Mod-Enter\": exitCode,\n \"Backspace\": backspace,\n \"Mod-Backspace\": backspace,\n \"Delete\": del,\n \"Mod-Delete\": del,\n \"Mod-a\": selectAll\n};\n\n// :: Object\n// A copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,\n// **Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and\n// **Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like\n// Ctrl-Delete.\nvar macBaseKeymap = {\n \"Ctrl-h\": pcBaseKeymap[\"Backspace\"],\n \"Alt-Backspace\": pcBaseKeymap[\"Mod-Backspace\"],\n \"Ctrl-d\": pcBaseKeymap[\"Delete\"],\n \"Ctrl-Alt-Backspace\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-Delete\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-d\": pcBaseKeymap[\"Mod-Delete\"]\n};\nfor (var key in pcBaseKeymap) { macBaseKeymap[key] = pcBaseKeymap[key]; }\n\n// declare global: os, navigator\nvar mac = typeof navigator != \"undefined\" ? /Mac/.test(navigator.platform)\n : typeof os != \"undefined\" ? os.platform() == \"darwin\" : false;\n\n// :: Object\n// Depending on the detected platform, this will hold\n// [`pcBasekeymap`](#commands.pcBaseKeymap) or\n// [`macBaseKeymap`](#commands.macBaseKeymap).\nvar baseKeymap = mac ? macBaseKeymap : pcBaseKeymap;\n\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, setBlockType, splitBlock, splitBlockKeepMarks, toggleMark, wrapIn };\n//# sourceMappingURL=index.es.js.map\n","import { Slice, Fragment, Mark, Node } from 'prosemirror-model';\nimport { ReplaceStep, ReplaceAroundStep, Transform } from 'prosemirror-transform';\n\nvar classesById = Object.create(null);\n\n// ::- Superclass for editor selections. Every selection type should\n// extend this. Should not be instantiated directly.\nvar Selection = function Selection($anchor, $head, ranges) {\n // :: [SelectionRange]\n // The ranges covered by the selection.\n this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];\n // :: ResolvedPos\n // The resolved anchor of the selection (the side that stays in\n // place when the selection is modified).\n this.$anchor = $anchor;\n // :: ResolvedPos\n // The resolved head of the selection (the side that moves when\n // the selection is modified).\n this.$head = $head;\n};\n\nvar prototypeAccessors = { anchor: { configurable: true },head: { configurable: true },from: { configurable: true },to: { configurable: true },$from: { configurable: true },$to: { configurable: true },empty: { configurable: true } };\n\n// :: number\n// The selection's anchor, as an unresolved position.\nprototypeAccessors.anchor.get = function () { return this.$anchor.pos };\n\n// :: number\n// The selection's head.\nprototypeAccessors.head.get = function () { return this.$head.pos };\n\n// :: number\n// The lower bound of the selection's main range.\nprototypeAccessors.from.get = function () { return this.$from.pos };\n\n// :: number\n// The upper bound of the selection's main range.\nprototypeAccessors.to.get = function () { return this.$to.pos };\n\n// :: ResolvedPos\n// The resolved lowerbound of the selection's main range.\nprototypeAccessors.$from.get = function () {\n return this.ranges[0].$from\n};\n\n// :: ResolvedPos\n// The resolved upper bound of the selection's main range.\nprototypeAccessors.$to.get = function () {\n return this.ranges[0].$to\n};\n\n// :: bool\n// Indicates whether the selection contains any content.\nprototypeAccessors.empty.get = function () {\n var ranges = this.ranges;\n for (var i = 0; i < ranges.length; i++)\n { if (ranges[i].$from.pos != ranges[i].$to.pos) { return false } }\n return true\n};\n\n// eq:: (Selection) → bool\n// Test whether the selection is the same as another selection.\n\n// map:: (doc: Node, mapping: Mappable) → Selection\n// Map this selection through a [mappable](#transform.Mappable) thing. `doc`\n// should be the new document to which we are mapping.\n\n// :: () → Slice\n// Get the content of this selection as a slice.\nSelection.prototype.content = function content () {\n return this.$from.node(0).slice(this.from, this.to, true)\n};\n\n// :: (Transaction, ?Slice)\n// Replace the selection with a slice or, if no slice is given,\n// delete the selection. Will append to the given transaction.\nSelection.prototype.replace = function replace (tr, content) {\n if ( content === void 0 ) content = Slice.empty;\n\n // Put the new selection at the position after the inserted\n // content. When that ended in an inline node, search backwards,\n // to get the position after that node. If not, search forward.\n var lastNode = content.content.lastChild, lastParent = null;\n for (var i = 0; i < content.openEnd; i++) {\n lastParent = lastNode;\n lastNode = lastNode.lastChild;\n }\n\n var mapFrom = tr.steps.length, ranges = this.ranges;\n for (var i$1 = 0; i$1 < ranges.length; i$1++) {\n var ref = ranges[i$1];\n var $from = ref.$from;\n var $to = ref.$to;\n var mapping = tr.mapping.slice(mapFrom);\n tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i$1 ? Slice.empty : content);\n if (i$1 == 0)\n { selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1); }\n }\n};\n\n// :: (Transaction, Node)\n// Replace the selection with the given node, appending the changes\n// to the given transaction.\nSelection.prototype.replaceWith = function replaceWith (tr, node) {\n var mapFrom = tr.steps.length, ranges = this.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var ref = ranges[i];\n var $from = ref.$from;\n var $to = ref.$to;\n var mapping = tr.mapping.slice(mapFrom);\n var from = mapping.map($from.pos), to = mapping.map($to.pos);\n if (i) {\n tr.deleteRange(from, to);\n } else {\n tr.replaceRangeWith(from, to, node);\n selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);\n }\n }\n};\n\n// toJSON:: () → Object\n// Convert the selection to a JSON representation. When implementing\n// this for a custom selection class, make sure to give the object a\n// `type` property whose value matches the ID under which you\n// [registered](#state.Selection^jsonID) your class.\n\n// :: (ResolvedPos, number, ?bool) → ?Selection\n// Find a valid cursor or leaf node selection starting at the given\n// position and searching back if `dir` is negative, and forward if\n// positive. When `textOnly` is true, only consider cursor\n// selections. Will return null when no valid selection position is\n// found.\nSelection.findFrom = function findFrom ($pos, dir, textOnly) {\n var inner = $pos.parent.inlineContent ? new TextSelection($pos)\n : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);\n if (inner) { return inner }\n\n for (var depth = $pos.depth - 1; depth >= 0; depth--) {\n var found = dir < 0\n ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly)\n : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);\n if (found) { return found }\n }\n};\n\n// :: (ResolvedPos, ?number) → Selection\n// Find a valid cursor or leaf node selection near the given\n// position. Searches forward first by default, but if `bias` is\n// negative, it will search backwards first.\nSelection.near = function near ($pos, bias) {\n if ( bias === void 0 ) bias = 1;\n\n return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0))\n};\n\n// :: (Node) → Selection\n// Find the cursor or leaf node selection closest to the start of\n// the given document. Will return an\n// [`AllSelection`](#state.AllSelection) if no valid position\n// exists.\nSelection.atStart = function atStart (doc) {\n return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc)\n};\n\n// :: (Node) → Selection\n// Find the cursor or leaf node selection closest to the end of the\n// given document.\nSelection.atEnd = function atEnd (doc) {\n return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc)\n};\n\n// :: (Node, Object) → Selection\n// Deserialize the JSON representation of a selection. Must be\n// implemented for custom classes (as a static class method).\nSelection.fromJSON = function fromJSON (doc, json) {\n if (!json || !json.type) { throw new RangeError(\"Invalid input for Selection.fromJSON\") }\n var cls = classesById[json.type];\n if (!cls) { throw new RangeError((\"No selection type \" + (json.type) + \" defined\")) }\n return cls.fromJSON(doc, json)\n};\n\n// :: (string, constructor<Selection>)\n// To be able to deserialize selections from JSON, custom selection\n// classes must register themselves with an ID string, so that they\n// can be disambiguated. Try to pick something that's unlikely to\n// clash with classes from other modules.\nSelection.jsonID = function jsonID (id, selectionClass) {\n if (id in classesById) { throw new RangeError(\"Duplicate use of selection JSON ID \" + id) }\n classesById[id] = selectionClass;\n selectionClass.prototype.jsonID = id;\n return selectionClass\n};\n\n// :: () → SelectionBookmark\n// Get a [bookmark](#state.SelectionBookmark) for this selection,\n// which is a value that can be mapped without having access to a\n// current document, and later resolved to a real selection for a\n// given document again. (This is used mostly by the history to\n// track and restore old selections.) The default implementation of\n// this method just converts the selection to a text selection and\n// returns the bookmark for that.\nSelection.prototype.getBookmark = function getBookmark () {\n return TextSelection.between(this.$anchor, this.$head).getBookmark()\n};\n\nObject.defineProperties( Selection.prototype, prototypeAccessors );\n\n// :: bool\n// Controls whether, when a selection of this type is active in the\n// browser, the selected range should be visible to the user. Defaults\n// to `true`.\nSelection.prototype.visible = true;\n\n// SelectionBookmark:: interface\n// A lightweight, document-independent representation of a selection.\n// You can define a custom bookmark type for a custom selection class\n// to make the history handle it well.\n//\n// map:: (mapping: Mapping) → SelectionBookmark\n// Map the bookmark through a set of changes.\n//\n// resolve:: (doc: Node) → Selection\n// Resolve the bookmark to a real selection again. This may need to\n// do some error checking and may fall back to a default (usually\n// [`TextSelection.between`](#state.TextSelection^between)) if\n// mapping made the bookmark invalid.\n\n// ::- Represents a selected range in a document.\nvar SelectionRange = function SelectionRange($from, $to) {\n // :: ResolvedPos\n // The lower bound of the range.\n this.$from = $from;\n // :: ResolvedPos\n // The upper bound of the range.\n this.$to = $to;\n};\n\n// ::- A text selection represents a classical editor selection, with\n// a head (the moving side) and anchor (immobile side), both of which\n// point into textblock nodes. It can be empty (a regular cursor\n// position).\nvar TextSelection = /*@__PURE__*/(function (Selection) {\n function TextSelection($anchor, $head) {\n if ( $head === void 0 ) $head = $anchor;\n\n Selection.call(this, $anchor, $head);\n }\n\n if ( Selection ) TextSelection.__proto__ = Selection;\n TextSelection.prototype = Object.create( Selection && Selection.prototype );\n TextSelection.prototype.constructor = TextSelection;\n\n var prototypeAccessors$1 = { $cursor: { configurable: true } };\n\n // :: ?ResolvedPos\n // Returns a resolved position if this is a cursor selection (an\n // empty text selection), and null otherwise.\n prototypeAccessors$1.$cursor.get = function () { return this.$anchor.pos == this.$head.pos ? this.$head : null };\n\n TextSelection.prototype.map = function map (doc, mapping) {\n var $head = doc.resolve(mapping.map(this.head));\n if (!$head.parent.inlineContent) { return Selection.near($head) }\n var $anchor = doc.resolve(mapping.map(this.anchor));\n return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head)\n };\n\n TextSelection.prototype.replace = function replace (tr, content) {\n if ( content === void 0 ) content = Slice.empty;\n\n Selection.prototype.replace.call(this, tr, content);\n if (content == Slice.empty) {\n var marks = this.$from.marksAcross(this.$to);\n if (marks) { tr.ensureMarks(marks); }\n }\n };\n\n TextSelection.prototype.eq = function eq (other) {\n return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head\n };\n\n TextSelection.prototype.getBookmark = function getBookmark () {\n return new TextBookmark(this.anchor, this.head)\n };\n\n TextSelection.prototype.toJSON = function toJSON () {\n return {type: \"text\", anchor: this.anchor, head: this.head}\n };\n\n TextSelection.fromJSON = function fromJSON (doc, json) {\n if (typeof json.anchor != \"number\" || typeof json.head != \"number\")\n { throw new RangeError(\"Invalid input for TextSelection.fromJSON\") }\n return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head))\n };\n\n // :: (Node, number, ?number) → TextSelection\n // Create a text selection from non-resolved positions.\n TextSelection.create = function create (doc, anchor, head) {\n if ( head === void 0 ) head = anchor;\n\n var $anchor = doc.resolve(anchor);\n return new this($anchor, head == anchor ? $anchor : doc.resolve(head))\n };\n\n // :: (ResolvedPos, ResolvedPos, ?number) → Selection\n // Return a text selection that spans the given positions or, if\n // they aren't text positions, find a text selection near them.\n // `bias` determines whether the method searches forward (default)\n // or backwards (negative number) first. Will fall back to calling\n // [`Selection.near`](#state.Selection^near) when the document\n // doesn't contain a valid text position.\n TextSelection.between = function between ($anchor, $head, bias) {\n var dPos = $anchor.pos - $head.pos;\n if (!bias || dPos) { bias = dPos >= 0 ? 1 : -1; }\n if (!$head.parent.inlineContent) {\n var found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);\n if (found) { $head = found.$head; }\n else { return Selection.near($head, bias) }\n }\n if (!$anchor.parent.inlineContent) {\n if (dPos == 0) {\n $anchor = $head;\n } else {\n $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;\n if (($anchor.pos < $head.pos) != (dPos < 0)) { $anchor = $head; }\n }\n }\n return new TextSelection($anchor, $head)\n };\n\n Object.defineProperties( TextSelection.prototype, prototypeAccessors$1 );\n\n return TextSelection;\n}(Selection));\n\nSelection.jsonID(\"text\", TextSelection);\n\nvar TextBookmark = function TextBookmark(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n};\nTextBookmark.prototype.map = function map (mapping) {\n return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head))\n};\nTextBookmark.prototype.resolve = function resolve (doc) {\n return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head))\n};\n\n// ::- A node selection is a selection that points at a single node.\n// All nodes marked [selectable](#model.NodeSpec.selectable) can be\n// the target of a node selection. In such a selection, `from` and\n// `to` point directly before and after the selected node, `anchor`\n// equals `from`, and `head` equals `to`..\nvar NodeSelection = /*@__PURE__*/(function (Selection) {\n function NodeSelection($pos) {\n var node = $pos.nodeAfter;\n var $end = $pos.node(0).resolve($pos.pos + node.nodeSize);\n Selection.call(this, $pos, $end);\n // :: Node The selected node.\n this.node = node;\n }\n\n if ( Selection ) NodeSelection.__proto__ = Selection;\n NodeSelection.prototype = Object.create( Selection && Selection.prototype );\n NodeSelection.prototype.constructor = NodeSelection;\n\n NodeSelection.prototype.map = function map (doc, mapping) {\n var ref = mapping.mapResult(this.anchor);\n var deleted = ref.deleted;\n var pos = ref.pos;\n var $pos = doc.resolve(pos);\n if (deleted) { return Selection.near($pos) }\n return new NodeSelection($pos)\n };\n\n NodeSelection.prototype.content = function content () {\n return new Slice(Fragment.from(this.node), 0, 0)\n };\n\n NodeSelection.prototype.eq = function eq (other) {\n return other instanceof NodeSelection && other.anchor == this.anchor\n };\n\n NodeSelection.prototype.toJSON = function toJSON () {\n return {type: \"node\", anchor: this.anchor}\n };\n\n NodeSelection.prototype.getBookmark = function getBookmark () { return new NodeBookmark(this.anchor) };\n\n NodeSelection.fromJSON = function fromJSON (doc, json) {\n if (typeof json.anchor != \"number\")\n { throw new RangeError(\"Invalid input for NodeSelection.fromJSON\") }\n return new NodeSelection(doc.resolve(json.anchor))\n };\n\n // :: (Node, number) → NodeSelection\n // Create a node selection from non-resolved positions.\n NodeSelection.create = function create (doc, from) {\n return new this(doc.resolve(from))\n };\n\n // :: (Node) → bool\n // Determines whether the given node may be selected as a node\n // selection.\n NodeSelection.isSelectable = function isSelectable (node) {\n return !node.isText && node.type.spec.selectable !== false\n };\n\n return NodeSelection;\n}(Selection));\n\nNodeSelection.prototype.visible = false;\n\nSelection.jsonID(\"node\", NodeSelection);\n\nvar NodeBookmark = function NodeBookmark(anchor) {\n this.anchor = anchor;\n};\nNodeBookmark.prototype.map = function map (mapping) {\n var ref = mapping.mapResult(this.anchor);\n var deleted = ref.deleted;\n var pos = ref.pos;\n return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos)\n};\nNodeBookmark.prototype.resolve = function resolve (doc) {\n var $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;\n if (node && NodeSelection.isSelectable(node)) { return new NodeSelection($pos) }\n return Selection.near($pos)\n};\n\n// ::- A selection type that represents selecting the whole document\n// (which can not necessarily be expressed with a text selection, when\n// there are for example leaf block nodes at the start or end of the\n// document).\nvar AllSelection = /*@__PURE__*/(function (Selection) {\n function AllSelection(doc) {\n Selection.call(this, doc.resolve(0), doc.resolve(doc.content.size));\n }\n\n if ( Selection ) AllSelection.__proto__ = Selection;\n AllSelection.prototype = Object.create( Selection && Selection.prototype );\n AllSelection.prototype.constructor = AllSelection;\n\n AllSelection.prototype.toJSON = function toJSON () { return {type: \"all\"} };\n\n AllSelection.fromJSON = function fromJSON (doc) { return new AllSelection(doc) };\n\n AllSelection.prototype.map = function map (doc) { return new AllSelection(doc) };\n\n AllSelection.prototype.eq = function eq (other) { return other instanceof AllSelection };\n\n AllSelection.prototype.getBookmark = function getBookmark () { return AllBookmark };\n\n return AllSelection;\n}(Selection));\n\nSelection.jsonID(\"all\", AllSelection);\n\nvar AllBookmark = {\n map: function map() { return this },\n resolve: function resolve(doc) { return new AllSelection(doc) }\n};\n\n// FIXME we'll need some awareness of text direction when scanning for selections\n\n// Try to find a selection inside the given node. `pos` points at the\n// position where the search starts. When `text` is true, only return\n// text selections.\nfunction findSelectionIn(doc, node, pos, index, dir, text) {\n if (node.inlineContent) { return TextSelection.create(doc, pos) }\n for (var i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {\n var child = node.child(i);\n if (!child.isAtom) {\n var inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);\n if (inner) { return inner }\n } else if (!text && NodeSelection.isSelectable(child)) {\n return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0))\n }\n pos += child.nodeSize * dir;\n }\n}\n\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n var last = tr.steps.length - 1;\n if (last < startLen) { return }\n var step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) { return }\n var map = tr.mapping.maps[last], end;\n map.forEach(function (_from, _to, _newFrom, newTo) { if (end == null) { end = newTo; } });\n tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\n\nvar UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;\n\n// ::- An editor state transaction, which can be applied to a state to\n// create an updated state. Use\n// [`EditorState.tr`](#state.EditorState.tr) to create an instance.\n//\n// Transactions track changes to the document (they are a subclass of\n// [`Transform`](#transform.Transform)), but also other state changes,\n// like selection updates and adjustments of the set of [stored\n// marks](#state.EditorState.storedMarks). In addition, you can store\n// metadata properties in a transaction, which are extra pieces of\n// information that client code or plugins can use to describe what a\n// transacion represents, so that they can update their [own\n// state](#state.StateField) accordingly.\n//\n// The [editor view](#view.EditorView) uses a few metadata properties:\n// it will attach a property `\"pointer\"` with the value `true` to\n// selection transactions directly caused by mouse or touch input, and\n// a `\"uiEvent\"` property of that may be `\"paste\"`, `\"cut\"`, or `\"drop\"`.\nvar Transaction = /*@__PURE__*/(function (Transform) {\n function Transaction(state) {\n Transform.call(this, state.doc);\n // :: number\n // The timestamp associated with this transaction, in the same\n // format as `Date.now()`.\n this.time = Date.now();\n this.curSelection = state.selection;\n // The step count for which the current selection is valid.\n this.curSelectionFor = 0;\n // :: ?[Mark]\n // The stored marks set by this transaction, if any.\n this.storedMarks = state.storedMarks;\n // Bitfield to track which aspects of the state were updated by\n // this transaction.\n this.updated = 0;\n // Object used to store metadata properties for the transaction.\n this.meta = Object.create(null);\n }\n\n if ( Transform ) Transaction.__proto__ = Transform;\n Transaction.prototype = Object.create( Transform && Transform.prototype );\n Transaction.prototype.constructor = Transaction;\n\n var prototypeAccessors = { selection: { configurable: true },selectionSet: { configurable: true },storedMarksSet: { configurable: true },isGeneric: { configurable: true },scrolledIntoView: { configurable: true } };\n\n // :: Selection\n // The transaction's current selection. This defaults to the editor\n // selection [mapped](#state.Selection.map) through the steps in the\n // transaction, but can be overwritten with\n // [`setSelection`](#state.Transaction.setSelection).\n prototypeAccessors.selection.get = function () {\n if (this.curSelectionFor < this.steps.length) {\n this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));\n this.curSelectionFor = this.steps.length;\n }\n return this.curSelection\n };\n\n // :: (Selection) → Transaction\n // Update the transaction's current selection. Will determine the\n // selection that the editor gets when the transaction is applied.\n Transaction.prototype.setSelection = function setSelection (selection) {\n if (selection.$from.doc != this.doc)\n { throw new RangeError(\"Selection passed to setSelection must point at the current document\") }\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this\n };\n\n // :: bool\n // Whether the selection was explicitly updated by this transaction.\n prototypeAccessors.selectionSet.get = function () {\n return (this.updated & UPDATED_SEL) > 0\n };\n\n // :: (?[Mark]) → Transaction\n // Set the current stored marks.\n Transaction.prototype.setStoredMarks = function setStoredMarks (marks) {\n this.storedMarks = marks;\n this.updated |= UPDATED_MARKS;\n return this\n };\n\n // :: ([Mark]) → Transaction\n // Make sure the current stored marks or, if that is null, the marks\n // at the selection, match the given set of marks. Does nothing if\n // this is already the case.\n Transaction.prototype.ensureMarks = function ensureMarks (marks) {\n if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))\n { this.setStoredMarks(marks); }\n return this\n };\n\n // :: (Mark) → Transaction\n // Add a mark to the set of stored marks.\n Transaction.prototype.addStoredMark = function addStoredMark (mark) {\n return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()))\n };\n\n // :: (union<Mark, MarkType>) → Transaction\n // Remove a mark or mark type from the set of stored marks.\n Transaction.prototype.removeStoredMark = function removeStoredMark (mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()))\n };\n\n // :: bool\n // Whether the stored marks were explicitly set for this transaction.\n prototypeAccessors.storedMarksSet.get = function () {\n return (this.updated & UPDATED_MARKS) > 0\n };\n\n Transaction.prototype.addStep = function addStep (step, doc) {\n Transform.prototype.addStep.call(this, step, doc);\n this.updated = this.updated & ~UPDATED_MARKS;\n this.storedMarks = null;\n };\n\n // :: (number) → Transaction\n // Update the timestamp for the transaction.\n Transaction.prototype.setTime = function setTime (time) {\n this.time = time;\n return this\n };\n\n // :: (Slice) → Transaction\n // Replace the current selection with the given slice.\n Transaction.prototype.replaceSelection = function replaceSelection (slice) {\n this.selection.replace(this, slice);\n return this\n };\n\n // :: (Node, ?bool) → Transaction\n // Replace the selection with the given node. When `inheritMarks` is\n // true and the content is inline, it inherits the marks from the\n // place where it is inserted.\n Transaction.prototype.replaceSelectionWith = function replaceSelectionWith (node, inheritMarks) {\n var selection = this.selection;\n if (inheritMarks !== false)\n { node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || Mark.none))); }\n selection.replaceWith(this, node);\n return this\n };\n\n // :: () → Transaction\n // Delete the selection.\n Transaction.prototype.deleteSelection = function deleteSelection () {\n this.selection.replace(this);\n return this\n };\n\n // :: (string, from: ?number, to: ?number) → Transaction\n // Replace the given range, or the selection if no range is given,\n // with a text node containing the given string.\n Transaction.prototype.insertText = function insertText (text, from, to) {\n if ( to === void 0 ) to = from;\n\n var schema = this.doc.type.schema;\n if (from == null) {\n if (!text) { return this.deleteSelection() }\n return this.replaceSelectionWith(schema.text(text), true)\n } else {\n if (!text) { return this.deleteRange(from, to) }\n var marks = this.storedMarks;\n if (!marks) {\n var $from = this.doc.resolve(from);\n marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));\n }\n this.replaceRangeWith(from, to, schema.text(text, marks));\n if (!this.selection.empty) { this.setSelection(Selection.near(this.selection.$to)); }\n return this\n }\n };\n\n // :: (union<string, Plugin, PluginKey>, any) → Transaction\n // Store a metadata property in this transaction, keyed either by\n // name or by plugin.\n Transaction.prototype.setMeta = function setMeta (key, value) {\n this.meta[typeof key == \"string\" ? key : key.key] = value;\n return this\n };\n\n // :: (union<string, Plugin, PluginKey>) → any\n // Retrieve a metadata property for a given name or plugin.\n Transaction.prototype.getMeta = function getMeta (key) {\n return this.meta[typeof key == \"string\" ? key : key.key]\n };\n\n // :: bool\n // Returns true if this transaction doesn't contain any metadata,\n // and can thus safely be extended.\n prototypeAccessors.isGeneric.get = function () {\n for (var _ in this.meta) { return false }\n return true\n };\n\n // :: () → Transaction\n // Indicate that the editor should scroll the selection into view\n // when updated to the state produced by this transaction.\n Transaction.prototype.scrollIntoView = function scrollIntoView () {\n this.updated |= UPDATED_SCROLL;\n return this\n };\n\n prototypeAccessors.scrolledIntoView.get = function () {\n return (this.updated & UPDATED_SCROLL) > 0\n };\n\n Object.defineProperties( Transaction.prototype, prototypeAccessors );\n\n return Transaction;\n}(Transform));\n\nfunction bind(f, self) {\n return !self || !f ? f : f.bind(self)\n}\n\nvar FieldDesc = function FieldDesc(name, desc, self) {\n this.name = name;\n this.init = bind(desc.init, self);\n this.apply = bind(desc.apply, self);\n};\n\nvar baseFields = [\n new FieldDesc(\"doc\", {\n init: function init(config) { return config.doc || config.schema.topNodeType.createAndFill() },\n apply: function apply(tr) { return tr.doc }\n }),\n\n new FieldDesc(\"selection\", {\n init: function init(config, instance) { return config.selection || Selection.atStart(instance.doc) },\n apply: function apply(tr) { return tr.selection }\n }),\n\n new FieldDesc(\"storedMarks\", {\n init: function init(config) { return config.storedMarks || null },\n apply: function apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null }\n }),\n\n new FieldDesc(\"scrollToSelection\", {\n init: function init() { return 0 },\n apply: function apply(tr, prev) { return tr.scrolledIntoView ? prev + 1 : prev }\n })\n];\n\n// Object wrapping the part of a state object that stays the same\n// across transactions. Stored in the state's `config` property.\nvar Configuration = function Configuration(schema, plugins) {\n var this$1 = this;\n\n this.schema = schema;\n this.fields = baseFields.concat();\n this.plugins = [];\n this.pluginsByKey = Object.create(null);\n if (plugins) { plugins.forEach(function (plugin) {\n if (this$1.pluginsByKey[plugin.key])\n { throw new RangeError(\"Adding different instances of a keyed plugin (\" + plugin.key + \")\") }\n this$1.plugins.push(plugin);\n this$1.pluginsByKey[plugin.key] = plugin;\n if (plugin.spec.state)\n { this$1.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin)); }\n }); }\n};\n\n// ::- The state of a ProseMirror editor is represented by an object\n// of this type. A state is a persistent data structure—it isn't\n// updated, but rather a new state value is computed from an old one\n// using the [`apply`](#state.EditorState.apply) method.\n//\n// A state holds a number of built-in fields, and plugins can\n// [define](#state.PluginSpec.state) additional fields.\nvar EditorState = function EditorState(config) {\n this.config = config;\n};\n\nvar prototypeAccessors$1 = { schema: { configurable: true },plugins: { configurable: true },tr: { configurable: true } };\n\n// doc:: Node\n// The current document.\n\n// selection:: Selection\n// The selection.\n\n// storedMarks:: ?[Mark]\n// A set of marks to apply to the next input. Will be null when\n// no explicit marks have been set.\n\n// :: Schema\n// The schema of the state's document.\nprototypeAccessors$1.schema.get = function () {\n return this.config.schema\n};\n\n// :: [Plugin]\n// The plugins that are active in this state.\nprototypeAccessors$1.plugins.get = function () {\n return this.config.plugins\n};\n\n// :: (Transaction) → EditorState\n// Apply the given transaction to produce a new state.\nEditorState.prototype.apply = function apply (tr) {\n return this.applyTransaction(tr).state\n};\n\n// : (Transaction) → bool\nEditorState.prototype.filterTransaction = function filterTransaction (tr, ignore) {\n if ( ignore === void 0 ) ignore = -1;\n\n for (var i = 0; i < this.config.plugins.length; i++) { if (i != ignore) {\n var plugin = this.config.plugins[i];\n if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))\n { return false }\n } }\n return true\n};\n\n// :: (Transaction) → {state: EditorState, transactions: [Transaction]}\n// Verbose variant of [`apply`](#state.EditorState.apply) that\n// returns the precise transactions that were applied (which might\n// be influenced by the [transaction\n// hooks](#state.PluginSpec.filterTransaction) of\n// plugins) along with the new state.\nEditorState.prototype.applyTransaction = function applyTransaction (rootTr) {\n if (!this.filterTransaction(rootTr)) { return {state: this, transactions: []} }\n\n var trs = [rootTr], newState = this.applyInner(rootTr), seen = null;\n // This loop repeatedly gives plugins a chance to respond to\n // transactions as new transactions are added, making sure to only\n // pass the transactions the plugin did not see before.\n for (;;) {\n var haveNew = false;\n for (var i = 0; i < this.config.plugins.length; i++) {\n var plugin = this.config.plugins[i];\n if (plugin.spec.appendTransaction) {\n var n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;\n var tr = n < trs.length &&\n plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);\n if (tr && newState.filterTransaction(tr, i)) {\n tr.setMeta(\"appendedTransaction\", rootTr);\n if (!seen) {\n seen = [];\n for (var j = 0; j < this.config.plugins.length; j++)\n { seen.push(j < i ? {state: newState, n: trs.length} : {state: this, n: 0}); }\n }\n trs.push(tr);\n newState = newState.applyInner(tr);\n haveNew = true;\n }\n if (seen) { seen[i] = {state: newState, n: trs.length}; }\n }\n }\n if (!haveNew) { return {state: newState, transactions: trs} }\n }\n};\n\n// : (Transaction) → EditorState\nEditorState.prototype.applyInner = function applyInner (tr) {\n if (!tr.before.eq(this.doc)) { throw new RangeError(\"Applying a mismatched transaction\") }\n var newInstance = new EditorState(this.config), fields = this.config.fields;\n for (var i = 0; i < fields.length; i++) {\n var field = fields[i];\n newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);\n }\n for (var i$1 = 0; i$1 < applyListeners.length; i$1++) { applyListeners[i$1](this, tr, newInstance); }\n return newInstance\n};\n\n// :: Transaction\n// Start a [transaction](#state.Transaction) from this state.\nprototypeAccessors$1.tr.get = function () { return new Transaction(this) };\n\n// :: (Object) → EditorState\n// Create a new state.\n//\n// config::- Configuration options. Must contain `schema` or `doc` (or both).\n//\n// schema:: ?Schema\n// The schema to use.\n//\n// doc:: ?Node\n// The starting document.\n//\n// selection:: ?Selection\n// A valid selection in the document.\n//\n// storedMarks:: ?[Mark]\n// The initial set of [stored marks](#state.EditorState.storedMarks).\n//\n// plugins:: ?[Plugin]\n// The plugins that should be active in this state.\nEditorState.create = function create (config) {\n var $config = new Configuration(config.schema || config.doc.type.schema, config.plugins);\n var instance = new EditorState($config);\n for (var i = 0; i < $config.fields.length; i++)\n { instance[$config.fields[i].name] = $config.fields[i].init(config, instance); }\n return instance\n};\n\n// :: (Object) → EditorState\n// Create a new state based on this one, but with an adjusted set of\n// active plugins. State fields that exist in both sets of plugins\n// are kept unchanged. Those that no longer exist are dropped, and\n// those that are new are initialized using their\n// [`init`](#state.StateField.init) method, passing in the new\n// configuration object..\n//\n// config::- configuration options\n//\n// schema:: ?Schema\n// New schema to use.\n//\n// plugins:: ?[Plugin]\n// New set of active plugins.\nEditorState.prototype.reconfigure = function reconfigure (config) {\n var $config = new Configuration(config.schema || this.schema, config.plugins);\n var fields = $config.fields, instance = new EditorState($config);\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);\n }\n return instance\n};\n\n// :: (?union<Object<Plugin>, string, number>) → Object\n// Serialize this state to JSON. If you want to serialize the state\n// of plugins, pass an object mapping property names to use in the\n// resulting JSON object to plugin objects. The argument may also be\n// a string or number, in which case it is ignored, to support the\n// way `JSON.stringify` calls `toString` methods.\nEditorState.prototype.toJSON = function toJSON (pluginFields) {\n var result = {doc: this.doc.toJSON(), selection: this.selection.toJSON()};\n if (this.storedMarks) { result.storedMarks = this.storedMarks.map(function (m) { return m.toJSON(); }); }\n if (pluginFields && typeof pluginFields == 'object') { for (var prop in pluginFields) {\n if (prop == \"doc\" || prop == \"selection\")\n { throw new RangeError(\"The JSON fields `doc` and `selection` are reserved\") }\n var plugin = pluginFields[prop], state = plugin.spec.state;\n if (state && state.toJSON) { result[prop] = state.toJSON.call(plugin, this[plugin.key]); }\n } }\n return result\n};\n\n// :: (Object, Object, ?Object<Plugin>) → EditorState\n// Deserialize a JSON representation of a state. `config` should\n// have at least a `schema` field, and should contain array of\n// plugins to initialize the state with. `pluginFields` can be used\n// to deserialize the state of plugins, by associating plugin\n// instances with the property names they use in the JSON object.\n//\n// config::- configuration options\n//\n// schema:: Schema\n// The schema to use.\n//\n// plugins:: ?[Plugin]\n// The set of active plugins.\nEditorState.fromJSON = function fromJSON (config, json, pluginFields) {\n if (!json) { throw new RangeError(\"Invalid input for EditorState.fromJSON\") }\n if (!config.schema) { throw new RangeError(\"Required config field 'schema' missing\") }\n var $config = new Configuration(config.schema, config.plugins);\n var instance = new EditorState($config);\n $config.fields.forEach(function (field) {\n if (field.name == \"doc\") {\n instance.doc = Node.fromJSON(config.schema, json.doc);\n } else if (field.name == \"selection\") {\n instance.selection = Selection.fromJSON(instance.doc, json.selection);\n } else if (field.name == \"storedMarks\") {\n if (json.storedMarks) { instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON); }\n } else {\n if (pluginFields) { for (var prop in pluginFields) {\n var plugin = pluginFields[prop], state = plugin.spec.state;\n if (plugin.key == field.name && state && state.fromJSON &&\n Object.prototype.hasOwnProperty.call(json, prop)) {\n // This field belongs to a plugin mapped to a JSON field, read it from there.\n instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);\n return\n }\n } }\n instance[field.name] = field.init(config, instance);\n }\n });\n return instance\n};\n\n// Kludge to allow the view to track mappings between different\n// instances of a state.\n//\n// FIXME this is no longer needed as of prosemirror-view 1.9.0,\n// though due to backwards-compat we should probably keep it around\n// for a while (if only as a no-op)\nEditorState.addApplyListener = function addApplyListener (f) {\n applyListeners.push(f);\n};\nEditorState.removeApplyListener = function removeApplyListener (f) {\n var found = applyListeners.indexOf(f);\n if (found > -1) { applyListeners.splice(found, 1); }\n};\n\nObject.defineProperties( EditorState.prototype, prototypeAccessors$1 );\n\nvar applyListeners = [];\n\n// PluginSpec:: interface\n//\n// This is the type passed to the [`Plugin`](#state.Plugin)\n// constructor. It provides a definition for a plugin.\n//\n// props:: ?EditorProps\n// The [view props](#view.EditorProps) added by this plugin. Props\n// that are functions will be bound to have the plugin instance as\n// their `this` binding.\n//\n// state:: ?StateField<any>\n// Allows a plugin to define a [state field](#state.StateField), an\n// extra slot in the state object in which it can keep its own data.\n//\n// key:: ?PluginKey\n// Can be used to make this a keyed plugin. You can have only one\n// plugin with a given key in a given state, but it is possible to\n// access the plugin's configuration and state through the key,\n// without having access to the plugin instance object.\n//\n// view:: ?(EditorView) → Object\n// When the plugin needs to interact with the editor view, or\n// set something up in the DOM, use this field. The function\n// will be called when the plugin's state is associated with an\n// editor view.\n//\n// return::-\n// Should return an object with the following optional\n// properties:\n//\n// update:: ?(view: EditorView, prevState: EditorState)\n// Called whenever the view's state is updated.\n//\n// destroy:: ?()\n// Called when the view is destroyed or receives a state\n// with different plugins.\n//\n// filterTransaction:: ?(Transaction, EditorState) → bool\n// When present, this will be called before a transaction is\n// applied by the state, allowing the plugin to cancel it (by\n// returning false).\n//\n// appendTransaction:: ?(transactions: [Transaction], oldState: EditorState, newState: EditorState) → ?Transaction\n// Allows the plugin to append another transaction to be applied\n// after the given array of transactions. When another plugin\n// appends a transaction after this was called, it is called again\n// with the new state and new transactions—but only the new\n// transactions, i.e. it won't be passed transactions that it\n// already saw.\n\nfunction bindProps(obj, self, target) {\n for (var prop in obj) {\n var val = obj[prop];\n if (val instanceof Function) { val = val.bind(self); }\n else if (prop == \"handleDOMEvents\") { val = bindProps(val, self, {}); }\n target[prop] = val;\n }\n return target\n}\n\n// ::- Plugins bundle functionality that can be added to an editor.\n// They are part of the [editor state](#state.EditorState) and\n// may influence that state and the view that contains it.\nvar Plugin = function Plugin(spec) {\n // :: EditorProps\n // The [props](#view.EditorProps) exported by this plugin.\n this.props = {};\n if (spec.props) { bindProps(spec.props, this, this.props); }\n // :: Object\n // The plugin's [spec object](#state.PluginSpec).\n this.spec = spec;\n this.key = spec.key ? spec.key.key : createKey(\"plugin\");\n};\n\n// :: (EditorState) → any\n// Extract the plugin's state field from an editor state.\nPlugin.prototype.getState = function getState (state) { return state[this.key] };\n\n// StateField:: interface<T>\n// A plugin spec may provide a state field (under its\n// [`state`](#state.PluginSpec.state) property) of this type, which\n// describes the state it wants to keep. Functions provided here are\n// always called with the plugin instance as their `this` binding.\n//\n// init:: (config: Object, instance: EditorState) → T\n// Initialize the value of the field. `config` will be the object\n// passed to [`EditorState.create`](#state.EditorState^create). Note\n// that `instance` is a half-initialized state instance, and will\n// not have values for plugin fields initialized after this one.\n//\n// apply:: (tr: Transaction, value: T, oldState: EditorState, newState: EditorState) → T\n// Apply the given transaction to this state field, producing a new\n// field value. Note that the `newState` argument is again a partially\n// constructed state does not yet contain the state from plugins\n// coming after this one.\n//\n// toJSON:: ?(value: T) → *\n// Convert this field to JSON. Optional, can be left off to disable\n// JSON serialization for the field.\n//\n// fromJSON:: ?(config: Object, value: *, state: EditorState) → T\n// Deserialize the JSON representation of this field. Note that the\n// `state` argument is again a half-initialized state.\n\nvar keys = Object.create(null);\n\nfunction createKey(name) {\n if (name in keys) { return name + \"$\" + ++keys[name] }\n keys[name] = 0;\n return name + \"$\"\n}\n\n// ::- A key is used to [tag](#state.PluginSpec.key)\n// plugins in a way that makes it possible to find them, given an\n// editor state. Assigning a key does mean only one plugin of that\n// type can be active in a state.\nvar PluginKey = function PluginKey(name) {\nif ( name === void 0 ) name = \"key\";\n this.key = createKey(name); };\n\n// :: (EditorState) → ?Plugin\n// Get the active plugin with this key, if any, from an editor\n// state.\nPluginKey.prototype.get = function get (state) { return state.config.pluginsByKey[this.key] };\n\n// :: (EditorState) → ?any\n// Get the plugin's state from an editor state.\nPluginKey.prototype.getState = function getState (state) { return state[this.key] };\n\nexport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection, Transaction };\n//# sourceMappingURL=index.es.js.map\n","import { Plugin } from 'prosemirror-state';\nimport { dropPoint } from 'prosemirror-transform';\n\n// :: (options: ?Object) → Plugin\n// Create a plugin that, when added to a ProseMirror instance,\n// causes a decoration to show up at the drop position when something\n// is dragged over the editor.\n//\n// options::- These options are supported:\n//\n// color:: ?string\n// The color of the cursor. Defaults to `black`.\n//\n// width:: ?number\n// The precise width of the cursor in pixels. Defaults to 1.\n//\n// class:: ?string\n// A CSS class name to add to the cursor element.\nfunction dropCursor(options) {\n if ( options === void 0 ) options = {};\n\n return new Plugin({\n view: function view(editorView) { return new DropCursorView(editorView, options) }\n })\n}\n\nvar DropCursorView = function DropCursorView(editorView, options) {\n var this$1 = this;\n\n this.editorView = editorView;\n this.width = options.width || 1;\n this.color = options.color || \"black\";\n this.class = options.class;\n this.cursorPos = null;\n this.element = null;\n this.timeout = null;\n\n this.handlers = [\"dragover\", \"dragend\", \"drop\", \"dragleave\"].map(function (name) {\n var handler = function (e) { return this$1[name](e); };\n editorView.dom.addEventListener(name, handler);\n return {name: name, handler: handler}\n });\n};\n\nDropCursorView.prototype.destroy = function destroy () {\n var this$1 = this;\n\n this.handlers.forEach(function (ref) {\n var name = ref.name;\n var handler = ref.handler;\n\n return this$1.editorView.dom.removeEventListener(name, handler);\n });\n};\n\nDropCursorView.prototype.update = function update (editorView, prevState) {\n if (this.cursorPos != null && prevState.doc != editorView.state.doc) { this.updateOverlay(); }\n};\n\nDropCursorView.prototype.setCursor = function setCursor (pos) {\n if (pos == this.cursorPos) { return }\n this.cursorPos = pos;\n if (pos == null) {\n this.element.parentNode.removeChild(this.element);\n this.element = null;\n } else {\n this.updateOverlay();\n }\n};\n\nDropCursorView.prototype.updateOverlay = function updateOverlay () {\n var $pos = this.editorView.state.doc.resolve(this.cursorPos), rect;\n if (!$pos.parent.inlineContent) {\n var before = $pos.nodeBefore, after = $pos.nodeAfter;\n if (before || after) {\n var nodeRect = this.editorView.nodeDOM(this.cursorPos - (before ?before.nodeSize : 0)).getBoundingClientRect();\n var top = before ? nodeRect.bottom : nodeRect.top;\n if (before && after)\n { top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2; }\n rect = {left: nodeRect.left, right: nodeRect.right, top: top - this.width / 2, bottom: top + this.width / 2};\n }\n }\n if (!rect) {\n var coords = this.editorView.coordsAtPos(this.cursorPos);\n rect = {left: coords.left - this.width / 2, right: coords.left + this.width / 2, top: coords.top, bottom: coords.bottom};\n }\n\n var parent = this.editorView.dom.offsetParent;\n if (!this.element) {\n this.element = parent.appendChild(document.createElement(\"div\"));\n if (this.class) { this.element.className = this.class; }\n this.element.style.cssText = \"position: absolute; z-index: 50; pointer-events: none; background-color: \" + this.color;\n }\n var parentRect = !parent || parent == document.body && getComputedStyle(parent).position == \"static\"\n ? {left: -pageXOffset, top: -pageYOffset} : parent.getBoundingClientRect();\n this.element.style.left = (rect.left - parentRect.left) + \"px\";\n this.element.style.top = (rect.top - parentRect.top) + \"px\";\n this.element.style.width = (rect.right - rect.left) + \"px\";\n this.element.style.height = (rect.bottom - rect.top) + \"px\";\n};\n\nDropCursorView.prototype.scheduleRemoval = function scheduleRemoval (timeout) {\n var this$1 = this;\n\n clearTimeout(this.timeout);\n this.timeout = setTimeout(function () { return this$1.setCursor(null); }, timeout);\n};\n\nDropCursorView.prototype.dragover = function dragover (event) {\n if (!this.editorView.editable) { return }\n var pos = this.editorView.posAtCoords({left: event.clientX, top: event.clientY});\n if (pos) {\n var target = pos.pos;\n if (this.editorView.dragging && this.editorView.dragging.slice) {\n target = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);\n if (target == null) { target = pos.pos; }\n }\n this.setCursor(target);\n this.scheduleRemoval(5000);\n }\n};\n\nDropCursorView.prototype.dragend = function dragend () {\n this.scheduleRemoval(20);\n};\n\nDropCursorView.prototype.drop = function drop () {\n this.scheduleRemoval(20);\n};\n\nDropCursorView.prototype.dragleave = function dragleave (event) {\n if (event.target == this.editorView.dom || !this.editorView.dom.contains(event.relatedTarget))\n { this.setCursor(null); }\n};\n\nexport { dropCursor };\n//# sourceMappingURL=index.es.js.map\n","import { keydownHandler } from 'prosemirror-keymap';\nimport { Selection, Plugin, TextSelection, NodeSelection } from 'prosemirror-state';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\nimport { Slice } from 'prosemirror-model';\n\n// ::- Gap cursor selections are represented using this class. Its\n// `$anchor` and `$head` properties both point at the cursor position.\nvar GapCursor = /*@__PURE__*/(function (Selection) {\n function GapCursor($pos) {\n Selection.call(this, $pos, $pos);\n }\n\n if ( Selection ) GapCursor.__proto__ = Selection;\n GapCursor.prototype = Object.create( Selection && Selection.prototype );\n GapCursor.prototype.constructor = GapCursor;\n\n GapCursor.prototype.map = function map (doc, mapping) {\n var $pos = doc.resolve(mapping.map(this.head));\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos)\n };\n\n GapCursor.prototype.content = function content () { return Slice.empty };\n\n GapCursor.prototype.eq = function eq (other) {\n return other instanceof GapCursor && other.head == this.head\n };\n\n GapCursor.prototype.toJSON = function toJSON () {\n return {type: \"gapcursor\", pos: this.head}\n };\n\n GapCursor.fromJSON = function fromJSON (doc, json) {\n if (typeof json.pos != \"number\") { throw new RangeError(\"Invalid input for GapCursor.fromJSON\") }\n return new GapCursor(doc.resolve(json.pos))\n };\n\n GapCursor.prototype.getBookmark = function getBookmark () { return new GapBookmark(this.anchor) };\n\n GapCursor.valid = function valid ($pos) {\n var parent = $pos.parent;\n if (parent.isTextblock || !closedBefore($pos) || !closedAfter($pos)) { return false }\n var override = parent.type.spec.allowGapCursor;\n if (override != null) { return override }\n var deflt = parent.contentMatchAt($pos.index()).defaultType;\n return deflt && deflt.isTextblock\n };\n\n GapCursor.findFrom = function findFrom ($pos, dir, mustMove) {\n if (!mustMove && GapCursor.valid($pos)) { return $pos }\n\n var pos = $pos.pos, next = null;\n // Scan up from this position\n for (var d = $pos.depth;; d--) {\n var parent = $pos.node(d);\n if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {\n next = parent.maybeChild(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);\n break\n } else if (d == 0) {\n return null\n }\n pos += dir;\n var $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur)) { return $cur }\n }\n\n // And then down into the next node\n for (;;) {\n next = dir > 0 ? next.firstChild : next.lastChild;\n if (!next) { break }\n pos += dir;\n var $cur$1 = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur$1)) { return $cur$1 }\n }\n\n return null\n };\n\n return GapCursor;\n}(Selection));\n\nGapCursor.prototype.visible = false;\n\nSelection.jsonID(\"gapcursor\", GapCursor);\n\nvar GapBookmark = function GapBookmark(pos) {\n this.pos = pos;\n};\nGapBookmark.prototype.map = function map (mapping) {\n return new GapBookmark(mapping.map(this.pos))\n};\nGapBookmark.prototype.resolve = function resolve (doc) {\n var $pos = doc.resolve(this.pos);\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos)\n};\n\nfunction closedBefore($pos) {\n for (var d = $pos.depth; d >= 0; d--) {\n var index = $pos.index(d);\n // At the start of this parent, look at next one\n if (index == 0) { continue }\n // See if the node before (or its first ancestor) is closed\n for (var before = $pos.node(d).child(index - 1);; before = before.lastChild) {\n if ((before.childCount == 0 && !before.inlineContent) || before.isAtom || before.type.spec.isolating) { return true }\n if (before.inlineContent) { return false }\n }\n }\n // Hit start of document\n return true\n}\n\nfunction closedAfter($pos) {\n for (var d = $pos.depth; d >= 0; d--) {\n var index = $pos.indexAfter(d), parent = $pos.node(d);\n if (index == parent.childCount) { continue }\n for (var after = parent.child(index);; after = after.firstChild) {\n if ((after.childCount == 0 && !after.inlineContent) || after.isAtom || after.type.spec.isolating) { return true }\n if (after.inlineContent) { return false }\n }\n }\n return true\n}\n\n// :: () → Plugin\n// Create a gap cursor plugin. When enabled, this will capture clicks\n// near and arrow-key-motion past places that don't have a normally\n// selectable position nearby, and create a gap cursor selection for\n// them. The cursor is drawn as an element with class\n// `ProseMirror-gapcursor`. You can either include\n// `style/gapcursor.css` from the package's directory or add your own\n// styles to make it visible.\nvar gapCursor = function() {\n return new Plugin({\n props: {\n decorations: drawGapCursor,\n\n createSelectionBetween: function createSelectionBetween(_view, $anchor, $head) {\n if ($anchor.pos == $head.pos && GapCursor.valid($head)) { return new GapCursor($head) }\n },\n\n handleClick: handleClick,\n handleKeyDown: handleKeyDown\n }\n })\n};\n\nvar handleKeyDown = keydownHandler({\n \"ArrowLeft\": arrow(\"horiz\", -1),\n \"ArrowRight\": arrow(\"horiz\", 1),\n \"ArrowUp\": arrow(\"vert\", -1),\n \"ArrowDown\": arrow(\"vert\", 1)\n});\n\nfunction arrow(axis, dir) {\n var dirStr = axis == \"vert\" ? (dir > 0 ? \"down\" : \"up\") : (dir > 0 ? \"right\" : \"left\");\n return function(state, dispatch, view) {\n var sel = state.selection;\n var $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;\n if (sel instanceof TextSelection) {\n if (!view.endOfTextblock(dirStr)) { return false }\n mustMove = false;\n $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());\n }\n var $found = GapCursor.findFrom($start, dir, mustMove);\n if (!$found) { return false }\n if (dispatch) { dispatch(state.tr.setSelection(new GapCursor($found))); }\n return true\n }\n}\n\nfunction handleClick(view, pos, event) {\n if (!view.editable) { return false }\n var $pos = view.state.doc.resolve(pos);\n if (!GapCursor.valid($pos)) { return false }\n var ref = view.posAtCoords({left: event.clientX, top: event.clientY});\n var inside = ref.inside;\n if (inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(inside))) { return false }\n view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));\n return true\n}\n\nfunction drawGapCursor(state) {\n if (!(state.selection instanceof GapCursor)) { return null }\n var node = document.createElement(\"div\");\n node.className = \"ProseMirror-gapcursor\";\n return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, {key: \"gapcursor\"})])\n}\n\nexport { GapCursor, gapCursor };\n//# sourceMappingURL=index.es.js.map\n","\n /*!\n * tiptap v1.26.5\n * (c) 2019 Scrumpy UG (limited liability)\n * @license MIT\n */\n \nimport { EditorState, Plugin, PluginKey, TextSelection } from 'prosemirror-state';\nexport { NodeSelection, Plugin, PluginKey, TextSelection } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { Schema, DOMParser, DOMSerializer } from 'prosemirror-model';\nimport { dropCursor } from 'prosemirror-dropcursor';\nimport { gapCursor } from 'prosemirror-gapcursor';\nimport { keymap } from 'prosemirror-keymap';\nimport { baseKeymap } from 'prosemirror-commands';\nimport { inputRules, undoInputRule } from 'prosemirror-inputrules';\nimport { getMarkRange, getMarkAttrs, markIsActive, nodeIsActive } from 'tiptap-utils';\nimport Vue from 'vue';\nimport { setBlockType } from 'tiptap-commands';\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) {\n return;\n }\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nfunction camelCase (str) {\n return str.replace(/(?:^\\w|[A-Z]|\\b\\w)/g, function (word, index) {\n return index === 0 ? word.toLowerCase() : word.toUpperCase();\n }).replace(/\\s+/g, '');\n}\n\nvar ComponentView =\n/*#__PURE__*/\nfunction () {\n function ComponentView(component, _ref) {\n var editor = _ref.editor,\n extension = _ref.extension,\n parent = _ref.parent,\n node = _ref.node,\n view = _ref.view,\n decorations = _ref.decorations,\n getPos = _ref.getPos;\n\n _classCallCheck(this, ComponentView);\n\n this.component = component;\n this.editor = editor;\n this.extension = extension;\n this.parent = parent;\n this.node = node;\n this.view = view;\n this.decorations = decorations;\n this.isNode = !!this.node.marks;\n this.isMark = !this.isNode;\n this.getPos = this.isMark ? this.getMarkPos : getPos;\n this.captureEvents = true;\n this.dom = this.createDOM();\n this.contentDOM = this.vm.$refs.content;\n }\n\n _createClass(ComponentView, [{\n key: \"createDOM\",\n value: function createDOM() {\n var _this = this;\n\n var Component = Vue.extend(this.component);\n var props = {\n editor: this.editor,\n node: this.node,\n view: this.view,\n getPos: function getPos() {\n return _this.getPos();\n },\n decorations: this.decorations,\n selected: false,\n options: this.extension.options,\n updateAttrs: function updateAttrs(attrs) {\n return _this.updateAttrs(attrs);\n }\n };\n\n if (typeof this.extension.setSelection === 'function') {\n this.setSelection = this.extension.setSelection;\n }\n\n this.vm = new Component({\n parent: this.parent,\n propsData: props\n }).$mount();\n return this.vm.$el;\n }\n }, {\n key: \"update\",\n value: function update(node, decorations) {\n if (node.type !== this.node.type) {\n return false;\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true;\n }\n\n this.node = node;\n this.decorations = decorations;\n this.updateComponentProps({\n node: node,\n decorations: decorations\n });\n return true;\n }\n }, {\n key: \"updateComponentProps\",\n value: function updateComponentProps(props) {\n var _this2 = this;\n\n if (!this.vm._props) {\n return;\n } // Update props in component\n // TODO: Avoid mutating a prop directly.\n // Maybe there is a better way to do this?\n\n\n var originalSilent = Vue.config.silent;\n Vue.config.silent = true;\n Object.entries(props).forEach(function (_ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n key = _ref3[0],\n value = _ref3[1];\n\n _this2.vm._props[key] = value;\n }); // this.vm._props.node = node\n // this.vm._props.decorations = decorations\n\n Vue.config.silent = originalSilent;\n }\n }, {\n key: \"updateAttrs\",\n value: function updateAttrs(attrs) {\n if (!this.view.editable) {\n return;\n }\n\n var state = this.view.state;\n var type = this.node.type;\n var pos = this.getPos();\n\n var newAttrs = _objectSpread2({}, this.node.attrs, {}, attrs);\n\n var transaction = this.isMark ? state.tr.removeMark(pos.from, pos.to, type).addMark(pos.from, pos.to, type.create(newAttrs)) : state.tr.setNodeMarkup(pos, null, newAttrs);\n this.view.dispatch(transaction);\n } // prevent a full re-render of the vue component on update\n // we'll handle prop updates in `update()`\n\n }, {\n key: \"ignoreMutation\",\n value: function ignoreMutation(mutation) {\n // allow leaf nodes to be selected\n if (mutation.type === 'selection') {\n return false;\n }\n\n if (!this.contentDOM) {\n return true;\n }\n\n return !this.contentDOM.contains(mutation.target);\n } // disable (almost) all prosemirror event listener for node views\n\n }, {\n key: \"stopEvent\",\n value: function stopEvent(event) {\n var _this3 = this;\n\n if (typeof this.extension.stopEvent === 'function') {\n return this.extension.stopEvent(event);\n }\n\n var draggable = !!this.extension.schema.draggable; // support a custom drag handle\n\n if (draggable && event.type === 'mousedown') {\n var dragHandle = event.target.closest && event.target.closest('[data-drag-handle]');\n var isValidDragHandle = dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle));\n\n if (isValidDragHandle) {\n this.captureEvents = false;\n document.addEventListener('dragend', function () {\n _this3.captureEvents = true;\n }, {\n once: true\n });\n }\n }\n\n var isCopy = event.type === 'copy';\n var isPaste = event.type === 'paste';\n var isCut = event.type === 'cut';\n var isDrag = event.type.startsWith('drag') || event.type === 'drop';\n\n if (draggable && isDrag || isCopy || isPaste || isCut) {\n return false;\n }\n\n return this.captureEvents;\n }\n }, {\n key: \"selectNode\",\n value: function selectNode() {\n this.updateComponentProps({\n selected: true\n });\n }\n }, {\n key: \"deselectNode\",\n value: function deselectNode() {\n this.updateComponentProps({\n selected: false\n });\n }\n }, {\n key: \"getMarkPos\",\n value: function getMarkPos() {\n var pos = this.view.posAtDOM(this.dom);\n var resolvedPos = this.view.state.doc.resolve(pos);\n var range = getMarkRange(resolvedPos, this.node.type);\n return range;\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.vm.$destroy();\n }\n }]);\n\n return ComponentView;\n}();\n\nvar Emitter =\n/*#__PURE__*/\nfunction () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n }\n\n _createClass(Emitter, [{\n key: \"on\",\n // Add an event listener for given event\n value: function on(event, fn) {\n this._callbacks = this._callbacks || {}; // Create namespace for this event\n\n if (!this._callbacks[event]) {\n this._callbacks[event] = [];\n }\n\n this._callbacks[event].push(fn);\n\n return this;\n }\n }, {\n key: \"emit\",\n value: function emit(event) {\n var _this = this;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n this._callbacks = this._callbacks || {};\n var callbacks = this._callbacks[event];\n\n if (callbacks) {\n callbacks.forEach(function (callback) {\n return callback.apply(_this, args);\n });\n }\n\n return this;\n } // Remove event listener for given event.\n // If fn is not provided, all event listeners for that event will be removed.\n // If neither is provided, all event listeners will be removed.\n\n }, {\n key: \"off\",\n value: function off(event, fn) {\n if (!arguments.length) {\n this._callbacks = {};\n } else {\n // event listeners for the given event\n var callbacks = this._callbacks ? this._callbacks[event] : null;\n\n if (callbacks) {\n if (fn) {\n this._callbacks[event] = callbacks.filter(function (cb) {\n return cb !== fn;\n }); // remove specific handler\n } else {\n delete this._callbacks[event]; // remove all handlers\n }\n }\n }\n\n return this;\n }\n }]);\n\n return Emitter;\n}();\n\nvar Extension =\n/*#__PURE__*/\nfunction () {\n function Extension() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Extension);\n\n this.options = _objectSpread2({}, this.defaultOptions, {}, options);\n }\n\n _createClass(Extension, [{\n key: \"init\",\n value: function init() {\n return null;\n }\n }, {\n key: \"bindEditor\",\n value: function bindEditor() {\n var editor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.editor = editor;\n }\n }, {\n key: \"inputRules\",\n value: function inputRules() {\n return [];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules() {\n return [];\n }\n }, {\n key: \"keys\",\n value: function keys() {\n return {};\n }\n }, {\n key: \"name\",\n get: function get() {\n return null;\n }\n }, {\n key: \"type\",\n get: function get() {\n return 'extension';\n }\n }, {\n key: \"update\",\n get: function get() {\n return function () {};\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {};\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [];\n }\n }]);\n\n return Extension;\n}();\n\nvar ExtensionManager =\n/*#__PURE__*/\nfunction () {\n function ExtensionManager() {\n var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var editor = arguments.length > 1 ? arguments[1] : undefined;\n\n _classCallCheck(this, ExtensionManager);\n\n extensions.forEach(function (extension) {\n extension.bindEditor(editor);\n extension.init();\n });\n this.extensions = extensions;\n }\n\n _createClass(ExtensionManager, [{\n key: \"keymaps\",\n value: function keymaps(_ref) {\n var schema = _ref.schema;\n var extensionKeymaps = this.extensions.filter(function (extension) {\n return ['extension'].includes(extension.type);\n }).filter(function (extension) {\n return extension.keys;\n }).map(function (extension) {\n return extension.keys({\n schema: schema\n });\n });\n var nodeMarkKeymaps = this.extensions.filter(function (extension) {\n return ['node', 'mark'].includes(extension.type);\n }).filter(function (extension) {\n return extension.keys;\n }).map(function (extension) {\n return extension.keys({\n type: schema[\"\".concat(extension.type, \"s\")][extension.name],\n schema: schema\n });\n });\n return [].concat(_toConsumableArray(extensionKeymaps), _toConsumableArray(nodeMarkKeymaps)).map(function (keys) {\n return keymap(keys);\n });\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref2) {\n var schema = _ref2.schema,\n excludedExtensions = _ref2.excludedExtensions;\n if (!(excludedExtensions instanceof Array) && excludedExtensions) return [];\n var allowedExtensions = excludedExtensions instanceof Array ? this.extensions.filter(function (extension) {\n return !excludedExtensions.includes(extension.name);\n }) : this.extensions;\n var extensionInputRules = allowedExtensions.filter(function (extension) {\n return ['extension'].includes(extension.type);\n }).filter(function (extension) {\n return extension.inputRules;\n }).map(function (extension) {\n return extension.inputRules({\n schema: schema\n });\n });\n var nodeMarkInputRules = allowedExtensions.filter(function (extension) {\n return ['node', 'mark'].includes(extension.type);\n }).filter(function (extension) {\n return extension.inputRules;\n }).map(function (extension) {\n return extension.inputRules({\n type: schema[\"\".concat(extension.type, \"s\")][extension.name],\n schema: schema\n });\n });\n return [].concat(_toConsumableArray(extensionInputRules), _toConsumableArray(nodeMarkInputRules)).reduce(function (allInputRules, inputRules) {\n return [].concat(_toConsumableArray(allInputRules), _toConsumableArray(inputRules));\n }, []);\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref3) {\n var schema = _ref3.schema,\n excludedExtensions = _ref3.excludedExtensions;\n if (!(excludedExtensions instanceof Array) && excludedExtensions) return [];\n var allowedExtensions = excludedExtensions instanceof Array ? this.extensions.filter(function (extension) {\n return !excludedExtensions.includes(extension.name);\n }) : this.extensions;\n var extensionPasteRules = allowedExtensions.filter(function (extension) {\n return ['extension'].includes(extension.type);\n }).filter(function (extension) {\n return extension.pasteRules;\n }).map(function (extension) {\n return extension.pasteRules({\n schema: schema\n });\n });\n var nodeMarkPasteRules = allowedExtensions.filter(function (extension) {\n return ['node', 'mark'].includes(extension.type);\n }).filter(function (extension) {\n return extension.pasteRules;\n }).map(function (extension) {\n return extension.pasteRules({\n type: schema[\"\".concat(extension.type, \"s\")][extension.name],\n schema: schema\n });\n });\n return [].concat(_toConsumableArray(extensionPasteRules), _toConsumableArray(nodeMarkPasteRules)).reduce(function (allPasteRules, pasteRules) {\n return [].concat(_toConsumableArray(allPasteRules), _toConsumableArray(pasteRules));\n }, []);\n }\n }, {\n key: \"commands\",\n value: function commands(_ref4) {\n var schema = _ref4.schema,\n view = _ref4.view;\n return this.extensions.filter(function (extension) {\n return extension.commands;\n }).reduce(function (allCommands, extension) {\n var name = extension.name,\n type = extension.type;\n var commands = {};\n var value = extension.commands(_objectSpread2({\n schema: schema\n }, ['node', 'mark'].includes(type) ? {\n type: schema[\"\".concat(type, \"s\")][name]\n } : {}));\n\n var apply = function apply(cb, attrs) {\n if (!view.editable) {\n return false;\n }\n\n view.focus();\n return cb(attrs)(view.state, view.dispatch, view);\n };\n\n var handle = function handle(_name, _value) {\n if (Array.isArray(_value)) {\n commands[_name] = function (attrs) {\n return _value.forEach(function (callback) {\n return apply(callback, attrs);\n });\n };\n } else if (typeof _value === 'function') {\n commands[_name] = function (attrs) {\n return apply(_value, attrs);\n };\n }\n };\n\n if (_typeof(value) === 'object') {\n Object.entries(value).forEach(function (_ref5) {\n var _ref6 = _slicedToArray(_ref5, 2),\n commandName = _ref6[0],\n commandValue = _ref6[1];\n\n handle(commandName, commandValue);\n });\n } else {\n handle(name, value);\n }\n\n return _objectSpread2({}, allCommands, {}, commands);\n }, {});\n }\n }, {\n key: \"nodes\",\n get: function get() {\n return this.extensions.filter(function (extension) {\n return extension.type === 'node';\n }).reduce(function (nodes, _ref7) {\n var name = _ref7.name,\n schema = _ref7.schema;\n return _objectSpread2({}, nodes, _defineProperty({}, name, schema));\n }, {});\n }\n }, {\n key: \"options\",\n get: function get() {\n var view = this.view;\n return this.extensions.reduce(function (nodes, extension) {\n return _objectSpread2({}, nodes, _defineProperty({}, extension.name, new Proxy(extension.options, {\n set: function set(obj, prop, value) {\n var changed = obj[prop] !== value;\n Object.assign(obj, _defineProperty({}, prop, value));\n\n if (changed) {\n extension.update(view);\n }\n\n return true;\n }\n })));\n }, {});\n }\n }, {\n key: \"marks\",\n get: function get() {\n return this.extensions.filter(function (extension) {\n return extension.type === 'mark';\n }).reduce(function (marks, _ref8) {\n var name = _ref8.name,\n schema = _ref8.schema;\n return _objectSpread2({}, marks, _defineProperty({}, name, schema));\n }, {});\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return this.extensions.filter(function (extension) {\n return extension.plugins;\n }).reduce(function (allPlugins, _ref9) {\n var plugins = _ref9.plugins;\n return [].concat(_toConsumableArray(allPlugins), _toConsumableArray(plugins));\n }, []);\n }\n }]);\n\n return ExtensionManager;\n}();\n\nfunction injectCSS (css) {\n if (process.env.NODE_ENV !== 'test') {\n var style = document.createElement('style');\n style.type = 'text/css';\n style.textContent = css;\n var _document = document,\n head = _document.head;\n var firstChild = head.firstChild;\n\n if (firstChild) {\n head.insertBefore(style, firstChild);\n } else {\n head.appendChild(style);\n }\n }\n}\n\nvar Mark =\n/*#__PURE__*/\nfunction (_Extension) {\n _inherits(Mark, _Extension);\n\n function Mark() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Mark);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Mark).call(this, options));\n }\n\n _createClass(Mark, [{\n key: \"command\",\n value: function command() {\n return function () {};\n }\n }, {\n key: \"type\",\n get: function get() {\n return 'mark';\n }\n }, {\n key: \"view\",\n get: function get() {\n return null;\n }\n }, {\n key: \"schema\",\n get: function get() {\n return null;\n }\n }]);\n\n return Mark;\n}(Extension);\n\nfunction minMax() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n return Math.min(Math.max(parseInt(value, 10), min), max);\n}\n\nvar Node =\n/*#__PURE__*/\nfunction (_Extension) {\n _inherits(Node, _Extension);\n\n function Node() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Node);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Node).call(this, options));\n }\n\n _createClass(Node, [{\n key: \"command\",\n value: function command() {\n return function () {};\n }\n }, {\n key: \"type\",\n get: function get() {\n return 'node';\n }\n }, {\n key: \"view\",\n get: function get() {\n return null;\n }\n }, {\n key: \"schema\",\n get: function get() {\n return null;\n }\n }]);\n\n return Node;\n}(Extension);\n\nvar Doc =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Doc, _Node);\n\n function Doc() {\n _classCallCheck(this, Doc);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Doc).apply(this, arguments));\n }\n\n _createClass(Doc, [{\n key: \"name\",\n get: function get() {\n return 'doc';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'block+'\n };\n }\n }]);\n\n return Doc;\n}(Node);\n\nvar Paragraph =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Paragraph, _Node);\n\n function Paragraph() {\n _classCallCheck(this, Paragraph);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Paragraph).apply(this, arguments));\n }\n\n _createClass(Paragraph, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type;\n return function () {\n return setBlockType(type);\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'paragraph';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'inline*',\n group: 'block',\n draggable: false,\n parseDOM: [{\n tag: 'p'\n }],\n toDOM: function toDOM() {\n return ['p', 0];\n }\n };\n }\n }]);\n\n return Paragraph;\n}(Node);\n\nvar Text =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Text, _Node);\n\n function Text() {\n _classCallCheck(this, Text);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Text).apply(this, arguments));\n }\n\n _createClass(Text, [{\n key: \"name\",\n get: function get() {\n return 'text';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n group: 'inline'\n };\n }\n }]);\n\n return Text;\n}(Node);\n\nvar css = \".ProseMirror {\\n position: relative;\\n}\\n\\n.ProseMirror {\\n word-wrap: break-word;\\n white-space: pre-wrap;\\n -webkit-font-variant-ligatures: none;\\n font-variant-ligatures: none;\\n}\\n\\n.ProseMirror pre {\\n white-space: pre-wrap;\\n}\\n\\n.ProseMirror-gapcursor {\\n display: none;\\n pointer-events: none;\\n position: absolute;\\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\";\n\nvar Editor =\n/*#__PURE__*/\nfunction (_Emitter) {\n _inherits(Editor, _Emitter);\n\n function Editor() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Editor);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(Editor).call(this));\n _this.defaultOptions = {\n editorProps: {},\n editable: true,\n autoFocus: null,\n extensions: [],\n content: '',\n topNode: 'doc',\n emptyDocument: {\n type: 'doc',\n content: [{\n type: 'paragraph'\n }]\n },\n useBuiltInExtensions: true,\n disableInputRules: false,\n disablePasteRules: false,\n dropCursor: {},\n parseOptions: {},\n injectCSS: true,\n onInit: function onInit() {},\n onTransaction: function onTransaction() {},\n onUpdate: function onUpdate() {},\n onFocus: function onFocus() {},\n onBlur: function onBlur() {},\n onPaste: function onPaste() {},\n onDrop: function onDrop() {}\n };\n _this.events = ['init', 'transaction', 'update', 'focus', 'blur', 'paste', 'drop'];\n\n _this.init(options);\n\n return _this;\n }\n\n _createClass(Editor, [{\n key: \"init\",\n value: function init() {\n var _this2 = this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.setOptions(_objectSpread2({}, this.defaultOptions, {}, options));\n this.focused = false;\n this.selection = {\n from: 0,\n to: 0\n };\n this.element = document.createElement('div');\n this.extensions = this.createExtensions();\n this.nodes = this.createNodes();\n this.marks = this.createMarks();\n this.schema = this.createSchema();\n this.plugins = this.createPlugins();\n this.keymaps = this.createKeymaps();\n this.inputRules = this.createInputRules();\n this.pasteRules = this.createPasteRules();\n this.view = this.createView();\n this.commands = this.createCommands();\n this.setActiveNodesAndMarks();\n\n if (this.options.injectCSS) {\n injectCSS(css);\n }\n\n if (this.options.autoFocus !== null) {\n this.focus(this.options.autoFocus);\n }\n\n this.events.forEach(function (name) {\n _this2.on(name, _this2.options[camelCase(\"on \".concat(name))] || function () {});\n });\n this.emit('init', {\n view: this.view,\n state: this.state\n }); // give extension manager access to our view\n\n this.extensions.view = this.view;\n }\n }, {\n key: \"setOptions\",\n value: function setOptions(options) {\n this.options = _objectSpread2({}, this.options, {}, options);\n\n if (this.view && this.state) {\n this.view.updateState(this.state);\n }\n }\n }, {\n key: \"createExtensions\",\n value: function createExtensions() {\n return new ExtensionManager([].concat(_toConsumableArray(this.builtInExtensions), _toConsumableArray(this.options.extensions)), this);\n }\n }, {\n key: \"createPlugins\",\n value: function createPlugins() {\n return this.extensions.plugins;\n }\n }, {\n key: \"createKeymaps\",\n value: function createKeymaps() {\n return this.extensions.keymaps({\n schema: this.schema\n });\n }\n }, {\n key: \"createInputRules\",\n value: function createInputRules() {\n return this.extensions.inputRules({\n schema: this.schema,\n excludedExtensions: this.options.disableInputRules\n });\n }\n }, {\n key: \"createPasteRules\",\n value: function createPasteRules() {\n return this.extensions.pasteRules({\n schema: this.schema,\n excludedExtensions: this.options.disablePasteRules\n });\n }\n }, {\n key: \"createCommands\",\n value: function createCommands() {\n return this.extensions.commands({\n schema: this.schema,\n view: this.view\n });\n }\n }, {\n key: \"createNodes\",\n value: function createNodes() {\n return this.extensions.nodes;\n }\n }, {\n key: \"createMarks\",\n value: function createMarks() {\n return this.extensions.marks;\n }\n }, {\n key: \"createSchema\",\n value: function createSchema() {\n return new Schema({\n topNode: this.options.topNode,\n nodes: this.nodes,\n marks: this.marks\n });\n }\n }, {\n key: \"createState\",\n value: function createState() {\n var _this3 = this;\n\n return EditorState.create({\n schema: this.schema,\n doc: this.createDocument(this.options.content),\n plugins: [].concat(_toConsumableArray(this.plugins), [inputRules({\n rules: this.inputRules\n })], _toConsumableArray(this.pasteRules), _toConsumableArray(this.keymaps), [keymap({\n Backspace: undoInputRule\n }), keymap(baseKeymap), dropCursor(this.options.dropCursor), gapCursor(), new Plugin({\n key: new PluginKey('editable'),\n props: {\n editable: function editable() {\n return _this3.options.editable;\n }\n }\n }), new Plugin({\n props: {\n attributes: {\n tabindex: 0\n },\n handleDOMEvents: {\n focus: function focus(view, event) {\n _this3.focused = true;\n\n _this3.emit('focus', {\n event: event,\n state: view.state,\n view: view\n });\n\n var transaction = _this3.state.tr.setMeta('focused', true);\n\n _this3.view.dispatch(transaction);\n },\n blur: function blur(view, event) {\n _this3.focused = false;\n\n _this3.emit('blur', {\n event: event,\n state: view.state,\n view: view\n });\n\n var transaction = _this3.state.tr.setMeta('focused', false);\n\n _this3.view.dispatch(transaction);\n }\n }\n }\n }), new Plugin({\n props: this.options.editorProps\n })])\n });\n }\n }, {\n key: \"createDocument\",\n value: function createDocument(content) {\n var parseOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.parseOptions;\n\n if (content === null) {\n return this.schema.nodeFromJSON(this.options.emptyDocument);\n }\n\n if (_typeof(content) === 'object') {\n try {\n return this.schema.nodeFromJSON(content);\n } catch (error) {\n console.warn('[tiptap warn]: Invalid content.', 'Passed value:', content, 'Error:', error);\n return this.schema.nodeFromJSON(this.options.emptyDocument);\n }\n }\n\n if (typeof content === 'string') {\n var element = document.createElement('div');\n element.innerHTML = content.trim();\n return DOMParser.fromSchema(this.schema).parse(element, parseOptions);\n }\n\n return false;\n }\n }, {\n key: \"createView\",\n value: function createView() {\n var _this4 = this;\n\n return new EditorView(this.element, {\n state: this.createState(),\n handlePaste: function handlePaste() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this4.emit.apply(_this4, ['paste'].concat(args));\n },\n handleDrop: function handleDrop() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n _this4.emit.apply(_this4, ['drop'].concat(args));\n },\n dispatchTransaction: this.dispatchTransaction.bind(this)\n });\n }\n }, {\n key: \"setParentComponent\",\n value: function setParentComponent() {\n var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (!component) {\n return;\n }\n\n this.view.setProps({\n nodeViews: this.initNodeViews({\n parent: component,\n extensions: [].concat(_toConsumableArray(this.builtInExtensions), _toConsumableArray(this.options.extensions))\n })\n });\n }\n }, {\n key: \"initNodeViews\",\n value: function initNodeViews(_ref) {\n var _this5 = this;\n\n var parent = _ref.parent,\n extensions = _ref.extensions;\n return extensions.filter(function (extension) {\n return ['node', 'mark'].includes(extension.type);\n }).filter(function (extension) {\n return extension.view;\n }).reduce(function (nodeViews, extension) {\n var nodeView = function nodeView(node, view, getPos, decorations) {\n var component = extension.view;\n return new ComponentView(component, {\n editor: _this5,\n extension: extension,\n parent: parent,\n node: node,\n view: view,\n getPos: getPos,\n decorations: decorations\n });\n };\n\n return _objectSpread2({}, nodeViews, _defineProperty({}, extension.name, nodeView));\n }, {});\n }\n }, {\n key: \"dispatchTransaction\",\n value: function dispatchTransaction(transaction) {\n var newState = this.state.apply(transaction);\n this.view.updateState(newState);\n this.selection = {\n from: this.state.selection.from,\n to: this.state.selection.to\n };\n this.setActiveNodesAndMarks();\n this.emit('transaction', {\n getHTML: this.getHTML.bind(this),\n getJSON: this.getJSON.bind(this),\n state: this.state,\n transaction: transaction\n });\n\n if (!transaction.docChanged || transaction.getMeta('preventUpdate')) {\n return;\n }\n\n this.emitUpdate(transaction);\n }\n }, {\n key: \"emitUpdate\",\n value: function emitUpdate(transaction) {\n this.emit('update', {\n getHTML: this.getHTML.bind(this),\n getJSON: this.getJSON.bind(this),\n state: this.state,\n transaction: transaction\n });\n }\n }, {\n key: \"resolveSelection\",\n value: function resolveSelection() {\n var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (this.selection && position === null) {\n return this.selection;\n }\n\n if (position === 'start' || position === true) {\n return {\n from: 0,\n to: 0\n };\n }\n\n if (position === 'end') {\n var doc = this.state.doc;\n return {\n from: doc.content.size,\n to: doc.content.size\n };\n }\n\n return {\n from: position,\n to: position\n };\n }\n }, {\n key: \"focus\",\n value: function focus() {\n var _this6 = this;\n\n var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (this.view.focused && position === null || position === false) {\n return;\n }\n\n var _this$resolveSelectio = this.resolveSelection(position),\n from = _this$resolveSelectio.from,\n to = _this$resolveSelectio.to;\n\n this.setSelection(from, to);\n setTimeout(function () {\n return _this6.view.focus();\n }, 10);\n }\n }, {\n key: \"setSelection\",\n value: function setSelection() {\n var from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var _this$state = this.state,\n doc = _this$state.doc,\n tr = _this$state.tr;\n var resolvedFrom = minMax(from, 0, doc.content.size);\n var resolvedEnd = minMax(to, 0, doc.content.size);\n var selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);\n var transaction = tr.setSelection(selection);\n this.view.dispatch(transaction);\n }\n }, {\n key: \"blur\",\n value: function blur() {\n this.view.dom.blur();\n }\n }, {\n key: \"getSchemaJSON\",\n value: function getSchemaJSON() {\n return JSON.parse(JSON.stringify({\n nodes: this.extensions.nodes,\n marks: this.extensions.marks\n }));\n }\n }, {\n key: \"getHTML\",\n value: function getHTML() {\n var div = document.createElement('div');\n var fragment = DOMSerializer.fromSchema(this.schema).serializeFragment(this.state.doc.content);\n div.appendChild(fragment);\n return div.innerHTML;\n }\n }, {\n key: \"getJSON\",\n value: function getJSON() {\n return this.state.doc.toJSON();\n }\n }, {\n key: \"setContent\",\n value: function setContent() {\n var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var emitUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var parseOptions = arguments.length > 2 ? arguments[2] : undefined;\n var _this$state2 = this.state,\n doc = _this$state2.doc,\n tr = _this$state2.tr;\n var document = this.createDocument(content, parseOptions);\n var selection = TextSelection.create(doc, 0, doc.content.size);\n var transaction = tr.setSelection(selection).replaceSelectionWith(document, false).setMeta('preventUpdate', !emitUpdate);\n this.view.dispatch(transaction);\n }\n }, {\n key: \"clearContent\",\n value: function clearContent() {\n var emitUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.setContent(this.options.emptyDocument, emitUpdate);\n }\n }, {\n key: \"setActiveNodesAndMarks\",\n value: function setActiveNodesAndMarks() {\n var _this7 = this;\n\n this.activeMarks = Object.entries(this.schema.marks).reduce(function (marks, _ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n name = _ref3[0],\n mark = _ref3[1];\n\n return _objectSpread2({}, marks, _defineProperty({}, name, function () {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return markIsActive(_this7.state, mark, attrs);\n }));\n }, {});\n this.activeMarkAttrs = Object.entries(this.schema.marks).reduce(function (marks, _ref4) {\n var _ref5 = _slicedToArray(_ref4, 2),\n name = _ref5[0],\n mark = _ref5[1];\n\n return _objectSpread2({}, marks, _defineProperty({}, name, getMarkAttrs(_this7.state, mark)));\n }, {});\n this.activeNodes = Object.entries(this.schema.nodes).reduce(function (nodes, _ref6) {\n var _ref7 = _slicedToArray(_ref6, 2),\n name = _ref7[0],\n node = _ref7[1];\n\n return _objectSpread2({}, nodes, _defineProperty({}, name, function () {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return nodeIsActive(_this7.state, node, attrs);\n }));\n }, {});\n }\n }, {\n key: \"getMarkAttrs\",\n value: function getMarkAttrs() {\n var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n return this.activeMarkAttrs[type];\n }\n }, {\n key: \"registerPlugin\",\n value: function registerPlugin() {\n var plugin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (!plugin) {\n return;\n }\n\n var newState = this.state.reconfigure({\n plugins: this.state.plugins.concat([plugin])\n });\n this.view.updateState(newState);\n }\n }, {\n key: \"unregisterPlugin\",\n value: function unregisterPlugin() {\n var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (!name || !this.view.docView) {\n return;\n }\n\n var newState = this.state.reconfigure({\n plugins: this.state.plugins.filter(function (plugin) {\n return !plugin.key.startsWith(\"\".concat(name, \"$\"));\n })\n });\n this.view.updateState(newState);\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n if (!this.view) {\n return;\n }\n\n this.view.destroy();\n }\n }, {\n key: \"builtInExtensions\",\n get: function get() {\n if (!this.options.useBuiltInExtensions) {\n return [];\n }\n\n return [new Doc(), new Text(), new Paragraph()];\n }\n }, {\n key: \"state\",\n get: function get() {\n return this.view ? this.view.state : null;\n }\n }, {\n key: \"isActive\",\n get: function get() {\n return Object.entries(_objectSpread2({}, this.activeMarks, {}, this.activeNodes)).reduce(function (types, _ref8) {\n var _ref9 = _slicedToArray(_ref8, 2),\n name = _ref9[0],\n value = _ref9[1];\n\n return _objectSpread2({}, types, _defineProperty({}, name, function () {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return value(attrs);\n }));\n }, {});\n }\n }]);\n\n return Editor;\n}(Emitter);\n\nvar EditorContent = {\n props: {\n editor: {\n default: null,\n type: Object\n }\n },\n watch: {\n editor: {\n immediate: true,\n handler: function handler(editor) {\n var _this = this;\n\n if (editor && editor.element) {\n this.$nextTick(function () {\n _this.$el.appendChild(editor.element.firstChild);\n\n editor.setParentComponent(_this);\n });\n }\n }\n }\n },\n render: function render(createElement) {\n return createElement('div');\n },\n beforeDestroy: function beforeDestroy() {\n this.editor.element = this.$el;\n }\n};\n\nvar Menu =\n/*#__PURE__*/\nfunction () {\n function Menu(_ref) {\n var _this = this;\n\n var options = _ref.options;\n\n _classCallCheck(this, Menu);\n\n this.options = options;\n this.preventHide = false; // the mousedown event is fired before blur so we can prevent it\n\n this.mousedownHandler = this.handleClick.bind(this);\n this.options.element.addEventListener('mousedown', this.mousedownHandler);\n this.options.editor.on('blur', function () {\n if (_this.preventHide) {\n _this.preventHide = false;\n return;\n }\n\n _this.options.editor.emit('menubar:focusUpdate', false);\n });\n }\n\n _createClass(Menu, [{\n key: \"handleClick\",\n value: function handleClick() {\n this.preventHide = true;\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.options.element.removeEventListener('mousedown', this.mousedownHandler);\n }\n }]);\n\n return Menu;\n}();\n\nfunction MenuBar (options) {\n return new Plugin({\n key: new PluginKey('menu_bar'),\n view: function view(editorView) {\n return new Menu({\n editorView: editorView,\n options: options\n });\n }\n });\n}\n\nvar EditorMenuBar = {\n props: {\n editor: {\n default: null,\n type: Object\n }\n },\n data: function data() {\n return {\n focused: false\n };\n },\n watch: {\n editor: {\n immediate: true,\n handler: function handler(editor) {\n var _this = this;\n\n if (editor) {\n this.$nextTick(function () {\n editor.registerPlugin(MenuBar({\n editor: editor,\n element: _this.$el\n }));\n _this.focused = editor.focused;\n editor.on('focus', function () {\n _this.focused = true;\n });\n editor.on('menubar:focusUpdate', function (focused) {\n _this.focused = focused;\n });\n });\n }\n }\n }\n },\n render: function render() {\n if (!this.editor) {\n return null;\n }\n\n return this.$scopedSlots.default({\n focused: this.focused,\n focus: this.editor.focus,\n commands: this.editor.commands,\n isActive: this.editor.isActive,\n getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor)\n });\n }\n};\n\nfunction textRange(node, from, to) {\n var range = document.createRange();\n range.setEnd(node, to == null ? node.nodeValue.length : to);\n range.setStart(node, from || 0);\n return range;\n}\n\nfunction singleRect(object, bias) {\n var rects = object.getClientRects();\n return !rects.length ? object.getBoundingClientRect() : rects[bias < 0 ? 0 : rects.length - 1];\n}\n\nfunction coordsAtPos(view, pos) {\n var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n var _view$docView$domFrom = view.docView.domFromPos(pos),\n node = _view$docView$domFrom.node,\n offset = _view$docView$domFrom.offset;\n\n var side;\n var rect;\n\n if (node.nodeType === 3) {\n if (end && offset < node.nodeValue.length) {\n rect = singleRect(textRange(node, offset - 1, offset), -1);\n side = 'right';\n } else if (offset < node.nodeValue.length) {\n rect = singleRect(textRange(node, offset, offset + 1), -1);\n side = 'left';\n }\n } else if (node.firstChild) {\n if (offset < node.childNodes.length) {\n var child = node.childNodes[offset];\n rect = singleRect(child.nodeType === 3 ? textRange(child) : child, -1);\n side = 'left';\n }\n\n if ((!rect || rect.top === rect.bottom) && offset) {\n var _child = node.childNodes[offset - 1];\n rect = singleRect(_child.nodeType === 3 ? textRange(_child) : _child, 1);\n side = 'right';\n }\n } else {\n rect = node.getBoundingClientRect();\n side = 'left';\n }\n\n var x = rect[side];\n return {\n top: rect.top,\n bottom: rect.bottom,\n left: x,\n right: x\n };\n}\n\nvar Menu$1 =\n/*#__PURE__*/\nfunction () {\n function Menu(_ref) {\n var _this = this;\n\n var options = _ref.options,\n editorView = _ref.editorView;\n\n _classCallCheck(this, Menu);\n\n this.options = _objectSpread2({}, {\n element: null,\n keepInBounds: true,\n onUpdate: function onUpdate() {\n return false;\n }\n }, {}, options);\n this.editorView = editorView;\n this.isActive = false;\n this.left = 0;\n this.bottom = 0;\n this.top = 0;\n this.preventHide = false; // the mousedown event is fired before blur so we can prevent it\n\n this.mousedownHandler = this.handleClick.bind(this);\n this.options.element.addEventListener('mousedown', this.mousedownHandler);\n this.options.editor.on('focus', function (_ref2) {\n var view = _ref2.view;\n\n _this.update(view);\n });\n this.options.editor.on('blur', function (_ref3) {\n var event = _ref3.event;\n\n if (_this.preventHide) {\n _this.preventHide = false;\n return;\n }\n\n _this.hide(event);\n });\n }\n\n _createClass(Menu, [{\n key: \"handleClick\",\n value: function handleClick() {\n this.preventHide = true;\n }\n }, {\n key: \"update\",\n value: function update(view, lastState) {\n var state = view.state;\n\n if (view.composing) {\n return;\n } // Don't do anything if the document/selection didn't change\n\n\n if (lastState && lastState.doc.eq(state.doc) && lastState.selection.eq(state.selection)) {\n return;\n } // Hide the tooltip if the selection is empty\n\n\n if (state.selection.empty) {\n this.hide();\n return;\n } // Otherwise, reposition it and update its content\n\n\n var _state$selection = state.selection,\n from = _state$selection.from,\n to = _state$selection.to; // These are in screen coordinates\n // We can't use EditorView.cordsAtPos here because it can't handle linebreaks correctly\n // See: https://github.com/ProseMirror/prosemirror-view/pull/47\n\n var start = coordsAtPos(view, from);\n var end = coordsAtPos(view, to, true); // The box in which the tooltip is positioned, to use as base\n\n var parent = this.options.element.offsetParent;\n\n if (!parent) {\n this.hide();\n return;\n }\n\n var box = parent.getBoundingClientRect();\n var el = this.options.element.getBoundingClientRect(); // Find a center-ish x position from the selection endpoints (when\n // crossing lines, end may be more to the left)\n\n var left = (start.left + end.left) / 2 - box.left; // Keep the menuBubble in the bounding box of the offsetParent i\n\n this.left = Math.round(this.options.keepInBounds ? Math.min(box.width - el.width / 2, Math.max(left, el.width / 2)) : left);\n this.bottom = Math.round(box.bottom - start.top);\n this.top = Math.round(end.bottom - box.top);\n this.isActive = true;\n this.sendUpdate();\n }\n }, {\n key: \"sendUpdate\",\n value: function sendUpdate() {\n this.options.onUpdate({\n isActive: this.isActive,\n left: this.left,\n bottom: this.bottom,\n top: this.top\n });\n }\n }, {\n key: \"hide\",\n value: function hide(event) {\n if (event && event.relatedTarget && this.options.element.parentNode.contains(event.relatedTarget)) {\n return;\n }\n\n this.isActive = false;\n this.sendUpdate();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.options.element.removeEventListener('mousedown', this.mousedownHandler);\n }\n }]);\n\n return Menu;\n}();\n\nfunction MenuBubble (options) {\n return new Plugin({\n key: new PluginKey('menu_bubble'),\n view: function view(editorView) {\n return new Menu$1({\n editorView: editorView,\n options: options\n });\n }\n });\n}\n\nvar EditorMenuBubble = {\n props: {\n editor: {\n default: null,\n type: Object\n },\n keepInBounds: {\n default: true,\n type: Boolean\n }\n },\n data: function data() {\n return {\n menu: {\n isActive: false,\n left: 0,\n bottom: 0\n }\n };\n },\n watch: {\n editor: {\n immediate: true,\n handler: function handler(editor) {\n var _this = this;\n\n if (editor) {\n this.$nextTick(function () {\n editor.registerPlugin(MenuBubble({\n editor: editor,\n element: _this.$el,\n keepInBounds: _this.keepInBounds,\n onUpdate: function onUpdate(menu) {\n // the second check ensures event is fired only once\n if (menu.isActive && _this.menu.isActive === false) {\n _this.$emit('show', menu);\n } else if (!menu.isActive && _this.menu.isActive === true) {\n _this.$emit('hide', menu);\n }\n\n _this.menu = menu;\n }\n }));\n });\n }\n }\n }\n },\n render: function render() {\n if (!this.editor) {\n return null;\n }\n\n return this.$scopedSlots.default({\n focused: this.editor.view.focused,\n focus: this.editor.focus,\n commands: this.editor.commands,\n isActive: this.editor.isActive,\n getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor),\n menu: this.menu\n });\n },\n beforeDestroy: function beforeDestroy() {\n this.editor.unregisterPlugin('menu_bubble');\n }\n};\n\nvar Menu$2 =\n/*#__PURE__*/\nfunction () {\n function Menu(_ref) {\n var _this = this;\n\n var options = _ref.options,\n editorView = _ref.editorView;\n\n _classCallCheck(this, Menu);\n\n this.options = _objectSpread2({}, {\n resizeObserver: true,\n element: null,\n onUpdate: function onUpdate() {\n return false;\n }\n }, {}, options);\n this.preventHide = false;\n this.editorView = editorView;\n this.isActive = false;\n this.top = 0; // the mousedown event is fired before blur so we can prevent it\n\n this.mousedownHandler = this.handleClick.bind(this);\n this.options.element.addEventListener('mousedown', this.mousedownHandler);\n this.options.editor.on('focus', function (_ref2) {\n var view = _ref2.view;\n\n _this.update(view);\n });\n this.options.editor.on('blur', function (_ref3) {\n var event = _ref3.event;\n\n if (_this.preventHide) {\n _this.preventHide = false;\n return;\n }\n\n _this.hide(event);\n }); // sometimes we have to update the position\n // because of a loaded images for example\n\n if (this.options.resizeObserver && window.ResizeObserver) {\n this.resizeObserver = new ResizeObserver(function () {\n if (_this.isActive) {\n _this.update(_this.editorView);\n }\n });\n this.resizeObserver.observe(this.editorView.dom);\n }\n }\n\n _createClass(Menu, [{\n key: \"handleClick\",\n value: function handleClick() {\n this.preventHide = true;\n }\n }, {\n key: \"update\",\n value: function update(view, lastState) {\n var state = view.state; // Don't do anything if the document/selection didn't change\n\n if (lastState && lastState.doc.eq(state.doc) && lastState.selection.eq(state.selection)) {\n return;\n }\n\n if (!state.selection.empty) {\n this.hide();\n return;\n }\n\n var currentDom = view.domAtPos(state.selection.anchor);\n var isActive = currentDom.node.innerHTML === '<br>' && currentDom.node.tagName === 'P' && currentDom.node.parentNode === view.dom;\n\n if (!isActive) {\n this.hide();\n return;\n }\n\n var parent = this.options.element.offsetParent;\n\n if (!parent) {\n this.hide();\n return;\n }\n\n var editorBoundings = parent.getBoundingClientRect();\n var cursorBoundings = view.coordsAtPos(state.selection.anchor);\n var top = cursorBoundings.top - editorBoundings.top;\n this.isActive = true;\n this.top = top;\n this.sendUpdate();\n }\n }, {\n key: \"sendUpdate\",\n value: function sendUpdate() {\n this.options.onUpdate({\n isActive: this.isActive,\n top: this.top\n });\n }\n }, {\n key: \"hide\",\n value: function hide(event) {\n if (event && event.relatedTarget && this.options.element.parentNode.contains(event.relatedTarget)) {\n return;\n }\n\n this.isActive = false;\n this.sendUpdate();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.options.element.removeEventListener('mousedown', this.mousedownHandler);\n\n if (this.resizeObserver) {\n this.resizeObserver.unobserve(this.editorView.dom);\n }\n }\n }]);\n\n return Menu;\n}();\n\nfunction FloatingMenu (options) {\n return new Plugin({\n key: new PluginKey('floating_menu'),\n view: function view(editorView) {\n return new Menu$2({\n editorView: editorView,\n options: options\n });\n }\n });\n}\n\nvar EditorFloatingMenu = {\n props: {\n editor: {\n default: null,\n type: Object\n }\n },\n data: function data() {\n return {\n menu: {\n isActive: false,\n left: 0,\n bottom: 0\n }\n };\n },\n watch: {\n editor: {\n immediate: true,\n handler: function handler(editor) {\n var _this = this;\n\n if (editor) {\n this.$nextTick(function () {\n editor.registerPlugin(FloatingMenu({\n editor: editor,\n element: _this.$el,\n onUpdate: function onUpdate(menu) {\n // the second check ensures event is fired only once\n if (menu.isActive && _this.menu.isActive === false) {\n _this.$emit('show', menu);\n } else if (!menu.isActive && _this.menu.isActive === true) {\n _this.$emit('hide', menu);\n }\n\n _this.menu = menu;\n }\n }));\n });\n }\n }\n }\n },\n render: function render() {\n if (!this.editor) {\n return null;\n }\n\n return this.$scopedSlots.default({\n focused: this.editor.view.focused,\n focus: this.editor.focus,\n commands: this.editor.commands,\n isActive: this.editor.isActive,\n getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor),\n menu: this.menu\n });\n },\n beforeDestroy: function beforeDestroy() {\n this.editor.unregisterPlugin('floating_menu');\n }\n};\n\nexport { Doc, Editor, EditorContent, EditorFloatingMenu, EditorMenuBar, EditorMenuBubble, Extension, Mark, Node, Paragraph, Text };\n","// ::- Persistent data structure representing an ordered mapping from\n// strings to values, with some convenient update methods.\nfunction OrderedMap(content) {\n this.content = content;\n}\n\nOrderedMap.prototype = {\n constructor: OrderedMap,\n\n find: function(key) {\n for (var i = 0; i < this.content.length; i += 2)\n if (this.content[i] === key) return i\n return -1\n },\n\n // :: (string) → ?any\n // Retrieve the value stored under `key`, or return undefined when\n // no such key exists.\n get: function(key) {\n var found = this.find(key);\n return found == -1 ? undefined : this.content[found + 1]\n },\n\n // :: (string, any, ?string) → OrderedMap\n // Create a new map by replacing the value of `key` with a new\n // value, or adding a binding to the end of the map. If `newKey` is\n // given, the key of the binding will be replaced with that key.\n update: function(key, value, newKey) {\n var self = newKey && newKey != key ? this.remove(newKey) : this;\n var found = self.find(key), content = self.content.slice();\n if (found == -1) {\n content.push(newKey || key, value);\n } else {\n content[found + 1] = value;\n if (newKey) content[found] = newKey;\n }\n return new OrderedMap(content)\n },\n\n // :: (string) → OrderedMap\n // Return a map with the given key removed, if it existed.\n remove: function(key) {\n var found = this.find(key);\n if (found == -1) return this\n var content = this.content.slice();\n content.splice(found, 2);\n return new OrderedMap(content)\n },\n\n // :: (string, any) → OrderedMap\n // Add a new key to the start of the map.\n addToStart: function(key, value) {\n return new OrderedMap([key, value].concat(this.remove(key).content))\n },\n\n // :: (string, any) → OrderedMap\n // Add a new key to the end of the map.\n addToEnd: function(key, value) {\n var content = this.remove(key).content.slice();\n content.push(key, value);\n return new OrderedMap(content)\n },\n\n // :: (string, string, any) → OrderedMap\n // Add a key after the given key. If `place` is not found, the new\n // key is added to the end.\n addBefore: function(place, key, value) {\n var without = this.remove(key), content = without.content.slice();\n var found = without.find(place);\n content.splice(found == -1 ? content.length : found, 0, key, value);\n return new OrderedMap(content)\n },\n\n // :: ((key: string, value: any))\n // Call the given function for each key/value pair in the map, in\n // order.\n forEach: function(f) {\n for (var i = 0; i < this.content.length; i += 2)\n f(this.content[i], this.content[i + 1]);\n },\n\n // :: (union<Object, OrderedMap>) → OrderedMap\n // Create a new map by prepending the keys in this map that don't\n // appear in `map` before the keys in `map`.\n prepend: function(map) {\n map = OrderedMap.from(map);\n if (!map.size) return this\n return new OrderedMap(map.content.concat(this.subtract(map).content))\n },\n\n // :: (union<Object, OrderedMap>) → OrderedMap\n // Create a new map by appending the keys in this map that don't\n // appear in `map` after the keys in `map`.\n append: function(map) {\n map = OrderedMap.from(map);\n if (!map.size) return this\n return new OrderedMap(this.subtract(map).content.concat(map.content))\n },\n\n // :: (union<Object, OrderedMap>) → OrderedMap\n // Create a map containing all the keys in this map that don't\n // appear in `map`.\n subtract: function(map) {\n var result = this;\n map = OrderedMap.from(map);\n for (var i = 0; i < map.content.length; i += 2)\n result = result.remove(map.content[i]);\n return result\n },\n\n // :: number\n // The amount of keys in this map.\n get size() {\n return this.content.length >> 1\n }\n};\n\n// :: (?union<Object, OrderedMap>) → OrderedMap\n// Return a map with the given content. If null, create an empty\n// map. If given an ordered map, return that map itself. If given an\n// object, create a map from the object's properties.\nOrderedMap.from = function(value) {\n if (value instanceof OrderedMap) return value\n var content = [];\n if (value) for (var prop in value) content.push(prop, value[prop]);\n return new OrderedMap(content)\n};\n\nvar orderedmap = OrderedMap;\n\nexport default orderedmap;\n","import OrderedMap from 'orderedmap';\n\nfunction findDiffStart(a, b, pos) {\n for (var i = 0;; i++) {\n if (i == a.childCount || i == b.childCount)\n { return a.childCount == b.childCount ? null : pos }\n\n var childA = a.child(i), childB = b.child(i);\n if (childA == childB) { pos += childA.nodeSize; continue }\n\n if (!childA.sameMarkup(childB)) { return pos }\n\n if (childA.isText && childA.text != childB.text) {\n for (var j = 0; childA.text[j] == childB.text[j]; j++)\n { pos++; }\n return pos\n }\n if (childA.content.size || childB.content.size) {\n var inner = findDiffStart(childA.content, childB.content, pos + 1);\n if (inner != null) { return inner }\n }\n pos += childA.nodeSize;\n }\n}\n\nfunction findDiffEnd(a, b, posA, posB) {\n for (var iA = a.childCount, iB = b.childCount;;) {\n if (iA == 0 || iB == 0)\n { return iA == iB ? null : {a: posA, b: posB} }\n\n var childA = a.child(--iA), childB = b.child(--iB), size = childA.nodeSize;\n if (childA == childB) {\n posA -= size; posB -= size;\n continue\n }\n\n if (!childA.sameMarkup(childB)) { return {a: posA, b: posB} }\n\n if (childA.isText && childA.text != childB.text) {\n var same = 0, minSize = Math.min(childA.text.length, childB.text.length);\n while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {\n same++; posA--; posB--;\n }\n return {a: posA, b: posB}\n }\n if (childA.content.size || childB.content.size) {\n var inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);\n if (inner) { return inner }\n }\n posA -= size; posB -= size;\n }\n}\n\n// ::- A fragment represents a node's collection of child nodes.\n//\n// Like nodes, fragments are persistent data structures, and you\n// should not mutate them or their content. Rather, you create new\n// instances whenever needed. The API tries to make this easy.\nvar Fragment = function Fragment(content, size) {\n this.content = content;\n // :: number\n // The size of the fragment, which is the total of the size of its\n // content nodes.\n this.size = size || 0;\n if (size == null) { for (var i = 0; i < content.length; i++)\n { this.size += content[i].nodeSize; } }\n};\n\nvar prototypeAccessors = { firstChild: { configurable: true },lastChild: { configurable: true },childCount: { configurable: true } };\n\n// :: (number, number, (node: Node, start: number, parent: Node, index: number) → ?bool, ?number)\n// Invoke a callback for all descendant nodes between the given two\n// positions (relative to start of this fragment). Doesn't descend\n// into a node when the callback returns `false`.\nFragment.prototype.nodesBetween = function nodesBetween (from, to, f, nodeStart, parent) {\n if ( nodeStart === void 0 ) nodeStart = 0;\n\n for (var i = 0, pos = 0; pos < to; i++) {\n var child = this.content[i], end = pos + child.nodeSize;\n if (end > from && f(child, nodeStart + pos, parent, i) !== false && child.content.size) {\n var start = pos + 1;\n child.nodesBetween(Math.max(0, from - start),\n Math.min(child.content.size, to - start),\n f, nodeStart + start);\n }\n pos = end;\n }\n};\n\n// :: ((node: Node, pos: number, parent: Node) → ?bool)\n// Call the given callback for every descendant node. The callback\n// may return `false` to prevent traversal of a given node's children.\nFragment.prototype.descendants = function descendants (f) {\n this.nodesBetween(0, this.size, f);\n};\n\n// : (number, number, ?string, ?string) → string\nFragment.prototype.textBetween = function textBetween (from, to, blockSeparator, leafText) {\n var text = \"\", separated = true;\n this.nodesBetween(from, to, function (node, pos) {\n if (node.isText) {\n text += node.text.slice(Math.max(from, pos) - pos, to - pos);\n separated = !blockSeparator;\n } else if (node.isLeaf && leafText) {\n text += leafText;\n separated = !blockSeparator;\n } else if (!separated && node.isBlock) {\n text += blockSeparator;\n separated = true;\n }\n }, 0);\n return text\n};\n\n// :: (Fragment) → Fragment\n// Create a new fragment containing the combined content of this\n// fragment and the other.\nFragment.prototype.append = function append (other) {\n if (!other.size) { return this }\n if (!this.size) { return other }\n var last = this.lastChild, first = other.firstChild, content = this.content.slice(), i = 0;\n if (last.isText && last.sameMarkup(first)) {\n content[content.length - 1] = last.withText(last.text + first.text);\n i = 1;\n }\n for (; i < other.content.length; i++) { content.push(other.content[i]); }\n return new Fragment(content, this.size + other.size)\n};\n\n// :: (number, ?number) → Fragment\n// Cut out the sub-fragment between the two given positions.\nFragment.prototype.cut = function cut (from, to) {\n if (to == null) { to = this.size; }\n if (from == 0 && to == this.size) { return this }\n var result = [], size = 0;\n if (to > from) { for (var i = 0, pos = 0; pos < to; i++) {\n var child = this.content[i], end = pos + child.nodeSize;\n if (end > from) {\n if (pos < from || end > to) {\n if (child.isText)\n { child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos)); }\n else\n { child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1)); }\n }\n result.push(child);\n size += child.nodeSize;\n }\n pos = end;\n } }\n return new Fragment(result, size)\n};\n\nFragment.prototype.cutByIndex = function cutByIndex (from, to) {\n if (from == to) { return Fragment.empty }\n if (from == 0 && to == this.content.length) { return this }\n return new Fragment(this.content.slice(from, to))\n};\n\n// :: (number, Node) → Fragment\n// Create a new fragment in which the node at the given index is\n// replaced by the given node.\nFragment.prototype.replaceChild = function replaceChild (index, node) {\n var current = this.content[index];\n if (current == node) { return this }\n var copy = this.content.slice();\n var size = this.size + node.nodeSize - current.nodeSize;\n copy[index] = node;\n return new Fragment(copy, size)\n};\n\n// : (Node) → Fragment\n// Create a new fragment by prepending the given node to this\n// fragment.\nFragment.prototype.addToStart = function addToStart (node) {\n return new Fragment([node].concat(this.content), this.size + node.nodeSize)\n};\n\n// : (Node) → Fragment\n// Create a new fragment by appending the given node to this\n// fragment.\nFragment.prototype.addToEnd = function addToEnd (node) {\n return new Fragment(this.content.concat(node), this.size + node.nodeSize)\n};\n\n// :: (Fragment) → bool\n// Compare this fragment to another one.\nFragment.prototype.eq = function eq (other) {\n if (this.content.length != other.content.length) { return false }\n for (var i = 0; i < this.content.length; i++)\n { if (!this.content[i].eq(other.content[i])) { return false } }\n return true\n};\n\n// :: ?Node\n// The first child of the fragment, or `null` if it is empty.\nprototypeAccessors.firstChild.get = function () { return this.content.length ? this.content[0] : null };\n\n// :: ?Node\n// The last child of the fragment, or `null` if it is empty.\nprototypeAccessors.lastChild.get = function () { return this.content.length ? this.content[this.content.length - 1] : null };\n\n// :: number\n// The number of child nodes in this fragment.\nprototypeAccessors.childCount.get = function () { return this.content.length };\n\n// :: (number) → Node\n// Get the child node at the given index. Raise an error when the\n// index is out of range.\nFragment.prototype.child = function child (index) {\n var found = this.content[index];\n if (!found) { throw new RangeError(\"Index \" + index + \" out of range for \" + this) }\n return found\n};\n\n// :: (number) → ?Node\n// Get the child node at the given index, if it exists.\nFragment.prototype.maybeChild = function maybeChild (index) {\n return this.content[index]\n};\n\n// :: ((node: Node, offset: number, index: number))\n// Call `f` for every child node, passing the node, its offset\n// into this parent node, and its index.\nFragment.prototype.forEach = function forEach (f) {\n for (var i = 0, p = 0; i < this.content.length; i++) {\n var child = this.content[i];\n f(child, p, i);\n p += child.nodeSize;\n }\n};\n\n// :: (Fragment) → ?number\n// Find the first position at which this fragment and another\n// fragment differ, or `null` if they are the same.\nFragment.prototype.findDiffStart = function findDiffStart$1 (other, pos) {\n if ( pos === void 0 ) pos = 0;\n\n return findDiffStart(this, other, pos)\n};\n\n// :: (Fragment) → ?{a: number, b: number}\n// Find the first position, searching from the end, at which this\n// fragment and the given fragment differ, or `null` if they are the\n// same. Since this position will not be the same in both nodes, an\n// object with two separate positions is returned.\nFragment.prototype.findDiffEnd = function findDiffEnd$1 (other, pos, otherPos) {\n if ( pos === void 0 ) pos = this.size;\n if ( otherPos === void 0 ) otherPos = other.size;\n\n return findDiffEnd(this, other, pos, otherPos)\n};\n\n// : (number, ?number) → {index: number, offset: number}\n// Find the index and inner offset corresponding to a given relative\n// position in this fragment. The result object will be reused\n// (overwritten) the next time the function is called. (Not public.)\nFragment.prototype.findIndex = function findIndex (pos, round) {\n if ( round === void 0 ) round = -1;\n\n if (pos == 0) { return retIndex(0, pos) }\n if (pos == this.size) { return retIndex(this.content.length, pos) }\n if (pos > this.size || pos < 0) { throw new RangeError((\"Position \" + pos + \" outside of fragment (\" + (this) + \")\")) }\n for (var i = 0, curPos = 0;; i++) {\n var cur = this.child(i), end = curPos + cur.nodeSize;\n if (end >= pos) {\n if (end == pos || round > 0) { return retIndex(i + 1, end) }\n return retIndex(i, curPos)\n }\n curPos = end;\n }\n};\n\n// :: () → string\n// Return a debugging string that describes this fragment.\nFragment.prototype.toString = function toString () { return \"<\" + this.toStringInner() + \">\" };\n\nFragment.prototype.toStringInner = function toStringInner () { return this.content.join(\", \") };\n\n// :: () → ?Object\n// Create a JSON-serializeable representation of this fragment.\nFragment.prototype.toJSON = function toJSON () {\n return this.content.length ? this.content.map(function (n) { return n.toJSON(); }) : null\n};\n\n// :: (Schema, ?Object) → Fragment\n// Deserialize a fragment from its JSON representation.\nFragment.fromJSON = function fromJSON (schema, value) {\n if (!value) { return Fragment.empty }\n if (!Array.isArray(value)) { throw new RangeError(\"Invalid input for Fragment.fromJSON\") }\n return new Fragment(value.map(schema.nodeFromJSON))\n};\n\n// :: ([Node]) → Fragment\n// Build a fragment from an array of nodes. Ensures that adjacent\n// text nodes with the same marks are joined together.\nFragment.fromArray = function fromArray (array) {\n if (!array.length) { return Fragment.empty }\n var joined, size = 0;\n for (var i = 0; i < array.length; i++) {\n var node = array[i];\n size += node.nodeSize;\n if (i && node.isText && array[i - 1].sameMarkup(node)) {\n if (!joined) { joined = array.slice(0, i); }\n joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);\n } else if (joined) {\n joined.push(node);\n }\n }\n return new Fragment(joined || array, size)\n};\n\n// :: (?union<Fragment, Node, [Node]>) → Fragment\n// Create a fragment from something that can be interpreted as a set\n// of nodes. For `null`, it returns the empty fragment. For a\n// fragment, the fragment itself. For a node or array of nodes, a\n// fragment containing those nodes.\nFragment.from = function from (nodes) {\n if (!nodes) { return Fragment.empty }\n if (nodes instanceof Fragment) { return nodes }\n if (Array.isArray(nodes)) { return this.fromArray(nodes) }\n if (nodes.attrs) { return new Fragment([nodes], nodes.nodeSize) }\n throw new RangeError(\"Can not convert \" + nodes + \" to a Fragment\" +\n (nodes.nodesBetween ? \" (looks like multiple versions of prosemirror-model were loaded)\" : \"\"))\n};\n\nObject.defineProperties( Fragment.prototype, prototypeAccessors );\n\nvar found = {index: 0, offset: 0};\nfunction retIndex(index, offset) {\n found.index = index;\n found.offset = offset;\n return found\n}\n\n// :: Fragment\n// An empty fragment. Intended to be reused whenever a node doesn't\n// contain anything (rather than allocating a new empty fragment for\n// each leaf node).\nFragment.empty = new Fragment([], 0);\n\nfunction compareDeep(a, b) {\n if (a === b) { return true }\n if (!(a && typeof a == \"object\") ||\n !(b && typeof b == \"object\")) { return false }\n var array = Array.isArray(a);\n if (Array.isArray(b) != array) { return false }\n if (array) {\n if (a.length != b.length) { return false }\n for (var i = 0; i < a.length; i++) { if (!compareDeep(a[i], b[i])) { return false } }\n } else {\n for (var p in a) { if (!(p in b) || !compareDeep(a[p], b[p])) { return false } }\n for (var p$1 in b) { if (!(p$1 in a)) { return false } }\n }\n return true\n}\n\n// ::- A mark is a piece of information that can be attached to a node,\n// such as it being emphasized, in code font, or a link. It has a type\n// and optionally a set of attributes that provide further information\n// (such as the target of the link). Marks are created through a\n// `Schema`, which controls which types exist and which\n// attributes they have.\nvar Mark = function Mark(type, attrs) {\n // :: MarkType\n // The type of this mark.\n this.type = type;\n // :: Object\n // The attributes associated with this mark.\n this.attrs = attrs;\n};\n\n// :: ([Mark]) → [Mark]\n// Given a set of marks, create a new set which contains this one as\n// well, in the right position. If this mark is already in the set,\n// the set itself is returned. If any marks that are set to be\n// [exclusive](#model.MarkSpec.excludes) with this mark are present,\n// those are replaced by this one.\nMark.prototype.addToSet = function addToSet (set) {\n var copy, placed = false;\n for (var i = 0; i < set.length; i++) {\n var other = set[i];\n if (this.eq(other)) { return set }\n if (this.type.excludes(other.type)) {\n if (!copy) { copy = set.slice(0, i); }\n } else if (other.type.excludes(this.type)) {\n return set\n } else {\n if (!placed && other.type.rank > this.type.rank) {\n if (!copy) { copy = set.slice(0, i); }\n copy.push(this);\n placed = true;\n }\n if (copy) { copy.push(other); }\n }\n }\n if (!copy) { copy = set.slice(); }\n if (!placed) { copy.push(this); }\n return copy\n};\n\n// :: ([Mark]) → [Mark]\n// Remove this mark from the given set, returning a new set. If this\n// mark is not in the set, the set itself is returned.\nMark.prototype.removeFromSet = function removeFromSet (set) {\n for (var i = 0; i < set.length; i++)\n { if (this.eq(set[i]))\n { return set.slice(0, i).concat(set.slice(i + 1)) } }\n return set\n};\n\n// :: ([Mark]) → bool\n// Test whether this mark is in the given set of marks.\nMark.prototype.isInSet = function isInSet (set) {\n for (var i = 0; i < set.length; i++)\n { if (this.eq(set[i])) { return true } }\n return false\n};\n\n// :: (Mark) → bool\n// Test whether this mark has the same type and attributes as\n// another mark.\nMark.prototype.eq = function eq (other) {\n return this == other ||\n (this.type == other.type && compareDeep(this.attrs, other.attrs))\n};\n\n// :: () → Object\n// Convert this mark to a JSON-serializeable representation.\nMark.prototype.toJSON = function toJSON () {\n var obj = {type: this.type.name};\n for (var _ in this.attrs) {\n obj.attrs = this.attrs;\n break\n }\n return obj\n};\n\n// :: (Schema, Object) → Mark\nMark.fromJSON = function fromJSON (schema, json) {\n if (!json) { throw new RangeError(\"Invalid input for Mark.fromJSON\") }\n var type = schema.marks[json.type];\n if (!type) { throw new RangeError((\"There is no mark type \" + (json.type) + \" in this schema\")) }\n return type.create(json.attrs)\n};\n\n// :: ([Mark], [Mark]) → bool\n// Test whether two sets of marks are identical.\nMark.sameSet = function sameSet (a, b) {\n if (a == b) { return true }\n if (a.length != b.length) { return false }\n for (var i = 0; i < a.length; i++)\n { if (!a[i].eq(b[i])) { return false } }\n return true\n};\n\n// :: (?union<Mark, [Mark]>) → [Mark]\n// Create a properly sorted mark set from null, a single mark, or an\n// unsorted array of marks.\nMark.setFrom = function setFrom (marks) {\n if (!marks || marks.length == 0) { return Mark.none }\n if (marks instanceof Mark) { return [marks] }\n var copy = marks.slice();\n copy.sort(function (a, b) { return a.type.rank - b.type.rank; });\n return copy\n};\n\n// :: [Mark] The empty set of marks.\nMark.none = [];\n\n// ReplaceError:: class extends Error\n// Error type raised by [`Node.replace`](#model.Node.replace) when\n// given an invalid replacement.\n\nfunction ReplaceError(message) {\n var err = Error.call(this, message);\n err.__proto__ = ReplaceError.prototype;\n return err\n}\n\nReplaceError.prototype = Object.create(Error.prototype);\nReplaceError.prototype.constructor = ReplaceError;\nReplaceError.prototype.name = \"ReplaceError\";\n\n// ::- A slice represents a piece cut out of a larger document. It\n// stores not only a fragment, but also the depth up to which nodes on\n// both side are ‘open’ (cut through).\nvar Slice = function Slice(content, openStart, openEnd) {\n // :: Fragment The slice's content.\n this.content = content;\n // :: number The open depth at the start.\n this.openStart = openStart;\n // :: number The open depth at the end.\n this.openEnd = openEnd;\n};\n\nvar prototypeAccessors$1 = { size: { configurable: true } };\n\n// :: number\n// The size this slice would add when inserted into a document.\nprototypeAccessors$1.size.get = function () {\n return this.content.size - this.openStart - this.openEnd\n};\n\nSlice.prototype.insertAt = function insertAt (pos, fragment) {\n var content = insertInto(this.content, pos + this.openStart, fragment, null);\n return content && new Slice(content, this.openStart, this.openEnd)\n};\n\nSlice.prototype.removeBetween = function removeBetween (from, to) {\n return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd)\n};\n\n// :: (Slice) → bool\n// Tests whether this slice is equal to another slice.\nSlice.prototype.eq = function eq (other) {\n return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd\n};\n\nSlice.prototype.toString = function toString () {\n return this.content + \"(\" + this.openStart + \",\" + this.openEnd + \")\"\n};\n\n// :: () → ?Object\n// Convert a slice to a JSON-serializable representation.\nSlice.prototype.toJSON = function toJSON () {\n if (!this.content.size) { return null }\n var json = {content: this.content.toJSON()};\n if (this.openStart > 0) { json.openStart = this.openStart; }\n if (this.openEnd > 0) { json.openEnd = this.openEnd; }\n return json\n};\n\n// :: (Schema, ?Object) → Slice\n// Deserialize a slice from its JSON representation.\nSlice.fromJSON = function fromJSON (schema, json) {\n if (!json) { return Slice.empty }\n var openStart = json.openStart || 0, openEnd = json.openEnd || 0;\n if (typeof openStart != \"number\" || typeof openEnd != \"number\")\n { throw new RangeError(\"Invalid input for Slice.fromJSON\") }\n return new Slice(Fragment.fromJSON(schema, json.content), json.openStart || 0, json.openEnd || 0)\n};\n\n// :: (Fragment, ?bool) → Slice\n// Create a slice from a fragment by taking the maximum possible\n// open value on both side of the fragment.\nSlice.maxOpen = function maxOpen (fragment, openIsolating) {\n if ( openIsolating === void 0 ) openIsolating=true;\n\n var openStart = 0, openEnd = 0;\n for (var n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) { openStart++; }\n for (var n$1 = fragment.lastChild; n$1 && !n$1.isLeaf && (openIsolating || !n$1.type.spec.isolating); n$1 = n$1.lastChild) { openEnd++; }\n return new Slice(fragment, openStart, openEnd)\n};\n\nObject.defineProperties( Slice.prototype, prototypeAccessors$1 );\n\nfunction removeRange(content, from, to) {\n var ref = content.findIndex(from);\n var index = ref.index;\n var offset = ref.offset;\n var child = content.maybeChild(index);\n var ref$1 = content.findIndex(to);\n var indexTo = ref$1.index;\n var offsetTo = ref$1.offset;\n if (offset == from || child.isText) {\n if (offsetTo != to && !content.child(indexTo).isText) { throw new RangeError(\"Removing non-flat range\") }\n return content.cut(0, from).append(content.cut(to))\n }\n if (index != indexTo) { throw new RangeError(\"Removing non-flat range\") }\n return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)))\n}\n\nfunction insertInto(content, dist, insert, parent) {\n var ref = content.findIndex(dist);\n var index = ref.index;\n var offset = ref.offset;\n var child = content.maybeChild(index);\n if (offset == dist || child.isText) {\n if (parent && !parent.canReplace(index, index, insert)) { return null }\n return content.cut(0, dist).append(insert).append(content.cut(dist))\n }\n var inner = insertInto(child.content, dist - offset - 1, insert);\n return inner && content.replaceChild(index, child.copy(inner))\n}\n\n// :: Slice\n// The empty slice.\nSlice.empty = new Slice(Fragment.empty, 0, 0);\n\nfunction replace($from, $to, slice) {\n if (slice.openStart > $from.depth)\n { throw new ReplaceError(\"Inserted content deeper than insertion position\") }\n if ($from.depth - slice.openStart != $to.depth - slice.openEnd)\n { throw new ReplaceError(\"Inconsistent open depths\") }\n return replaceOuter($from, $to, slice, 0)\n}\n\nfunction replaceOuter($from, $to, slice, depth) {\n var index = $from.index(depth), node = $from.node(depth);\n if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {\n var inner = replaceOuter($from, $to, slice, depth + 1);\n return node.copy(node.content.replaceChild(index, inner))\n } else if (!slice.content.size) {\n return close(node, replaceTwoWay($from, $to, depth))\n } else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) { // Simple, flat case\n var parent = $from.parent, content = parent.content;\n return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)))\n } else {\n var ref = prepareSliceForReplace(slice, $from);\n var start = ref.start;\n var end = ref.end;\n return close(node, replaceThreeWay($from, start, end, $to, depth))\n }\n}\n\nfunction checkJoin(main, sub) {\n if (!sub.type.compatibleContent(main.type))\n { throw new ReplaceError(\"Cannot join \" + sub.type.name + \" onto \" + main.type.name) }\n}\n\nfunction joinable($before, $after, depth) {\n var node = $before.node(depth);\n checkJoin(node, $after.node(depth));\n return node\n}\n\nfunction addNode(child, target) {\n var last = target.length - 1;\n if (last >= 0 && child.isText && child.sameMarkup(target[last]))\n { target[last] = child.withText(target[last].text + child.text); }\n else\n { target.push(child); }\n}\n\nfunction addRange($start, $end, depth, target) {\n var node = ($end || $start).node(depth);\n var startIndex = 0, endIndex = $end ? $end.index(depth) : node.childCount;\n if ($start) {\n startIndex = $start.index(depth);\n if ($start.depth > depth) {\n startIndex++;\n } else if ($start.textOffset) {\n addNode($start.nodeAfter, target);\n startIndex++;\n }\n }\n for (var i = startIndex; i < endIndex; i++) { addNode(node.child(i), target); }\n if ($end && $end.depth == depth && $end.textOffset)\n { addNode($end.nodeBefore, target); }\n}\n\nfunction close(node, content) {\n if (!node.type.validContent(content))\n { throw new ReplaceError(\"Invalid content for node \" + node.type.name) }\n return node.copy(content)\n}\n\nfunction replaceThreeWay($from, $start, $end, $to, depth) {\n var openStart = $from.depth > depth && joinable($from, $start, depth + 1);\n var openEnd = $to.depth > depth && joinable($end, $to, depth + 1);\n\n var content = [];\n addRange(null, $from, depth, content);\n if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {\n checkJoin(openStart, openEnd);\n addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);\n } else {\n if (openStart)\n { addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content); }\n addRange($start, $end, depth, content);\n if (openEnd)\n { addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content); }\n }\n addRange($to, null, depth, content);\n return new Fragment(content)\n}\n\nfunction replaceTwoWay($from, $to, depth) {\n var content = [];\n addRange(null, $from, depth, content);\n if ($from.depth > depth) {\n var type = joinable($from, $to, depth + 1);\n addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content)\n}\n\nfunction prepareSliceForReplace(slice, $along) {\n var extra = $along.depth - slice.openStart, parent = $along.node(extra);\n var node = parent.copy(slice.content);\n for (var i = extra - 1; i >= 0; i--)\n { node = $along.node(i).copy(Fragment.from(node)); }\n return {start: node.resolveNoCache(slice.openStart + extra),\n end: node.resolveNoCache(node.content.size - slice.openEnd - extra)}\n}\n\n// ::- You can [_resolve_](#model.Node.resolve) a position to get more\n// information about it. Objects of this class represent such a\n// resolved position, providing various pieces of context information,\n// and some helper methods.\n//\n// Throughout this interface, methods that take an optional `depth`\n// parameter will interpret undefined as `this.depth` and negative\n// numbers as `this.depth + value`.\nvar ResolvedPos = function ResolvedPos(pos, path, parentOffset) {\n // :: number The position that was resolved.\n this.pos = pos;\n this.path = path;\n // :: number\n // The number of levels the parent node is from the root. If this\n // position points directly into the root node, it is 0. If it\n // points into a top-level paragraph, 1, and so on.\n this.depth = path.length / 3 - 1;\n // :: number The offset this position has into its parent node.\n this.parentOffset = parentOffset;\n};\n\nvar prototypeAccessors$2 = { parent: { configurable: true },doc: { configurable: true },textOffset: { configurable: true },nodeAfter: { configurable: true },nodeBefore: { configurable: true } };\n\nResolvedPos.prototype.resolveDepth = function resolveDepth (val) {\n if (val == null) { return this.depth }\n if (val < 0) { return this.depth + val }\n return val\n};\n\n// :: Node\n// The parent node that the position points into. Note that even if\n// a position points into a text node, that node is not considered\n// the parent—text nodes are ‘flat’ in this model, and have no content.\nprototypeAccessors$2.parent.get = function () { return this.node(this.depth) };\n\n// :: Node\n// The root node in which the position was resolved.\nprototypeAccessors$2.doc.get = function () { return this.node(0) };\n\n// :: (?number) → Node\n// The ancestor node at the given level. `p.node(p.depth)` is the\n// same as `p.parent`.\nResolvedPos.prototype.node = function node (depth) { return this.path[this.resolveDepth(depth) * 3] };\n\n// :: (?number) → number\n// The index into the ancestor at the given level. If this points at\n// the 3rd node in the 2nd paragraph on the top level, for example,\n// `p.index(0)` is 1 and `p.index(1)` is 2.\nResolvedPos.prototype.index = function index (depth) { return this.path[this.resolveDepth(depth) * 3 + 1] };\n\n// :: (?number) → number\n// The index pointing after this position into the ancestor at the\n// given level.\nResolvedPos.prototype.indexAfter = function indexAfter (depth) {\n depth = this.resolveDepth(depth);\n return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1)\n};\n\n// :: (?number) → number\n// The (absolute) position at the start of the node at the given\n// level.\nResolvedPos.prototype.start = function start (depth) {\n depth = this.resolveDepth(depth);\n return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1\n};\n\n// :: (?number) → number\n// The (absolute) position at the end of the node at the given\n// level.\nResolvedPos.prototype.end = function end (depth) {\n depth = this.resolveDepth(depth);\n return this.start(depth) + this.node(depth).content.size\n};\n\n// :: (?number) → number\n// The (absolute) position directly before the wrapping node at the\n// given level, or, when `depth` is `this.depth + 1`, the original\n// position.\nResolvedPos.prototype.before = function before (depth) {\n depth = this.resolveDepth(depth);\n if (!depth) { throw new RangeError(\"There is no position before the top-level node\") }\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1]\n};\n\n// :: (?number) → number\n// The (absolute) position directly after the wrapping node at the\n// given level, or the original position when `depth` is `this.depth + 1`.\nResolvedPos.prototype.after = function after (depth) {\n depth = this.resolveDepth(depth);\n if (!depth) { throw new RangeError(\"There is no position after the top-level node\") }\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize\n};\n\n// :: number\n// When this position points into a text node, this returns the\n// distance between the position and the start of the text node.\n// Will be zero for positions that point between nodes.\nprototypeAccessors$2.textOffset.get = function () { return this.pos - this.path[this.path.length - 1] };\n\n// :: ?Node\n// Get the node directly after the position, if any. If the position\n// points into a text node, only the part of that node after the\n// position is returned.\nprototypeAccessors$2.nodeAfter.get = function () {\n var parent = this.parent, index = this.index(this.depth);\n if (index == parent.childCount) { return null }\n var dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index);\n return dOff ? parent.child(index).cut(dOff) : child\n};\n\n// :: ?Node\n// Get the node directly before the position, if any. If the\n// position points into a text node, only the part of that node\n// before the position is returned.\nprototypeAccessors$2.nodeBefore.get = function () {\n var index = this.index(this.depth);\n var dOff = this.pos - this.path[this.path.length - 1];\n if (dOff) { return this.parent.child(index).cut(0, dOff) }\n return index == 0 ? null : this.parent.child(index - 1)\n};\n\n// :: () → [Mark]\n// Get the marks at this position, factoring in the surrounding\n// marks' [`inclusive`](#model.MarkSpec.inclusive) property. If the\n// position is at the start of a non-empty node, the marks of the\n// node after it (if any) are returned.\nResolvedPos.prototype.marks = function marks () {\n var parent = this.parent, index = this.index();\n\n // In an empty parent, return the empty array\n if (parent.content.size == 0) { return Mark.none }\n\n // When inside a text node, just return the text node's marks\n if (this.textOffset) { return parent.child(index).marks }\n\n var main = parent.maybeChild(index - 1), other = parent.maybeChild(index);\n // If the `after` flag is true of there is no node before, make\n // the node after this position the main reference.\n if (!main) { var tmp = main; main = other; other = tmp; }\n\n // Use all marks in the main node, except those that have\n // `inclusive` set to false and are not present in the other node.\n var marks = main.marks;\n for (var i = 0; i < marks.length; i++)\n { if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks)))\n { marks = marks[i--].removeFromSet(marks); } }\n\n return marks\n};\n\n// :: (ResolvedPos) → ?[Mark]\n// Get the marks after the current position, if any, except those\n// that are non-inclusive and not present at position `$end`. This\n// is mostly useful for getting the set of marks to preserve after a\n// deletion. Will return `null` if this position is at the end of\n// its parent node or its parent node isn't a textblock (in which\n// case no marks should be preserved).\nResolvedPos.prototype.marksAcross = function marksAcross ($end) {\n var after = this.parent.maybeChild(this.index());\n if (!after || !after.isInline) { return null }\n\n var marks = after.marks, next = $end.parent.maybeChild($end.index());\n for (var i = 0; i < marks.length; i++)\n { if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks)))\n { marks = marks[i--].removeFromSet(marks); } }\n return marks\n};\n\n// :: (number) → number\n// The depth up to which this position and the given (non-resolved)\n// position share the same parent nodes.\nResolvedPos.prototype.sharedDepth = function sharedDepth (pos) {\n for (var depth = this.depth; depth > 0; depth--)\n { if (this.start(depth) <= pos && this.end(depth) >= pos) { return depth } }\n return 0\n};\n\n// :: (?ResolvedPos, ?(Node) → bool) → ?NodeRange\n// Returns a range based on the place where this position and the\n// given position diverge around block content. If both point into\n// the same textblock, for example, a range around that textblock\n// will be returned. If they point into different blocks, the range\n// around those blocks in their shared ancestor is returned. You can\n// pass in an optional predicate that will be called with a parent\n// node to see if a range into that parent is acceptable.\nResolvedPos.prototype.blockRange = function blockRange (other, pred) {\n if ( other === void 0 ) other = this;\n\n if (other.pos < this.pos) { return other.blockRange(this) }\n for (var d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--)\n { if (other.pos <= this.end(d) && (!pred || pred(this.node(d))))\n { return new NodeRange(this, other, d) } }\n};\n\n// :: (ResolvedPos) → bool\n// Query whether the given position shares the same parent node.\nResolvedPos.prototype.sameParent = function sameParent (other) {\n return this.pos - this.parentOffset == other.pos - other.parentOffset\n};\n\n// :: (ResolvedPos) → ResolvedPos\n// Return the greater of this and the given position.\nResolvedPos.prototype.max = function max (other) {\n return other.pos > this.pos ? other : this\n};\n\n// :: (ResolvedPos) → ResolvedPos\n// Return the smaller of this and the given position.\nResolvedPos.prototype.min = function min (other) {\n return other.pos < this.pos ? other : this\n};\n\nResolvedPos.prototype.toString = function toString () {\n var str = \"\";\n for (var i = 1; i <= this.depth; i++)\n { str += (str ? \"/\" : \"\") + this.node(i).type.name + \"_\" + this.index(i - 1); }\n return str + \":\" + this.parentOffset\n};\n\nResolvedPos.resolve = function resolve (doc, pos) {\n if (!(pos >= 0 && pos <= doc.content.size)) { throw new RangeError(\"Position \" + pos + \" out of range\") }\n var path = [];\n var start = 0, parentOffset = pos;\n for (var node = doc;;) {\n var ref = node.content.findIndex(parentOffset);\n var index = ref.index;\n var offset = ref.offset;\n var rem = parentOffset - offset;\n path.push(node, index, start + offset);\n if (!rem) { break }\n node = node.child(index);\n if (node.isText) { break }\n parentOffset = rem - 1;\n start += offset + 1;\n }\n return new ResolvedPos(pos, path, parentOffset)\n};\n\nResolvedPos.resolveCached = function resolveCached (doc, pos) {\n for (var i = 0; i < resolveCache.length; i++) {\n var cached = resolveCache[i];\n if (cached.pos == pos && cached.doc == doc) { return cached }\n }\n var result = resolveCache[resolveCachePos] = ResolvedPos.resolve(doc, pos);\n resolveCachePos = (resolveCachePos + 1) % resolveCacheSize;\n return result\n};\n\nObject.defineProperties( ResolvedPos.prototype, prototypeAccessors$2 );\n\nvar resolveCache = [], resolveCachePos = 0, resolveCacheSize = 12;\n\n// ::- Represents a flat range of content, i.e. one that starts and\n// ends in the same node.\nvar NodeRange = function NodeRange($from, $to, depth) {\n // :: ResolvedPos A resolved position along the start of the\n // content. May have a `depth` greater than this object's `depth`\n // property, since these are the positions that were used to\n // compute the range, not re-resolved positions directly at its\n // boundaries.\n this.$from = $from;\n // :: ResolvedPos A position along the end of the content. See\n // caveat for [`$from`](#model.NodeRange.$from).\n this.$to = $to;\n // :: number The depth of the node that this range points into.\n this.depth = depth;\n};\n\nvar prototypeAccessors$1$1 = { start: { configurable: true },end: { configurable: true },parent: { configurable: true },startIndex: { configurable: true },endIndex: { configurable: true } };\n\n// :: number The position at the start of the range.\nprototypeAccessors$1$1.start.get = function () { return this.$from.before(this.depth + 1) };\n// :: number The position at the end of the range.\nprototypeAccessors$1$1.end.get = function () { return this.$to.after(this.depth + 1) };\n\n// :: Node The parent node that the range points into.\nprototypeAccessors$1$1.parent.get = function () { return this.$from.node(this.depth) };\n// :: number The start index of the range in the parent node.\nprototypeAccessors$1$1.startIndex.get = function () { return this.$from.index(this.depth) };\n// :: number The end index of the range in the parent node.\nprototypeAccessors$1$1.endIndex.get = function () { return this.$to.indexAfter(this.depth) };\n\nObject.defineProperties( NodeRange.prototype, prototypeAccessors$1$1 );\n\nvar emptyAttrs = Object.create(null);\n\n// ::- This class represents a node in the tree that makes up a\n// ProseMirror document. So a document is an instance of `Node`, with\n// children that are also instances of `Node`.\n//\n// Nodes are persistent data structures. Instead of changing them, you\n// create new ones with the content you want. Old ones keep pointing\n// at the old document shape. This is made cheaper by sharing\n// structure between the old and new data as much as possible, which a\n// tree shape like this (without back pointers) makes easy.\n//\n// **Do not** directly mutate the properties of a `Node` object. See\n// [the guide](/docs/guide/#doc) for more information.\nvar Node = function Node(type, attrs, content, marks) {\n // :: NodeType\n // The type of node that this is.\n this.type = type;\n\n // :: Object\n // An object mapping attribute names to values. The kind of\n // attributes allowed and required are\n // [determined](#model.NodeSpec.attrs) by the node type.\n this.attrs = attrs;\n\n // :: Fragment\n // A container holding the node's children.\n this.content = content || Fragment.empty;\n\n // :: [Mark]\n // The marks (things like whether it is emphasized or part of a\n // link) applied to this node.\n this.marks = marks || Mark.none;\n};\n\nvar prototypeAccessors$3 = { nodeSize: { configurable: true },childCount: { configurable: true },textContent: { configurable: true },firstChild: { configurable: true },lastChild: { configurable: true },isBlock: { configurable: true },isTextblock: { configurable: true },inlineContent: { configurable: true },isInline: { configurable: true },isText: { configurable: true },isLeaf: { configurable: true },isAtom: { configurable: true } };\n\n// text:: ?string\n// For text nodes, this contains the node's text content.\n\n// :: number\n// The size of this node, as defined by the integer-based [indexing\n// scheme](/docs/guide/#doc.indexing). For text nodes, this is the\n// amount of characters. For other leaf nodes, it is one. For\n// non-leaf nodes, it is the size of the content plus two (the start\n// and end token).\nprototypeAccessors$3.nodeSize.get = function () { return this.isLeaf ? 1 : 2 + this.content.size };\n\n// :: number\n// The number of children that the node has.\nprototypeAccessors$3.childCount.get = function () { return this.content.childCount };\n\n// :: (number) → Node\n// Get the child node at the given index. Raises an error when the\n// index is out of range.\nNode.prototype.child = function child (index) { return this.content.child(index) };\n\n// :: (number) → ?Node\n// Get the child node at the given index, if it exists.\nNode.prototype.maybeChild = function maybeChild (index) { return this.content.maybeChild(index) };\n\n// :: ((node: Node, offset: number, index: number))\n// Call `f` for every child node, passing the node, its offset\n// into this parent node, and its index.\nNode.prototype.forEach = function forEach (f) { this.content.forEach(f); };\n\n// :: (number, number, (node: Node, pos: number, parent: Node, index: number) → ?bool, ?number)\n// Invoke a callback for all descendant nodes recursively between\n// the given two positions that are relative to start of this node's\n// content. The callback is invoked with the node, its\n// parent-relative position, its parent node, and its child index.\n// When the callback returns false for a given node, that node's\n// children will not be recursed over. The last parameter can be\n// used to specify a starting position to count from.\nNode.prototype.nodesBetween = function nodesBetween (from, to, f, startPos) {\n if ( startPos === void 0 ) startPos = 0;\n\n this.content.nodesBetween(from, to, f, startPos, this);\n};\n\n// :: ((node: Node, pos: number, parent: Node) → ?bool)\n// Call the given callback for every descendant node. Doesn't\n// descend into a node when the callback returns `false`.\nNode.prototype.descendants = function descendants (f) {\n this.nodesBetween(0, this.content.size, f);\n};\n\n// :: string\n// Concatenates all the text nodes found in this fragment and its\n// children.\nprototypeAccessors$3.textContent.get = function () { return this.textBetween(0, this.content.size, \"\") };\n\n// :: (number, number, ?string, ?string) → string\n// Get all text between positions `from` and `to`. When\n// `blockSeparator` is given, it will be inserted whenever a new\n// block node is started. When `leafText` is given, it'll be\n// inserted for every non-text leaf node encountered.\nNode.prototype.textBetween = function textBetween (from, to, blockSeparator, leafText) {\n return this.content.textBetween(from, to, blockSeparator, leafText)\n};\n\n// :: ?Node\n// Returns this node's first child, or `null` if there are no\n// children.\nprototypeAccessors$3.firstChild.get = function () { return this.content.firstChild };\n\n// :: ?Node\n// Returns this node's last child, or `null` if there are no\n// children.\nprototypeAccessors$3.lastChild.get = function () { return this.content.lastChild };\n\n// :: (Node) → bool\n// Test whether two nodes represent the same piece of document.\nNode.prototype.eq = function eq (other) {\n return this == other || (this.sameMarkup(other) && this.content.eq(other.content))\n};\n\n// :: (Node) → bool\n// Compare the markup (type, attributes, and marks) of this node to\n// those of another. Returns `true` if both have the same markup.\nNode.prototype.sameMarkup = function sameMarkup (other) {\n return this.hasMarkup(other.type, other.attrs, other.marks)\n};\n\n// :: (NodeType, ?Object, ?[Mark]) → bool\n// Check whether this node's markup correspond to the given type,\n// attributes, and marks.\nNode.prototype.hasMarkup = function hasMarkup (type, attrs, marks) {\n return this.type == type &&\n compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) &&\n Mark.sameSet(this.marks, marks || Mark.none)\n};\n\n// :: (?Fragment) → Node\n// Create a new node with the same markup as this node, containing\n// the given content (or empty, if no content is given).\nNode.prototype.copy = function copy (content) {\n if ( content === void 0 ) content = null;\n\n if (content == this.content) { return this }\n return new this.constructor(this.type, this.attrs, content, this.marks)\n};\n\n// :: ([Mark]) → Node\n// Create a copy of this node, with the given set of marks instead\n// of the node's own marks.\nNode.prototype.mark = function mark (marks) {\n return marks == this.marks ? this : new this.constructor(this.type, this.attrs, this.content, marks)\n};\n\n// :: (number, ?number) → Node\n// Create a copy of this node with only the content between the\n// given positions. If `to` is not given, it defaults to the end of\n// the node.\nNode.prototype.cut = function cut (from, to) {\n if (from == 0 && to == this.content.size) { return this }\n return this.copy(this.content.cut(from, to))\n};\n\n// :: (number, ?number) → Slice\n// Cut out the part of the document between the given positions, and\n// return it as a `Slice` object.\nNode.prototype.slice = function slice (from, to, includeParents) {\n if ( to === void 0 ) to = this.content.size;\n if ( includeParents === void 0 ) includeParents = false;\n\n if (from == to) { return Slice.empty }\n\n var $from = this.resolve(from), $to = this.resolve(to);\n var depth = includeParents ? 0 : $from.sharedDepth(to);\n var start = $from.start(depth), node = $from.node(depth);\n var content = node.content.cut($from.pos - start, $to.pos - start);\n return new Slice(content, $from.depth - depth, $to.depth - depth)\n};\n\n// :: (number, number, Slice) → Node\n// Replace the part of the document between the given positions with\n// the given slice. The slice must 'fit', meaning its open sides\n// must be able to connect to the surrounding content, and its\n// content nodes must be valid children for the node they are placed\n// into. If any of this is violated, an error of type\n// [`ReplaceError`](#model.ReplaceError) is thrown.\nNode.prototype.replace = function replace$1 (from, to, slice) {\n return replace(this.resolve(from), this.resolve(to), slice)\n};\n\n// :: (number) → ?Node\n// Find the node directly after the given position.\nNode.prototype.nodeAt = function nodeAt (pos) {\n for (var node = this;;) {\n var ref = node.content.findIndex(pos);\n var index = ref.index;\n var offset = ref.offset;\n node = node.maybeChild(index);\n if (!node) { return null }\n if (offset == pos || node.isText) { return node }\n pos -= offset + 1;\n }\n};\n\n// :: (number) → {node: ?Node, index: number, offset: number}\n// Find the (direct) child node after the given offset, if any,\n// and return it along with its index and offset relative to this\n// node.\nNode.prototype.childAfter = function childAfter (pos) {\n var ref = this.content.findIndex(pos);\n var index = ref.index;\n var offset = ref.offset;\n return {node: this.content.maybeChild(index), index: index, offset: offset}\n};\n\n// :: (number) → {node: ?Node, index: number, offset: number}\n// Find the (direct) child node before the given offset, if any,\n// and return it along with its index and offset relative to this\n// node.\nNode.prototype.childBefore = function childBefore (pos) {\n if (pos == 0) { return {node: null, index: 0, offset: 0} }\n var ref = this.content.findIndex(pos);\n var index = ref.index;\n var offset = ref.offset;\n if (offset < pos) { return {node: this.content.child(index), index: index, offset: offset} }\n var node = this.content.child(index - 1);\n return {node: node, index: index - 1, offset: offset - node.nodeSize}\n};\n\n// :: (number) → ResolvedPos\n// Resolve the given position in the document, returning an\n// [object](#model.ResolvedPos) with information about its context.\nNode.prototype.resolve = function resolve (pos) { return ResolvedPos.resolveCached(this, pos) };\n\nNode.prototype.resolveNoCache = function resolveNoCache (pos) { return ResolvedPos.resolve(this, pos) };\n\n// :: (number, number, MarkType) → bool\n// Test whether a mark of the given type occurs in this document\n// between the two given positions.\nNode.prototype.rangeHasMark = function rangeHasMark (from, to, type) {\n var found = false;\n if (to > from) { this.nodesBetween(from, to, function (node) {\n if (type.isInSet(node.marks)) { found = true; }\n return !found\n }); }\n return found\n};\n\n// :: bool\n// True when this is a block (non-inline node)\nprototypeAccessors$3.isBlock.get = function () { return this.type.isBlock };\n\n// :: bool\n// True when this is a textblock node, a block node with inline\n// content.\nprototypeAccessors$3.isTextblock.get = function () { return this.type.isTextblock };\n\n// :: bool\n// True when this node allows inline content.\nprototypeAccessors$3.inlineContent.get = function () { return this.type.inlineContent };\n\n// :: bool\n// True when this is an inline node (a text node or a node that can\n// appear among text).\nprototypeAccessors$3.isInline.get = function () { return this.type.isInline };\n\n// :: bool\n// True when this is a text node.\nprototypeAccessors$3.isText.get = function () { return this.type.isText };\n\n// :: bool\n// True when this is a leaf node.\nprototypeAccessors$3.isLeaf.get = function () { return this.type.isLeaf };\n\n// :: bool\n// True when this is an atom, i.e. when it does not have directly\n// editable content. This is usually the same as `isLeaf`, but can\n// be configured with the [`atom` property](#model.NodeSpec.atom) on\n// a node's spec (typically used when the node is displayed as an\n// uneditable [node view](#view.NodeView)).\nprototypeAccessors$3.isAtom.get = function () { return this.type.isAtom };\n\n// :: () → string\n// Return a string representation of this node for debugging\n// purposes.\nNode.prototype.toString = function toString () {\n if (this.type.spec.toDebugString) { return this.type.spec.toDebugString(this) }\n var name = this.type.name;\n if (this.content.size)\n { name += \"(\" + this.content.toStringInner() + \")\"; }\n return wrapMarks(this.marks, name)\n};\n\n// :: (number) → ContentMatch\n// Get the content match in this node at the given index.\nNode.prototype.contentMatchAt = function contentMatchAt (index) {\n var match = this.type.contentMatch.matchFragment(this.content, 0, index);\n if (!match) { throw new Error(\"Called contentMatchAt on a node with invalid content\") }\n return match\n};\n\n// :: (number, number, ?Fragment, ?number, ?number) → bool\n// Test whether replacing the range between `from` and `to` (by\n// child index) with the given replacement fragment (which defaults\n// to the empty fragment) would leave the node's content valid. You\n// can optionally pass `start` and `end` indices into the\n// replacement fragment.\nNode.prototype.canReplace = function canReplace (from, to, replacement, start, end) {\n if ( replacement === void 0 ) replacement = Fragment.empty;\n if ( start === void 0 ) start = 0;\n if ( end === void 0 ) end = replacement.childCount;\n\n var one = this.contentMatchAt(from).matchFragment(replacement, start, end);\n var two = one && one.matchFragment(this.content, to);\n if (!two || !two.validEnd) { return false }\n for (var i = start; i < end; i++) { if (!this.type.allowsMarks(replacement.child(i).marks)) { return false } }\n return true\n};\n\n// :: (number, number, NodeType, ?[Mark]) → bool\n// Test whether replacing the range `from` to `to` (by index) with a\n// node of the given type would leave the node's content valid.\nNode.prototype.canReplaceWith = function canReplaceWith (from, to, type, marks) {\n if (marks && !this.type.allowsMarks(marks)) { return false }\n var start = this.contentMatchAt(from).matchType(type);\n var end = start && start.matchFragment(this.content, to);\n return end ? end.validEnd : false\n};\n\n// :: (Node) → bool\n// Test whether the given node's content could be appended to this\n// node. If that node is empty, this will only return true if there\n// is at least one node type that can appear in both nodes (to avoid\n// merging completely incompatible nodes).\nNode.prototype.canAppend = function canAppend (other) {\n if (other.content.size) { return this.canReplace(this.childCount, this.childCount, other.content) }\n else { return this.type.compatibleContent(other.type) }\n};\n\n// :: ()\n// Check whether this node and its descendants conform to the\n// schema, and raise error when they do not.\nNode.prototype.check = function check () {\n if (!this.type.validContent(this.content))\n { throw new RangeError((\"Invalid content for node \" + (this.type.name) + \": \" + (this.content.toString().slice(0, 50)))) }\n this.content.forEach(function (node) { return node.check(); });\n};\n\n// :: () → Object\n// Return a JSON-serializeable representation of this node.\nNode.prototype.toJSON = function toJSON () {\n var obj = {type: this.type.name};\n for (var _ in this.attrs) {\n obj.attrs = this.attrs;\n break\n }\n if (this.content.size)\n { obj.content = this.content.toJSON(); }\n if (this.marks.length)\n { obj.marks = this.marks.map(function (n) { return n.toJSON(); }); }\n return obj\n};\n\n// :: (Schema, Object) → Node\n// Deserialize a node from its JSON representation.\nNode.fromJSON = function fromJSON (schema, json) {\n if (!json) { throw new RangeError(\"Invalid input for Node.fromJSON\") }\n var marks = null;\n if (json.marks) {\n if (!Array.isArray(json.marks)) { throw new RangeError(\"Invalid mark data for Node.fromJSON\") }\n marks = json.marks.map(schema.markFromJSON);\n }\n if (json.type == \"text\") {\n if (typeof json.text != \"string\") { throw new RangeError(\"Invalid text node in JSON\") }\n return schema.text(json.text, marks)\n }\n var content = Fragment.fromJSON(schema, json.content);\n return schema.nodeType(json.type).create(json.attrs, content, marks)\n};\n\nObject.defineProperties( Node.prototype, prototypeAccessors$3 );\n\nvar TextNode = /*@__PURE__*/(function (Node) {\n function TextNode(type, attrs, content, marks) {\n Node.call(this, type, attrs, null, marks);\n\n if (!content) { throw new RangeError(\"Empty text nodes are not allowed\") }\n\n this.text = content;\n }\n\n if ( Node ) TextNode.__proto__ = Node;\n TextNode.prototype = Object.create( Node && Node.prototype );\n TextNode.prototype.constructor = TextNode;\n\n var prototypeAccessors$1 = { textContent: { configurable: true },nodeSize: { configurable: true } };\n\n TextNode.prototype.toString = function toString () {\n if (this.type.spec.toDebugString) { return this.type.spec.toDebugString(this) }\n return wrapMarks(this.marks, JSON.stringify(this.text))\n };\n\n prototypeAccessors$1.textContent.get = function () { return this.text };\n\n TextNode.prototype.textBetween = function textBetween (from, to) { return this.text.slice(from, to) };\n\n prototypeAccessors$1.nodeSize.get = function () { return this.text.length };\n\n TextNode.prototype.mark = function mark (marks) {\n return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks)\n };\n\n TextNode.prototype.withText = function withText (text) {\n if (text == this.text) { return this }\n return new TextNode(this.type, this.attrs, text, this.marks)\n };\n\n TextNode.prototype.cut = function cut (from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.text.length;\n\n if (from == 0 && to == this.text.length) { return this }\n return this.withText(this.text.slice(from, to))\n };\n\n TextNode.prototype.eq = function eq (other) {\n return this.sameMarkup(other) && this.text == other.text\n };\n\n TextNode.prototype.toJSON = function toJSON () {\n var base = Node.prototype.toJSON.call(this);\n base.text = this.text;\n return base\n };\n\n Object.defineProperties( TextNode.prototype, prototypeAccessors$1 );\n\n return TextNode;\n}(Node));\n\nfunction wrapMarks(marks, str) {\n for (var i = marks.length - 1; i >= 0; i--)\n { str = marks[i].type.name + \"(\" + str + \")\"; }\n return str\n}\n\n// ::- Instances of this class represent a match state of a node\n// type's [content expression](#model.NodeSpec.content), and can be\n// used to find out whether further content matches here, and whether\n// a given position is a valid end of the node.\nvar ContentMatch = function ContentMatch(validEnd) {\n // :: bool\n // True when this match state represents a valid end of the node.\n this.validEnd = validEnd;\n this.next = [];\n this.wrapCache = [];\n};\n\nvar prototypeAccessors$4 = { inlineContent: { configurable: true },defaultType: { configurable: true },edgeCount: { configurable: true } };\n\nContentMatch.parse = function parse (string, nodeTypes) {\n var stream = new TokenStream(string, nodeTypes);\n if (stream.next == null) { return ContentMatch.empty }\n var expr = parseExpr(stream);\n if (stream.next) { stream.err(\"Unexpected trailing text\"); }\n var match = dfa(nfa(expr));\n checkForDeadEnds(match, stream);\n return match\n};\n\n// :: (NodeType) → ?ContentMatch\n// Match a node type, returning a match after that node if\n// successful.\nContentMatch.prototype.matchType = function matchType (type) {\n for (var i = 0; i < this.next.length; i += 2)\n { if (this.next[i] == type) { return this.next[i + 1] } }\n return null\n};\n\n// :: (Fragment, ?number, ?number) → ?ContentMatch\n// Try to match a fragment. Returns the resulting match when\n// successful.\nContentMatch.prototype.matchFragment = function matchFragment (frag, start, end) {\n if ( start === void 0 ) start = 0;\n if ( end === void 0 ) end = frag.childCount;\n\n var cur = this;\n for (var i = start; cur && i < end; i++)\n { cur = cur.matchType(frag.child(i).type); }\n return cur\n};\n\nprototypeAccessors$4.inlineContent.get = function () {\n var first = this.next[0];\n return first ? first.isInline : false\n};\n\n// :: ?NodeType\n// Get the first matching node type at this match position that can\n// be generated.\nprototypeAccessors$4.defaultType.get = function () {\n for (var i = 0; i < this.next.length; i += 2) {\n var type = this.next[i];\n if (!(type.isText || type.hasRequiredAttrs())) { return type }\n }\n};\n\nContentMatch.prototype.compatible = function compatible (other) {\n for (var i = 0; i < this.next.length; i += 2)\n { for (var j = 0; j < other.next.length; j += 2)\n { if (this.next[i] == other.next[j]) { return true } } }\n return false\n};\n\n// :: (Fragment, bool, ?number) → ?Fragment\n// Try to match the given fragment, and if that fails, see if it can\n// be made to match by inserting nodes in front of it. When\n// successful, return a fragment of inserted nodes (which may be\n// empty if nothing had to be inserted). When `toEnd` is true, only\n// return a fragment if the resulting match goes to the end of the\n// content expression.\nContentMatch.prototype.fillBefore = function fillBefore (after, toEnd, startIndex) {\n if ( toEnd === void 0 ) toEnd = false;\n if ( startIndex === void 0 ) startIndex = 0;\n\n var seen = [this];\n function search(match, types) {\n var finished = match.matchFragment(after, startIndex);\n if (finished && (!toEnd || finished.validEnd))\n { return Fragment.from(types.map(function (tp) { return tp.createAndFill(); })) }\n\n for (var i = 0; i < match.next.length; i += 2) {\n var type = match.next[i], next = match.next[i + 1];\n if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {\n seen.push(next);\n var found = search(next, types.concat(type));\n if (found) { return found }\n }\n }\n }\n\n return search(this, [])\n};\n\n// :: (NodeType) → ?[NodeType]\n// Find a set of wrapping node types that would allow a node of the\n// given type to appear at this position. The result may be empty\n// (when it fits directly) and will be null when no such wrapping\n// exists.\nContentMatch.prototype.findWrapping = function findWrapping (target) {\n for (var i = 0; i < this.wrapCache.length; i += 2)\n { if (this.wrapCache[i] == target) { return this.wrapCache[i + 1] } }\n var computed = this.computeWrapping(target);\n this.wrapCache.push(target, computed);\n return computed\n};\n\nContentMatch.prototype.computeWrapping = function computeWrapping (target) {\n var seen = Object.create(null), active = [{match: this, type: null, via: null}];\n while (active.length) {\n var current = active.shift(), match = current.match;\n if (match.matchType(target)) {\n var result = [];\n for (var obj = current; obj.type; obj = obj.via)\n { result.push(obj.type); }\n return result.reverse()\n }\n for (var i = 0; i < match.next.length; i += 2) {\n var type = match.next[i];\n if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || match.next[i + 1].validEnd)) {\n active.push({match: type.contentMatch, type: type, via: current});\n seen[type.name] = true;\n }\n }\n }\n};\n\n// :: number\n// The number of outgoing edges this node has in the finite\n// automaton that describes the content expression.\nprototypeAccessors$4.edgeCount.get = function () {\n return this.next.length >> 1\n};\n\n// :: (number) → {type: NodeType, next: ContentMatch}\n// Get the _n_th outgoing edge from this node in the finite\n// automaton that describes the content expression.\nContentMatch.prototype.edge = function edge (n) {\n var i = n << 1;\n if (i >= this.next.length) { throw new RangeError((\"There's no \" + n + \"th edge in this content match\")) }\n return {type: this.next[i], next: this.next[i + 1]}\n};\n\nContentMatch.prototype.toString = function toString () {\n var seen = [];\n function scan(m) {\n seen.push(m);\n for (var i = 1; i < m.next.length; i += 2)\n { if (seen.indexOf(m.next[i]) == -1) { scan(m.next[i]); } }\n }\n scan(this);\n return seen.map(function (m, i) {\n var out = i + (m.validEnd ? \"*\" : \" \") + \" \";\n for (var i$1 = 0; i$1 < m.next.length; i$1 += 2)\n { out += (i$1 ? \", \" : \"\") + m.next[i$1].name + \"->\" + seen.indexOf(m.next[i$1 + 1]); }\n return out\n }).join(\"\\n\")\n};\n\nObject.defineProperties( ContentMatch.prototype, prototypeAccessors$4 );\n\nContentMatch.empty = new ContentMatch(true);\n\nvar TokenStream = function TokenStream(string, nodeTypes) {\n this.string = string;\n this.nodeTypes = nodeTypes;\n this.inline = null;\n this.pos = 0;\n this.tokens = string.split(/\\s*(?=\\b|\\W|$)/);\n if (this.tokens[this.tokens.length - 1] == \"\") { this.tokens.pop(); }\n if (this.tokens[0] == \"\") { this.tokens.unshift(); }\n};\n\nvar prototypeAccessors$1$2 = { next: { configurable: true } };\n\nprototypeAccessors$1$2.next.get = function () { return this.tokens[this.pos] };\n\nTokenStream.prototype.eat = function eat (tok) { return this.next == tok && (this.pos++ || true) };\n\nTokenStream.prototype.err = function err (str) { throw new SyntaxError(str + \" (in content expression '\" + this.string + \"')\") };\n\nObject.defineProperties( TokenStream.prototype, prototypeAccessors$1$2 );\n\nfunction parseExpr(stream) {\n var exprs = [];\n do { exprs.push(parseExprSeq(stream)); }\n while (stream.eat(\"|\"))\n return exprs.length == 1 ? exprs[0] : {type: \"choice\", exprs: exprs}\n}\n\nfunction parseExprSeq(stream) {\n var exprs = [];\n do { exprs.push(parseExprSubscript(stream)); }\n while (stream.next && stream.next != \")\" && stream.next != \"|\")\n return exprs.length == 1 ? exprs[0] : {type: \"seq\", exprs: exprs}\n}\n\nfunction parseExprSubscript(stream) {\n var expr = parseExprAtom(stream);\n for (;;) {\n if (stream.eat(\"+\"))\n { expr = {type: \"plus\", expr: expr}; }\n else if (stream.eat(\"*\"))\n { expr = {type: \"star\", expr: expr}; }\n else if (stream.eat(\"?\"))\n { expr = {type: \"opt\", expr: expr}; }\n else if (stream.eat(\"{\"))\n { expr = parseExprRange(stream, expr); }\n else { break }\n }\n return expr\n}\n\nfunction parseNum(stream) {\n if (/\\D/.test(stream.next)) { stream.err(\"Expected number, got '\" + stream.next + \"'\"); }\n var result = Number(stream.next);\n stream.pos++;\n return result\n}\n\nfunction parseExprRange(stream, expr) {\n var min = parseNum(stream), max = min;\n if (stream.eat(\",\")) {\n if (stream.next != \"}\") { max = parseNum(stream); }\n else { max = -1; }\n }\n if (!stream.eat(\"}\")) { stream.err(\"Unclosed braced range\"); }\n return {type: \"range\", min: min, max: max, expr: expr}\n}\n\nfunction resolveName(stream, name) {\n var types = stream.nodeTypes, type = types[name];\n if (type) { return [type] }\n var result = [];\n for (var typeName in types) {\n var type$1 = types[typeName];\n if (type$1.groups.indexOf(name) > -1) { result.push(type$1); }\n }\n if (result.length == 0) { stream.err(\"No node type or group '\" + name + \"' found\"); }\n return result\n}\n\nfunction parseExprAtom(stream) {\n if (stream.eat(\"(\")) {\n var expr = parseExpr(stream);\n if (!stream.eat(\")\")) { stream.err(\"Missing closing paren\"); }\n return expr\n } else if (!/\\W/.test(stream.next)) {\n var exprs = resolveName(stream, stream.next).map(function (type) {\n if (stream.inline == null) { stream.inline = type.isInline; }\n else if (stream.inline != type.isInline) { stream.err(\"Mixing inline and block content\"); }\n return {type: \"name\", value: type}\n });\n stream.pos++;\n return exprs.length == 1 ? exprs[0] : {type: \"choice\", exprs: exprs}\n } else {\n stream.err(\"Unexpected token '\" + stream.next + \"'\");\n }\n}\n\n// The code below helps compile a regular-expression-like language\n// into a deterministic finite automaton. For a good introduction to\n// these concepts, see https://swtch.com/~rsc/regexp/regexp1.html\n\n// : (Object) → [[{term: ?any, to: number}]]\n// Construct an NFA from an expression as returned by the parser. The\n// NFA is represented as an array of states, which are themselves\n// arrays of edges, which are `{term, to}` objects. The first state is\n// the entry state and the last node is the success state.\n//\n// Note that unlike typical NFAs, the edge ordering in this one is\n// significant, in that it is used to contruct filler content when\n// necessary.\nfunction nfa(expr) {\n var nfa = [[]];\n connect(compile(expr, 0), node());\n return nfa\n\n function node() { return nfa.push([]) - 1 }\n function edge(from, to, term) {\n var edge = {term: term, to: to};\n nfa[from].push(edge);\n return edge\n }\n function connect(edges, to) { edges.forEach(function (edge) { return edge.to = to; }); }\n\n function compile(expr, from) {\n if (expr.type == \"choice\") {\n return expr.exprs.reduce(function (out, expr) { return out.concat(compile(expr, from)); }, [])\n } else if (expr.type == \"seq\") {\n for (var i = 0;; i++) {\n var next = compile(expr.exprs[i], from);\n if (i == expr.exprs.length - 1) { return next }\n connect(next, from = node());\n }\n } else if (expr.type == \"star\") {\n var loop = node();\n edge(from, loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)]\n } else if (expr.type == \"plus\") {\n var loop$1 = node();\n connect(compile(expr.expr, from), loop$1);\n connect(compile(expr.expr, loop$1), loop$1);\n return [edge(loop$1)]\n } else if (expr.type == \"opt\") {\n return [edge(from)].concat(compile(expr.expr, from))\n } else if (expr.type == \"range\") {\n var cur = from;\n for (var i$1 = 0; i$1 < expr.min; i$1++) {\n var next$1 = node();\n connect(compile(expr.expr, cur), next$1);\n cur = next$1;\n }\n if (expr.max == -1) {\n connect(compile(expr.expr, cur), cur);\n } else {\n for (var i$2 = expr.min; i$2 < expr.max; i$2++) {\n var next$2 = node();\n edge(cur, next$2);\n connect(compile(expr.expr, cur), next$2);\n cur = next$2;\n }\n }\n return [edge(cur)]\n } else if (expr.type == \"name\") {\n return [edge(from, null, expr.value)]\n }\n }\n}\n\nfunction cmp(a, b) { return b - a }\n\n// Get the set of nodes reachable by null edges from `node`. Omit\n// nodes with only a single null-out-edge, since they may lead to\n// needless duplicated nodes.\nfunction nullFrom(nfa, node) {\n var result = [];\n scan(node);\n return result.sort(cmp)\n\n function scan(node) {\n var edges = nfa[node];\n if (edges.length == 1 && !edges[0].term) { return scan(edges[0].to) }\n result.push(node);\n for (var i = 0; i < edges.length; i++) {\n var ref = edges[i];\n var term = ref.term;\n var to = ref.to;\n if (!term && result.indexOf(to) == -1) { scan(to); }\n }\n }\n}\n\n// : ([[{term: ?any, to: number}]]) → ContentMatch\n// Compiles an NFA as produced by `nfa` into a DFA, modeled as a set\n// of state objects (`ContentMatch` instances) with transitions\n// between them.\nfunction dfa(nfa) {\n var labeled = Object.create(null);\n return explore(nullFrom(nfa, 0))\n\n function explore(states) {\n var out = [];\n states.forEach(function (node) {\n nfa[node].forEach(function (ref) {\n var term = ref.term;\n var to = ref.to;\n\n if (!term) { return }\n var known = out.indexOf(term), set = known > -1 && out[known + 1];\n nullFrom(nfa, to).forEach(function (node) {\n if (!set) { out.push(term, set = []); }\n if (set.indexOf(node) == -1) { set.push(node); }\n });\n });\n });\n var state = labeled[states.join(\",\")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);\n for (var i = 0; i < out.length; i += 2) {\n var states$1 = out[i + 1].sort(cmp);\n state.next.push(out[i], labeled[states$1.join(\",\")] || explore(states$1));\n }\n return state\n }\n}\n\nfunction checkForDeadEnds(match, stream) {\n for (var i = 0, work = [match]; i < work.length; i++) {\n var state = work[i], dead = !state.validEnd, nodes = [];\n for (var j = 0; j < state.next.length; j += 2) {\n var node = state.next[j], next = state.next[j + 1];\n nodes.push(node.name);\n if (dead && !(node.isText || node.hasRequiredAttrs())) { dead = false; }\n if (work.indexOf(next) == -1) { work.push(next); }\n }\n if (dead) { stream.err(\"Only non-generatable nodes (\" + nodes.join(\", \") + \") in a required position\"); }\n }\n}\n\n// For node types where all attrs have a default value (or which don't\n// have any attributes), build up a single reusable default attribute\n// object, and use it for all nodes that don't specify specific\n// attributes.\nfunction defaultAttrs(attrs) {\n var defaults = Object.create(null);\n for (var attrName in attrs) {\n var attr = attrs[attrName];\n if (!attr.hasDefault) { return null }\n defaults[attrName] = attr.default;\n }\n return defaults\n}\n\nfunction computeAttrs(attrs, value) {\n var built = Object.create(null);\n for (var name in attrs) {\n var given = value && value[name];\n if (given === undefined) {\n var attr = attrs[name];\n if (attr.hasDefault) { given = attr.default; }\n else { throw new RangeError(\"No value supplied for attribute \" + name) }\n }\n built[name] = given;\n }\n return built\n}\n\nfunction initAttrs(attrs) {\n var result = Object.create(null);\n if (attrs) { for (var name in attrs) { result[name] = new Attribute(attrs[name]); } }\n return result\n}\n\n// ::- Node types are objects allocated once per `Schema` and used to\n// [tag](#model.Node.type) `Node` instances. They contain information\n// about the node type, such as its name and what kind of node it\n// represents.\nvar NodeType = function NodeType(name, schema, spec) {\n // :: string\n // The name the node type has in this schema.\n this.name = name;\n\n // :: Schema\n // A link back to the `Schema` the node type belongs to.\n this.schema = schema;\n\n // :: NodeSpec\n // The spec that this type is based on\n this.spec = spec;\n\n this.groups = spec.group ? spec.group.split(\" \") : [];\n this.attrs = initAttrs(spec.attrs);\n\n this.defaultAttrs = defaultAttrs(this.attrs);\n\n // :: ContentMatch\n // The starting match of the node type's content expression.\n this.contentMatch = null;\n\n // : ?[MarkType]\n // The set of marks allowed in this node. `null` means all marks\n // are allowed.\n this.markSet = null;\n\n // :: bool\n // True if this node type has inline content.\n this.inlineContent = null;\n\n // :: bool\n // True if this is a block type\n this.isBlock = !(spec.inline || name == \"text\");\n\n // :: bool\n // True if this is the text node type.\n this.isText = name == \"text\";\n};\n\nvar prototypeAccessors$5 = { isInline: { configurable: true },isTextblock: { configurable: true },isLeaf: { configurable: true },isAtom: { configurable: true } };\n\n// :: bool\n// True if this is an inline type.\nprototypeAccessors$5.isInline.get = function () { return !this.isBlock };\n\n// :: bool\n// True if this is a textblock type, a block that contains inline\n// content.\nprototypeAccessors$5.isTextblock.get = function () { return this.isBlock && this.inlineContent };\n\n// :: bool\n// True for node types that allow no content.\nprototypeAccessors$5.isLeaf.get = function () { return this.contentMatch == ContentMatch.empty };\n\n// :: bool\n// True when this node is an atom, i.e. when it does not have\n// directly editable content.\nprototypeAccessors$5.isAtom.get = function () { return this.isLeaf || this.spec.atom };\n\n// :: () → bool\n// Tells you whether this node type has any required attributes.\nNodeType.prototype.hasRequiredAttrs = function hasRequiredAttrs () {\n for (var n in this.attrs) { if (this.attrs[n].isRequired) { return true } }\n return false\n};\n\nNodeType.prototype.compatibleContent = function compatibleContent (other) {\n return this == other || this.contentMatch.compatible(other.contentMatch)\n};\n\nNodeType.prototype.computeAttrs = function computeAttrs$1 (attrs) {\n if (!attrs && this.defaultAttrs) { return this.defaultAttrs }\n else { return computeAttrs(this.attrs, attrs) }\n};\n\n// :: (?Object, ?union<Fragment, Node, [Node]>, ?[Mark]) → Node\n// Create a `Node` of this type. The given attributes are\n// checked and defaulted (you can pass `null` to use the type's\n// defaults entirely, if no required attributes exist). `content`\n// may be a `Fragment`, a node, an array of nodes, or\n// `null`. Similarly `marks` may be `null` to default to the empty\n// set of marks.\nNodeType.prototype.create = function create (attrs, content, marks) {\n if (this.isText) { throw new Error(\"NodeType.create can't construct text nodes\") }\n return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks))\n};\n\n// :: (?Object, ?union<Fragment, Node, [Node]>, ?[Mark]) → Node\n// Like [`create`](#model.NodeType.create), but check the given content\n// against the node type's content restrictions, and throw an error\n// if it doesn't match.\nNodeType.prototype.createChecked = function createChecked (attrs, content, marks) {\n content = Fragment.from(content);\n if (!this.validContent(content))\n { throw new RangeError(\"Invalid content for node \" + this.name) }\n return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks))\n};\n\n// :: (?Object, ?union<Fragment, Node, [Node]>, ?[Mark]) → ?Node\n// Like [`create`](#model.NodeType.create), but see if it is necessary to\n// add nodes to the start or end of the given fragment to make it\n// fit the node. If no fitting wrapping can be found, return null.\n// Note that, due to the fact that required nodes can always be\n// created, this will always succeed if you pass null or\n// `Fragment.empty` as content.\nNodeType.prototype.createAndFill = function createAndFill (attrs, content, marks) {\n attrs = this.computeAttrs(attrs);\n content = Fragment.from(content);\n if (content.size) {\n var before = this.contentMatch.fillBefore(content);\n if (!before) { return null }\n content = before.append(content);\n }\n var after = this.contentMatch.matchFragment(content).fillBefore(Fragment.empty, true);\n if (!after) { return null }\n return new Node(this, attrs, content.append(after), Mark.setFrom(marks))\n};\n\n// :: (Fragment) → bool\n// Returns true if the given fragment is valid content for this node\n// type with the given attributes.\nNodeType.prototype.validContent = function validContent (content) {\n var result = this.contentMatch.matchFragment(content);\n if (!result || !result.validEnd) { return false }\n for (var i = 0; i < content.childCount; i++)\n { if (!this.allowsMarks(content.child(i).marks)) { return false } }\n return true\n};\n\n// :: (MarkType) → bool\n// Check whether the given mark type is allowed in this node.\nNodeType.prototype.allowsMarkType = function allowsMarkType (markType) {\n return this.markSet == null || this.markSet.indexOf(markType) > -1\n};\n\n// :: ([Mark]) → bool\n// Test whether the given set of marks are allowed in this node.\nNodeType.prototype.allowsMarks = function allowsMarks (marks) {\n if (this.markSet == null) { return true }\n for (var i = 0; i < marks.length; i++) { if (!this.allowsMarkType(marks[i].type)) { return false } }\n return true\n};\n\n// :: ([Mark]) → [Mark]\n// Removes the marks that are not allowed in this node from the given set.\nNodeType.prototype.allowedMarks = function allowedMarks (marks) {\n if (this.markSet == null) { return marks }\n var copy;\n for (var i = 0; i < marks.length; i++) {\n if (!this.allowsMarkType(marks[i].type)) {\n if (!copy) { copy = marks.slice(0, i); }\n } else if (copy) {\n copy.push(marks[i]);\n }\n }\n return !copy ? marks : copy.length ? copy : Mark.empty\n};\n\nNodeType.compile = function compile (nodes, schema) {\n var result = Object.create(null);\n nodes.forEach(function (name, spec) { return result[name] = new NodeType(name, schema, spec); });\n\n var topType = schema.spec.topNode || \"doc\";\n if (!result[topType]) { throw new RangeError(\"Schema is missing its top node type ('\" + topType + \"')\") }\n if (!result.text) { throw new RangeError(\"Every schema needs a 'text' type\") }\n for (var _ in result.text.attrs) { throw new RangeError(\"The text node type should not have attributes\") }\n\n return result\n};\n\nObject.defineProperties( NodeType.prototype, prototypeAccessors$5 );\n\n// Attribute descriptors\n\nvar Attribute = function Attribute(options) {\n this.hasDefault = Object.prototype.hasOwnProperty.call(options, \"default\");\n this.default = options.default;\n};\n\nvar prototypeAccessors$1$3 = { isRequired: { configurable: true } };\n\nprototypeAccessors$1$3.isRequired.get = function () {\n return !this.hasDefault\n};\n\nObject.defineProperties( Attribute.prototype, prototypeAccessors$1$3 );\n\n// Marks\n\n// ::- Like nodes, marks (which are associated with nodes to signify\n// things like emphasis or being part of a link) are\n// [tagged](#model.Mark.type) with type objects, which are\n// instantiated once per `Schema`.\nvar MarkType = function MarkType(name, rank, schema, spec) {\n // :: string\n // The name of the mark type.\n this.name = name;\n\n // :: Schema\n // The schema that this mark type instance is part of.\n this.schema = schema;\n\n // :: MarkSpec\n // The spec on which the type is based.\n this.spec = spec;\n\n this.attrs = initAttrs(spec.attrs);\n\n this.rank = rank;\n this.excluded = null;\n var defaults = defaultAttrs(this.attrs);\n this.instance = defaults && new Mark(this, defaults);\n};\n\n// :: (?Object) → Mark\n// Create a mark of this type. `attrs` may be `null` or an object\n// containing only some of the mark's attributes. The others, if\n// they have defaults, will be added.\nMarkType.prototype.create = function create (attrs) {\n if (!attrs && this.instance) { return this.instance }\n return new Mark(this, computeAttrs(this.attrs, attrs))\n};\n\nMarkType.compile = function compile (marks, schema) {\n var result = Object.create(null), rank = 0;\n marks.forEach(function (name, spec) { return result[name] = new MarkType(name, rank++, schema, spec); });\n return result\n};\n\n// :: ([Mark]) → [Mark]\n// When there is a mark of this type in the given set, a new set\n// without it is returned. Otherwise, the input set is returned.\nMarkType.prototype.removeFromSet = function removeFromSet (set) {\n for (var i = 0; i < set.length; i++)\n { if (set[i].type == this)\n { return set.slice(0, i).concat(set.slice(i + 1)) } }\n return set\n};\n\n// :: ([Mark]) → ?Mark\n// Tests whether there is a mark of this type in the given set.\nMarkType.prototype.isInSet = function isInSet (set) {\n for (var i = 0; i < set.length; i++)\n { if (set[i].type == this) { return set[i] } }\n};\n\n// :: (MarkType) → bool\n// Queries whether a given mark type is\n// [excluded](#model.MarkSpec.excludes) by this one.\nMarkType.prototype.excludes = function excludes (other) {\n return this.excluded.indexOf(other) > -1\n};\n\n// SchemaSpec:: interface\n// An object describing a schema, as passed to the [`Schema`](#model.Schema)\n// constructor.\n//\n// nodes:: union<Object<NodeSpec>, OrderedMap<NodeSpec>>\n// The node types in this schema. Maps names to\n// [`NodeSpec`](#model.NodeSpec) objects that describe the node type\n// associated with that name. Their order is significant—it\n// determines which [parse rules](#model.NodeSpec.parseDOM) take\n// precedence by default, and which nodes come first in a given\n// [group](#model.NodeSpec.group).\n//\n// marks:: ?union<Object<MarkSpec>, OrderedMap<MarkSpec>>\n// The mark types that exist in this schema. The order in which they\n// are provided determines the order in which [mark\n// sets](#model.Mark.addToSet) are sorted and in which [parse\n// rules](#model.MarkSpec.parseDOM) are tried.\n//\n// topNode:: ?string\n// The name of the default top-level node for the schema. Defaults\n// to `\"doc\"`.\n\n// NodeSpec:: interface\n//\n// content:: ?string\n// The content expression for this node, as described in the [schema\n// guide](/docs/guide/#schema.content_expressions). When not given,\n// the node does not allow any content.\n//\n// marks:: ?string\n// The marks that are allowed inside of this node. May be a\n// space-separated string referring to mark names or groups, `\"_\"`\n// to explicitly allow all marks, or `\"\"` to disallow marks. When\n// not given, nodes with inline content default to allowing all\n// marks, other nodes default to not allowing marks.\n//\n// group:: ?string\n// The group or space-separated groups to which this node belongs,\n// which can be referred to in the content expressions for the\n// schema.\n//\n// inline:: ?bool\n// Should be set to true for inline nodes. (Implied for text nodes.)\n//\n// atom:: ?bool\n// Can be set to true to indicate that, though this isn't a [leaf\n// node](#model.NodeType.isLeaf), it doesn't have directly editable\n// content and should be treated as a single unit in the view.\n//\n// attrs:: ?Object<AttributeSpec>\n// The attributes that nodes of this type get.\n//\n// selectable:: ?bool\n// Controls whether nodes of this type can be selected as a [node\n// selection](#state.NodeSelection). Defaults to true for non-text\n// nodes.\n//\n// draggable:: ?bool\n// Determines whether nodes of this type can be dragged without\n// being selected. Defaults to false.\n//\n// code:: ?bool\n// Can be used to indicate that this node contains code, which\n// causes some commands to behave differently.\n//\n// defining:: ?bool\n// Determines whether this node is considered an important parent\n// node during replace operations (such as paste). Non-defining (the\n// default) nodes get dropped when their entire content is replaced,\n// whereas defining nodes persist and wrap the inserted content.\n// Likewise, in _inserted_ content the defining parents of the\n// content are preserved when possible. Typically,\n// non-default-paragraph textblock types, and possibly list items,\n// are marked as defining.\n//\n// isolating:: ?bool\n// When enabled (default is false), the sides of nodes of this type\n// count as boundaries that regular editing operations, like\n// backspacing or lifting, won't cross. An example of a node that\n// should probably have this enabled is a table cell.\n//\n// toDOM:: ?(node: Node) → DOMOutputSpec\n// Defines the default way a node of this type should be serialized\n// to DOM/HTML (as used by\n// [`DOMSerializer.fromSchema`](#model.DOMSerializer^fromSchema)).\n// Should return a DOM node or an [array\n// structure](#model.DOMOutputSpec) that describes one, with an\n// optional number zero (“hole”) in it to indicate where the node's\n// content should be inserted.\n//\n// For text nodes, the default is to create a text DOM node. Though\n// it is possible to create a serializer where text is rendered\n// differently, this is not supported inside the editor, so you\n// shouldn't override that in your text node spec.\n//\n// parseDOM:: ?[ParseRule]\n// Associates DOM parser information with this node, which can be\n// used by [`DOMParser.fromSchema`](#model.DOMParser^fromSchema) to\n// automatically derive a parser. The `node` field in the rules is\n// implied (the name of this node will be filled in automatically).\n// If you supply your own parser, you do not need to also specify\n// parsing rules in your schema.\n//\n// toDebugString:: ?(node: Node) -> string\n// Defines the default way a node of this type should be serialized\n// to a string representation for debugging (e.g. in error messages).\n\n// MarkSpec:: interface\n//\n// attrs:: ?Object<AttributeSpec>\n// The attributes that marks of this type get.\n//\n// inclusive:: ?bool\n// Whether this mark should be active when the cursor is positioned\n// at its end (or at its start when that is also the start of the\n// parent node). Defaults to true.\n//\n// excludes:: ?string\n// Determines which other marks this mark can coexist with. Should\n// be a space-separated strings naming other marks or groups of marks.\n// When a mark is [added](#model.Mark.addToSet) to a set, all marks\n// that it excludes are removed in the process. If the set contains\n// any mark that excludes the new mark but is not, itself, excluded\n// by the new mark, the mark can not be added an the set. You can\n// use the value `\"_\"` to indicate that the mark excludes all\n// marks in the schema.\n//\n// Defaults to only being exclusive with marks of the same type. You\n// can set it to an empty string (or any string not containing the\n// mark's own name) to allow multiple marks of a given type to\n// coexist (as long as they have different attributes).\n//\n// group:: ?string\n// The group or space-separated groups to which this mark belongs.\n//\n// spanning:: ?bool\n// Determines whether marks of this type can span multiple adjacent\n// nodes when serialized to DOM/HTML. Defaults to true.\n//\n// toDOM:: ?(mark: Mark, inline: bool) → DOMOutputSpec\n// Defines the default way marks of this type should be serialized\n// to DOM/HTML. When the resulting spec contains a hole, that is\n// where the marked content is placed. Otherwise, it is appended to\n// the top node.\n//\n// parseDOM:: ?[ParseRule]\n// Associates DOM parser information with this mark (see the\n// corresponding [node spec field](#model.NodeSpec.parseDOM)). The\n// `mark` field in the rules is implied.\n\n// AttributeSpec:: interface\n//\n// Used to [define](#model.NodeSpec.attrs) attributes on nodes or\n// marks.\n//\n// default:: ?any\n// The default value for this attribute, to use when no explicit\n// value is provided. Attributes that have no default must be\n// provided whenever a node or mark of a type that has them is\n// created.\n\n// ::- A document schema. Holds [node](#model.NodeType) and [mark\n// type](#model.MarkType) objects for the nodes and marks that may\n// occur in conforming documents, and provides functionality for\n// creating and deserializing such documents.\nvar Schema = function Schema(spec) {\n // :: SchemaSpec\n // The [spec](#model.SchemaSpec) on which the schema is based,\n // with the added guarantee that its `nodes` and `marks`\n // properties are\n // [`OrderedMap`](https://github.com/marijnh/orderedmap) instances\n // (not raw objects).\n this.spec = {};\n for (var prop in spec) { this.spec[prop] = spec[prop]; }\n this.spec.nodes = OrderedMap.from(spec.nodes);\n this.spec.marks = OrderedMap.from(spec.marks);\n\n // :: Object<NodeType>\n // An object mapping the schema's node names to node type objects.\n this.nodes = NodeType.compile(this.spec.nodes, this);\n\n // :: Object<MarkType>\n // A map from mark names to mark type objects.\n this.marks = MarkType.compile(this.spec.marks, this);\n\n var contentExprCache = Object.create(null);\n for (var prop$1 in this.nodes) {\n if (prop$1 in this.marks)\n { throw new RangeError(prop$1 + \" can not be both a node and a mark\") }\n var type = this.nodes[prop$1], contentExpr = type.spec.content || \"\", markExpr = type.spec.marks;\n type.contentMatch = contentExprCache[contentExpr] ||\n (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));\n type.inlineContent = type.contentMatch.inlineContent;\n type.markSet = markExpr == \"_\" ? null :\n markExpr ? gatherMarks(this, markExpr.split(\" \")) :\n markExpr == \"\" || !type.inlineContent ? [] : null;\n }\n for (var prop$2 in this.marks) {\n var type$1 = this.marks[prop$2], excl = type$1.spec.excludes;\n type$1.excluded = excl == null ? [type$1] : excl == \"\" ? [] : gatherMarks(this, excl.split(\" \"));\n }\n\n this.nodeFromJSON = this.nodeFromJSON.bind(this);\n this.markFromJSON = this.markFromJSON.bind(this);\n\n // :: NodeType\n // The type of the [default top node](#model.SchemaSpec.topNode)\n // for this schema.\n this.topNodeType = this.nodes[this.spec.topNode || \"doc\"];\n\n // :: Object\n // An object for storing whatever values modules may want to\n // compute and cache per schema. (If you want to store something\n // in it, try to use property names unlikely to clash.)\n this.cached = Object.create(null);\n this.cached.wrappings = Object.create(null);\n};\n\n// :: (union<string, NodeType>, ?Object, ?union<Fragment, Node, [Node]>, ?[Mark]) → Node\n// Create a node in this schema. The `type` may be a string or a\n// `NodeType` instance. Attributes will be extended\n// with defaults, `content` may be a `Fragment`,\n// `null`, a `Node`, or an array of nodes.\nSchema.prototype.node = function node (type, attrs, content, marks) {\n if (typeof type == \"string\")\n { type = this.nodeType(type); }\n else if (!(type instanceof NodeType))\n { throw new RangeError(\"Invalid node type: \" + type) }\n else if (type.schema != this)\n { throw new RangeError(\"Node type from different schema used (\" + type.name + \")\") }\n\n return type.createChecked(attrs, content, marks)\n};\n\n// :: (string, ?[Mark]) → Node\n// Create a text node in the schema. Empty text nodes are not\n// allowed.\nSchema.prototype.text = function text (text$1, marks) {\n var type = this.nodes.text;\n return new TextNode(type, type.defaultAttrs, text$1, Mark.setFrom(marks))\n};\n\n// :: (union<string, MarkType>, ?Object) → Mark\n// Create a mark with the given type and attributes.\nSchema.prototype.mark = function mark (type, attrs) {\n if (typeof type == \"string\") { type = this.marks[type]; }\n return type.create(attrs)\n};\n\n// :: (Object) → Node\n// Deserialize a node from its JSON representation. This method is\n// bound.\nSchema.prototype.nodeFromJSON = function nodeFromJSON (json) {\n return Node.fromJSON(this, json)\n};\n\n// :: (Object) → Mark\n// Deserialize a mark from its JSON representation. This method is\n// bound.\nSchema.prototype.markFromJSON = function markFromJSON (json) {\n return Mark.fromJSON(this, json)\n};\n\nSchema.prototype.nodeType = function nodeType (name) {\n var found = this.nodes[name];\n if (!found) { throw new RangeError(\"Unknown node type: \" + name) }\n return found\n};\n\nfunction gatherMarks(schema, marks) {\n var found = [];\n for (var i = 0; i < marks.length; i++) {\n var name = marks[i], mark = schema.marks[name], ok = mark;\n if (mark) {\n found.push(mark);\n } else {\n for (var prop in schema.marks) {\n var mark$1 = schema.marks[prop];\n if (name == \"_\" || (mark$1.spec.group && mark$1.spec.group.split(\" \").indexOf(name) > -1))\n { found.push(ok = mark$1); }\n }\n }\n if (!ok) { throw new SyntaxError(\"Unknown mark type: '\" + marks[i] + \"'\") }\n }\n return found\n}\n\n// ParseOptions:: interface\n// These are the options recognized by the\n// [`parse`](#model.DOMParser.parse) and\n// [`parseSlice`](#model.DOMParser.parseSlice) methods.\n//\n// preserveWhitespace:: ?union<bool, \"full\">\n// By default, whitespace is collapsed as per HTML's rules. Pass\n// `true` to preserve whitespace, but normalize newlines to\n// spaces, and `\"full\"` to preserve whitespace entirely.\n//\n// findPositions:: ?[{node: dom.Node, offset: number}]\n// When given, the parser will, beside parsing the content,\n// record the document positions of the given DOM positions. It\n// will do so by writing to the objects, adding a `pos` property\n// that holds the document position. DOM positions that are not\n// in the parsed content will not be written to.\n//\n// from:: ?number\n// The child node index to start parsing from.\n//\n// to:: ?number\n// The child node index to stop parsing at.\n//\n// topNode:: ?Node\n// By default, the content is parsed into the schema's default\n// [top node type](#model.Schema.topNodeType). You can pass this\n// option to use the type and attributes from a different node\n// as the top container.\n//\n// topMatch:: ?ContentMatch\n// Provide the starting content match that content parsed into the\n// top node is matched against.\n//\n// context:: ?ResolvedPos\n// A set of additional nodes to count as\n// [context](#model.ParseRule.context) when parsing, above the\n// given [top node](#model.ParseOptions.topNode).\n\n// ParseRule:: interface\n// A value that describes how to parse a given DOM node or inline\n// style as a ProseMirror node or mark.\n//\n// tag:: ?string\n// A CSS selector describing the kind of DOM elements to match. A\n// single rule should have _either_ a `tag` or a `style` property.\n//\n// namespace:: ?string\n// The namespace to match. This should be used with `tag`.\n// Nodes are only matched when the namespace matches or this property\n// is null.\n//\n// style:: ?string\n// A CSS property name to match. When given, this rule matches\n// inline styles that list that property. May also have the form\n// `\"property=value\"`, in which case the rule only matches if the\n// propery's value exactly matches the given value. (For more\n// complicated filters, use [`getAttrs`](#model.ParseRule.getAttrs)\n// and return false to indicate that the match failed.)\n//\n// priority:: ?number\n// Can be used to change the order in which the parse rules in a\n// schema are tried. Those with higher priority come first. Rules\n// without a priority are counted as having priority 50. This\n// property is only meaningful in a schema—when directly\n// constructing a parser, the order of the rule array is used.\n//\n// context:: ?string\n// When given, restricts this rule to only match when the current\n// context—the parent nodes into which the content is being\n// parsed—matches this expression. Should contain one or more node\n// names or node group names followed by single or double slashes.\n// For example `\"paragraph/\"` means the rule only matches when the\n// parent node is a paragraph, `\"blockquote/paragraph/\"` restricts\n// it to be in a paragraph that is inside a blockquote, and\n// `\"section//\"` matches any position inside a section—a double\n// slash matches any sequence of ancestor nodes. To allow multiple\n// different contexts, they can be separated by a pipe (`|`)\n// character, as in `\"blockquote/|list_item/\"`.\n//\n// node:: ?string\n// The name of the node type to create when this rule matches. Only\n// valid for rules with a `tag` property, not for style rules. Each\n// rule should have one of a `node`, `mark`, or `ignore` property\n// (except when it appears in a [node](#model.NodeSpec.parseDOM) or\n// [mark spec](#model.MarkSpec.parseDOM), in which case the `node`\n// or `mark` property will be derived from its position).\n//\n// mark:: ?string\n// The name of the mark type to wrap the matched content in.\n//\n// ignore:: ?bool\n// When true, ignore content that matches this rule.\n//\n// skip:: ?bool\n// When true, ignore the node that matches this rule, but do parse\n// its content.\n//\n// attrs:: ?Object\n// Attributes for the node or mark created by this rule. When\n// `getAttrs` is provided, it takes precedence.\n//\n// getAttrs:: ?(union<dom.Node, string>) → ?union<Object, false>\n// A function used to compute the attributes for the node or mark\n// created by this rule. Can also be used to describe further\n// conditions the DOM element or style must match. When it returns\n// `false`, the rule won't match. When it returns null or undefined,\n// that is interpreted as an empty/default set of attributes.\n//\n// Called with a DOM Element for `tag` rules, and with a string (the\n// style's value) for `style` rules.\n//\n// contentElement:: ?union<string, (dom.Node) → dom.Node>\n// For `tag` rules that produce non-leaf nodes or marks, by default\n// the content of the DOM element is parsed as content of the mark\n// or node. If the child nodes are in a descendent node, this may be\n// a CSS selector string that the parser must use to find the actual\n// content element, or a function that returns the actual content\n// element to the parser.\n//\n// getContent:: ?(dom.Node, schema: Schema) → Fragment\n// Can be used to override the content of a matched node. When\n// present, instead of parsing the node's child nodes, the result of\n// this function is used.\n//\n// preserveWhitespace:: ?union<bool, \"full\">\n// Controls whether whitespace should be preserved when parsing the\n// content inside the matched element. `false` means whitespace may\n// be collapsed, `true` means that whitespace should be preserved\n// but newlines normalized to spaces, and `\"full\"` means that\n// newlines should also be preserved.\n\n// ::- A DOM parser represents a strategy for parsing DOM content into\n// a ProseMirror document conforming to a given schema. Its behavior\n// is defined by an array of [rules](#model.ParseRule).\nvar DOMParser = function DOMParser(schema, rules) {\n var this$1 = this;\n\n // :: Schema\n // The schema into which the parser parses.\n this.schema = schema;\n // :: [ParseRule]\n // The set of [parse rules](#model.ParseRule) that the parser\n // uses, in order of precedence.\n this.rules = rules;\n this.tags = [];\n this.styles = [];\n\n rules.forEach(function (rule) {\n if (rule.tag) { this$1.tags.push(rule); }\n else if (rule.style) { this$1.styles.push(rule); }\n });\n};\n\n// :: (dom.Node, ?ParseOptions) → Node\n// Parse a document from the content of a DOM node.\nDOMParser.prototype.parse = function parse (dom, options) {\n if ( options === void 0 ) options = {};\n\n var context = new ParseContext(this, options, false);\n context.addAll(dom, null, options.from, options.to);\n return context.finish()\n};\n\n// :: (dom.Node, ?ParseOptions) → Slice\n// Parses the content of the given DOM node, like\n// [`parse`](#model.DOMParser.parse), and takes the same set of\n// options. But unlike that method, which produces a whole node,\n// this one returns a slice that is open at the sides, meaning that\n// the schema constraints aren't applied to the start of nodes to\n// the left of the input and the end of nodes at the end.\nDOMParser.prototype.parseSlice = function parseSlice (dom, options) {\n if ( options === void 0 ) options = {};\n\n var context = new ParseContext(this, options, true);\n context.addAll(dom, null, options.from, options.to);\n return Slice.maxOpen(context.finish())\n};\n\nDOMParser.prototype.matchTag = function matchTag (dom, context) {\n for (var i = 0; i < this.tags.length; i++) {\n var rule = this.tags[i];\n if (matches(dom, rule.tag) &&\n (rule.namespace === undefined || dom.namespaceURI == rule.namespace) &&\n (!rule.context || context.matchesContext(rule.context))) {\n if (rule.getAttrs) {\n var result = rule.getAttrs(dom);\n if (result === false) { continue }\n rule.attrs = result;\n }\n return rule\n }\n }\n};\n\nDOMParser.prototype.matchStyle = function matchStyle (prop, value, context) {\n for (var i = 0; i < this.styles.length; i++) {\n var rule = this.styles[i];\n if (rule.style.indexOf(prop) != 0 ||\n rule.context && !context.matchesContext(rule.context) ||\n // Test that the style string either precisely matches the prop,\n // or has an '=' sign after the prop, followed by the given\n // value.\n rule.style.length > prop.length &&\n (rule.style.charCodeAt(prop.length) != 61 || rule.style.slice(prop.length + 1) != value))\n { continue }\n if (rule.getAttrs) {\n var result = rule.getAttrs(value);\n if (result === false) { continue }\n rule.attrs = result;\n }\n return rule\n }\n};\n\n// : (Schema) → [ParseRule]\nDOMParser.schemaRules = function schemaRules (schema) {\n var result = [];\n function insert(rule) {\n var priority = rule.priority == null ? 50 : rule.priority, i = 0;\n for (; i < result.length; i++) {\n var next = result[i], nextPriority = next.priority == null ? 50 : next.priority;\n if (nextPriority < priority) { break }\n }\n result.splice(i, 0, rule);\n }\n\n var loop = function ( name ) {\n var rules = schema.marks[name].spec.parseDOM;\n if (rules) { rules.forEach(function (rule) {\n insert(rule = copy(rule));\n rule.mark = name;\n }); }\n };\n\n for (var name in schema.marks) loop( name );\n var loop$1 = function ( name ) {\n var rules$1 = schema.nodes[name$1].spec.parseDOM;\n if (rules$1) { rules$1.forEach(function (rule) {\n insert(rule = copy(rule));\n rule.node = name$1;\n }); }\n };\n\n for (var name$1 in schema.nodes) loop$1();\n return result\n};\n\n// :: (Schema) → DOMParser\n// Construct a DOM parser using the parsing rules listed in a\n// schema's [node specs](#model.NodeSpec.parseDOM), reordered by\n// [priority](#model.ParseRule.priority).\nDOMParser.fromSchema = function fromSchema (schema) {\n return schema.cached.domParser ||\n (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)))\n};\n\n// : Object<bool> The block-level tags in HTML5\nvar blockTags = {\n address: true, article: true, aside: true, blockquote: true, canvas: true,\n dd: true, div: true, dl: true, fieldset: true, figcaption: true, figure: true,\n footer: true, form: true, h1: true, h2: true, h3: true, h4: true, h5: true,\n h6: true, header: true, hgroup: true, hr: true, li: true, noscript: true, ol: true,\n output: true, p: true, pre: true, section: true, table: true, tfoot: true, ul: true\n};\n\n// : Object<bool> The tags that we normally ignore.\nvar ignoreTags = {\n head: true, noscript: true, object: true, script: true, style: true, title: true\n};\n\n// : Object<bool> List tags.\nvar listTags = {ol: true, ul: true};\n\n// Using a bitfield for node context options\nvar OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;\n\nfunction wsOptionsFor(preserveWhitespace) {\n return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === \"full\" ? OPT_PRESERVE_WS_FULL : 0)\n}\n\nvar NodeContext = function NodeContext(type, attrs, marks, pendingMarks, solid, match, options) {\n this.type = type;\n this.attrs = attrs;\n this.solid = solid;\n this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);\n this.options = options;\n this.content = [];\n // Marks applied to this node itself\n this.marks = marks;\n // Marks applied to its children\n this.activeMarks = Mark.none;\n // Marks that can't apply here, but will be used in children if possible\n this.pendingMarks = pendingMarks;\n};\n\nNodeContext.prototype.findWrapping = function findWrapping (node) {\n if (!this.match) {\n if (!this.type) { return [] }\n var fill = this.type.contentMatch.fillBefore(Fragment.from(node));\n if (fill) {\n this.match = this.type.contentMatch.matchFragment(fill);\n } else {\n var start = this.type.contentMatch, wrap;\n if (wrap = start.findWrapping(node.type)) {\n this.match = start;\n return wrap\n } else {\n return null\n }\n }\n }\n return this.match.findWrapping(node.type)\n};\n\nNodeContext.prototype.finish = function finish (openEnd) {\n if (!(this.options & OPT_PRESERVE_WS)) { // Strip trailing whitespace\n var last = this.content[this.content.length - 1], m;\n if (last && last.isText && (m = /[ \\t\\r\\n\\u000c]+$/.exec(last.text))) {\n if (last.text.length == m[0].length) { this.content.pop(); }\n else { this.content[this.content.length - 1] = last.withText(last.text.slice(0, last.text.length - m[0].length)); }\n }\n }\n var content = Fragment.from(this.content);\n if (!openEnd && this.match)\n { content = content.append(this.match.fillBefore(Fragment.empty, true)); }\n return this.type ? this.type.create(this.attrs, content, this.marks) : content\n};\n\nNodeContext.prototype.applyPending = function applyPending (nextType) {\n for (var i = 0, pending = this.pendingMarks; i < pending.length; i++) {\n var mark = pending[i];\n if ((this.type ? this.type.allowsMarkType(mark.type) : markMayApply(mark.type, nextType)) &&\n !mark.isInSet(this.activeMarks)) {\n this.activeMarks = mark.addToSet(this.activeMarks);\n this.pendingMarks = mark.removeFromSet(this.pendingMarks);\n }\n }\n};\n\nvar ParseContext = function ParseContext(parser, options, open) {\n // : DOMParser The parser we are using.\n this.parser = parser;\n // : Object The options passed to this parse.\n this.options = options;\n this.isOpen = open;\n var topNode = options.topNode, topContext;\n var topOptions = wsOptionsFor(options.preserveWhitespace) | (open ? OPT_OPEN_LEFT : 0);\n if (topNode)\n { topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, Mark.none, true,\n options.topMatch || topNode.type.contentMatch, topOptions); }\n else if (open)\n { topContext = new NodeContext(null, null, Mark.none, Mark.none, true, null, topOptions); }\n else\n { topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, Mark.none, true, null, topOptions); }\n this.nodes = [topContext];\n // : [Mark] The current set of marks\n this.open = 0;\n this.find = options.findPositions;\n this.needsBlock = false;\n};\n\nvar prototypeAccessors$6 = { top: { configurable: true },currentPos: { configurable: true } };\n\nprototypeAccessors$6.top.get = function () {\n return this.nodes[this.open]\n};\n\n// : (dom.Node)\n// Add a DOM node to the content. Text is inserted as text node,\n// otherwise, the node is passed to `addElement` or, if it has a\n// `style` attribute, `addElementWithStyles`.\nParseContext.prototype.addDOM = function addDOM (dom) {\n if (dom.nodeType == 3) {\n this.addTextNode(dom);\n } else if (dom.nodeType == 1) {\n var style = dom.getAttribute(\"style\");\n var marks = style ? this.readStyles(parseStyles(style)) : null, top = this.top;\n if (marks != null) { for (var i = 0; i < marks.length; i++) { this.addPendingMark(marks[i]); } }\n this.addElement(dom);\n if (marks != null) { for (var i$1 = 0; i$1 < marks.length; i$1++) { this.removePendingMark(marks[i$1], top); } }\n }\n};\n\nParseContext.prototype.addTextNode = function addTextNode (dom) {\n var value = dom.nodeValue;\n var top = this.top;\n if ((top.type ? top.type.inlineContent : top.content.length && top.content[0].isInline) || /[^ \\t\\r\\n\\u000c]/.test(value)) {\n if (!(top.options & OPT_PRESERVE_WS)) {\n value = value.replace(/[ \\t\\r\\n\\u000c]+/g, \" \");\n // If this starts with whitespace, and there is no node before it, or\n // a hard break, or a text node that ends with whitespace, strip the\n // leading space.\n if (/^[ \\t\\r\\n\\u000c]/.test(value) && this.open == this.nodes.length - 1) {\n var nodeBefore = top.content[top.content.length - 1];\n var domNodeBefore = dom.previousSibling;\n if (!nodeBefore ||\n (domNodeBefore && domNodeBefore.nodeName == 'BR') ||\n (nodeBefore.isText && /[ \\t\\r\\n\\u000c]$/.test(nodeBefore.text)))\n { value = value.slice(1); }\n }\n } else if (!(top.options & OPT_PRESERVE_WS_FULL)) {\n value = value.replace(/\\r?\\n|\\r/g, \" \");\n }\n if (value) { this.insertNode(this.parser.schema.text(value)); }\n this.findInText(dom);\n } else {\n this.findInside(dom);\n }\n};\n\n// : (dom.Element)\n// Try to find a handler for the given tag and use that to parse. If\n// none is found, the element's content nodes are added directly.\nParseContext.prototype.addElement = function addElement (dom) {\n var name = dom.nodeName.toLowerCase();\n if (listTags.hasOwnProperty(name)) { normalizeList(dom); }\n var rule = (this.options.ruleFromNode && this.options.ruleFromNode(dom)) || this.parser.matchTag(dom, this);\n if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {\n this.findInside(dom);\n } else if (!rule || rule.skip) {\n if (rule && rule.skip.nodeType) { dom = rule.skip; }\n var sync, top = this.top, oldNeedsBlock = this.needsBlock;\n if (blockTags.hasOwnProperty(name)) {\n sync = true;\n if (!top.type) { this.needsBlock = true; }\n } else if (!dom.firstChild) {\n this.leafFallback(dom);\n return\n }\n this.addAll(dom);\n if (sync) { this.sync(top); }\n this.needsBlock = oldNeedsBlock;\n } else {\n this.addElementByRule(dom, rule);\n }\n};\n\n// Called for leaf DOM nodes that would otherwise be ignored\nParseContext.prototype.leafFallback = function leafFallback (dom) {\n if (dom.nodeName == \"BR\" && this.top.type && this.top.type.inlineContent)\n { this.addTextNode(dom.ownerDocument.createTextNode(\"\\n\")); }\n};\n\n// Run any style parser associated with the node's styles. Either\n// return an array of marks, or null to indicate some of the styles\n// had a rule with `ignore` set.\nParseContext.prototype.readStyles = function readStyles (styles) {\n var marks = Mark.none;\n for (var i = 0; i < styles.length; i += 2) {\n var rule = this.parser.matchStyle(styles[i], styles[i + 1], this);\n if (!rule) { continue }\n if (rule.ignore) { return null }\n marks = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(marks);\n }\n return marks\n};\n\n// : (dom.Element, ParseRule) → bool\n// Look up a handler for the given node. If none are found, return\n// false. Otherwise, apply it, use its return value to drive the way\n// the node's content is wrapped, and return true.\nParseContext.prototype.addElementByRule = function addElementByRule (dom, rule) {\n var this$1 = this;\n\n var sync, nodeType, markType, mark;\n if (rule.node) {\n nodeType = this.parser.schema.nodes[rule.node];\n if (!nodeType.isLeaf) {\n sync = this.enter(nodeType, rule.attrs, rule.preserveWhitespace);\n } else if (!this.insertNode(nodeType.create(rule.attrs))) {\n this.leafFallback(dom);\n }\n } else {\n markType = this.parser.schema.marks[rule.mark];\n mark = markType.create(rule.attrs);\n this.addPendingMark(mark);\n }\n var startIn = this.top;\n\n if (nodeType && nodeType.isLeaf) {\n this.findInside(dom);\n } else if (rule.getContent) {\n this.findInside(dom);\n rule.getContent(dom, this.parser.schema).forEach(function (node) { return this$1.insertNode(node); });\n } else {\n var contentDOM = rule.contentElement;\n if (typeof contentDOM == \"string\") { contentDOM = dom.querySelector(contentDOM); }\n else if (typeof contentDOM == \"function\") { contentDOM = contentDOM(dom); }\n if (!contentDOM) { contentDOM = dom; }\n this.findAround(dom, contentDOM, true);\n this.addAll(contentDOM, sync);\n }\n if (sync) { this.sync(startIn); this.open--; }\n if (mark) { this.removePendingMark(mark, startIn); }\n};\n\n// : (dom.Node, ?NodeBuilder, ?number, ?number)\n// Add all child nodes between `startIndex` and `endIndex` (or the\n// whole node, if not given). If `sync` is passed, use it to\n// synchronize after every block element.\nParseContext.prototype.addAll = function addAll (parent, sync, startIndex, endIndex) {\n var index = startIndex || 0;\n for (var dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild,\n end = endIndex == null ? null : parent.childNodes[endIndex];\n dom != end; dom = dom.nextSibling, ++index) {\n this.findAtPoint(parent, index);\n this.addDOM(dom);\n if (sync && blockTags.hasOwnProperty(dom.nodeName.toLowerCase()))\n { this.sync(sync); }\n }\n this.findAtPoint(parent, index);\n};\n\n// Try to find a way to fit the given node type into the current\n// context. May add intermediate wrappers and/or leave non-solid\n// nodes that we're in.\nParseContext.prototype.findPlace = function findPlace (node) {\n var route, sync;\n for (var depth = this.open; depth >= 0; depth--) {\n var cx = this.nodes[depth];\n var found = cx.findWrapping(node);\n if (found && (!route || route.length > found.length)) {\n route = found;\n sync = cx;\n if (!found.length) { break }\n }\n if (cx.solid) { break }\n }\n if (!route) { return false }\n this.sync(sync);\n for (var i = 0; i < route.length; i++)\n { this.enterInner(route[i], null, false); }\n return true\n};\n\n// : (Node) → ?Node\n// Try to insert the given node, adjusting the context when needed.\nParseContext.prototype.insertNode = function insertNode (node) {\n if (node.isInline && this.needsBlock && !this.top.type) {\n var block = this.textblockFromContext();\n if (block) { this.enterInner(block); }\n }\n if (this.findPlace(node)) {\n this.closeExtra();\n var top = this.top;\n top.applyPending(node.type);\n if (top.match) { top.match = top.match.matchType(node.type); }\n var marks = top.activeMarks;\n for (var i = 0; i < node.marks.length; i++)\n { if (!top.type || top.type.allowsMarkType(node.marks[i].type))\n { marks = node.marks[i].addToSet(marks); } }\n top.content.push(node.mark(marks));\n return true\n }\n return false\n};\n\n// : (NodeType, ?Object) → bool\n// Try to start a node of the given type, adjusting the context when\n// necessary.\nParseContext.prototype.enter = function enter (type, attrs, preserveWS) {\n var ok = this.findPlace(type.create(attrs));\n if (ok) { this.enterInner(type, attrs, true, preserveWS); }\n return ok\n};\n\n// Open a node of the given type\nParseContext.prototype.enterInner = function enterInner (type, attrs, solid, preserveWS) {\n this.closeExtra();\n var top = this.top;\n top.applyPending(type);\n top.match = top.match && top.match.matchType(type, attrs);\n var options = preserveWS == null ? top.options & ~OPT_OPEN_LEFT : wsOptionsFor(preserveWS);\n if ((top.options & OPT_OPEN_LEFT) && top.content.length == 0) { options |= OPT_OPEN_LEFT; }\n this.nodes.push(new NodeContext(type, attrs, top.activeMarks, top.pendingMarks, solid, null, options));\n this.open++;\n};\n\n// Make sure all nodes above this.open are finished and added to\n// their parents\nParseContext.prototype.closeExtra = function closeExtra (openEnd) {\n var i = this.nodes.length - 1;\n if (i > this.open) {\n for (; i > this.open; i--) { this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd)); }\n this.nodes.length = this.open + 1;\n }\n};\n\nParseContext.prototype.finish = function finish () {\n this.open = 0;\n this.closeExtra(this.isOpen);\n return this.nodes[0].finish(this.isOpen || this.options.topOpen)\n};\n\nParseContext.prototype.sync = function sync (to) {\n for (var i = this.open; i >= 0; i--) { if (this.nodes[i] == to) {\n this.open = i;\n return\n } }\n};\n\nprototypeAccessors$6.currentPos.get = function () {\n this.closeExtra();\n var pos = 0;\n for (var i = this.open; i >= 0; i--) {\n var content = this.nodes[i].content;\n for (var j = content.length - 1; j >= 0; j--)\n { pos += content[j].nodeSize; }\n if (i) { pos++; }\n }\n return pos\n};\n\nParseContext.prototype.findAtPoint = function findAtPoint (parent, offset) {\n if (this.find) { for (var i = 0; i < this.find.length; i++) {\n if (this.find[i].node == parent && this.find[i].offset == offset)\n { this.find[i].pos = this.currentPos; }\n } }\n};\n\nParseContext.prototype.findInside = function findInside (parent) {\n if (this.find) { for (var i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node))\n { this.find[i].pos = this.currentPos; }\n } }\n};\n\nParseContext.prototype.findAround = function findAround (parent, content, before) {\n if (parent != content && this.find) { for (var i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {\n var pos = content.compareDocumentPosition(this.find[i].node);\n if (pos & (before ? 2 : 4))\n { this.find[i].pos = this.currentPos; }\n }\n } }\n};\n\nParseContext.prototype.findInText = function findInText (textNode) {\n if (this.find) { for (var i = 0; i < this.find.length; i++) {\n if (this.find[i].node == textNode)\n { this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset); }\n } }\n};\n\n// : (string) → bool\n// Determines whether the given [context\n// string](#ParseRule.context) matches this context.\nParseContext.prototype.matchesContext = function matchesContext (context) {\n var this$1 = this;\n\n if (context.indexOf(\"|\") > -1)\n { return context.split(/\\s*\\|\\s*/).some(this.matchesContext, this) }\n\n var parts = context.split(\"/\");\n var option = this.options.context;\n var useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);\n var minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);\n var match = function (i, depth) {\n for (; i >= 0; i--) {\n var part = parts[i];\n if (part == \"\") {\n if (i == parts.length - 1 || i == 0) { continue }\n for (; depth >= minDepth; depth--)\n { if (match(i - 1, depth)) { return true } }\n return false\n } else {\n var next = depth > 0 || (depth == 0 && useRoot) ? this$1.nodes[depth].type\n : option && depth >= minDepth ? option.node(depth - minDepth).type\n : null;\n if (!next || (next.name != part && next.groups.indexOf(part) == -1))\n { return false }\n depth--;\n }\n }\n return true\n };\n return match(parts.length - 1, this.open)\n};\n\nParseContext.prototype.textblockFromContext = function textblockFromContext () {\n var $context = this.options.context;\n if ($context) { for (var d = $context.depth; d >= 0; d--) {\n var deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;\n if (deflt && deflt.isTextblock && deflt.defaultAttrs) { return deflt }\n } }\n for (var name in this.parser.schema.nodes) {\n var type = this.parser.schema.nodes[name];\n if (type.isTextblock && type.defaultAttrs) { return type }\n }\n};\n\nParseContext.prototype.addPendingMark = function addPendingMark (mark) {\n this.top.pendingMarks = mark.addToSet(this.top.pendingMarks);\n};\n\nParseContext.prototype.removePendingMark = function removePendingMark (mark, upto) {\n for (var depth = this.open; depth >= 0; depth--) {\n var level = this.nodes[depth];\n var found = level.pendingMarks.lastIndexOf(mark);\n if (found > -1) { level.pendingMarks = mark.removeFromSet(level.pendingMarks); }\n else { level.activeMarks = mark.removeFromSet(level.activeMarks); }\n if (level == upto) { break }\n }\n};\n\nObject.defineProperties( ParseContext.prototype, prototypeAccessors$6 );\n\n// Kludge to work around directly nested list nodes produced by some\n// tools and allowed by browsers to mean that the nested list is\n// actually part of the list item above it.\nfunction normalizeList(dom) {\n for (var child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {\n var name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;\n if (name && listTags.hasOwnProperty(name) && prevItem) {\n prevItem.appendChild(child);\n child = prevItem;\n } else if (name == \"li\") {\n prevItem = child;\n } else if (name) {\n prevItem = null;\n }\n }\n}\n\n// Apply a CSS selector.\nfunction matches(dom, selector) {\n return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector)\n}\n\n// : (string) → [string]\n// Tokenize a style attribute into property/value pairs.\nfunction parseStyles(style) {\n var re = /\\s*([\\w-]+)\\s*:\\s*([^;]+)/g, m, result = [];\n while (m = re.exec(style)) { result.push(m[1], m[2].trim()); }\n return result\n}\n\nfunction copy(obj) {\n var copy = {};\n for (var prop in obj) { copy[prop] = obj[prop]; }\n return copy\n}\n\n// Used when finding a mark at the top level of a fragment parse.\n// Checks whether it would be reasonable to apply a given mark type to\n// a given node, by looking at the way the mark occurs in the schema.\nfunction markMayApply(markType, nodeType) {\n var nodes = nodeType.schema.nodes;\n var loop = function ( name ) {\n var parent = nodes[name];\n if (!parent.allowsMarkType(markType)) { return }\n var seen = [], scan = function (match) {\n seen.push(match);\n for (var i = 0; i < match.edgeCount; i++) {\n var ref = match.edge(i);\n var type = ref.type;\n var next = ref.next;\n if (type == nodeType) { return true }\n if (seen.indexOf(next) < 0 && scan(next)) { return true }\n }\n };\n if (scan(parent.contentMatch)) { return { v: true } }\n };\n\n for (var name in nodes) {\n var returned = loop( name );\n\n if ( returned ) return returned.v;\n }\n}\n\n// DOMOutputSpec:: interface\n// A description of a DOM structure. Can be either a string, which is\n// interpreted as a text node, a DOM node, which is interpreted as\n// itself, or an array.\n//\n// An array describes a DOM element. The first value in the array\n// should be a string—the name of the DOM element, optionally prefixed\n// by a namespace URL and a space. If the second element is plain\n// object, it is interpreted as a set of attributes for the element.\n// Any elements after that (including the 2nd if it's not an attribute\n// object) are interpreted as children of the DOM elements, and must\n// either be valid `DOMOutputSpec` values, or the number zero.\n//\n// The number zero (pronounced “hole”) is used to indicate the place\n// where a node's child nodes should be inserted. If it occurs in an\n// output spec, it should be the only child element in its parent\n// node.\n\n// ::- A DOM serializer knows how to convert ProseMirror nodes and\n// marks of various types to DOM nodes.\nvar DOMSerializer = function DOMSerializer(nodes, marks) {\n // :: Object<(node: Node) → DOMOutputSpec>\n // The node serialization functions.\n this.nodes = nodes || {};\n // :: Object<?(mark: Mark, inline: bool) → DOMOutputSpec>\n // The mark serialization functions.\n this.marks = marks || {};\n};\n\n// :: (Fragment, ?Object) → dom.DocumentFragment\n// Serialize the content of this fragment to a DOM fragment. When\n// not in the browser, the `document` option, containing a DOM\n// document, should be passed so that the serializer can create\n// nodes.\nDOMSerializer.prototype.serializeFragment = function serializeFragment (fragment, options, target) {\n var this$1 = this;\n if ( options === void 0 ) options = {};\n\n if (!target) { target = doc(options).createDocumentFragment(); }\n\n var top = target, active = null;\n fragment.forEach(function (node) {\n if (active || node.marks.length) {\n if (!active) { active = []; }\n var keep = 0, rendered = 0;\n while (keep < active.length && rendered < node.marks.length) {\n var next = node.marks[rendered];\n if (!this$1.marks[next.type.name]) { rendered++; continue }\n if (!next.eq(active[keep]) || next.type.spec.spanning === false) { break }\n keep += 2; rendered++;\n }\n while (keep < active.length) {\n top = active.pop();\n active.pop();\n }\n while (rendered < node.marks.length) {\n var add = node.marks[rendered++];\n var markDOM = this$1.serializeMark(add, node.isInline, options);\n if (markDOM) {\n active.push(add, top);\n top.appendChild(markDOM.dom);\n top = markDOM.contentDOM || markDOM.dom;\n }\n }\n }\n top.appendChild(this$1.serializeNode(node, options));\n });\n\n return target\n};\n\n// :: (Node, ?Object) → dom.Node\n// Serialize this node to a DOM node. This can be useful when you\n// need to serialize a part of a document, as opposed to the whole\n// document. To serialize a whole document, use\n// [`serializeFragment`](#model.DOMSerializer.serializeFragment) on\n// its [content](#model.Node.content).\nDOMSerializer.prototype.serializeNode = function serializeNode (node, options) {\n if ( options === void 0 ) options = {};\n\n var ref =\n DOMSerializer.renderSpec(doc(options), this.nodes[node.type.name](node));\n var dom = ref.dom;\n var contentDOM = ref.contentDOM;\n if (contentDOM) {\n if (node.isLeaf)\n { throw new RangeError(\"Content hole not allowed in a leaf node spec\") }\n if (options.onContent)\n { options.onContent(node, contentDOM, options); }\n else\n { this.serializeFragment(node.content, options, contentDOM); }\n }\n return dom\n};\n\nDOMSerializer.prototype.serializeNodeAndMarks = function serializeNodeAndMarks (node, options) {\n if ( options === void 0 ) options = {};\n\n var dom = this.serializeNode(node, options);\n for (var i = node.marks.length - 1; i >= 0; i--) {\n var wrap = this.serializeMark(node.marks[i], node.isInline, options);\n if (wrap) {\n(wrap.contentDOM || wrap.dom).appendChild(dom);\n dom = wrap.dom;\n }\n }\n return dom\n};\n\nDOMSerializer.prototype.serializeMark = function serializeMark (mark, inline, options) {\n if ( options === void 0 ) options = {};\n\n var toDOM = this.marks[mark.type.name];\n return toDOM && DOMSerializer.renderSpec(doc(options), toDOM(mark, inline))\n};\n\n// :: (dom.Document, DOMOutputSpec) → {dom: dom.Node, contentDOM: ?dom.Node}\n// Render an [output spec](#model.DOMOutputSpec) to a DOM node. If\n// the spec has a hole (zero) in it, `contentDOM` will point at the\n// node with the hole.\nDOMSerializer.renderSpec = function renderSpec (doc, structure, xmlNS) {\n if ( xmlNS === void 0 ) xmlNS = null;\n\n if (typeof structure == \"string\")\n { return {dom: doc.createTextNode(structure)} }\n if (structure.nodeType != null)\n { return {dom: structure} }\n var tagName = structure[0], space = tagName.indexOf(\" \");\n if (space > 0) {\n xmlNS = tagName.slice(0, space);\n tagName = tagName.slice(space + 1);\n }\n var contentDOM = null, dom = xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName);\n var attrs = structure[1], start = 1;\n if (attrs && typeof attrs == \"object\" && attrs.nodeType == null && !Array.isArray(attrs)) {\n start = 2;\n for (var name in attrs) { if (attrs[name] != null) {\n var space$1 = name.indexOf(\" \");\n if (space$1 > 0) { dom.setAttributeNS(name.slice(0, space$1), name.slice(space$1 + 1), attrs[name]); }\n else { dom.setAttribute(name, attrs[name]); }\n } }\n }\n for (var i = start; i < structure.length; i++) {\n var child = structure[i];\n if (child === 0) {\n if (i < structure.length - 1 || i > start)\n { throw new RangeError(\"Content hole must be the only child of its parent node\") }\n return {dom: dom, contentDOM: dom}\n } else {\n var ref = DOMSerializer.renderSpec(doc, child, xmlNS);\n var inner = ref.dom;\n var innerContent = ref.contentDOM;\n dom.appendChild(inner);\n if (innerContent) {\n if (contentDOM) { throw new RangeError(\"Multiple content holes\") }\n contentDOM = innerContent;\n }\n }\n }\n return {dom: dom, contentDOM: contentDOM}\n};\n\n// :: (Schema) → DOMSerializer\n// Build a serializer using the [`toDOM`](#model.NodeSpec.toDOM)\n// properties in a schema's node and mark specs.\nDOMSerializer.fromSchema = function fromSchema (schema) {\n return schema.cached.domSerializer ||\n (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)))\n};\n\n// : (Schema) → Object<(node: Node) → DOMOutputSpec>\n// Gather the serializers in a schema's node specs into an object.\n// This can be useful as a base to build a custom serializer from.\nDOMSerializer.nodesFromSchema = function nodesFromSchema (schema) {\n var result = gatherToDOM(schema.nodes);\n if (!result.text) { result.text = function (node) { return node.text; }; }\n return result\n};\n\n// : (Schema) → Object<(mark: Mark) → DOMOutputSpec>\n// Gather the serializers in a schema's mark specs into an object.\nDOMSerializer.marksFromSchema = function marksFromSchema (schema) {\n return gatherToDOM(schema.marks)\n};\n\nfunction gatherToDOM(obj) {\n var result = {};\n for (var name in obj) {\n var toDOM = obj[name].spec.toDOM;\n if (toDOM) { result[name] = toDOM; }\n }\n return result\n}\n\nfunction doc(options) {\n // declare global: window\n return options.document || window.document\n}\n\nexport { ContentMatch, DOMParser, DOMSerializer, Fragment, Mark, MarkType, Node, NodeRange, NodeType, ReplaceError, ResolvedPos, Schema, Slice };\n//# sourceMappingURL=index.es.js.map\n","import { ReplaceError, Slice, Fragment, MarkType } from 'prosemirror-model';\n\n// Mappable:: interface\n// There are several things that positions can be mapped through.\n// Such objects conform to this interface.\n//\n// map:: (pos: number, assoc: ?number) → number\n// Map a position through this object. When given, `assoc` (should\n// be -1 or 1, defaults to 1) determines with which side the\n// position is associated, which determines in which direction to\n// move when a chunk of content is inserted at the mapped position.\n//\n// mapResult:: (pos: number, assoc: ?number) → MapResult\n// Map a position, and return an object containing additional\n// information about the mapping. The result's `deleted` field tells\n// you whether the position was deleted (completely enclosed in a\n// replaced range) during the mapping. When content on only one side\n// is deleted, the position itself is only considered deleted when\n// `assoc` points in the direction of the deleted content.\n\n// Recovery values encode a range index and an offset. They are\n// represented as numbers, because tons of them will be created when\n// mapping, for example, a large number of decorations. The number's\n// lower 16 bits provide the index, the remaining bits the offset.\n//\n// Note: We intentionally don't use bit shift operators to en- and\n// decode these, since those clip to 32 bits, which we might in rare\n// cases want to overflow. A 64-bit float can represent 48-bit\n// integers precisely.\n\nvar lower16 = 0xffff;\nvar factor16 = Math.pow(2, 16);\n\nfunction makeRecover(index, offset) { return index + offset * factor16 }\nfunction recoverIndex(value) { return value & lower16 }\nfunction recoverOffset(value) { return (value - (value & lower16)) / factor16 }\n\n// ::- An object representing a mapped position with extra\n// information.\nvar MapResult = function MapResult(pos, deleted, recover) {\n if ( deleted === void 0 ) deleted = false;\n if ( recover === void 0 ) recover = null;\n\n // :: number The mapped version of the position.\n this.pos = pos;\n // :: bool Tells you whether the position was deleted, that is,\n // whether the step removed its surroundings from the document.\n this.deleted = deleted;\n this.recover = recover;\n};\n\n// :: class extends Mappable\n// A map describing the deletions and insertions made by a step, which\n// can be used to find the correspondence between positions in the\n// pre-step version of a document and the same position in the\n// post-step version.\nvar StepMap = function StepMap(ranges, inverted) {\n if ( inverted === void 0 ) inverted = false;\n\n this.ranges = ranges;\n this.inverted = inverted;\n};\n\nStepMap.prototype.recover = function recover (value) {\n var diff = 0, index = recoverIndex(value);\n if (!this.inverted) { for (var i = 0; i < index; i++)\n { diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1]; } }\n return this.ranges[index * 3] + diff + recoverOffset(value)\n};\n\n// : (number, ?number) → MapResult\nStepMap.prototype.mapResult = function mapResult (pos, assoc) {\n if ( assoc === void 0 ) assoc = 1;\n return this._map(pos, assoc, false) };\n\n// : (number, ?number) → number\nStepMap.prototype.map = function map (pos, assoc) {\n if ( assoc === void 0 ) assoc = 1;\n return this._map(pos, assoc, true) };\n\nStepMap.prototype._map = function _map (pos, assoc, simple) {\n var diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (var i = 0; i < this.ranges.length; i += 3) {\n var start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos) { break }\n var oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;\n if (pos <= end) {\n var side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;\n var result = start + diff + (side < 0 ? 0 : newSize);\n if (simple) { return result }\n var recover = makeRecover(i / 3, pos - start);\n return new MapResult(result, assoc < 0 ? pos != start : pos != end, recover)\n }\n diff += newSize - oldSize;\n }\n return simple ? pos + diff : new MapResult(pos + diff)\n};\n\nStepMap.prototype.touches = function touches (pos, recover) {\n var diff = 0, index = recoverIndex(recover);\n var oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (var i = 0; i < this.ranges.length; i += 3) {\n var start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos) { break }\n var oldSize = this.ranges[i + oldIndex], end = start + oldSize;\n if (pos <= end && i == index * 3) { return true }\n diff += this.ranges[i + newIndex] - oldSize;\n }\n return false\n};\n\n// :: ((oldStart: number, oldEnd: number, newStart: number, newEnd: number))\n// Calls the given function on each of the changed ranges included in\n// this map.\nStepMap.prototype.forEach = function forEach (f) {\n var oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (var i = 0, diff = 0; i < this.ranges.length; i += 3) {\n var start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);\n var oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];\n f(oldStart, oldStart + oldSize, newStart, newStart + newSize);\n diff += newSize - oldSize;\n }\n};\n\n// :: () → StepMap\n// Create an inverted version of this map. The result can be used to\n// map positions in the post-step document to the pre-step document.\nStepMap.prototype.invert = function invert () {\n return new StepMap(this.ranges, !this.inverted)\n};\n\nStepMap.prototype.toString = function toString () {\n return (this.inverted ? \"-\" : \"\") + JSON.stringify(this.ranges)\n};\n\n// :: (n: number) → StepMap\n// Create a map that moves all positions by offset `n` (which may be\n// negative). This can be useful when applying steps meant for a\n// sub-document to a larger document, or vice-versa.\nStepMap.offset = function offset (n) {\n return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n])\n};\n\nStepMap.empty = new StepMap([]);\n\n// :: class extends Mappable\n// A mapping represents a pipeline of zero or more [step\n// maps](#transform.StepMap). It has special provisions for losslessly\n// handling mapping positions through a series of steps in which some\n// steps are inverted versions of earlier steps. (This comes up when\n// ‘[rebasing](/docs/guide/#transform.rebasing)’ steps for\n// collaboration or history management.)\nvar Mapping = function Mapping(maps, mirror, from, to) {\n // :: [StepMap]\n // The step maps in this mapping.\n this.maps = maps || [];\n // :: number\n // The starting position in the `maps` array, used when `map` or\n // `mapResult` is called.\n this.from = from || 0;\n // :: number\n // The end position in the `maps` array.\n this.to = to == null ? this.maps.length : to;\n this.mirror = mirror;\n};\n\n// :: (?number, ?number) → Mapping\n// Create a mapping that maps only through a part of this one.\nMapping.prototype.slice = function slice (from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.maps.length;\n\n return new Mapping(this.maps, this.mirror, from, to)\n};\n\nMapping.prototype.copy = function copy () {\n return new Mapping(this.maps.slice(), this.mirror && this.mirror.slice(), this.from, this.to)\n};\n\n// :: (StepMap, ?number)\n// Add a step map to the end of this mapping. If `mirrors` is\n// given, it should be the index of the step map that is the mirror\n// image of this one.\nMapping.prototype.appendMap = function appendMap (map, mirrors) {\n this.to = this.maps.push(map);\n if (mirrors != null) { this.setMirror(this.maps.length - 1, mirrors); }\n};\n\n// :: (Mapping)\n// Add all the step maps in a given mapping to this one (preserving\n// mirroring information).\nMapping.prototype.appendMapping = function appendMapping (mapping) {\n for (var i = 0, startSize = this.maps.length; i < mapping.maps.length; i++) {\n var mirr = mapping.getMirror(i);\n this.appendMap(mapping.maps[i], mirr != null && mirr < i ? startSize + mirr : null);\n }\n};\n\n// :: (number) → ?number\n// Finds the offset of the step map that mirrors the map at the\n// given offset, in this mapping (as per the second argument to\n// `appendMap`).\nMapping.prototype.getMirror = function getMirror (n) {\n if (this.mirror) { for (var i = 0; i < this.mirror.length; i++)\n { if (this.mirror[i] == n) { return this.mirror[i + (i % 2 ? -1 : 1)] } } }\n};\n\nMapping.prototype.setMirror = function setMirror (n, m) {\n if (!this.mirror) { this.mirror = []; }\n this.mirror.push(n, m);\n};\n\n// :: (Mapping)\n// Append the inverse of the given mapping to this one.\nMapping.prototype.appendMappingInverted = function appendMappingInverted (mapping) {\n for (var i = mapping.maps.length - 1, totalSize = this.maps.length + mapping.maps.length; i >= 0; i--) {\n var mirr = mapping.getMirror(i);\n this.appendMap(mapping.maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : null);\n }\n};\n\n// :: () → Mapping\n// Create an inverted version of this mapping.\nMapping.prototype.invert = function invert () {\n var inverse = new Mapping;\n inverse.appendMappingInverted(this);\n return inverse\n};\n\n// : (number, ?number) → number\n// Map a position through this mapping.\nMapping.prototype.map = function map (pos, assoc) {\n if ( assoc === void 0 ) assoc = 1;\n\n if (this.mirror) { return this._map(pos, assoc, true) }\n for (var i = this.from; i < this.to; i++)\n { pos = this.maps[i].map(pos, assoc); }\n return pos\n};\n\n// : (number, ?number) → MapResult\n// Map a position through this mapping, returning a mapping\n// result.\nMapping.prototype.mapResult = function mapResult (pos, assoc) {\n if ( assoc === void 0 ) assoc = 1;\n return this._map(pos, assoc, false) };\n\nMapping.prototype._map = function _map (pos, assoc, simple) {\n var deleted = false, recoverables = null;\n\n for (var i = this.from; i < this.to; i++) {\n var map = this.maps[i], rec = recoverables && recoverables[i];\n if (rec != null && map.touches(pos, rec)) {\n pos = map.recover(rec);\n continue\n }\n\n var result = map.mapResult(pos, assoc);\n if (result.recover != null) {\n var corr = this.getMirror(i);\n if (corr != null && corr > i && corr < this.to) {\n if (result.deleted) {\n i = corr;\n pos = this.maps[corr].recover(result.recover);\n continue\n } else {\n(recoverables || (recoverables = Object.create(null)))[corr] = result.recover;\n }\n }\n }\n\n if (result.deleted) { deleted = true; }\n pos = result.pos;\n }\n\n return simple ? pos : new MapResult(pos, deleted)\n};\n\nfunction TransformError(message) {\n var err = Error.call(this, message);\n err.__proto__ = TransformError.prototype;\n return err\n}\n\nTransformError.prototype = Object.create(Error.prototype);\nTransformError.prototype.constructor = TransformError;\nTransformError.prototype.name = \"TransformError\";\n\n// ::- Abstraction to build up and track an array of\n// [steps](#transform.Step) representing a document transformation.\n//\n// Most transforming methods return the `Transform` object itself, so\n// that they can be chained.\nvar Transform = function Transform(doc) {\n // :: Node\n // The current document (the result of applying the steps in the\n // transform).\n this.doc = doc;\n // :: [Step]\n // The steps in this transform.\n this.steps = [];\n // :: [Node]\n // The documents before each of the steps.\n this.docs = [];\n // :: Mapping\n // A mapping with the maps for each of the steps in this transform.\n this.mapping = new Mapping;\n};\n\nvar prototypeAccessors = { before: { configurable: true },docChanged: { configurable: true } };\n\n// :: Node The starting document.\nprototypeAccessors.before.get = function () { return this.docs.length ? this.docs[0] : this.doc };\n\n// :: (step: Step) → this\n// Apply a new step in this transform, saving the result. Throws an\n// error when the step fails.\nTransform.prototype.step = function step (object) {\n var result = this.maybeStep(object);\n if (result.failed) { throw new TransformError(result.failed) }\n return this\n};\n\n// :: (Step) → StepResult\n// Try to apply a step in this transformation, ignoring it if it\n// fails. Returns the step result.\nTransform.prototype.maybeStep = function maybeStep (step) {\n var result = step.apply(this.doc);\n if (!result.failed) { this.addStep(step, result.doc); }\n return result\n};\n\n// :: bool\n// True when the document has been changed (when there are any\n// steps).\nprototypeAccessors.docChanged.get = function () {\n return this.steps.length > 0\n};\n\nTransform.prototype.addStep = function addStep (step, doc) {\n this.docs.push(this.doc);\n this.steps.push(step);\n this.mapping.appendMap(step.getMap());\n this.doc = doc;\n};\n\nObject.defineProperties( Transform.prototype, prototypeAccessors );\n\nfunction mustOverride() { throw new Error(\"Override me\") }\n\nvar stepsByID = Object.create(null);\n\n// ::- A step object represents an atomic change. It generally applies\n// only to the document it was created for, since the positions\n// stored in it will only make sense for that document.\n//\n// New steps are defined by creating classes that extend `Step`,\n// overriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`\n// methods, and registering your class with a unique\n// JSON-serialization identifier using\n// [`Step.jsonID`](#transform.Step^jsonID).\nvar Step = function Step () {};\n\nStep.prototype.apply = function apply (_doc) { return mustOverride() };\n\n// :: () → StepMap\n// Get the step map that represents the changes made by this step,\n// and which can be used to transform between positions in the old\n// and the new document.\nStep.prototype.getMap = function getMap () { return StepMap.empty };\n\n// :: (doc: Node) → Step\n// Create an inverted version of this step. Needs the document as it\n// was before the step as argument.\nStep.prototype.invert = function invert (_doc) { return mustOverride() };\n\n// :: (mapping: Mappable) → ?Step\n// Map this step through a mappable thing, returning either a\n// version of that step with its positions adjusted, or `null` if\n// the step was entirely deleted by the mapping.\nStep.prototype.map = function map (_mapping) { return mustOverride() };\n\n// :: (other: Step) → ?Step\n// Try to merge this step with another one, to be applied directly\n// after it. Returns the merged step when possible, null if the\n// steps can't be merged.\nStep.prototype.merge = function merge (_other) { return null };\n\n// :: () → Object\n// Create a JSON-serializeable representation of this step. When\n// defining this for a custom subclass, make sure the result object\n// includes the step type's [JSON id](#transform.Step^jsonID) under\n// the `stepType` property.\nStep.prototype.toJSON = function toJSON () { return mustOverride() };\n\n// :: (Schema, Object) → Step\n// Deserialize a step from its JSON representation. Will call\n// through to the step class' own implementation of this method.\nStep.fromJSON = function fromJSON (schema, json) {\n if (!json || !json.stepType) { throw new RangeError(\"Invalid input for Step.fromJSON\") }\n var type = stepsByID[json.stepType];\n if (!type) { throw new RangeError((\"No step type \" + (json.stepType) + \" defined\")) }\n return type.fromJSON(schema, json)\n};\n\n// :: (string, constructor<Step>)\n// To be able to serialize steps to JSON, each step needs a string\n// ID to attach to its JSON representation. Use this method to\n// register an ID for your step classes. Try to pick something\n// that's unlikely to clash with steps from other modules.\nStep.jsonID = function jsonID (id, stepClass) {\n if (id in stepsByID) { throw new RangeError(\"Duplicate use of step JSON ID \" + id) }\n stepsByID[id] = stepClass;\n stepClass.prototype.jsonID = id;\n return stepClass\n};\n\n// ::- The result of [applying](#transform.Step.apply) a step. Contains either a\n// new document or a failure value.\nvar StepResult = function StepResult(doc, failed) {\n // :: ?Node The transformed document.\n this.doc = doc;\n // :: ?string Text providing information about a failed step.\n this.failed = failed;\n};\n\n// :: (Node) → StepResult\n// Create a successful step result.\nStepResult.ok = function ok (doc) { return new StepResult(doc, null) };\n\n// :: (string) → StepResult\n// Create a failed step result.\nStepResult.fail = function fail (message) { return new StepResult(null, message) };\n\n// :: (Node, number, number, Slice) → StepResult\n// Call [`Node.replace`](#model.Node.replace) with the given\n// arguments. Create a successful result if it succeeds, and a\n// failed one if it throws a `ReplaceError`.\nStepResult.fromReplace = function fromReplace (doc, from, to, slice) {\n try {\n return StepResult.ok(doc.replace(from, to, slice))\n } catch (e) {\n if (e instanceof ReplaceError) { return StepResult.fail(e.message) }\n throw e\n }\n};\n\n// ::- Replace a part of the document with a slice of new content.\nvar ReplaceStep = /*@__PURE__*/(function (Step) {\n function ReplaceStep(from, to, slice, structure) {\n Step.call(this);\n this.from = from;\n this.to = to;\n this.slice = slice;\n this.structure = !!structure;\n }\n\n if ( Step ) ReplaceStep.__proto__ = Step;\n ReplaceStep.prototype = Object.create( Step && Step.prototype );\n ReplaceStep.prototype.constructor = ReplaceStep;\n\n ReplaceStep.prototype.apply = function apply (doc) {\n if (this.structure && contentBetween(doc, this.from, this.to))\n { return StepResult.fail(\"Structure replace would overwrite content\") }\n return StepResult.fromReplace(doc, this.from, this.to, this.slice)\n };\n\n ReplaceStep.prototype.getMap = function getMap () {\n return new StepMap([this.from, this.to - this.from, this.slice.size])\n };\n\n ReplaceStep.prototype.invert = function invert (doc) {\n return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to))\n };\n\n ReplaceStep.prototype.map = function map (mapping) {\n var from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted) { return null }\n return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice)\n };\n\n ReplaceStep.prototype.merge = function merge (other) {\n if (!(other instanceof ReplaceStep) || other.structure != this.structure) { return null }\n\n if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {\n var slice = this.slice.size + other.slice.size == 0 ? Slice.empty\n : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);\n return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure)\n } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {\n var slice$1 = this.slice.size + other.slice.size == 0 ? Slice.empty\n : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);\n return new ReplaceStep(other.from, this.to, slice$1, this.structure)\n } else {\n return null\n }\n };\n\n ReplaceStep.prototype.toJSON = function toJSON () {\n var json = {stepType: \"replace\", from: this.from, to: this.to};\n if (this.slice.size) { json.slice = this.slice.toJSON(); }\n if (this.structure) { json.structure = true; }\n return json\n };\n\n ReplaceStep.fromJSON = function fromJSON (schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n { throw new RangeError(\"Invalid input for ReplaceStep.fromJSON\") }\n return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure)\n };\n\n return ReplaceStep;\n}(Step));\n\nStep.jsonID(\"replace\", ReplaceStep);\n\n// ::- Replace a part of the document with a slice of content, but\n// preserve a range of the replaced content by moving it into the\n// slice.\nvar ReplaceAroundStep = /*@__PURE__*/(function (Step) {\n function ReplaceAroundStep(from, to, gapFrom, gapTo, slice, insert, structure) {\n Step.call(this);\n this.from = from;\n this.to = to;\n this.gapFrom = gapFrom;\n this.gapTo = gapTo;\n this.slice = slice;\n this.insert = insert;\n this.structure = !!structure;\n }\n\n if ( Step ) ReplaceAroundStep.__proto__ = Step;\n ReplaceAroundStep.prototype = Object.create( Step && Step.prototype );\n ReplaceAroundStep.prototype.constructor = ReplaceAroundStep;\n\n ReplaceAroundStep.prototype.apply = function apply (doc) {\n if (this.structure && (contentBetween(doc, this.from, this.gapFrom) ||\n contentBetween(doc, this.gapTo, this.to)))\n { return StepResult.fail(\"Structure gap-replace would overwrite content\") }\n\n var gap = doc.slice(this.gapFrom, this.gapTo);\n if (gap.openStart || gap.openEnd)\n { return StepResult.fail(\"Gap is not a flat range\") }\n var inserted = this.slice.insertAt(this.insert, gap.content);\n if (!inserted) { return StepResult.fail(\"Content does not fit in gap\") }\n return StepResult.fromReplace(doc, this.from, this.to, inserted)\n };\n\n ReplaceAroundStep.prototype.getMap = function getMap () {\n return new StepMap([this.from, this.gapFrom - this.from, this.insert,\n this.gapTo, this.to - this.gapTo, this.slice.size - this.insert])\n };\n\n ReplaceAroundStep.prototype.invert = function invert (doc) {\n var gap = this.gapTo - this.gapFrom;\n return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap,\n this.from + this.insert, this.from + this.insert + gap,\n doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from),\n this.gapFrom - this.from, this.structure)\n };\n\n ReplaceAroundStep.prototype.map = function map (mapping) {\n var from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n var gapFrom = mapping.map(this.gapFrom, -1), gapTo = mapping.map(this.gapTo, 1);\n if ((from.deleted && to.deleted) || gapFrom < from.pos || gapTo > to.pos) { return null }\n return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure)\n };\n\n ReplaceAroundStep.prototype.toJSON = function toJSON () {\n var json = {stepType: \"replaceAround\", from: this.from, to: this.to,\n gapFrom: this.gapFrom, gapTo: this.gapTo, insert: this.insert};\n if (this.slice.size) { json.slice = this.slice.toJSON(); }\n if (this.structure) { json.structure = true; }\n return json\n };\n\n ReplaceAroundStep.fromJSON = function fromJSON (schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\" ||\n typeof json.gapFrom != \"number\" || typeof json.gapTo != \"number\" || typeof json.insert != \"number\")\n { throw new RangeError(\"Invalid input for ReplaceAroundStep.fromJSON\") }\n return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo,\n Slice.fromJSON(schema, json.slice), json.insert, !!json.structure)\n };\n\n return ReplaceAroundStep;\n}(Step));\n\nStep.jsonID(\"replaceAround\", ReplaceAroundStep);\n\nfunction contentBetween(doc, from, to) {\n var $from = doc.resolve(from), dist = to - from, depth = $from.depth;\n while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {\n depth--;\n dist--;\n }\n if (dist > 0) {\n var next = $from.node(depth).maybeChild($from.indexAfter(depth));\n while (dist > 0) {\n if (!next || next.isLeaf) { return true }\n next = next.firstChild;\n dist--;\n }\n }\n return false\n}\n\nfunction canCut(node, start, end) {\n return (start == 0 || node.canReplace(start, node.childCount)) &&\n (end == node.childCount || node.canReplace(0, end))\n}\n\n// :: (NodeRange) → ?number\n// Try to find a target depth to which the content in the given range\n// can be lifted. Will not go across\n// [isolating](#model.NodeSpec.isolating) parent nodes.\nfunction liftTarget(range) {\n var parent = range.parent;\n var content = parent.content.cutByIndex(range.startIndex, range.endIndex);\n for (var depth = range.depth;; --depth) {\n var node = range.$from.node(depth);\n var index = range.$from.index(depth), endIndex = range.$to.indexAfter(depth);\n if (depth < range.depth && node.canReplace(index, endIndex, content))\n { return depth }\n if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex)) { break }\n }\n}\n\n// :: (NodeRange, number) → this\n// Split the content in the given range off from its parent, if there\n// is sibling content before or after it, and move it up the tree to\n// the depth specified by `target`. You'll probably want to use\n// [`liftTarget`](#transform.liftTarget) to compute `target`, to make\n// sure the lift is valid.\nTransform.prototype.lift = function(range, target) {\n var $from = range.$from;\n var $to = range.$to;\n var depth = range.depth;\n\n var gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);\n var start = gapStart, end = gapEnd;\n\n var before = Fragment.empty, openStart = 0;\n for (var d = depth, splitting = false; d > target; d--)\n { if (splitting || $from.index(d) > 0) {\n splitting = true;\n before = Fragment.from($from.node(d).copy(before));\n openStart++;\n } else {\n start--;\n } }\n var after = Fragment.empty, openEnd = 0;\n for (var d$1 = depth, splitting$1 = false; d$1 > target; d$1--)\n { if (splitting$1 || $to.after(d$1 + 1) < $to.end(d$1)) {\n splitting$1 = true;\n after = Fragment.from($to.node(d$1).copy(after));\n openEnd++;\n } else {\n end++;\n } }\n\n return this.step(new ReplaceAroundStep(start, end, gapStart, gapEnd,\n new Slice(before.append(after), openStart, openEnd),\n before.size - openStart, true))\n};\n\n// :: (NodeRange, NodeType, ?Object, ?NodeRange) → ?[{type: NodeType, attrs: ?Object}]\n// Try to find a valid way to wrap the content in the given range in a\n// node of the given type. May introduce extra nodes around and inside\n// the wrapper node, if necessary. Returns null if no valid wrapping\n// could be found. When `innerRange` is given, that range's content is\n// used as the content to fit into the wrapping, instead of the\n// content of `range`.\nfunction findWrapping(range, nodeType, attrs, innerRange) {\n if ( innerRange === void 0 ) innerRange = range;\n\n var around = findWrappingOutside(range, nodeType);\n var inner = around && findWrappingInside(innerRange, nodeType);\n if (!inner) { return null }\n return around.map(withAttrs).concat({type: nodeType, attrs: attrs}).concat(inner.map(withAttrs))\n}\n\nfunction withAttrs(type) { return {type: type, attrs: null} }\n\nfunction findWrappingOutside(range, type) {\n var parent = range.parent;\n var startIndex = range.startIndex;\n var endIndex = range.endIndex;\n var around = parent.contentMatchAt(startIndex).findWrapping(type);\n if (!around) { return null }\n var outer = around.length ? around[0] : type;\n return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null\n}\n\nfunction findWrappingInside(range, type) {\n var parent = range.parent;\n var startIndex = range.startIndex;\n var endIndex = range.endIndex;\n var inner = parent.child(startIndex);\n var inside = type.contentMatch.findWrapping(inner.type);\n if (!inside) { return null }\n var lastType = inside.length ? inside[inside.length - 1] : type;\n var innerMatch = lastType.contentMatch;\n for (var i = startIndex; innerMatch && i < endIndex; i++)\n { innerMatch = innerMatch.matchType(parent.child(i).type); }\n if (!innerMatch || !innerMatch.validEnd) { return null }\n return inside\n}\n\n// :: (NodeRange, [{type: NodeType, attrs: ?Object}]) → this\n// Wrap the given [range](#model.NodeRange) in the given set of wrappers.\n// The wrappers are assumed to be valid in this position, and should\n// probably be computed with [`findWrapping`](#transform.findWrapping).\nTransform.prototype.wrap = function(range, wrappers) {\n var content = Fragment.empty;\n for (var i = wrappers.length - 1; i >= 0; i--)\n { content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content)); }\n\n var start = range.start, end = range.end;\n return this.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true))\n};\n\n// :: (number, ?number, NodeType, ?Object) → this\n// Set the type of all textblocks (partly) between `from` and `to` to\n// the given node type with the given attributes.\nTransform.prototype.setBlockType = function(from, to, type, attrs) {\n var this$1 = this;\n if ( to === void 0 ) to = from;\n\n if (!type.isTextblock) { throw new RangeError(\"Type given to setBlockType should be a textblock\") }\n var mapFrom = this.steps.length;\n this.doc.nodesBetween(from, to, function (node, pos) {\n if (node.isTextblock && !node.hasMarkup(type, attrs) && canChangeType(this$1.doc, this$1.mapping.slice(mapFrom).map(pos), type)) {\n // Ensure all markup that isn't allowed in the new node type is cleared\n this$1.clearIncompatible(this$1.mapping.slice(mapFrom).map(pos, 1), type);\n var mapping = this$1.mapping.slice(mapFrom);\n var startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);\n this$1.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1,\n new Slice(Fragment.from(type.create(attrs, null, node.marks)), 0, 0), 1, true));\n return false\n }\n });\n return this\n};\n\nfunction canChangeType(doc, pos, type) {\n var $pos = doc.resolve(pos), index = $pos.index();\n return $pos.parent.canReplaceWith(index, index + 1, type)\n}\n\n// :: (number, ?NodeType, ?Object, ?[Mark]) → this\n// Change the type, attributes, and/or marks of the node at `pos`.\n// When `type` isn't given, the existing node type is preserved,\nTransform.prototype.setNodeMarkup = function(pos, type, attrs, marks) {\n var node = this.doc.nodeAt(pos);\n if (!node) { throw new RangeError(\"No node at given position\") }\n if (!type) { type = node.type; }\n var newNode = type.create(attrs, null, marks || node.marks);\n if (node.isLeaf)\n { return this.replaceWith(pos, pos + node.nodeSize, newNode) }\n\n if (!type.validContent(node.content))\n { throw new RangeError(\"Invalid content for node type \" + type.name) }\n\n return this.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1,\n new Slice(Fragment.from(newNode), 0, 0), 1, true))\n};\n\n// :: (Node, number, number, ?[?{type: NodeType, attrs: ?Object}]) → bool\n// Check whether splitting at the given position is allowed.\nfunction canSplit(doc, pos, depth, typesAfter) {\n if ( depth === void 0 ) depth = 1;\n\n var $pos = doc.resolve(pos), base = $pos.depth - depth;\n var innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating ||\n !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) ||\n !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))\n { return false }\n for (var d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n var node = $pos.node(d), index$1 = $pos.index(d);\n if (node.type.spec.isolating) { return false }\n var rest = node.content.cutByIndex(index$1, node.childCount);\n var after = (typesAfter && typesAfter[i]) || node;\n if (after != node) { rest = rest.replaceChild(0, after.type.create(after.attrs)); }\n if (!node.canReplace(index$1 + 1, node.childCount) || !after.type.validContent(rest))\n { return false }\n }\n var index = $pos.indexAfter(base);\n var baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type)\n}\n\n// :: (number, ?number, ?[?{type: NodeType, attrs: ?Object}]) → this\n// Split the node at the given position, and optionally, if `depth` is\n// greater than one, any number of nodes above that. By default, the\n// parts split off will inherit the node type of the original node.\n// This can be changed by passing an array of types and attributes to\n// use after the split.\nTransform.prototype.split = function(pos, depth, typesAfter) {\n if ( depth === void 0 ) depth = 1;\n\n var $pos = this.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty;\n for (var d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {\n before = Fragment.from($pos.node(d).copy(before));\n var typeAfter = typesAfter && typesAfter[i];\n after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));\n }\n return this.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true))\n};\n\n// :: (Node, number) → bool\n// Test whether the blocks before and after a given position can be\n// joined.\nfunction canJoin(doc, pos) {\n var $pos = doc.resolve(pos), index = $pos.index();\n return joinable($pos.nodeBefore, $pos.nodeAfter) &&\n $pos.parent.canReplace(index, index + 1)\n}\n\nfunction joinable(a, b) {\n return a && b && !a.isLeaf && a.canAppend(b)\n}\n\n// :: (Node, number, ?number) → ?number\n// Find an ancestor of the given position that can be joined to the\n// block before (or after if `dir` is positive). Returns the joinable\n// point, if any.\nfunction joinPoint(doc, pos, dir) {\n if ( dir === void 0 ) dir = -1;\n\n var $pos = doc.resolve(pos);\n for (var d = $pos.depth;; d--) {\n var before = (void 0), after = (void 0), index = $pos.index(d);\n if (d == $pos.depth) {\n before = $pos.nodeBefore;\n after = $pos.nodeAfter;\n } else if (dir > 0) {\n before = $pos.node(d + 1);\n index++;\n after = $pos.node(d).maybeChild(index);\n } else {\n before = $pos.node(d).maybeChild(index - 1);\n after = $pos.node(d + 1);\n }\n if (before && !before.isTextblock && joinable(before, after) &&\n $pos.node(d).canReplace(index, index + 1)) { return pos }\n if (d == 0) { break }\n pos = dir < 0 ? $pos.before(d) : $pos.after(d);\n }\n}\n\n// :: (number, ?number) → this\n// Join the blocks around the given position. If depth is 2, their\n// last and first siblings are also joined, and so on.\nTransform.prototype.join = function(pos, depth) {\n if ( depth === void 0 ) depth = 1;\n\n var step = new ReplaceStep(pos - depth, pos + depth, Slice.empty, true);\n return this.step(step)\n};\n\n// :: (Node, number, NodeType) → ?number\n// Try to find a point where a node of the given type can be inserted\n// near `pos`, by searching up the node hierarchy when `pos` itself\n// isn't a valid place but is at the start or end of a node. Return\n// null if no position was found.\nfunction insertPoint(doc, pos, nodeType) {\n var $pos = doc.resolve(pos);\n if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) { return pos }\n\n if ($pos.parentOffset == 0)\n { for (var d = $pos.depth - 1; d >= 0; d--) {\n var index = $pos.index(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType)) { return $pos.before(d + 1) }\n if (index > 0) { return null }\n } }\n if ($pos.parentOffset == $pos.parent.content.size)\n { for (var d$1 = $pos.depth - 1; d$1 >= 0; d$1--) {\n var index$1 = $pos.indexAfter(d$1);\n if ($pos.node(d$1).canReplaceWith(index$1, index$1, nodeType)) { return $pos.after(d$1 + 1) }\n if (index$1 < $pos.node(d$1).childCount) { return null }\n } }\n}\n\n// :: (Node, number, Slice) → ?number\n// Finds a position at or around the given position where the given\n// slice can be inserted. Will look at parent nodes' nearest boundary\n// and try there, even if the original position wasn't directly at the\n// start or end of that node. Returns null when no position was found.\nfunction dropPoint(doc, pos, slice) {\n var $pos = doc.resolve(pos);\n if (!slice.content.size) { return pos }\n var content = slice.content;\n for (var i = 0; i < slice.openStart; i++) { content = content.firstChild.content; }\n for (var pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {\n for (var d = $pos.depth; d >= 0; d--) {\n var bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;\n var insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);\n if (pass == 1\n ? $pos.node(d).canReplace(insertPos, insertPos, content)\n : $pos.node(d).contentMatchAt(insertPos).findWrapping(content.firstChild.type))\n { return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1) }\n }\n }\n return null\n}\n\nfunction mapFragment(fragment, f, parent) {\n var mapped = [];\n for (var i = 0; i < fragment.childCount; i++) {\n var child = fragment.child(i);\n if (child.content.size) { child = child.copy(mapFragment(child.content, f, child)); }\n if (child.isInline) { child = f(child, parent, i); }\n mapped.push(child);\n }\n return Fragment.fromArray(mapped)\n}\n\n// ::- Add a mark to all inline content between two positions.\nvar AddMarkStep = /*@__PURE__*/(function (Step) {\n function AddMarkStep(from, to, mark) {\n Step.call(this);\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n\n if ( Step ) AddMarkStep.__proto__ = Step;\n AddMarkStep.prototype = Object.create( Step && Step.prototype );\n AddMarkStep.prototype.constructor = AddMarkStep;\n\n AddMarkStep.prototype.apply = function apply (doc) {\n var this$1 = this;\n\n var oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);\n var parent = $from.node($from.sharedDepth(this.to));\n var slice = new Slice(mapFragment(oldSlice.content, function (node, parent) {\n if (!parent.type.allowsMarkType(this$1.mark.type)) { return node }\n return node.mark(this$1.mark.addToSet(node.marks))\n }, parent), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice)\n };\n\n AddMarkStep.prototype.invert = function invert () {\n return new RemoveMarkStep(this.from, this.to, this.mark)\n };\n\n AddMarkStep.prototype.map = function map (mapping) {\n var from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos) { return null }\n return new AddMarkStep(from.pos, to.pos, this.mark)\n };\n\n AddMarkStep.prototype.merge = function merge (other) {\n if (other instanceof AddMarkStep &&\n other.mark.eq(this.mark) &&\n this.from <= other.to && this.to >= other.from)\n { return new AddMarkStep(Math.min(this.from, other.from),\n Math.max(this.to, other.to), this.mark) }\n };\n\n AddMarkStep.prototype.toJSON = function toJSON () {\n return {stepType: \"addMark\", mark: this.mark.toJSON(),\n from: this.from, to: this.to}\n };\n\n AddMarkStep.fromJSON = function fromJSON (schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n { throw new RangeError(\"Invalid input for AddMarkStep.fromJSON\") }\n return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark))\n };\n\n return AddMarkStep;\n}(Step));\n\nStep.jsonID(\"addMark\", AddMarkStep);\n\n// ::- Remove a mark from all inline content between two positions.\nvar RemoveMarkStep = /*@__PURE__*/(function (Step) {\n function RemoveMarkStep(from, to, mark) {\n Step.call(this);\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n\n if ( Step ) RemoveMarkStep.__proto__ = Step;\n RemoveMarkStep.prototype = Object.create( Step && Step.prototype );\n RemoveMarkStep.prototype.constructor = RemoveMarkStep;\n\n RemoveMarkStep.prototype.apply = function apply (doc) {\n var this$1 = this;\n\n var oldSlice = doc.slice(this.from, this.to);\n var slice = new Slice(mapFragment(oldSlice.content, function (node) {\n return node.mark(this$1.mark.removeFromSet(node.marks))\n }), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice)\n };\n\n RemoveMarkStep.prototype.invert = function invert () {\n return new AddMarkStep(this.from, this.to, this.mark)\n };\n\n RemoveMarkStep.prototype.map = function map (mapping) {\n var from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos) { return null }\n return new RemoveMarkStep(from.pos, to.pos, this.mark)\n };\n\n RemoveMarkStep.prototype.merge = function merge (other) {\n if (other instanceof RemoveMarkStep &&\n other.mark.eq(this.mark) &&\n this.from <= other.to && this.to >= other.from)\n { return new RemoveMarkStep(Math.min(this.from, other.from),\n Math.max(this.to, other.to), this.mark) }\n };\n\n RemoveMarkStep.prototype.toJSON = function toJSON () {\n return {stepType: \"removeMark\", mark: this.mark.toJSON(),\n from: this.from, to: this.to}\n };\n\n RemoveMarkStep.fromJSON = function fromJSON (schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n { throw new RangeError(\"Invalid input for RemoveMarkStep.fromJSON\") }\n return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark))\n };\n\n return RemoveMarkStep;\n}(Step));\n\nStep.jsonID(\"removeMark\", RemoveMarkStep);\n\n// :: (number, number, Mark) → this\n// Add the given mark to the inline content between `from` and `to`.\nTransform.prototype.addMark = function(from, to, mark) {\n var this$1 = this;\n\n var removed = [], added = [], removing = null, adding = null;\n this.doc.nodesBetween(from, to, function (node, pos, parent) {\n if (!node.isInline) { return }\n var marks = node.marks;\n if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {\n var start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);\n var newSet = mark.addToSet(marks);\n\n for (var i = 0; i < marks.length; i++) {\n if (!marks[i].isInSet(newSet)) {\n if (removing && removing.to == start && removing.mark.eq(marks[i]))\n { removing.to = end; }\n else\n { removed.push(removing = new RemoveMarkStep(start, end, marks[i])); }\n }\n }\n\n if (adding && adding.to == start)\n { adding.to = end; }\n else\n { added.push(adding = new AddMarkStep(start, end, mark)); }\n }\n });\n\n removed.forEach(function (s) { return this$1.step(s); });\n added.forEach(function (s) { return this$1.step(s); });\n return this\n};\n\n// :: (number, number, ?union<Mark, MarkType>) → this\n// Remove marks from inline nodes between `from` and `to`. When `mark`\n// is a single mark, remove precisely that mark. When it is a mark type,\n// remove all marks of that type. When it is null, remove all marks of\n// any type.\nTransform.prototype.removeMark = function(from, to, mark) {\n var this$1 = this;\n if ( mark === void 0 ) mark = null;\n\n var matched = [], step = 0;\n this.doc.nodesBetween(from, to, function (node, pos) {\n if (!node.isInline) { return }\n step++;\n var toRemove = null;\n if (mark instanceof MarkType) {\n var found = mark.isInSet(node.marks);\n if (found) { toRemove = [found]; }\n } else if (mark) {\n if (mark.isInSet(node.marks)) { toRemove = [mark]; }\n } else {\n toRemove = node.marks;\n }\n if (toRemove && toRemove.length) {\n var end = Math.min(pos + node.nodeSize, to);\n for (var i = 0; i < toRemove.length; i++) {\n var style = toRemove[i], found$1 = (void 0);\n for (var j = 0; j < matched.length; j++) {\n var m = matched[j];\n if (m.step == step - 1 && style.eq(matched[j].style)) { found$1 = m; }\n }\n if (found$1) {\n found$1.to = end;\n found$1.step = step;\n } else {\n matched.push({style: style, from: Math.max(pos, from), to: end, step: step});\n }\n }\n }\n });\n matched.forEach(function (m) { return this$1.step(new RemoveMarkStep(m.from, m.to, m.style)); });\n return this\n};\n\n// :: (number, NodeType, ?ContentMatch) → this\n// Removes all marks and nodes from the content of the node at `pos`\n// that don't match the given new parent node type. Accepts an\n// optional starting [content match](#model.ContentMatch) as third\n// argument.\nTransform.prototype.clearIncompatible = function(pos, parentType, match) {\n if ( match === void 0 ) match = parentType.contentMatch;\n\n var node = this.doc.nodeAt(pos);\n var delSteps = [], cur = pos + 1;\n for (var i = 0; i < node.childCount; i++) {\n var child = node.child(i), end = cur + child.nodeSize;\n var allowed = match.matchType(child.type, child.attrs);\n if (!allowed) {\n delSteps.push(new ReplaceStep(cur, end, Slice.empty));\n } else {\n match = allowed;\n for (var j = 0; j < child.marks.length; j++) { if (!parentType.allowsMarkType(child.marks[j].type))\n { this.step(new RemoveMarkStep(cur, end, child.marks[j])); } }\n }\n cur = end;\n }\n if (!match.validEnd) {\n var fill = match.fillBefore(Fragment.empty, true);\n this.replace(cur, cur, new Slice(fill, 0, 0));\n }\n for (var i$1 = delSteps.length - 1; i$1 >= 0; i$1--) { this.step(delSteps[i$1]); }\n return this\n};\n\n// :: (Node, number, ?number, ?Slice) → ?Step\n// ‘Fit’ a slice into a given position in the document, producing a\n// [step](#transform.Step) that inserts it. Will return null if\n// there's no meaningful way to insert the slice here, or inserting it\n// would be a no-op (an empty slice over an empty range).\nfunction replaceStep(doc, from, to, slice) {\n if ( to === void 0 ) to = from;\n if ( slice === void 0 ) slice = Slice.empty;\n\n if (from == to && !slice.size) { return null }\n\n var $from = doc.resolve(from), $to = doc.resolve(to);\n // Optimization -- avoid work if it's obvious that it's not needed.\n if (fitsTrivially($from, $to, slice)) { return new ReplaceStep(from, to, slice) }\n var placed = placeSlice($from, slice);\n\n var fittedLeft = fitLeft($from, placed);\n var fitted = fitRight($from, $to, fittedLeft);\n if (!fitted) { return null }\n if (fittedLeft.size != fitted.size && canMoveText($from, $to, fittedLeft)) {\n var d = $to.depth, after = $to.after(d);\n while (d > 1 && after == $to.end(--d)) { ++after; }\n var fittedAfter = fitRight($from, doc.resolve(after), fittedLeft);\n if (fittedAfter)\n { return new ReplaceAroundStep(from, after, to, $to.end(), fittedAfter, fittedLeft.size) }\n }\n return fitted.size || from != to ? new ReplaceStep(from, to, fitted) : null\n}\n\n// :: (number, ?number, ?Slice) → this\n// Replace the part of the document between `from` and `to` with the\n// given `slice`.\nTransform.prototype.replace = function(from, to, slice) {\n if ( to === void 0 ) to = from;\n if ( slice === void 0 ) slice = Slice.empty;\n\n var step = replaceStep(this.doc, from, to, slice);\n if (step) { this.step(step); }\n return this\n};\n\n// :: (number, number, union<Fragment, Node, [Node]>) → this\n// Replace the given range with the given content, which may be a\n// fragment, node, or array of nodes.\nTransform.prototype.replaceWith = function(from, to, content) {\n return this.replace(from, to, new Slice(Fragment.from(content), 0, 0))\n};\n\n// :: (number, number) → this\n// Delete the content between the given positions.\nTransform.prototype.delete = function(from, to) {\n return this.replace(from, to, Slice.empty)\n};\n\n// :: (number, union<Fragment, Node, [Node]>) → this\n// Insert the given content at the given position.\nTransform.prototype.insert = function(pos, content) {\n return this.replaceWith(pos, pos, content)\n};\n\n\n\nfunction fitLeftInner($from, depth, placed, placedBelow) {\n var content = Fragment.empty, openEnd = 0, placedHere = placed[depth];\n if ($from.depth > depth) {\n var inner = fitLeftInner($from, depth + 1, placed, placedBelow || placedHere);\n openEnd = inner.openEnd + 1;\n content = Fragment.from($from.node(depth + 1).copy(inner.content));\n }\n\n if (placedHere) {\n content = content.append(placedHere.content);\n openEnd = placedHere.openEnd;\n }\n if (placedBelow) {\n content = content.append($from.node(depth).contentMatchAt($from.indexAfter(depth)).fillBefore(Fragment.empty, true));\n openEnd = 0;\n }\n\n return {content: content, openEnd: openEnd}\n}\n\nfunction fitLeft($from, placed) {\n var ref = fitLeftInner($from, 0, placed, false);\n var content = ref.content;\n var openEnd = ref.openEnd;\n return new Slice(content, $from.depth, openEnd || 0)\n}\n\nfunction fitRightJoin(content, parent, $from, $to, depth, openStart, openEnd) {\n var match, count = content.childCount, matchCount = count - (openEnd > 0 ? 1 : 0);\n var parentNode = openStart < 0 ? parent : $from.node(depth);\n if (openStart < 0)\n { match = parentNode.contentMatchAt(matchCount); }\n else if (count == 1 && openEnd > 0)\n { match = parentNode.contentMatchAt(openStart ? $from.index(depth) : $from.indexAfter(depth)); }\n else\n { match = parentNode.contentMatchAt($from.indexAfter(depth))\n .matchFragment(content, count > 0 && openStart ? 1 : 0, matchCount); }\n\n var toNode = $to.node(depth);\n if (openEnd > 0 && depth < $to.depth) {\n var after = toNode.content.cutByIndex($to.indexAfter(depth)).addToStart(content.lastChild);\n var joinable$1 = match.fillBefore(after, true);\n // Can't insert content if there's a single node stretched across this gap\n if (joinable$1 && joinable$1.size && openStart > 0 && count == 1) { joinable$1 = null; }\n\n if (joinable$1) {\n var inner = fitRightJoin(content.lastChild.content, content.lastChild, $from, $to,\n depth + 1, count == 1 ? openStart - 1 : -1, openEnd - 1);\n if (inner) {\n var last = content.lastChild.copy(inner);\n if (joinable$1.size)\n { return content.cutByIndex(0, count - 1).append(joinable$1).addToEnd(last) }\n else\n { return content.replaceChild(count - 1, last) }\n }\n }\n }\n if (openEnd > 0)\n { match = match.matchType((count == 1 && openStart > 0 ? $from.node(depth + 1) : content.lastChild).type); }\n\n // If we're here, the next level can't be joined, so we see what\n // happens if we leave it open.\n var toIndex = $to.index(depth);\n if (toIndex == toNode.childCount && !toNode.type.compatibleContent(parent.type)) { return null }\n var joinable = match.fillBefore(toNode.content, true, toIndex);\n for (var i = toIndex; joinable && i < toNode.content.childCount; i++)\n { if (!parentNode.type.allowsMarks(toNode.content.child(i).marks)) { joinable = null; } }\n if (!joinable) { return null }\n\n if (openEnd > 0) {\n var closed = fitRightClosed(content.lastChild, openEnd - 1, $from, depth + 1,\n count == 1 ? openStart - 1 : -1);\n content = content.replaceChild(count - 1, closed);\n }\n content = content.append(joinable);\n if ($to.depth > depth)\n { content = content.addToEnd(fitRightSeparate($to, depth + 1)); }\n return content\n}\n\nfunction fitRightClosed(node, openEnd, $from, depth, openStart) {\n var match, content = node.content, count = content.childCount;\n if (openStart >= 0)\n { match = $from.node(depth).contentMatchAt($from.indexAfter(depth))\n .matchFragment(content, openStart > 0 ? 1 : 0, count); }\n else\n { match = node.contentMatchAt(count); }\n\n if (openEnd > 0) {\n var closed = fitRightClosed(content.lastChild, openEnd - 1, $from, depth + 1,\n count == 1 ? openStart - 1 : -1);\n content = content.replaceChild(count - 1, closed);\n }\n\n return node.copy(content.append(match.fillBefore(Fragment.empty, true)))\n}\n\nfunction fitRightSeparate($to, depth) {\n var node = $to.node(depth);\n var fill = node.contentMatchAt(0).fillBefore(node.content, true, $to.index(depth));\n if ($to.depth > depth) { fill = fill.addToEnd(fitRightSeparate($to, depth + 1)); }\n return node.copy(fill)\n}\n\nfunction normalizeSlice(content, openStart, openEnd) {\n while (openStart > 0 && openEnd > 0 && content.childCount == 1) {\n content = content.firstChild.content;\n openStart--;\n openEnd--;\n }\n return new Slice(content, openStart, openEnd)\n}\n\n// : (ResolvedPos, ResolvedPos, number, Slice) → Slice\nfunction fitRight($from, $to, slice) {\n var fitted = fitRightJoin(slice.content, $from.node(0), $from, $to, 0, slice.openStart, slice.openEnd);\n if (!fitted) { return null }\n return normalizeSlice(fitted, slice.openStart, $to.depth)\n}\n\nfunction fitsTrivially($from, $to, slice) {\n return !slice.openStart && !slice.openEnd && $from.start() == $to.start() &&\n $from.parent.canReplace($from.index(), $to.index(), slice.content)\n}\n\nfunction canMoveText($from, $to, slice) {\n if (!$to.parent.isTextblock) { return false }\n\n var parent = slice.openEnd ? nodeRight(slice.content, slice.openEnd)\n : $from.node($from.depth - (slice.openStart - slice.openEnd));\n if (!parent.isTextblock) { return false }\n for (var i = $to.index(); i < $to.parent.childCount; i++)\n { if (!parent.type.allowsMarks($to.parent.child(i).marks)) { return false } }\n var match;\n if (slice.openEnd) {\n match = parent.contentMatchAt(parent.childCount);\n } else {\n match = parent.contentMatchAt(parent.childCount);\n if (slice.size) { match = match.matchFragment(slice.content, slice.openStart ? 1 : 0); }\n }\n match = match.matchFragment($to.parent.content, $to.index());\n return match && match.validEnd\n}\n\nfunction nodeRight(content, depth) {\n for (var i = 1; i < depth; i++) { content = content.lastChild.content; }\n return content.lastChild\n}\n\n// Algorithm for 'placing' the elements of a slice into a gap:\n//\n// We consider the content of each node that is open to the left to be\n// independently placeable. I.e. in <p(\"foo\"), p(\"bar\")>, when the\n// paragraph on the left is open, \"foo\" can be placed (somewhere on\n// the left side of the replacement gap) independently from p(\"bar\").\n//\n// So placeSlice splits up a slice into a number of sub-slices,\n// along with information on where they can be placed on the given\n// left-side edge. It works by walking the open side of the slice,\n// from the inside out, and trying to find a landing spot for each\n// element, by simultaneously scanning over the gap side. When no\n// place is found for an open node's content, it is left in that node.\n\n// : (ResolvedPos, Slice) → [{content: Fragment, openEnd: number, depth: number}]\nfunction placeSlice($from, slice) {\n var frontier = new Frontier($from);\n for (var pass = 1; slice.size && pass <= 3; pass++) {\n var value = frontier.placeSlice(slice.content, slice.openStart, slice.openEnd, pass);\n if (pass == 3 && value != slice && value.size) { pass = 0; } // Restart if the 3rd pass made progress but left content\n slice = value;\n }\n while (frontier.open.length) { frontier.closeNode(); }\n return frontier.placed\n}\n\n// Helper class that models the open side of the insert position,\n// keeping track of the content match and already inserted content\n// at each depth.\nvar Frontier = function Frontier($pos) {\n // : [{parent: Node, match: ContentMatch, content: Fragment, wrapper: bool, openEnd: number, depth: number}]\n this.open = [];\n for (var d = 0; d <= $pos.depth; d++) {\n var parent = $pos.node(d), match = parent.contentMatchAt($pos.indexAfter(d));\n this.open.push({parent: parent, match: match, content: Fragment.empty, wrapper: false, openEnd: 0, depth: d});\n }\n this.placed = [];\n};\n\n// : (Fragment, number, number, number, ?Node) → Slice\n// Tries to place the content of the given slice, and returns a\n// slice containing unplaced content.\n//\n// pass 1: try to fit directly\n// pass 2: allow wrapper nodes to be introduced\n// pass 3: allow unwrapping of nodes that aren't open\nFrontier.prototype.placeSlice = function placeSlice (fragment, openStart, openEnd, pass, parent) {\n if (openStart > 0) {\n var first = fragment.firstChild;\n var inner = this.placeSlice(first.content, Math.max(0, openStart - 1),\n openEnd && fragment.childCount == 1 ? openEnd - 1 : 0,\n pass, first);\n if (inner.content != first.content) {\n if (inner.content.size) {\n fragment = fragment.replaceChild(0, first.copy(inner.content));\n openStart = inner.openStart + 1;\n } else {\n if (fragment.childCount == 1) { openEnd = 0; }\n fragment = fragment.cutByIndex(1);\n openStart = 0;\n }\n }\n }\n var result = this.placeContent(fragment, openStart, openEnd, pass, parent);\n if (pass > 2 && result.size && openStart == 0) {\n var child = result.content.firstChild, single = result.content.childCount == 1;\n this.placeContent(child.content, 0, openEnd && single ? openEnd - 1 : 0, pass, child);\n result = single ? Fragment.empty : new Slice(result.content.cutByIndex(1), 0, openEnd);\n }\n return result\n};\n\nFrontier.prototype.placeContent = function placeContent (fragment, openStart, openEnd, pass, parent) {\n var i = 0;\n // Go over the fragment's children\n for (; i < fragment.childCount; i++) {\n var child = fragment.child(i), placed = false, last = i == fragment.childCount - 1;\n // Try each open node in turn, starting from the innermost\n for (var d = this.open.length - 1; d >= 0; d--) {\n var open = this.open[d], wrap = (void 0);\n\n // If pass > 1, it is allowed to wrap the node to help find a\n // fit, so if findWrapping returns something, we add open\n // nodes to the frontier for that wrapping.\n if (pass > 1 && (wrap = open.match.findWrapping(child.type)) &&\n !(parent && wrap.length && wrap[wrap.length - 1] == parent.type)) {\n while (this.open.length - 1 > d) { this.closeNode(); }\n for (var w = 0; w < wrap.length; w++) {\n open.match = open.match.matchType(wrap[w]);\n d++;\n open = {parent: wrap[w].create(),\n match: wrap[w].contentMatch,\n content: Fragment.empty, wrapper: true, openEnd: 0, depth: d + w};\n this.open.push(open);\n }\n }\n\n // See if the child fits here\n var match = open.match.matchType(child.type);\n if (!match) {\n var fill = open.match.fillBefore(Fragment.from(child));\n if (fill) {\n for (var j = 0; j < fill.childCount; j++) {\n var ch = fill.child(j);\n this.addNode(open, ch, 0);\n match = open.match.matchFragment(ch);\n }\n } else if (parent && open.match.matchType(parent.type)) {\n // Don't continue looking further up if the parent node\n // would fit here.\n break\n } else {\n continue\n }\n }\n\n // Close open nodes above this one, since we're starting to\n // add to this.\n while (this.open.length - 1 > d) { this.closeNode(); }\n // Strip marks from the child or close its start when necessary\n child = child.mark(open.parent.type.allowedMarks(child.marks));\n if (openStart) {\n child = closeNodeStart(child, openStart, last ? openEnd : 0);\n openStart = 0;\n }\n // Add the child to this open node and adjust its metadata\n this.addNode(open, child, last ? openEnd : 0);\n open.match = match;\n if (last) { openEnd = 0; }\n placed = true;\n break\n }\n // As soon as we've failed to place a node we stop looking at\n // later nodes\n if (!placed) { break }\n }\n // Close the current open node if it's not the the root and we\n // either placed up to the end of the node or the the current\n // slice depth's node type matches the open node's type\n if (this.open.length > 1 &&\n (i > 0 && i == fragment.childCount ||\n parent && this.open[this.open.length - 1].parent.type == parent.type))\n { this.closeNode(); }\n\n return new Slice(fragment.cutByIndex(i), openStart, openEnd)\n};\n\nFrontier.prototype.addNode = function addNode (open, node, openEnd) {\n open.content = closeFragmentEnd(open.content, open.openEnd).addToEnd(node);\n open.openEnd = openEnd;\n};\n\nFrontier.prototype.closeNode = function closeNode () {\n var open = this.open.pop();\n if (open.content.size == 0) ; else if (open.wrapper) {\n this.addNode(this.open[this.open.length - 1], open.parent.copy(open.content), open.openEnd + 1);\n } else {\n this.placed[open.depth] = {depth: open.depth, content: open.content, openEnd: open.openEnd};\n }\n};\n\nfunction closeNodeStart(node, openStart, openEnd) {\n var content = node.content;\n if (openStart > 1) {\n var first = closeNodeStart(node.firstChild, openStart - 1, node.childCount == 1 ? openEnd - 1 : 0);\n content = node.content.replaceChild(0, first);\n }\n var fill = node.type.contentMatch.fillBefore(content, openEnd == 0);\n return node.copy(fill.append(content))\n}\n\nfunction closeNodeEnd(node, depth) {\n var content = node.content;\n if (depth > 1) {\n var last = closeNodeEnd(node.lastChild, depth - 1);\n content = node.content.replaceChild(node.childCount - 1, last);\n }\n var fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);\n return node.copy(content.append(fill))\n}\n\nfunction closeFragmentEnd(fragment, depth) {\n return depth ? fragment.replaceChild(fragment.childCount - 1, closeNodeEnd(fragment.lastChild, depth)) : fragment\n}\n\n// :: (number, number, Slice) → this\n// Replace a range of the document with a given slice, using `from`,\n// `to`, and the slice's [`openStart`](#model.Slice.openStart) property\n// as hints, rather than fixed start and end points. This method may\n// grow the replaced area or close open nodes in the slice in order to\n// get a fit that is more in line with WYSIWYG expectations, by\n// dropping fully covered parent nodes of the replaced region when\n// they are marked [non-defining](#model.NodeSpec.defining), or\n// including an open parent node from the slice that _is_ marked as\n// [defining](#model.NodeSpec.defining).\n//\n// This is the method, for example, to handle paste. The similar\n// [`replace`](#transform.Transform.replace) method is a more\n// primitive tool which will _not_ move the start and end of its given\n// range, and is useful in situations where you need more precise\n// control over what happens.\nTransform.prototype.replaceRange = function(from, to, slice) {\n if (!slice.size) { return this.deleteRange(from, to) }\n\n var $from = this.doc.resolve(from), $to = this.doc.resolve(to);\n if (fitsTrivially($from, $to, slice))\n { return this.step(new ReplaceStep(from, to, slice)) }\n\n var targetDepths = coveredDepths($from, this.doc.resolve(to));\n // Can't replace the whole document, so remove 0 if it's present\n if (targetDepths[targetDepths.length - 1] == 0) { targetDepths.pop(); }\n // Negative numbers represent not expansion over the whole node at\n // that depth, but replacing from $from.before(-D) to $to.pos.\n var preferredTarget = -($from.depth + 1);\n targetDepths.unshift(preferredTarget);\n // This loop picks a preferred target depth, if one of the covering\n // depths is not outside of a defining node, and adds negative\n // depths for any depth that has $from at its start and does not\n // cross a defining node.\n for (var d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {\n var spec = $from.node(d).type.spec;\n if (spec.defining || spec.isolating) { break }\n if (targetDepths.indexOf(d) > -1) { preferredTarget = d; }\n else if ($from.before(d) == pos) { targetDepths.splice(1, 0, -d); }\n }\n // Try to fit each possible depth of the slice into each possible\n // target depth, starting with the preferred depths.\n var preferredTargetIndex = targetDepths.indexOf(preferredTarget);\n\n var leftNodes = [], preferredDepth = slice.openStart;\n for (var content = slice.content, i = 0;; i++) {\n var node = content.firstChild;\n leftNodes.push(node);\n if (i == slice.openStart) { break }\n content = node.content;\n }\n // Back up if the node directly above openStart, or the node above\n // that separated only by a non-defining textblock node, is defining.\n if (preferredDepth > 0 && leftNodes[preferredDepth - 1].type.spec.defining &&\n $from.node(preferredTargetIndex).type != leftNodes[preferredDepth - 1].type)\n { preferredDepth -= 1; }\n else if (preferredDepth >= 2 && leftNodes[preferredDepth - 1].isTextblock && leftNodes[preferredDepth - 2].type.spec.defining &&\n $from.node(preferredTargetIndex).type != leftNodes[preferredDepth - 2].type)\n { preferredDepth -= 2; }\n\n for (var j = slice.openStart; j >= 0; j--) {\n var openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);\n var insert = leftNodes[openDepth];\n if (!insert) { continue }\n for (var i$1 = 0; i$1 < targetDepths.length; i$1++) {\n // Loop over possible expansion levels, starting with the\n // preferred one\n var targetDepth = targetDepths[(i$1 + preferredTargetIndex) % targetDepths.length], expand = true;\n if (targetDepth < 0) { expand = false; targetDepth = -targetDepth; }\n var parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);\n if (parent.canReplaceWith(index, index, insert.type, insert.marks))\n { return this.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to,\n new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth),\n openDepth, slice.openEnd)) }\n }\n }\n\n var startSteps = this.steps.length;\n for (var i$2 = targetDepths.length - 1; i$2 >= 0; i$2--) {\n this.replace(from, to, slice);\n if (this.steps.length > startSteps) { break }\n var depth = targetDepths[i$2];\n if (i$2 < 0) { continue }\n from = $from.before(depth); to = $to.after(depth);\n }\n return this\n};\n\nfunction closeFragment(fragment, depth, oldOpen, newOpen, parent) {\n if (depth < oldOpen) {\n var first = fragment.firstChild;\n fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));\n }\n if (depth > newOpen) {\n var match = parent.contentMatchAt(0);\n var start = match.fillBefore(fragment).append(fragment);\n fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));\n }\n return fragment\n}\n\n// :: (number, number, Node) → this\n// Replace the given range with a node, but use `from` and `to` as\n// hints, rather than precise positions. When from and to are the same\n// and are at the start or end of a parent node in which the given\n// node doesn't fit, this method may _move_ them out towards a parent\n// that does allow the given node to be placed. When the given range\n// completely covers a parent node, this method may completely replace\n// that parent node.\nTransform.prototype.replaceRangeWith = function(from, to, node) {\n if (!node.isInline && from == to && this.doc.resolve(from).parent.content.size) {\n var point = insertPoint(this.doc, from, node.type);\n if (point != null) { from = to = point; }\n }\n return this.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0))\n};\n\n// :: (number, number) → this\n// Delete the given range, expanding it to cover fully covered\n// parent nodes until a valid replace is found.\nTransform.prototype.deleteRange = function(from, to) {\n var $from = this.doc.resolve(from), $to = this.doc.resolve(to);\n var covered = coveredDepths($from, $to);\n for (var i = 0; i < covered.length; i++) {\n var depth = covered[i], last = i == covered.length - 1;\n if ((last && depth == 0) || $from.node(depth).type.contentMatch.validEnd)\n { return this.delete($from.start(depth), $to.end(depth)) }\n if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))\n { return this.delete($from.before(depth), $to.after(depth)) }\n }\n for (var d = 1; d <= $from.depth && d <= $to.depth; d++) {\n if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d)\n { return this.delete($from.before(d), to) }\n }\n return this.delete(from, to)\n};\n\n// : (ResolvedPos, ResolvedPos) → [number]\n// Returns an array of all depths for which $from - $to spans the\n// whole content of the nodes at that depth.\nfunction coveredDepths($from, $to) {\n var result = [], minDepth = Math.min($from.depth, $to.depth);\n for (var d = minDepth; d >= 0; d--) {\n var start = $from.start(d);\n if (start < $from.pos - ($from.depth - d) ||\n $to.end(d) > $to.pos + ($to.depth - d) ||\n $from.node(d).type.spec.isolating ||\n $to.node(d).type.spec.isolating) { break }\n if (start == $to.start(d)) { result.push(d); }\n }\n return result\n}\n\nexport { AddMarkStep, MapResult, Mapping, RemoveMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, TransformError, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep };\n//# sourceMappingURL=index.es.js.map\n","var GOOD_LEAF_SIZE = 200;\n\n// :: class<T> A rope sequence is a persistent sequence data structure\n// that supports appending, prepending, and slicing without doing a\n// full copy. It is represented as a mostly-balanced tree.\nvar RopeSequence = function RopeSequence () {};\n\nRopeSequence.prototype.append = function append (other) {\n if (!other.length) { return this }\n other = RopeSequence.from(other);\n\n return (!this.length && other) ||\n (other.length < GOOD_LEAF_SIZE && this.leafAppend(other)) ||\n (this.length < GOOD_LEAF_SIZE && other.leafPrepend(this)) ||\n this.appendInner(other)\n};\n\n// :: (union<[T], RopeSequence<T>>) → RopeSequence<T>\n// Prepend an array or other rope to this one, returning a new rope.\nRopeSequence.prototype.prepend = function prepend (other) {\n if (!other.length) { return this }\n return RopeSequence.from(other).append(this)\n};\n\nRopeSequence.prototype.appendInner = function appendInner (other) {\n return new Append(this, other)\n};\n\n// :: (?number, ?number) → RopeSequence<T>\n// Create a rope repesenting a sub-sequence of this rope.\nRopeSequence.prototype.slice = function slice (from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.length;\n\n if (from >= to) { return RopeSequence.empty }\n return this.sliceInner(Math.max(0, from), Math.min(this.length, to))\n};\n\n// :: (number) → T\n// Retrieve the element at the given position from this rope.\nRopeSequence.prototype.get = function get (i) {\n if (i < 0 || i >= this.length) { return undefined }\n return this.getInner(i)\n};\n\n// :: ((element: T, index: number) → ?bool, ?number, ?number)\n// Call the given function for each element between the given\n// indices. This tends to be more efficient than looping over the\n// indices and calling `get`, because it doesn't have to descend the\n// tree for every element.\nRopeSequence.prototype.forEach = function forEach (f, from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.length;\n\n if (from <= to)\n { this.forEachInner(f, from, to, 0); }\n else\n { this.forEachInvertedInner(f, from, to, 0); }\n};\n\n// :: ((element: T, index: number) → U, ?number, ?number) → [U]\n// Map the given functions over the elements of the rope, producing\n// a flat array.\nRopeSequence.prototype.map = function map (f, from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.length;\n\n var result = [];\n this.forEach(function (elt, i) { return result.push(f(elt, i)); }, from, to);\n return result\n};\n\n// :: (?union<[T], RopeSequence<T>>) → RopeSequence<T>\n// Create a rope representing the given array, or return the rope\n// itself if a rope was given.\nRopeSequence.from = function from (values) {\n if (values instanceof RopeSequence) { return values }\n return values && values.length ? new Leaf(values) : RopeSequence.empty\n};\n\nvar Leaf = /*@__PURE__*/(function (RopeSequence) {\n function Leaf(values) {\n RopeSequence.call(this);\n this.values = values;\n }\n\n if ( RopeSequence ) Leaf.__proto__ = RopeSequence;\n Leaf.prototype = Object.create( RopeSequence && RopeSequence.prototype );\n Leaf.prototype.constructor = Leaf;\n\n var prototypeAccessors = { length: { configurable: true },depth: { configurable: true } };\n\n Leaf.prototype.flatten = function flatten () {\n return this.values\n };\n\n Leaf.prototype.sliceInner = function sliceInner (from, to) {\n if (from == 0 && to == this.length) { return this }\n return new Leaf(this.values.slice(from, to))\n };\n\n Leaf.prototype.getInner = function getInner (i) {\n return this.values[i]\n };\n\n Leaf.prototype.forEachInner = function forEachInner (f, from, to, start) {\n for (var i = from; i < to; i++)\n { if (f(this.values[i], start + i) === false) { return false } }\n };\n\n Leaf.prototype.forEachInvertedInner = function forEachInvertedInner (f, from, to, start) {\n for (var i = from - 1; i >= to; i--)\n { if (f(this.values[i], start + i) === false) { return false } }\n };\n\n Leaf.prototype.leafAppend = function leafAppend (other) {\n if (this.length + other.length <= GOOD_LEAF_SIZE)\n { return new Leaf(this.values.concat(other.flatten())) }\n };\n\n Leaf.prototype.leafPrepend = function leafPrepend (other) {\n if (this.length + other.length <= GOOD_LEAF_SIZE)\n { return new Leaf(other.flatten().concat(this.values)) }\n };\n\n prototypeAccessors.length.get = function () { return this.values.length };\n\n prototypeAccessors.depth.get = function () { return 0 };\n\n Object.defineProperties( Leaf.prototype, prototypeAccessors );\n\n return Leaf;\n}(RopeSequence));\n\n// :: RopeSequence\n// The empty rope sequence.\nRopeSequence.empty = new Leaf([]);\n\nvar Append = /*@__PURE__*/(function (RopeSequence) {\n function Append(left, right) {\n RopeSequence.call(this);\n this.left = left;\n this.right = right;\n this.length = left.length + right.length;\n this.depth = Math.max(left.depth, right.depth) + 1;\n }\n\n if ( RopeSequence ) Append.__proto__ = RopeSequence;\n Append.prototype = Object.create( RopeSequence && RopeSequence.prototype );\n Append.prototype.constructor = Append;\n\n Append.prototype.flatten = function flatten () {\n return this.left.flatten().concat(this.right.flatten())\n };\n\n Append.prototype.getInner = function getInner (i) {\n return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length)\n };\n\n Append.prototype.forEachInner = function forEachInner (f, from, to, start) {\n var leftLen = this.left.length;\n if (from < leftLen &&\n this.left.forEachInner(f, from, Math.min(to, leftLen), start) === false)\n { return false }\n if (to > leftLen &&\n this.right.forEachInner(f, Math.max(from - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false)\n { return false }\n };\n\n Append.prototype.forEachInvertedInner = function forEachInvertedInner (f, from, to, start) {\n var leftLen = this.left.length;\n if (from > leftLen &&\n this.right.forEachInvertedInner(f, from - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false)\n { return false }\n if (to < leftLen &&\n this.left.forEachInvertedInner(f, Math.min(from, leftLen), to, start) === false)\n { return false }\n };\n\n Append.prototype.sliceInner = function sliceInner (from, to) {\n if (from == 0 && to == this.length) { return this }\n var leftLen = this.left.length;\n if (to <= leftLen) { return this.left.slice(from, to) }\n if (from >= leftLen) { return this.right.slice(from - leftLen, to - leftLen) }\n return this.left.slice(from, leftLen).append(this.right.slice(0, to - leftLen))\n };\n\n Append.prototype.leafAppend = function leafAppend (other) {\n var inner = this.right.leafAppend(other);\n if (inner) { return new Append(this.left, inner) }\n };\n\n Append.prototype.leafPrepend = function leafPrepend (other) {\n var inner = this.left.leafPrepend(other);\n if (inner) { return new Append(inner, this.right) }\n };\n\n Append.prototype.appendInner = function appendInner (other) {\n if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1)\n { return new Append(this.left, new Append(this.right, other)) }\n return new Append(this, other)\n };\n\n return Append;\n}(RopeSequence));\n\nvar ropeSequence = RopeSequence;\n\nexport default ropeSequence;\n","import RopeSequence from 'rope-sequence';\nimport { Mapping } from 'prosemirror-transform';\nimport { PluginKey, Plugin } from 'prosemirror-state';\n\n// ProseMirror's history isn't simply a way to roll back to a previous\n// state, because ProseMirror supports applying changes without adding\n// them to the history (for example during collaboration).\n//\n// To this end, each 'Branch' (one for the undo history and one for\n// the redo history) keeps an array of 'Items', which can optionally\n// hold a step (an actual undoable change), and always hold a position\n// map (which is needed to move changes below them to apply to the\n// current document).\n//\n// An item that has both a step and a selection bookmark is the start\n// of an 'event' — a group of changes that will be undone or redone at\n// once. (It stores only the bookmark, since that way we don't have to\n// provide a document until the selection is actually applied, which\n// is useful when compressing.)\n\n// Used to schedule history compression\nvar max_empty_items = 500;\n\nvar Branch = function Branch(items, eventCount) {\n this.items = items;\n this.eventCount = eventCount;\n};\n\n// : (EditorState, bool) → ?{transform: Transform, selection: ?SelectionBookmark, remaining: Branch}\n// Pop the latest event off the branch's history and apply it\n// to a document transform.\nBranch.prototype.popEvent = function popEvent (state, preserveItems) {\n var this$1 = this;\n\n if (this.eventCount == 0) { return null }\n\n var end = this.items.length;\n for (;; end--) {\n var next = this.items.get(end - 1);\n if (next.selection) { --end; break }\n }\n\n var remap, mapFrom;\n if (preserveItems) {\n remap = this.remapping(end, this.items.length);\n mapFrom = remap.maps.length;\n }\n var transform = state.tr;\n var selection, remaining;\n var addAfter = [], addBefore = [];\n\n this.items.forEach(function (item, i) {\n if (!item.step) {\n if (!remap) {\n remap = this$1.remapping(end, i + 1);\n mapFrom = remap.maps.length;\n }\n mapFrom--;\n addBefore.push(item);\n return\n }\n\n if (remap) {\n addBefore.push(new Item(item.map));\n var step = item.step.map(remap.slice(mapFrom)), map;\n\n if (step && transform.maybeStep(step).doc) {\n map = transform.mapping.maps[transform.mapping.maps.length - 1];\n addAfter.push(new Item(map, null, null, addAfter.length + addBefore.length));\n }\n mapFrom--;\n if (map) { remap.appendMap(map, mapFrom); }\n } else {\n transform.maybeStep(item.step);\n }\n\n if (item.selection) {\n selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;\n remaining = new Branch(this$1.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this$1.eventCount - 1);\n return false\n }\n }, this.items.length, 0);\n\n return {remaining: remaining, transform: transform, selection: selection}\n};\n\n// : (Transform, ?SelectionBookmark, Object) → Branch\n// Create a new branch with the given transform added.\nBranch.prototype.addTransform = function addTransform (transform, selection, histOptions, preserveItems) {\n var newItems = [], eventCount = this.eventCount;\n var oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;\n\n for (var i = 0; i < transform.steps.length; i++) {\n var step = transform.steps[i].invert(transform.docs[i]);\n var item = new Item(transform.mapping.maps[i], step, selection), merged = (void 0);\n if (merged = lastItem && lastItem.merge(item)) {\n item = merged;\n if (i) { newItems.pop(); }\n else { oldItems = oldItems.slice(0, oldItems.length - 1); }\n }\n newItems.push(item);\n if (selection) {\n eventCount++;\n selection = null;\n }\n if (!preserveItems) { lastItem = item; }\n }\n var overflow = eventCount - histOptions.depth;\n if (overflow > DEPTH_OVERFLOW) {\n oldItems = cutOffEvents(oldItems, overflow);\n eventCount -= overflow;\n }\n return new Branch(oldItems.append(newItems), eventCount)\n};\n\nBranch.prototype.remapping = function remapping (from, to) {\n var maps = new Mapping;\n this.items.forEach(function (item, i) {\n var mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from\n ? mirrorPos = maps.maps.length - item.mirrorOffset : null;\n maps.appendMap(item.map, mirrorPos);\n }, from, to);\n return maps\n};\n\nBranch.prototype.addMaps = function addMaps (array) {\n if (this.eventCount == 0) { return this }\n return new Branch(this.items.append(array.map(function (map) { return new Item(map); })), this.eventCount)\n};\n\n// : (Transform, number)\n// When the collab module receives remote changes, the history has\n// to know about those, so that it can adjust the steps that were\n// rebased on top of the remote changes, and include the position\n// maps for the remote changes in its array of items.\nBranch.prototype.rebased = function rebased (rebasedTransform, rebasedCount) {\n if (!this.eventCount) { return this }\n\n var rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);\n\n var mapping = rebasedTransform.mapping;\n var newUntil = rebasedTransform.steps.length;\n var eventCount = this.eventCount;\n this.items.forEach(function (item) { if (item.selection) { eventCount--; } }, start);\n\n var iRebased = rebasedCount;\n this.items.forEach(function (item) {\n var pos = mapping.getMirror(--iRebased);\n if (pos == null) { return }\n newUntil = Math.min(newUntil, pos);\n var map = mapping.maps[pos];\n if (item.step) {\n var step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);\n var selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));\n if (selection) { eventCount++; }\n rebasedItems.push(new Item(map, step, selection));\n } else {\n rebasedItems.push(new Item(map));\n }\n }, start);\n\n var newMaps = [];\n for (var i = rebasedCount; i < newUntil; i++)\n { newMaps.push(new Item(mapping.maps[i])); }\n var items = this.items.slice(0, start).append(newMaps).append(rebasedItems);\n var branch = new Branch(items, eventCount);\n\n if (branch.emptyItemCount() > max_empty_items)\n { branch = branch.compress(this.items.length - rebasedItems.length); }\n return branch\n};\n\nBranch.prototype.emptyItemCount = function emptyItemCount () {\n var count = 0;\n this.items.forEach(function (item) { if (!item.step) { count++; } });\n return count\n};\n\n// Compressing a branch means rewriting it to push the air (map-only\n// items) out. During collaboration, these naturally accumulate\n// because each remote change adds one. The `upto` argument is used\n// to ensure that only the items below a given level are compressed,\n// because `rebased` relies on a clean, untouched set of items in\n// order to associate old items with rebased steps.\nBranch.prototype.compress = function compress (upto) {\n if ( upto === void 0 ) upto = this.items.length;\n\n var remap = this.remapping(0, upto), mapFrom = remap.maps.length;\n var items = [], events = 0;\n this.items.forEach(function (item, i) {\n if (i >= upto) {\n items.push(item);\n if (item.selection) { events++; }\n } else if (item.step) {\n var step = item.step.map(remap.slice(mapFrom)), map = step && step.getMap();\n mapFrom--;\n if (map) { remap.appendMap(map, mapFrom); }\n if (step) {\n var selection = item.selection && item.selection.map(remap.slice(mapFrom));\n if (selection) { events++; }\n var newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;\n if (merged = items.length && items[last].merge(newItem))\n { items[last] = merged; }\n else\n { items.push(newItem); }\n }\n } else if (item.map) {\n mapFrom--;\n }\n }, this.items.length, 0);\n return new Branch(RopeSequence.from(items.reverse()), events)\n};\n\nBranch.empty = new Branch(RopeSequence.empty, 0);\n\nfunction cutOffEvents(items, n) {\n var cutPoint;\n items.forEach(function (item, i) {\n if (item.selection && (n-- == 0)) {\n cutPoint = i;\n return false\n }\n });\n return items.slice(cutPoint)\n}\n\nvar Item = function Item(map, step, selection, mirrorOffset) {\n // The (forward) step map for this item.\n this.map = map;\n // The inverted step\n this.step = step;\n // If this is non-null, this item is the start of a group, and\n // this selection is the starting selection for the group (the one\n // that was active before the first step was applied)\n this.selection = selection;\n // If this item is the inverse of a previous mapping on the stack,\n // this points at the inverse's offset\n this.mirrorOffset = mirrorOffset;\n};\n\nItem.prototype.merge = function merge (other) {\n if (this.step && other.step && !other.selection) {\n var step = other.step.merge(this.step);\n if (step) { return new Item(step.getMap().invert(), step, this.selection) }\n }\n};\n\n// The value of the state field that tracks undo/redo history for that\n// state. Will be stored in the plugin state when the history plugin\n// is active.\nvar HistoryState = function HistoryState(done, undone, prevRanges, prevTime) {\n this.done = done;\n this.undone = undone;\n this.prevRanges = prevRanges;\n this.prevTime = prevTime;\n};\n\nvar DEPTH_OVERFLOW = 20;\n\n// : (HistoryState, EditorState, Transaction, Object)\n// Record a transformation in undo history.\nfunction applyTransaction(history, state, tr, options) {\n var historyTr = tr.getMeta(historyKey), rebased;\n if (historyTr) { return historyTr.historyState }\n\n if (tr.getMeta(closeHistoryKey)) { history = new HistoryState(history.done, history.undone, null, 0); }\n\n var appended = tr.getMeta(\"appendedTransaction\");\n\n if (tr.steps.length == 0) {\n return history\n } else if (appended && appended.getMeta(historyKey)) {\n if (appended.getMeta(historyKey).redo)\n { return new HistoryState(history.done.addTransform(tr, null, options, mustPreserveItems(state)),\n history.undone, rangesFor(tr.mapping.maps[tr.steps.length - 1]), history.prevTime) }\n else\n { return new HistoryState(history.done, history.undone.addTransform(tr, null, options, mustPreserveItems(state)),\n null, history.prevTime) }\n } else if (tr.getMeta(\"addToHistory\") !== false && !(appended && appended.getMeta(\"addToHistory\") === false)) {\n // Group transforms that occur in quick succession into one event.\n var newGroup = !appended && (history.prevTime < (tr.time || 0) - options.newGroupDelay ||\n !isAdjacentTo(tr, history.prevRanges));\n var prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1]);\n return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : null,\n options, mustPreserveItems(state)),\n Branch.empty, prevRanges, tr.time)\n } else if (rebased = tr.getMeta(\"rebased\")) {\n // Used by the collab module to tell the history that some of its\n // content has been rebased.\n return new HistoryState(history.done.rebased(tr, rebased),\n history.undone.rebased(tr, rebased),\n mapRanges(history.prevRanges, tr.mapping), history.prevTime)\n } else {\n return new HistoryState(history.done.addMaps(tr.mapping.maps),\n history.undone.addMaps(tr.mapping.maps),\n mapRanges(history.prevRanges, tr.mapping), history.prevTime)\n }\n}\n\nfunction isAdjacentTo(transform, prevRanges) {\n if (!prevRanges) { return false }\n if (!transform.docChanged) { return true }\n var adjacent = false;\n transform.mapping.maps[0].forEach(function (start, end) {\n for (var i = 0; i < prevRanges.length; i += 2)\n { if (start <= prevRanges[i + 1] && end >= prevRanges[i])\n { adjacent = true; } }\n });\n return adjacent\n}\n\nfunction rangesFor(map) {\n var result = [];\n map.forEach(function (_from, _to, from, to) { return result.push(from, to); });\n return result\n}\n\nfunction mapRanges(ranges, mapping) {\n if (!ranges) { return null }\n var result = [];\n for (var i = 0; i < ranges.length; i += 2) {\n var from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);\n if (from <= to) { result.push(from, to); }\n }\n return result\n}\n\n// : (HistoryState, EditorState, (tr: Transaction), bool)\n// Apply the latest event from one branch to the document and shift the event\n// onto the other branch.\nfunction histTransaction(history, state, dispatch, redo) {\n var preserveItems = mustPreserveItems(state), histOptions = historyKey.get(state).spec.config;\n var pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);\n if (!pop) { return }\n\n var selection = pop.selection.resolve(pop.transform.doc);\n var added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(),\n histOptions, preserveItems);\n\n var newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0);\n dispatch(pop.transform.setSelection(selection).setMeta(historyKey, {redo: redo, historyState: newHist}).scrollIntoView());\n}\n\nvar cachedPreserveItems = false, cachedPreserveItemsPlugins = null;\n// Check whether any plugin in the given state has a\n// `historyPreserveItems` property in its spec, in which case we must\n// preserve steps exactly as they came in, so that they can be\n// rebased.\nfunction mustPreserveItems(state) {\n var plugins = state.plugins;\n if (cachedPreserveItemsPlugins != plugins) {\n cachedPreserveItems = false;\n cachedPreserveItemsPlugins = plugins;\n for (var i = 0; i < plugins.length; i++) { if (plugins[i].spec.historyPreserveItems) {\n cachedPreserveItems = true;\n break\n } }\n }\n return cachedPreserveItems\n}\n\n// :: (Transaction) → Transaction\n// Set a flag on the given transaction that will prevent further steps\n// from being appended to an existing history event (so that they\n// require a separate undo command to undo).\nfunction closeHistory(tr) {\n return tr.setMeta(closeHistoryKey, true)\n}\n\nvar historyKey = new PluginKey(\"history\");\nvar closeHistoryKey = new PluginKey(\"closeHistory\");\n\n// :: (?Object) → Plugin\n// Returns a plugin that enables the undo history for an editor. The\n// plugin will track undo and redo stacks, which can be used with the\n// [`undo`](#history.undo) and [`redo`](#history.redo) commands.\n//\n// You can set an `\"addToHistory\"` [metadata\n// property](#state.Transaction.setMeta) of `false` on a transaction\n// to prevent it from being rolled back by undo.\n//\n// config::-\n// Supports the following configuration options:\n//\n// depth:: ?number\n// The amount of history events that are collected before the\n// oldest events are discarded. Defaults to 100.\n//\n// newGroupDelay:: ?number\n// The delay between changes after which a new group should be\n// started. Defaults to 500 (milliseconds). Note that when changes\n// aren't adjacent, a new group is always started.\nfunction history(config) {\n config = {depth: config && config.depth || 100,\n newGroupDelay: config && config.newGroupDelay || 500};\n return new Plugin({\n key: historyKey,\n\n state: {\n init: function init() {\n return new HistoryState(Branch.empty, Branch.empty, null, 0)\n },\n apply: function apply(tr, hist, state) {\n return applyTransaction(hist, state, tr, config)\n }\n },\n\n config: config\n })\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// A command function that undoes the last change, if any.\nfunction undo(state, dispatch) {\n var hist = historyKey.getState(state);\n if (!hist || hist.done.eventCount == 0) { return false }\n if (dispatch) { histTransaction(hist, state, dispatch, false); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// A command function that redoes the last undone change, if any.\nfunction redo(state, dispatch) {\n var hist = historyKey.getState(state);\n if (!hist || hist.undone.eventCount == 0) { return false }\n if (dispatch) { histTransaction(hist, state, dispatch, true); }\n return true\n}\n\n// :: (EditorState) → number\n// The amount of undoable events available in a given state.\nfunction undoDepth(state) {\n var hist = historyKey.getState(state);\n return hist ? hist.done.eventCount : 0\n}\n\n// :: (EditorState) → number\n// The amount of redoable events available in a given editor state.\nfunction redoDepth(state) {\n var hist = historyKey.getState(state);\n return hist ? hist.undone.eventCount : 0\n}\n\nexport { HistoryState, closeHistory, history, redo, redoDepth, undo, undoDepth };\n//# sourceMappingURL=index.es.js.map\n","\n /*!\n * tiptap-extensions v1.28.5\n * (c) 2019 Scrumpy UG (limited liability)\n * @license MIT\n */\n \nimport { Node, Plugin, PluginKey, Mark, Extension } from 'tiptap';\nimport { toggleWrap, wrappingInputRule, toggleList, toggleBlockType, setBlockType, textblockTypeInputRule, chainCommands, exitCode, nodeInputRule, splitListItem, sinkListItem, liftListItem, insertText, replaceText, splitToDefaultListItem, toggleMark, markInputRule, markPasteRule, updateMark, removeMark, pasteRule } from 'tiptap-commands';\nimport low from 'lowlight/lib/core';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\nimport { findBlockNodes, createTable } from 'prosemirror-utils';\nimport { Plugin as Plugin$1, PluginKey as PluginKey$1, TextSelection } from 'prosemirror-state';\nimport { tableNodes, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, deleteTable, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, setCellAttr, fixTables, goToNextCell, columnResizing, tableEditing } from 'prosemirror-tables';\nimport { getMarkAttrs, nodeEqualsType } from 'tiptap-utils';\nimport { Step } from 'prosemirror-transform';\nimport { sendableSteps, getVersion, receiveTransaction, collab } from 'prosemirror-collab';\nimport { undo, redo, undoDepth, redoDepth, history } from 'prosemirror-history';\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) {\n return;\n }\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nvar Blockquote =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Blockquote, _Node);\n\n function Blockquote() {\n _classCallCheck(this, Blockquote);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Blockquote).apply(this, arguments));\n }\n\n _createClass(Blockquote, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleWrap(type, schema.nodes.paragraph);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type;\n return {\n 'Ctrl->': toggleWrap(type)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [wrappingInputRule(/^\\s*>\\s$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'blockquote';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'block*',\n group: 'block',\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'blockquote'\n }],\n toDOM: function toDOM() {\n return ['blockquote', 0];\n }\n };\n }\n }]);\n\n return Blockquote;\n}(Node);\n\nvar BulletList =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(BulletList, _Node);\n\n function BulletList() {\n _classCallCheck(this, BulletList);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(BulletList).apply(this, arguments));\n }\n\n _createClass(BulletList, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleList(type, schema.nodes.list_item);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type,\n schema = _ref2.schema;\n return {\n 'Shift-Ctrl-8': toggleList(type, schema.nodes.list_item)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [wrappingInputRule(/^\\s*([-+*])\\s$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'bullet_list';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'list_item+',\n group: 'block',\n parseDOM: [{\n tag: 'ul'\n }],\n toDOM: function toDOM() {\n return ['ul', 0];\n }\n };\n }\n }]);\n\n return BulletList;\n}(Node);\n\nvar CodeBlock =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(CodeBlock, _Node);\n\n function CodeBlock() {\n _classCallCheck(this, CodeBlock);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(CodeBlock).apply(this, arguments));\n }\n\n _createClass(CodeBlock, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleBlockType(type, schema.nodes.paragraph);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type;\n return {\n 'Shift-Ctrl-\\\\': setBlockType(type)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [textblockTypeInputRule(/^```$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'code_block';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'text*',\n marks: '',\n group: 'block',\n code: true,\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'pre',\n preserveWhitespace: 'full'\n }],\n toDOM: function toDOM() {\n return ['pre', ['code', 0]];\n }\n };\n }\n }]);\n\n return CodeBlock;\n}(Node);\n\nfunction getDecorations(_ref) {\n var doc = _ref.doc,\n name = _ref.name;\n var decorations = [];\n var blocks = findBlockNodes(doc).filter(function (item) {\n return item.node.type.name === name;\n });\n\n var flatten = function flatten(list) {\n return list.reduce(function (a, b) {\n return a.concat(Array.isArray(b) ? flatten(b) : b);\n }, []);\n };\n\n function parseNodes(nodes) {\n var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n return nodes.map(function (node) {\n var classes = [].concat(_toConsumableArray(className), _toConsumableArray(node.properties ? node.properties.className : []));\n\n if (node.children) {\n return parseNodes(node.children, classes);\n }\n\n return {\n text: node.value,\n classes: classes\n };\n });\n }\n\n blocks.forEach(function (block) {\n var startPos = block.pos + 1;\n var nodes = low.highlightAuto(block.node.textContent).value;\n flatten(parseNodes(nodes)).map(function (node) {\n var from = startPos;\n var to = from + node.text.length;\n startPos = to;\n return _objectSpread2({}, node, {\n from: from,\n to: to\n });\n }).forEach(function (node) {\n var decoration = Decoration.inline(node.from, node.to, {\n class: node.classes.join(' ')\n });\n decorations.push(decoration);\n });\n });\n return DecorationSet.create(doc, decorations);\n}\n\nfunction HighlightPlugin(_ref2) {\n var name = _ref2.name;\n return new Plugin({\n name: new PluginKey('highlight'),\n state: {\n init: function init(_, _ref3) {\n var doc = _ref3.doc;\n return getDecorations({\n doc: doc,\n name: name\n });\n },\n apply: function apply(transaction, decorationSet, oldState, state) {\n // TODO: find way to cache decorations\n // see: https://discuss.prosemirror.net/t/how-to-update-multiple-inline-decorations-on-node-change/1493\n var nodeName = state.selection.$head.parent.type.name;\n var previousNodeName = oldState.selection.$head.parent.type.name;\n\n if (transaction.docChanged && [nodeName, previousNodeName].includes(name)) {\n return getDecorations({\n doc: transaction.doc,\n name: name\n });\n }\n\n return decorationSet.map(transaction.mapping, transaction.doc);\n }\n },\n props: {\n decorations: function decorations(state) {\n return this.getState(state);\n }\n }\n });\n}\n\nvar CodeBlockHighlight =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(CodeBlockHighlight, _Node);\n\n function CodeBlockHighlight() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, CodeBlockHighlight);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(CodeBlockHighlight).call(this, options));\n\n try {\n Object.entries(_this.options.languages).forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n name = _ref2[0],\n mapping = _ref2[1];\n\n low.registerLanguage(name, mapping);\n });\n } catch (err) {\n throw new Error('Invalid syntax highlight definitions: define at least one highlight.js language mapping');\n }\n\n return _this;\n }\n\n _createClass(CodeBlockHighlight, [{\n key: \"commands\",\n value: function commands(_ref3) {\n var type = _ref3.type,\n schema = _ref3.schema;\n return function () {\n return toggleBlockType(type, schema.nodes.paragraph);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref4) {\n var type = _ref4.type;\n return {\n 'Shift-Ctrl-\\\\': setBlockType(type)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref5) {\n var type = _ref5.type;\n return [textblockTypeInputRule(/^```$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'code_block';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n languages: {}\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'text*',\n marks: '',\n group: 'block',\n code: true,\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'pre',\n preserveWhitespace: 'full'\n }],\n toDOM: function toDOM() {\n return ['pre', ['code', 0]];\n }\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [HighlightPlugin({\n name: this.name\n })];\n }\n }]);\n\n return CodeBlockHighlight;\n}(Node);\n\nvar HardBreak =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(HardBreak, _Node);\n\n function HardBreak() {\n _classCallCheck(this, HardBreak);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(HardBreak).apply(this, arguments));\n }\n\n _createClass(HardBreak, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n var command = chainCommands(exitCode, function (state, dispatch) {\n dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView());\n return true;\n });\n return {\n 'Mod-Enter': command,\n 'Shift-Enter': command\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'hard_break';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n inline: true,\n group: 'inline',\n selectable: false,\n parseDOM: [{\n tag: 'br'\n }],\n toDOM: function toDOM() {\n return ['br'];\n }\n };\n }\n }]);\n\n return HardBreak;\n}(Node);\n\nvar Heading =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Heading, _Node);\n\n function Heading() {\n _classCallCheck(this, Heading);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Heading).apply(this, arguments));\n }\n\n _createClass(Heading, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function (attrs) {\n return toggleBlockType(type, schema.nodes.paragraph, attrs);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type;\n return this.options.levels.reduce(function (items, level) {\n return _objectSpread2({}, items, {}, _defineProperty({}, \"Shift-Ctrl-\".concat(level), setBlockType(type, {\n level: level\n })));\n }, {});\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return this.options.levels.map(function (level) {\n return textblockTypeInputRule(new RegExp(\"^(#{1,\".concat(level, \"})\\\\s$\")), type, function () {\n return {\n level: level\n };\n });\n });\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'heading';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n levels: [1, 2, 3, 4, 5, 6]\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n attrs: {\n level: {\n default: 1\n }\n },\n content: 'inline*',\n group: 'block',\n defining: true,\n draggable: false,\n parseDOM: this.options.levels.map(function (level) {\n return {\n tag: \"h\".concat(level),\n attrs: {\n level: level\n }\n };\n }),\n toDOM: function toDOM(node) {\n return [\"h\".concat(node.attrs.level), 0];\n }\n };\n }\n }]);\n\n return Heading;\n}(Node);\n\nvar HorizontalRule =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(HorizontalRule, _Node);\n\n function HorizontalRule() {\n _classCallCheck(this, HorizontalRule);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(HorizontalRule).apply(this, arguments));\n }\n\n _createClass(HorizontalRule, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type;\n return function () {\n return function (state, dispatch) {\n return dispatch(state.tr.replaceSelectionWith(type.create()));\n };\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref2) {\n var type = _ref2.type;\n return [nodeInputRule(/^(?:---|___\\s|\\*\\*\\*\\s)$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'horizontal_rule';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n group: 'block',\n parseDOM: [{\n tag: 'hr'\n }],\n toDOM: function toDOM() {\n return ['hr'];\n }\n };\n }\n }]);\n\n return HorizontalRule;\n}(Node);\n\n/**\n * Matches following attributes in Markdown-typed image: [, alt, src, title]\n *\n * Example:\n * ![Lorem](image.jpg) -> [, \"Lorem\", \"image.jpg\"]\n * ![](image.jpg \"Ipsum\") -> [, \"\", \"image.jpg\", \"Ipsum\"]\n * ![Lorem](image.jpg \"Ipsum\") -> [, \"Lorem\", \"image.jpg\", \"Ipsum\"]\n */\n\nvar IMAGE_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\n\nvar Image =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Image, _Node);\n\n function Image() {\n _classCallCheck(this, Image);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Image).apply(this, arguments));\n }\n\n _createClass(Image, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type;\n return function (attrs) {\n return function (state, dispatch) {\n var selection = state.selection;\n var position = selection.$cursor ? selection.$cursor.pos : selection.$to.pos;\n var node = type.create(attrs);\n var transaction = state.tr.insert(position, node);\n dispatch(transaction);\n };\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref2) {\n var type = _ref2.type;\n return [nodeInputRule(IMAGE_INPUT_REGEX, type, function (match) {\n var _match = _slicedToArray(match, 4),\n alt = _match[1],\n src = _match[2],\n title = _match[3];\n\n return {\n src: src,\n alt: alt,\n title: title\n };\n })];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'image';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n inline: true,\n attrs: {\n src: {},\n alt: {\n default: null\n },\n title: {\n default: null\n }\n },\n group: 'inline',\n draggable: true,\n parseDOM: [{\n tag: 'img[src]',\n getAttrs: function getAttrs(dom) {\n return {\n src: dom.getAttribute('src'),\n title: dom.getAttribute('title'),\n alt: dom.getAttribute('alt')\n };\n }\n }],\n toDOM: function toDOM(node) {\n return ['img', node.attrs];\n }\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [new Plugin({\n props: {\n handleDOMEvents: {\n drop: function drop(view, event) {\n var hasFiles = event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length;\n\n if (!hasFiles) {\n return;\n }\n\n var images = Array.from(event.dataTransfer.files).filter(function (file) {\n return /image/i.test(file.type);\n });\n\n if (images.length === 0) {\n return;\n }\n\n event.preventDefault();\n var schema = view.state.schema;\n var coordinates = view.posAtCoords({\n left: event.clientX,\n top: event.clientY\n });\n images.forEach(function (image) {\n var reader = new FileReader();\n\n reader.onload = function (readerEvent) {\n var node = schema.nodes.image.create({\n src: readerEvent.target.result\n });\n var transaction = view.state.tr.insert(coordinates.pos, node);\n view.dispatch(transaction);\n };\n\n reader.readAsDataURL(image);\n });\n }\n }\n }\n })];\n }\n }]);\n\n return Image;\n}(Node);\n\nvar ListItem =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(ListItem, _Node);\n\n function ListItem() {\n _classCallCheck(this, ListItem);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(ListItem).apply(this, arguments));\n }\n\n _createClass(ListItem, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n Enter: splitListItem(type),\n Tab: sinkListItem(type),\n 'Shift-Tab': liftListItem(type)\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'list_item';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'paragraph block*',\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'li'\n }],\n toDOM: function toDOM() {\n return ['li', 0];\n }\n };\n }\n }]);\n\n return ListItem;\n}(Node);\n\nfunction triggerCharacter(_ref) {\n var _ref$char = _ref.char,\n char = _ref$char === void 0 ? '@' : _ref$char,\n _ref$allowSpaces = _ref.allowSpaces,\n allowSpaces = _ref$allowSpaces === void 0 ? false : _ref$allowSpaces,\n _ref$startOfLine = _ref.startOfLine,\n startOfLine = _ref$startOfLine === void 0 ? false : _ref$startOfLine;\n return function ($position) {\n // cancel if top level node\n if ($position.depth <= 0) {\n return false;\n } // Matching expressions used for later\n\n\n var escapedChar = \"\\\\\".concat(char);\n var suffix = new RegExp(\"\\\\s\".concat(escapedChar, \"$\"));\n var prefix = startOfLine ? '^' : '';\n var regexp = allowSpaces ? new RegExp(\"\".concat(prefix).concat(escapedChar, \".*?(?=\\\\s\").concat(escapedChar, \"|$)\"), 'gm') : new RegExp(\"\".concat(prefix, \"(?:^)?\").concat(escapedChar, \"[^\\\\s\").concat(escapedChar, \"]*\"), 'gm'); // Lookup the boundaries of the current node\n\n var textFrom = $position.before();\n var textTo = $position.end();\n var text = $position.doc.textBetween(textFrom, textTo, '\\0', '\\0');\n var match = regexp.exec(text);\n var position;\n\n while (match !== null) {\n // JavaScript doesn't have lookbehinds; this hacks a check that first character is \" \"\n // or the line beginning\n var matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index);\n\n if (/^[\\s\\0]?$/.test(matchPrefix)) {\n // The absolute position of the match in the document\n var from = match.index + $position.start();\n var to = from + match[0].length; // Edge case handling; if spaces are allowed and we're directly in between\n // two triggers\n\n if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {\n match[0] += ' ';\n to += 1;\n } // If the $position is located within the matched substring, return that range\n\n\n if (from < $position.pos && to >= $position.pos) {\n position = {\n range: {\n from: from,\n to: to\n },\n query: match[0].slice(char.length),\n text: match[0]\n };\n }\n }\n\n match = regexp.exec(text);\n }\n\n return position;\n };\n}\n\nfunction SuggestionsPlugin(_ref2) {\n var _ref2$matcher = _ref2.matcher,\n matcher = _ref2$matcher === void 0 ? {\n char: '@',\n allowSpaces: false,\n startOfLine: false\n } : _ref2$matcher,\n _ref2$appendText = _ref2.appendText,\n appendText = _ref2$appendText === void 0 ? null : _ref2$appendText,\n _ref2$suggestionClass = _ref2.suggestionClass,\n suggestionClass = _ref2$suggestionClass === void 0 ? 'suggestion' : _ref2$suggestionClass,\n _ref2$command = _ref2.command,\n _command = _ref2$command === void 0 ? function () {\n return false;\n } : _ref2$command,\n _ref2$items = _ref2.items,\n items = _ref2$items === void 0 ? [] : _ref2$items,\n _ref2$onEnter = _ref2.onEnter,\n onEnter = _ref2$onEnter === void 0 ? function () {\n return false;\n } : _ref2$onEnter,\n _ref2$onChange = _ref2.onChange,\n onChange = _ref2$onChange === void 0 ? function () {\n return false;\n } : _ref2$onChange,\n _ref2$onExit = _ref2.onExit,\n onExit = _ref2$onExit === void 0 ? function () {\n return false;\n } : _ref2$onExit,\n _ref2$onKeyDown = _ref2.onKeyDown,\n onKeyDown = _ref2$onKeyDown === void 0 ? function () {\n return false;\n } : _ref2$onKeyDown,\n _ref2$onFilter = _ref2.onFilter,\n onFilter = _ref2$onFilter === void 0 ? function (searchItems, query) {\n if (!query) {\n return searchItems;\n }\n\n return searchItems.filter(function (item) {\n return JSON.stringify(item).toLowerCase().includes(query.toLowerCase());\n });\n } : _ref2$onFilter;\n\n return new Plugin$1({\n key: new PluginKey$1('suggestions'),\n view: function view() {\n var _this = this;\n\n return {\n update: function update(view, prevState) {\n var prev = _this.key.getState(prevState);\n\n var next = _this.key.getState(view.state); // See how the state changed\n\n\n var moved = prev.active && next.active && prev.range.from !== next.range.from;\n var started = !prev.active && next.active;\n var stopped = prev.active && !next.active;\n var changed = !started && !stopped && prev.query !== next.query;\n var handleStart = started || moved;\n var handleChange = changed && !moved;\n var handleExit = stopped || moved; // Cancel when suggestion isn't active\n\n if (!handleStart && !handleChange && !handleExit) {\n return;\n }\n\n var state = handleExit ? prev : next;\n var decorationNode = document.querySelector(\"[data-decoration-id=\\\"\".concat(state.decorationId, \"\\\"]\")); // build a virtual node for popper.js or tippy.js\n // this can be used for building popups without a DOM node\n\n var virtualNode = decorationNode ? {\n getBoundingClientRect: function getBoundingClientRect() {\n return decorationNode.getBoundingClientRect();\n },\n clientWidth: decorationNode.clientWidth,\n clientHeight: decorationNode.clientHeight\n } : null;\n var props = {\n view: view,\n range: state.range,\n query: state.query,\n text: state.text,\n decorationNode: decorationNode,\n virtualNode: virtualNode,\n items: onFilter(Array.isArray(items) ? items : items(), state.query),\n command: function command(_ref3) {\n var range = _ref3.range,\n attrs = _ref3.attrs;\n\n _command({\n range: range,\n attrs: attrs,\n schema: view.state.schema\n })(view.state, view.dispatch, view);\n\n if (appendText) {\n insertText(appendText)(view.state, view.dispatch, view);\n }\n }\n }; // Trigger the hooks when necessary\n\n if (handleExit) {\n onExit(props);\n }\n\n if (handleChange) {\n onChange(props);\n }\n\n if (handleStart) {\n onEnter(props);\n }\n }\n };\n },\n state: {\n // Initialize the plugin's internal state.\n init: function init() {\n return {\n active: false,\n range: {},\n query: null,\n text: null\n };\n },\n // Apply changes to the plugin state from a view transaction.\n apply: function apply(tr, prev) {\n var selection = tr.selection;\n\n var next = _objectSpread2({}, prev); // We can only be suggesting if there is no selection\n\n\n if (selection.from === selection.to) {\n // Reset active state if we just left the previous suggestion range\n if (selection.from < prev.range.from || selection.from > prev.range.to) {\n next.active = false;\n } // Try to match against where our cursor currently is\n\n\n var $position = selection.$from;\n var match = triggerCharacter(matcher)($position);\n var decorationId = (Math.random() + 1).toString(36).substr(2, 5); // If we found a match, update the current state to show it\n\n if (match) {\n next.active = true;\n next.decorationId = prev.decorationId ? prev.decorationId : decorationId;\n next.range = match.range;\n next.query = match.query;\n next.text = match.text;\n } else {\n next.active = false;\n }\n } else {\n next.active = false;\n } // Make sure to empty the range if suggestion is inactive\n\n\n if (!next.active) {\n next.decorationId = null;\n next.range = {};\n next.query = null;\n next.text = null;\n }\n\n return next;\n }\n },\n props: {\n // Call the keydown hook if suggestion is active.\n handleKeyDown: function handleKeyDown(view, event) {\n var _this$getState = this.getState(view.state),\n active = _this$getState.active,\n range = _this$getState.range;\n\n if (!active) return false;\n return onKeyDown({\n view: view,\n event: event,\n range: range\n });\n },\n // Setup decorator on the currently active suggestion.\n decorations: function decorations(editorState) {\n var _this$getState2 = this.getState(editorState),\n active = _this$getState2.active,\n range = _this$getState2.range,\n decorationId = _this$getState2.decorationId;\n\n if (!active) return null;\n return DecorationSet.create(editorState.doc, [Decoration.inline(range.from, range.to, {\n nodeName: 'span',\n class: suggestionClass,\n 'data-decoration-id': decorationId\n })]);\n }\n }\n });\n}\n\nvar Mention =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Mention, _Node);\n\n function Mention() {\n _classCallCheck(this, Mention);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Mention).apply(this, arguments));\n }\n\n _createClass(Mention, [{\n key: \"commands\",\n value: function commands(_ref) {\n var _this = this;\n\n var schema = _ref.schema;\n return function (attrs) {\n return replaceText(null, schema.nodes[_this.name], attrs);\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'mention';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n matcher: {\n char: '@',\n allowSpaces: false,\n startOfLine: false\n },\n mentionClass: 'mention',\n suggestionClass: 'mention-suggestion'\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n var _this2 = this;\n\n return {\n attrs: {\n id: {},\n label: {}\n },\n group: 'inline',\n inline: true,\n selectable: false,\n atom: true,\n toDOM: function toDOM(node) {\n return ['span', {\n class: _this2.options.mentionClass,\n 'data-mention-id': node.attrs.id\n }, \"\".concat(_this2.options.matcher.char).concat(node.attrs.label)];\n },\n parseDOM: [{\n tag: 'span[data-mention-id]',\n getAttrs: function getAttrs(dom) {\n var id = dom.getAttribute('data-mention-id');\n var label = dom.innerText.split(_this2.options.matcher.char).join('');\n return {\n id: id,\n label: label\n };\n }\n }]\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this3 = this;\n\n return [SuggestionsPlugin({\n command: function command(_ref2) {\n var range = _ref2.range,\n attrs = _ref2.attrs,\n schema = _ref2.schema;\n return replaceText(range, schema.nodes[_this3.name], attrs);\n },\n appendText: ' ',\n matcher: this.options.matcher,\n items: this.options.items,\n onEnter: this.options.onEnter,\n onChange: this.options.onChange,\n onExit: this.options.onExit,\n onKeyDown: this.options.onKeyDown,\n onFilter: this.options.onFilter,\n suggestionClass: this.options.suggestionClass\n })];\n }\n }]);\n\n return Mention;\n}(Node);\n\nvar OrderedList =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(OrderedList, _Node);\n\n function OrderedList() {\n _classCallCheck(this, OrderedList);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(OrderedList).apply(this, arguments));\n }\n\n _createClass(OrderedList, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleList(type, schema.nodes.list_item);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type,\n schema = _ref2.schema;\n return {\n 'Shift-Ctrl-9': toggleList(type, schema.nodes.list_item)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [wrappingInputRule(/^(\\d+)\\.\\s$/, type, function (match) {\n return {\n order: +match[1]\n };\n }, function (match, node) {\n return node.childCount + node.attrs.order === +match[1];\n })];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'ordered_list';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n attrs: {\n order: {\n default: 1\n }\n },\n content: 'list_item+',\n group: 'block',\n parseDOM: [{\n tag: 'ol',\n getAttrs: function getAttrs(dom) {\n return {\n order: dom.hasAttribute('start') ? +dom.getAttribute('start') : 1\n };\n }\n }],\n toDOM: function toDOM(node) {\n return node.attrs.order === 1 ? ['ol', 0] : ['ol', {\n start: node.attrs.order\n }, 0];\n }\n };\n }\n }]);\n\n return OrderedList;\n}(Node);\n\nvar TableNodes = tableNodes({\n tableGroup: 'block',\n cellContent: 'block+',\n cellAttributes: {\n background: {\n default: null,\n getFromDOM: function getFromDOM(dom) {\n return dom.style.backgroundColor || null;\n },\n setDOMAttr: function setDOMAttr(value, attrs) {\n if (value) {\n var style = {\n style: \"\".concat(attrs.style || '', \"background-color: \").concat(value, \";\")\n };\n Object.assign(attrs, style);\n }\n }\n }\n }\n});\n\nvar Table =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Table, _Node);\n\n function Table() {\n _classCallCheck(this, Table);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Table).apply(this, arguments));\n }\n\n _createClass(Table, [{\n key: \"commands\",\n value: function commands(_ref) {\n var schema = _ref.schema;\n return {\n createTable: function createTable$1(_ref2) {\n var rowsCount = _ref2.rowsCount,\n colsCount = _ref2.colsCount,\n withHeaderRow = _ref2.withHeaderRow;\n return function (state, dispatch) {\n var offset = state.tr.selection.anchor + 1;\n\n var nodes = createTable(schema, rowsCount, colsCount, withHeaderRow);\n\n var tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();\n var resolvedPos = tr.doc.resolve(offset);\n tr.setSelection(TextSelection.near(resolvedPos));\n dispatch(tr);\n };\n },\n addColumnBefore: function addColumnBefore$1() {\n return addColumnBefore;\n },\n addColumnAfter: function addColumnAfter$1() {\n return addColumnAfter;\n },\n deleteColumn: function deleteColumn$1() {\n return deleteColumn;\n },\n addRowBefore: function addRowBefore$1() {\n return addRowBefore;\n },\n addRowAfter: function addRowAfter$1() {\n return addRowAfter;\n },\n deleteRow: function deleteRow$1() {\n return deleteRow;\n },\n deleteTable: function deleteTable$1() {\n return deleteTable;\n },\n toggleCellMerge: function toggleCellMerge() {\n return function (state, dispatch) {\n if (mergeCells(state, dispatch)) {\n return;\n }\n\n splitCell(state, dispatch);\n };\n },\n mergeCells: function mergeCells$1() {\n return mergeCells;\n },\n splitCell: function splitCell$1() {\n return splitCell;\n },\n toggleHeaderColumn: function toggleHeaderColumn$1() {\n return toggleHeaderColumn;\n },\n toggleHeaderRow: function toggleHeaderRow$1() {\n return toggleHeaderRow;\n },\n toggleHeaderCell: function toggleHeaderCell$1() {\n return toggleHeaderCell;\n },\n setCellAttr: function setCellAttr$1() {\n return setCellAttr;\n },\n fixTables: function fixTables$1() {\n return fixTables;\n }\n };\n }\n }, {\n key: \"keys\",\n value: function keys() {\n return {\n Tab: goToNextCell(1),\n 'Shift-Tab': goToNextCell(-1)\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'table';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n resizable: false\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n return TableNodes.table;\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [].concat(_toConsumableArray(this.options.resizable ? [columnResizing()] : []), [tableEditing()]);\n }\n }]);\n\n return Table;\n}(Node);\n\nvar TableHeader =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(TableHeader, _Node);\n\n function TableHeader() {\n _classCallCheck(this, TableHeader);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(TableHeader).apply(this, arguments));\n }\n\n _createClass(TableHeader, [{\n key: \"name\",\n get: function get() {\n return 'table_header';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return TableNodes.table_header;\n }\n }]);\n\n return TableHeader;\n}(Node);\n\nvar TableCell =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(TableCell, _Node);\n\n function TableCell() {\n _classCallCheck(this, TableCell);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(TableCell).apply(this, arguments));\n }\n\n _createClass(TableCell, [{\n key: \"name\",\n get: function get() {\n return 'table_cell';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return TableNodes.table_cell;\n }\n }]);\n\n return TableCell;\n}(Node);\n\nvar TableRow =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(TableRow, _Node);\n\n function TableRow() {\n _classCallCheck(this, TableRow);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(TableRow).apply(this, arguments));\n }\n\n _createClass(TableRow, [{\n key: \"name\",\n get: function get() {\n return 'table_row';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return TableNodes.table_row;\n }\n }]);\n\n return TableRow;\n}(Node);\n\nvar TodoItem =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(TodoItem, _Node);\n\n function TodoItem() {\n _classCallCheck(this, TodoItem);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(TodoItem).apply(this, arguments));\n }\n\n _createClass(TodoItem, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n Enter: splitToDefaultListItem(type),\n Tab: this.options.nested ? sinkListItem(type) : function () {},\n 'Shift-Tab': liftListItem(type)\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'todo_item';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n nested: false\n };\n }\n }, {\n key: \"view\",\n get: function get() {\n return {\n props: ['node', 'updateAttrs', 'view'],\n methods: {\n onChange: function onChange() {\n this.updateAttrs({\n done: !this.node.attrs.done\n });\n }\n },\n template: \"\\n <li :data-type=\\\"node.type.name\\\" :data-done=\\\"node.attrs.done.toString()\\\" data-drag-handle>\\n <span class=\\\"todo-checkbox\\\" contenteditable=\\\"false\\\" @click=\\\"onChange\\\"></span>\\n <div class=\\\"todo-content\\\" ref=\\\"content\\\" :contenteditable=\\\"view.editable.toString()\\\"></div>\\n </li>\\n \"\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n var _this = this;\n\n return {\n attrs: {\n done: {\n default: false\n }\n },\n draggable: true,\n content: this.options.nested ? '(paragraph|todo_list)+' : 'paragraph+',\n toDOM: function toDOM(node) {\n var done = node.attrs.done;\n return ['li', {\n 'data-type': _this.name,\n 'data-done': done.toString()\n }, ['span', {\n class: 'todo-checkbox',\n contenteditable: 'false'\n }], ['div', {\n class: 'todo-content'\n }, 0]];\n },\n parseDOM: [{\n priority: 51,\n tag: \"[data-type=\\\"\".concat(this.name, \"\\\"]\"),\n getAttrs: function getAttrs(dom) {\n return {\n done: dom.getAttribute('data-done') === 'true'\n };\n }\n }]\n };\n }\n }]);\n\n return TodoItem;\n}(Node);\n\nvar TodoList =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(TodoList, _Node);\n\n function TodoList() {\n _classCallCheck(this, TodoList);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(TodoList).apply(this, arguments));\n }\n\n _createClass(TodoList, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleList(type, schema.nodes.todo_item);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref2) {\n var type = _ref2.type;\n return [wrappingInputRule(/^\\s*(\\[ \\])\\s$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'todo_list';\n }\n }, {\n key: \"schema\",\n get: function get() {\n var _this = this;\n\n return {\n group: 'block',\n content: 'todo_item+',\n toDOM: function toDOM() {\n return ['ul', {\n 'data-type': _this.name\n }, 0];\n },\n parseDOM: [{\n priority: 51,\n tag: \"[data-type=\\\"\".concat(this.name, \"\\\"]\")\n }]\n };\n }\n }]);\n\n return TodoList;\n}(Node);\n\nvar Bold =\n/*#__PURE__*/\nfunction (_Mark) {\n _inherits(Bold, _Mark);\n\n function Bold() {\n _classCallCheck(this, Bold);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Bold).apply(this, arguments));\n }\n\n _createClass(Bold, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-b': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [markInputRule(/(?:\\*\\*|__)([^*_]+)(?:\\*\\*|__)$/, type)];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref4) {\n var type = _ref4.type;\n return [markPasteRule(/(?:\\*\\*|__)([^*_]+)(?:\\*\\*|__)/g, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'bold';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n parseDOM: [{\n tag: 'strong'\n }, {\n tag: 'b',\n getAttrs: function getAttrs(node) {\n return node.style.fontWeight !== 'normal' && null;\n }\n }, {\n style: 'font-weight',\n getAttrs: function getAttrs(value) {\n return /^(bold(er)?|[5-9]\\d{2,})$/.test(value) && null;\n }\n }],\n toDOM: function toDOM() {\n return ['strong', 0];\n }\n };\n }\n }]);\n\n return Bold;\n}(Mark);\n\nvar Code =\n/*#__PURE__*/\nfunction (_Mark) {\n _inherits(Code, _Mark);\n\n function Code() {\n _classCallCheck(this, Code);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Code).apply(this, arguments));\n }\n\n _createClass(Code, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-`': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [markInputRule(/(?:`)([^`]+)(?:`)$/, type)];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref4) {\n var type = _ref4.type;\n return [markPasteRule(/(?:`)([^`]+)(?:`)/g, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'code';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n excludes: '_',\n parseDOM: [{\n tag: 'code'\n }],\n toDOM: function toDOM() {\n return ['code', 0];\n }\n };\n }\n }]);\n\n return Code;\n}(Mark);\n\nvar Italic =\n/*#__PURE__*/\nfunction (_Mark) {\n _inherits(Italic, _Mark);\n\n function Italic() {\n _classCallCheck(this, Italic);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Italic).apply(this, arguments));\n }\n\n _createClass(Italic, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-i': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [markInputRule(/(?:^|[^_])(_([^_]+)_)$/, type), markInputRule(/(?:^|[^*])(\\*([^*]+)\\*)$/, type)];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref4) {\n var type = _ref4.type;\n return [markPasteRule(/_([^_]+)_/g, type), markPasteRule(/\\*([^*]+)\\*/g, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'italic';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n parseDOM: [{\n tag: 'i'\n }, {\n tag: 'em'\n }, {\n style: 'font-style=italic'\n }],\n toDOM: function toDOM() {\n return ['em', 0];\n }\n };\n }\n }]);\n\n return Italic;\n}(Mark);\n\nvar Link =\n/*#__PURE__*/\nfunction (_Mark) {\n _inherits(Link, _Mark);\n\n function Link() {\n _classCallCheck(this, Link);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Link).apply(this, arguments));\n }\n\n _createClass(Link, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type;\n return function (attrs) {\n if (attrs.href) {\n return updateMark(type, attrs);\n }\n\n return removeMark(type);\n };\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref2) {\n var type = _ref2.type;\n return [pasteRule(/https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-zA-Z]{2,}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g, type, function (url) {\n return {\n href: url\n };\n })];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'link';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n openOnClick: true\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n attrs: {\n href: {\n default: null\n }\n },\n inclusive: false,\n parseDOM: [{\n tag: 'a[href]',\n getAttrs: function getAttrs(dom) {\n return {\n href: dom.getAttribute('href')\n };\n }\n }],\n toDOM: function toDOM(node) {\n return ['a', _objectSpread2({}, node.attrs, {\n rel: 'noopener noreferrer nofollow'\n }), 0];\n }\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n if (!this.options.openOnClick) {\n return [];\n }\n\n return [new Plugin({\n props: {\n handleClick: function handleClick(view, pos, event) {\n var schema = view.state.schema;\n var attrs = getMarkAttrs(view.state, schema.marks.link);\n\n if (attrs.href && event.target instanceof HTMLAnchorElement) {\n event.stopPropagation();\n window.open(attrs.href);\n }\n }\n }\n })];\n }\n }]);\n\n return Link;\n}(Mark);\n\nvar Strike =\n/*#__PURE__*/\nfunction (_Mark) {\n _inherits(Strike, _Mark);\n\n function Strike() {\n _classCallCheck(this, Strike);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Strike).apply(this, arguments));\n }\n\n _createClass(Strike, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-d': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [markInputRule(/~([^~]+)~$/, type)];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref4) {\n var type = _ref4.type;\n return [markPasteRule(/~([^~]+)~/g, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'strike';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n parseDOM: [{\n tag: 's'\n }, {\n tag: 'del'\n }, {\n tag: 'strike'\n }, {\n style: 'text-decoration',\n getAttrs: function getAttrs(value) {\n return value === 'line-through';\n }\n }],\n toDOM: function toDOM() {\n return ['s', 0];\n }\n };\n }\n }]);\n\n return Strike;\n}(Mark);\n\nvar Underline =\n/*#__PURE__*/\nfunction (_Mark) {\n _inherits(Underline, _Mark);\n\n function Underline() {\n _classCallCheck(this, Underline);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Underline).apply(this, arguments));\n }\n\n _createClass(Underline, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-u': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'underline';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n parseDOM: [{\n tag: 'u'\n }, {\n style: 'text-decoration',\n getAttrs: function getAttrs(value) {\n return value === 'underline';\n }\n }],\n toDOM: function toDOM() {\n return ['u', 0];\n }\n };\n }\n }]);\n\n return Underline;\n}(Mark);\n\nvar Collaboration =\n/*#__PURE__*/\nfunction (_Extension) {\n _inherits(Collaboration, _Extension);\n\n function Collaboration() {\n _classCallCheck(this, Collaboration);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Collaboration).apply(this, arguments));\n }\n\n _createClass(Collaboration, [{\n key: \"init\",\n value: function init() {\n var _this = this;\n\n this.getSendableSteps = this.debounce(function (state) {\n var sendable = sendableSteps(state);\n\n if (sendable) {\n _this.options.onSendable({\n editor: _this.editor,\n sendable: {\n version: sendable.version,\n steps: sendable.steps.map(function (step) {\n return step.toJSON();\n }),\n clientID: sendable.clientID\n }\n });\n }\n }, this.options.debounce);\n this.editor.on('transaction', function (_ref) {\n var state = _ref.state;\n\n _this.getSendableSteps(state);\n });\n }\n }, {\n key: \"debounce\",\n value: function debounce(fn, delay) {\n var timeout;\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(function () {\n fn.apply(void 0, args);\n timeout = null;\n }, delay);\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'collaboration';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n var _this2 = this;\n\n return {\n version: 0,\n clientID: Math.floor(Math.random() * 0xFFFFFFFF),\n debounce: 250,\n onSendable: function onSendable() {},\n update: function update(_ref2) {\n var steps = _ref2.steps,\n version = _ref2.version;\n var _this2$editor = _this2.editor,\n state = _this2$editor.state,\n view = _this2$editor.view,\n schema = _this2$editor.schema;\n\n if (getVersion(state) > version) {\n return;\n }\n\n view.dispatch(receiveTransaction(state, steps.map(function (item) {\n return Step.fromJSON(schema, item.step);\n }), steps.map(function (item) {\n return item.clientID;\n })));\n }\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [collab({\n version: this.options.version,\n clientID: this.options.clientID\n })];\n }\n }]);\n\n return Collaboration;\n}(Extension);\n\nvar Focus =\n/*#__PURE__*/\nfunction (_Extension) {\n _inherits(Focus, _Extension);\n\n function Focus() {\n _classCallCheck(this, Focus);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Focus).apply(this, arguments));\n }\n\n _createClass(Focus, [{\n key: \"name\",\n get: function get() {\n return 'focus';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n className: 'has-focus',\n nested: false\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this = this;\n\n return [new Plugin({\n props: {\n decorations: function decorations(_ref) {\n var doc = _ref.doc,\n plugins = _ref.plugins,\n selection = _ref.selection;\n var editablePlugin = plugins.find(function (plugin) {\n return plugin.key.startsWith('editable$');\n });\n var editable = editablePlugin.props.editable();\n var active = editable && _this.options.className;\n var focused = _this.editor.focused;\n var anchor = selection.anchor;\n var decorations = [];\n\n if (!active || !focused) {\n return false;\n }\n\n doc.descendants(function (node, pos) {\n var hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;\n\n if (hasAnchor && !node.isText) {\n var decoration = Decoration.node(pos, pos + node.nodeSize, {\n class: _this.options.className\n });\n decorations.push(decoration);\n }\n\n return _this.options.nested;\n });\n return DecorationSet.create(doc, decorations);\n }\n }\n })];\n }\n }]);\n\n return Focus;\n}(Extension);\n\nvar History =\n/*#__PURE__*/\nfunction (_Extension) {\n _inherits(History, _Extension);\n\n function History() {\n _classCallCheck(this, History);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(History).apply(this, arguments));\n }\n\n _createClass(History, [{\n key: \"keys\",\n value: function keys() {\n var keymap = {\n 'Mod-z': undo,\n 'Mod-y': redo,\n 'Shift-Mod-z': redo\n };\n return keymap;\n }\n }, {\n key: \"commands\",\n value: function commands() {\n return {\n undo: function undo$1() {\n return undo;\n },\n redo: function redo$1() {\n return redo;\n },\n undoDepth: function undoDepth$1() {\n return undoDepth;\n },\n redoDepth: function redoDepth$1() {\n return redoDepth;\n }\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'history';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n depth: '',\n newGroupDelay: ''\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [history({\n depth: this.options.depth,\n newGroupDelay: this.options.newGroupDelay\n })];\n }\n }]);\n\n return History;\n}(Extension);\n\nvar Placeholder =\n/*#__PURE__*/\nfunction (_Extension) {\n _inherits(Placeholder, _Extension);\n\n function Placeholder() {\n _classCallCheck(this, Placeholder);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(Placeholder).apply(this, arguments));\n }\n\n _createClass(Placeholder, [{\n key: \"name\",\n get: function get() {\n return 'placeholder';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n emptyEditorClass: 'is-editor-empty',\n emptyNodeClass: 'is-empty',\n emptyNodeText: 'Write something …',\n showOnlyWhenEditable: true,\n showOnlyCurrent: true\n };\n }\n }, {\n key: \"update\",\n get: function get() {\n return function (view) {\n view.updateState(view.state);\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this = this;\n\n return [new Plugin({\n props: {\n decorations: function decorations(_ref) {\n var doc = _ref.doc,\n plugins = _ref.plugins,\n selection = _ref.selection;\n var editablePlugin = plugins.find(function (plugin) {\n return plugin.key.startsWith('editable$');\n });\n var editable = editablePlugin.props.editable();\n var active = editable || !_this.options.showOnlyWhenEditable;\n var anchor = selection.anchor;\n var decorations = [];\n var isEditorEmpty = doc.textContent.length === 0;\n\n if (!active) {\n return false;\n }\n\n doc.descendants(function (node, pos) {\n var hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;\n var isNodeEmpty = node.content.size === 0;\n\n if ((hasAnchor || !_this.options.showOnlyCurrent) && isNodeEmpty) {\n var classes = [_this.options.emptyNodeClass];\n\n if (isEditorEmpty) {\n classes.push(_this.options.emptyEditorClass);\n }\n\n var decoration = Decoration.node(pos, pos + node.nodeSize, {\n class: classes.join(' '),\n 'data-empty-text': typeof _this.options.emptyNodeText === 'function' ? _this.options.emptyNodeText(node) : _this.options.emptyNodeText\n });\n decorations.push(decoration);\n }\n\n return false;\n });\n return DecorationSet.create(doc, decorations);\n }\n }\n })];\n }\n }]);\n\n return Placeholder;\n}(Extension);\n\nvar Search =\n/*#__PURE__*/\nfunction (_Extension) {\n _inherits(Search, _Extension);\n\n function Search() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Search);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(Search).call(this, options));\n _this.results = [];\n _this.searchTerm = null;\n _this._updating = false;\n return _this;\n }\n\n _createClass(Search, [{\n key: \"commands\",\n value: function commands() {\n var _this2 = this;\n\n return {\n find: function find(attrs) {\n return _this2.find(attrs);\n },\n replace: function replace(attrs) {\n return _this2.replace(attrs);\n },\n replaceAll: function replaceAll(attrs) {\n return _this2.replaceAll(attrs);\n },\n clearSearch: function clearSearch() {\n return _this2.clear();\n }\n };\n }\n }, {\n key: \"_search\",\n value: function _search(doc) {\n var _this3 = this;\n\n this.results = [];\n var mergedTextNodes = [];\n var index = 0;\n\n if (!this.searchTerm) {\n return;\n }\n\n doc.descendants(function (node, pos) {\n if (node.isText) {\n if (mergedTextNodes[index]) {\n mergedTextNodes[index] = {\n text: mergedTextNodes[index].text + node.text,\n pos: mergedTextNodes[index].pos\n };\n } else {\n mergedTextNodes[index] = {\n text: node.text,\n pos: pos\n };\n }\n } else {\n index += 1;\n }\n });\n mergedTextNodes.forEach(function (_ref) {\n var text = _ref.text,\n pos = _ref.pos;\n var search = _this3.findRegExp;\n var m; // eslint-disable-next-line no-cond-assign\n\n while (m = search.exec(text)) {\n if (m[0] === '') {\n break;\n }\n\n _this3.results.push({\n from: pos + m.index,\n to: pos + m.index + m[0].length\n });\n }\n });\n }\n }, {\n key: \"replace\",\n value: function replace(_replace) {\n var _this4 = this;\n\n return function (state, dispatch) {\n var firstResult = _this4.results[0];\n\n if (!firstResult) {\n return;\n }\n\n var _this4$results$ = _this4.results[0],\n from = _this4$results$.from,\n to = _this4$results$.to;\n dispatch(state.tr.insertText(_replace, from, to));\n\n _this4.editor.commands.find(_this4.searchTerm);\n };\n }\n }, {\n key: \"rebaseNextResult\",\n value: function rebaseNextResult(replace, index) {\n var lastOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var nextIndex = index + 1;\n\n if (!this.results[nextIndex]) {\n return null;\n }\n\n var _this$results$index = this.results[index],\n currentFrom = _this$results$index.from,\n currentTo = _this$results$index.to;\n var offset = currentTo - currentFrom - replace.length + lastOffset;\n var _this$results$nextInd = this.results[nextIndex],\n from = _this$results$nextInd.from,\n to = _this$results$nextInd.to;\n this.results[nextIndex] = {\n to: to - offset,\n from: from - offset\n };\n return offset;\n }\n }, {\n key: \"replaceAll\",\n value: function replaceAll(replace) {\n var _this5 = this;\n\n return function (_ref2, dispatch) {\n var tr = _ref2.tr;\n var offset;\n\n if (!_this5.results.length) {\n return;\n }\n\n _this5.results.forEach(function (_ref3, index) {\n var from = _ref3.from,\n to = _ref3.to;\n tr.insertText(replace, from, to);\n offset = _this5.rebaseNextResult(replace, index, offset);\n });\n\n dispatch(tr);\n\n _this5.editor.commands.find(_this5.searchTerm);\n };\n }\n }, {\n key: \"find\",\n value: function find(searchTerm) {\n var _this6 = this;\n\n return function (state, dispatch) {\n _this6.searchTerm = _this6.options.disableRegex ? searchTerm.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&') : searchTerm;\n\n _this6.updateView(state, dispatch);\n };\n }\n }, {\n key: \"clear\",\n value: function clear() {\n var _this7 = this;\n\n return function (state, dispatch) {\n _this7.searchTerm = null;\n\n _this7.updateView(state, dispatch);\n };\n }\n }, {\n key: \"updateView\",\n value: function updateView(_ref4, dispatch) {\n var tr = _ref4.tr;\n this._updating = true;\n dispatch(tr);\n this._updating = false;\n }\n }, {\n key: \"createDeco\",\n value: function createDeco(doc) {\n this._search(doc);\n\n return this.decorations ? DecorationSet.create(doc, this.decorations) : [];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'search';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n autoSelectNext: true,\n findClass: 'find',\n searching: false,\n caseSensitive: false,\n disableRegex: true,\n alwaysSearch: false\n };\n }\n }, {\n key: \"findRegExp\",\n get: function get() {\n return RegExp(this.searchTerm, !this.options.caseSensitive ? 'gui' : 'gu');\n }\n }, {\n key: \"decorations\",\n get: function get() {\n var _this8 = this;\n\n return this.results.map(function (deco) {\n return Decoration.inline(deco.from, deco.to, {\n class: _this8.options.findClass\n });\n });\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this9 = this;\n\n return [new Plugin({\n state: {\n init: function init() {\n return DecorationSet.empty;\n },\n apply: function apply(tr, old) {\n if (_this9._updating || _this9.options.searching || tr.docChanged && _this9.options.alwaysSearch) {\n return _this9.createDeco(tr.doc);\n }\n\n if (tr.docChanged) {\n return old.map(tr.mapping, tr.doc);\n }\n\n return old;\n }\n },\n props: {\n decorations: function decorations(state) {\n return this.getState(state);\n }\n }\n })];\n }\n }]);\n\n return Search;\n}(Extension);\n\nvar TrailingNode =\n/*#__PURE__*/\nfunction (_Extension) {\n _inherits(TrailingNode, _Extension);\n\n function TrailingNode() {\n _classCallCheck(this, TrailingNode);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(TrailingNode).apply(this, arguments));\n }\n\n _createClass(TrailingNode, [{\n key: \"name\",\n get: function get() {\n return 'trailing_node';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n node: 'paragraph',\n notAfter: ['paragraph']\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this = this;\n\n var plugin = new PluginKey(this.name);\n var disabledNodes = Object.entries(this.editor.schema.nodes).map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n value = _ref2[1];\n\n return value;\n }).filter(function (node) {\n return _this.options.notAfter.includes(node.name);\n });\n return [new Plugin({\n key: plugin,\n view: function view() {\n return {\n update: function update(view) {\n var state = view.state;\n var insertNodeAtEnd = plugin.getState(state);\n\n if (!insertNodeAtEnd) {\n return;\n }\n\n var doc = state.doc,\n schema = state.schema,\n tr = state.tr;\n var type = schema.nodes[_this.options.node];\n var transaction = tr.insert(doc.content.size, type.create());\n view.dispatch(transaction);\n }\n };\n },\n state: {\n init: function init(_, state) {\n var lastNode = state.tr.doc.lastChild;\n return !nodeEqualsType({\n node: lastNode,\n types: disabledNodes\n });\n },\n apply: function apply(tr, value) {\n if (!tr.docChanged) {\n return value;\n }\n\n var lastNode = tr.doc.lastChild;\n return !nodeEqualsType({\n node: lastNode,\n types: disabledNodes\n });\n }\n }\n })];\n }\n }]);\n\n return TrailingNode;\n}(Extension);\n\nexport { Blockquote, Bold, BulletList, Code, CodeBlock, CodeBlockHighlight, Collaboration, Focus, HardBreak, Heading, HighlightPlugin as Highlight, History, HorizontalRule, Image, Italic, Link, ListItem, Mention, OrderedList, Placeholder, Search, Strike, SuggestionsPlugin as Suggestions, Table, TableCell, TableHeader, TableRow, TodoItem, TodoList, TrailingNode, Underline };\n","import { findWrapping, ReplaceAroundStep, canSplit, liftTarget } from 'prosemirror-transform';\nimport { NodeRange, Fragment, Slice } from 'prosemirror-model';\n\nvar olDOM = [\"ol\", 0], ulDOM = [\"ul\", 0], liDOM = [\"li\", 0];\n\n// :: NodeSpec\n// An ordered list [node spec](#model.NodeSpec). Has a single\n// attribute, `order`, which determines the number at which the list\n// starts counting, and defaults to 1. Represented as an `<ol>`\n// element.\nvar orderedList = {\n attrs: {order: {default: 1}},\n parseDOM: [{tag: \"ol\", getAttrs: function getAttrs(dom) {\n return {order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1}\n }}],\n toDOM: function toDOM(node) {\n return node.attrs.order == 1 ? olDOM : [\"ol\", {start: node.attrs.order}, 0]\n }\n};\n\n// :: NodeSpec\n// A bullet list node spec, represented in the DOM as `<ul>`.\nvar bulletList = {\n parseDOM: [{tag: \"ul\"}],\n toDOM: function toDOM() { return ulDOM }\n};\n\n// :: NodeSpec\n// A list item (`<li>`) spec.\nvar listItem = {\n parseDOM: [{tag: \"li\"}],\n toDOM: function toDOM() { return liDOM },\n defining: true\n};\n\nfunction add(obj, props) {\n var copy = {};\n for (var prop in obj) { copy[prop] = obj[prop]; }\n for (var prop$1 in props) { copy[prop$1] = props[prop$1]; }\n return copy\n}\n\n// :: (OrderedMap<NodeSpec>, string, ?string) → OrderedMap<NodeSpec>\n// Convenience function for adding list-related node types to a map\n// specifying the nodes for a schema. Adds\n// [`orderedList`](#schema-list.orderedList) as `\"ordered_list\"`,\n// [`bulletList`](#schema-list.bulletList) as `\"bullet_list\"`, and\n// [`listItem`](#schema-list.listItem) as `\"list_item\"`.\n//\n// `itemContent` determines the content expression for the list items.\n// If you want the commands defined in this module to apply to your\n// list structure, it should have a shape like `\"paragraph block*\"` or\n// `\"paragraph (ordered_list | bullet_list)*\"`. `listGroup` can be\n// given to assign a group name to the list node types, for example\n// `\"block\"`.\nfunction addListNodes(nodes, itemContent, listGroup) {\n return nodes.append({\n ordered_list: add(orderedList, {content: \"list_item+\", group: listGroup}),\n bullet_list: add(bulletList, {content: \"list_item+\", group: listGroup}),\n list_item: add(listItem, {content: itemContent})\n })\n}\n\n// :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Returns a command function that wraps the selection in a list with\n// the given type an attributes. If `dispatch` is null, only return a\n// value to indicate whether this is possible, but don't actually\n// perform the change.\nfunction wrapInList(listType, attrs) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to), doJoin = false, outerRange = range;\n if (!range) { return false }\n // This is at the top of an existing list item\n if (range.depth >= 2 && $from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {\n // Don't do anything if this is the top of the list\n if ($from.index(range.depth - 1) == 0) { return false }\n var $insert = state.doc.resolve(range.start - 2);\n outerRange = new NodeRange($insert, $insert, range.depth);\n if (range.endIndex < range.parent.childCount)\n { range = new NodeRange($from, state.doc.resolve($to.end(range.depth)), range.depth); }\n doJoin = true;\n }\n var wrap = findWrapping(outerRange, listType, attrs, range);\n if (!wrap) { return false }\n if (dispatch) { dispatch(doWrapInList(state.tr, range, wrap, doJoin, listType).scrollIntoView()); }\n return true\n }\n}\n\nfunction doWrapInList(tr, range, wrappers, joinBefore, listType) {\n var content = Fragment.empty;\n for (var i = wrappers.length - 1; i >= 0; i--)\n { content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content)); }\n\n tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end,\n new Slice(content, 0, 0), wrappers.length, true));\n\n var found = 0;\n for (var i$1 = 0; i$1 < wrappers.length; i$1++) { if (wrappers[i$1].type == listType) { found = i$1 + 1; } }\n var splitDepth = wrappers.length - found;\n\n var splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;\n for (var i$2 = range.startIndex, e = range.endIndex, first = true; i$2 < e; i$2++, first = false) {\n if (!first && canSplit(tr.doc, splitPos, splitDepth)) {\n tr.split(splitPos, splitDepth);\n splitPos += 2 * splitDepth;\n }\n splitPos += parent.child(i$2).nodeSize;\n }\n return tr\n}\n\n// :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Build a command that splits a non-empty textblock at the top level\n// of a list item by also splitting that list item.\nfunction splitListItem(itemType) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var node = ref.node;\n if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to)) { return false }\n var grandParent = $from.node(-1);\n if (grandParent.type != itemType) { return false }\n if ($from.parent.content.size == 0) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 2 || $from.node(-3).type != itemType ||\n $from.index(-2) != $from.node(-2).childCount - 1) { return false }\n if (dispatch) {\n var wrap = Fragment.empty, keepItem = $from.index(-1) > 0;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (var d = $from.depth - (keepItem ? 1 : 2); d >= $from.depth - 3; d--)\n { wrap = Fragment.from($from.node(d).copy(wrap)); }\n // Add a second list item with an empty default start node\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n var tr$1 = state.tr.replace($from.before(keepItem ? null : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));\n tr$1.setSelection(state.selection.constructor.near(tr$1.doc.resolve($from.pos + (keepItem ? 3 : 2))));\n dispatch(tr$1.scrollIntoView());\n }\n return true\n }\n var nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n var tr = state.tr.delete($from.pos, $to.pos);\n var types = nextType && [null, {type: nextType}];\n if (!canSplit(tr.doc, $from.pos, 2, types)) { return false }\n if (dispatch) { dispatch(tr.split($from.pos, 2, types).scrollIntoView()); }\n return true\n }\n}\n\n// :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Create a command to lift the list item around the selection up into\n// a wrapping list.\nfunction liftListItem(itemType) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to, function (node) { return node.childCount && node.firstChild.type == itemType; });\n if (!range) { return false }\n if (!dispatch) { return true }\n if ($from.node(range.depth - 1).type == itemType) // Inside a parent list\n { return liftToOuterList(state, dispatch, itemType, range) }\n else // Outer list node\n { return liftOutOfList(state, dispatch, range) }\n }\n}\n\nfunction liftToOuterList(state, dispatch, itemType, range) {\n var tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);\n if (end < endOfList) {\n // There are siblings after the lifted items, which must become\n // children of the last item\n tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList,\n new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));\n range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);\n }\n dispatch(tr.lift(range, liftTarget(range)).scrollIntoView());\n return true\n}\n\nfunction liftOutOfList(state, dispatch, range) {\n var tr = state.tr, list = range.parent;\n // Merge the list items into a single big item\n for (var pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {\n pos -= list.child(i).nodeSize;\n tr.delete(pos - 1, pos + 1);\n }\n var $start = tr.doc.resolve(range.start), item = $start.nodeAfter;\n var atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;\n var parent = $start.node(-1), indexBefore = $start.index(-1);\n if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1,\n item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))\n { return false }\n var start = $start.pos, end = start + item.nodeSize;\n // Strip off the surrounding list. At the sides where we're not at\n // the end of the list, the existing list is closed. At sides where\n // this is the end, it is overwritten to its end.\n tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1,\n new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty)))\n .append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))),\n atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));\n dispatch(tr.scrollIntoView());\n return true\n}\n\n// :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Create a command to sink the list item around the selection down\n// into an inner list.\nfunction sinkListItem(itemType) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to, function (node) { return node.childCount && node.firstChild.type == itemType; });\n if (!range) { return false }\n var startIndex = range.startIndex;\n if (startIndex == 0) { return false }\n var parent = range.parent, nodeBefore = parent.child(startIndex - 1);\n if (nodeBefore.type != itemType) { return false }\n\n if (dispatch) {\n var nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;\n var inner = Fragment.from(nestedBefore ? itemType.create() : null);\n var slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))),\n nestedBefore ? 3 : 1, 0);\n var before = range.start, after = range.end;\n dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after,\n before, after, slice, 1, true))\n .scrollIntoView());\n }\n return true\n }\n}\n\nexport { addListNodes, bulletList, liftListItem, listItem, orderedList, sinkListItem, splitListItem, wrapInList };\n//# sourceMappingURL=index.es.js.map\n","\n /*!\n * tiptap-commands v1.12.4\n * (c) 2019 Scrumpy UG (limited liability)\n * @license MIT\n */\n \nimport { setBlockType, lift, wrapIn } from 'prosemirror-commands';\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, setBlockType, splitBlock, splitBlockKeepMarks, toggleMark, wrapIn } from 'prosemirror-commands';\nimport { liftListItem, wrapInList } from 'prosemirror-schema-list';\nexport { addListNodes, liftListItem, sinkListItem, splitListItem, wrapInList } from 'prosemirror-schema-list';\nimport { InputRule } from 'prosemirror-inputrules';\nexport { textblockTypeInputRule, wrappingInputRule } from 'prosemirror-inputrules';\nimport { Plugin } from 'prosemirror-state';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { getMarkRange, nodeIsActive } from 'tiptap-utils';\nimport { findParentNode } from 'prosemirror-utils';\n\nfunction insertText () {\n var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n return function (state, dispatch) {\n var $from = state.selection.$from;\n var pos = $from.pos.pos;\n dispatch(state.tr.insertText(text, pos));\n return true;\n };\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nfunction getMarksBetween(start, end, state) {\n var marks = [];\n state.doc.nodesBetween(start, end, function (node, pos) {\n marks = [].concat(_toConsumableArray(marks), _toConsumableArray(node.marks.map(function (mark) {\n return {\n start: pos,\n end: pos + node.nodeSize,\n mark: mark\n };\n })));\n });\n return marks;\n}\n\nfunction markInputRule (regexp, markType, getAttrs) {\n return new InputRule(regexp, function (state, match, start, end) {\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n var tr = state.tr;\n var m = match.length - 1;\n var markEnd = end;\n var markStart = start;\n\n if (match[m]) {\n var matchStart = start + match[0].indexOf(match[m - 1]);\n var matchEnd = matchStart + match[m - 1].length - 1;\n var textStart = matchStart + match[m - 1].lastIndexOf(match[m]);\n var textEnd = textStart + match[m].length;\n var excludedMarks = getMarksBetween(start, end, state).filter(function (item) {\n var excluded = item.mark.type.excluded;\n return excluded.find(function (type) {\n return type.name === markType.name;\n });\n }).filter(function (item) {\n return item.end > matchStart;\n });\n\n if (excludedMarks.length) {\n return false;\n }\n\n if (textEnd < matchEnd) {\n tr.delete(textEnd, matchEnd);\n }\n\n if (textStart > matchStart) {\n tr.delete(matchStart, textStart);\n }\n\n markStart = matchStart;\n markEnd = markStart + match[m].length;\n }\n\n tr.addMark(markStart, markEnd, markType.create(attrs));\n tr.removeStoredMark(markType);\n return tr;\n });\n}\n\nfunction nodeInputRule (regexp, type, getAttrs) {\n return new InputRule(regexp, function (state, match, start, end) {\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n var tr = state.tr;\n\n if (match[0]) {\n tr.replaceWith(start - 1, end, type.create(attrs));\n }\n\n return tr;\n });\n}\n\nfunction pasteRule (regexp, type, getAttrs) {\n var handler = function handler(fragment) {\n var nodes = [];\n fragment.forEach(function (child) {\n if (child.isText) {\n var text = child.text;\n var pos = 0;\n var match;\n\n do {\n match = regexp.exec(text);\n\n if (match) {\n var start = match.index;\n var end = start + match[0].length;\n var attrs = getAttrs instanceof Function ? getAttrs(match[0]) : getAttrs;\n\n if (start > 0) {\n nodes.push(child.cut(pos, start));\n }\n\n nodes.push(child.cut(start, end).mark(type.create(attrs).addToSet(child.marks)));\n pos = end;\n }\n } while (match);\n\n if (pos < text.length) {\n nodes.push(child.cut(pos));\n }\n } else {\n nodes.push(child.copy(handler(child.content)));\n }\n });\n return Fragment.fromArray(nodes);\n };\n\n return new Plugin({\n props: {\n transformPasted: function transformPasted(slice) {\n return new Slice(handler(slice.content), slice.openStart, slice.openEnd);\n }\n }\n });\n}\n\nfunction markPasteRule (regexp, type, getAttrs) {\n var handler = function handler(fragment) {\n var nodes = [];\n fragment.forEach(function (child) {\n if (child.isText) {\n var text = child.text,\n marks = child.marks;\n var pos = 0;\n var match;\n var isLink = !!marks.filter(function (x) {\n return x.type.name === 'link';\n })[0]; // eslint-disable-next-line\n\n while (!isLink && (match = regexp.exec(text)) !== null) {\n if (match[1]) {\n var start = match.index;\n var end = start + match[0].length;\n var textStart = start + match[0].indexOf(match[1]);\n var textEnd = textStart + match[1].length;\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs; // adding text before markdown to nodes\n\n if (start > 0) {\n nodes.push(child.cut(pos, start));\n } // adding the markdown part to nodes\n\n\n nodes.push(child.cut(textStart, textEnd).mark(type.create(attrs).addToSet(child.marks)));\n pos = end;\n }\n } // adding rest of text to nodes\n\n\n if (pos < text.length) {\n nodes.push(child.cut(pos));\n }\n } else {\n nodes.push(child.copy(handler(child.content)));\n }\n });\n return Fragment.fromArray(nodes);\n };\n\n return new Plugin({\n props: {\n transformPasted: function transformPasted(slice) {\n return new Slice(handler(slice.content), slice.openStart, slice.openEnd);\n }\n }\n });\n}\n\nfunction removeMark (type) {\n return function (state, dispatch) {\n var tr = state.tr,\n selection = state.selection;\n var from = selection.from,\n to = selection.to;\n var $from = selection.$from,\n empty = selection.empty;\n\n if (empty) {\n var range = getMarkRange($from, type);\n from = range.from;\n to = range.to;\n }\n\n tr.removeMark(from, to, type);\n return dispatch(tr);\n };\n}\n\nfunction replaceText () {\n var range = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var type = arguments.length > 1 ? arguments[1] : undefined;\n var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return function (state, dispatch) {\n var _state$selection = state.selection,\n $from = _state$selection.$from,\n $to = _state$selection.$to;\n var index = $from.index();\n var from = range ? range.from : $from.pos;\n var to = range ? range.to : $to.pos;\n\n if (!$from.parent.canReplaceWith(index, index, type)) {\n return false;\n }\n\n if (dispatch) {\n dispatch(state.tr.replaceWith(from, to, type.create(attrs)));\n }\n\n return true;\n };\n}\n\nfunction setInlineBlockType (type) {\n var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return function (state, dispatch) {\n var $from = state.selection.$from;\n var index = $from.index();\n\n if (!$from.parent.canReplaceWith(index, index, type)) {\n return false;\n }\n\n if (dispatch) {\n dispatch(state.tr.replaceSelectionWith(type.create(attrs)));\n }\n\n return true;\n };\n}\n\n// see https://github.com/ProseMirror/prosemirror-transform/blob/master/src/structure.js\n// Since this piece of code was \"borrowed\" from prosemirror, ESLint rules are ignored.\n\n/* eslint-disable max-len, no-plusplus, no-undef, eqeqeq */\n\nfunction canSplit(doc, pos) {\n var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var typesAfter = arguments.length > 3 ? arguments[3] : undefined;\n var $pos = doc.resolve(pos);\n var base = $pos.depth - depth;\n var innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;\n\n for (var d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n var node = $pos.node(d);\n\n var _index = $pos.index(d);\n\n if (node.type.spec.isolating) return false;\n var rest = node.content.cutByIndex(_index, node.childCount);\n var after = typesAfter && typesAfter[i] || node;\n if (after != node) rest = rest.replaceChild(0, after.type.create(after.attrs));\n /* Change starts from here */\n // if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest))\n // return false\n\n if (!node.canReplace(_index + 1, node.childCount)) return false;\n /* Change ends here */\n }\n\n var index = $pos.indexAfter(base);\n var baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);\n} // this is a copy of splitListItem\n// see https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js\n\n\nfunction splitToDefaultListItem(itemType) {\n return function (state, dispatch) {\n var _state$selection = state.selection,\n $from = _state$selection.$from,\n $to = _state$selection.$to,\n node = _state$selection.node;\n if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;\n var grandParent = $from.node(-1);\n if (grandParent.type != itemType) return false;\n\n if ($from.parent.content.size == 0) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 2 || $from.node(-3).type != itemType || $from.index(-2) != $from.node(-2).childCount - 1) return false;\n\n if (dispatch) {\n var wrap = Fragment.empty;\n var keepItem = $from.index(-1) > 0; // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n\n for (var d = $from.depth - (keepItem ? 1 : 2); d >= $from.depth - 3; d--) {\n wrap = Fragment.from($from.node(d).copy(wrap));\n } // Add a second list item with an empty default start node\n\n\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n\n var _tr = state.tr.replace($from.before(keepItem ? null : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));\n\n _tr.setSelection(state.selection.constructor.near(_tr.doc.resolve($from.pos + (keepItem ? 3 : 2))));\n\n dispatch(_tr.scrollIntoView());\n }\n\n return true;\n }\n\n var nextType = $to.pos == $from.end() ? grandParent.contentMatchAt($from.indexAfter(-1)).defaultType : null;\n var tr = state.tr.delete($from.pos, $to.pos);\n /* Change starts from here */\n // let types = nextType && [null, {type: nextType}]\n\n var types = nextType && [{\n type: itemType\n }, {\n type: nextType\n }];\n if (!types) types = [{\n type: itemType\n }, null];\n /* Change ends here */\n\n if (!canSplit(tr.doc, $from.pos, 2, types)) return false;\n if (dispatch) dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n return true;\n };\n}\n/* eslint-enable max-len, no-plusplus, no-undef, eqeqeq */\n\nfunction toggleBlockType (type, toggletype) {\n var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return function (state, dispatch, view) {\n var isActive = nodeIsActive(state, type, attrs);\n\n if (isActive) {\n return setBlockType(toggletype)(state, dispatch, view);\n }\n\n return setBlockType(type, attrs)(state, dispatch, view);\n };\n}\n\nfunction isList(node, schema) {\n return node.type === schema.nodes.bullet_list || node.type === schema.nodes.ordered_list || node.type === schema.nodes.todo_list;\n}\n\nfunction toggleList(listType, itemType) {\n return function (state, dispatch, view) {\n var schema = state.schema,\n selection = state.selection;\n var $from = selection.$from,\n $to = selection.$to;\n var range = $from.blockRange($to);\n\n if (!range) {\n return false;\n }\n\n var parentList = findParentNode(function (node) {\n return isList(node, schema);\n })(selection);\n\n if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {\n if (parentList.node.type === listType) {\n return liftListItem(itemType)(state, dispatch, view);\n }\n\n if (isList(parentList.node, schema) && listType.validContent(parentList.node.content)) {\n var tr = state.tr;\n tr.setNodeMarkup(parentList.pos, listType);\n\n if (dispatch) {\n dispatch(tr);\n }\n\n return false;\n }\n }\n\n return wrapInList(listType)(state, dispatch, view);\n };\n}\n\nfunction toggleWrap (type) {\n return function (state, dispatch, view) {\n var isActive = nodeIsActive(state, type);\n\n if (isActive) {\n return lift(state, dispatch);\n }\n\n return wrapIn(type)(state, dispatch, view);\n };\n}\n\nfunction updateMark (type, attrs) {\n return function (state, dispatch) {\n var tr = state.tr,\n selection = state.selection,\n doc = state.doc;\n var from = selection.from,\n to = selection.to;\n var $from = selection.$from,\n empty = selection.empty;\n\n if (empty) {\n var range = getMarkRange($from, type);\n from = range.from;\n to = range.to;\n }\n\n var hasMark = doc.rangeHasMark(from, to, type);\n\n if (hasMark) {\n tr.removeMark(from, to, type);\n }\n\n tr.addMark(from, to, type.create(attrs));\n return dispatch(tr);\n };\n}\n\nexport { insertText, markInputRule, markPasteRule, nodeInputRule, pasteRule, removeMark, replaceText, setInlineBlockType, splitToDefaultListItem, toggleBlockType, toggleList, toggleWrap, updateMark };\n","import { Plugin } from 'prosemirror-state';\nimport { findWrapping, canJoin } from 'prosemirror-transform';\n\n// ::- Input rules are regular expressions describing a piece of text\n// that, when typed, causes something to happen. This might be\n// changing two dashes into an emdash, wrapping a paragraph starting\n// with `\"> \"` into a blockquote, or something entirely different.\nvar InputRule = function InputRule(match, handler) {\n this.match = match;\n this.handler = typeof handler == \"string\" ? stringHandler(handler) : handler;\n};\n\nfunction stringHandler(string) {\n return function(state, match, start, end) {\n var insert = string;\n if (match[1]) {\n var offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n var cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n return state.tr.insertText(insert, start, end)\n }\n}\n\nvar MAX_MATCH = 500;\n\n// :: (config: {rules: [InputRule]}) → Plugin\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.\nfunction inputRules(ref) {\n var rules = ref.rules;\n\n var plugin = new Plugin({\n state: {\n init: function init() { return null },\n apply: function apply(tr, prev) {\n var stored = tr.getMeta(this);\n if (stored) { return stored }\n return tr.selectionSet || tr.docChanged ? null : prev\n }\n },\n\n props: {\n handleTextInput: function handleTextInput(view, from, to, text) {\n return run(view, from, to, text, rules, plugin)\n },\n handleDOMEvents: {\n compositionend: function (view) {\n setTimeout(function () {\n var ref = view.state.selection;\n var $cursor = ref.$cursor;\n if ($cursor) { run(view, $cursor.pos, $cursor.pos, \"\", rules, plugin); }\n });\n }\n }\n },\n\n isInputRules: true\n });\n return plugin\n}\n\nfunction run(view, from, to, text, rules, plugin) {\n if (view.composing) { return false }\n var state = view.state, $from = state.doc.resolve(from);\n if ($from.parent.type.spec.code) { return false }\n var textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - MAX_MATCH), $from.parentOffset,\n null, \"\\ufffc\") + text;\n for (var i = 0; i < rules.length; i++) {\n var match = rules[i].match.exec(textBefore);\n var tr = match && rules[i].handler(state, match, from - (match[0].length - text.length), to);\n if (!tr) { continue }\n view.dispatch(tr.setMeta(plugin, {transform: tr, from: from, to: to, text: text}));\n return true\n }\n return false\n}\n\n// :: (EditorState, ?(Transaction)) → bool\n// This is a command that will undo an input rule, if applying such a\n// rule was the last thing that the user did.\nfunction undoInputRule(state, dispatch) {\n var plugins = state.plugins;\n for (var i = 0; i < plugins.length; i++) {\n var plugin = plugins[i], undoable = (void 0);\n if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n if (dispatch) {\n var tr = state.tr, toUndo = undoable.transform;\n for (var j = toUndo.steps.length - 1; j >= 0; j--)\n { tr.step(toUndo.steps[j].invert(toUndo.docs[j])); }\n var marks = tr.doc.resolve(undoable.from).marks();\n dispatch(tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks)));\n }\n return true\n }\n }\n return false\n}\n\n// :: InputRule Converts double dashes to an emdash.\nvar emDash = new InputRule(/--$/, \"—\");\n// :: InputRule Converts three dots to an ellipsis character.\nvar ellipsis = new InputRule(/\\.\\.\\.$/, \"…\");\n// :: InputRule “Smart” opening double quotes.\nvar openDoubleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(\")$/, \"“\");\n// :: InputRule “Smart” closing double quotes.\nvar closeDoubleQuote = new InputRule(/\"$/, \"”\");\n// :: InputRule “Smart” opening single quotes.\nvar openSingleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(')$/, \"‘\");\n// :: InputRule “Smart” closing single quotes.\nvar closeSingleQuote = new InputRule(/'$/, \"’\");\n\n// :: [InputRule] Smart-quote related input rules.\nvar smartQuotes = [openDoubleQuote, closeDoubleQuote, openSingleQuote, closeSingleQuote];\n\n// :: (RegExp, NodeType, ?union<Object, ([string]) → ?Object>, ?([string], Node) → bool) → InputRule\n// Build an input rule for automatically wrapping a textblock when a\n// given string is typed. The `regexp` argument is\n// directly passed through to the `InputRule` constructor. 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// `nodeType` is the type of node to wrap in. If it needs attributes,\n// you can either pass them directly, or pass a function that will\n// compute them from the regular expression match.\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](#transform.Transform.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.\nfunction wrappingInputRule(regexp, nodeType, getAttrs, joinPredicate) {\n return new InputRule(regexp, function (state, match, start, end) {\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n var tr = state.tr.delete(start, end);\n var $start = tr.doc.resolve(start), range = $start.blockRange(), wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping) { return null }\n tr.wrap(range, wrapping);\n var before = tr.doc.resolve(start - 1).nodeBefore;\n if (before && before.type == nodeType && canJoin(tr.doc, start - 1) &&\n (!joinPredicate || joinPredicate(match, before)))\n { tr.join(start - 1); }\n return tr\n })\n}\n\n// :: (RegExp, NodeType, ?union<Object, ([string]) → ?Object>) → InputRule\n// Build an input rule that changes the type of a textblock when the\n// matched text is typed into it. You'll usually want to start your\n// regexp with `^` to that it is only matched at the start of a\n// textblock. The optional `getAttrs` parameter can be used to compute\n// the new node's attributes, and works the same as in the\n// `wrappingInputRule` function.\nfunction textblockTypeInputRule(regexp, nodeType, getAttrs) {\n return new InputRule(regexp, function (state, match, start, end) {\n var $start = state.doc.resolve(start);\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType)) { return null }\n return state.tr\n .delete(start, end)\n .setBlockType(start, start, nodeType, attrs)\n })\n}\n\nexport { InputRule, closeDoubleQuote, closeSingleQuote, ellipsis, emDash, inputRules, openDoubleQuote, openSingleQuote, smartQuotes, textblockTypeInputRule, undoInputRule, wrappingInputRule };\n//# sourceMappingURL=index.es.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar prosemirrorState = require('prosemirror-state');\nvar prosemirrorModel = require('prosemirror-model');\nvar prosemirrorTables = require('prosemirror-tables');\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a node of a given `nodeType`. It will return an original transaction if parent node hasn't been found.\n//\n// ```javascript\n// dispatch(\n// removeParentNodeOfType(schema.nodes.table)(tr)\n// );\n// ```\nvar removeParentNodeOfType = function removeParentNodeOfType(nodeType) {\n return function (tr) {\n var parent = findParentNodeOfType(nodeType)(tr.selection);\n if (parent) {\n return removeNodeAtPos(parent.pos)(tr);\n }\n return tr;\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>, content: union<ProseMirrorNode, Fragment>) → (tr: Transaction) → Transaction\n// Returns a new transaction that replaces parent node of a given `nodeType` with the given `content`. It will return an original transaction if either parent node hasn't been found or replacing is not possible.\n//\n// ```javascript\n// const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));\n//\n// dispatch(\n// replaceParentNodeOfType(schema.nodes.table, node)(tr)\n// );\n// ```\nvar replaceParentNodeOfType = function replaceParentNodeOfType(nodeType, content) {\n return function (tr) {\n if (!Array.isArray(nodeType)) {\n nodeType = [nodeType];\n }\n for (var i = 0, count = nodeType.length; i < count; i++) {\n var parent = findParentNodeOfType(nodeType[i])(tr.selection);\n if (parent) {\n var newTr = replaceNodeAtPos(parent.pos, content)(tr);\n if (newTr !== tr) {\n return newTr;\n }\n }\n }\n return tr;\n };\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected node. It will return an original transaction if current selection is not a `NodeSelection`.\n//\n// ```javascript\n// dispatch(\n// removeSelectedNode(tr)\n// );\n// ```\nvar removeSelectedNode = function removeSelectedNode(tr) {\n if (isNodeSelection(tr.selection)) {\n var from = tr.selection.$from.pos;\n var to = tr.selection.$to.pos;\n return cloneTr(tr.delete(from, to));\n }\n return tr;\n};\n\n// :: (content: union<ProseMirrorNode, ProseMirrorFragment>) → (tr: Transaction) → Transaction\n// Returns a new transaction that replaces selected node with a given `node`, keeping NodeSelection on the new `node`.\n// It will return the original transaction if either current selection is not a NodeSelection or replacing is not possible.\n//\n// ```javascript\n// const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));\n// dispatch(\n// replaceSelectedNode(node)(tr)\n// );\n// ```\nvar replaceSelectedNode = function replaceSelectedNode(content) {\n return function (tr) {\n if (isNodeSelection(tr.selection)) {\n var _tr$selection = tr.selection,\n $from = _tr$selection.$from,\n $to = _tr$selection.$to;\n\n if (content instanceof prosemirrorModel.Fragment && $from.parent.canReplace($from.index(), $from.indexAfter(), content) || $from.parent.canReplaceWith($from.index(), $from.indexAfter(), content.type)) {\n return cloneTr(tr.replaceWith($from.pos, $to.pos, content)\n // restore node selection\n .setSelection(new prosemirrorState.NodeSelection(tr.doc.resolve($from.pos))));\n }\n }\n return tr;\n };\n};\n\n// :: (position: number, dir: ?number) → (tr: Transaction) → Transaction\n// Returns a new transaction that tries to find a valid cursor selection starting at the given `position`\n// and searching back if `dir` is negative, and forward if positive.\n// If a valid cursor position hasn't been found, it will return the original transaction.\n//\n// ```javascript\n// dispatch(\n// setTextSelection(5)(tr)\n// );\n// ```\nvar setTextSelection = function setTextSelection(position) {\n var dir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n return function (tr) {\n var nextSelection = prosemirrorState.Selection.findFrom(tr.doc.resolve(position), dir, true);\n if (nextSelection) {\n return tr.setSelection(nextSelection);\n }\n return tr;\n };\n};\n\nvar isSelectableNode = function isSelectableNode(node) {\n return node.type && node.type.spec.selectable;\n};\nvar shouldSelectNode = function shouldSelectNode(node) {\n return isSelectableNode(node) && node.type.isLeaf;\n};\n\nvar setSelection = function setSelection(node, pos, tr) {\n if (shouldSelectNode(node)) {\n return tr.setSelection(new prosemirrorState.NodeSelection(tr.doc.resolve(pos)));\n }\n return setTextSelection(pos)(tr);\n};\n\n// :: (content: union<ProseMirrorNode, Fragment>, position: ?number, tryToReplace?: boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that inserts a given `content` at the current cursor position, or at a given `position`, if it is allowed by schema. If schema restricts such nesting, it will try to find an appropriate place for a given node in the document, looping through parent nodes up until the root document node.\n// If `tryToReplace` is true and current selection is a NodeSelection, it will replace selected node with inserted content if its allowed by schema.\n// If cursor is inside of an empty paragraph, it will try to replace that paragraph with the given content. If insertion is successful and inserted node has content, it will set cursor inside of that content.\n// It will return an original transaction if the place for insertion hasn't been found.\n//\n// ```javascript\n// const node = schema.nodes.extension.createChecked({});\n// dispatch(\n// safeInsert(node)(tr)\n// );\n// ```\nvar safeInsert = function safeInsert(content, position, tryToReplace) {\n return function (tr) {\n var hasPosition = typeof position === 'number';\n var $from = tr.selection.$from;\n\n var $insertPos = hasPosition ? tr.doc.resolve(position) : isNodeSelection(tr.selection) ? tr.doc.resolve($from.pos + 1) : $from;\n var parent = $insertPos.parent;\n\n // try to replace selected node\n\n if (isNodeSelection(tr.selection) && tryToReplace) {\n var oldTr = tr;\n tr = replaceSelectedNode(content)(tr);\n if (oldTr !== tr) {\n return tr;\n }\n }\n\n // try to replace an empty paragraph\n if (isEmptyParagraph(parent)) {\n var _oldTr = tr;\n tr = replaceParentNodeOfType(parent.type, content)(tr);\n if (_oldTr !== tr) {\n var pos = isSelectableNode(content) ? // for selectable node, selection position would be the position of the replaced parent\n $insertPos.before($insertPos.depth) : $insertPos.pos;\n return setSelection(content, pos, tr);\n }\n }\n\n // given node is allowed at the current cursor position\n if (canInsert($insertPos, content)) {\n tr.insert($insertPos.pos, content);\n var _pos = hasPosition ? $insertPos.pos : isSelectableNode(content) ? // for atom nodes selection position after insertion is the previous pos\n tr.selection.$anchor.pos - 1 : tr.selection.$anchor.pos;\n return cloneTr(setSelection(content, _pos, tr));\n }\n\n // looking for a place in the doc where the node is allowed\n for (var i = $insertPos.depth; i > 0; i--) {\n var _pos2 = $insertPos.after(i);\n var $pos = tr.doc.resolve(_pos2);\n if (canInsert($pos, content)) {\n tr.insert(_pos2, content);\n return cloneTr(setSelection(content, _pos2, tr));\n }\n }\n return tr;\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>, type: ?union<NodeType, null>, attrs: ?union<Object, null>, marks?: [Mark]) → (tr: Transaction) → Transaction\n// Returns a transaction that changes the type, attributes, and/or marks of the parent node of a given `nodeType`.\n//\n// ```javascript\n// const node = schema.nodes.extension.createChecked({});\n// dispatch(\n// setParentNodeMarkup(schema.nodes.panel, null, { panelType })(tr);\n// );\n// ```\nvar setParentNodeMarkup = function setParentNodeMarkup(nodeType, type, attrs, marks) {\n return function (tr) {\n var parent = findParentNodeOfType(nodeType)(tr.selection);\n if (parent) {\n return cloneTr(tr.setNodeMarkup(parent.pos, type, Object.assign({}, parent.node.attrs, attrs), marks));\n }\n return tr;\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (tr: Transaction) → Transaction\n// Returns a new transaction that sets a `NodeSelection` on a parent node of a `given nodeType`.\n//\n// ```javascript\n// dispatch(\n// selectParentNodeOfType([tableCell, tableHeader])(state.tr)\n// );\n// ```\nvar selectParentNodeOfType = function selectParentNodeOfType(nodeType) {\n return function (tr) {\n if (!isNodeSelection(tr.selection)) {\n var parent = findParentNodeOfType(nodeType)(tr.selection);\n if (parent) {\n return cloneTr(tr.setSelection(prosemirrorState.NodeSelection.create(tr.doc, parent.pos)));\n }\n }\n return tr;\n };\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that deletes previous node.\n//\n// ```javascript\n// dispatch(\n// removeNodeBefore(state.tr)\n// );\n// ```\nvar removeNodeBefore = function removeNodeBefore(tr) {\n var position = findPositionOfNodeBefore(tr.selection);\n if (typeof position === 'number') {\n return removeNodeAtPos(position)(tr);\n }\n return tr;\n};\n\n// :: (selection: Selection) → boolean\n// Checks if current selection is a `NodeSelection`.\n//\n// ```javascript\n// if (isNodeSelection(tr.selection)) {\n// // ...\n// }\n// ```\nvar isNodeSelection = function isNodeSelection(selection) {\n return selection instanceof prosemirrorState.NodeSelection;\n};\n\n// (nodeType: union<NodeType, [NodeType]>) → boolean\n// Checks if the type a given `node` equals to a given `nodeType`.\nvar equalNodeType = function equalNodeType(nodeType, node) {\n return Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1 || node.type === nodeType;\n};\n\n// (tr: Transaction) → Transaction\n// Creates a new transaction object from a given transaction\nvar cloneTr = function cloneTr(tr) {\n return Object.assign(Object.create(tr), tr).setTime(Date.now());\n};\n\n// (position: number, content: union<ProseMirrorNode, Fragment>) → (tr: Transaction) → Transaction\n// Returns a `replace` transaction that replaces a node at a given position with the given `content`.\n// It will return the original transaction if replacing is not possible.\n// `position` should point at the position immediately before the node.\nvar replaceNodeAtPos = function replaceNodeAtPos(position, content) {\n return function (tr) {\n var node = tr.doc.nodeAt(position);\n var $pos = tr.doc.resolve(position);\n if (canReplace($pos, content)) {\n tr = tr.replaceWith(position, position + node.nodeSize, content);\n var start = tr.selection.$from.pos - 1;\n // put cursor inside of the inserted node\n tr = setTextSelection(Math.max(start, 0), -1)(tr);\n // move cursor to the start of the node\n tr = setTextSelection(tr.selection.$from.start())(tr);\n return cloneTr(tr);\n }\n return tr;\n };\n};\n\n// ($pos: ResolvedPos, doc: ProseMirrorNode, content: union<ProseMirrorNode, Fragment>, ) → boolean\n// Checks if replacing a node at a given `$pos` inside of the `doc` node with the given `content` is possible.\nvar canReplace = function canReplace($pos, content) {\n var node = $pos.node($pos.depth);\n return node && node.type.validContent(content instanceof prosemirrorModel.Fragment ? content : prosemirrorModel.Fragment.from(content));\n};\n\n// (position: number) → (tr: Transaction) → Transaction\n// Returns a `delete` transaction that removes a node at a given position with the given `node`.\n// `position` should point at the position immediately before the node.\nvar removeNodeAtPos = function removeNodeAtPos(position) {\n return function (tr) {\n var node = tr.doc.nodeAt(position);\n return cloneTr(tr.delete(position, position + node.nodeSize));\n };\n};\n\n// (schema: Schema) → {[key: string]: NodeType}\n// Returns a map where keys are tableRoles and values are NodeTypes.\nvar tableNodeTypes = function tableNodeTypes(schema) {\n if (schema.cached.tableNodeTypes) {\n return schema.cached.tableNodeTypes;\n }\n var roles = {};\n Object.keys(schema.nodes).forEach(function (type) {\n var nodeType = schema.nodes[type];\n if (nodeType.spec.tableRole) {\n roles[nodeType.spec.tableRole] = nodeType;\n }\n });\n schema.cached.tableNodeTypes = roles;\n return roles;\n};\n\n// :: ($pos: ResolvedPos, content: union<ProseMirrorNode, Fragment>) → boolean\n// Checks if a given `content` can be inserted at the given `$pos`\n//\n// ```javascript\n// const { selection: { $from } } = state;\n// const node = state.schema.nodes.atom.createChecked();\n// if (canInsert($from, node)) {\n// // ...\n// }\n// ```\nvar canInsert = function canInsert($pos, content) {\n var index = $pos.index();\n\n if (content instanceof prosemirrorModel.Fragment) {\n return $pos.parent.canReplace(index, index, content);\n } else if (content instanceof prosemirrorModel.Node) {\n return $pos.parent.canReplaceWith(index, index, content.type);\n }\n return false;\n};\n\n// (node: ProseMirrorNode) → boolean\n// Checks if a given `node` is an empty paragraph\nvar isEmptyParagraph = function isEmptyParagraph(node) {\n return !node || node.type.name === 'paragraph' && node.nodeSize === 2;\n};\n\n// ($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning a table node closest to a given `$pos`.\n//\n// ```javascript\n// const table = findTableClosestToPos(state.doc.resolve(10));\n// ```\nvar findTableClosestToPos = function findTableClosestToPos($pos) {\n var predicate = function predicate(node) {\n return node.type.spec.tableRole && /table/i.test(node.type.spec.tableRole);\n };\n return findParentNodeClosestToPos($pos, predicate);\n};\n\nvar createCell = function createCell(cellType) {\n var cellContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n if (cellContent) {\n return cellType.createChecked(null, cellContent);\n }\n\n return cellType.createAndFill();\n};\n\n// (rect: {left: number, right: number, top: number, bottom: number}) → (selection: Selection) → boolean\n// Checks if a given CellSelection rect is selected\nvar isRectSelected = function isRectSelected(rect) {\n return function (selection) {\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n var start = selection.$anchorCell.start(-1);\n var cells = map.cellsInRect(rect);\n var selectedCells = map.cellsInRect(map.rectBetween(selection.$anchorCell.pos - start, selection.$headCell.pos - start));\n\n for (var i = 0, count = cells.length; i < count; i++) {\n if (selectedCells.indexOf(cells[i]) === -1) {\n return false;\n }\n }\n\n return true;\n };\n};\n\n// This function transposes an array of array flipping the columns for rows,\n// transposition is a familiar algebra concept;\n// you can get more details here:\n// https://en.wikipedia.org/wiki/Transpose\n//\n// ```javascript\n//\n// const arr = [\n// ['a1', 'a2', 'a3'],\n// ['b1', 'b2', 'b3'],\n// ['c1', 'c2', 'c3'],\n// ['d1', 'd2', 'd3'],\n// ];\n//\n// const result = transpose(arr);\n//\n// result === [\n// ['a1', 'b1', 'c1', 'd1'],\n// ['a2', 'b2', 'c2', 'd2'],\n// ['a3', 'b3', 'c3', 'd3'],\n// ]\n// ```\nvar transpose = function transpose(array) {\n return array[0].map(function (_, i) {\n return array.map(function (column) {\n return column[i];\n });\n });\n};\n\n// :: (tableNode: Node) -> Array<Node>\n// This function will transform the table node\n// into a matrix of rows and columns respecting merged cells,\n// for example this table will be convert to the below:\n//\n// ```\n// ____________________________\n// | | | |\n// | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// | A3 | B3 | C2 | |\n// |______|______|______|______|\n// ```\n//\n//\n// ```javascript\n// array = [\n// [A1, B1, C1, null],\n// [A2, B2, null, D1],\n// [A3. B3, C2, null],\n// ]\n// ```\nvar convertTableNodeToArrayOfRows = function convertTableNodeToArrayOfRows(tableNode) {\n var map = prosemirrorTables.TableMap.get(tableNode);\n var rows = [];\n for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {\n var rowCells = [];\n var seen = {};\n\n for (var colIndex = 0; colIndex < map.width; colIndex++) {\n var cellPos = map.map[rowIndex * map.width + colIndex];\n var cell = tableNode.nodeAt(cellPos);\n var rect = map.findCell(cellPos);\n if (seen[cellPos] || rect.top !== rowIndex) {\n rowCells.push(null);\n continue;\n }\n seen[cellPos] = true;\n\n rowCells.push(cell);\n }\n\n rows.push(rowCells);\n }\n\n return rows;\n};\n\n// :: (tableNode: Node, tableArray: Array<Node>) -> Node\n// This function will transform a matrix of nodes\n// into table node respecting merged cells and rows configurations,\n// for example this array will be convert to the table below:\n//\n// ```javascript\n// array = [\n// [A1, B1, C1, null],\n// [A2, B2, null, D1],\n// [A3. B3, C2, null],\n// ]\n// ```\n//\n// ```\n// ____________________________\n// | | | |\n// | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// | A3 | B3 | C2 | |\n// |______|______|______|______|\n// ```\n//\nvar convertArrayOfRowsToTableNode = function convertArrayOfRowsToTableNode(tableNode, arrayOfNodes) {\n var rowsPM = [];\n var map = prosemirrorTables.TableMap.get(tableNode);\n for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {\n var row = tableNode.child(rowIndex);\n var rowCells = [];\n\n for (var colIndex = 0; colIndex < map.width; colIndex++) {\n if (!arrayOfNodes[rowIndex][colIndex]) {\n continue;\n }\n var cellPos = map.map[rowIndex * map.width + colIndex];\n\n var cell = arrayOfNodes[rowIndex][colIndex];\n var oldCell = tableNode.nodeAt(cellPos);\n var newCell = oldCell.type.createChecked(Object.assign({}, cell.attrs), cell.content, cell.marks);\n rowCells.push(newCell);\n }\n\n rowsPM.push(row.type.createChecked(row.attrs, rowCells, row.marks));\n }\n\n var newTable = tableNode.type.createChecked(tableNode.attrs, rowsPM, tableNode.marks);\n\n return newTable;\n};\n\nvar moveTableColumn = function moveTableColumn(table, indexesOrigin, indexesTarget, direction) {\n var rows = transpose(convertTableNodeToArrayOfRows(table.node));\n\n rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n rows = transpose(rows);\n\n return convertArrayOfRowsToTableNode(table.node, rows);\n};\n\nvar moveTableRow = function moveTableRow(table, indexesOrigin, indexesTarget, direction) {\n var rows = convertTableNodeToArrayOfRows(table.node);\n\n rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n\n return convertArrayOfRowsToTableNode(table.node, rows);\n};\n\nvar moveRowInArrayOfRows = function moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, directionOverride) {\n var direction = indexesOrigin[0] > indexesTarget[0] ? -1 : 1;\n\n var rowsExtracted = rows.splice(indexesOrigin[0], indexesOrigin.length);\n var positionOffset = rowsExtracted.length % 2 === 0 ? 1 : 0;\n var target = void 0;\n\n if (directionOverride === -1 && direction === 1) {\n target = indexesTarget[0] - 1;\n } else if (directionOverride === 1 && direction === -1) {\n target = indexesTarget[indexesTarget.length - 1] - positionOffset + 1;\n } else {\n target = direction === -1 ? indexesTarget[0] : indexesTarget[indexesTarget.length - 1] - positionOffset;\n }\n\n rows.splice.apply(rows, [target, 0].concat(rowsExtracted));\n return rows;\n};\n\nvar checkInvalidMovements = function checkInvalidMovements(originIndex, targetIndex, targets, type) {\n var direction = originIndex > targetIndex ? -1 : 1;\n var errorMessage = 'Target position is invalid, you can\\'t move the ' + type + ' ' + originIndex + ' to ' + targetIndex + ', the target can\\'t be split. You could use tryToFit option.';\n\n if (direction === 1) {\n if (targets.slice(0, targets.length - 1).indexOf(targetIndex) !== -1) {\n throw new Error(errorMessage);\n }\n } else {\n if (targets.slice(1).indexOf(targetIndex) !== -1) {\n throw new Error(errorMessage);\n }\n }\n\n return true;\n};\n\n// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const predicate = node => node.type === schema.nodes.blockquote;\n// const parent = findParentNode(predicate)(selection);\n// ```\nvar findParentNode = function findParentNode(predicate) {\n return function (_ref) {\n var $from = _ref.$from;\n return findParentNodeClosestToPos($from, predicate);\n };\n};\n\n// :: ($pos: ResolvedPos, predicate: (node: ProseMirrorNode) → boolean) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes starting from the given `$pos`, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const predicate = node => node.type === schema.nodes.blockquote;\n// const parent = findParentNodeClosestToPos(state.doc.resolve(5), predicate);\n// ```\nvar findParentNodeClosestToPos = function findParentNodeClosestToPos($pos, predicate) {\n for (var i = $pos.depth; i > 0; i--) {\n var node = $pos.node(i);\n if (predicate(node)) {\n return {\n pos: i > 0 ? $pos.before(i) : 0,\n start: $pos.start(i),\n depth: i,\n node: node\n };\n }\n }\n};\n\n// :: (predicate: (node: ProseMirrorNode) → boolean, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → (selection: Selection) → ?dom.Node\n// Iterates over parent nodes, returning DOM reference of the closest node `predicate` returns truthy for.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const predicate = node => node.type === schema.nodes.table;\n// const parent = findParentDomRef(predicate, domAtPos)(selection); // <table>\n// ```\nvar findParentDomRef = function findParentDomRef(predicate, domAtPos) {\n return function (selection) {\n var parent = findParentNode(predicate)(selection);\n if (parent) {\n return findDomRefAtPos(parent.pos, domAtPos);\n }\n };\n};\n\n// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → boolean\n// Checks if there's a parent node `predicate` returns truthy for.\n//\n// ```javascript\n// if (hasParentNode(node => node.type === schema.nodes.table)(selection)) {\n// // ....\n// }\n// ```\nvar hasParentNode = function hasParentNode(predicate) {\n return function (selection) {\n return !!findParentNode(predicate)(selection);\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const parent = findParentNodeOfType(schema.nodes.paragraph)(selection);\n// ```\nvar findParentNodeOfType = function findParentNodeOfType(nodeType) {\n return function (selection) {\n return findParentNode(function (node) {\n return equalNodeType(nodeType, node);\n })(selection);\n };\n};\n\n// :: ($pos: ResolvedPos, nodeType: union<NodeType, [NodeType]>) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes starting from the given `$pos`, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const parent = findParentNodeOfTypeClosestToPos(state.doc.resolve(10), schema.nodes.paragraph);\n// ```\nvar findParentNodeOfTypeClosestToPos = function findParentNodeOfTypeClosestToPos($pos, nodeType) {\n return findParentNodeClosestToPos($pos, function (node) {\n return equalNodeType(nodeType, node);\n });\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (selection: Selection) → boolean\n// Checks if there's a parent node of a given `nodeType`.\n//\n// ```javascript\n// if (hasParentNodeOfType(schema.nodes.table)(selection)) {\n// // ....\n// }\n// ```\nvar hasParentNodeOfType = function hasParentNodeOfType(nodeType) {\n return function (selection) {\n return hasParentNode(function (node) {\n return equalNodeType(nodeType, node);\n })(selection);\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → (selection: Selection) → ?dom.Node\n// Iterates over parent nodes, returning DOM reference of the closest node of a given `nodeType`.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const parent = findParentDomRefOfType(schema.nodes.codeBlock, domAtPos)(selection); // <pre>\n// ```\nvar findParentDomRefOfType = function findParentDomRefOfType(nodeType, domAtPos) {\n return function (selection) {\n return findParentDomRef(function (node) {\n return equalNodeType(nodeType, node);\n }, domAtPos)(selection);\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Returns a node of a given `nodeType` if it is selected. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const { extension, inlineExtension, bodiedExtension } = schema.nodes;\n// const selectedNode = findSelectedNodeOfType([\n// extension,\n// inlineExtension,\n// bodiedExtension,\n// ])(selection);\n// ```\nvar findSelectedNodeOfType = function findSelectedNodeOfType(nodeType) {\n return function (selection) {\n if (isNodeSelection(selection)) {\n var node = selection.node,\n $from = selection.$from;\n\n if (equalNodeType(nodeType, node)) {\n return { node: node, pos: $from.pos, depth: $from.depth };\n }\n }\n };\n};\n\n// :: (selection: Selection) → ?number\n// Returns position of the previous node.\n//\n// ```javascript\n// const pos = findPositionOfNodeBefore(tr.selection);\n// ```\nvar findPositionOfNodeBefore = function findPositionOfNodeBefore(selection) {\n var nodeBefore = selection.$from.nodeBefore;\n\n var maybeSelection = prosemirrorState.Selection.findFrom(selection.$from, -1);\n if (maybeSelection && nodeBefore) {\n // leaf node\n var parent = findParentNodeOfType(nodeBefore.type)(maybeSelection);\n if (parent) {\n return parent.pos;\n }\n return maybeSelection.$from.pos;\n }\n};\n\n// :: (position: number, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → dom.Node\n// Returns DOM reference of a node at a given `position`. If the node type is of type `TEXT_NODE` it will return the reference of the parent node.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const ref = findDomRefAtPos($from.pos, domAtPos);\n// ```\nvar findDomRefAtPos = function findDomRefAtPos(position, domAtPos) {\n var dom = domAtPos(position);\n var node = dom.node.childNodes[dom.offset];\n\n if (dom.node.nodeType === Node.TEXT_NODE) {\n return dom.node.parentNode;\n }\n\n if (!node || node.nodeType === Node.TEXT_NODE) {\n return dom.node;\n }\n\n return node;\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Flattens descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const children = flatten(node);\n// ```\nvar flatten = function flatten(node) {\n var descend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n if (!node) {\n throw new Error('Invalid \"node\" parameter');\n }\n var result = [];\n node.descendants(function (child, pos) {\n result.push({ node: child, pos: pos });\n if (!descend) {\n return false;\n }\n });\n return result;\n};\n\n// :: (node: ProseMirrorNode, predicate: (node: ProseMirrorNode) → boolean, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const textNodes = findChildren(node, child => child.isText, false);\n// ```\nvar findChildren = function findChildren(node, predicate, descend) {\n if (!node) {\n throw new Error('Invalid \"node\" parameter');\n } else if (!predicate) {\n throw new Error('Invalid \"predicate\" parameter');\n }\n return flatten(node, descend).filter(function (child) {\n return predicate(child.node);\n });\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns text nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const textNodes = findTextNodes(node);\n// ```\nvar findTextNodes = function findTextNodes(node, descend) {\n return findChildren(node, function (child) {\n return child.isText;\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns inline nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const inlineNodes = findInlineNodes(node);\n// ```\nvar findInlineNodes = function findInlineNodes(node, descend) {\n return findChildren(node, function (child) {\n return child.isInline;\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns block descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const blockNodes = findBlockNodes(node);\n// ```\nvar findBlockNodes = function findBlockNodes(node, descend) {\n return findChildren(node, function (child) {\n return child.isBlock;\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, predicate: (attrs: ?Object) → boolean, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const mergedCells = findChildrenByAttr(table, attrs => attrs.colspan === 2);\n// ```\nvar findChildrenByAttr = function findChildrenByAttr(node, predicate, descend) {\n return findChildren(node, function (child) {\n return !!predicate(child.attrs);\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, nodeType: NodeType, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes of a given nodeType. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const cells = findChildrenByType(table, schema.nodes.tableCell);\n// ```\nvar findChildrenByType = function findChildrenByType(node, nodeType, descend) {\n return findChildren(node, function (child) {\n return child.type === nodeType;\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, markType: markType, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes that have a mark of a given markType. It doesn't descend into a `node` when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const nodes = findChildrenByMark(state.doc, schema.marks.strong);\n// ```\nvar findChildrenByMark = function findChildrenByMark(node, markType, descend) {\n return findChildren(node, function (child) {\n return markType.isInSet(child.marks);\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, nodeType: NodeType) → boolean\n// Returns `true` if a given node contains nodes of a given `nodeType`\n//\n// ```javascript\n// if (contains(panel, schema.nodes.listItem)) {\n// // ...\n// }\n// ```\nvar contains = function contains(node, nodeType) {\n return !!findChildrenByType(node, nodeType).length;\n};\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n// :: (selection: Selection) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning the closest table node.\n//\n// ```javascript\n// const table = findTable(selection);\n// ```\nvar findTable = function findTable(selection) {\n return findParentNode(function (node) {\n return node.type.spec.tableRole && node.type.spec.tableRole === 'table';\n })(selection);\n};\n\n// :: (selection: Selection) → boolean\n// Checks if current selection is a `CellSelection`.\n//\n// ```javascript\n// if (isCellSelection(selection)) {\n// // ...\n// }\n// ```\nvar isCellSelection = function isCellSelection(selection) {\n return selection instanceof prosemirrorTables.CellSelection;\n};\n\n// :: (selection: Selection) → ?{left: number, right: number, top: number, bottom: number}\n// Get the selection rectangle. Returns `undefined` if selection is not a CellSelection.\n//\n// ```javascript\n// const rect = getSelectionRect(selection);\n// ```\nvar getSelectionRect = function getSelectionRect(selection) {\n if (!isCellSelection(selection)) {\n return;\n }\n var start = selection.$anchorCell.start(-1);\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n return map.rectBetween(selection.$anchorCell.pos - start, selection.$headCell.pos - start);\n};\n\n// :: (columnIndex: number) → (selection: Selection) → boolean\n// Checks if entire column at index `columnIndex` is selected.\n//\n// ```javascript\n// const className = isColumnSelected(i)(selection) ? 'selected' : '';\n// ```\nvar isColumnSelected = function isColumnSelected(columnIndex) {\n return function (selection) {\n if (isCellSelection(selection)) {\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n return isRectSelected({\n left: columnIndex,\n right: columnIndex + 1,\n top: 0,\n bottom: map.height\n })(selection);\n }\n\n return false;\n };\n};\n\n// :: (rowIndex: number) → (selection: Selection) → boolean\n// Checks if entire row at index `rowIndex` is selected.\n//\n// ```javascript\n// const className = isRowSelected(i)(selection) ? 'selected' : '';\n// ```\nvar isRowSelected = function isRowSelected(rowIndex) {\n return function (selection) {\n if (isCellSelection(selection)) {\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n return isRectSelected({\n left: 0,\n right: map.width,\n top: rowIndex,\n bottom: rowIndex + 1\n })(selection);\n }\n\n return false;\n };\n};\n\n// :: (selection: Selection) → boolean\n// Checks if entire table is selected\n//\n// ```javascript\n// const className = isTableSelected(selection) ? 'selected' : '';\n// ```\nvar isTableSelected = function isTableSelected(selection) {\n if (isCellSelection(selection)) {\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n return isRectSelected({\n left: 0,\n right: map.width,\n top: 0,\n bottom: map.height\n })(selection);\n }\n\n return false;\n};\n\n// :: (columnIndex: union<number, [number]>) → (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of cells in a column(s), where `columnIndex` could be a column index or an array of column indexes.\n//\n// ```javascript\n// const cells = getCellsInColumn(i)(selection); // [{node, pos}, {node, pos}]\n// ```\nvar getCellsInColumn = function getCellsInColumn(columnIndex) {\n return function (selection) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var indexes = Array.isArray(columnIndex) ? columnIndex : Array.from([columnIndex]);\n return indexes.reduce(function (acc, index) {\n if (index >= 0 && index <= map.width - 1) {\n var cells = map.cellsInRect({\n left: index,\n right: index + 1,\n top: 0,\n bottom: map.height\n });\n return acc.concat(cells.map(function (nodePos) {\n var node = table.node.nodeAt(nodePos);\n var pos = nodePos + table.start;\n return { pos: pos, start: pos + 1, node: node };\n }));\n }\n }, []);\n }\n };\n};\n\n// :: (rowIndex: union<number, [number]>) → (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of cells in a row(s), where `rowIndex` could be a row index or an array of row indexes.\n//\n// ```javascript\n// const cells = getCellsInRow(i)(selection); // [{node, pos}, {node, pos}]\n// ```\nvar getCellsInRow = function getCellsInRow(rowIndex) {\n return function (selection) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var indexes = Array.isArray(rowIndex) ? rowIndex : Array.from([rowIndex]);\n return indexes.reduce(function (acc, index) {\n if (index >= 0 && index <= map.height - 1) {\n var cells = map.cellsInRect({\n left: 0,\n right: map.width,\n top: index,\n bottom: index + 1\n });\n return acc.concat(cells.map(function (nodePos) {\n var node = table.node.nodeAt(nodePos);\n var pos = nodePos + table.start;\n return { pos: pos, start: pos + 1, node: node };\n }));\n }\n }, []);\n }\n };\n};\n\n// :: (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of all cells in a table.\n//\n// ```javascript\n// const cells = getCellsInTable(selection); // [{node, pos}, {node, pos}]\n// ```\nvar getCellsInTable = function getCellsInTable(selection) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var cells = map.cellsInRect({\n left: 0,\n right: map.width,\n top: 0,\n bottom: map.height\n });\n return cells.map(function (nodePos) {\n var node = table.node.nodeAt(nodePos);\n var pos = nodePos + table.start;\n return { pos: pos, start: pos + 1, node: node };\n });\n }\n};\n\nvar select = function select(type) {\n return function (index, expand) {\n return function (tr) {\n var table = findTable(tr.selection);\n var isRowSelection = type === 'row';\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n\n // Check if the index is valid\n if (index >= 0 && index < (isRowSelection ? map.height : map.width)) {\n var left = isRowSelection ? 0 : index;\n var top = isRowSelection ? index : 0;\n var right = isRowSelection ? map.width : index + 1;\n var bottom = isRowSelection ? index + 1 : map.height;\n\n if (expand) {\n var cell = findCellClosestToPos(tr.selection.$from);\n if (!cell) {\n return tr;\n }\n\n var selRect = map.findCell(cell.pos - table.start);\n if (isRowSelection) {\n top = Math.min(top, selRect.top);\n bottom = Math.max(bottom, selRect.bottom);\n } else {\n left = Math.min(left, selRect.left);\n right = Math.max(right, selRect.right);\n }\n }\n\n var cellsInFirstRow = map.cellsInRect({\n left: left,\n top: top,\n right: isRowSelection ? right : left + 1,\n bottom: isRowSelection ? top + 1 : bottom\n });\n\n var cellsInLastRow = bottom - top === 1 ? cellsInFirstRow : map.cellsInRect({\n left: isRowSelection ? left : right - 1,\n top: isRowSelection ? bottom - 1 : top,\n right: right,\n bottom: bottom\n });\n\n var head = table.start + cellsInFirstRow[0];\n var anchor = table.start + cellsInLastRow[cellsInLastRow.length - 1];\n var $head = tr.doc.resolve(head);\n var $anchor = tr.doc.resolve(anchor);\n\n return cloneTr(tr.setSelection(new prosemirrorTables.CellSelection($anchor, $head)));\n }\n }\n return tr;\n };\n };\n};\n\n// :: (columnIndex: number, expand: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on a column at index `columnIndex`.\n// Use the optional `expand` param to extend from current selection.\n//\n// ```javascript\n// dispatch(\n// selectColumn(i)(state.tr)\n// );\n// ```\nvar selectColumn = select('column');\n\n// :: (rowIndex: number, expand: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on a column at index `rowIndex`.\n// Use the optional `expand` param to extend from current selection.\n//\n// ```javascript\n// dispatch(\n// selectRow(i)(state.tr)\n// );\n// ```\nvar selectRow = select('row');\n\n// :: (selection: Selection) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on the entire table.\n//\n// ```javascript\n// dispatch(\n// selectTable(i)(state.tr)\n// );\n// ```\nvar selectTable = function selectTable(tr) {\n var table = findTable(tr.selection);\n if (table) {\n var _TableMap$get = prosemirrorTables.TableMap.get(table.node),\n map = _TableMap$get.map;\n\n if (map && map.length) {\n var head = table.start + map[0];\n var anchor = table.start + map[map.length - 1];\n var $head = tr.doc.resolve(head);\n var $anchor = tr.doc.resolve(anchor);\n\n return cloneTr(tr.setSelection(new prosemirrorTables.CellSelection($anchor, $head)));\n }\n }\n return tr;\n};\n\n// :: (cell: {pos: number, node: ProseMirrorNode}, schema: Schema) → (tr: Transaction) → Transaction\n// Returns a new transaction that clears the content of a given `cell`.\n//\n// ```javascript\n// const $pos = state.doc.resolve(13);\n// dispatch(\n// emptyCell(findCellClosestToPos($pos), state.schema)(state.tr)\n// );\n// ```\nvar emptyCell = function emptyCell(cell, schema) {\n return function (tr) {\n if (cell) {\n var _tableNodeTypes$cell$ = tableNodeTypes(schema).cell.createAndFill(),\n content = _tableNodeTypes$cell$.content;\n\n if (!cell.node.content.eq(content)) {\n tr.replaceWith(cell.pos + 1, cell.pos + cell.node.nodeSize, content);\n return cloneTr(tr);\n }\n }\n return tr;\n };\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new column at index `columnIndex`.\n//\n// ```javascript\n// dispatch(\n// addColumnAt(i)(state.tr)\n// );\n// ```\nvar addColumnAt = function addColumnAt(columnIndex) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n if (columnIndex >= 0 && columnIndex <= map.width) {\n return cloneTr(prosemirrorTables.addColumn(tr, {\n map: map,\n tableStart: table.start,\n table: table.node\n }, columnIndex));\n }\n }\n return tr;\n };\n};\n\n// :: (originRowIndex: number, targetRowIndex: targetColumnIndex, options?: MovementOptions) → (tr: Transaction) → Transaction\n// Returns a new transaction that moves the origin row to the target index;\n//\n// by default \"tryToFit\" is false, that means if you try to move a row to a place\n// where we will need to split a row with merged cells it'll throw an exception, for example:\n//\n// ```\n// ____________________________\n// | | | |\n// 0 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// 1 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 2 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// ```\n//\n// if you try to move the row 0 to the row index 1 with tryToFit false,\n// it'll throw an exception since you can't split the row 1;\n// but if \"tryToFit\" is true, it'll move the row using the current direction.\n//\n// We defined current direction using the target and origin values\n// if the origin is greater than the target, that means the course is `bottom-to-top`,\n// so the `tryToFit` logic will use this direction to determine\n// if we should move the column to the right or the left.\n//\n// for example, if you call the function using `moveRow(0, 1, { tryToFit: true })`\n// the result will be:\n// ```\n// ____________________________\n// | | | |\n// 0 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 1 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 2 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// ```\n//\n// since we could put the row zero on index one,\n// we pushed to the best place to fit the row index 0,\n// in this case, row index 2.\n//\n//\n// -------- HOW TO OVERRIDE DIRECTION --------\n//\n// If you set \"tryToFit\" to \"true\", it will try to figure out the best direction\n// place to fit using the origin and target index, for example:\n//\n//\n// ```\n// ____________________________\n// | | | |\n// 0 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// 1 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 2 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 3 | A4 | B4 | |\n// |______|______ ______| |\n// | | | | D2 |\n// 4 | A5 | B5 | C3 | |\n// |______|______|______|______|\n// ```\n//\n//\n// If you try to move the row 0 to row index 4 with \"tryToFit\" enabled, by default,\n// the code will put it on after the merged rows,\n// but you can override it using the \"direction\" option.\n//\n// -1: Always put the origin before the target\n// ```\n// ____________________________\n// | | | |\n// 0 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 1 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 2 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// 3 | A4 | B4 | |\n// |______|______ ______| |\n// | | | | D2 |\n// 4 | A5 | B5 | C3 | |\n// |______|______|______|______|\n// ```\n//\n// 0: Automatically decide the best place to fit\n// ```\n// ____________________________\n// | | | |\n// 0 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 1 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 2 | A4 | B4 | |\n// |______|______ ______| |\n// | | | | D2 |\n// 3 | A5 | B5 | C3 | |\n// |______|______|______|______|\n// | | | |\n// 4 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// ```\n//\n// 1: Always put the origin after the target\n// ```\n// ____________________________\n// | | | |\n// 0 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 1 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 2 | A4 | B4 | |\n// |______|______ ______| |\n// | | | | D2 |\n// 3 | A5 | B5 | C3 | |\n// |______|______|______|______|\n// | | | |\n// 4 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// ```\n//\n// ```javascript\n// dispatch(\n// moveRow(x, y, options)(state.tr)\n// );\n// ```\nvar moveRow = function moveRow(originRowIndex, targetRowIndex, opts) {\n return function (tr) {\n var defaultOptions = { tryToFit: false, direction: 0 };\n var options = Object.assign(defaultOptions, opts);\n var table = findTable(tr.selection);\n if (!table) {\n return tr;\n }\n\n var _getSelectionRangeInR = getSelectionRangeInRow(originRowIndex)(tr),\n indexesOriginRow = _getSelectionRangeInR.indexes;\n\n var _getSelectionRangeInR2 = getSelectionRangeInRow(targetRowIndex)(tr),\n indexesTargetRow = _getSelectionRangeInR2.indexes;\n\n if (indexesOriginRow.indexOf(targetRowIndex) > -1) {\n return tr;\n }\n\n if (!options.tryToFit && indexesTargetRow.length > 1) {\n checkInvalidMovements(originRowIndex, targetRowIndex, indexesTargetRow, 'row');\n }\n\n var newTable = moveTableRow(table, indexesOriginRow, indexesTargetRow, options.direction);\n\n return cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);\n };\n};\n\n// :: (originColumnIndex: number, targetColumnIndex: targetColumnIndex, options?: MovementOptions) → (tr: Transaction) → Transaction\n// Returns a new transaction that moves the origin column to the target index;\n//\n// by default \"tryToFit\" is false, that means if you try to move a column to a place\n// where we will need to split a column with merged cells it'll throw an exception, for example:\n//\n// ```\n// 0 1 2\n// ____________________________\n// | | | |\n// | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// | A3 | B3 | C2 | |\n// |______|______|______|______|\n// ```\n//\n//\n// if you try to move the column 0 to the column index 1 with tryToFit false,\n// it'll throw an exception since you can't split the column 1;\n// but if \"tryToFit\" is true, it'll move the column using the current direction.\n//\n// We defined current direction using the target and origin values\n// if the origin is greater than the target, that means the course is `right-to-left`,\n// so the `tryToFit` logic will use this direction to determine\n// if we should move the column to the right or the left.\n//\n// for example, if you call the function using `moveColumn(0, 1, { tryToFit: true })`\n// the result will be:\n//\n// ```\n// 0 1 2\n// _____________________ _______\n// | | | |\n// | B1 | C1 | A1 |\n// |______|______ ______|______|\n// | | | |\n// | B2 | | A2 |\n// |______ ______| |______|\n// | | | D1 | |\n// | B3 | C2 | | A3 |\n// |______|______|______|______|\n// ```\n//\n// since we could put the column zero on index one,\n// we pushed to the best place to fit the column 0, in this case, column index 2.\n//\n// -------- HOW TO OVERRIDE DIRECTION --------\n//\n// If you set \"tryToFit\" to \"true\", it will try to figure out the best direction\n// place to fit using the origin and target index, for example:\n//\n//\n// ```\n// 0 1 2 3 4 5 6\n// _________________________________________________\n// | | | | | |\n// | A1 | B1 | C1 | E1 | F1 |\n// |______|______|______ ______|______|______ ______|\n// | | | | | |\n// | A2 | B2 | | E2 | |\n// |______|______ ______| |______ ______| |\n// | | | | D1 | | | G2 |\n// | A3 | B3 | C3 | | E3 | F3 | |\n// |______|______|______|______|______|______|______|\n// ```\n//\n//\n// If you try to move the column 0 to column index 5 with \"tryToFit\" enabled, by default,\n// the code will put it on after the merged columns,\n// but you can override it using the \"direction\" option.\n//\n// -1: Always put the origin before the target\n//\n// ```\n// 0 1 2 3 4 5 6\n// _________________________________________________\n// | | | | | |\n// | B1 | C1 | A1 | E1 | F1 |\n// |______|______ ______|______|______|______ ______|\n// | | | | | |\n// | B2 | | A2 | E2 | |\n// |______ ______| |______|______ ______| |\n// | | | D1 | | | | G2 |\n// | B3 | C3 | | A3 | E3 | F3 | |\n// |______|______|______|______|______|______|______|\n// ```\n//\n// 0: Automatically decide the best place to fit\n//\n// ```\n// 0 1 2 3 4 5 6\n// _________________________________________________\n// | | | | | |\n// | B1 | C1 | E1 | F1 | A1 |\n// |______|______ ______|______|______ ______|______|\n// | | | | | |\n// | B2 | | E2 | | A2 |\n// |______ ______| |______ ______| |______|\n// | | | D1 | | | G2 | |\n// | B3 | C3 | | E3 | F3 | | A3 |\n// |______|______|______|______|______|______|______|\n// ```\n//\n// 1: Always put the origin after the target\n//\n// ```\n// 0 1 2 3 4 5 6\n// _________________________________________________\n// | | | | | |\n// | B1 | C1 | E1 | F1 | A1 |\n// |______|______ ______|______|______ ______|______|\n// | | | | | |\n// | B2 | | E2 | | A2 |\n// |______ ______| |______ ______| |______|\n// | | | D1 | | | G2 | |\n// | B3 | C3 | | E3 | F3 | | A3 |\n// |______|______|______|______|______|______|______|\n// ```\n//\n// ```javascript\n// dispatch(\n// moveColumn(x, y, options)(state.tr)\n// );\n// ```\nvar moveColumn = function moveColumn(originColumnIndex, targetColumnIndex, opts) {\n return function (tr) {\n var defaultOptions = { tryToFit: false, direction: 0 };\n var options = Object.assign(defaultOptions, opts);\n var table = findTable(tr.selection);\n if (!table) {\n return tr;\n }\n\n var _getSelectionRangeInC = getSelectionRangeInColumn(originColumnIndex)(tr),\n indexesOriginColumn = _getSelectionRangeInC.indexes;\n\n var _getSelectionRangeInC2 = getSelectionRangeInColumn(targetColumnIndex)(tr),\n indexesTargetColumn = _getSelectionRangeInC2.indexes;\n\n if (indexesOriginColumn.indexOf(targetColumnIndex) > -1) {\n return tr;\n }\n\n if (!options.tryToFit && indexesTargetColumn.length > 1) {\n checkInvalidMovements(originColumnIndex, targetColumnIndex, indexesTargetColumn, 'column');\n }\n\n var newTable = moveTableColumn(table, indexesOriginColumn, indexesTargetColumn, options.direction);\n\n return cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);\n };\n};\n\n// :: (rowIndex: number, clonePreviousRow?: boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new row at index `rowIndex`. Optionally clone the previous row.\n//\n// ```javascript\n// dispatch(\n// addRowAt(i)(state.tr)\n// );\n// ```\n//\n// ```javascript\n// dispatch(\n// addRowAt(i, true)(state.tr)\n// );\n// ```\nvar addRowAt = function addRowAt(rowIndex, clonePreviousRow) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var cloneRowIndex = rowIndex - 1;\n\n if (clonePreviousRow && cloneRowIndex >= 0) {\n return cloneTr(cloneRowAt(cloneRowIndex)(tr));\n }\n\n if (rowIndex >= 0 && rowIndex <= map.height) {\n return cloneTr(prosemirrorTables.addRow(tr, {\n map: map,\n tableStart: table.start,\n table: table.node\n }, rowIndex));\n }\n }\n return tr;\n };\n};\n\n// :: (cloneRowIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new row after `cloneRowIndex`, cloning the row attributes at `cloneRowIndex`.\n//\n// ```javascript\n// dispatch(\n// cloneRowAt(i)(state.tr)\n// );\n// ```\nvar cloneRowAt = function cloneRowAt(rowIndex) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n\n if (rowIndex >= 0 && rowIndex <= map.height) {\n var tableNode = table.node;\n var tableNodes = tableNodeTypes(tableNode.type.schema);\n\n var rowPos = table.start;\n for (var i = 0; i < rowIndex + 1; i++) {\n rowPos += tableNode.child(i).nodeSize;\n }\n\n var cloneRow = tableNode.child(rowIndex);\n // Re-create the same nodes with same attrs, dropping the node content.\n var cells = [];\n var rowWidth = 0;\n cloneRow.forEach(function (cell) {\n // If we're copying a row with rowspan somewhere, we dont want to copy that cell\n // We'll increment its span below.\n if (cell.attrs.rowspan === 1) {\n rowWidth += cell.attrs.colspan;\n cells.push(tableNodes[cell.type.spec.tableRole].createAndFill(cell.attrs, cell.marks));\n }\n });\n\n // If a higher row spans past our clone row, bump the higher row to cover this new row too.\n if (rowWidth < map.width) {\n var rowSpanCells = [];\n\n var _loop = function _loop(_i) {\n var foundCells = filterCellsInRow(_i, function (cell, tr) {\n var rowspan = cell.node.attrs.rowspan;\n var spanRange = _i + rowspan;\n return rowspan > 1 && spanRange > rowIndex;\n })(tr);\n rowSpanCells.push.apply(rowSpanCells, _toConsumableArray(foundCells));\n };\n\n for (var _i = rowIndex; _i >= 0; _i--) {\n _loop(_i);\n }\n\n if (rowSpanCells.length) {\n rowSpanCells.forEach(function (cell) {\n tr = setCellAttrs(cell, {\n rowspan: cell.node.attrs.rowspan + 1\n })(tr);\n });\n }\n }\n\n return safeInsert(tableNodes.row.create(cloneRow.attrs, cells), rowPos)(tr);\n }\n }\n return tr;\n };\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a column at index `columnIndex`. If there is only one column left, it will remove the entire table.\n//\n// ```javascript\n// dispatch(\n// removeColumnAt(i)(state.tr)\n// );\n// ```\nvar removeColumnAt = function removeColumnAt(columnIndex) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n if (columnIndex === 0 && map.width === 1) {\n return removeTable(tr);\n } else if (columnIndex >= 0 && columnIndex <= map.width) {\n prosemirrorTables.removeColumn(tr, {\n map: map,\n tableStart: table.start,\n table: table.node\n }, columnIndex);\n return cloneTr(tr);\n }\n }\n return tr;\n };\n};\n\n// :: (rowIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a row at index `rowIndex`. If there is only one row left, it will remove the entire table.\n//\n// ```javascript\n// dispatch(\n// removeRowAt(i)(state.tr)\n// );\n// ```\nvar removeRowAt = function removeRowAt(rowIndex) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n if (rowIndex === 0 && map.height === 1) {\n return removeTable(tr);\n } else if (rowIndex >= 0 && rowIndex <= map.height) {\n prosemirrorTables.removeRow(tr, {\n map: map,\n tableStart: table.start,\n table: table.node\n }, rowIndex);\n return cloneTr(tr);\n }\n }\n return tr;\n };\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes a table node if the cursor is inside of it.\n//\n// ```javascript\n// dispatch(\n// removeTable(state.tr)\n// );\n// ```\nvar removeTable = function removeTable(tr) {\n var $from = tr.selection.$from;\n\n for (var depth = $from.depth; depth > 0; depth--) {\n var node = $from.node(depth);\n if (node.type.spec.tableRole === 'table') {\n return cloneTr(tr.delete($from.before(depth), $from.after(depth)));\n }\n }\n return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected columns.\n//\n// ```javascript\n// dispatch(\n// removeSelectedColumns(state.tr)\n// );\n// ```\nvar removeSelectedColumns = function removeSelectedColumns(tr) {\n var selection = tr.selection;\n\n if (isTableSelected(selection)) {\n return removeTable(tr);\n }\n if (isCellSelection(selection)) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var rect = map.rectBetween(selection.$anchorCell.pos - table.start, selection.$headCell.pos - table.start);\n\n if (rect.left == 0 && rect.right == map.width) {\n return false;\n }\n\n var pmTableRect = Object.assign({}, rect, {\n map: map,\n table: table.node,\n tableStart: table.start\n });\n\n for (var i = pmTableRect.right - 1;; i--) {\n prosemirrorTables.removeColumn(tr, pmTableRect, i);\n if (i === pmTableRect.left) {\n break;\n }\n pmTableRect.table = pmTableRect.tableStart ? tr.doc.nodeAt(pmTableRect.tableStart - 1) : tr.doc;\n pmTableRect.map = prosemirrorTables.TableMap.get(pmTableRect.table);\n }\n return cloneTr(tr);\n }\n }\n return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected rows.\n//\n// ```javascript\n// dispatch(\n// removeSelectedRows(state.tr)\n// );\n// ```\nvar removeSelectedRows = function removeSelectedRows(tr) {\n var selection = tr.selection;\n\n if (isTableSelected(selection)) {\n return removeTable(tr);\n }\n if (isCellSelection(selection)) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var rect = map.rectBetween(selection.$anchorCell.pos - table.start, selection.$headCell.pos - table.start);\n\n if (rect.top == 0 && rect.bottom == map.height) {\n return false;\n }\n\n var pmTableRect = Object.assign({}, rect, {\n map: map,\n table: table.node,\n tableStart: table.start\n });\n\n for (var i = pmTableRect.bottom - 1;; i--) {\n prosemirrorTables.removeRow(tr, pmTableRect, i);\n if (i === pmTableRect.top) {\n break;\n }\n pmTableRect.table = pmTableRect.tableStart ? tr.doc.nodeAt(pmTableRect.tableStart - 1) : tr.doc;\n pmTableRect.map = prosemirrorTables.TableMap.get(pmTableRect.table);\n }\n\n return cloneTr(tr);\n }\n }\n return tr;\n};\n\n// :: ($pos: ResolvedPos) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a column closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n// removeColumnClosestToPos(state.doc.resolve(3))(state.tr)\n// );\n// ```\nvar removeColumnClosestToPos = function removeColumnClosestToPos($pos) {\n return function (tr) {\n var rect = findCellRectClosestToPos($pos);\n if (rect) {\n return removeColumnAt(rect.left)(setTextSelection($pos.pos)(tr));\n }\n return tr;\n };\n};\n\n// :: ($pos: ResolvedPos) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a row closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n// removeRowClosestToPos(state.doc.resolve(3))(state.tr)\n// );\n// ```\nvar removeRowClosestToPos = function removeRowClosestToPos($pos) {\n return function (tr) {\n var rect = findCellRectClosestToPos($pos);\n if (rect) {\n return removeRowAt(rect.top)(setTextSelection($pos.pos)(tr));\n }\n return tr;\n };\n};\n\n// :: (columnIndex: number, cellTransform: (cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that maps a given `cellTransform` function to each cell in a column at a given `columnIndex`.\n// It will set the selection into the last cell of the column if `setCursorToLastCell` param is set to `true`.\n//\n// ```javascript\n// dispatch(\n// forEachCellInColumn(0, (cell, tr) => emptyCell(cell, state.schema)(tr))(state.tr)\n// );\n// ```\nvar forEachCellInColumn = function forEachCellInColumn(columnIndex, cellTransform, setCursorToLastCell) {\n return function (tr) {\n var cells = getCellsInColumn(columnIndex)(tr.selection);\n if (cells) {\n for (var i = cells.length - 1; i >= 0; i--) {\n tr = cellTransform(cells[i], tr);\n }\n if (setCursorToLastCell) {\n var $pos = tr.doc.resolve(tr.mapping.map(cells[cells.length - 1].pos));\n tr.setSelection(prosemirrorState.Selection.near($pos));\n }\n return cloneTr(tr);\n }\n return tr;\n };\n};\n\n// :: (rowIndex: number, cellTransform: (cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that maps a given `cellTransform` function to each cell in a row at a given `rowIndex`.\n// It will set the selection into the last cell of the row if `setCursorToLastCell` param is set to `true`.\n//\n// ```javascript\n// dispatch(\n// forEachCellInRow(0, (cell, tr) => setCellAttrs(cell, { background: 'red' })(tr))(state.tr)\n// );\n// ```\nvar forEachCellInRow = function forEachCellInRow(rowIndex, cellTransform, setCursorToLastCell) {\n return function (tr) {\n var cells = getCellsInRow(rowIndex)(tr.selection);\n if (cells) {\n for (var i = cells.length - 1; i >= 0; i--) {\n tr = cellTransform(cells[i], tr);\n }\n if (setCursorToLastCell) {\n var $pos = tr.doc.resolve(tr.mapping.map(cells[cells.length - 1].pos));\n tr.setSelection(prosemirrorState.Selection.near($pos));\n }\n }\n return tr;\n };\n};\n\n// :: (cell: {pos: number, start: number, node: ProseMirrorNode}, attrs: Object) → (tr: Transaction) → Transaction\n// Returns a new transaction that sets given `attrs` to a given `cell`.\n//\n// ```javascript\n// dispatch(\n// setCellAttrs(findCellClosestToPos($pos), { background: 'blue' })(tr);\n// );\n// ```\nvar setCellAttrs = function setCellAttrs(cell, attrs) {\n return function (tr) {\n if (cell) {\n tr.setNodeMarkup(cell.pos, null, Object.assign({}, cell.node.attrs, attrs));\n return cloneTr(tr);\n }\n return tr;\n };\n};\n\n// :: (schema: Schema, rowsCount: ?number, colsCount: ?number, withHeaderRow: ?boolean, cellContent: ?Node) → Node\n// Returns a table node of a given size.\n// `withHeaderRow` defines whether the first row of the table will be a header row.\n// `cellContent` defines the content of each cell.\n//\n// ```javascript\n// const table = createTable(state.schema); // 3x3 table node\n// dispatch(\n// tr.replaceSelectionWith(table).scrollIntoView()\n// );\n// ```\nvar createTable = function createTable(schema) {\n var rowsCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;\n var colsCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;\n var withHeaderRow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n var cellContent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;\n\n var _tableNodeTypes = tableNodeTypes(schema),\n tableCell = _tableNodeTypes.cell,\n tableHeader = _tableNodeTypes.header_cell,\n tableRow = _tableNodeTypes.row,\n table = _tableNodeTypes.table;\n\n var cells = [];\n var headerCells = [];\n for (var i = 0; i < colsCount; i++) {\n cells.push(createCell(tableCell, cellContent));\n\n if (withHeaderRow) {\n headerCells.push(createCell(tableHeader, cellContent));\n }\n }\n\n var rows = [];\n for (var _i2 = 0; _i2 < rowsCount; _i2++) {\n rows.push(tableRow.createChecked(null, withHeaderRow && _i2 === 0 ? headerCells : cells));\n }\n\n return table.createChecked(null, rows);\n};\n\n// :: ($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning a table cell or a table header node closest to a given `$pos`.\n//\n// ```javascript\n// const cell = findCellClosestToPos(state.selection.$from);\n// ```\nvar findCellClosestToPos = function findCellClosestToPos($pos) {\n var predicate = function predicate(node) {\n return node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole);\n };\n return findParentNodeClosestToPos($pos, predicate);\n};\n\n// :: ($pos: ResolvedPos) → ?{left: number, top: number, right: number, bottom: number}\n// Returns the rectangle spanning a cell closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n// findCellRectClosestToPos(state.selection.$from)\n// );\n// ```\nvar findCellRectClosestToPos = function findCellRectClosestToPos($pos) {\n var cell = findCellClosestToPos($pos);\n if (cell) {\n var table = findTableClosestToPos($pos);\n var map = prosemirrorTables.TableMap.get(table.node);\n var cellPos = cell.pos - table.start;\n return map.rectBetween(cellPos, cellPos);\n }\n};\n\nvar filterCellsInRow = function filterCellsInRow(rowIndex, predicate) {\n return function (tr) {\n var foundCells = [];\n var cells = getCellsInRow(rowIndex)(tr.selection);\n if (cells) {\n for (var j = cells.length - 1; j >= 0; j--) {\n if (predicate(cells[j], tr)) {\n foundCells.push(cells[j]);\n }\n }\n }\n\n return foundCells;\n };\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}\n// Returns a range of rectangular selection spanning all merged cells around a column at index `columnIndex`.\n//\n// ```javascript\n// const range = getSelectionRangeInColumn(3)(state.tr);\n// ```\nvar getSelectionRangeInColumn = function getSelectionRangeInColumn(columnIndex) {\n return function (tr) {\n var startIndex = columnIndex;\n var endIndex = columnIndex;\n\n // looking for selection start column (startIndex)\n\n var _loop2 = function _loop2(i) {\n var cells = getCellsInColumn(i)(tr.selection);\n if (cells) {\n cells.forEach(function (cell) {\n var maybeEndIndex = cell.node.attrs.colspan + i - 1;\n if (maybeEndIndex >= startIndex) {\n startIndex = i;\n }\n if (maybeEndIndex > endIndex) {\n endIndex = maybeEndIndex;\n }\n });\n }\n };\n\n for (var i = columnIndex; i >= 0; i--) {\n _loop2(i);\n }\n // looking for selection end column (endIndex)\n\n var _loop3 = function _loop3(i) {\n var cells = getCellsInColumn(i)(tr.selection);\n if (cells) {\n cells.forEach(function (cell) {\n var maybeEndIndex = cell.node.attrs.colspan + i - 1;\n if (cell.node.attrs.colspan > 1 && maybeEndIndex > endIndex) {\n endIndex = maybeEndIndex;\n }\n });\n }\n };\n\n for (var i = columnIndex; i <= endIndex; i++) {\n _loop3(i);\n }\n\n // filter out columns without cells (where all rows have colspan > 1 in the same column)\n var indexes = [];\n for (var i = startIndex; i <= endIndex; i++) {\n var maybeCells = getCellsInColumn(i)(tr.selection);\n if (maybeCells && maybeCells.length) {\n indexes.push(i);\n }\n }\n startIndex = indexes[0];\n endIndex = indexes[indexes.length - 1];\n\n var firstSelectedColumnCells = getCellsInColumn(startIndex)(tr.selection);\n var firstRowCells = getCellsInRow(0)(tr.selection);\n var $anchor = tr.doc.resolve(firstSelectedColumnCells[firstSelectedColumnCells.length - 1].pos);\n\n var headCell = void 0;\n for (var _i3 = endIndex; _i3 >= startIndex; _i3--) {\n var columnCells = getCellsInColumn(_i3)(tr.selection);\n if (columnCells && columnCells.length) {\n for (var j = firstRowCells.length - 1; j >= 0; j--) {\n if (firstRowCells[j].pos === columnCells[0].pos) {\n headCell = columnCells[0];\n break;\n }\n }\n if (headCell) {\n break;\n }\n }\n }\n\n var $head = tr.doc.resolve(headCell.pos);\n return { $anchor: $anchor, $head: $head, indexes: indexes };\n };\n};\n\n// :: (rowIndex: number) → (tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}\n// Returns a range of rectangular selection spanning all merged cells around a row at index `rowIndex`.\n//\n// ```javascript\n// const range = getSelectionRangeInRow(3)(state.tr);\n// ```\nvar getSelectionRangeInRow = function getSelectionRangeInRow(rowIndex) {\n return function (tr) {\n var startIndex = rowIndex;\n var endIndex = rowIndex;\n // looking for selection start row (startIndex)\n\n var _loop4 = function _loop4(i) {\n var cells = getCellsInRow(i)(tr.selection);\n cells.forEach(function (cell) {\n var maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n if (maybeEndIndex >= startIndex) {\n startIndex = i;\n }\n if (maybeEndIndex > endIndex) {\n endIndex = maybeEndIndex;\n }\n });\n };\n\n for (var i = rowIndex; i >= 0; i--) {\n _loop4(i);\n }\n // looking for selection end row (endIndex)\n\n var _loop5 = function _loop5(i) {\n var cells = getCellsInRow(i)(tr.selection);\n cells.forEach(function (cell) {\n var maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n if (cell.node.attrs.rowspan > 1 && maybeEndIndex > endIndex) {\n endIndex = maybeEndIndex;\n }\n });\n };\n\n for (var i = rowIndex; i <= endIndex; i++) {\n _loop5(i);\n }\n\n // filter out rows without cells (where all columns have rowspan > 1 in the same row)\n var indexes = [];\n for (var i = startIndex; i <= endIndex; i++) {\n var maybeCells = getCellsInRow(i)(tr.selection);\n if (maybeCells && maybeCells.length) {\n indexes.push(i);\n }\n }\n startIndex = indexes[0];\n endIndex = indexes[indexes.length - 1];\n\n var firstSelectedRowCells = getCellsInRow(startIndex)(tr.selection);\n var firstColumnCells = getCellsInColumn(0)(tr.selection);\n var $anchor = tr.doc.resolve(firstSelectedRowCells[firstSelectedRowCells.length - 1].pos);\n\n var headCell = void 0;\n for (var _i4 = endIndex; _i4 >= startIndex; _i4--) {\n var rowCells = getCellsInRow(_i4)(tr.selection);\n if (rowCells && rowCells.length) {\n for (var j = firstColumnCells.length - 1; j >= 0; j--) {\n if (firstColumnCells[j].pos === rowCells[0].pos) {\n headCell = rowCells[0];\n break;\n }\n }\n if (headCell) {\n break;\n }\n }\n }\n\n var $head = tr.doc.resolve(headCell.pos);\n return { $anchor: $anchor, $head: $head, indexes: indexes };\n };\n};\n\nexports.isNodeSelection = isNodeSelection;\nexports.canInsert = canInsert;\nexports.convertTableNodeToArrayOfRows = convertTableNodeToArrayOfRows;\nexports.convertArrayOfRowsToTableNode = convertArrayOfRowsToTableNode;\nexports.findParentNode = findParentNode;\nexports.findParentNodeClosestToPos = findParentNodeClosestToPos;\nexports.findParentDomRef = findParentDomRef;\nexports.hasParentNode = hasParentNode;\nexports.findParentNodeOfType = findParentNodeOfType;\nexports.findParentNodeOfTypeClosestToPos = findParentNodeOfTypeClosestToPos;\nexports.hasParentNodeOfType = hasParentNodeOfType;\nexports.findParentDomRefOfType = findParentDomRefOfType;\nexports.findSelectedNodeOfType = findSelectedNodeOfType;\nexports.findPositionOfNodeBefore = findPositionOfNodeBefore;\nexports.findDomRefAtPos = findDomRefAtPos;\nexports.flatten = flatten;\nexports.findChildren = findChildren;\nexports.findTextNodes = findTextNodes;\nexports.findInlineNodes = findInlineNodes;\nexports.findBlockNodes = findBlockNodes;\nexports.findChildrenByAttr = findChildrenByAttr;\nexports.findChildrenByType = findChildrenByType;\nexports.findChildrenByMark = findChildrenByMark;\nexports.contains = contains;\nexports.findTable = findTable;\nexports.isCellSelection = isCellSelection;\nexports.getSelectionRect = getSelectionRect;\nexports.isColumnSelected = isColumnSelected;\nexports.isRowSelected = isRowSelected;\nexports.isTableSelected = isTableSelected;\nexports.getCellsInColumn = getCellsInColumn;\nexports.getCellsInRow = getCellsInRow;\nexports.getCellsInTable = getCellsInTable;\nexports.selectColumn = selectColumn;\nexports.selectRow = selectRow;\nexports.selectTable = selectTable;\nexports.emptyCell = emptyCell;\nexports.addColumnAt = addColumnAt;\nexports.moveRow = moveRow;\nexports.moveColumn = moveColumn;\nexports.addRowAt = addRowAt;\nexports.cloneRowAt = cloneRowAt;\nexports.removeColumnAt = removeColumnAt;\nexports.removeRowAt = removeRowAt;\nexports.removeTable = removeTable;\nexports.removeSelectedColumns = removeSelectedColumns;\nexports.removeSelectedRows = removeSelectedRows;\nexports.removeColumnClosestToPos = removeColumnClosestToPos;\nexports.removeRowClosestToPos = removeRowClosestToPos;\nexports.forEachCellInColumn = forEachCellInColumn;\nexports.forEachCellInRow = forEachCellInRow;\nexports.setCellAttrs = setCellAttrs;\nexports.createTable = createTable;\nexports.findCellClosestToPos = findCellClosestToPos;\nexports.findCellRectClosestToPos = findCellRectClosestToPos;\nexports.getSelectionRangeInColumn = getSelectionRangeInColumn;\nexports.getSelectionRangeInRow = getSelectionRangeInRow;\nexports.removeParentNodeOfType = removeParentNodeOfType;\nexports.replaceParentNodeOfType = replaceParentNodeOfType;\nexports.removeSelectedNode = removeSelectedNode;\nexports.replaceSelectedNode = replaceSelectedNode;\nexports.setTextSelection = setTextSelection;\nexports.safeInsert = safeInsert;\nexports.setParentNodeMarkup = setParentNodeMarkup;\nexports.selectParentNodeOfType = selectParentNodeOfType;\nexports.removeNodeBefore = removeNodeBefore;\n//# sourceMappingURL=index.js.map\n","import { TextSelection, Selection, NodeSelection } from 'prosemirror-state';\nimport { DOMSerializer, Fragment, Mark, DOMParser, Slice } from 'prosemirror-model';\nimport { dropPoint } from 'prosemirror-transform';\n\nvar result = {};\n\nif (typeof navigator != \"undefined\" && typeof document != \"undefined\") {\n var ie_edge = /Edge\\/(\\d+)/.exec(navigator.userAgent);\n var ie_upto10 = /MSIE \\d/.test(navigator.userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);\n\n result.mac = /Mac/.test(navigator.platform);\n var ie = result.ie = !!(ie_upto10 || ie_11up || ie_edge);\n result.ie_version = ie_upto10 ? document.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : null;\n result.gecko = !ie && /gecko\\/(\\d+)/i.test(navigator.userAgent);\n result.gecko_version = result.gecko && +(/Firefox\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1];\n var chrome = !ie && /Chrome\\/(\\d+)/.exec(navigator.userAgent);\n result.chrome = !!chrome;\n result.chrome_version = chrome && +chrome[1];\n result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\\/\\w+/.test(navigator.userAgent);\n result.android = /Android \\d/.test(navigator.userAgent);\n result.webkit = \"webkitFontSmoothing\" in document.documentElement.style;\n result.safari = /Apple Computer/.test(navigator.vendor);\n result.webkit_version = result.webkit && +(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1];\n}\n\nvar domIndex = function(node) {\n for (var index = 0;; index++) {\n node = node.previousSibling;\n if (!node) { return index }\n }\n};\n\nvar parentNode = function(node) {\n var parent = node.parentNode;\n return parent && parent.nodeType == 11 ? parent.host : parent\n};\n\nvar textRange = function(node, from, to) {\n var range = document.createRange();\n range.setEnd(node, to == null ? node.nodeValue.length : to);\n range.setStart(node, from || 0);\n return range\n};\n\n// Scans forward and backward through DOM positions equivalent to the\n// given one to see if the two are in the same place (i.e. after a\n// text node vs at the end of that text node)\nvar isEquivalentPosition = function(node, off, targetNode, targetOff) {\n return targetNode && (scanFor(node, off, targetNode, targetOff, -1) ||\n scanFor(node, off, targetNode, targetOff, 1))\n};\n\nvar atomElements = /^(img|br|input|textarea|hr)$/i;\n\nfunction scanFor(node, off, targetNode, targetOff, dir) {\n for (;;) {\n if (node == targetNode && off == targetOff) { return true }\n if (off == (dir < 0 ? 0 : nodeSize(node))) {\n var parent = node.parentNode;\n if (parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == \"false\")\n { return false }\n off = domIndex(node) + (dir < 0 ? 0 : 1);\n node = parent;\n } else if (node.nodeType == 1) {\n node = node.childNodes[off + (dir < 0 ? -1 : 0)];\n if (node.contentEditable == \"false\") { return false }\n off = dir < 0 ? nodeSize(node) : 0;\n } else {\n return false\n }\n }\n}\n\nfunction nodeSize(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length\n}\n\nfunction isOnEdge(node, offset, parent) {\n for (var atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {\n if (node == parent) { return true }\n var index = domIndex(node);\n node = node.parentNode;\n if (!node) { return false }\n atStart = atStart && index == 0;\n atEnd = atEnd && index == nodeSize(node);\n }\n}\n\nfunction hasBlockDesc(dom) {\n var desc;\n for (var cur = dom; cur; cur = cur.parentNode) { if (desc = cur.pmViewDesc) { break } }\n return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom)\n}\n\n// Work around Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=447523\n// (isCollapsed inappropriately returns true in shadow dom)\nvar selectionCollapsed = function(domSel) {\n var collapsed = domSel.isCollapsed;\n if (collapsed && result.chrome && domSel.rangeCount && !domSel.getRangeAt(0).collapsed)\n { collapsed = false; }\n return collapsed\n};\n\nfunction keyEvent(keyCode, key) {\n var event = document.createEvent(\"Event\");\n event.initEvent(\"keydown\", true, true);\n event.keyCode = keyCode;\n event.key = event.code = key;\n return event\n}\n\nfunction windowRect(win) {\n return {left: 0, right: win.innerWidth,\n top: 0, bottom: win.innerHeight}\n}\n\nfunction getSide(value, side) {\n return typeof value == \"number\" ? value : value[side]\n}\n\nfunction scrollRectIntoView(view, rect, startDOM) {\n var scrollThreshold = view.someProp(\"scrollThreshold\") || 0, scrollMargin = view.someProp(\"scrollMargin\") || 5;\n var doc = view.dom.ownerDocument, win = doc.defaultView;\n for (var parent = startDOM || view.dom;; parent = parentNode(parent)) {\n if (!parent) { break }\n if (parent.nodeType != 1) { continue }\n var atTop = parent == doc.body || parent.nodeType != 1;\n var bounding = atTop ? windowRect(win) : parent.getBoundingClientRect();\n var moveX = 0, moveY = 0;\n if (rect.top < bounding.top + getSide(scrollThreshold, \"top\"))\n { moveY = -(bounding.top - rect.top + getSide(scrollMargin, \"top\")); }\n else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, \"bottom\"))\n { moveY = rect.bottom - bounding.bottom + getSide(scrollMargin, \"bottom\"); }\n if (rect.left < bounding.left + getSide(scrollThreshold, \"left\"))\n { moveX = -(bounding.left - rect.left + getSide(scrollMargin, \"left\")); }\n else if (rect.right > bounding.right - getSide(scrollThreshold, \"right\"))\n { moveX = rect.right - bounding.right + getSide(scrollMargin, \"right\"); }\n if (moveX || moveY) {\n if (atTop) {\n win.scrollBy(moveX, moveY);\n } else {\n var startX = parent.scrollLeft, startY = parent.scrollTop;\n if (moveY) { parent.scrollTop += moveY; }\n if (moveX) { parent.scrollLeft += moveX; }\n var dX = parent.scrollLeft - startX, dY = parent.scrollTop - startY;\n rect = {left: rect.left - dX, top: rect.top - dY, right: rect.right - dX, bottom: rect.bottom - dY};\n }\n }\n if (atTop) { break }\n }\n}\n\n// Store the scroll position of the editor's parent nodes, along with\n// the top position of an element near the top of the editor, which\n// will be used to make sure the visible viewport remains stable even\n// when the size of the content above changes.\nfunction storeScrollPos(view) {\n var rect = view.dom.getBoundingClientRect(), startY = Math.max(0, rect.top);\n var refDOM, refTop;\n for (var x = (rect.left + rect.right) / 2, y = startY + 1;\n y < Math.min(innerHeight, rect.bottom); y += 5) {\n var dom = view.root.elementFromPoint(x, y);\n if (dom == view.dom || !view.dom.contains(dom)) { continue }\n var localRect = dom.getBoundingClientRect();\n if (localRect.top >= startY - 20) {\n refDOM = dom;\n refTop = localRect.top;\n break\n }\n }\n return {refDOM: refDOM, refTop: refTop, stack: scrollStack(view.dom)}\n}\n\nfunction scrollStack(dom) {\n var stack = [], doc = dom.ownerDocument;\n for (; dom; dom = parentNode(dom)) {\n stack.push({dom: dom, top: dom.scrollTop, left: dom.scrollLeft});\n if (dom == doc) { break }\n }\n return stack\n}\n\n// Reset the scroll position of the editor's parent nodes to that what\n// it was before, when storeScrollPos was called.\nfunction resetScrollPos(ref) {\n var refDOM = ref.refDOM;\n var refTop = ref.refTop;\n var stack = ref.stack;\n\n var newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;\n restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);\n}\n\nfunction restoreScrollStack(stack, dTop) {\n for (var i = 0; i < stack.length; i++) {\n var ref = stack[i];\n var dom = ref.dom;\n var top = ref.top;\n var left = ref.left;\n if (dom.scrollTop != top + dTop) { dom.scrollTop = top + dTop; }\n if (dom.scrollLeft != left) { dom.scrollLeft = left; }\n }\n}\n\nvar preventScrollSupported = null;\n// Feature-detects support for .focus({preventScroll: true}), and uses\n// a fallback kludge when not supported.\nfunction focusPreventScroll(dom) {\n if (dom.setActive) { return dom.setActive() } // in IE\n if (preventScrollSupported) { return dom.focus(preventScrollSupported) }\n\n var stored = scrollStack(dom);\n dom.focus(preventScrollSupported == null ? {\n get preventScroll() {\n preventScrollSupported = {preventScroll: true};\n return true\n }\n } : undefined);\n if (!preventScrollSupported) {\n preventScrollSupported = false;\n restoreScrollStack(stored, 0);\n }\n}\n\nfunction findOffsetInNode(node, coords) {\n var closest, dxClosest = 2e8, coordsClosest, offset = 0;\n var rowBot = coords.top, rowTop = coords.top;\n for (var child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {\n var rects = (void 0);\n if (child.nodeType == 1) { rects = child.getClientRects(); }\n else if (child.nodeType == 3) { rects = textRange(child).getClientRects(); }\n else { continue }\n\n for (var i = 0; i < rects.length; i++) {\n var rect = rects[i];\n if (rect.top <= rowBot && rect.bottom >= rowTop) {\n rowBot = Math.max(rect.bottom, rowBot);\n rowTop = Math.min(rect.top, rowTop);\n var dx = rect.left > coords.left ? rect.left - coords.left\n : rect.right < coords.left ? coords.left - rect.right : 0;\n if (dx < dxClosest) {\n closest = child;\n dxClosest = dx;\n coordsClosest = dx && closest.nodeType == 3 ? {left: rect.right < coords.left ? rect.right : rect.left, top: coords.top} : coords;\n if (child.nodeType == 1 && dx)\n { offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0); }\n continue\n }\n }\n if (!closest && (coords.left >= rect.right && coords.top >= rect.top ||\n coords.left >= rect.left && coords.top >= rect.bottom))\n { offset = childIndex + 1; }\n }\n }\n if (closest && closest.nodeType == 3) { return findOffsetInText(closest, coordsClosest) }\n if (!closest || (dxClosest && closest.nodeType == 1)) { return {node: node, offset: offset} }\n return findOffsetInNode(closest, coordsClosest)\n}\n\nfunction findOffsetInText(node, coords) {\n var len = node.nodeValue.length;\n var range = document.createRange();\n for (var i = 0; i < len; i++) {\n range.setEnd(node, i + 1);\n range.setStart(node, i);\n var rect = singleRect(range, 1);\n if (rect.top == rect.bottom) { continue }\n if (inRect(coords, rect))\n { return {node: node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0)} }\n }\n return {node: node, offset: 0}\n}\n\nfunction inRect(coords, rect) {\n return coords.left >= rect.left - 1 && coords.left <= rect.right + 1&&\n coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1\n}\n\nfunction targetKludge(dom, coords) {\n var parent = dom.parentNode;\n if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left)\n { return parent }\n return dom\n}\n\nfunction posFromElement(view, elt, coords) {\n var ref = findOffsetInNode(elt, coords);\n var node = ref.node;\n var offset = ref.offset;\n var bias = -1;\n if (node.nodeType == 1 && !node.firstChild) {\n var rect = node.getBoundingClientRect();\n bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;\n }\n return view.docView.posFromDOM(node, offset, bias)\n}\n\nfunction posFromCaret(view, node, offset, coords) {\n // Browser (in caretPosition/RangeFromPoint) will agressively\n // normalize towards nearby inline nodes. Since we are interested in\n // positions between block nodes too, we first walk up the hierarchy\n // of nodes to see if there are block nodes that the coordinates\n // fall outside of. If so, we take the position before/after that\n // block. If not, we call `posFromDOM` on the raw node/offset.\n var outside = -1;\n for (var cur = node;;) {\n if (cur == view.dom) { break }\n var desc = view.docView.nearestDesc(cur, true);\n if (!desc) { return null }\n if (desc.node.isBlock && desc.parent) {\n var rect = desc.dom.getBoundingClientRect();\n if (rect.left > coords.left || rect.top > coords.top) { outside = desc.posBefore; }\n else if (rect.right < coords.left || rect.bottom < coords.top) { outside = desc.posAfter; }\n else { break }\n }\n cur = desc.dom.parentNode;\n }\n return outside > -1 ? outside : view.docView.posFromDOM(node, offset)\n}\n\nfunction elementFromPoint(element, coords, box) {\n var len = element.childNodes.length;\n if (len && box.top < box.bottom) {\n for (var startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {\n var child = element.childNodes[i];\n if (child.nodeType == 1) {\n var rects = child.getClientRects();\n for (var j = 0; j < rects.length; j++) {\n var rect = rects[j];\n if (inRect(coords, rect)) { return elementFromPoint(child, coords, rect) }\n }\n }\n if ((i = (i + 1) % len) == startI) { break }\n }\n }\n return element\n}\n\n// Given an x,y position on the editor, get the position in the document.\nfunction posAtCoords(view, coords) {\n var assign, assign$1;\n\n var root = view.root, node, offset;\n if (root.caretPositionFromPoint) {\n try { // Firefox throws for this call in hard-to-predict circumstances (#994)\n var pos$1 = root.caretPositionFromPoint(coords.left, coords.top);\n if (pos$1) { ((assign = pos$1, node = assign.offsetNode, offset = assign.offset)); }\n } catch (_) {}\n }\n if (!node && root.caretRangeFromPoint) {\n var range = root.caretRangeFromPoint(coords.left, coords.top);\n if (range) { ((assign$1 = range, node = assign$1.startContainer, offset = assign$1.startOffset)); }\n }\n\n var elt = root.elementFromPoint(coords.left, coords.top + 1), pos;\n if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {\n var box = view.dom.getBoundingClientRect();\n if (!inRect(coords, box)) { return null }\n elt = elementFromPoint(view.dom, coords, box);\n if (!elt) { return null }\n }\n elt = targetKludge(elt, coords);\n if (node) {\n if (result.gecko && node.nodeType == 1) {\n // Firefox will sometimes return offsets into <input> nodes, which\n // have no actual children, from caretPositionFromPoint (#953)\n offset = Math.min(offset, node.childNodes.length);\n // It'll also move the returned position before image nodes,\n // even if those are behind it.\n if (offset < node.childNodes.length) {\n var next = node.childNodes[offset], box$1;\n if (next.nodeName == \"IMG\" && (box$1 = next.getBoundingClientRect()).right <= coords.left &&\n box$1.bottom > coords.top)\n { offset++; }\n }\n }\n // Suspiciously specific kludge to work around caret*FromPoint\n // never returning a position at the end of the document\n if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 &&\n coords.top > node.lastChild.getBoundingClientRect().bottom)\n { pos = view.state.doc.content.size; }\n // Ignore positions directly after a BR, since caret*FromPoint\n // 'round up' positions that would be more accurately placed\n // before the BR node.\n else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != \"BR\")\n { pos = posFromCaret(view, node, offset, coords); }\n }\n if (pos == null) { pos = posFromElement(view, elt, coords); }\n\n var desc = view.docView.nearestDesc(elt, true);\n return {pos: pos, inside: desc ? desc.posAtStart - desc.border : -1}\n}\n\nfunction singleRect(object, bias) {\n var rects = object.getClientRects();\n return !rects.length ? object.getBoundingClientRect() : rects[bias < 0 ? 0 : rects.length - 1]\n}\n\n// : (EditorView, number) → {left: number, top: number, right: number, bottom: number}\n// Given a position in the document model, get a bounding box of the\n// character at that position, relative to the window.\nfunction coordsAtPos(view, pos) {\n var ref = view.docView.domFromPos(pos);\n var node = ref.node;\n var offset = ref.offset;\n\n // These browsers support querying empty text ranges\n if (node.nodeType == 3 && (result.webkit || result.gecko)) {\n var rect = singleRect(textRange(node, offset, offset), 0);\n // Firefox returns bad results (the position before the space)\n // when querying a position directly after line-broken\n // whitespace. Detect this situation and and kludge around it\n if (result.gecko && offset && /\\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {\n var rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);\n if (rectBefore.top == rect.top) {\n var rectAfter = singleRect(textRange(node, offset, offset + 1), -1);\n if (rectAfter.top != rect.top)\n { return flattenV(rectAfter, rectAfter.left < rectBefore.left) }\n }\n }\n return rect\n }\n\n if (node.nodeType == 1 && !view.state.doc.resolve(pos).parent.inlineContent) {\n // Return a horizontal line in block context\n var top = true, rect$1;\n if (offset < node.childNodes.length) {\n var after = node.childNodes[offset];\n if (after.nodeType == 1) { rect$1 = after.getBoundingClientRect(); }\n }\n if (!rect$1 && offset) {\n var before = node.childNodes[offset - 1];\n if (before.nodeType == 1) { rect$1 = before.getBoundingClientRect(); top = false; }\n }\n return flattenH(rect$1 || node.getBoundingClientRect(), top)\n }\n\n // Not Firefox/Chrome, or not in a text node, so we have to use\n // actual element/character rectangles to get a solution (this part\n // is not very bidi-safe)\n //\n // Try the left side first, fall back to the right one if that\n // doesn't work.\n for (var dir = -1; dir < 2; dir += 2) {\n if (dir < 0 && offset) {\n var prev = (void 0), target = node.nodeType == 3 ? textRange(node, offset - 1, offset)\n : (prev = node.childNodes[offset - 1]).nodeType == 3 ? textRange(prev)\n : prev.nodeType == 1 && prev.nodeName != \"BR\" ? prev : null; // BR nodes tend to only return the rectangle before them\n if (target) {\n var rect$2 = singleRect(target, 1);\n if (rect$2.top < rect$2.bottom) { return flattenV(rect$2, false) }\n }\n } else if (dir > 0 && offset < nodeSize(node)) {\n var next = (void 0), target$1 = node.nodeType == 3 ? textRange(node, offset, offset + 1)\n : (next = node.childNodes[offset]).nodeType == 3 ? textRange(next)\n : next.nodeType == 1 ? next : null;\n if (target$1) {\n var rect$3 = singleRect(target$1, -1);\n if (rect$3.top < rect$3.bottom) { return flattenV(rect$3, true) }\n }\n }\n }\n // All else failed, just try to get a rectangle for the target node\n return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, 0), false)\n}\n\nfunction flattenV(rect, left) {\n if (rect.width == 0) { return rect }\n var x = left ? rect.left : rect.right;\n return {top: rect.top, bottom: rect.bottom, left: x, right: x}\n}\n\nfunction flattenH(rect, top) {\n if (rect.height == 0) { return rect }\n var y = top ? rect.top : rect.bottom;\n return {top: y, bottom: y, left: rect.left, right: rect.right}\n}\n\nfunction withFlushedState(view, state, f) {\n var viewState = view.state, active = view.root.activeElement;\n if (viewState != state) { view.updateState(state); }\n if (active != view.dom) { view.focus(); }\n try {\n return f()\n } finally {\n if (viewState != state) { view.updateState(viewState); }\n if (active != view.dom) { active.focus(); }\n }\n}\n\n// : (EditorView, number, number)\n// Whether vertical position motion in a given direction\n// from a position would leave a text block.\nfunction endOfTextblockVertical(view, state, dir) {\n var sel = state.selection;\n var $pos = dir == \"up\" ? sel.$anchor.min(sel.$head) : sel.$anchor.max(sel.$head);\n return withFlushedState(view, state, function () {\n var ref = view.docView.domFromPos($pos.pos);\n var dom = ref.node;\n for (;;) {\n var nearest = view.docView.nearestDesc(dom, true);\n if (!nearest) { break }\n if (nearest.node.isBlock) { dom = nearest.dom; break }\n dom = nearest.dom.parentNode;\n }\n var coords = coordsAtPos(view, $pos.pos);\n for (var child = dom.firstChild; child; child = child.nextSibling) {\n var boxes = (void 0);\n if (child.nodeType == 1) { boxes = child.getClientRects(); }\n else if (child.nodeType == 3) { boxes = textRange(child, 0, child.nodeValue.length).getClientRects(); }\n else { continue }\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n if (box.bottom > box.top && (dir == \"up\" ? box.bottom < coords.top + 1 : box.top > coords.bottom - 1))\n { return false }\n }\n }\n return true\n })\n}\n\nvar maybeRTL = /[\\u0590-\\u08ac]/;\n\nfunction endOfTextblockHorizontal(view, state, dir) {\n var ref = state.selection;\n var $head = ref.$head;\n if (!$head.parent.isTextblock) { return false }\n var offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size;\n var sel = getSelection();\n // If the textblock is all LTR, or the browser doesn't support\n // Selection.modify (Edge), fall back to a primitive approach\n if (!maybeRTL.test($head.parent.textContent) || !sel.modify)\n { return dir == \"left\" || dir == \"backward\" ? atStart : atEnd }\n\n return withFlushedState(view, state, function () {\n // This is a huge hack, but appears to be the best we can\n // currently do: use `Selection.modify` to move the selection by\n // one character, and see if that moves the cursor out of the\n // textblock (or doesn't move it at all, when at the start/end of\n // the document).\n var oldRange = sel.getRangeAt(0), oldNode = sel.focusNode, oldOff = sel.focusOffset;\n var oldBidiLevel = sel.caretBidiLevel; // Only for Firefox\n sel.modify(\"move\", dir, \"character\");\n var parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;\n var result = !parentDOM.contains(sel.focusNode.nodeType == 1 ? sel.focusNode : sel.focusNode.parentNode) ||\n (oldNode == sel.focusNode && oldOff == sel.focusOffset);\n // Restore the previous selection\n sel.removeAllRanges();\n sel.addRange(oldRange);\n if (oldBidiLevel != null) { sel.caretBidiLevel = oldBidiLevel; }\n return result\n })\n}\n\nvar cachedState = null, cachedDir = null, cachedResult = false;\nfunction endOfTextblock(view, state, dir) {\n if (cachedState == state && cachedDir == dir) { return cachedResult }\n cachedState = state; cachedDir = dir;\n return cachedResult = dir == \"up\" || dir == \"down\"\n ? endOfTextblockVertical(view, state, dir)\n : endOfTextblockHorizontal(view, state, dir)\n}\n\n// NodeView:: interface\n//\n// By default, document nodes are rendered using the result of the\n// [`toDOM`](#model.NodeSpec.toDOM) method of their spec, and managed\n// entirely by the editor. For some use cases, such as embedded\n// node-specific editing interfaces, you want more control over\n// the behavior of a node's in-editor representation, and need to\n// [define](#view.EditorProps.nodeViews) a custom node view.\n//\n// Objects returned as node views must conform to this interface.\n//\n// dom:: ?dom.Node\n// The outer DOM node that represents the document node. When not\n// given, the default strategy is used to create a DOM node.\n//\n// contentDOM:: ?dom.Node\n// The DOM node that should hold the node's content. Only meaningful\n// if the node view also defines a `dom` property and if its node\n// type is not a leaf node type. When this is present, ProseMirror\n// will take care of rendering the node's children into it. When it\n// is not present, the node view itself is responsible for rendering\n// (or deciding not to render) its child nodes.\n//\n// update:: ?(node: Node, decorations: [Decoration]) → bool\n// When given, this will be called when the view is updating itself.\n// It will be given a node (possibly of a different type), and an\n// array of active decorations (which are automatically drawn, and\n// the node view may ignore if it isn't interested in them), and\n// should return true if it was able to update to that node, and\n// false otherwise. If the node view has a `contentDOM` property (or\n// no `dom` property), updating its child nodes will be handled by\n// ProseMirror.\n//\n// selectNode:: ?()\n// Can be used to override the way the node's selected status (as a\n// node selection) is displayed.\n//\n// deselectNode:: ?()\n// When defining a `selectNode` method, you should also provide a\n// `deselectNode` method to remove the effect again.\n//\n// setSelection:: ?(anchor: number, head: number, root: dom.Document)\n// This will be called to handle setting the selection inside the\n// node. The `anchor` and `head` positions are relative to the start\n// of the node. By default, a DOM selection will be created between\n// the DOM positions corresponding to those positions, but if you\n// override it you can do something else.\n//\n// stopEvent:: ?(event: dom.Event) → bool\n// Can be used to prevent the editor view from trying to handle some\n// or all DOM events that bubble up from the node view. Events for\n// which this returns true are not handled by the editor.\n//\n// ignoreMutation:: ?(dom.MutationRecord) → bool\n// Called when a DOM\n// [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)\n// or a selection change happens within the view. When the change is\n// a selection change, the record will have a `type` property of\n// `\"selection\"` (which doesn't occur for native mutation records).\n// Return false if the editor should re-read the selection or\n// re-parse the range around the mutation, true if it can safely be\n// ignored.\n//\n// destroy:: ?()\n// Called when the node view is removed from the editor or the whole\n// editor is destroyed.\n\n// View descriptions are data structures that describe the DOM that is\n// used to represent the editor's content. They are used for:\n//\n// - Incremental redrawing when the document changes\n//\n// - Figuring out what part of the document a given DOM position\n// corresponds to\n//\n// - Wiring in custom implementations of the editing interface for a\n// given node\n//\n// They form a doubly-linked mutable tree, starting at `view.docView`.\n\nvar NOT_DIRTY = 0, CHILD_DIRTY = 1, CONTENT_DIRTY = 2, NODE_DIRTY = 3;\n\n// Superclass for the various kinds of descriptions. Defines their\n// basic structure and shared methods.\nvar ViewDesc = function ViewDesc(parent, children, dom, contentDOM) {\n this.parent = parent;\n this.children = children;\n this.dom = dom;\n // An expando property on the DOM node provides a link back to its\n // description.\n dom.pmViewDesc = this;\n // This is the node that holds the child views. It may be null for\n // descs that don't have children.\n this.contentDOM = contentDOM;\n this.dirty = NOT_DIRTY;\n};\n\nvar prototypeAccessors = { beforePosition: { configurable: true },size: { configurable: true },border: { configurable: true },posBefore: { configurable: true },posAtStart: { configurable: true },posAfter: { configurable: true },posAtEnd: { configurable: true },contentLost: { configurable: true } };\n\n// Used to check whether a given description corresponds to a\n// widget/mark/node.\nViewDesc.prototype.matchesWidget = function matchesWidget () { return false };\nViewDesc.prototype.matchesMark = function matchesMark () { return false };\nViewDesc.prototype.matchesNode = function matchesNode () { return false };\nViewDesc.prototype.matchesHack = function matchesHack () { return false };\n\nprototypeAccessors.beforePosition.get = function () { return false };\n\n// : () → ?ParseRule\n// When parsing in-editor content (in domchange.js), we allow\n// descriptions to determine the parse rules that should be used to\n// parse them.\nViewDesc.prototype.parseRule = function parseRule () { return null };\n\n// : (dom.Event) → bool\n// Used by the editor's event handler to ignore events that come\n// from certain descs.\nViewDesc.prototype.stopEvent = function stopEvent () { return false };\n\n// The size of the content represented by this desc.\nprototypeAccessors.size.get = function () {\n var size = 0;\n for (var i = 0; i < this.children.length; i++) { size += this.children[i].size; }\n return size\n};\n\n// For block nodes, this represents the space taken up by their\n// start/end tokens.\nprototypeAccessors.border.get = function () { return 0 };\n\nViewDesc.prototype.destroy = function destroy () {\n this.parent = null;\n if (this.dom.pmViewDesc == this) { this.dom.pmViewDesc = null; }\n for (var i = 0; i < this.children.length; i++)\n { this.children[i].destroy(); }\n};\n\nViewDesc.prototype.posBeforeChild = function posBeforeChild (child) {\n for (var i = 0, pos = this.posAtStart; i < this.children.length; i++) {\n var cur = this.children[i];\n if (cur == child) { return pos }\n pos += cur.size;\n }\n};\n\nprototypeAccessors.posBefore.get = function () {\n return this.parent.posBeforeChild(this)\n};\n\nprototypeAccessors.posAtStart.get = function () {\n return this.parent ? this.parent.posBeforeChild(this) + this.border : 0\n};\n\nprototypeAccessors.posAfter.get = function () {\n return this.posBefore + this.size\n};\n\nprototypeAccessors.posAtEnd.get = function () {\n return this.posAtStart + this.size - 2 * this.border\n};\n\n// : (dom.Node, number, ?number) → number\nViewDesc.prototype.localPosFromDOM = function localPosFromDOM (dom, offset, bias) {\n // If the DOM position is in the content, use the child desc after\n // it to figure out a position.\n if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) {\n if (bias < 0) {\n var domBefore, desc;\n if (dom == this.contentDOM) {\n domBefore = dom.childNodes[offset - 1];\n } else {\n while (dom.parentNode != this.contentDOM) { dom = dom.parentNode; }\n domBefore = dom.previousSibling;\n }\n while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) { domBefore = domBefore.previousSibling; }\n return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart\n } else {\n var domAfter, desc$1;\n if (dom == this.contentDOM) {\n domAfter = dom.childNodes[offset];\n } else {\n while (dom.parentNode != this.contentDOM) { dom = dom.parentNode; }\n domAfter = dom.nextSibling;\n }\n while (domAfter && !((desc$1 = domAfter.pmViewDesc) && desc$1.parent == this)) { domAfter = domAfter.nextSibling; }\n return domAfter ? this.posBeforeChild(desc$1) : this.posAtEnd\n }\n }\n // Otherwise, use various heuristics, falling back on the bias\n // parameter, to determine whether to return the position at the\n // start or at the end of this view desc.\n var atEnd;\n if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {\n atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;\n } else if (this.dom.firstChild) {\n if (offset == 0) { for (var search = dom;; search = search.parentNode) {\n if (search == this.dom) { atEnd = false; break }\n if (search.parentNode.firstChild != search) { break }\n } }\n if (atEnd == null && offset == dom.childNodes.length) { for (var search$1 = dom;; search$1 = search$1.parentNode) {\n if (search$1 == this.dom) { atEnd = true; break }\n if (search$1.parentNode.lastChild != search$1) { break }\n } }\n }\n return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart\n};\n\n// Scan up the dom finding the first desc that is a descendant of\n// this one.\nViewDesc.prototype.nearestDesc = function nearestDesc (dom, onlyNodes) {\n for (var first = true, cur = dom; cur; cur = cur.parentNode) {\n var desc = this.getDesc(cur);\n if (desc && (!onlyNodes || desc.node)) {\n // If dom is outside of this desc's nodeDOM, don't count it.\n if (first && desc.nodeDOM &&\n !(desc.nodeDOM.nodeType == 1 ? desc.nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : desc.nodeDOM == dom))\n { first = false; }\n else\n { return desc }\n }\n }\n};\n\nViewDesc.prototype.getDesc = function getDesc (dom) {\n var desc = dom.pmViewDesc;\n for (var cur = desc; cur; cur = cur.parent) { if (cur == this) { return desc } }\n};\n\nViewDesc.prototype.posFromDOM = function posFromDOM (dom, offset, bias) {\n for (var scan = dom;; scan = scan.parentNode) {\n var desc = this.getDesc(scan);\n if (desc) { return desc.localPosFromDOM(dom, offset, bias) }\n }\n};\n\n// : (number) → ?NodeViewDesc\n// Find the desc for the node after the given pos, if any. (When a\n// parent node overrode rendering, there might not be one.)\nViewDesc.prototype.descAt = function descAt (pos) {\n for (var i = 0, offset = 0; i < this.children.length; i++) {\n var child = this.children[i], end = offset + child.size;\n if (offset == pos && end != offset) {\n while (!child.border && child.children.length) { child = child.children[0]; }\n return child\n }\n if (pos < end) { return child.descAt(pos - offset - child.border) }\n offset = end;\n }\n};\n\n// : (number) → {node: dom.Node, offset: number}\nViewDesc.prototype.domFromPos = function domFromPos (pos) {\n if (!this.contentDOM) { return {node: this.dom, offset: 0} }\n for (var offset = 0, i = 0;; i++) {\n if (offset == pos) {\n while (i < this.children.length && (this.children[i].beforePosition || this.children[i].dom.parentNode != this.contentDOM)) { i++; }\n return {node: this.contentDOM,\n offset: i == this.children.length ? this.contentDOM.childNodes.length : domIndex(this.children[i].dom)}\n }\n if (i == this.children.length) { throw new Error(\"Invalid position \" + pos) }\n var child = this.children[i], end = offset + child.size;\n if (pos < end) { return child.domFromPos(pos - offset - child.border) }\n offset = end;\n }\n};\n\n// Used to find a DOM range in a single parent for a given changed\n// range.\nViewDesc.prototype.parseRange = function parseRange (from, to, base) {\n if ( base === void 0 ) base = 0;\n\n if (this.children.length == 0)\n { return {node: this.contentDOM, from: from, to: to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length} }\n\n var fromOffset = -1, toOffset = -1;\n for (var offset = base, i = 0;; i++) {\n var child = this.children[i], end = offset + child.size;\n if (fromOffset == -1 && from <= end) {\n var childBase = offset + child.border;\n // FIXME maybe descend mark views to parse a narrower range?\n if (from >= childBase && to <= end - child.border && child.node &&\n child.contentDOM && this.contentDOM.contains(child.contentDOM))\n { return child.parseRange(from, to, childBase) }\n\n from = offset;\n for (var j = i; j > 0; j--) {\n var prev = this.children[j - 1];\n if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {\n fromOffset = domIndex(prev.dom) + 1;\n break\n }\n from -= prev.size;\n }\n if (fromOffset == -1) { fromOffset = 0; }\n }\n if (fromOffset > -1 && to <= end) {\n to = end;\n for (var j$1 = i + 1; j$1 < this.children.length; j$1++) {\n var next = this.children[j$1];\n if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {\n toOffset = domIndex(next.dom);\n break\n }\n to += next.size;\n }\n if (toOffset == -1) { toOffset = this.contentDOM.childNodes.length; }\n break\n }\n offset = end;\n }\n return {node: this.contentDOM, from: from, to: to, fromOffset: fromOffset, toOffset: toOffset}\n};\n\nViewDesc.prototype.emptyChildAt = function emptyChildAt (side) {\n if (this.border || !this.contentDOM || !this.children.length) { return false }\n var child = this.children[side < 0 ? 0 : this.children.length - 1];\n return child.size == 0 || child.emptyChildAt(side)\n};\n\n// : (number) → dom.Node\nViewDesc.prototype.domAfterPos = function domAfterPos (pos) {\n var ref = this.domFromPos(pos);\n var node = ref.node;\n var offset = ref.offset;\n if (node.nodeType != 1 || offset == node.childNodes.length)\n { throw new RangeError(\"No node after pos \" + pos) }\n return node.childNodes[offset]\n};\n\n// : (number, number, dom.Document)\n// View descs are responsible for setting any selection that falls\n// entirely inside of them, so that custom implementations can do\n// custom things with the selection. Note that this falls apart when\n// a selection starts in such a node and ends in another, in which\n// case we just use whatever domFromPos produces as a best effort.\nViewDesc.prototype.setSelection = function setSelection (anchor, head, root, force) {\n // If the selection falls entirely in a child, give it to that child\n var from = Math.min(anchor, head), to = Math.max(anchor, head);\n for (var i = 0, offset = 0; i < this.children.length; i++) {\n var child = this.children[i], end = offset + child.size;\n if (from > offset && to < end)\n { return child.setSelection(anchor - offset - child.border, head - offset - child.border, root, force) }\n offset = end;\n }\n\n var anchorDOM = this.domFromPos(anchor), headDOM = this.domFromPos(head);\n var domSel = root.getSelection();\n\n if (!force &&\n isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset) &&\n isEquivalentPosition(headDOM.node, headDOM.offset, domSel.focusNode, domSel.focusOffset))\n { return }\n\n // Selection.extend can be used to create an 'inverted' selection\n // (one where the focus is before the anchor), but not all\n // browsers support it yet.\n if (domSel.extend || anchor == head) {\n domSel.collapse(anchorDOM.node, anchorDOM.offset);\n if (anchor != head) { domSel.extend(headDOM.node, headDOM.offset); }\n } else {\n if (anchor > head) { var tmp = anchorDOM; anchorDOM = headDOM; headDOM = tmp; }\n var range = document.createRange();\n range.setEnd(headDOM.node, headDOM.offset);\n range.setStart(anchorDOM.node, anchorDOM.offset);\n domSel.removeAllRanges();\n domSel.addRange(range);\n }\n};\n\n// : (dom.MutationRecord) → bool\nViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n return !this.contentDOM && mutation.type != \"selection\"\n};\n\nprototypeAccessors.contentLost.get = function () {\n return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM)\n};\n\n// Remove a subtree of the element tree that has been touched\n// by a DOM change, so that the next update will redraw it.\nViewDesc.prototype.markDirty = function markDirty (from, to) {\n for (var offset = 0, i = 0; i < this.children.length; i++) {\n var child = this.children[i], end = offset + child.size;\n if (offset == end ? from <= end && to >= offset : from < end && to > offset) {\n var startInside = offset + child.border, endInside = end - child.border;\n if (from >= startInside && to <= endInside) {\n this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;\n if (from == startInside && to == endInside &&\n (child.contentLost || child.dom.parentNode != this.contentDOM)) { child.dirty = NODE_DIRTY; }\n else { child.markDirty(from - startInside, to - startInside); }\n return\n } else {\n child.dirty = NODE_DIRTY;\n }\n }\n offset = end;\n }\n this.dirty = CONTENT_DIRTY;\n};\n\nViewDesc.prototype.markParentsDirty = function markParentsDirty () {\n var level = 1;\n for (var node = this.parent; node; node = node.parent, level++) {\n var dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;\n if (node.dirty < dirty) { node.dirty = dirty; }\n }\n};\n\nObject.defineProperties( ViewDesc.prototype, prototypeAccessors );\n\n// Reused array to avoid allocating fresh arrays for things that will\n// stay empty anyway.\nvar nothing = [];\n\n// A widget desc represents a widget decoration, which is a DOM node\n// drawn between the document nodes.\nvar WidgetViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function WidgetViewDesc(parent, widget, view, pos) {\n var self, dom = widget.type.toDOM;\n if (typeof dom == \"function\") { dom = dom(view, function () {\n if (!self) { return pos }\n if (self.parent) { return self.parent.posBeforeChild(self) }\n }); }\n if (!widget.type.spec.raw) {\n if (dom.nodeType != 1) {\n var wrap = document.createElement(\"span\");\n wrap.appendChild(dom);\n dom = wrap;\n }\n dom.contentEditable = false;\n dom.classList.add(\"ProseMirror-widget\");\n }\n ViewDesc.call(this, parent, nothing, dom, null);\n this.widget = widget;\n self = this;\n }\n\n if ( ViewDesc ) WidgetViewDesc.__proto__ = ViewDesc;\n WidgetViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n WidgetViewDesc.prototype.constructor = WidgetViewDesc;\n\n var prototypeAccessors$1 = { beforePosition: { configurable: true } };\n\n prototypeAccessors$1.beforePosition.get = function () {\n return this.widget.type.side < 0\n };\n\n WidgetViewDesc.prototype.matchesWidget = function matchesWidget (widget) {\n return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type)\n };\n\n WidgetViewDesc.prototype.parseRule = function parseRule () { return {ignore: true} };\n\n WidgetViewDesc.prototype.stopEvent = function stopEvent (event) {\n var stop = this.widget.spec.stopEvent;\n return stop ? stop(event) : false\n };\n\n WidgetViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n return mutation.type != \"selection\" || this.widget.spec.ignoreSelection\n };\n\n Object.defineProperties( WidgetViewDesc.prototype, prototypeAccessors$1 );\n\n return WidgetViewDesc;\n}(ViewDesc));\n\nvar CompositionViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function CompositionViewDesc(parent, dom, textDOM, text) {\n ViewDesc.call(this, parent, nothing, dom, null);\n this.textDOM = textDOM;\n this.text = text;\n }\n\n if ( ViewDesc ) CompositionViewDesc.__proto__ = ViewDesc;\n CompositionViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n CompositionViewDesc.prototype.constructor = CompositionViewDesc;\n\n var prototypeAccessors$2 = { size: { configurable: true } };\n\n prototypeAccessors$2.size.get = function () { return this.text.length };\n\n CompositionViewDesc.prototype.localPosFromDOM = function localPosFromDOM (dom, offset) {\n if (dom != this.textDOM) { return this.posAtStart + (offset ? this.size : 0) }\n return this.posAtStart + offset\n };\n\n CompositionViewDesc.prototype.domFromPos = function domFromPos (pos) {\n return {node: this.textDOM, offset: pos}\n };\n\n CompositionViewDesc.prototype.ignoreMutation = function ignoreMutation (mut) {\n return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue\n };\n\n Object.defineProperties( CompositionViewDesc.prototype, prototypeAccessors$2 );\n\n return CompositionViewDesc;\n}(ViewDesc));\n\n// A mark desc represents a mark. May have multiple children,\n// depending on how the mark is split. Note that marks are drawn using\n// a fixed nesting order, for simplicity and predictability, so in\n// some cases they will be split more often than would appear\n// necessary.\nvar MarkViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function MarkViewDesc(parent, mark, dom, contentDOM) {\n ViewDesc.call(this, parent, [], dom, contentDOM);\n this.mark = mark;\n }\n\n if ( ViewDesc ) MarkViewDesc.__proto__ = ViewDesc;\n MarkViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n MarkViewDesc.prototype.constructor = MarkViewDesc;\n\n MarkViewDesc.create = function create (parent, mark, inline, view) {\n var custom = view.nodeViews[mark.type.name];\n var spec = custom && custom(mark, view, inline);\n if (!spec || !spec.dom)\n { spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline)); }\n return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom)\n };\n\n MarkViewDesc.prototype.parseRule = function parseRule () { return {mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM} };\n\n MarkViewDesc.prototype.matchesMark = function matchesMark (mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark) };\n\n MarkViewDesc.prototype.markDirty = function markDirty (from, to) {\n ViewDesc.prototype.markDirty.call(this, from, to);\n // Move dirty info to nearest node view\n if (this.dirty != NOT_DIRTY) {\n var parent = this.parent;\n while (!parent.node) { parent = parent.parent; }\n if (parent.dirty < this.dirty) { parent.dirty = this.dirty; }\n this.dirty = NOT_DIRTY;\n }\n };\n\n MarkViewDesc.prototype.slice = function slice (from, to, view) {\n var copy = MarkViewDesc.create(this.parent, this.mark, true, view);\n var nodes = this.children, size = this.size;\n if (to < size) { nodes = replaceNodes(nodes, to, size, view); }\n if (from > 0) { nodes = replaceNodes(nodes, 0, from, view); }\n for (var i = 0; i < nodes.length; i++) { nodes[i].parent = copy; }\n copy.children = nodes;\n return copy\n };\n\n return MarkViewDesc;\n}(ViewDesc));\n\n// Node view descs are the main, most common type of view desc, and\n// correspond to an actual node in the document. Unlike mark descs,\n// they populate their child array themselves.\nvar NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {\n ViewDesc.call(this, parent, node.isLeaf ? nothing : [], dom, contentDOM);\n this.nodeDOM = nodeDOM;\n this.node = node;\n this.outerDeco = outerDeco;\n this.innerDeco = innerDeco;\n if (contentDOM) { this.updateChildren(view, pos); }\n }\n\n if ( ViewDesc ) NodeViewDesc.__proto__ = ViewDesc;\n NodeViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n NodeViewDesc.prototype.constructor = NodeViewDesc;\n\n var prototypeAccessors$3 = { size: { configurable: true },border: { configurable: true } };\n\n // By default, a node is rendered using the `toDOM` method from the\n // node type spec. But client code can use the `nodeViews` spec to\n // supply a custom node view, which can influence various aspects of\n // the way the node works.\n //\n // (Using subclassing for this was intentionally decided against,\n // since it'd require exposing a whole slew of finnicky\n // implementation details to the user code that they probably will\n // never need.)\n NodeViewDesc.create = function create (parent, node, outerDeco, innerDeco, view, pos) {\n var assign;\n\n var custom = view.nodeViews[node.type.name], descObj;\n var spec = custom && custom(node, view, function () {\n // (This is a function that allows the custom view to find its\n // own position)\n if (!descObj) { return pos }\n if (descObj.parent) { return descObj.parent.posBeforeChild(descObj) }\n }, outerDeco);\n\n var dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;\n if (node.isText) {\n if (!dom) { dom = document.createTextNode(node.text); }\n else if (dom.nodeType != 3) { throw new RangeError(\"Text must be rendered as a DOM text node\") }\n } else if (!dom) {\n((assign = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node)), dom = assign.dom, contentDOM = assign.contentDOM));\n }\n if (!contentDOM && !node.isText && dom.nodeName != \"BR\") { // Chrome gets confused by <br contenteditable=false>\n if (!dom.hasAttribute(\"contenteditable\")) { dom.contentEditable = false; }\n if (node.type.spec.draggable) { dom.draggable = true; }\n }\n\n var nodeDOM = dom;\n dom = applyOuterDeco(dom, outerDeco, node);\n\n if (spec)\n { return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM,\n spec, view, pos + 1) }\n else if (node.isText)\n { return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) }\n else\n { return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos + 1) }\n };\n\n NodeViewDesc.prototype.parseRule = function parseRule () {\n var this$1 = this;\n\n // Experimental kludge to allow opt-in re-parsing of nodes\n if (this.node.type.spec.reparseInView) { return null }\n // FIXME the assumption that this can always return the current\n // attrs means that if the user somehow manages to change the\n // attrs in the dom, that won't be picked up. Not entirely sure\n // whether this is a problem\n var rule = {node: this.node.type.name, attrs: this.node.attrs};\n if (this.node.type.spec.code) { rule.preserveWhitespace = \"full\"; }\n if (this.contentDOM && !this.contentLost) { rule.contentElement = this.contentDOM; }\n else { rule.getContent = function () { return this$1.contentDOM ? Fragment.empty : this$1.node.content; }; }\n return rule\n };\n\n NodeViewDesc.prototype.matchesNode = function matchesNode (node, outerDeco, innerDeco) {\n return this.dirty == NOT_DIRTY && node.eq(this.node) &&\n sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco)\n };\n\n prototypeAccessors$3.size.get = function () { return this.node.nodeSize };\n\n prototypeAccessors$3.border.get = function () { return this.node.isLeaf ? 0 : 1 };\n\n // Syncs `this.children` to match `this.node.content` and the local\n // decorations, possibly introducing nesting for marks. Then, in a\n // separate step, syncs the DOM inside `this.contentDOM` to\n // `this.children`.\n NodeViewDesc.prototype.updateChildren = function updateChildren (view, pos) {\n var this$1 = this;\n\n var inline = this.node.inlineContent, off = pos;\n var composition = inline && view.composing && this.localCompositionNode(view, pos);\n var updater = new ViewTreeUpdater(this, composition && composition.node);\n iterDeco(this.node, this.innerDeco, function (widget, i, insideNode) {\n if (widget.spec.marks)\n { updater.syncToMarks(widget.spec.marks, inline, view); }\n else if (widget.type.side >= 0 && !insideNode)\n { updater.syncToMarks(i == this$1.node.childCount ? Mark.none : this$1.node.child(i).marks, inline, view); }\n // If the next node is a desc matching this widget, reuse it,\n // otherwise insert the widget as a new view desc.\n updater.placeWidget(widget, view, off);\n }, function (child, outerDeco, innerDeco, i) {\n // Make sure the wrapping mark descs match the node's marks.\n updater.syncToMarks(child.marks, inline, view);\n // Either find an existing desc that exactly matches this node,\n // and drop the descs before it.\n updater.findNodeMatch(child, outerDeco, innerDeco, i) ||\n // Or try updating the next desc to reflect this node.\n updater.updateNextNode(child, outerDeco, innerDeco, view, i) ||\n // Or just add it as a new desc.\n updater.addNode(child, outerDeco, innerDeco, view, off);\n off += child.nodeSize;\n });\n // Drop all remaining descs after the current position.\n updater.syncToMarks(nothing, inline, view);\n if (this.node.isTextblock) { updater.addTextblockHacks(); }\n updater.destroyRest();\n\n // Sync the DOM if anything changed\n if (updater.changed || this.dirty == CONTENT_DIRTY) {\n // May have to protect focused DOM from being changed if a composition is active\n if (composition) { this.protectLocalComposition(view, composition); }\n this.renderChildren();\n }\n };\n\n NodeViewDesc.prototype.renderChildren = function renderChildren () {\n renderDescs(this.contentDOM, this.children);\n if (result.ios) { iosHacks(this.dom); }\n };\n\n NodeViewDesc.prototype.localCompositionNode = function localCompositionNode (view, pos) {\n // Only do something if both the selection and a focused text node\n // are inside of this node, and the node isn't already part of a\n // view that's a child of this view\n var ref = view.state.selection;\n var from = ref.from;\n var to = ref.to;\n if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size) { return }\n var sel = view.root.getSelection();\n var textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);\n if (!textNode || !this.dom.contains(textNode.parentNode)) { return }\n\n // Find the text in the focused node in the node, stop if it's not\n // there (may have been modified through other means, in which\n // case it should overwritten)\n var text = textNode.nodeValue;\n var textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);\n\n return textPos < 0 ? null : {node: textNode, pos: textPos, text: text}\n };\n\n NodeViewDesc.prototype.protectLocalComposition = function protectLocalComposition (view, ref) {\n var node = ref.node;\n var pos = ref.pos;\n var text = ref.text;\n\n // The node is already part of a local view desc, leave it there\n if (this.getDesc(node)) { return }\n\n // Create a composition view for the orphaned nodes\n var topNode = node;\n for (;; topNode = topNode.parentNode) {\n if (topNode.parentNode == this.contentDOM) { break }\n while (topNode.previousSibling) { topNode.parentNode.removeChild(topNode.previousSibling); }\n while (topNode.nextSibling) { topNode.parentNode.removeChild(topNode.nextSibling); }\n if (topNode.pmViewDesc) { topNode.pmViewDesc = null; }\n }\n var desc = new CompositionViewDesc(this, topNode, node, text);\n view.compositionNodes.push(desc);\n\n // Patch up this.children to contain the composition view\n this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);\n };\n\n // : (Node, [Decoration], DecorationSet, EditorView) → bool\n // If this desc be updated to match the given node decoration,\n // do so and return true.\n NodeViewDesc.prototype.update = function update (node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY ||\n !node.sameMarkup(this.node)) { return false }\n this.updateInner(node, outerDeco, innerDeco, view);\n return true\n };\n\n NodeViewDesc.prototype.updateInner = function updateInner (node, outerDeco, innerDeco, view) {\n this.updateOuterDeco(outerDeco);\n this.node = node;\n this.innerDeco = innerDeco;\n if (this.contentDOM) { this.updateChildren(view, this.posAtStart); }\n this.dirty = NOT_DIRTY;\n };\n\n NodeViewDesc.prototype.updateOuterDeco = function updateOuterDeco (outerDeco) {\n if (sameOuterDeco(outerDeco, this.outerDeco)) { return }\n var needsWrap = this.nodeDOM.nodeType != 1;\n var oldDOM = this.dom;\n this.dom = patchOuterDeco(this.dom, this.nodeDOM,\n computeOuterDeco(this.outerDeco, this.node, needsWrap),\n computeOuterDeco(outerDeco, this.node, needsWrap));\n if (this.dom != oldDOM) {\n oldDOM.pmViewDesc = null;\n this.dom.pmViewDesc = this;\n }\n this.outerDeco = outerDeco;\n };\n\n // Mark this node as being the selected node.\n NodeViewDesc.prototype.selectNode = function selectNode () {\n this.nodeDOM.classList.add(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable) { this.dom.draggable = true; }\n };\n\n // Remove selected node marking from this node.\n NodeViewDesc.prototype.deselectNode = function deselectNode () {\n this.nodeDOM.classList.remove(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable) { this.dom.removeAttribute(\"draggable\"); }\n };\n\n Object.defineProperties( NodeViewDesc.prototype, prototypeAccessors$3 );\n\n return NodeViewDesc;\n}(ViewDesc));\n\n// Create a view desc for the top-level document node, to be exported\n// and used by the view class.\nfunction docViewDesc(doc, outerDeco, innerDeco, dom, view) {\n applyOuterDeco(dom, outerDeco, doc);\n return new NodeViewDesc(null, doc, outerDeco, innerDeco, dom, dom, dom, view, 0)\n}\n\nvar TextViewDesc = /*@__PURE__*/(function (NodeViewDesc) {\n function TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {\n NodeViewDesc.call(this, parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view);\n }\n\n if ( NodeViewDesc ) TextViewDesc.__proto__ = NodeViewDesc;\n TextViewDesc.prototype = Object.create( NodeViewDesc && NodeViewDesc.prototype );\n TextViewDesc.prototype.constructor = TextViewDesc;\n\n TextViewDesc.prototype.parseRule = function parseRule () {\n return {skip: this.nodeDOM.parentNode || true}\n };\n\n TextViewDesc.prototype.update = function update (node, outerDeco) {\n if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) ||\n !node.sameMarkup(this.node)) { return false }\n this.updateOuterDeco(outerDeco);\n if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue)\n { this.nodeDOM.nodeValue = node.text; }\n this.node = node;\n this.dirty = NOT_DIRTY;\n return true\n };\n\n TextViewDesc.prototype.inParent = function inParent () {\n var parentDOM = this.parent.contentDOM;\n for (var n = this.nodeDOM; n; n = n.parentNode) { if (n == parentDOM) { return true } }\n return false\n };\n\n TextViewDesc.prototype.domFromPos = function domFromPos (pos) {\n return {node: this.nodeDOM, offset: pos}\n };\n\n TextViewDesc.prototype.localPosFromDOM = function localPosFromDOM (dom, offset, bias) {\n if (dom == this.nodeDOM) { return this.posAtStart + Math.min(offset, this.node.text.length) }\n return NodeViewDesc.prototype.localPosFromDOM.call(this, dom, offset, bias)\n };\n\n TextViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n return mutation.type != \"characterData\" && mutation.type != \"selection\"\n };\n\n TextViewDesc.prototype.slice = function slice (from, to, view) {\n var node = this.node.cut(from, to), dom = document.createTextNode(node.text);\n return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view)\n };\n\n return TextViewDesc;\n}(NodeViewDesc));\n\n// A dummy desc used to tag trailing BR or span nodes created to work\n// around contentEditable terribleness.\nvar BRHackViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function BRHackViewDesc () {\n ViewDesc.apply(this, arguments);\n }\n\n if ( ViewDesc ) BRHackViewDesc.__proto__ = ViewDesc;\n BRHackViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n BRHackViewDesc.prototype.constructor = BRHackViewDesc;\n\n BRHackViewDesc.prototype.parseRule = function parseRule () { return {ignore: true} };\n BRHackViewDesc.prototype.matchesHack = function matchesHack () { return this.dirty == NOT_DIRTY };\n\n return BRHackViewDesc;\n}(ViewDesc));\n\n// A separate subclass is used for customized node views, so that the\n// extra checks only have to be made for nodes that are actually\n// customized.\nvar CustomNodeViewDesc = /*@__PURE__*/(function (NodeViewDesc) {\n function CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {\n NodeViewDesc.call(this, parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);\n this.spec = spec;\n }\n\n if ( NodeViewDesc ) CustomNodeViewDesc.__proto__ = NodeViewDesc;\n CustomNodeViewDesc.prototype = Object.create( NodeViewDesc && NodeViewDesc.prototype );\n CustomNodeViewDesc.prototype.constructor = CustomNodeViewDesc;\n\n // A custom `update` method gets to decide whether the update goes\n // through. If it does, and there's a `contentDOM` node, our logic\n // updates the children.\n CustomNodeViewDesc.prototype.update = function update (node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY) { return false }\n if (this.spec.update) {\n var result = this.spec.update(node, outerDeco);\n if (result) { this.updateInner(node, outerDeco, innerDeco, view); }\n return result\n } else if (!this.contentDOM && !node.isLeaf) {\n return false\n } else {\n return NodeViewDesc.prototype.update.call(this, node, outerDeco, innerDeco, view)\n }\n };\n\n CustomNodeViewDesc.prototype.selectNode = function selectNode () {\n this.spec.selectNode ? this.spec.selectNode() : NodeViewDesc.prototype.selectNode.call(this);\n };\n\n CustomNodeViewDesc.prototype.deselectNode = function deselectNode () {\n this.spec.deselectNode ? this.spec.deselectNode() : NodeViewDesc.prototype.deselectNode.call(this);\n };\n\n CustomNodeViewDesc.prototype.setSelection = function setSelection (anchor, head, root, force) {\n this.spec.setSelection ? this.spec.setSelection(anchor, head, root)\n : NodeViewDesc.prototype.setSelection.call(this, anchor, head, root, force);\n };\n\n CustomNodeViewDesc.prototype.destroy = function destroy () {\n if (this.spec.destroy) { this.spec.destroy(); }\n NodeViewDesc.prototype.destroy.call(this);\n };\n\n CustomNodeViewDesc.prototype.stopEvent = function stopEvent (event) {\n return this.spec.stopEvent ? this.spec.stopEvent(event) : false\n };\n\n CustomNodeViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : NodeViewDesc.prototype.ignoreMutation.call(this, mutation)\n };\n\n return CustomNodeViewDesc;\n}(NodeViewDesc));\n\n// : (dom.Node, [ViewDesc])\n// Sync the content of the given DOM node with the nodes associated\n// with the given array of view descs, recursing into mark descs\n// because this should sync the subtree for a whole node at a time.\nfunction renderDescs(parentDOM, descs) {\n var dom = parentDOM.firstChild;\n for (var i = 0; i < descs.length; i++) {\n var desc = descs[i], childDOM = desc.dom;\n if (childDOM.parentNode == parentDOM) {\n while (childDOM != dom) { dom = rm(dom); }\n dom = dom.nextSibling;\n } else {\n parentDOM.insertBefore(childDOM, dom);\n }\n if (desc instanceof MarkViewDesc) {\n var pos = dom ? dom.previousSibling : parentDOM.lastChild;\n renderDescs(desc.contentDOM, desc.children);\n dom = pos ? pos.nextSibling : parentDOM.firstChild;\n }\n }\n while (dom) { dom = rm(dom); }\n}\n\nfunction OuterDecoLevel(nodeName) {\n if (nodeName) { this.nodeName = nodeName; }\n}\nOuterDecoLevel.prototype = Object.create(null);\n\nvar noDeco = [new OuterDecoLevel];\n\nfunction computeOuterDeco(outerDeco, node, needsWrap) {\n if (outerDeco.length == 0) { return noDeco }\n\n var top = needsWrap ? noDeco[0] : new OuterDecoLevel, result = [top];\n\n for (var i = 0; i < outerDeco.length; i++) {\n var attrs = outerDeco[i].type.attrs, cur = top;\n if (!attrs) { continue }\n if (attrs.nodeName)\n { result.push(cur = new OuterDecoLevel(attrs.nodeName)); }\n\n for (var name in attrs) {\n var val = attrs[name];\n if (val == null) { continue }\n if (needsWrap && result.length == 1)\n { result.push(cur = top = new OuterDecoLevel(node.isInline ? \"span\" : \"div\")); }\n if (name == \"class\") { cur.class = (cur.class ? cur.class + \" \" : \"\") + val; }\n else if (name == \"style\") { cur.style = (cur.style ? cur.style + \";\" : \"\") + val; }\n else if (name != \"nodeName\") { cur[name] = val; }\n }\n }\n\n return result\n}\n\nfunction patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {\n // Shortcut for trivial case\n if (prevComputed == noDeco && curComputed == noDeco) { return nodeDOM }\n\n var curDOM = nodeDOM;\n for (var i = 0; i < curComputed.length; i++) {\n var deco = curComputed[i], prev = prevComputed[i];\n if (i) {\n var parent = (void 0);\n if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM &&\n (parent = curDOM.parentNode) && parent.tagName.toLowerCase() == deco.nodeName) {\n curDOM = parent;\n } else {\n parent = document.createElement(deco.nodeName);\n parent.appendChild(curDOM);\n prev = noDeco[0];\n curDOM = parent;\n }\n }\n patchAttributes(curDOM, prev || noDeco[0], deco);\n }\n return curDOM\n}\n\nfunction patchAttributes(dom, prev, cur) {\n for (var name in prev)\n { if (name != \"class\" && name != \"style\" && name != \"nodeName\" && !(name in cur))\n { dom.removeAttribute(name); } }\n for (var name$1 in cur)\n { if (name$1 != \"class\" && name$1 != \"style\" && name$1 != \"nodeName\" && cur[name$1] != prev[name$1])\n { dom.setAttribute(name$1, cur[name$1]); } }\n if (prev.class != cur.class) {\n var prevList = prev.class ? prev.class.split(\" \") : nothing;\n var curList = cur.class ? cur.class.split(\" \") : nothing;\n for (var i = 0; i < prevList.length; i++) { if (curList.indexOf(prevList[i]) == -1)\n { dom.classList.remove(prevList[i]); } }\n for (var i$1 = 0; i$1 < curList.length; i$1++) { if (prevList.indexOf(curList[i$1]) == -1)\n { dom.classList.add(curList[i$1]); } }\n }\n if (prev.style != cur.style) {\n if (prev.style) {\n var prop = /\\s*([\\w\\-\\xa1-\\uffff]+)\\s*:(?:\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|\\(.*?\\)|[^;])*/g, m;\n while (m = prop.exec(prev.style))\n { dom.style.removeProperty(m[1]); }\n }\n if (cur.style)\n { dom.style.cssText += cur.style; }\n }\n}\n\nfunction applyOuterDeco(dom, deco, node) {\n return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1))\n}\n\n// : ([Decoration], [Decoration]) → bool\nfunction sameOuterDeco(a, b) {\n if (a.length != b.length) { return false }\n for (var i = 0; i < a.length; i++) { if (!a[i].type.eq(b[i].type)) { return false } }\n return true\n}\n\n// Remove a DOM node and return its next sibling.\nfunction rm(dom) {\n var next = dom.nextSibling;\n dom.parentNode.removeChild(dom);\n return next\n}\n\n// Helper class for incrementally updating a tree of mark descs and\n// the widget and node descs inside of them.\nvar ViewTreeUpdater = function ViewTreeUpdater(top, lockedNode) {\n this.top = top;\n this.lock = lockedNode;\n // Index into `this.top`'s child array, represents the current\n // update position.\n this.index = 0;\n // When entering a mark, the current top and index are pushed\n // onto this.\n this.stack = [];\n // Tracks whether anything was changed\n this.changed = false;\n\n var pre = preMatch(top.node.content, top.children);\n this.preMatched = pre.nodes;\n this.preMatchOffset = pre.offset;\n};\n\nViewTreeUpdater.prototype.getPreMatch = function getPreMatch (index) {\n return index >= this.preMatchOffset ? this.preMatched[index - this.preMatchOffset] : null\n};\n\n// Destroy and remove the children between the given indices in\n// `this.top`.\nViewTreeUpdater.prototype.destroyBetween = function destroyBetween (start, end) {\n if (start == end) { return }\n for (var i = start; i < end; i++) { this.top.children[i].destroy(); }\n this.top.children.splice(start, end - start);\n this.changed = true;\n};\n\n// Destroy all remaining children in `this.top`.\nViewTreeUpdater.prototype.destroyRest = function destroyRest () {\n this.destroyBetween(this.index, this.top.children.length);\n};\n\n// : ([Mark], EditorView)\n// Sync the current stack of mark descs with the given array of\n// marks, reusing existing mark descs when possible.\nViewTreeUpdater.prototype.syncToMarks = function syncToMarks (marks, inline, view) {\n var keep = 0, depth = this.stack.length >> 1;\n var maxKeep = Math.min(depth, marks.length);\n while (keep < maxKeep &&\n (keep == depth - 1 ? this.top : this.stack[(keep + 1) << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)\n { keep++; }\n\n while (keep < depth) {\n this.destroyRest();\n this.top.dirty = NOT_DIRTY;\n this.index = this.stack.pop();\n this.top = this.stack.pop();\n depth--;\n }\n while (depth < marks.length) {\n this.stack.push(this.top, this.index + 1);\n var found = -1;\n for (var i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {\n if (this.top.children[i].matchesMark(marks[depth])) { found = i; break }\n }\n if (found > -1) {\n if (found > this.index) {\n this.changed = true;\n this.destroyBetween(this.index, found);\n }\n this.top = this.top.children[this.index];\n } else {\n var markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);\n this.top.children.splice(this.index, 0, markDesc);\n this.top = markDesc;\n this.changed = true;\n }\n this.index = 0;\n depth++;\n }\n};\n\n// : (Node, [Decoration], DecorationSet) → bool\n// Try to find a node desc matching the given data. Skip over it and\n// return true when successful.\nViewTreeUpdater.prototype.findNodeMatch = function findNodeMatch (node, outerDeco, innerDeco, index) {\n var found = -1, preMatch = index < 0 ? undefined : this.getPreMatch(index), children = this.top.children;\n if (preMatch && preMatch.matchesNode(node, outerDeco, innerDeco)) {\n found = children.indexOf(preMatch);\n } else {\n for (var i = this.index, e = Math.min(children.length, i + 5); i < e; i++) {\n var child = children[i];\n if (child.matchesNode(node, outerDeco, innerDeco) && this.preMatched.indexOf(child) < 0) {\n found = i;\n break\n }\n }\n }\n if (found < 0) { return false }\n this.destroyBetween(this.index, found);\n this.index++;\n return true\n};\n\n// : (Node, [Decoration], DecorationSet, EditorView, Fragment, number) → bool\n// Try to update the next node, if any, to the given data. Checks\n// pre-matches to avoid overwriting nodes that could still be used.\nViewTreeUpdater.prototype.updateNextNode = function updateNextNode (node, outerDeco, innerDeco, view, index) {\n for (var i = this.index; i < this.top.children.length; i++) {\n var next = this.top.children[i];\n if (next instanceof NodeViewDesc) {\n var preMatch = this.preMatched.indexOf(next);\n if (preMatch > -1 && preMatch + this.preMatchOffset != index) { return false }\n var nextDOM = next.dom;\n\n // Can't update if nextDOM is or contains this.lock, except if\n // it's a text node whose content already matches the new text\n // and whose decorations match the new ones.\n var locked = this.lock && (nextDOM == this.lock || nextDOM.nodeType == 1 && nextDOM.contains(this.lock.parentNode)) &&\n !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text &&\n next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));\n if (!locked && next.update(node, outerDeco, innerDeco, view)) {\n this.destroyBetween(this.index, i);\n if (next.dom != nextDOM) { this.changed = true; }\n this.index++;\n return true\n }\n break\n }\n }\n return false\n};\n\n// : (Node, [Decoration], DecorationSet, EditorView)\n// Insert the node as a newly created node desc.\nViewTreeUpdater.prototype.addNode = function addNode (node, outerDeco, innerDeco, view, pos) {\n this.top.children.splice(this.index++, 0, NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos));\n this.changed = true;\n};\n\nViewTreeUpdater.prototype.placeWidget = function placeWidget (widget, view, pos) {\n if (this.index < this.top.children.length && this.top.children[this.index].matchesWidget(widget)) {\n this.index++;\n } else {\n var desc = new WidgetViewDesc(this.top, widget, view, pos);\n this.top.children.splice(this.index++, 0, desc);\n this.changed = true;\n }\n};\n\n// Make sure a textblock looks and behaves correctly in\n// contentEditable.\nViewTreeUpdater.prototype.addTextblockHacks = function addTextblockHacks () {\n var lastChild = this.top.children[this.index - 1];\n while (lastChild instanceof MarkViewDesc) { lastChild = lastChild.children[lastChild.children.length - 1]; }\n\n if (!lastChild || // Empty textblock\n !(lastChild instanceof TextViewDesc) ||\n /\\n$/.test(lastChild.node.text)) {\n if (this.index < this.top.children.length && this.top.children[this.index].matchesHack()) {\n this.index++;\n } else {\n var dom = document.createElement(\"br\");\n this.top.children.splice(this.index++, 0, new BRHackViewDesc(this.top, nothing, dom, null));\n this.changed = true;\n }\n }\n};\n\n// : (Fragment, [ViewDesc]) → [ViewDesc]\n// Iterate from the end of the fragment and array of descs to find\n// directly matching ones, in order to avoid overeagerly reusing\n// those for other nodes. Returns an array whose positions correspond\n// to node positions in the fragment, and whose elements are either\n// descs matched to the child at that index, or empty.\nfunction preMatch(frag, descs) {\n var result = [], end = frag.childCount;\n for (var i = descs.length - 1; end > 0 && i >= 0; i--) {\n var desc = descs[i], node = desc.node;\n if (!node) { continue }\n if (node != frag.child(end - 1)) { break }\n result.push(desc);\n --end;\n }\n return {nodes: result.reverse(), offset: end}\n}\n\nfunction compareSide(a, b) { return a.type.side - b.type.side }\n\n// : (ViewDesc, DecorationSet, (Decoration, number), (Node, [Decoration], DecorationSet, number))\n// This function abstracts iterating over the nodes and decorations in\n// a fragment. Calls `onNode` for each node, with its local and child\n// decorations. Splits text nodes when there is a decoration starting\n// or ending inside of them. Calls `onWidget` for each widget.\nfunction iterDeco(parent, deco, onWidget, onNode) {\n var locals = deco.locals(parent), offset = 0;\n // Simple, cheap variant for when there are no local decorations\n if (locals.length == 0) {\n for (var i = 0; i < parent.childCount; i++) {\n var child = parent.child(i);\n onNode(child, locals, deco.forChild(offset, child), i);\n offset += child.nodeSize;\n }\n return\n }\n\n var decoIndex = 0, active = [], restNode = null;\n for (var parentIndex = 0;;) {\n if (decoIndex < locals.length && locals[decoIndex].to == offset) {\n var widget = locals[decoIndex++], widgets = (void 0);\n while (decoIndex < locals.length && locals[decoIndex].to == offset)\n { (widgets || (widgets = [widget])).push(locals[decoIndex++]); }\n if (widgets) {\n widgets.sort(compareSide);\n for (var i$1 = 0; i$1 < widgets.length; i$1++) { onWidget(widgets[i$1], parentIndex, !!restNode); }\n } else {\n onWidget(widget, parentIndex, !!restNode);\n }\n }\n\n var child$1 = (void 0), index = (void 0);\n if (restNode) {\n index = -1;\n child$1 = restNode;\n restNode = null;\n } else if (parentIndex < parent.childCount) {\n index = parentIndex;\n child$1 = parent.child(parentIndex++);\n } else {\n break\n }\n\n for (var i$2 = 0; i$2 < active.length; i$2++) { if (active[i$2].to <= offset) { active.splice(i$2--, 1); } }\n while (decoIndex < locals.length && locals[decoIndex].from == offset) { active.push(locals[decoIndex++]); }\n\n var end = offset + child$1.nodeSize;\n if (child$1.isText) {\n var cutAt = end;\n if (decoIndex < locals.length && locals[decoIndex].from < cutAt) { cutAt = locals[decoIndex].from; }\n for (var i$3 = 0; i$3 < active.length; i$3++) { if (active[i$3].to < cutAt) { cutAt = active[i$3].to; } }\n if (cutAt < end) {\n restNode = child$1.cut(cutAt - offset);\n child$1 = child$1.cut(0, cutAt - offset);\n end = cutAt;\n index = -1;\n }\n }\n\n onNode(child$1, active.length ? active.slice() : nothing, deco.forChild(offset, child$1), index);\n offset = end;\n }\n}\n\n// List markers in Mobile Safari will mysteriously disappear\n// sometimes. This works around that.\nfunction iosHacks(dom) {\n if (dom.nodeName == \"UL\" || dom.nodeName == \"OL\") {\n var oldCSS = dom.style.cssText;\n dom.style.cssText = oldCSS + \"; list-style: square !important\";\n window.getComputedStyle(dom).listStyle;\n dom.style.cssText = oldCSS;\n }\n}\n\nfunction nearbyTextNode(node, offset) {\n for (;;) {\n if (node.nodeType == 3) { return node }\n if (node.nodeType == 1 && offset > 0) {\n if (node.childNodes.length > offset && node.childNodes[offset].nodeType == 3)\n { return node.childNodes[offset] }\n node = node.childNodes[offset - 1];\n offset = nodeSize(node);\n } else if (node.nodeType == 1 && offset < node.childNodes.length) {\n node = node.childNodes[offset];\n offset = 0;\n } else {\n return null\n }\n }\n}\n\n// Find a piece of text in an inline fragment, overlapping from-to\nfunction findTextInFragment(frag, text, from, to) {\n for (var i = 0, pos = 0; i < frag.childCount && pos <= to;) {\n var child = frag.child(i++), childStart = pos;\n pos += child.nodeSize;\n if (!child.isText) { continue }\n var str = child.text;\n while (i < frag.childCount) {\n var next = frag.child(i++);\n pos += next.nodeSize;\n if (!next.isText) { break }\n str += next.text;\n }\n if (pos >= from) {\n var found = str.lastIndexOf(text, to - childStart);\n if (found >= 0 && found + text.length + childStart >= from)\n { return childStart + found }\n }\n }\n return -1\n}\n\n// Replace range from-to in an array of view descs with replacement\n// (may be null to just delete). This goes very much against the grain\n// of the rest of this code, which tends to create nodes with the\n// right shape in one go, rather than messing with them after\n// creation, but is necessary in the composition hack.\nfunction replaceNodes(nodes, from, to, view, replacement) {\n var result = [];\n for (var i = 0, off = 0; i < nodes.length; i++) {\n var child = nodes[i], start = off, end = off += child.size;\n if (start >= to || end <= from) {\n result.push(child);\n } else {\n if (start < from) { result.push(child.slice(0, from - start, view)); }\n if (replacement) {\n result.push(replacement);\n replacement = null;\n }\n if (end > to) { result.push(child.slice(to - start, child.size, view)); }\n }\n }\n return result\n}\n\nfunction moveSelectionBlock(state, dir) {\n var ref = state.selection;\n var $anchor = ref.$anchor;\n var $head = ref.$head;\n var $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);\n var $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;\n return $start && Selection.findFrom($start, dir)\n}\n\nfunction apply(view, sel) {\n view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());\n return true\n}\n\nfunction selectHorizontally(view, dir, mods) {\n var sel = view.state.selection;\n if (sel instanceof TextSelection) {\n if (!sel.empty || mods.indexOf(\"s\") > -1) {\n return false\n } else if (view.endOfTextblock(dir > 0 ? \"right\" : \"left\")) {\n var next = moveSelectionBlock(view.state, dir);\n if (next && (next instanceof NodeSelection)) { return apply(view, next) }\n return false\n } else {\n var $head = sel.$head, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc;\n if (!node || node.isText) { return false }\n var nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;\n if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) { return false }\n if (NodeSelection.isSelectable(node)) {\n return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head))\n } else if (result.webkit) {\n // Chrome and Safari will introduce extra pointless cursor\n // positions around inline uneditable nodes, so we have to\n // take over and move the cursor past them (#937)\n return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)))\n } else {\n return false\n }\n }\n } else if (sel instanceof NodeSelection && sel.node.isInline) {\n return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from))\n } else {\n var next$1 = moveSelectionBlock(view.state, dir);\n if (next$1) { return apply(view, next$1) }\n return false\n }\n}\n\nfunction nodeLen(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length\n}\n\nfunction isIgnorable(dom) {\n var desc = dom.pmViewDesc;\n return desc && desc.size == 0 && (dom.nextSibling || dom.nodeName != \"BR\")\n}\n\n// Make sure the cursor isn't directly after one or more ignored\n// nodes, which will confuse the browser's cursor motion logic.\nfunction skipIgnoredNodesLeft(view) {\n var sel = view.root.getSelection();\n var node = sel.focusNode, offset = sel.focusOffset;\n if (!node) { return }\n var moveNode, moveOffset, force = false;\n // Gecko will do odd things when the selection is directly in front\n // of a non-editable node, so in that case, move it into the next\n // node if possible. Issue prosemirror/prosemirror#832.\n if (result.gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset])) { force = true; }\n for (;;) {\n if (offset > 0) {\n if (node.nodeType != 1) {\n break\n } else {\n var before = node.childNodes[offset - 1];\n if (isIgnorable(before)) {\n moveNode = node;\n moveOffset = --offset;\n } else if (before.nodeType == 3) {\n node = before;\n offset = node.nodeValue.length;\n } else { break }\n }\n } else if (isBlockNode(node)) {\n break\n } else {\n var prev = node.previousSibling;\n while (prev && isIgnorable(prev)) {\n moveNode = node.parentNode;\n moveOffset = domIndex(prev);\n prev = prev.previousSibling;\n }\n if (!prev) {\n node = node.parentNode;\n if (node == view.dom) { break }\n offset = 0;\n } else {\n node = prev;\n offset = nodeLen(node);\n }\n }\n }\n if (force) { setSelFocus(view, sel, node, offset); }\n else if (moveNode) { setSelFocus(view, sel, moveNode, moveOffset); }\n}\n\n// Make sure the cursor isn't directly before one or more ignored\n// nodes.\nfunction skipIgnoredNodesRight(view) {\n var sel = view.root.getSelection();\n var node = sel.focusNode, offset = sel.focusOffset;\n if (!node) { return }\n var len = nodeLen(node);\n var moveNode, moveOffset;\n for (;;) {\n if (offset < len) {\n if (node.nodeType != 1) { break }\n var after = node.childNodes[offset];\n if (isIgnorable(after)) {\n moveNode = node;\n moveOffset = ++offset;\n }\n else { break }\n } else if (isBlockNode(node)) {\n break\n } else {\n var next = node.nextSibling;\n while (next && isIgnorable(next)) {\n moveNode = next.parentNode;\n moveOffset = domIndex(next) + 1;\n next = next.nextSibling;\n }\n if (!next) {\n node = node.parentNode;\n if (node == view.dom) { break }\n offset = len = 0;\n } else {\n node = next;\n offset = 0;\n len = nodeLen(node);\n }\n }\n }\n if (moveNode) { setSelFocus(view, sel, moveNode, moveOffset); }\n}\n\nfunction isBlockNode(dom) {\n var desc = dom.pmViewDesc;\n return desc && desc.node && desc.node.isBlock\n}\n\nfunction setSelFocus(view, sel, node, offset) {\n if (selectionCollapsed(sel)) {\n var range = document.createRange();\n range.setEnd(node, offset);\n range.setStart(node, offset);\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (sel.extend) {\n sel.extend(node, offset);\n }\n view.domObserver.setCurSelection();\n}\n\n// : (EditorState, number)\n// Check whether vertical selection motion would involve node\n// selections. If so, apply it (if not, the result is left to the\n// browser)\nfunction selectVertically(view, dir, mods) {\n var sel = view.state.selection;\n if (sel instanceof TextSelection && !sel.empty || mods.indexOf(\"s\") > -1) { return false }\n var $from = sel.$from;\n var $to = sel.$to;\n\n if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? \"up\" : \"down\")) {\n var next = moveSelectionBlock(view.state, dir);\n if (next && (next instanceof NodeSelection))\n { return apply(view, next) }\n }\n if (!$from.parent.inlineContent) {\n var beyond = Selection.findFrom(dir < 0 ? $from : $to, dir);\n return beyond ? apply(view, beyond) : true\n }\n return false\n}\n\nfunction stopNativeHorizontalDelete(view, dir) {\n if (!(view.state.selection instanceof TextSelection)) { return true }\n var ref = view.state.selection;\n var $head = ref.$head;\n var $anchor = ref.$anchor;\n var empty = ref.empty;\n if (!$head.sameParent($anchor)) { return true }\n if (!empty) { return false }\n if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) { return true }\n var nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);\n if (nextNode && !nextNode.isText) {\n var tr = view.state.tr;\n if (dir < 0) { tr.delete($head.pos - nextNode.nodeSize, $head.pos); }\n else { tr.delete($head.pos, $head.pos + nextNode.nodeSize); }\n view.dispatch(tr);\n return true\n }\n return false\n}\n\nfunction switchEditable(view, node, state) {\n view.domObserver.stop();\n node.contentEditable = state;\n view.domObserver.start();\n}\n\n// Issue #867 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821\n// In which Chrome does really wrong things when the down arrow is\n// pressed when the cursor is directly at the start of a textblock and\n// has an uneditable node after it\nfunction chromeDownArrowBug(view) {\n if (!result.chrome || view.state.selection.$head.parentOffset > 0) { return }\n var ref = view.root.getSelection();\n var focusNode = ref.focusNode;\n var focusOffset = ref.focusOffset;\n if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 &&\n focusNode.firstChild && focusNode.firstChild.contentEditable == \"false\") {\n var child = focusNode.firstChild;\n switchEditable(view, child, true);\n setTimeout(function () { return switchEditable(view, child, false); }, 20);\n }\n}\n\n// A backdrop key mapping used to make sure we always suppress keys\n// that have a dangerous default effect, even if the commands they are\n// bound to return false, and to make sure that cursor-motion keys\n// find a cursor (as opposed to a node selection) when pressed. For\n// cursor-motion keys, the code in the handlers also takes care of\n// block selections.\n\nfunction getMods(event) {\n var result = \"\";\n if (event.ctrlKey) { result += \"c\"; }\n if (event.metaKey) { result += \"m\"; }\n if (event.altKey) { result += \"a\"; }\n if (event.shiftKey) { result += \"s\"; }\n return result\n}\n\nfunction captureKeyDown(view, event) {\n var code = event.keyCode, mods = getMods(event);\n if (code == 8 || (result.mac && code == 72 && mods == \"c\")) { // Backspace, Ctrl-h on Mac\n return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodesLeft(view)\n } else if (code == 46 || (result.mac && code == 68 && mods == \"c\")) { // Delete, Ctrl-d on Mac\n return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodesRight(view)\n } else if (code == 13 || code == 27) { // Enter, Esc\n return true\n } else if (code == 37) { // Left arrow\n return selectHorizontally(view, -1, mods) || skipIgnoredNodesLeft(view)\n } else if (code == 39) { // Right arrow\n return selectHorizontally(view, 1, mods) || skipIgnoredNodesRight(view)\n } else if (code == 38) { // Up arrow\n return selectVertically(view, -1, mods) || skipIgnoredNodesLeft(view)\n } else if (code == 40) { // Down arrow\n return chromeDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodesRight(view)\n } else if (mods == (result.mac ? \"m\" : \"c\") &&\n (code == 66 || code == 73 || code == 89 || code == 90)) { // Mod-[biyz]\n return true\n }\n return false\n}\n\nfunction selectionFromDOM(view, origin) {\n var domSel = view.root.getSelection(), doc = view.state.doc;\n var nearestDesc = view.docView.nearestDesc(domSel.focusNode), inWidget = nearestDesc && nearestDesc.size == 0;\n var head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset);\n var $head = doc.resolve(head), $anchor, selection;\n if (selectionCollapsed(domSel)) {\n $anchor = $head;\n while (nearestDesc && !nearestDesc.node) { nearestDesc = nearestDesc.parent; }\n if (nearestDesc && nearestDesc.node.isAtom && NodeSelection.isSelectable(nearestDesc.node) && nearestDesc.parent\n && !(nearestDesc.node.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {\n var pos = nearestDesc.posBefore;\n selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));\n }\n } else {\n $anchor = doc.resolve(view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset));\n }\n\n if (!selection) {\n var bias = origin == \"pointer\" || (view.state.selection.head < $head.pos && !inWidget) ? 1 : -1;\n selection = selectionBetween(view, $anchor, $head, bias);\n }\n return selection\n}\n\nfunction selectionToDOM(view, force) {\n var sel = view.state.selection;\n syncNodeSelection(view, sel);\n\n if (view.editable ? !view.hasFocus() : !(hasSelection(view) && document.activeElement.contains(view.dom))) { return }\n\n view.domObserver.disconnectSelection();\n\n if (view.cursorWrapper) {\n selectCursorWrapper(view);\n } else {\n var anchor = sel.anchor;\n var head = sel.head;\n var resetEditableFrom, resetEditableTo;\n if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {\n if (!sel.$from.parent.inlineContent)\n { resetEditableFrom = temporarilyEditableNear(view, sel.from); }\n if (!sel.empty && !sel.$from.parent.inlineContent)\n { resetEditableTo = temporarilyEditableNear(view, sel.to); }\n }\n view.docView.setSelection(anchor, head, view.root, force);\n if (brokenSelectBetweenUneditable) {\n if (resetEditableFrom) { resetEditable(resetEditableFrom); }\n if (resetEditableTo) { resetEditable(resetEditableTo); }\n }\n if (sel.visible) {\n view.dom.classList.remove(\"ProseMirror-hideselection\");\n } else {\n view.dom.classList.add(\"ProseMirror-hideselection\");\n if (\"onselectionchange\" in document) { removeClassOnSelectionChange(view); }\n }\n }\n\n view.domObserver.setCurSelection();\n view.domObserver.connectSelection();\n}\n\n// Kludge to work around Webkit not allowing a selection to start/end\n// between non-editable block nodes. We briefly make something\n// editable, set the selection, then set it uneditable again.\n\nvar brokenSelectBetweenUneditable = result.safari || result.chrome && result.chrome_version < 63;\n\nfunction temporarilyEditableNear(view, pos) {\n var ref = view.docView.domFromPos(pos);\n var node = ref.node;\n var offset = ref.offset;\n var after = offset < node.childNodes.length ? node.childNodes[offset] : null;\n var before = offset ? node.childNodes[offset - 1] : null;\n if (result.safari && after && after.contentEditable == \"false\") { return setEditable(after) }\n if ((!after || after.contentEditable == \"false\") && (!before || before.contentEditable == \"false\")) {\n if (after) { return setEditable(after) }\n else if (before) { return setEditable(before) }\n }\n}\n\nfunction setEditable(element) {\n element.contentEditable = \"true\";\n if (result.safari && element.draggable) { element.draggable = false; element.wasDraggable = true; }\n return element\n}\n\nfunction resetEditable(element) {\n element.contentEditable = \"false\";\n if (element.wasDraggable) { element.draggable = true; element.wasDraggable = null; }\n}\n\nfunction removeClassOnSelectionChange(view) {\n var doc = view.dom.ownerDocument;\n doc.removeEventListener(\"selectionchange\", view.hideSelectionGuard);\n var domSel = view.root.getSelection();\n var node = domSel.anchorNode, offset = domSel.anchorOffset;\n doc.addEventListener(\"selectionchange\", view.hideSelectionGuard = function () {\n if (domSel.anchorNode != node || domSel.anchorOffset != offset) {\n doc.removeEventListener(\"selectionchange\", view.hideSelectionGuard);\n view.dom.classList.remove(\"ProseMirror-hideselection\");\n }\n });\n}\n\nfunction selectCursorWrapper(view) {\n var domSel = view.root.getSelection(), range = document.createRange();\n var node = view.cursorWrapper.dom, img = node.nodeName == \"IMG\";\n if (img) { range.setEnd(node.parentNode, domIndex(node) + 1); }\n else { range.setEnd(node, 0); }\n range.collapse(false);\n domSel.removeAllRanges();\n domSel.addRange(range);\n // Kludge to kill 'control selection' in IE11 when selecting an\n // invisible cursor wrapper, since that would result in those weird\n // resize handles and a selection that considers the absolutely\n // positioned wrapper, rather than the root editable node, the\n // focused element.\n if (!img && !view.state.selection.visible && result.ie && result.ie_version <= 11) {\n node.disabled = true;\n node.disabled = false;\n }\n}\n\nfunction syncNodeSelection(view, sel) {\n if (sel instanceof NodeSelection) {\n var desc = view.docView.descAt(sel.from);\n if (desc != view.lastSelectedViewDesc) {\n clearNodeSelection(view);\n if (desc) { desc.selectNode(); }\n view.lastSelectedViewDesc = desc;\n }\n } else {\n clearNodeSelection(view);\n }\n}\n\n// Clear all DOM statefulness of the last node selection.\nfunction clearNodeSelection(view) {\n if (view.lastSelectedViewDesc) {\n if (view.lastSelectedViewDesc.parent)\n { view.lastSelectedViewDesc.deselectNode(); }\n view.lastSelectedViewDesc = null;\n }\n}\n\nfunction selectionBetween(view, $anchor, $head, bias) {\n return view.someProp(\"createSelectionBetween\", function (f) { return f(view, $anchor, $head); })\n || TextSelection.between($anchor, $head, bias)\n}\n\nfunction hasFocusAndSelection(view) {\n if (view.editable && view.root.activeElement != view.dom) { return false }\n return hasSelection(view)\n}\n\nfunction hasSelection(view) {\n var sel = view.root.getSelection();\n if (!sel.anchorNode) { return false }\n try {\n // Firefox will raise 'permission denied' errors when accessing\n // properties of `sel.anchorNode` when it's in a generated CSS\n // element.\n return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) &&\n (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode))\n } catch(_) {\n return false\n }\n}\n\nfunction anchorInRightPlace(view) {\n var anchorDOM = view.docView.domFromPos(view.state.selection.anchor);\n var domSel = view.root.getSelection();\n return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset)\n}\n\n// Note that all referencing and parsing is done with the\n// start-of-operation selection and document, since that's the one\n// that the DOM represents. If any changes came in in the meantime,\n// the modification is mapped over those before it is applied, in\n// readDOMChange.\n\nfunction parseBetween(view, from_, to_) {\n var ref = view.docView.parseRange(from_, to_);\n var parent = ref.node;\n var fromOffset = ref.fromOffset;\n var toOffset = ref.toOffset;\n var from = ref.from;\n var to = ref.to;\n\n var domSel = view.root.getSelection(), find = null, anchor = domSel.anchorNode;\n if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {\n find = [{node: anchor, offset: domSel.anchorOffset}];\n if (!selectionCollapsed(domSel))\n { find.push({node: domSel.focusNode, offset: domSel.focusOffset}); }\n }\n // Work around issue in Chrome where backspacing sometimes replaces\n // the deleted content with a random BR node (issues #799, #831)\n if (result.chrome && view.lastKeyCode === 8) {\n for (var off = toOffset; off > fromOffset; off--) {\n var node = parent.childNodes[off - 1], desc = node.pmViewDesc;\n if (node.nodeType == \"BR\" && !desc) { toOffset = off; break }\n if (!desc || desc.size) { break }\n }\n }\n var startDoc = view.state.doc;\n var parser = view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n var $from = startDoc.resolve(from);\n\n var sel = null, doc = parser.parse(parent, {\n topNode: $from.parent,\n topMatch: $from.parent.contentMatchAt($from.index()),\n topOpen: true,\n from: fromOffset,\n to: toOffset,\n preserveWhitespace: $from.parent.type.spec.code ? \"full\" : true,\n editableContent: true,\n findPositions: find,\n ruleFromNode: ruleFromNode,\n context: $from\n });\n if (find && find[0].pos != null) {\n var anchor$1 = find[0].pos, head = find[1] && find[1].pos;\n if (head == null) { head = anchor$1; }\n sel = {anchor: anchor$1 + from, head: head + from};\n }\n return {doc: doc, sel: sel, from: from, to: to}\n}\n\nfunction ruleFromNode(dom) {\n var desc = dom.pmViewDesc;\n if (desc) {\n return desc.parseRule()\n } else if (dom.nodeName == \"BR\" && dom.parentNode) {\n // Safari replaces the list item or table cell with a BR\n // directly in the list node (?!) if you delete the last\n // character in a list item or table cell (#708, #862)\n if (result.safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {\n var skip = document.createElement(\"div\");\n skip.appendChild(document.createElement(\"li\"));\n return {skip: skip}\n } else if (dom.parentNode.lastChild == dom || result.safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) {\n return {ignore: true}\n }\n } else if (dom.nodeName == \"IMG\" && dom.getAttribute(\"mark-placeholder\")) {\n return {ignore: true}\n }\n}\n\nfunction readDOMChange(view, from, to, typeOver, addedNodes) {\n if (from < 0) {\n var origin = view.lastSelectionTime > Date.now() - 50 ? view.lastSelectionOrigin : null;\n var newSel = selectionFromDOM(view, origin);\n if (!view.state.selection.eq(newSel)) {\n var tr$1 = view.state.tr.setSelection(newSel);\n if (origin == \"pointer\") { tr$1.setMeta(\"pointer\", true); }\n else if (origin == \"key\") { tr$1.scrollIntoView(); }\n view.dispatch(tr$1);\n }\n return\n }\n\n var $before = view.state.doc.resolve(from);\n var shared = $before.sharedDepth(to);\n from = $before.before(shared + 1);\n to = view.state.doc.resolve(to).after(shared + 1);\n\n var sel = view.state.selection;\n var parse = parseBetween(view, from, to);\n\n var doc = view.state.doc, compare = doc.slice(parse.from, parse.to);\n var preferredPos, preferredSide;\n // Prefer anchoring to end when Backspace is pressed\n if (view.lastKeyCode === 8 && Date.now() - 100 < view.lastKeyCodeTime) {\n preferredPos = view.state.selection.to;\n preferredSide = \"end\";\n } else {\n preferredPos = view.state.selection.from;\n preferredSide = \"start\";\n }\n view.lastKeyCode = null;\n\n var change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);\n if (!change) {\n if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) &&\n !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) {\n change = {start: sel.from, endA: sel.to, endB: sel.to};\n } else {\n if (parse.sel) {\n var sel$1 = resolveSelection(view, view.state.doc, parse.sel);\n if (sel$1 && !sel$1.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel$1)); }\n }\n return\n }\n }\n view.domChangeCount++;\n // Handle the case where overwriting a selection by typing matches\n // the start or end of the selected content, creating a change\n // that's smaller than what was actually overwritten.\n if (view.state.selection.from < view.state.selection.to &&\n change.start == change.endB &&\n view.state.selection instanceof TextSelection) {\n if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2) {\n change.start = view.state.selection.from;\n } else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2) {\n change.endB += (view.state.selection.to - change.endA);\n change.endA = view.state.selection.to;\n }\n }\n\n // IE11 will insert a non-breaking space _ahead_ of the space after\n // the cursor space when adding a space before another space. When\n // that happened, adjust the change to cover the space instead.\n if (result.ie && result.ie_version <= 11 && change.endB == change.start + 1 &&\n change.endA == change.start && change.start > parse.from &&\n parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == \" \\u00a0\") {\n change.start--;\n change.endA--;\n change.endB--;\n }\n\n var $from = parse.doc.resolveNoCache(change.start - parse.from);\n var $to = parse.doc.resolveNoCache(change.endB - parse.from);\n var nextSel;\n // If this looks like the effect of pressing Enter (or was recorded\n // as being an iOS enter press), just dispatch an Enter key instead.\n if (((result.ios && view.lastIOSEnter > Date.now() - 100 &&\n (!$from.sameParent($to) || addedNodes.some(function (n) { return n.nodeName == \"DIV\"; }))) ||\n (!$from.sameParent($to) && $from.pos < parse.doc.content.size &&\n (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) &&\n nextSel.head == $to.pos)) &&\n view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); })) {\n view.lastIOSEnter = 0;\n return\n }\n // Same for backspace\n if (view.state.selection.anchor > change.start &&\n looksLikeJoin(doc, change.start, change.endA, $from, $to) &&\n view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(8, \"Backspace\")); })) {\n if (result.android && result.chrome) { view.domObserver.suppressSelectionUpdates(); } // #820\n return\n }\n\n var chFrom = change.start, chTo = change.endA;\n\n var tr, storedMarks, markChange, $from1;\n if ($from.sameParent($to) && $from.parent.inlineContent) {\n if ($from.pos == $to.pos) { // Deletion\n // IE11 sometimes weirdly moves the DOM selection around after\n // backspacing out the first element in a textblock\n if (result.ie && result.ie_version <= 11 && $from.parentOffset == 0) {\n view.domObserver.suppressSelectionUpdates();\n setTimeout(function () { return selectionToDOM(view); }, 20);\n }\n tr = view.state.tr.delete(chFrom, chTo);\n storedMarks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));\n } else if ( // Adding or removing a mark\n change.endA == change.endB && ($from1 = doc.resolve(change.start)) &&\n (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset),\n $from1.parent.content.cut($from1.parentOffset, change.endA - $from1.start())))\n ) {\n tr = view.state.tr;\n if (markChange.type == \"add\") { tr.addMark(chFrom, chTo, markChange.mark); }\n else { tr.removeMark(chFrom, chTo, markChange.mark); }\n } else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {\n // Both positions in the same text node -- simply insert text\n var text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);\n if (view.someProp(\"handleTextInput\", function (f) { return f(view, chFrom, chTo, text); })) { return }\n tr = view.state.tr.insertText(text, chFrom, chTo);\n }\n }\n\n if (!tr)\n { tr = view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from)); }\n if (parse.sel) {\n var sel$2 = resolveSelection(view, tr.doc, parse.sel);\n // Chrome Android will sometimes, during composition, report the\n // selection in the wrong place. If it looks like that is\n // happening, don't update the selection.\n // Edge just doesn't move the cursor forward when you start typing\n // in an empty block or between br nodes.\n if (sel$2 && !(result.chrome && result.android && view.composing && sel$2.empty &&\n (sel$2.head == chFrom || sel$2.head == tr.mapping.map(chTo) - 1) ||\n result.ie && sel$2.empty && sel$2.head == chFrom))\n { tr.setSelection(sel$2); }\n }\n if (storedMarks) { tr.ensureMarks(storedMarks); }\n view.dispatch(tr.scrollIntoView());\n}\n\nfunction resolveSelection(view, doc, parsedSel) {\n if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) { return null }\n return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head))\n}\n\n// : (Fragment, Fragment) → ?{mark: Mark, type: string}\n// Given two same-length, non-empty fragments of inline content,\n// determine whether the first could be created from the second by\n// removing or adding a single mark type.\nfunction isMarkChange(cur, prev) {\n var curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks;\n var added = curMarks, removed = prevMarks, type, mark, update;\n for (var i = 0; i < prevMarks.length; i++) { added = prevMarks[i].removeFromSet(added); }\n for (var i$1 = 0; i$1 < curMarks.length; i$1++) { removed = curMarks[i$1].removeFromSet(removed); }\n if (added.length == 1 && removed.length == 0) {\n mark = added[0];\n type = \"add\";\n update = function (node) { return node.mark(mark.addToSet(node.marks)); };\n } else if (added.length == 0 && removed.length == 1) {\n mark = removed[0];\n type = \"remove\";\n update = function (node) { return node.mark(mark.removeFromSet(node.marks)); };\n } else {\n return null\n }\n var updated = [];\n for (var i$2 = 0; i$2 < prev.childCount; i$2++) { updated.push(update(prev.child(i$2))); }\n if (Fragment.from(updated).eq(cur)) { return {mark: mark, type: type} }\n}\n\nfunction looksLikeJoin(old, start, end, $newStart, $newEnd) {\n if (!$newStart.parent.isTextblock ||\n // The content must have shrunk\n end - start <= $newEnd.pos - $newStart.pos ||\n // newEnd must point directly at or after the end of the block that newStart points into\n skipClosingAndOpening($newStart, true, false) < $newEnd.pos)\n { return false }\n\n var $start = old.resolve(start);\n // Start must be at the end of a block\n if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)\n { return false }\n var $next = old.resolve(skipClosingAndOpening($start, true, true));\n // The next textblock must start before end and end near it\n if (!$next.parent.isTextblock || $next.pos > end ||\n skipClosingAndOpening($next, true, false) < end)\n { return false }\n\n // The fragments after the join point must match\n return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content)\n}\n\nfunction skipClosingAndOpening($pos, fromEnd, mayOpen) {\n var depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;\n while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {\n depth--;\n end++;\n fromEnd = false;\n }\n if (mayOpen) {\n var next = $pos.node(depth).maybeChild($pos.indexAfter(depth));\n while (next && !next.isLeaf) {\n next = next.firstChild;\n end++;\n }\n }\n return end\n}\n\nfunction findDiff(a, b, pos, preferredPos, preferredSide) {\n var start = a.findDiffStart(b, pos);\n if (start == null) { return null }\n var ref = a.findDiffEnd(b, pos + a.size, pos + b.size);\n var endA = ref.a;\n var endB = ref.b;\n if (preferredSide == \"end\") {\n var adjust = Math.max(0, start - Math.min(endA, endB));\n preferredPos -= endA + adjust - start;\n }\n if (endA < start && a.size < b.size) {\n var move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;\n start -= move;\n endB = start + (endB - endA);\n endA = start;\n } else if (endB < start) {\n var move$1 = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;\n start -= move$1;\n endA = start + (endA - endB);\n endB = start;\n }\n return {start: start, endA: endA, endB: endB}\n}\n\nfunction serializeForClipboard(view, slice) {\n var context = [];\n var content = slice.content;\n var openStart = slice.openStart;\n var openEnd = slice.openEnd;\n while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {\n openStart--;\n openEnd--;\n var node = content.firstChild;\n context.push(node.type.name, node.type.hasRequiredAttrs() ? node.attrs : null);\n content = node.content;\n }\n\n var serializer = view.someProp(\"clipboardSerializer\") || DOMSerializer.fromSchema(view.state.schema);\n var doc = detachedDoc(), wrap = doc.createElement(\"div\");\n wrap.appendChild(serializer.serializeFragment(content, {document: doc}));\n\n var firstChild = wrap.firstChild, needsWrap;\n while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {\n for (var i = needsWrap.length - 1; i >= 0; i--) {\n var wrapper = doc.createElement(needsWrap[i]);\n while (wrap.firstChild) { wrapper.appendChild(wrap.firstChild); }\n wrap.appendChild(wrapper);\n }\n firstChild = wrap.firstChild;\n }\n\n if (firstChild && firstChild.nodeType == 1)\n { firstChild.setAttribute(\"data-pm-slice\", (openStart + \" \" + openEnd + \" \" + (JSON.stringify(context)))); }\n\n var text = view.someProp(\"clipboardTextSerializer\", function (f) { return f(slice); }) ||\n slice.content.textBetween(0, slice.content.size, \"\\n\\n\");\n\n return {dom: wrap, text: text}\n}\n\n// : (EditorView, string, string, ?bool, ResolvedPos) → ?Slice\n// Read a slice of content from the clipboard (or drop data).\nfunction parseFromClipboard(view, text, html, plainText, $context) {\n var dom, inCode = $context.parent.type.spec.code, slice;\n if (!html && !text) { return null }\n var asText = text && (plainText || inCode || !html);\n if (asText) {\n view.someProp(\"transformPastedText\", function (f) { text = f(text); });\n if (inCode) { return new Slice(Fragment.from(view.state.schema.text(text)), 0, 0) }\n var parsed = view.someProp(\"clipboardTextParser\", function (f) { return f(text, $context); });\n if (parsed) {\n slice = parsed;\n } else {\n dom = document.createElement(\"div\");\n text.trim().split(/(?:\\r\\n?|\\n)+/).forEach(function (block) {\n dom.appendChild(document.createElement(\"p\")).textContent = block;\n });\n }\n } else {\n view.someProp(\"transformPastedHTML\", function (f) { html = f(html); });\n dom = readHTML(html);\n }\n\n var contextNode = dom && dom.querySelector(\"[data-pm-slice]\");\n var sliceData = contextNode && /^(\\d+) (\\d+) (.*)/.exec(contextNode.getAttribute(\"data-pm-slice\"));\n if (!slice) {\n var parser = view.someProp(\"clipboardParser\") || view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n slice = parser.parseSlice(dom, {preserveWhitespace: !!(asText || sliceData), context: $context});\n }\n if (sliceData)\n { slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[3]); }\n else // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent\n { slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), false); }\n\n view.someProp(\"transformPasted\", function (f) { slice = f(slice); });\n return slice\n}\n\n// Takes a slice parsed with parseSlice, which means there hasn't been\n// any content-expression checking done on the top nodes, tries to\n// find a parent node in the current context that might fit the nodes,\n// and if successful, rebuilds the slice so that it fits into that parent.\n//\n// This addresses the problem that Transform.replace expects a\n// coherent slice, and will fail to place a set of siblings that don't\n// fit anywhere in the schema.\nfunction normalizeSiblings(fragment, $context) {\n if (fragment.childCount < 2) { return fragment }\n var loop = function ( d ) {\n var parent = $context.node(d);\n var match = parent.contentMatchAt($context.index(d));\n var lastWrap = (void 0), result = [];\n fragment.forEach(function (node) {\n if (!result) { return }\n var wrap = match.findWrapping(node.type), inLast;\n if (!wrap) { return result = null }\n if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) {\n result[result.length - 1] = inLast;\n } else {\n if (result.length) { result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length); }\n var wrapped = withWrappers(node, wrap);\n result.push(wrapped);\n match = match.matchType(wrapped.type, wrapped.attrs);\n lastWrap = wrap;\n }\n });\n if (result) { return { v: Fragment.from(result) } }\n };\n\n for (var d = $context.depth; d >= 0; d--) {\n var returned = loop( d );\n\n if ( returned ) return returned.v;\n }\n return fragment\n}\n\nfunction withWrappers(node, wrap, from) {\n if ( from === void 0 ) from = 0;\n\n for (var i = wrap.length - 1; i >= from; i--)\n { node = wrap[i].create(null, Fragment.from(node)); }\n return node\n}\n\n// Used to group adjacent nodes wrapped in similar parents by\n// normalizeSiblings into the same parent node\nfunction addToSibling(wrap, lastWrap, node, sibling, depth) {\n if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {\n var inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);\n if (inner) { return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner)) }\n var match = sibling.contentMatchAt(sibling.childCount);\n if (match.matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1]))\n { return sibling.copy(sibling.content.append(Fragment.from(withWrappers(node, wrap, depth + 1)))) }\n }\n}\n\nfunction closeRight(node, depth) {\n if (depth == 0) { return node }\n var fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));\n var fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);\n return node.copy(fragment.append(fill))\n}\n\nfunction closeRange(fragment, side, from, to, depth, openEnd) {\n var node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;\n if (depth < to - 1) { inner = closeRange(inner, side, from, to, depth + 1, openEnd); }\n if (depth >= from)\n { inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, fragment.childCount > 1 || openEnd <= depth).append(inner)\n : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true)); }\n return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner))\n}\n\nfunction closeSlice(slice, openStart, openEnd) {\n if (openStart < slice.openStart)\n { slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd); }\n if (openEnd < slice.openEnd)\n { slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd); }\n return slice\n}\n\n// Trick from jQuery -- some elements must be wrapped in other\n// elements for innerHTML to work. I.e. if you do `div.innerHTML =\n// \"<td>..</td>\"` the table cells are ignored.\nvar wrapMap = {\n thead: [\"table\"],\n tbody: [\"table\"],\n tfoot: [\"table\"],\n caption: [\"table\"],\n colgroup: [\"table\"],\n col: [\"table\", \"colgroup\"],\n tr: [\"table\", \"tbody\"],\n td: [\"table\", \"tbody\", \"tr\"],\n th: [\"table\", \"tbody\", \"tr\"]\n};\n\nvar _detachedDoc = null;\nfunction detachedDoc() {\n return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument(\"title\"))\n}\n\nfunction readHTML(html) {\n var metas = /(\\s*<meta [^>]*>)*/.exec(html);\n if (metas) { html = html.slice(metas[0].length); }\n var elt = detachedDoc().createElement(\"div\");\n var firstTag = /(?:<meta [^>]*>)*<([a-z][^>\\s]+)/i.exec(html), wrap, depth = 0;\n if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()]) {\n html = wrap.map(function (n) { return \"<\" + n + \">\"; }).join(\"\") + html + wrap.map(function (n) { return \"</\" + n + \">\"; }).reverse().join(\"\");\n depth = wrap.length;\n }\n elt.innerHTML = html;\n for (var i = 0; i < depth; i++) { elt = elt.firstChild; }\n return elt\n}\n\nfunction addContext(slice, context) {\n if (!slice.size) { return slice }\n var schema = slice.content.firstChild.type.schema, array;\n try { array = JSON.parse(context); }\n catch(e) { return slice }\n var content = slice.content;\n var openStart = slice.openStart;\n var openEnd = slice.openEnd;\n for (var i = array.length - 2; i >= 0; i -= 2) {\n var type = schema.nodes[array[i]];\n if (!type || type.hasRequiredAttrs()) { break }\n content = Fragment.from(type.create(array[i + 1], content));\n openStart++; openEnd++;\n }\n return new Slice(content, openStart, openEnd)\n}\n\nvar observeOptions = {\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n attributes: true,\n attributeOldValue: true,\n subtree: true\n};\n// IE11 has very broken mutation observers, so we also listen to DOMCharacterDataModified\nvar useCharData = result.ie && result.ie_version <= 11;\n\nvar SelectionState = function SelectionState() {\n this.anchorNode = this.anchorOffset = this.focusNode = this.focusOffset = null;\n};\n\nSelectionState.prototype.set = function set (sel) {\n this.anchorNode = sel.anchorNode; this.anchorOffset = sel.anchorOffset;\n this.focusNode = sel.focusNode; this.focusOffset = sel.focusOffset;\n};\n\nSelectionState.prototype.eq = function eq (sel) {\n return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset &&\n sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset\n};\n\nvar DOMObserver = function DOMObserver(view, handleDOMChange) {\n var this$1 = this;\n\n this.view = view;\n this.handleDOMChange = handleDOMChange;\n this.queue = [];\n this.flushingSoon = -1;\n this.observer = window.MutationObserver &&\n new window.MutationObserver(function (mutations) {\n for (var i = 0; i < mutations.length; i++) { this$1.queue.push(mutations[i]); }\n // IE11 will sometimes (on backspacing out a single character\n // text node after a BR node) call the observer callback\n // before actually updating the DOM, which will cause\n // ProseMirror to miss the change (see #930)\n if (result.ie && result.ie_version <= 11 && mutations.some(\n function (m) { return m.type == \"childList\" && m.removedNodes.length ||\n m.type == \"characterData\" && m.oldValue.length > m.target.nodeValue.length; }))\n { this$1.flushSoon(); }\n else\n { this$1.flush(); }\n });\n this.currentSelection = new SelectionState;\n if (useCharData) {\n this.onCharData = function (e) {\n this$1.queue.push({target: e.target, type: \"characterData\", oldValue: e.prevValue});\n this$1.flushSoon();\n };\n }\n this.onSelectionChange = this.onSelectionChange.bind(this);\n this.suppressingSelectionUpdates = false;\n};\n\nDOMObserver.prototype.flushSoon = function flushSoon () {\n var this$1 = this;\n\n if (this.flushingSoon < 0)\n { this.flushingSoon = window.setTimeout(function () { this$1.flushingSoon = -1; this$1.flush(); }, 20); }\n};\n\nDOMObserver.prototype.forceFlush = function forceFlush () {\n if (this.flushingSoon > -1) {\n window.clearTimeout(this.flushingSoon);\n this.flushingSoon = -1;\n this.flush();\n }\n};\n\nDOMObserver.prototype.start = function start () {\n if (this.observer)\n { this.observer.observe(this.view.dom, observeOptions); }\n if (useCharData)\n { this.view.dom.addEventListener(\"DOMCharacterDataModified\", this.onCharData); }\n this.connectSelection();\n};\n\nDOMObserver.prototype.stop = function stop () {\n var this$1 = this;\n\n if (this.observer) {\n var take = this.observer.takeRecords();\n if (take.length) {\n for (var i = 0; i < take.length; i++) { this.queue.push(take[i]); }\n window.setTimeout(function () { return this$1.flush(); }, 20);\n }\n this.observer.disconnect();\n }\n if (useCharData) { this.view.dom.removeEventListener(\"DOMCharacterDataModified\", this.onCharData); }\n this.disconnectSelection();\n};\n\nDOMObserver.prototype.connectSelection = function connectSelection () {\n this.view.dom.ownerDocument.addEventListener(\"selectionchange\", this.onSelectionChange);\n};\n\nDOMObserver.prototype.disconnectSelection = function disconnectSelection () {\n this.view.dom.ownerDocument.removeEventListener(\"selectionchange\", this.onSelectionChange);\n};\n\nDOMObserver.prototype.suppressSelectionUpdates = function suppressSelectionUpdates () {\n var this$1 = this;\n\n this.suppressingSelectionUpdates = true;\n setTimeout(function () { return this$1.suppressingSelectionUpdates = false; }, 50);\n};\n\nDOMObserver.prototype.onSelectionChange = function onSelectionChange () {\n if (!hasFocusAndSelection(this.view)) { return }\n if (this.suppressingSelectionUpdates) { return selectionToDOM(this.view) }\n // Deletions on IE11 fire their events in the wrong order, giving\n // us a selection change event before the DOM changes are\n // reported.\n if (result.ie && result.ie_version <= 11 && !this.view.state.selection.empty) {\n var sel = this.view.root.getSelection();\n // Selection.isCollapsed isn't reliable on IE\n if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset))\n { return this.flushSoon() }\n }\n this.flush();\n};\n\nDOMObserver.prototype.setCurSelection = function setCurSelection () {\n this.currentSelection.set(this.view.root.getSelection());\n};\n\nDOMObserver.prototype.ignoreSelectionChange = function ignoreSelectionChange (sel) {\n if (sel.rangeCount == 0) { return true }\n var container = sel.getRangeAt(0).commonAncestorContainer;\n var desc = this.view.docView.nearestDesc(container);\n if (desc && desc.ignoreMutation({type: \"selection\", target: container.nodeType == 3 ? container.parentNode : container})) {\n this.setCurSelection();\n return true\n }\n};\n\nDOMObserver.prototype.flush = function flush () {\n if (!this.view.docView || this.flushingSoon > -1) { return }\n var mutations = this.observer ? this.observer.takeRecords() : [];\n if (this.queue.length) {\n mutations = this.queue.concat(mutations);\n this.queue.length = 0;\n }\n\n var sel = this.view.root.getSelection();\n var newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasSelection(this.view) && !this.ignoreSelectionChange(sel);\n\n var from = -1, to = -1, typeOver = false, added = [];\n if (this.view.editable) {\n for (var i = 0; i < mutations.length; i++) {\n var result$1 = this.registerMutation(mutations[i], added);\n if (result$1) {\n from = from < 0 ? result$1.from : Math.min(result$1.from, from);\n to = to < 0 ? result$1.to : Math.max(result$1.to, to);\n if (result$1.typeOver) { typeOver = true; }\n }\n }\n }\n\n if (result.gecko && added.length > 1) {\n var brs = added.filter(function (n) { return n.nodeName == \"BR\"; });\n if (brs.length == 2) {\n var a = brs[0];\n var b = brs[1];\n if (a.parentNode && a.parentNode.parentNode == b.parentNode) { b.remove(); }\n else { a.remove(); }\n }\n }\n\n if (from > -1 || newSel) {\n if (from > -1) {\n this.view.docView.markDirty(from, to);\n checkCSS(this.view);\n }\n this.handleDOMChange(from, to, typeOver, added);\n if (this.view.docView.dirty) { this.view.updateState(this.view.state); }\n else if (!this.currentSelection.eq(sel)) { selectionToDOM(this.view); }\n }\n};\n\nDOMObserver.prototype.registerMutation = function registerMutation (mut, added) {\n // Ignore mutations inside nodes that were already noted as inserted\n if (added.indexOf(mut.target) > -1) { return null }\n var desc = this.view.docView.nearestDesc(mut.target);\n if (mut.type == \"attributes\" &&\n (desc == this.view.docView || mut.attributeName == \"contenteditable\" ||\n // Firefox sometimes fires spurious events for null/empty styles\n (mut.attributeName == \"style\" && !mut.oldValue && !mut.target.getAttribute(\"style\"))))\n { return null }\n if (!desc || desc.ignoreMutation(mut)) { return null }\n\n if (mut.type == \"childList\") {\n var prev = mut.previousSibling, next = mut.nextSibling;\n if (result.ie && result.ie_version <= 11 && mut.addedNodes.length) {\n // IE11 gives us incorrect next/prev siblings for some\n // insertions, so if there are added nodes, recompute those\n for (var i = 0; i < mut.addedNodes.length; i++) {\n var ref = mut.addedNodes[i];\n var previousSibling = ref.previousSibling;\n var nextSibling = ref.nextSibling;\n if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0) { prev = previousSibling; }\n if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0) { next = nextSibling; }\n }\n }\n var fromOffset = prev && prev.parentNode == mut.target\n ? domIndex(prev) + 1 : 0;\n var from = desc.localPosFromDOM(mut.target, fromOffset, -1);\n var toOffset = next && next.parentNode == mut.target\n ? domIndex(next) : mut.target.childNodes.length;\n for (var i$1 = 0; i$1 < mut.addedNodes.length; i$1++) { added.push(mut.addedNodes[i$1]); }\n var to = desc.localPosFromDOM(mut.target, toOffset, 1);\n return {from: from, to: to}\n } else if (mut.type == \"attributes\") {\n return {from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border}\n } else { // \"characterData\"\n return {\n from: desc.posAtStart,\n to: desc.posAtEnd,\n // An event was generated for a text change that didn't change\n // any text. Mark the dom change to fall back to assuming the\n // selection was typed over with an identical value if it can't\n // find another change.\n typeOver: mut.target.nodeValue == mut.oldValue\n }\n }\n};\n\nvar cssChecked = false;\n\nfunction checkCSS(view) {\n if (cssChecked) { return }\n cssChecked = true;\n if (getComputedStyle(view.dom).whiteSpace == \"normal\")\n { console[\"warn\"](\"ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.\"); }\n}\n\n// A collection of DOM events that occur within the editor, and callback functions\n// to invoke when the event fires.\nvar handlers = {}, editHandlers = {};\n\nfunction initInput(view) {\n view.shiftKey = false;\n view.mouseDown = null;\n view.lastKeyCode = null;\n view.lastKeyCodeTime = 0;\n view.lastClick = {time: 0, x: 0, y: 0, type: \"\"};\n view.lastSelectionOrigin = null;\n view.lastSelectionTime = 0;\n\n view.lastIOSEnter = 0;\n\n view.composing = false;\n view.composingTimeout = null;\n view.compositionNodes = [];\n view.compositionEndedAt = -2e8;\n\n view.domObserver = new DOMObserver(view, function (from, to, typeOver, added) { return readDOMChange(view, from, to, typeOver, added); });\n view.domObserver.start();\n // Used by hacks like the beforeinput handler to check whether anything happened in the DOM\n view.domChangeCount = 0;\n\n view.eventHandlers = Object.create(null);\n var loop = function ( event ) {\n var handler = handlers[event];\n view.dom.addEventListener(event, view.eventHandlers[event] = function (event) {\n if (eventBelongsToView(view, event) && !runCustomHandler(view, event) &&\n (view.editable || !(event.type in editHandlers)))\n { handler(view, event); }\n });\n };\n\n for (var event in handlers) loop( event );\n // On Safari, for reasons beyond my understanding, adding an input\n // event handler makes an issue where the composition vanishes when\n // you press enter go away.\n if (result.safari) { view.dom.addEventListener(\"input\", function () { return null; }); }\n\n ensureListeners(view);\n}\n\nfunction setSelectionOrigin(view, origin) {\n view.lastSelectionOrigin = origin;\n view.lastSelectionTime = Date.now();\n}\n\nfunction destroyInput(view) {\n view.domObserver.stop();\n for (var type in view.eventHandlers)\n { view.dom.removeEventListener(type, view.eventHandlers[type]); }\n clearTimeout(view.composingTimeout);\n}\n\nfunction ensureListeners(view) {\n view.someProp(\"handleDOMEvents\", function (currentHandlers) {\n for (var type in currentHandlers) { if (!view.eventHandlers[type])\n { view.dom.addEventListener(type, view.eventHandlers[type] = function (event) { return runCustomHandler(view, event); }); } }\n });\n}\n\nfunction runCustomHandler(view, event) {\n return view.someProp(\"handleDOMEvents\", function (handlers) {\n var handler = handlers[event.type];\n return handler ? handler(view, event) || event.defaultPrevented : false\n })\n}\n\nfunction eventBelongsToView(view, event) {\n if (!event.bubbles) { return true }\n if (event.defaultPrevented) { return false }\n for (var node = event.target; node != view.dom; node = node.parentNode)\n { if (!node || node.nodeType == 11 ||\n (node.pmViewDesc && node.pmViewDesc.stopEvent(event)))\n { return false } }\n return true\n}\n\nfunction dispatchEvent(view, event) {\n if (!runCustomHandler(view, event) && handlers[event.type] &&\n (view.editable || !(event.type in editHandlers)))\n { handlers[event.type](view, event); }\n}\n\neditHandlers.keydown = function (view, event) {\n view.shiftKey = event.keyCode == 16 || event.shiftKey;\n if (inOrNearComposition(view, event)) { return }\n view.domObserver.forceFlush();\n view.lastKeyCode = event.keyCode;\n view.lastKeyCodeTime = Date.now();\n // On iOS, if we preventDefault enter key presses, the virtual\n // keyboard gets confused. So the hack here is to set a flag that\n // makes the DOM change code recognize that what just happens should\n // be replaced by whatever the Enter key handlers do.\n if (result.ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {\n var now = Date.now();\n view.lastIOSEnter = now;\n setTimeout(function () {\n if (view.lastIOSEnter == now) {\n view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); });\n view.lastIOSEnter = 0;\n }\n }, 50);\n } else if (view.someProp(\"handleKeyDown\", function (f) { return f(view, event); }) || captureKeyDown(view, event)) {\n event.preventDefault();\n } else {\n setSelectionOrigin(view, \"key\");\n }\n};\n\neditHandlers.keyup = function (view, e) {\n if (e.keyCode == 16) { view.shiftKey = false; }\n};\n\neditHandlers.keypress = function (view, event) {\n if (inOrNearComposition(view, event) || !event.charCode ||\n event.ctrlKey && !event.altKey || result.mac && event.metaKey) { return }\n\n if (view.someProp(\"handleKeyPress\", function (f) { return f(view, event); })) {\n event.preventDefault();\n return\n }\n\n var sel = view.state.selection;\n if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {\n var text = String.fromCharCode(event.charCode);\n if (!view.someProp(\"handleTextInput\", function (f) { return f(view, sel.$from.pos, sel.$to.pos, text); }))\n { view.dispatch(view.state.tr.insertText(text).scrollIntoView()); }\n event.preventDefault();\n }\n};\n\nfunction eventCoords(event) { return {left: event.clientX, top: event.clientY} }\n\nfunction isNear(event, click) {\n var dx = click.x - event.clientX, dy = click.y - event.clientY;\n return dx * dx + dy * dy < 100\n}\n\nfunction runHandlerOnContext(view, propName, pos, inside, event) {\n if (inside == -1) { return false }\n var $pos = view.state.doc.resolve(inside);\n var loop = function ( i ) {\n if (view.someProp(propName, function (f) { return i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true)\n : f(view, pos, $pos.node(i), $pos.before(i), event, false); }))\n { return { v: true } }\n };\n\n for (var i = $pos.depth + 1; i > 0; i--) {\n var returned = loop( i );\n\n if ( returned ) return returned.v;\n }\n return false\n}\n\nfunction updateSelection(view, selection, origin) {\n if (!view.focused) { view.focus(); }\n var tr = view.state.tr.setSelection(selection);\n if (origin == \"pointer\") { tr.setMeta(\"pointer\", true); }\n view.dispatch(tr);\n}\n\nfunction selectClickedLeaf(view, inside) {\n if (inside == -1) { return false }\n var $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;\n if (node && node.isAtom && NodeSelection.isSelectable(node)) {\n updateSelection(view, new NodeSelection($pos), \"pointer\");\n return true\n }\n return false\n}\n\nfunction selectClickedNode(view, inside) {\n if (inside == -1) { return false }\n var sel = view.state.selection, selectedNode, selectAt;\n if (sel instanceof NodeSelection) { selectedNode = sel.node; }\n\n var $pos = view.state.doc.resolve(inside);\n for (var i = $pos.depth + 1; i > 0; i--) {\n var node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n if (NodeSelection.isSelectable(node)) {\n if (selectedNode && sel.$from.depth > 0 &&\n i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos)\n { selectAt = $pos.before(sel.$from.depth); }\n else\n { selectAt = $pos.before(i); }\n break\n }\n }\n\n if (selectAt != null) {\n updateSelection(view, NodeSelection.create(view.state.doc, selectAt), \"pointer\");\n return true\n } else {\n return false\n }\n}\n\nfunction handleSingleClick(view, pos, inside, event, selectNode) {\n return runHandlerOnContext(view, \"handleClickOn\", pos, inside, event) ||\n view.someProp(\"handleClick\", function (f) { return f(view, pos, event); }) ||\n (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside))\n}\n\nfunction handleDoubleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleDoubleClickOn\", pos, inside, event) ||\n view.someProp(\"handleDoubleClick\", function (f) { return f(view, pos, event); })\n}\n\nfunction handleTripleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleTripleClickOn\", pos, inside, event) ||\n view.someProp(\"handleTripleClick\", function (f) { return f(view, pos, event); }) ||\n defaultTripleClick(view, inside)\n}\n\nfunction defaultTripleClick(view, inside) {\n var doc = view.state.doc;\n if (inside == -1) {\n if (doc.inlineContent) {\n updateSelection(view, TextSelection.create(doc, 0, doc.content.size), \"pointer\");\n return true\n }\n return false\n }\n\n var $pos = doc.resolve(inside);\n for (var i = $pos.depth + 1; i > 0; i--) {\n var node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n var nodePos = $pos.before(i);\n if (node.inlineContent)\n { updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), \"pointer\"); }\n else if (NodeSelection.isSelectable(node))\n { updateSelection(view, NodeSelection.create(doc, nodePos), \"pointer\"); }\n else\n { continue }\n return true\n }\n}\n\nfunction forceDOMFlush(view) {\n return endComposition(view)\n}\n\nvar selectNodeModifier = result.mac ? \"metaKey\" : \"ctrlKey\";\n\nhandlers.mousedown = function (view, event) {\n view.shiftKey = event.shiftKey;\n var flushed = forceDOMFlush(view);\n var now = Date.now(), type = \"singleClick\";\n if (now - view.lastClick.time < 500 && isNear(event, view.lastClick) && !event[selectNodeModifier]) {\n if (view.lastClick.type == \"singleClick\") { type = \"doubleClick\"; }\n else if (view.lastClick.type == \"doubleClick\") { type = \"tripleClick\"; }\n }\n view.lastClick = {time: now, x: event.clientX, y: event.clientY, type: type};\n\n var pos = view.posAtCoords(eventCoords(event));\n if (!pos) { return }\n\n if (type == \"singleClick\")\n { view.mouseDown = new MouseDown(view, pos, event, flushed); }\n else if ((type == \"doubleClick\" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event))\n { event.preventDefault(); }\n else\n { setSelectionOrigin(view, \"pointer\"); }\n};\n\nvar MouseDown = function MouseDown(view, pos, event, flushed) {\n var this$1 = this;\n\n this.view = view;\n this.startDoc = view.state.doc;\n this.pos = pos;\n this.event = event;\n this.flushed = flushed;\n this.selectNode = event[selectNodeModifier];\n this.allowDefault = event.shiftKey;\n\n var targetNode, targetPos;\n if (pos.inside > -1) {\n targetNode = view.state.doc.nodeAt(pos.inside);\n targetPos = pos.inside;\n } else {\n var $pos = view.state.doc.resolve(pos.pos);\n targetNode = $pos.parent;\n targetPos = $pos.depth ? $pos.before() : 0;\n }\n\n this.mightDrag = null;\n\n var target = flushed ? null : event.target;\n var targetDesc = target ? view.docView.nearestDesc(target, true) : null;\n this.target = targetDesc ? targetDesc.dom : null;\n\n if (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||\n view.state.selection instanceof NodeSelection && targetPos == view.state.selection.from)\n { this.mightDrag = {node: targetNode,\n pos: targetPos,\n addAttr: this.target && !this.target.draggable,\n setUneditable: this.target && result.gecko && !this.target.hasAttribute(\"contentEditable\")}; }\n\n if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr) { this.target.draggable = true; }\n if (this.mightDrag.setUneditable)\n { setTimeout(function () { return this$1.target.setAttribute(\"contentEditable\", \"false\"); }, 20); }\n this.view.domObserver.start();\n }\n\n view.root.addEventListener(\"mouseup\", this.up = this.up.bind(this));\n view.root.addEventListener(\"mousemove\", this.move = this.move.bind(this));\n setSelectionOrigin(view, \"pointer\");\n};\n\nMouseDown.prototype.done = function done () {\n this.view.root.removeEventListener(\"mouseup\", this.up);\n this.view.root.removeEventListener(\"mousemove\", this.move);\n if (this.mightDrag && this.target) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr) { this.target.removeAttribute(\"draggable\"); }\n if (this.mightDrag.setUneditable) { this.target.removeAttribute(\"contentEditable\"); }\n this.view.domObserver.start();\n }\n this.view.mouseDown = null;\n};\n\nMouseDown.prototype.up = function up (event) {\n this.done();\n\n if (!this.view.dom.contains(event.target.nodeType == 3 ? event.target.parentNode : event.target))\n { return }\n\n var pos = this.pos;\n if (this.view.state.doc != this.startDoc) { pos = this.view.posAtCoords(eventCoords(event)); }\n\n if (this.allowDefault || !pos) {\n setSelectionOrigin(this.view, \"pointer\");\n } else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) {\n event.preventDefault();\n } else if (this.flushed ||\n // Chrome will sometimes treat a node selection as a\n // cursor, but still report that the node is selected\n // when asked through getSelection. You'll then get a\n // situation where clicking at the point where that\n // (hidden) cursor is doesn't change the selection, and\n // thus doesn't get a reaction from ProseMirror. This\n // works around that.\n (result.chrome && !(this.view.state.selection instanceof TextSelection) &&\n (pos.pos == this.view.state.selection.from || pos.pos == this.view.state.selection.to))) {\n updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), \"pointer\");\n event.preventDefault();\n } else {\n setSelectionOrigin(this.view, \"pointer\");\n }\n};\n\nMouseDown.prototype.move = function move (event) {\n if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 ||\n Math.abs(this.event.y - event.clientY) > 4))\n { this.allowDefault = true; }\n setSelectionOrigin(this.view, \"pointer\");\n};\n\nhandlers.touchdown = function (view) {\n forceDOMFlush(view);\n setSelectionOrigin(view, \"pointer\");\n};\n\nhandlers.contextmenu = function (view) { return forceDOMFlush(view); };\n\nfunction inOrNearComposition(view, event) {\n if (view.composing) { return true }\n // See https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/.\n // On Japanese input method editors (IMEs), the Enter key is used to confirm character\n // selection. On Safari, when Enter is pressed, compositionend and keydown events are\n // emitted. The keydown event triggers newline insertion, which we don't want.\n // This method returns true if the keydown event should be ignored.\n // We only ignore it once, as pressing Enter a second time *should* insert a newline.\n // Furthermore, the keydown event timestamp must be close to the compositionEndedAt timestamp.\n // This guards against the case where compositionend is triggered without the keyboard\n // (e.g. character confirmation may be done with the mouse), and keydown is triggered\n // afterwards- we wouldn't want to ignore the keydown event in this case.\n if (result.safari && Math.abs(event.timeStamp - view.compositionEndedAt) < 500) {\n view.compositionEndedAt = -2e8;\n return true\n }\n return false\n}\n\n// Drop active composition after 5 seconds of inactivity on Android\nvar timeoutComposition = result.android ? 5000 : -1;\n\neditHandlers.compositionstart = editHandlers.compositionupdate = function (view) {\n if (!view.composing) {\n view.domObserver.flush();\n var state = view.state;\n var $pos = state.selection.$from;\n if (state.selection.empty &&\n (state.storedMarks || (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(function (m) { return m.type.spec.inclusive === false; })))) {\n // Need to wrap the cursor in mark nodes different from the ones in the DOM context\n view.markCursor = view.state.storedMarks || $pos.marks();\n endComposition(view, true);\n view.markCursor = null;\n } else {\n endComposition(view);\n // In firefox, if the cursor is after but outside a marked node,\n // the inserted text won't inherit the marks. So this moves it\n // inside if necessary.\n if (result.gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {\n var sel = view.root.getSelection();\n for (var node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {\n var before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];\n if (!before) { break }\n if (before.nodeType == 3) {\n sel.collapse(before, before.nodeValue.length);\n break\n } else {\n node = before;\n offset = -1;\n }\n }\n }\n }\n view.composing = true;\n }\n scheduleComposeEnd(view, timeoutComposition);\n};\n\neditHandlers.compositionend = function (view, event) {\n if (view.composing) {\n view.composing = false;\n view.compositionEndedAt = event.timeStamp;\n scheduleComposeEnd(view, 20);\n }\n};\n\nfunction scheduleComposeEnd(view, delay) {\n clearTimeout(view.composingTimeout);\n if (delay > -1) { view.composingTimeout = setTimeout(function () { return endComposition(view); }, delay); }\n}\n\nfunction endComposition(view, forceUpdate) {\n view.domObserver.forceFlush();\n view.composing = false;\n while (view.compositionNodes.length > 0) { view.compositionNodes.pop().markParentsDirty(); }\n if (forceUpdate || view.docView.dirty) {\n var sel = selectionFromDOM(view);\n if (!sel.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel)); }\n else { view.updateState(view.state); }\n return true\n }\n return false\n}\n\nfunction captureCopy(view, dom) {\n // The extra wrapper is somehow necessary on IE/Edge to prevent the\n // content from being mangled when it is put onto the clipboard\n var doc = view.dom.ownerDocument;\n var wrap = doc.body.appendChild(doc.createElement(\"div\"));\n wrap.appendChild(dom);\n wrap.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n var sel = getSelection(), range = doc.createRange();\n range.selectNodeContents(dom);\n // Done because IE will fire a selectionchange moving the selection\n // to its start when removeAllRanges is called and the editor still\n // has focus (which will mess up the editor's selection state).\n view.dom.blur();\n sel.removeAllRanges();\n sel.addRange(range);\n setTimeout(function () {\n doc.body.removeChild(wrap);\n view.focus();\n }, 50);\n}\n\n// This is very crude, but unfortunately both these browsers _pretend_\n// that they have a clipboard API—all the objects and methods are\n// there, they just don't work, and they are hard to test.\nvar brokenClipboardAPI = (result.ie && result.ie_version < 15) ||\n (result.ios && result.webkit_version < 604);\n\nhandlers.copy = editHandlers.cut = function (view, e) {\n var sel = view.state.selection, cut = e.type == \"cut\";\n if (sel.empty) { return }\n\n // IE and Edge's clipboard interface is completely broken\n var data = brokenClipboardAPI ? null : e.clipboardData;\n var slice = sel.content();\n var ref = serializeForClipboard(view, slice);\n var dom = ref.dom;\n var text = ref.text;\n if (data) {\n e.preventDefault();\n data.clearData();\n data.setData(\"text/html\", dom.innerHTML);\n data.setData(\"text/plain\", text);\n } else {\n captureCopy(view, dom);\n }\n if (cut) { view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta(\"uiEvent\", \"cut\")); }\n};\n\nfunction sliceSingleNode(slice) {\n return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null\n}\n\nfunction capturePaste(view, e) {\n var doc = view.dom.ownerDocument;\n var plainText = view.shiftKey || view.state.selection.$from.parent.type.spec.code;\n var target = doc.body.appendChild(doc.createElement(plainText ? \"textarea\" : \"div\"));\n if (!plainText) { target.contentEditable = \"true\"; }\n target.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n target.focus();\n setTimeout(function () {\n view.focus();\n doc.body.removeChild(target);\n if (plainText) { doPaste(view, target.value, null, e); }\n else { doPaste(view, target.textContent, target.innerHTML, e); }\n }, 50);\n}\n\nfunction doPaste(view, text, html, e) {\n var slice = parseFromClipboard(view, text, html, view.shiftKey, view.state.selection.$from);\n if (view.someProp(\"handlePaste\", function (f) { return f(view, e, slice || Slice.empty); }) || !slice) { return }\n\n var singleNode = sliceSingleNode(slice);\n var tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, view.shiftKey) : view.state.tr.replaceSelection(slice);\n view.dispatch(tr.scrollIntoView().setMeta(\"paste\", true).setMeta(\"uiEvent\", \"paste\"));\n}\n\neditHandlers.paste = function (view, e) {\n var data = brokenClipboardAPI ? null : e.clipboardData;\n var html = data && data.getData(\"text/html\"), text = data && data.getData(\"text/plain\");\n if (data && (html || text || data.files.length)) {\n doPaste(view, text, html, e);\n e.preventDefault();\n } else {\n capturePaste(view, e);\n }\n};\n\nvar Dragging = function Dragging(slice, move) {\n this.slice = slice;\n this.move = move;\n};\n\nvar dragCopyModifier = result.mac ? \"altKey\" : \"ctrlKey\";\n\nhandlers.dragstart = function (view, e) {\n var mouseDown = view.mouseDown;\n if (mouseDown) { mouseDown.done(); }\n if (!e.dataTransfer) { return }\n\n var sel = view.state.selection;\n var pos = sel.empty ? null : view.posAtCoords(eventCoords(e));\n if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1: sel.to)) ; else if (mouseDown && mouseDown.mightDrag) {\n view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos)));\n } else if (e.target && e.target.nodeType == 1) {\n var desc = view.docView.nearestDesc(e.target, true);\n if (!desc || !desc.node.type.spec.draggable || desc == view.docView) { return }\n view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, desc.posBefore)));\n }\n var slice = view.state.selection.content();\n var ref = serializeForClipboard(view, slice);\n var dom = ref.dom;\n var text = ref.text;\n e.dataTransfer.clearData();\n e.dataTransfer.setData(brokenClipboardAPI ? \"Text\" : \"text/html\", dom.innerHTML);\n if (!brokenClipboardAPI) { e.dataTransfer.setData(\"text/plain\", text); }\n view.dragging = new Dragging(slice, !e[dragCopyModifier]);\n};\n\nhandlers.dragend = function (view) {\n window.setTimeout(function () { return view.dragging = null; }, 50);\n};\n\neditHandlers.dragover = editHandlers.dragenter = function (_, e) { return e.preventDefault(); };\n\neditHandlers.drop = function (view, e) {\n var dragging = view.dragging;\n view.dragging = null;\n\n if (!e.dataTransfer) { return }\n\n var eventPos = view.posAtCoords(eventCoords(e));\n if (!eventPos) { return }\n var $mouse = view.state.doc.resolve(eventPos.pos);\n if (!$mouse) { return }\n var slice = dragging && dragging.slice ||\n parseFromClipboard(view, e.dataTransfer.getData(brokenClipboardAPI ? \"Text\" : \"text/plain\"),\n brokenClipboardAPI ? null : e.dataTransfer.getData(\"text/html\"), false, $mouse);\n if (view.someProp(\"handleDrop\", function (f) { return f(view, e, slice || Slice.empty, dragging && dragging.move); })) {\n e.preventDefault();\n return\n }\n if (!slice) { return }\n\n e.preventDefault();\n var insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;\n if (insertPos == null) { insertPos = $mouse.pos; }\n\n var tr = view.state.tr;\n if (dragging && dragging.move) { tr.deleteSelection(); }\n\n var pos = tr.mapping.map(insertPos);\n var isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;\n var beforeInsert = tr.doc;\n if (isNode)\n { tr.replaceRangeWith(pos, pos, slice.content.firstChild); }\n else\n { tr.replaceRange(pos, pos, slice); }\n if (tr.doc.eq(beforeInsert)) { return }\n\n var $pos = tr.doc.resolve(pos);\n if (isNode && NodeSelection.isSelectable(slice.content.firstChild) &&\n $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild))\n { tr.setSelection(new NodeSelection($pos)); }\n else\n { tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(tr.mapping.map(insertPos)))); }\n view.focus();\n view.dispatch(tr.setMeta(\"uiEvent\", \"drop\"));\n};\n\nhandlers.focus = function (view) {\n if (!view.focused) {\n view.domObserver.stop();\n view.dom.classList.add(\"ProseMirror-focused\");\n view.domObserver.start();\n view.focused = true;\n setTimeout(function () {\n if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.root.getSelection()))\n { selectionToDOM(view); }\n }, 20);\n }\n};\n\nhandlers.blur = function (view) {\n if (view.focused) {\n view.domObserver.stop();\n view.dom.classList.remove(\"ProseMirror-focused\");\n view.domObserver.start();\n view.domObserver.currentSelection.set({});\n view.focused = false;\n }\n};\n\nhandlers.beforeinput = function (view, event) {\n // We should probably do more with beforeinput events, but support\n // is so spotty that I'm still waiting to see where they are going.\n\n // Very specific hack to deal with backspace sometimes failing on\n // Chrome Android when after an uneditable node.\n if (result.chrome && result.android && event.inputType == \"deleteContentBackward\") {\n var domChangeCount = view.domChangeCount;\n setTimeout(function () {\n if (view.domChangeCount != domChangeCount) { return } // Event already had some effect\n // This bug tends to close the virtual keyboard, so we refocus\n view.dom.blur();\n view.focus();\n if (view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(8, \"Backspace\")); })) { return }\n var ref = view.state.selection;\n var $cursor = ref.$cursor;\n // Crude approximation of backspace behavior when no command handled it\n if ($cursor && $cursor.pos > 0) { view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView()); }\n }, 50);\n }\n};\n\n// Make sure all handlers get registered\nfor (var prop in editHandlers) { handlers[prop] = editHandlers[prop]; }\n\nfunction compareObjs(a, b) {\n if (a == b) { return true }\n for (var p in a) { if (a[p] !== b[p]) { return false } }\n for (var p$1 in b) { if (!(p$1 in a)) { return false } }\n return true\n}\n\nvar WidgetType = function WidgetType(toDOM, spec) {\n this.spec = spec || noSpec;\n this.side = this.spec.side || 0;\n this.toDOM = toDOM;\n};\n\nWidgetType.prototype.map = function map (mapping, span, offset, oldOffset) {\n var ref = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);\n var pos = ref.pos;\n var deleted = ref.deleted;\n return deleted ? null : new Decoration(pos - offset, pos - offset, this)\n};\n\nWidgetType.prototype.valid = function valid () { return true };\n\nWidgetType.prototype.eq = function eq (other) {\n return this == other ||\n (other instanceof WidgetType &&\n (this.spec.key && this.spec.key == other.spec.key ||\n this.toDOM == other.toDOM && compareObjs(this.spec, other.spec)))\n};\n\nvar InlineType = function InlineType(attrs, spec) {\n this.spec = spec || noSpec;\n this.attrs = attrs;\n};\n\nInlineType.prototype.map = function map (mapping, span, offset, oldOffset) {\n var from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;\n var to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;\n return from >= to ? null : new Decoration(from, to, this)\n};\n\nInlineType.prototype.valid = function valid (_, span) { return span.from < span.to };\n\nInlineType.prototype.eq = function eq (other) {\n return this == other ||\n (other instanceof InlineType && compareObjs(this.attrs, other.attrs) &&\n compareObjs(this.spec, other.spec))\n};\n\nInlineType.is = function is (span) { return span.type instanceof InlineType };\n\nvar NodeType = function NodeType(attrs, spec) {\n this.spec = spec || noSpec;\n this.attrs = attrs;\n};\n\nNodeType.prototype.map = function map (mapping, span, offset, oldOffset) {\n var from = mapping.mapResult(span.from + oldOffset, 1);\n if (from.deleted) { return null }\n var to = mapping.mapResult(span.to + oldOffset, -1);\n if (to.deleted || to.pos <= from.pos) { return null }\n return new Decoration(from.pos - offset, to.pos - offset, this)\n};\n\nNodeType.prototype.valid = function valid (node, span) {\n var ref = node.content.findIndex(span.from);\n var index = ref.index;\n var offset = ref.offset;\n return offset == span.from && offset + node.child(index).nodeSize == span.to\n};\n\nNodeType.prototype.eq = function eq (other) {\n return this == other ||\n (other instanceof NodeType && compareObjs(this.attrs, other.attrs) &&\n compareObjs(this.spec, other.spec))\n};\n\n// ::- Decoration objects can be provided to the view through the\n// [`decorations` prop](#view.EditorProps.decorations). They come in\n// several variants—see the static members of this class for details.\nvar Decoration = function Decoration(from, to, type) {\n // :: number\n // The start position of the decoration.\n this.from = from;\n // :: number\n // The end position. Will be the same as `from` for [widget\n // decorations](#view.Decoration^widget).\n this.to = to;\n this.type = type;\n};\n\nvar prototypeAccessors$1 = { spec: { configurable: true } };\n\nDecoration.prototype.copy = function copy (from, to) {\n return new Decoration(from, to, this.type)\n};\n\nDecoration.prototype.eq = function eq (other, offset) {\n if ( offset === void 0 ) offset = 0;\n\n return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to\n};\n\nDecoration.prototype.map = function map (mapping, offset, oldOffset) {\n return this.type.map(mapping, this, offset, oldOffset)\n};\n\n// :: (number, union<(view: EditorView, getPos: () → number) → dom.Node, dom.Node>, ?Object) → Decoration\n// Creates a widget decoration, which is a DOM node that's shown in\n// the document at the given position. It is recommended that you\n// delay rendering the widget by passing a function that will be\n// called when the widget is actually drawn in a view, but you can\n// also directly pass a DOM node. `getPos` can be used to find the\n// widget's current document position.\n//\n// spec::- These options are supported:\n//\n// side:: ?number\n// Controls which side of the document position this widget is\n// associated with. When negative, it is drawn before a cursor\n// at its position, and content inserted at that position ends\n// up after the widget. When zero (the default) or positive, the\n// widget is drawn after the cursor and content inserted there\n// ends up before the widget.\n//\n// When there are multiple widgets at a given position, their\n// `side` values determine the order in which they appear. Those\n// with lower values appear first. The ordering of widgets with\n// the same `side` value is unspecified.\n//\n// When `marks` is null, `side` also determines the marks that\n// the widget is wrapped in—those of the node before when\n// negative, those of the node after when positive.\n//\n// marks:: ?[Mark]\n// The precise set of marks to draw around the widget.\n//\n// stopEvent:: ?(event: dom.Event) → bool\n// Can be used to control which DOM events, when they bubble out\n// of this widget, the editor view should ignore.\n//\n// ignoreSelection:: ?bool\n// When set (defaults to false), selection changes inside the\n// widget are ignored, and don't cause ProseMirror to try and\n// re-sync the selection with its selection state.\n//\n// key:: ?string\n// When comparing decorations of this type (in order to decide\n// whether it needs to be redrawn), ProseMirror will by default\n// compare the widget DOM node by identity. If you pass a key,\n// that key will be compared instead, which can be useful when\n// you generate decorations on the fly and don't want to store\n// and reuse DOM nodes. Make sure that any widgets with the same\n// key are interchangeable—if widgets differ in, for example,\n// the behavior of some event handler, they should get\n// different keys.\nDecoration.widget = function widget (pos, toDOM, spec) {\n return new Decoration(pos, pos, new WidgetType(toDOM, spec))\n};\n\n// :: (number, number, DecorationAttrs, ?Object) → Decoration\n// Creates an inline decoration, which adds the given attributes to\n// each inline node between `from` and `to`.\n//\n// spec::- These options are recognized:\n//\n// inclusiveStart:: ?bool\n// Determines how the left side of the decoration is\n// [mapped](#transform.Position_Mapping) when content is\n// inserted directly at that position. By default, the decoration\n// won't include the new content, but you can set this to `true`\n// to make it inclusive.\n//\n// inclusiveEnd:: ?bool\n// Determines how the right side of the decoration is mapped.\n// See\n// [`inclusiveStart`](#view.Decoration^inline^spec.inclusiveStart).\nDecoration.inline = function inline (from, to, attrs, spec) {\n return new Decoration(from, to, new InlineType(attrs, spec))\n};\n\n// :: (number, number, DecorationAttrs, ?Object) → Decoration\n// Creates a node decoration. `from` and `to` should point precisely\n// before and after a node in the document. That node, and only that\n// node, will receive the given attributes.\n//\n// spec::-\n//\n// Optional information to store with the decoration. It\n// is also used when comparing decorators for equality.\nDecoration.node = function node (from, to, attrs, spec) {\n return new Decoration(from, to, new NodeType(attrs, spec))\n};\n\n// :: Object\n// The spec provided when creating this decoration. Can be useful\n// if you've stored extra information in that object.\nprototypeAccessors$1.spec.get = function () { return this.type.spec };\n\nObject.defineProperties( Decoration.prototype, prototypeAccessors$1 );\n\n// DecorationAttrs:: interface\n// A set of attributes to add to a decorated node. Most properties\n// simply directly correspond to DOM attributes of the same name,\n// which will be set to the property's value. These are exceptions:\n//\n// class:: ?string\n// A CSS class name or a space-separated set of class names to be\n// _added_ to the classes that the node already had.\n//\n// style:: ?string\n// A string of CSS to be _added_ to the node's existing `style` property.\n//\n// nodeName:: ?string\n// When non-null, the target node is wrapped in a DOM element of\n// this type (and the other attributes are applied to this element).\n\nvar none = [], noSpec = {};\n\n// ::- A collection of [decorations](#view.Decoration), organized in\n// such a way that the drawing algorithm can efficiently use and\n// compare them. This is a persistent data structure—it is not\n// modified, updates create a new value.\nvar DecorationSet = function DecorationSet(local, children) {\n this.local = local && local.length ? local : none;\n this.children = children && children.length ? children : none;\n};\n\n// :: (Node, [Decoration]) → DecorationSet\n// Create a set of decorations, using the structure of the given\n// document.\nDecorationSet.create = function create (doc, decorations) {\n return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty\n};\n\n// :: (?number, ?number, ?(spec: Object) → bool) → [Decoration]\n// Find all decorations in this set which touch the given range\n// (including decorations that start or end directly at the\n// boundaries) and match the given predicate on their spec. When\n// `start` and `end` are omitted, all decorations in the set are\n// considered. When `predicate` isn't given, all decorations are\n// assumed to match.\nDecorationSet.prototype.find = function find (start, end, predicate) {\n var result = [];\n this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);\n return result\n};\n\nDecorationSet.prototype.findInner = function findInner (start, end, result, offset, predicate) {\n for (var i = 0; i < this.local.length; i++) {\n var span = this.local[i];\n if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec)))\n { result.push(span.copy(span.from + offset, span.to + offset)); }\n }\n for (var i$1 = 0; i$1 < this.children.length; i$1 += 3) {\n if (this.children[i$1] < end && this.children[i$1 + 1] > start) {\n var childOff = this.children[i$1] + 1;\n this.children[i$1 + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);\n }\n }\n};\n\n// :: (Mapping, Node, ?Object) → DecorationSet\n// Map the set of decorations in response to a change in the\n// document.\n//\n// options::- An optional set of options.\n//\n// onRemove:: ?(decorationSpec: Object)\n// When given, this function will be called for each decoration\n// that gets dropped as a result of the mapping, passing the\n// spec of that decoration.\nDecorationSet.prototype.map = function map (mapping, doc, options) {\n if (this == empty || mapping.maps.length == 0) { return this }\n return this.mapInner(mapping, doc, 0, 0, options || noSpec)\n};\n\nDecorationSet.prototype.mapInner = function mapInner (mapping, node, offset, oldOffset, options) {\n var newLocal;\n for (var i = 0; i < this.local.length; i++) {\n var mapped = this.local[i].map(mapping, offset, oldOffset);\n if (mapped && mapped.type.valid(node, mapped)) { (newLocal || (newLocal = [])).push(mapped); }\n else if (options.onRemove) { options.onRemove(this.local[i].spec); }\n }\n\n if (this.children.length)\n { return mapChildren(this.children, newLocal, mapping, node, offset, oldOffset, options) }\n else\n { return newLocal ? new DecorationSet(newLocal.sort(byPos)) : empty }\n};\n\n// :: (Node, [Decoration]) → DecorationSet\n// Add the given array of decorations to the ones in the set,\n// producing a new set. Needs access to the current document to\n// create the appropriate tree structure.\nDecorationSet.prototype.add = function add (doc, decorations) {\n if (!decorations.length) { return this }\n if (this == empty) { return DecorationSet.create(doc, decorations) }\n return this.addInner(doc, decorations, 0)\n};\n\nDecorationSet.prototype.addInner = function addInner (doc, decorations, offset) {\n var this$1 = this;\n\n var children, childIndex = 0;\n doc.forEach(function (childNode, childOffset) {\n var baseOffset = childOffset + offset, found;\n if (!(found = takeSpansForNode(decorations, childNode, baseOffset))) { return }\n\n if (!children) { children = this$1.children.slice(); }\n while (childIndex < children.length && children[childIndex] < childOffset) { childIndex += 3; }\n if (children[childIndex] == childOffset)\n { children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1); }\n else\n { children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec)); }\n childIndex += 3;\n });\n\n var local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);\n return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local,\n children || this.children)\n};\n\n// :: ([Decoration]) → DecorationSet\n// Create a new set that contains the decorations in this set, minus\n// the ones in the given array.\nDecorationSet.prototype.remove = function remove (decorations) {\n if (decorations.length == 0 || this == empty) { return this }\n return this.removeInner(decorations, 0)\n};\n\nDecorationSet.prototype.removeInner = function removeInner (decorations, offset) {\n var children = this.children, local = this.local;\n for (var i = 0; i < children.length; i += 3) {\n var found = (void 0), from = children[i] + offset, to = children[i + 1] + offset;\n for (var j = 0, span = (void 0); j < decorations.length; j++) { if (span = decorations[j]) {\n if (span.from > from && span.to < to) {\n decorations[j] = null\n ;(found || (found = [])).push(span);\n }\n } }\n if (!found) { continue }\n if (children == this.children) { children = this.children.slice(); }\n var removed = children[i + 2].removeInner(found, from + 1);\n if (removed != empty) {\n children[i + 2] = removed;\n } else {\n children.splice(i, 3);\n i -= 3;\n }\n }\n if (local.length) { for (var i$1 = 0, span$1 = (void 0); i$1 < decorations.length; i$1++) { if (span$1 = decorations[i$1]) {\n for (var j$1 = 0; j$1 < local.length; j$1++) { if (local[j$1].eq(span$1, offset)) {\n if (local == this.local) { local = this.local.slice(); }\n local.splice(j$1--, 1);\n } }\n } } }\n if (children == this.children && local == this.local) { return this }\n return local.length || children.length ? new DecorationSet(local, children) : empty\n};\n\nDecorationSet.prototype.forChild = function forChild (offset, node) {\n if (this == empty) { return this }\n if (node.isLeaf) { return DecorationSet.empty }\n\n var child, local;\n for (var i = 0; i < this.children.length; i += 3) { if (this.children[i] >= offset) {\n if (this.children[i] == offset) { child = this.children[i + 2]; }\n break\n } }\n var start = offset + 1, end = start + node.content.size;\n for (var i$1 = 0; i$1 < this.local.length; i$1++) {\n var dec = this.local[i$1];\n if (dec.from < end && dec.to > start && (dec.type instanceof InlineType)) {\n var from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;\n if (from < to) { (local || (local = [])).push(dec.copy(from, to)); }\n }\n }\n if (local) {\n var localSet = new DecorationSet(local.sort(byPos));\n return child ? new DecorationGroup([localSet, child]) : localSet\n }\n return child || empty\n};\n\nDecorationSet.prototype.eq = function eq (other) {\n if (this == other) { return true }\n if (!(other instanceof DecorationSet) ||\n this.local.length != other.local.length ||\n this.children.length != other.children.length) { return false }\n for (var i = 0; i < this.local.length; i++)\n { if (!this.local[i].eq(other.local[i])) { return false } }\n for (var i$1 = 0; i$1 < this.children.length; i$1 += 3)\n { if (this.children[i$1] != other.children[i$1] ||\n this.children[i$1 + 1] != other.children[i$1 + 1] ||\n !this.children[i$1 + 2].eq(other.children[i$1 + 2])) { return false } }\n return true\n};\n\nDecorationSet.prototype.locals = function locals (node) {\n return removeOverlap(this.localsInner(node))\n};\n\nDecorationSet.prototype.localsInner = function localsInner (node) {\n if (this == empty) { return none }\n if (node.inlineContent || !this.local.some(InlineType.is)) { return this.local }\n var result = [];\n for (var i = 0; i < this.local.length; i++) {\n if (!(this.local[i].type instanceof InlineType))\n { result.push(this.local[i]); }\n }\n return result\n};\n\nvar empty = new DecorationSet();\n\n// :: DecorationSet\n// The empty set of decorations.\nDecorationSet.empty = empty;\n\nDecorationSet.removeOverlap = removeOverlap;\n\n// :- An abstraction that allows the code dealing with decorations to\n// treat multiple DecorationSet objects as if it were a single object\n// with (a subset of) the same interface.\nvar DecorationGroup = function DecorationGroup(members) {\n this.members = members;\n};\n\nDecorationGroup.prototype.forChild = function forChild (offset, child) {\n if (child.isLeaf) { return DecorationSet.empty }\n var found = [];\n for (var i = 0; i < this.members.length; i++) {\n var result = this.members[i].forChild(offset, child);\n if (result == empty) { continue }\n if (result instanceof DecorationGroup) { found = found.concat(result.members); }\n else { found.push(result); }\n }\n return DecorationGroup.from(found)\n};\n\nDecorationGroup.prototype.eq = function eq (other) {\n if (!(other instanceof DecorationGroup) ||\n other.members.length != this.members.length) { return false }\n for (var i = 0; i < this.members.length; i++)\n { if (!this.members[i].eq(other.members[i])) { return false } }\n return true\n};\n\nDecorationGroup.prototype.locals = function locals (node) {\n var result, sorted = true;\n for (var i = 0; i < this.members.length; i++) {\n var locals = this.members[i].localsInner(node);\n if (!locals.length) { continue }\n if (!result) {\n result = locals;\n } else {\n if (sorted) {\n result = result.slice();\n sorted = false;\n }\n for (var j = 0; j < locals.length; j++) { result.push(locals[j]); }\n }\n }\n return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none\n};\n\n// : ([DecorationSet]) → union<DecorationSet, DecorationGroup>\n// Create a group for the given array of decoration sets, or return\n// a single set when possible.\nDecorationGroup.from = function from (members) {\n switch (members.length) {\n case 0: return empty\n case 1: return members[0]\n default: return new DecorationGroup(members)\n }\n};\n\nfunction mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {\n var children = oldChildren.slice();\n\n // Mark the children that are directly touched by changes, and\n // move those that are after the changes.\n var shift = function (oldStart, oldEnd, newStart, newEnd) {\n for (var i = 0; i < children.length; i += 3) {\n var end = children[i + 1], dSize = (void 0);\n if (end == -1 || oldStart > end + oldOffset) { continue }\n if (oldEnd >= children[i] + oldOffset) {\n children[i + 1] = -1;\n } else if (dSize = (newEnd - newStart) - (oldEnd - oldStart) + (oldOffset - offset)) {\n children[i] += dSize;\n children[i + 1] += dSize;\n }\n }\n };\n for (var i = 0; i < mapping.maps.length; i++) { mapping.maps[i].forEach(shift); }\n\n // Find the child nodes that still correspond to a single node,\n // recursively call mapInner on them and update their positions.\n var mustRebuild = false;\n for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] == -1) { // Touched nodes\n var from = mapping.map(children[i$1] + oldOffset), fromLocal = from - offset;\n if (fromLocal < 0 || fromLocal >= node.content.size) {\n mustRebuild = true;\n continue\n }\n // Must read oldChildren because children was tagged with -1\n var to = mapping.map(oldChildren[i$1 + 1] + oldOffset, -1), toLocal = to - offset;\n var ref = node.content.findIndex(fromLocal);\n var index = ref.index;\n var childOffset = ref.offset;\n var childNode = node.maybeChild(index);\n if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {\n var mapped = children[i$1 + 2].mapInner(mapping, childNode, from + 1, children[i$1] + oldOffset + 1, options);\n if (mapped != empty) {\n children[i$1] = fromLocal;\n children[i$1 + 1] = toLocal;\n children[i$1 + 2] = mapped;\n } else {\n children[i$1 + 1] = -2;\n mustRebuild = true;\n }\n } else {\n mustRebuild = true;\n }\n } }\n\n // Remaining children must be collected and rebuilt into the appropriate structure\n if (mustRebuild) {\n var decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal || [], mapping,\n offset, oldOffset, options);\n var built = buildTree(decorations, node, 0, options);\n newLocal = built.local;\n for (var i$2 = 0; i$2 < children.length; i$2 += 3) { if (children[i$2 + 1] < 0) {\n children.splice(i$2, 3);\n i$2 -= 3;\n } }\n for (var i$3 = 0, j = 0; i$3 < built.children.length; i$3 += 3) {\n var from$1 = built.children[i$3];\n while (j < children.length && children[j] < from$1) { j += 3; }\n children.splice(j, 0, built.children[i$3], built.children[i$3 + 1], built.children[i$3 + 2]);\n }\n }\n\n return new DecorationSet(newLocal && newLocal.sort(byPos), children)\n}\n\nfunction moveSpans(spans, offset) {\n if (!offset || !spans.length) { return spans }\n var result = [];\n for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n result.push(new Decoration(span.from + offset, span.to + offset, span.type));\n }\n return result\n}\n\nfunction mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {\n // Gather all decorations from the remaining marked children\n function gather(set, oldOffset) {\n for (var i = 0; i < set.local.length; i++) {\n var mapped = set.local[i].map(mapping, offset, oldOffset);\n if (mapped) { decorations.push(mapped); }\n else if (options.onRemove) { options.onRemove(set.local[i].spec); }\n }\n for (var i$1 = 0; i$1 < set.children.length; i$1 += 3)\n { gather(set.children[i$1 + 2], set.children[i$1] + oldOffset + 1); }\n }\n for (var i = 0; i < children.length; i += 3) { if (children[i + 1] == -1)\n { gather(children[i + 2], oldChildren[i] + oldOffset + 1); } }\n\n return decorations\n}\n\nfunction takeSpansForNode(spans, node, offset) {\n if (node.isLeaf) { return null }\n var end = offset + node.nodeSize, found = null;\n for (var i = 0, span = (void 0); i < spans.length; i++) {\n if ((span = spans[i]) && span.from > offset && span.to < end) {\n(found || (found = [])).push(span);\n spans[i] = null;\n }\n }\n return found\n}\n\nfunction withoutNulls(array) {\n var result = [];\n for (var i = 0; i < array.length; i++)\n { if (array[i] != null) { result.push(array[i]); } }\n return result\n}\n\n// : ([Decoration], Node, number) → DecorationSet\n// Build up a tree that corresponds to a set of decorations. `offset`\n// is a base offset that should be subtractet from the `from` and `to`\n// positions in the spans (so that we don't have to allocate new spans\n// for recursive calls).\nfunction buildTree(spans, node, offset, options) {\n var children = [], hasNulls = false;\n node.forEach(function (childNode, localStart) {\n var found = takeSpansForNode(spans, childNode, localStart + offset);\n if (found) {\n hasNulls = true;\n var subtree = buildTree(found, childNode, offset + localStart + 1, options);\n if (subtree != empty)\n { children.push(localStart, localStart + childNode.nodeSize, subtree); }\n }\n });\n var locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);\n for (var i = 0; i < locals.length; i++) { if (!locals[i].type.valid(node, locals[i])) {\n if (options.onRemove) { options.onRemove(locals[i].spec); }\n locals.splice(i--, 1);\n } }\n return locals.length || children.length ? new DecorationSet(locals, children) : empty\n}\n\n// : (Decoration, Decoration) → number\n// Used to sort decorations so that ones with a low start position\n// come first, and within a set with the same start position, those\n// with an smaller end position come first.\nfunction byPos(a, b) {\n return a.from - b.from || a.to - b.to\n}\n\n// : ([Decoration]) → [Decoration]\n// Scan a sorted array of decorations for partially overlapping spans,\n// and split those so that only fully overlapping spans are left (to\n// make subsequent rendering easier). Will return the input array if\n// no partially overlapping spans are found (the common case).\nfunction removeOverlap(spans) {\n var working = spans;\n for (var i = 0; i < working.length - 1; i++) {\n var span = working[i];\n if (span.from != span.to) { for (var j = i + 1; j < working.length; j++) {\n var next = working[j];\n if (next.from == span.from) {\n if (next.to != span.to) {\n if (working == spans) { working = spans.slice(); }\n // Followed by a partially overlapping larger span. Split that\n // span.\n working[j] = next.copy(next.from, span.to);\n insertAhead(working, j + 1, next.copy(span.to, next.to));\n }\n continue\n } else {\n if (next.from < span.to) {\n if (working == spans) { working = spans.slice(); }\n // The end of this one overlaps with a subsequent span. Split\n // this one.\n working[i] = span.copy(span.from, next.from);\n insertAhead(working, j, span.copy(next.from, span.to));\n }\n break\n }\n } }\n }\n return working\n}\n\nfunction insertAhead(array, i, deco) {\n while (i < array.length && byPos(deco, array[i]) > 0) { i++; }\n array.splice(i, 0, deco);\n}\n\n// : (EditorView) → union<DecorationSet, DecorationGroup>\n// Get the decorations associated with the current props of a view.\nfunction viewDecorations(view) {\n var found = [];\n view.someProp(\"decorations\", function (f) {\n var result = f(view.state);\n if (result && result != empty) { found.push(result); }\n });\n if (view.cursorWrapper)\n { found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco])); }\n return DecorationGroup.from(found)\n}\n\n// ::- An editor view manages the DOM structure that represents an\n// editable document. Its state and behavior are determined by its\n// [props](#view.DirectEditorProps).\nvar EditorView = function EditorView(place, props) {\n this._props = props;\n // :: EditorState\n // The view's current [state](#state.EditorState).\n this.state = props.state;\n\n this.dispatch = this.dispatch.bind(this);\n\n this._root = null;\n this.focused = false;\n\n // :: dom.Element\n // An editable DOM node containing the document. (You probably\n // should not directly interfere with its content.)\n this.dom = (place && place.mount) || document.createElement(\"div\");\n if (place) {\n if (place.appendChild) { place.appendChild(this.dom); }\n else if (place.apply) { place(this.dom); }\n else if (place.mount) { this.mounted = true; }\n }\n\n // :: bool\n // Indicates whether the editor is currently [editable](#view.EditorProps.editable).\n this.editable = getEditable(this);\n this.markCursor = null;\n this.cursorWrapper = null;\n updateCursorWrapper(this);\n this.nodeViews = buildNodeViews(this);\n this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);\n\n this.lastSelectedViewDesc = null;\n // :: ?{slice: Slice, move: bool}\n // When editor content is being dragged, this object contains\n // information about the dragged slice and whether it is being\n // copied or moved. At any other time, it is null.\n this.dragging = null;\n\n initInput(this);\n\n this.pluginViews = [];\n this.updatePluginViews();\n};\n\nvar prototypeAccessors$2 = { props: { configurable: true },root: { configurable: true } };\n\n// composing:: boolean\n// Holds `true` when a\n// [composition](https://developer.mozilla.org/en-US/docs/Mozilla/IME_handling_guide)\n// is active.\n\n// :: DirectEditorProps\n// The view's current [props](#view.EditorProps).\nprototypeAccessors$2.props.get = function () {\n if (this._props.state != this.state) {\n var prev = this._props;\n this._props = {};\n for (var name in prev) { this._props[name] = prev[name]; }\n this._props.state = this.state;\n }\n return this._props\n};\n\n// :: (DirectEditorProps)\n// Update the view's props. Will immediately cause an update to\n// the DOM.\nEditorView.prototype.update = function update (props) {\n if (props.handleDOMEvents != this._props.handleDOMEvents) { ensureListeners(this); }\n this._props = props;\n this.updateStateInner(props.state, true);\n};\n\n// :: (DirectEditorProps)\n// Update the view by updating existing props object with the object\n// given as argument. Equivalent to `view.update(Object.assign({},\n// view.props, props))`.\nEditorView.prototype.setProps = function setProps (props) {\n var updated = {};\n for (var name in this._props) { updated[name] = this._props[name]; }\n updated.state = this.state;\n for (var name$1 in props) { updated[name$1] = props[name$1]; }\n this.update(updated);\n};\n\n// :: (EditorState)\n// Update the editor's `state` prop, without touching any of the\n// other props.\nEditorView.prototype.updateState = function updateState (state) {\n this.updateStateInner(state, this.state.plugins != state.plugins);\n};\n\nEditorView.prototype.updateStateInner = function updateStateInner (state, reconfigured) {\n var this$1 = this;\n\n var prev = this.state, redraw = false;\n this.state = state;\n if (reconfigured) {\n var nodeViews = buildNodeViews(this);\n if (changedNodeViews(nodeViews, this.nodeViews)) {\n this.nodeViews = nodeViews;\n redraw = true;\n }\n ensureListeners(this);\n }\n\n this.editable = getEditable(this);\n updateCursorWrapper(this);\n var innerDeco = viewDecorations(this), outerDeco = computeDocDeco(this);\n\n var scroll = reconfigured ? \"reset\"\n : state.scrollToSelection > prev.scrollToSelection ? \"to selection\" : \"preserve\";\n var updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);\n var updateSel = updateDoc || !state.selection.eq(prev.selection);\n var oldScrollPos = scroll == \"preserve\" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);\n\n if (updateSel) {\n this.domObserver.stop();\n // Work around an issue in Chrome, IE, and Edge where changing\n // the DOM around an active selection puts it into a broken\n // state where the thing the user sees differs from the\n // selection reported by the Selection object (#710, #973,\n // #1011, #1013, #1035).\n var forceSelUpdate = updateDoc && (result.ie || result.chrome) && !this.composing &&\n !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);\n if (updateDoc) {\n var selContext = result.chrome && selectionContext(this.root);\n if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {\n this.docView.updateOuterDeco([]);\n this.docView.destroy();\n this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);\n }\n if (selContext && needChromeSelectionReset(selContext, this.root)) { forceSelUpdate = true; }\n }\n // Work around for an issue where an update arriving right between\n // a DOM selection change and the \"selectionchange\" event for it\n // can cause a spurious DOM selection update, disrupting mouse\n // drag selection.\n if (forceSelUpdate ||\n !(this.mouseDown && this.domObserver.currentSelection.eq(this.root.getSelection()) && anchorInRightPlace(this))) {\n selectionToDOM(this, forceSelUpdate);\n } else {\n syncNodeSelection(this, state.selection);\n this.domObserver.setCurSelection();\n }\n this.domObserver.start();\n }\n\n this.updatePluginViews(prev);\n\n if (scroll == \"reset\") {\n this.dom.scrollTop = 0;\n } else if (scroll == \"to selection\") {\n var startDOM = this.root.getSelection().focusNode;\n if (this.someProp(\"handleScrollToSelection\", function (f) { return f(this$1); }))\n ; // Handled\n else if (state.selection instanceof NodeSelection)\n { scrollRectIntoView(this, this.docView.domAfterPos(state.selection.from).getBoundingClientRect(), startDOM); }\n else\n { scrollRectIntoView(this, this.coordsAtPos(state.selection.head), startDOM); }\n } else if (oldScrollPos) {\n resetScrollPos(oldScrollPos);\n }\n};\n\nEditorView.prototype.destroyPluginViews = function destroyPluginViews () {\n var view;\n while (view = this.pluginViews.pop()) { if (view.destroy) { view.destroy(); } }\n};\n\nEditorView.prototype.updatePluginViews = function updatePluginViews (prevState) {\n if (!prevState || prevState.plugins != this.state.plugins) {\n this.destroyPluginViews();\n for (var i = 0; i < this.state.plugins.length; i++) {\n var plugin = this.state.plugins[i];\n if (plugin.spec.view) { this.pluginViews.push(plugin.spec.view(this)); }\n }\n } else {\n for (var i$1 = 0; i$1 < this.pluginViews.length; i$1++) {\n var pluginView = this.pluginViews[i$1];\n if (pluginView.update) { pluginView.update(this, prevState); }\n }\n }\n};\n\n// :: (string, ?(prop: *) → *) → *\n// Goes over the values of a prop, first those provided directly,\n// then those from plugins (in order), and calls `f` every time a\n// non-undefined value is found. When `f` returns a truthy value,\n// that is immediately returned. When `f` isn't provided, it is\n// treated as the identity function (the prop value is returned\n// directly).\nEditorView.prototype.someProp = function someProp (propName, f) {\n var prop = this._props && this._props[propName], value;\n if (prop != null && (value = f ? f(prop) : prop)) { return value }\n var plugins = this.state.plugins;\n if (plugins) { for (var i = 0; i < plugins.length; i++) {\n var prop$1 = plugins[i].props[propName];\n if (prop$1 != null && (value = f ? f(prop$1) : prop$1)) { return value }\n } }\n};\n\n// :: () → bool\n// Query whether the view has focus.\nEditorView.prototype.hasFocus = function hasFocus () {\n return this.root.activeElement == this.dom\n};\n\n// :: ()\n// Focus the editor.\nEditorView.prototype.focus = function focus () {\n this.domObserver.stop();\n if (this.editable) { focusPreventScroll(this.dom); }\n selectionToDOM(this);\n this.domObserver.start();\n};\n\n// :: union<dom.Document, dom.DocumentFragment>\n// Get the document root in which the editor exists. This will\n// usually be the top-level `document`, but might be a [shadow\n// DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)\n// root if the editor is inside one.\nprototypeAccessors$2.root.get = function () {\n var cached = this._root;\n if (cached == null) { for (var search = this.dom.parentNode; search; search = search.parentNode) {\n if (search.nodeType == 9 || (search.nodeType == 11 && search.host)) {\n if (!search.getSelection) { Object.getPrototypeOf(search).getSelection = function () { return document.getSelection(); }; }\n return this._root = search\n }\n } }\n return cached || document\n};\n\n// :: ({left: number, top: number}) → ?{pos: number, inside: number}\n// Given a pair of viewport coordinates, return the document\n// position that corresponds to them. May return null if the given\n// coordinates aren't inside of the editor. When an object is\n// returned, its `pos` property is the position nearest to the\n// coordinates, and its `inside` property holds the position of the\n// inner node that the position falls inside of, or -1 if it is at\n// the top level, not in any node.\nEditorView.prototype.posAtCoords = function posAtCoords$1 (coords) {\n return posAtCoords(this, coords)\n};\n\n// :: (number) → {left: number, right: number, top: number, bottom: number}\n// Returns the viewport rectangle at a given document position. `left`\n// and `right` will be the same number, as this returns a flat\n// cursor-ish rectangle.\nEditorView.prototype.coordsAtPos = function coordsAtPos$1 (pos) {\n return coordsAtPos(this, pos)\n};\n\n// :: (number) → {node: dom.Node, offset: number}\n// Find the DOM position that corresponds to the given document\n// position. Note that you should **not** mutate the editor's\n// internal DOM, only inspect it (and even that is usually not\n// necessary).\nEditorView.prototype.domAtPos = function domAtPos (pos) {\n return this.docView.domFromPos(pos)\n};\n\n// :: (number) → ?dom.Node\n// Find the DOM node that represents the document node after the\n// given position. May return `null` when the position doesn't point\n// in front of a node or if the node is inside an opaque node view.\n//\n// This is intended to be able to call things like\n// `getBoundingClientRect` on that DOM node. Do **not** mutate the\n// editor DOM directly, or add styling this way, since that will be\n// immediately overriden by the editor as it redraws the node.\nEditorView.prototype.nodeDOM = function nodeDOM (pos) {\n var desc = this.docView.descAt(pos);\n return desc ? desc.nodeDOM : null\n};\n\n// :: (dom.Node, number, ?number) → number\n// Find the document position that corresponds to a given DOM\n// position. (Whenever possible, it is preferable to inspect the\n// document structure directly, rather than poking around in the\n// DOM, but sometimes—for example when interpreting an event\n// target—you don't have a choice.)\n//\n// The `bias` parameter can be used to influence which side of a DOM\n// node to use when the position is inside a leaf node.\nEditorView.prototype.posAtDOM = function posAtDOM (node, offset, bias) {\n if ( bias === void 0 ) bias = -1;\n\n var pos = this.docView.posFromDOM(node, offset, bias);\n if (pos == null) { throw new RangeError(\"DOM position not inside the editor\") }\n return pos\n};\n\n// :: (union<\"up\", \"down\", \"left\", \"right\", \"forward\", \"backward\">, ?EditorState) → bool\n// Find out whether the selection is at the end of a textblock when\n// moving in a given direction. When, for example, given `\"left\"`,\n// it will return true if moving left from the current cursor\n// position would leave that position's parent textblock. Will apply\n// to the view's current state by default, but it is possible to\n// pass a different state.\nEditorView.prototype.endOfTextblock = function endOfTextblock$1 (dir, state) {\n return endOfTextblock(this, state || this.state, dir)\n};\n\n// :: ()\n// Removes the editor from the DOM and destroys all [node\n// views](#view.NodeView).\nEditorView.prototype.destroy = function destroy () {\n if (!this.docView) { return }\n destroyInput(this);\n this.destroyPluginViews();\n if (this.mounted) {\n this.docView.update(this.state.doc, [], viewDecorations(this), this);\n this.dom.textContent = \"\";\n } else if (this.dom.parentNode) {\n this.dom.parentNode.removeChild(this.dom);\n }\n this.docView.destroy();\n this.docView = null;\n};\n\n// Used for testing.\nEditorView.prototype.dispatchEvent = function dispatchEvent$1 (event) {\n return dispatchEvent(this, event)\n};\n\n// :: (Transaction)\n// Dispatch a transaction. Will call\n// [`dispatchTransaction`](#view.DirectEditorProps.dispatchTransaction)\n// when given, and otherwise defaults to applying the transaction to\n// the current state and calling\n// [`updateState`](#view.EditorView.updateState) with the result.\n// This method is bound to the view instance, so that it can be\n// easily passed around.\nEditorView.prototype.dispatch = function dispatch (tr) {\n var dispatchTransaction = this._props.dispatchTransaction;\n if (dispatchTransaction) { dispatchTransaction.call(this, tr); }\n else { this.updateState(this.state.apply(tr)); }\n};\n\nObject.defineProperties( EditorView.prototype, prototypeAccessors$2 );\n\nfunction computeDocDeco(view) {\n var attrs = Object.create(null);\n attrs.class = \"ProseMirror\";\n attrs.contenteditable = String(view.editable);\n\n view.someProp(\"attributes\", function (value) {\n if (typeof value == \"function\") { value = value(view.state); }\n if (value) { for (var attr in value) {\n if (attr == \"class\")\n { attrs.class += \" \" + value[attr]; }\n else if (!attrs[attr] && attr != \"contenteditable\" && attr != \"nodeName\")\n { attrs[attr] = String(value[attr]); }\n } }\n });\n\n return [Decoration.node(0, view.state.doc.content.size, attrs)]\n}\n\nfunction updateCursorWrapper(view) {\n if (view.markCursor) {\n var dom = document.createElement(\"img\");\n dom.setAttribute(\"mark-placeholder\", \"true\");\n view.cursorWrapper = {dom: dom, deco: Decoration.widget(view.state.selection.head, dom, {raw: true, marks: view.markCursor})};\n } else {\n view.cursorWrapper = null;\n }\n}\n\nfunction getEditable(view) {\n return !view.someProp(\"editable\", function (value) { return value(view.state) === false; })\n}\n\nfunction selectionContextChanged(sel1, sel2) {\n var depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));\n return sel1.$anchor.start(depth) != sel2.$anchor.start(depth)\n}\n\nfunction buildNodeViews(view) {\n var result = {};\n view.someProp(\"nodeViews\", function (obj) {\n for (var prop in obj) { if (!Object.prototype.hasOwnProperty.call(result, prop))\n { result[prop] = obj[prop]; } }\n });\n return result\n}\n\nfunction changedNodeViews(a, b) {\n var nA = 0, nB = 0;\n for (var prop in a) {\n if (a[prop] != b[prop]) { return true }\n nA++;\n }\n for (var _ in b) { nB++; }\n return nA != nB\n}\n\nfunction selectionContext(root) {\n var ref = root.getSelection();\n var offset = ref.focusOffset;\n var node = ref.focusNode;\n return node && node.nodeType == 1 ? [node, offset, node.childNodes[offset - 1], node.childNodes[offset]] : null\n}\n\nfunction needChromeSelectionReset(context, root) {\n var newContext = selectionContext(root);\n if (!newContext || newContext[0].nodeType == 3) { return false }\n for (var i = 0; i < context.length; i++) { if (newContext[i] != context[i]) { return true } }\n return false\n}\n\n// EditorProps:: interface\n//\n// Props are configuration values that can be passed to an editor view\n// or included in a plugin. This interface lists the supported props.\n//\n// The various event-handling functions may all return `true` to\n// indicate that they handled the given event. The view will then take\n// care to call `preventDefault` on the event, except with\n// `handleDOMEvents`, where the handler itself is responsible for that.\n//\n// How a prop is resolved depends on the prop. Handler functions are\n// called one at a time, starting with the base props and then\n// searching through the plugins (in order of appearance) until one of\n// them returns true. For some props, the first plugin that yields a\n// value gets precedence.\n//\n// handleDOMEvents:: ?Object<(view: EditorView, event: dom.Event) → bool>\n// Can be an object mapping DOM event type names to functions that\n// handle them. Such functions will be called before any handling\n// ProseMirror does of events fired on the editable DOM element.\n// Contrary to the other event handling props, when returning true\n// from such a function, you are responsible for calling\n// `preventDefault` yourself (or not, if you want to allow the\n// default behavior).\n//\n// handleKeyDown:: ?(view: EditorView, event: dom.KeyboardEvent) → bool\n// Called when the editor receives a `keydown` event.\n//\n// handleKeyPress:: ?(view: EditorView, event: dom.KeyboardEvent) → bool\n// Handler for `keypress` events.\n//\n// handleTextInput:: ?(view: EditorView, from: number, to: number, text: string) → bool\n// Whenever the user directly input text, this handler is called\n// before the input is applied. If it returns `true`, the default\n// behavior of actually inserting the text is suppressed.\n//\n// handleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n// Called for each node around a click, from the inside out. The\n// `direct` flag will be true for the inner node.\n//\n// handleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n// Called when the editor is clicked, after `handleClickOn` handlers\n// have been called.\n//\n// handleDoubleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n// Called for each node around a double click.\n//\n// handleDoubleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n// Called when the editor is double-clicked, after `handleDoubleClickOn`.\n//\n// handleTripleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n// Called for each node around a triple click.\n//\n// handleTripleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n// Called when the editor is triple-clicked, after `handleTripleClickOn`.\n//\n// handlePaste:: ?(view: EditorView, event: dom.Event, slice: Slice) → bool\n// Can be used to override the behavior of pasting. `slice` is the\n// pasted content parsed by the editor, but you can directly access\n// the event to get at the raw content.\n//\n// handleDrop:: ?(view: EditorView, event: dom.Event, slice: Slice, moved: bool) → bool\n// Called when something is dropped on the editor. `moved` will be\n// true if this drop moves from the current selection (which should\n// thus be deleted).\n//\n// handleScrollToSelection:: ?(view: EditorView) → bool\n// Called when the view, after updating its state, tries to scroll\n// the selection into view. A handler function may return false to\n// indicate that it did not handle the scrolling and further\n// handlers or the default behavior should be tried.\n//\n// createSelectionBetween:: ?(view: EditorView, anchor: ResolvedPos, head: ResolvedPos) → ?Selection\n// Can be used to override the way a selection is created when\n// reading a DOM selection between the given anchor and head.\n//\n// domParser:: ?DOMParser\n// The [parser](#model.DOMParser) to use when reading editor changes\n// from the DOM. Defaults to calling\n// [`DOMParser.fromSchema`](#model.DOMParser^fromSchema) on the\n// editor's schema.\n//\n// transformPastedHTML:: ?(html: string) → string\n// Can be used to transform pasted HTML text, _before_ it is parsed,\n// for example to clean it up.\n//\n// clipboardParser:: ?DOMParser\n// The [parser](#model.DOMParser) to use when reading content from\n// the clipboard. When not given, the value of the\n// [`domParser`](#view.EditorProps.domParser) prop is used.\n//\n// transformPastedText:: ?(text: string) → string\n// Transform pasted plain text.\n//\n// clipboardTextParser:: ?(text: string, $context: ResolvedPos) → Slice\n// A function to parse text from the clipboard into a document\n// slice. Called after\n// [`transformPastedText`](#view.EditorProps.transformPastedText).\n// The default behavior is to split the text into lines, wrap them\n// in `<p>` tags, and call\n// [`clipboardParser`](#view.EditorProps.clipboardParser) on it.\n//\n// transformPasted:: ?(Slice) → Slice\n// Can be used to transform pasted content before it is applied to\n// the document.\n//\n// nodeViews:: ?Object<(node: Node, view: EditorView, getPos: () → number, decorations: [Decoration]) → NodeView>\n// Allows you to pass custom rendering and behavior logic for nodes\n// and marks. Should map node and mark names to constructor\n// functions that produce a [`NodeView`](#view.NodeView) object\n// implementing the node's display behavior. For nodes, the third\n// argument `getPos` is a function that can be called to get the\n// node's current position, which can be useful when creating\n// transactions to update it. For marks, the third argument is a\n// boolean that indicates whether the mark's content is inline.\n//\n// `decorations` is an array of node or inline decorations that are\n// active around the node. They are automatically drawn in the\n// normal way, and you will usually just want to ignore this, but\n// they can also be used as a way to provide context information to\n// the node view without adding it to the document itself.\n//\n// clipboardSerializer:: ?DOMSerializer\n// The DOM serializer to use when putting content onto the\n// clipboard. If not given, the result of\n// [`DOMSerializer.fromSchema`](#model.DOMSerializer^fromSchema)\n// will be used.\n//\n// clipboardTextSerializer:: ?(Slice) → string\n// A function that will be called to get the text for the current\n// selection when copying text to the clipboard. By default, the\n// editor will use [`textBetween`](#model.Node.textBetween) on the\n// selected range.\n//\n// decorations:: ?(state: EditorState) → ?DecorationSet\n// A set of [document decorations](#view.Decoration) to show in the\n// view.\n//\n// editable:: ?(state: EditorState) → bool\n// When this returns false, the content of the view is not directly\n// editable.\n//\n// attributes:: ?union<Object<string>, (EditorState) → ?Object<string>>\n// Control the DOM attributes of the editable element. May be either\n// an object or a function going from an editor state to an object.\n// By default, the element will get a class `\"ProseMirror\"`, and\n// will have its `contentEditable` attribute determined by the\n// [`editable` prop](#view.EditorProps.editable). Additional classes\n// provided here will be added to the class. For other attributes,\n// the value provided first (as in\n// [`someProp`](#view.EditorView.someProp)) will be used.\n//\n// scrollThreshold:: ?union<number, {top: number, right: number, bottom: number, left: number}>\n// Determines the distance (in pixels) between the cursor and the\n// end of the visible viewport at which point, when scrolling the\n// cursor into view, scrolling takes place. Defaults to 0.\n//\n// scrollMargin:: ?union<number, {top: number, right: number, bottom: number, left: number}>\n// Determines the extra space (in pixels) that is left above or\n// below the cursor when it is scrolled into view. Defaults to 5.\n\n// DirectEditorProps:: interface extends EditorProps\n//\n// The props object given directly to the editor view supports two\n// fields that can't be used in plugins:\n//\n// state:: EditorState\n// The current state of the editor.\n//\n// dispatchTransaction:: ?(tr: Transaction)\n// The callback over which to send transactions (state updates)\n// produced by the view. If you specify this, you probably want to\n// make sure this ends up calling the view's\n// [`updateState`](#view.EditorView.updateState) method with a new\n// state that has the transaction\n// [applied](#state.EditorState.apply). The callback will be bound to have\n// the view instance as its `this` binding.\n\nexport { Decoration, DecorationSet, EditorView, endComposition as __endComposition, parseFromClipboard as __parseFromClipboard, serializeForClipboard as __serializeForClipboard };\n//# sourceMappingURL=index.es.js.map\n","/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n","import { PluginKey, Plugin, TextSelection } from 'prosemirror-state';\n\nvar Rebaseable = function Rebaseable(step, inverted, origin) {\n this.step = step;\n this.inverted = inverted;\n this.origin = origin;\n};\n\n// : ([Rebaseable], [Step], Transform) → [Rebaseable]\n// Undo a given set of steps, apply a set of other steps, and then\n// redo them.\nfunction rebaseSteps(steps, over, transform) {\n for (var i = steps.length - 1; i >= 0; i--) { transform.step(steps[i].inverted); }\n for (var i$1 = 0; i$1 < over.length; i$1++) { transform.step(over[i$1]); }\n var result = [];\n for (var i$2 = 0, mapFrom = steps.length; i$2 < steps.length; i$2++) {\n var mapped = steps[i$2].step.map(transform.mapping.slice(mapFrom));\n mapFrom--;\n if (mapped && !transform.maybeStep(mapped).failed) {\n transform.mapping.setMirror(mapFrom, transform.steps.length - 1);\n result.push(new Rebaseable(mapped, mapped.invert(transform.docs[transform.docs.length - 1]), steps[i$2].origin));\n }\n }\n return result\n}\n\n// This state field accumulates changes that have to be sent to the\n// central authority in the collaborating group and makes it possible\n// to integrate changes made by peers into our local document. It is\n// defined by the plugin, and will be available as the `collab` field\n// in the resulting editor state.\nvar CollabState = function CollabState(version, unconfirmed) {\n // : number\n // The version number of the last update received from the central\n // authority. Starts at 0 or the value of the `version` property\n // in the option object, for the editor's value when the option\n // was enabled.\n this.version = version;\n\n // : [Rebaseable]\n // The local steps that havent been successfully sent to the\n // server yet.\n this.unconfirmed = unconfirmed;\n};\n\nfunction unconfirmedFrom(transform) {\n var result = [];\n for (var i = 0; i < transform.steps.length; i++)\n { result.push(new Rebaseable(transform.steps[i],\n transform.steps[i].invert(transform.docs[i]),\n transform)); }\n return result\n}\n\nvar collabKey = new PluginKey(\"collab\");\n\n// :: (?Object) → Plugin\n//\n// Creates a plugin that enables the collaborative editing framework\n// for the editor.\n//\n// config::- An optional set of options\n//\n// version:: ?number\n// The starting version number of the collaborative editing.\n// Defaults to 0.\n//\n// clientID:: ?union<number, string>\n// This client's ID, used to distinguish its changes from those of\n// other clients. Defaults to a random 32-bit number.\nfunction collab(config) {\n if ( config === void 0 ) config = {};\n\n config = {version: config.version || 0,\n clientID: config.clientID == null ? Math.floor(Math.random() * 0xFFFFFFFF) : config.clientID};\n\n return new Plugin({\n key: collabKey,\n\n state: {\n init: function () { return new CollabState(config.version, []); },\n apply: function apply(tr, collab) {\n var newState = tr.getMeta(collabKey);\n if (newState)\n { return newState }\n if (tr.docChanged)\n { return new CollabState(collab.version, collab.unconfirmed.concat(unconfirmedFrom(tr))) }\n return collab\n }\n },\n\n config: config,\n // This is used to notify the history plugin to not merge steps,\n // so that the history can be rebased.\n historyPreserveItems: true\n })\n}\n\n// :: (state: EditorState, steps: [Step], clientIDs: [union<number, string>], options: ?Object) → Transaction\n// Create a transaction that represents a set of new steps received from\n// the authority. Applying this transaction moves the state forward to\n// adjust to the authority's view of the document.\n//\n// options::- Additional options.\n//\n// mapSelectionBackward:: ?boolean\n// When enabled (the default is `false`), if the current selection\n// is a [text selection](#state.TextSelection), its sides are\n// mapped with a negative bias for this transaction, so that\n// content inserted at the cursor ends up after the cursor. Users\n// usually prefer this, but it isn't done by default for reasons\n// of backwards compatibility.\nfunction receiveTransaction(state, steps, clientIDs, options) {\n // Pushes a set of steps (received from the central authority) into\n // the editor state (which should have the collab plugin enabled).\n // Will recognize its own changes, and confirm unconfirmed steps as\n // appropriate. Remaining unconfirmed steps will be rebased over\n // remote steps.\n var collabState = collabKey.getState(state);\n var version = collabState.version + steps.length;\n var ourID = collabKey.get(state).spec.config.clientID;\n\n // Find out which prefix of the steps originated with us\n var ours = 0;\n while (ours < clientIDs.length && clientIDs[ours] == ourID) { ++ours; }\n var unconfirmed = collabState.unconfirmed.slice(ours);\n steps = ours ? steps.slice(ours) : steps;\n\n // If all steps originated with us, we're done.\n if (!steps.length)\n { return state.tr.setMeta(collabKey, new CollabState(version, unconfirmed)) }\n\n var nUnconfirmed = unconfirmed.length;\n var tr = state.tr;\n if (nUnconfirmed) {\n unconfirmed = rebaseSteps(unconfirmed, steps, tr);\n } else {\n for (var i = 0; i < steps.length; i++) { tr.step(steps[i]); }\n unconfirmed = [];\n }\n\n var newCollabState = new CollabState(version, unconfirmed);\n if (options && options.mapSelectionBackward && state.selection instanceof TextSelection) {\n tr.setSelection(TextSelection.between(tr.doc.resolve(tr.mapping.map(state.selection.anchor, -1)),\n tr.doc.resolve(tr.mapping.map(state.selection.head, -1)), -1));\n tr.updated &= ~1;\n }\n return tr.setMeta(\"rebased\", nUnconfirmed).setMeta(\"addToHistory\", false).setMeta(collabKey, newCollabState)\n}\n\n// :: (state: EditorState) → ?{version: number, steps: [Step], clientID: union<number, string>, origins: [Transaction]}\n// Provides data describing the editor's unconfirmed steps, which need\n// to be sent to the central authority. Returns null when there is\n// nothing to send.\n//\n// `origins` holds the _original_ transactions that produced each\n// steps. This can be useful for looking up time stamps and other\n// metadata for the steps, but note that the steps may have been\n// rebased, whereas the origin transactions are still the old,\n// unchanged objects.\nfunction sendableSteps(state) {\n var collabState = collabKey.getState(state);\n if (collabState.unconfirmed.length == 0) { return null }\n return {\n version: collabState.version,\n steps: collabState.unconfirmed.map(function (s) { return s.step; }),\n clientID: collabKey.get(state).spec.config.clientID,\n get origins() { return this._origins || (this._origins = collabState.unconfirmed.map(function (s) { return s.origin; })) }\n }\n}\n\n// :: (EditorState) → number\n// Get the version up to which the collab plugin has synced with the\n// central authority.\nfunction getVersion(state) {\n return collabKey.getState(state).version\n}\n\nexport { collab, getVersion, rebaseSteps, receiveTransaction, sendableSteps };\n//# sourceMappingURL=index.es.js.map\n","\n /*!\n * tiptap-utils v1.8.2\n * (c) 2019 Scrumpy UG (limited liability)\n * @license MIT\n */\n \nimport { findSelectedNodeOfType, findParentNode } from 'prosemirror-utils';\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nfunction getMarkAttrs(state, type) {\n var _state$selection = state.selection,\n from = _state$selection.from,\n to = _state$selection.to;\n var marks = [];\n state.doc.nodesBetween(from, to, function (node) {\n marks = [].concat(_toConsumableArray(marks), _toConsumableArray(node.marks));\n });\n var mark = marks.find(function (markItem) {\n return markItem.type.name === type.name;\n });\n\n if (mark) {\n return mark.attrs;\n }\n\n return {};\n}\n\nfunction getMarkRange() {\n var $pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n if (!$pos || !type) {\n return false;\n }\n\n var start = $pos.parent.childAfter($pos.parentOffset);\n\n if (!start.node) {\n return false;\n }\n\n var link = start.node.marks.find(function (mark) {\n return mark.type === type;\n });\n\n if (!link) {\n return false;\n }\n\n var startIndex = $pos.index();\n var startPos = $pos.start() + start.offset;\n var endIndex = startIndex + 1;\n var endPos = startPos + start.node.nodeSize;\n\n while (startIndex > 0 && link.isInSet($pos.parent.child(startIndex - 1).marks)) {\n startIndex -= 1;\n startPos -= $pos.parent.child(startIndex).nodeSize;\n }\n\n while (endIndex < $pos.parent.childCount && link.isInSet($pos.parent.child(endIndex).marks)) {\n endPos += $pos.parent.child(endIndex).nodeSize;\n endIndex += 1;\n }\n\n return {\n from: startPos,\n to: endPos\n };\n}\n\nfunction markIsActive(state, type) {\n var _state$selection = state.selection,\n from = _state$selection.from,\n $from = _state$selection.$from,\n to = _state$selection.to,\n empty = _state$selection.empty;\n\n if (empty) {\n return !!type.isInSet(state.storedMarks || $from.marks());\n }\n\n return !!state.doc.rangeHasMark(from, to, type);\n}\n\nfunction nodeEqualsType(_ref) {\n var types = _ref.types,\n node = _ref.node;\n return Array.isArray(types) && types.includes(node.type) || node.type === types;\n}\n\nfunction nodeIsActive(state, type) {\n var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var predicate = function predicate(node) {\n return node.type === type;\n };\n\n var node = findSelectedNodeOfType(type)(state.selection) || findParentNode(predicate)(state.selection);\n\n if (!Object.keys(attrs).length || !node) {\n return !!node;\n }\n\n return node.node.hasMarkup(type, attrs);\n}\n\nexport { getMarkAttrs, getMarkRange, markIsActive, nodeEqualsType, nodeIsActive };\n","'use strict';\n\n\nmodule.exports = require('./lib/');\n","module.exports=/[!-#%-\\*,-\\/:;\\?@\\[-\\]_\\{\\}\\xA1\\xA7\\xAB\\xB6\\xB7\\xBB\\xBF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u09FD\\u0A76\\u0AF0\\u0C84\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u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E9A-\\uDE9C\\uDE9E-\\uDEA2]|\\uD807[\\uDC41-\\uDC45\\uDC70\\uDC71\\uDEF7\\uDEF8]|\\uD809[\\uDC70-\\uDC74]|\\uD81A[\\uDE6E\\uDE6F\\uDEF5\\uDF37-\\uDF3B\\uDF44]|\\uD81B[\\uDE97-\\uDE9A]|\\uD82F\\uDC9F|\\uD836[\\uDE87-\\uDE8B]|\\uD83A[\\uDD5E\\uDD5F]/","/**\n * class Ruler\n *\n * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and\n * [[MarkdownIt#inline]] to manage sequences of functions (rules):\n *\n * - keep rules in defined order\n * - assign the name to each rule\n * - enable/disable rules\n * - add/replace rules\n * - allow assign rules to additional named chains (in the same)\n * - cacheing lists of active rules\n *\n * You will not need use this class directly until write plugins. For simple\n * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and\n * [[MarkdownIt.use]].\n **/\n'use strict';\n\n\n/**\n * new Ruler()\n **/\nfunction Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Helper methods, should not be used directly\n\n\n// Find rule index by name\n//\nRuler.prototype.__find__ = function (name) {\n for (var i = 0; i < this.__rules__.length; i++) {\n if (this.__rules__[i].name === name) {\n return i;\n }\n }\n return -1;\n};\n\n\n// Build rules lookup cache\n//\nRuler.prototype.__compile__ = function () {\n var self = this;\n var chains = [ '' ];\n\n // collect unique names\n self.__rules__.forEach(function (rule) {\n if (!rule.enabled) { return; }\n\n rule.alt.forEach(function (altName) {\n if (chains.indexOf(altName) < 0) {\n chains.push(altName);\n }\n });\n });\n\n self.__cache__ = {};\n\n chains.forEach(function (chain) {\n self.__cache__[chain] = [];\n self.__rules__.forEach(function (rule) {\n if (!rule.enabled) { return; }\n\n if (chain && rule.alt.indexOf(chain) < 0) { return; }\n\n self.__cache__[chain].push(rule.fn);\n });\n });\n};\n\n\n/**\n * Ruler.at(name, fn [, options])\n * - name (String): rule name to replace.\n * - fn (Function): new rule function.\n * - options (Object): new rule options (not mandatory).\n *\n * Replace rule by name with new function & options. Throws error if name not\n * found.\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * Replace existing typographer replacement rule with new one:\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.core.ruler.at('replacements', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.at = function (name, fn, options) {\n var index = this.__find__(name);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + name); }\n\n this.__rules__[index].fn = fn;\n this.__rules__[index].alt = opt.alt || [];\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.before(beforeName, ruleName, fn [, options])\n * - beforeName (String): new rule will be added before this one.\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Add new rule to chain before one with given name. See also\n * [[Ruler.after]], [[Ruler.push]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.before = function (beforeName, ruleName, fn, options) {\n var index = this.__find__(beforeName);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }\n\n this.__rules__.splice(index, 0, {\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.after(afterName, ruleName, fn [, options])\n * - afterName (String): new rule will be added after this one.\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Add new rule to chain after one with given name. See also\n * [[Ruler.before]], [[Ruler.push]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.inline.ruler.after('text', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.after = function (afterName, ruleName, fn, options) {\n var index = this.__find__(afterName);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }\n\n this.__rules__.splice(index + 1, 0, {\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n/**\n * Ruler.push(ruleName, fn [, options])\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Push new rule to the end of chain. See also\n * [[Ruler.before]], [[Ruler.after]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.core.ruler.push('my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.push = function (ruleName, fn, options) {\n var opt = options || {};\n\n this.__rules__.push({\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.enable(list [, ignoreInvalid]) -> Array\n * - list (String|Array): list of rule names to enable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * Returns list of found rule names (if no exception happened).\n *\n * See also [[Ruler.disable]], [[Ruler.enableOnly]].\n **/\nRuler.prototype.enable = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n var result = [];\n\n // Search by name and enable\n list.forEach(function (name) {\n var idx = this.__find__(name);\n\n if (idx < 0) {\n if (ignoreInvalid) { return; }\n throw new Error('Rules manager: invalid rule name ' + name);\n }\n this.__rules__[idx].enabled = true;\n result.push(name);\n }, this);\n\n this.__cache__ = null;\n return result;\n};\n\n\n/**\n * Ruler.enableOnly(list [, ignoreInvalid])\n * - list (String|Array): list of rule names to enable (whitelist).\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable rules with given names, and disable everything else. If any rule name\n * not found - throw Error. Errors can be disabled by second param.\n *\n * See also [[Ruler.disable]], [[Ruler.enable]].\n **/\nRuler.prototype.enableOnly = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n this.__rules__.forEach(function (rule) { rule.enabled = false; });\n\n this.enable(list, ignoreInvalid);\n};\n\n\n/**\n * Ruler.disable(list [, ignoreInvalid]) -> Array\n * - list (String|Array): list of rule names to disable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Disable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * Returns list of found rule names (if no exception happened).\n *\n * See also [[Ruler.enable]], [[Ruler.enableOnly]].\n **/\nRuler.prototype.disable = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n var result = [];\n\n // Search by name and disable\n list.forEach(function (name) {\n var idx = this.__find__(name);\n\n if (idx < 0) {\n if (ignoreInvalid) { return; }\n throw new Error('Rules manager: invalid rule name ' + name);\n }\n this.__rules__[idx].enabled = false;\n result.push(name);\n }, this);\n\n this.__cache__ = null;\n return result;\n};\n\n\n/**\n * Ruler.getRules(chainName) -> Array\n *\n * Return array of active functions (rules) for given chain name. It analyzes\n * rules configuration, compiles caches if not exists and returns result.\n *\n * Default chain name is `''` (empty string). It can't be skipped. That's\n * done intentionally, to keep signature monomorphic for high speed.\n **/\nRuler.prototype.getRules = function (chainName) {\n if (this.__cache__ === null) {\n this.__compile__();\n }\n\n // Chain can be empty, if rules disabled. But we still have to return Array.\n return this.__cache__[chainName] || [];\n};\n\nmodule.exports = Ruler;\n","// Token class\n\n'use strict';\n\n\n/**\n * class Token\n **/\n\n/**\n * new Token(type, tag, nesting)\n *\n * Create new token and fill passed properties.\n **/\nfunction Token(type, tag, nesting) {\n /**\n * Token#type -> String\n *\n * Type of the token (string, e.g. \"paragraph_open\")\n **/\n this.type = type;\n\n /**\n * Token#tag -> String\n *\n * html tag name, e.g. \"p\"\n **/\n this.tag = tag;\n\n /**\n * Token#attrs -> Array\n *\n * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`\n **/\n this.attrs = null;\n\n /**\n * Token#map -> Array\n *\n * Source map info. Format: `[ line_begin, line_end ]`\n **/\n this.map = null;\n\n /**\n * Token#nesting -> Number\n *\n * Level change (number in {-1, 0, 1} set), where:\n *\n * - `1` means the tag is opening\n * - `0` means the tag is self-closing\n * - `-1` means the tag is closing\n **/\n this.nesting = nesting;\n\n /**\n * Token#level -> Number\n *\n * nesting level, the same as `state.level`\n **/\n this.level = 0;\n\n /**\n * Token#children -> Array\n *\n * An array of child nodes (inline and img tokens)\n **/\n this.children = null;\n\n /**\n * Token#content -> String\n *\n * In a case of self-closing tag (code, html, fence, etc.),\n * it has contents of this tag.\n **/\n this.content = '';\n\n /**\n * Token#markup -> String\n *\n * '*' or '_' for emphasis, fence string for fence, etc.\n **/\n this.markup = '';\n\n /**\n * Token#info -> String\n *\n * fence infostring\n **/\n this.info = '';\n\n /**\n * Token#meta -> Object\n *\n * A place for plugins to store an arbitrary data\n **/\n this.meta = null;\n\n /**\n * Token#block -> Boolean\n *\n * True for block-level tokens, false for inline tokens.\n * Used in renderer to calculate line breaks\n **/\n this.block = false;\n\n /**\n * Token#hidden -> Boolean\n *\n * If it's true, ignore this element when rendering. Used for tight lists\n * to hide paragraphs.\n **/\n this.hidden = false;\n}\n\n\n/**\n * Token.attrIndex(name) -> Number\n *\n * Search attribute index by name.\n **/\nToken.prototype.attrIndex = function attrIndex(name) {\n var attrs, i, len;\n\n if (!this.attrs) { return -1; }\n\n attrs = this.attrs;\n\n for (i = 0, len = attrs.length; i < len; i++) {\n if (attrs[i][0] === name) { return i; }\n }\n return -1;\n};\n\n\n/**\n * Token.attrPush(attrData)\n *\n * Add `[ name, value ]` attribute to list. Init attrs if necessary\n **/\nToken.prototype.attrPush = function attrPush(attrData) {\n if (this.attrs) {\n this.attrs.push(attrData);\n } else {\n this.attrs = [ attrData ];\n }\n};\n\n\n/**\n * Token.attrSet(name, value)\n *\n * Set `name` attribute to `value`. Override old value if exists.\n **/\nToken.prototype.attrSet = function attrSet(name, value) {\n var idx = this.attrIndex(name),\n attrData = [ name, value ];\n\n if (idx < 0) {\n this.attrPush(attrData);\n } else {\n this.attrs[idx] = attrData;\n }\n};\n\n\n/**\n * Token.attrGet(name)\n *\n * Get the value of attribute `name`, or null if it does not exist.\n **/\nToken.prototype.attrGet = function attrGet(name) {\n var idx = this.attrIndex(name), value = null;\n if (idx >= 0) {\n value = this.attrs[idx][1];\n }\n return value;\n};\n\n\n/**\n * Token.attrJoin(name, value)\n *\n * Join value to existing attribute via space. Or create new attribute if not\n * exists. Useful to operate with token classes.\n **/\nToken.prototype.attrJoin = function attrJoin(name, value) {\n var idx = this.attrIndex(name);\n\n if (idx < 0) {\n this.attrPush([ name, value ]);\n } else {\n this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;\n }\n};\n\n\nmodule.exports = Token;\n","var base = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 10: \"Enter\",\n 12: \"NumLock\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 44: \"PrintScreen\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Meta\",\n 92: \"Meta\",\n 106: \"*\",\n 107: \"+\",\n 108: \",\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 160: \"Shift\",\n 161: \"Shift\",\n 162: \"Control\",\n 163: \"Control\",\n 164: \"Alt\",\n 165: \"Alt\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\",\n 229: \"q\"\n};\nvar base_1 = base;\n\nvar shift = {\n 48: \")\",\n 49: \"!\",\n 50: \"@\",\n 51: \"#\",\n 52: \"$\",\n 53: \"%\",\n 54: \"^\",\n 55: \"&\",\n 56: \"*\",\n 57: \"(\",\n 59: \";\",\n 61: \"+\",\n 173: \"_\",\n 186: \":\",\n 187: \"+\",\n 188: \"<\",\n 189: \"_\",\n 190: \">\",\n 191: \"?\",\n 192: \"~\",\n 219: \"{\",\n 220: \"|\",\n 221: \"}\",\n 222: \"\\\"\",\n 229: \"Q\"\n};\nvar shift_1 = shift;\n\nvar chrome = typeof navigator != \"undefined\" && /Chrome\\/(\\d+)/.exec(navigator.userAgent);\nvar safari = typeof navigator != \"undefined\" && /Apple Computer/.test(navigator.vendor);\nvar gecko = typeof navigator != \"undefined\" && /Gecko\\/\\d+/.test(navigator.userAgent);\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform);\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);\nvar brokenModifierNames = chrome && (mac || +chrome[1] < 57) || gecko && mac;\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i);\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i;\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n base[i] = String.fromCharCode(i + 32);\n shift[i] = String.fromCharCode(i);\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code];\n\nvar keyName = function(event) {\n // Don't trust event.key in Chrome when there are modifiers until\n // they fix https://bugs.chromium.org/p/chromium/issues/detail?id=633838\n var ignoreKey = brokenModifierNames && (event.ctrlKey || event.altKey || event.metaKey) ||\n (safari || ie) && event.shiftKey && event.key && event.key.length == 1;\n var name = (!ignoreKey && event.key) ||\n (event.shiftKey ? shift : base)[event.keyCode] ||\n event.key || \"Unidentified\";\n // Edge sometimes produces wrong names (Issue #3)\n if (name == \"Esc\") name = \"Escape\";\n if (name == \"Del\") name = \"Delete\";\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n if (name == \"Left\") name = \"ArrowLeft\";\n if (name == \"Up\") name = \"ArrowUp\";\n if (name == \"Right\") name = \"ArrowRight\";\n if (name == \"Down\") name = \"ArrowDown\";\n return name\n};\n\nvar w3cKeyname = {\n\tbase: base_1,\n\tshift: shift_1,\n\tkeyName: keyName\n};\n\nexport default w3cKeyname;\nexport { base_1 as base, keyName, shift_1 as shift };\n","import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\n\n// declare global: navigator\n\nvar mac = typeof navigator != \"undefined\" ? /Mac/.test(navigator.platform) : false;\n\nfunction normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/), result = parts[parts.length - 1];\n if (result == \"Space\") { result = \" \"; }\n var alt, ctrl, shift, meta;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) { meta = true; }\n else if (/^a(lt)?$/i.test(mod)) { alt = true; }\n else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }\n else if (/^s(hift)?$/i.test(mod)) { shift = true; }\n else if (/^mod$/i.test(mod)) { if (mac) { meta = true; } else { ctrl = true; } }\n else { throw new Error(\"Unrecognized modifier name: \" + mod) }\n }\n if (alt) { result = \"Alt-\" + result; }\n if (ctrl) { result = \"Ctrl-\" + result; }\n if (meta) { result = \"Meta-\" + result; }\n if (shift) { result = \"Shift-\" + result; }\n return result\n}\n\nfunction normalize(map) {\n var copy = Object.create(null);\n for (var prop in map) { copy[normalizeKeyName(prop)] = map[prop]; }\n return copy\n}\n\nfunction modifiers(name, event, shift) {\n if (event.altKey) { name = \"Alt-\" + name; }\n if (event.ctrlKey) { name = \"Ctrl-\" + name; }\n if (event.metaKey) { name = \"Meta-\" + name; }\n if (shift !== false && event.shiftKey) { name = \"Shift-\" + name; }\n return name\n}\n\n// :: (Object) → Plugin\n// Create a keymap plugin for the given set of bindings.\n//\n// Bindings should map key names to [command](#commands)-style\n// functions, which will be called with `(EditorState, dispatch,\n// EditorView)` arguments, and should return true when they've handled\n// the key. Note that the view argument isn't part of the command\n// protocol, but can be used as an escape hatch if a binding needs to\n// directly interact with the UI.\n//\n// Key names may be strings like `\"Shift-Ctrl-Enter\"`—a key\n// identifier prefixed with zero or more modifiers. Key identifiers\n// are based on the strings that can appear in\n// [`KeyEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\n// Use lowercase letters to refer to letter keys (or uppercase letters\n// if you want shift to be held). You may use `\"Space\"` as an alias\n// for the `\" \"` name.\n//\n// Modifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n// `a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n// `Meta-`) are recognized. For characters that are created by holding\n// shift, the `Shift-` prefix is implied, and should not be added\n// explicitly.\n//\n// You can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\n// other platforms.\n//\n// You can add multiple keymap plugins to an editor. The order in\n// which they appear determines their precedence (the ones early in\n// the array get to dispatch first).\nfunction keymap(bindings) {\n return new Plugin({props: {handleKeyDown: keydownHandler(bindings)}})\n}\n\n// :: (Object) → (view: EditorView, event: dom.Event) → bool\n// Given a set of bindings (using the same format as\n// [`keymap`](#keymap.keymap), return a [keydown\n// handler](#view.EditorProps.handleKeyDown) that handles them.\nfunction keydownHandler(bindings) {\n var map = normalize(bindings);\n return function(view, event) {\n var name = keyName(event), isChar = name.length == 1 && name != \" \", baseName;\n var direct = map[modifiers(name, event, !isChar)];\n if (direct && direct(view.state, view.dispatch, view)) { return true }\n if (isChar && (event.shiftKey || event.altKey || event.metaKey) &&\n (baseName = base[event.keyCode]) && baseName != name) {\n var fromCode = map[modifiers(baseName, event, true)];\n if (fromCode && fromCode(view.state, view.dispatch, view)) { return true }\n } else if (isChar && event.shiftKey) {\n var withShift = map[modifiers(name, event, true)];\n if (withShift && withShift(view.state, view.dispatch, view)) { return true }\n }\n return false\n }\n}\n\nexport { keydownHandler, keymap };\n//# sourceMappingURL=index.es.js.map\n","import { PluginKey, TextSelection, Selection, SelectionRange, NodeSelection, Plugin } from 'prosemirror-state';\nimport { Fragment, Slice } from 'prosemirror-model';\nimport { keydownHandler } from 'prosemirror-keymap';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { Transform } from 'prosemirror-transform';\n\n// Because working with row and column-spanning cells is not quite\n// trivial, this code builds up a descriptive structure for a given\n// table node. The structures are cached with the (persistent) table\n// nodes as key, so that they only have to be recomputed when the\n// content of the table changes.\n//\n// This does mean that they have to store table-relative, not\n// document-relative positions. So code that uses them will typically\n// compute the start position of the table and offset positions passed\n// to or gotten from this structure by that amount.\n\nvar readFromCache, addToCache;\n// Prefer using a weak map to cache table maps. Fall back on a\n// fixed-size cache if that's not supported.\nif (typeof WeakMap != \"undefined\") {\n var cache = new WeakMap;\n readFromCache = function (key) { return cache.get(key); };\n addToCache = function (key, value) {\n cache.set(key, value);\n return value\n };\n} else {\n var cache$1 = [], cacheSize = 10, cachePos = 0;\n readFromCache = function (key) {\n for (var i = 0; i < cache$1.length; i += 2)\n { if (cache$1[i] == key) { return cache$1[i + 1] } }\n };\n addToCache = function (key, value) {\n if (cachePos == cacheSize) { cachePos = 0; }\n cache$1[cachePos++] = key;\n return cache$1[cachePos++] = value\n };\n}\n\nvar Rect = function Rect(left, top, right, bottom) {\n this.left = left; this.top = top; this.right = right; this.bottom = bottom;\n};\n\n// ::- A table map describes the structore of a given table. To avoid\n// recomputing them all the time, they are cached per table node. To\n// be able to do that, positions saved in the map are relative to the\n// start of the table, rather than the start of the document.\nvar TableMap = function TableMap(width, height, map, problems) {\n // :: number The width of the table\n this.width = width;\n // :: number The table's height\n this.height = height;\n // :: [number] A width * height array with the start position of\n // the cell covering that part of the table in each slot\n this.map = map;\n // An optional array of problems (cell overlap or non-rectangular\n // shape) for the table, used by the table normalizer.\n this.problems = problems;\n};\n\n// :: (number) → Rect\n// Find the dimensions of the cell at the given position.\nTableMap.prototype.findCell = function findCell (pos) {\n for (var i = 0; i < this.map.length; i++) {\n var curPos = this.map[i];\n if (curPos != pos) { continue }\n var left = i % this.width, top = (i / this.width) | 0;\n var right = left + 1, bottom = top + 1;\n for (var j = 1; right < this.width && this.map[i + j] == curPos; j++) { right++; }\n for (var j$1 = 1; bottom < this.height && this.map[i + (this.width * j$1)] == curPos; j$1++) { bottom++; }\n return new Rect(left, top, right, bottom)\n }\n throw new RangeError(\"No cell with offset \" + pos + \" found\")\n};\n\n// :: (number) → number\n// Find the left side of the cell at the given position.\nTableMap.prototype.colCount = function colCount (pos) {\n for (var i = 0; i < this.map.length; i++)\n { if (this.map[i] == pos) { return i % this.width } }\n throw new RangeError(\"No cell with offset \" + pos + \" found\")\n};\n\n// :: (number, string, number) → ?number\n// Find the next cell in the given direction, starting from the cell\n// at `pos`, if any.\nTableMap.prototype.nextCell = function nextCell (pos, axis, dir) {\n var ref = this.findCell(pos);\n var left = ref.left;\n var right = ref.right;\n var top = ref.top;\n var bottom = ref.bottom;\n if (axis == \"horiz\") {\n if (dir < 0 ? left == 0 : right == this.width) { return null }\n return this.map[top * this.width + (dir < 0 ? left - 1 : right)]\n } else {\n if (dir < 0 ? top == 0 : bottom == this.height) { return null }\n return this.map[left + this.width * (dir < 0 ? top - 1 : bottom)]\n }\n};\n\n// :: (number, number) → Rect\n// Get the rectangle spanning the two given cells.\nTableMap.prototype.rectBetween = function rectBetween (a, b) {\n var ref = this.findCell(a);\n var leftA = ref.left;\n var rightA = ref.right;\n var topA = ref.top;\n var bottomA = ref.bottom;\n var ref$1 = this.findCell(b);\n var leftB = ref$1.left;\n var rightB = ref$1.right;\n var topB = ref$1.top;\n var bottomB = ref$1.bottom;\n return new Rect(Math.min(leftA, leftB), Math.min(topA, topB),\n Math.max(rightA, rightB), Math.max(bottomA, bottomB))\n};\n\n// :: (Rect) → [number]\n// Return the position of all cells that have the top left corner in\n// the given rectangle.\nTableMap.prototype.cellsInRect = function cellsInRect (rect) {\n var result = [], seen = {};\n for (var row = rect.top; row < rect.bottom; row++) {\n for (var col = rect.left; col < rect.right; col++) {\n var index = row * this.width + col, pos = this.map[index];\n if (seen[pos]) { continue }\n seen[pos] = true;\n if ((col != rect.left || !col || this.map[index - 1] != pos) &&\n (row != rect.top || !row || this.map[index - this.width] != pos))\n { result.push(pos); }\n }\n }\n return result\n};\n\n// :: (number, number, Node) → number\n// Return the position at which the cell at the given row and column\n// starts, or would start, if a cell started there.\nTableMap.prototype.positionAt = function positionAt (row, col, table) {\n for (var i = 0, rowStart = 0;; i++) {\n var rowEnd = rowStart + table.child(i).nodeSize;\n if (i == row) {\n var index = col + row * this.width, rowEndIndex = (row + 1) * this.width;\n // Skip past cells from previous rows (via rowspan)\n while (index < rowEndIndex && this.map[index] < rowStart) { index++; }\n return index == rowEndIndex ? rowEnd - 1 : this.map[index]\n }\n rowStart = rowEnd;\n }\n};\n\n// :: (Node) → TableMap\n// Find the table map for the given table node.\nTableMap.get = function get (table) {\n return readFromCache(table) || addToCache(table, computeMap(table))\n};\n\n// Compute a table map.\nfunction computeMap(table) {\n if (table.type.spec.tableRole != \"table\") { throw new RangeError(\"Not a table node: \" + table.type.name) }\n var width = findWidth(table), height = table.childCount;\n var map = [], mapPos = 0, problems = null, colWidths = [];\n for (var i = 0, e = width * height; i < e; i++) { map[i] = 0; }\n\n for (var row = 0, pos = 0; row < height; row++) {\n var rowNode = table.child(row);\n pos++;\n for (var i$1 = 0;; i$1++) {\n while (mapPos < map.length && map[mapPos] != 0) { mapPos++; }\n if (i$1 == rowNode.childCount) { break }\n var cellNode = rowNode.child(i$1);\n var ref = cellNode.attrs;\n var colspan = ref.colspan;\n var rowspan = ref.rowspan;\n var colwidth = ref.colwidth;\n for (var h = 0; h < rowspan; h++) {\n if (h + row >= height) {\n (problems || (problems = [])).push({type: \"overlong_rowspan\", pos: pos, n: rowspan - h});\n break\n }\n var start = mapPos + (h * width);\n for (var w = 0; w < colspan; w++) {\n if (map[start + w] == 0)\n { map[start + w] = pos; }\n else\n { (problems || (problems = [])).push({type: \"collision\", row: row, pos: pos, n: colspan - w}); }\n var colW = colwidth && colwidth[w];\n if (colW) {\n var widthIndex = ((start + w) % width) * 2, prev = colWidths[widthIndex];\n if (prev == null || (prev != colW && colWidths[widthIndex + 1] == 1)) {\n colWidths[widthIndex] = colW;\n colWidths[widthIndex + 1] = 1;\n } else if (prev == colW) {\n colWidths[widthIndex + 1]++;\n }\n }\n }\n }\n mapPos += colspan;\n pos += cellNode.nodeSize;\n }\n var expectedPos = (row + 1) * width, missing = 0;\n while (mapPos < expectedPos) { if (map[mapPos++] == 0) { missing++; } }\n if (missing) { (problems || (problems = [])).push({type: \"missing\", row: row, n: missing}); }\n pos++;\n }\n\n var tableMap = new TableMap(width, height, map, problems), badWidths = false;\n\n // For columns that have defined widths, but whose widths disagree\n // between rows, fix up the cells whose width doesn't match the\n // computed one.\n for (var i$2 = 0; !badWidths && i$2 < colWidths.length; i$2 += 2)\n { if (colWidths[i$2] != null && colWidths[i$2 + 1] < height) { badWidths = true; } }\n if (badWidths) { findBadColWidths(tableMap, colWidths, table); }\n\n return tableMap\n}\n\nfunction findWidth(table) {\n var width = -1, hasRowSpan = false;\n for (var row = 0; row < table.childCount; row++) {\n var rowNode = table.child(row), rowWidth = 0;\n if (hasRowSpan) { for (var j = 0; j < row; j++) {\n var prevRow = table.child(j);\n for (var i = 0; i < prevRow.childCount; i++) {\n var cell = prevRow.child(i);\n if (j + cell.attrs.rowspan > row) { rowWidth += cell.attrs.colspan; }\n }\n } }\n for (var i$1 = 0; i$1 < rowNode.childCount; i$1++) {\n var cell$1 = rowNode.child(i$1);\n rowWidth += cell$1.attrs.colspan;\n if (cell$1.attrs.rowspan > 1) { hasRowSpan = true; }\n }\n if (width == -1)\n { width = rowWidth; }\n else if (width != rowWidth)\n { width = Math.max(width, rowWidth); }\n }\n return width\n}\n\nfunction findBadColWidths(map, colWidths, table) {\n if (!map.problems) { map.problems = []; }\n for (var i = 0, seen = {}; i < map.map.length; i++) {\n var pos = map.map[i];\n if (seen[pos]) { continue }\n seen[pos] = true;\n var node = table.nodeAt(pos), updated = null;\n for (var j = 0; j < node.attrs.colspan; j++) {\n var col = (i + j) % map.width, colWidth = colWidths[col * 2];\n if (colWidth != null && (!node.attrs.colwidth || node.attrs.colwidth[j] != colWidth))\n { (updated || (updated = freshColWidth(node.attrs)))[j] = colWidth; }\n }\n if (updated) { map.problems.unshift({type: \"colwidth mismatch\", pos: pos, colwidth: updated}); }\n }\n}\n\nfunction freshColWidth(attrs) {\n if (attrs.colwidth) { return attrs.colwidth.slice() }\n var result = [];\n for (var i = 0; i < attrs.colspan; i++) { result.push(0); }\n return result\n}\n\n// Various helper function for working with tables\n\nvar key = new PluginKey(\"selectingCells\");\n\nfunction cellAround($pos) {\n for (var d = $pos.depth - 1; d > 0; d--)\n { if ($pos.node(d).type.spec.tableRole == \"row\") { return $pos.node(0).resolve($pos.before(d + 1)) } }\n return null\n}\n\nfunction cellWrapping($pos) {\n for (var d = $pos.depth; d > 0; d--) { // Sometimes the cell can be in the same depth.\n var role = $pos.node(d).type.spec.tableRole;\n if (role === \"cell\" || role === 'header_cell') { return $pos.node(d) }\n }\n return null\n}\n\nfunction isInTable(state) {\n var $head = state.selection.$head;\n for (var d = $head.depth; d > 0; d--) { if ($head.node(d).type.spec.tableRole == \"row\") { return true } }\n return false\n}\n\nfunction selectionCell(state) {\n var sel = state.selection;\n if (sel.$anchorCell) {\n return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;\n } else if (sel.node && sel.node.type.spec.tableRole == \"cell\") {\n return sel.$anchor\n }\n return cellAround(sel.$head) || cellNear(sel.$head)\n}\n\nfunction cellNear($pos) {\n for (var after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {\n var role = after.type.spec.tableRole;\n if (role == \"cell\" || role == \"header_cell\") { return $pos.doc.resolve(pos) }\n }\n for (var before = $pos.nodeBefore, pos$1 = $pos.pos; before; before = before.lastChild, pos$1--) {\n var role$1 = before.type.spec.tableRole;\n if (role$1 == \"cell\" || role$1 == \"header_cell\") { return $pos.doc.resolve(pos$1 - before.nodeSize) }\n }\n}\n\nfunction pointsAtCell($pos) {\n return $pos.parent.type.spec.tableRole == \"row\" && $pos.nodeAfter\n}\n\nfunction moveCellForward($pos) {\n return $pos.node(0).resolve($pos.pos + $pos.nodeAfter.nodeSize)\n}\n\nfunction inSameTable($a, $b) {\n return $a.depth == $b.depth && $a.pos >= $b.start(-1) && $a.pos <= $b.end(-1)\n}\n\nfunction findCell($pos) {\n return TableMap.get($pos.node(-1)).findCell($pos.pos - $pos.start(-1))\n}\n\nfunction colCount($pos) {\n return TableMap.get($pos.node(-1)).colCount($pos.pos - $pos.start(-1))\n}\n\nfunction nextCell($pos, axis, dir) {\n var start = $pos.start(-1), map = TableMap.get($pos.node(-1));\n var moved = map.nextCell($pos.pos - start, axis, dir);\n return moved == null ? null : $pos.node(0).resolve(start + moved)\n}\n\nfunction setAttr(attrs, name, value) {\n var result = {};\n for (var prop in attrs) { result[prop] = attrs[prop]; }\n result[name] = value;\n return result\n}\n\nfunction rmColSpan(attrs, pos, n) {\n if ( n === void 0 ) n=1;\n\n var result = setAttr(attrs, \"colspan\", attrs.colspan - n);\n if (result.colwidth) {\n result.colwidth = result.colwidth.slice();\n result.colwidth.splice(pos, n);\n if (!result.colwidth.some(function (w) { return w > 0; })) { result.colwidth = null; }\n }\n return result\n}\n\nfunction addColSpan(attrs, pos, n) {\n if ( n === void 0 ) n=1;\n\n var result = setAttr(attrs, \"colspan\", attrs.colspan + n);\n if (result.colwidth) {\n result.colwidth = result.colwidth.slice();\n for (var i = 0; i < n; i++) { result.colwidth.splice(pos, 0, 0); }\n }\n return result\n}\n\n// This file defines a ProseMirror selection subclass that models\n\n// ::- A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)\n// subclass that represents a cell selection spanning part of a table.\n// With the plugin enabled, these will be created when the user\n// selects across cells, and will be drawn by giving selected cells a\n// `selectedCell` CSS class.\nvar CellSelection = /*@__PURE__*/(function (Selection) {\n function CellSelection($anchorCell, $headCell) {\n if ( $headCell === void 0 ) $headCell = $anchorCell;\n\n var table = $anchorCell.node(-1), map = TableMap.get(table), start = $anchorCell.start(-1);\n var rect = map.rectBetween($anchorCell.pos - start, $headCell.pos - start);\n var doc = $anchorCell.node(0);\n var cells = map.cellsInRect(rect).filter(function (p) { return p != $headCell.pos - start; });\n // Make the head cell the first range, so that it counts as the\n // primary part of the selection\n cells.unshift($headCell.pos - start);\n var ranges = cells.map(function (pos) {\n var cell = table.nodeAt(pos), from = pos + start + 1;\n return new SelectionRange(doc.resolve(from), doc.resolve(from + cell.content.size))\n });\n Selection.call(this, ranges[0].$from, ranges[0].$to, ranges);\n // :: ResolvedPos\n // A resolved position pointing _in front of_ the anchor cell (the one\n // that doesn't move when extending the selection).\n this.$anchorCell = $anchorCell;\n // :: ResolvedPos\n // A resolved position pointing in front of the head cell (the one\n // moves when extending the selection).\n this.$headCell = $headCell;\n }\n\n if ( Selection ) CellSelection.__proto__ = Selection;\n CellSelection.prototype = Object.create( Selection && Selection.prototype );\n CellSelection.prototype.constructor = CellSelection;\n\n CellSelection.prototype.map = function map (doc, mapping) {\n var $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos));\n var $headCell = doc.resolve(mapping.map(this.$headCell.pos));\n if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {\n var tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);\n if (tableChanged && this.isRowSelection())\n { return CellSelection.rowSelection($anchorCell, $headCell) }\n else if (tableChanged && this.isColSelection())\n { return CellSelection.colSelection($anchorCell, $headCell) }\n else\n { return new CellSelection($anchorCell, $headCell) }\n }\n return TextSelection.between($anchorCell, $headCell)\n };\n\n // :: () → Slice\n // Returns a rectangular slice of table rows containing the selected\n // cells.\n CellSelection.prototype.content = function content () {\n var table = this.$anchorCell.node(-1), map = TableMap.get(table), start = this.$anchorCell.start(-1);\n var rect = map.rectBetween(this.$anchorCell.pos - start, this.$headCell.pos - start);\n var seen = {}, rows = [];\n for (var row = rect.top; row < rect.bottom; row++) {\n var rowContent = [];\n for (var index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {\n var pos = map.map[index];\n if (!seen[pos]) {\n seen[pos] = true;\n var cellRect = map.findCell(pos), cell = table.nodeAt(pos);\n var extraLeft = rect.left - cellRect.left, extraRight = cellRect.right - rect.right;\n if (extraLeft > 0 || extraRight > 0) {\n var attrs = cell.attrs;\n if (extraLeft > 0) { attrs = rmColSpan(attrs, 0, extraLeft); }\n if (extraRight > 0) { attrs = rmColSpan(attrs, attrs.colspan - extraRight, extraRight); }\n if (cellRect.left < rect.left) { cell = cell.type.createAndFill(attrs); }\n else { cell = cell.type.create(attrs, cell.content); }\n }\n if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {\n var attrs$1 = setAttr(cell.attrs, \"rowspan\", Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top));\n if (cellRect.top < rect.top) { cell = cell.type.createAndFill(attrs$1); }\n else { cell = cell.type.create(attrs$1, cell.content); }\n }\n rowContent.push(cell);\n }\n }\n rows.push(table.child(row).copy(Fragment.from(rowContent)));\n }\n\n var fragment = this.isColSelection() && this.isRowSelection() ? table : rows;\n return new Slice(Fragment.from(fragment), 1, 1)\n };\n\n CellSelection.prototype.replace = function replace (tr, content) {\n if ( content === void 0 ) content = Slice.empty;\n\n var mapFrom = tr.steps.length, ranges = this.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var ref = ranges[i];\n var $from = ref.$from;\n var $to = ref.$to;\n var mapping = tr.mapping.slice(mapFrom);\n tr.replace(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n }\n var sel = Selection.findFrom(tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)), -1);\n if (sel) { tr.setSelection(sel); }\n };\n\n CellSelection.prototype.replaceWith = function replaceWith (tr, node) {\n this.replace(tr, new Slice(Fragment.from(node), 0, 0));\n };\n\n CellSelection.prototype.forEachCell = function forEachCell (f) {\n var table = this.$anchorCell.node(-1), map = TableMap.get(table), start = this.$anchorCell.start(-1);\n var cells = map.cellsInRect(map.rectBetween(this.$anchorCell.pos - start, this.$headCell.pos - start));\n for (var i = 0; i < cells.length; i++)\n { f(table.nodeAt(cells[i]), start + cells[i]); }\n };\n\n // :: () → bool\n // True if this selection goes all the way from the top to the\n // bottom of the table.\n CellSelection.prototype.isColSelection = function isColSelection () {\n var anchorTop = this.$anchorCell.index(-1), headTop = this.$headCell.index(-1);\n if (Math.min(anchorTop, headTop) > 0) { return false }\n var anchorBot = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan,\n headBot = headTop + this.$headCell.nodeAfter.attrs.rowspan;\n return Math.max(anchorBot, headBot) == this.$headCell.node(-1).childCount\n };\n\n // :: (ResolvedPos, ?ResolvedPos) → CellSelection\n // Returns the smallest column selection that covers the given anchor\n // and head cell.\n CellSelection.colSelection = function colSelection ($anchorCell, $headCell) {\n if ( $headCell === void 0 ) $headCell = $anchorCell;\n\n var map = TableMap.get($anchorCell.node(-1)), start = $anchorCell.start(-1);\n var anchorRect = map.findCell($anchorCell.pos - start), headRect = map.findCell($headCell.pos - start);\n var doc = $anchorCell.node(0);\n if (anchorRect.top <= headRect.top) {\n if (anchorRect.top > 0)\n { $anchorCell = doc.resolve(start + map.map[anchorRect.left]); }\n if (headRect.bottom < map.height)\n { $headCell = doc.resolve(start + map.map[map.width * (map.height - 1) + headRect.right - 1]); }\n } else {\n if (headRect.top > 0)\n { $headCell = doc.resolve(start + map.map[headRect.left]); }\n if (anchorRect.bottom < map.height)\n { $anchorCell = doc.resolve(start + map.map[map.width * (map.height - 1) + anchorRect.right - 1]); }\n }\n return new CellSelection($anchorCell, $headCell)\n };\n\n // :: () → bool\n // True if this selection goes all the way from the left to the\n // right of the table.\n CellSelection.prototype.isRowSelection = function isRowSelection () {\n var map = TableMap.get(this.$anchorCell.node(-1)), start = this.$anchorCell.start(-1);\n var anchorLeft = map.colCount(this.$anchorCell.pos - start),\n headLeft = map.colCount(this.$headCell.pos - start);\n if (Math.min(anchorLeft, headLeft) > 0) { return false }\n var anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan,\n headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;\n return Math.max(anchorRight, headRight) == map.width\n };\n\n CellSelection.prototype.eq = function eq (other) {\n return other instanceof CellSelection && other.$anchorCell.pos == this.$anchorCell.pos &&\n other.$headCell.pos == this.$headCell.pos\n };\n\n // :: (ResolvedPos, ?ResolvedPos) → CellSelection\n // Returns the smallest row selection that covers the given anchor\n // and head cell.\n CellSelection.rowSelection = function rowSelection ($anchorCell, $headCell) {\n if ( $headCell === void 0 ) $headCell = $anchorCell;\n\n var map = TableMap.get($anchorCell.node(-1)), start = $anchorCell.start(-1);\n var anchorRect = map.findCell($anchorCell.pos - start), headRect = map.findCell($headCell.pos - start);\n var doc = $anchorCell.node(0);\n if (anchorRect.left <= headRect.left) {\n if (anchorRect.left > 0)\n { $anchorCell = doc.resolve(start + map.map[anchorRect.top * map.width]); }\n if (headRect.right < map.width)\n { $headCell = doc.resolve(start + map.map[map.width * (headRect.top + 1) - 1]); }\n } else {\n if (headRect.left > 0)\n { $headCell = doc.resolve(start + map.map[headRect.top * map.width]); }\n if (anchorRect.right < map.width)\n { $anchorCell = doc.resolve(start + map.map[map.width * (anchorRect.top + 1) - 1]); }\n }\n return new CellSelection($anchorCell, $headCell)\n };\n\n CellSelection.prototype.toJSON = function toJSON () {\n return {type: \"cell\", anchor: this.$anchorCell.pos, head: this.$headCell.pos}\n };\n\n CellSelection.fromJSON = function fromJSON (doc, json) {\n return new CellSelection(doc.resolve(json.anchor), doc.resolve(json.head))\n };\n\n // :: (Node, number, ?number) → CellSelection\n CellSelection.create = function create (doc, anchorCell, headCell) {\n if ( headCell === void 0 ) headCell = anchorCell;\n\n return new CellSelection(doc.resolve(anchorCell), doc.resolve(headCell))\n };\n\n CellSelection.prototype.getBookmark = function getBookmark () { return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos) };\n\n return CellSelection;\n}(Selection));\n\nCellSelection.prototype.visible = false;\n\nSelection.jsonID(\"cell\", CellSelection);\n\nvar CellBookmark = function CellBookmark(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n};\nCellBookmark.prototype.map = function map (mapping) {\n return new CellBookmark(mapping.map(this.anchor), mapping.map(this.head))\n};\nCellBookmark.prototype.resolve = function resolve (doc) {\n var $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);\n if ($anchorCell.parent.type.spec.tableRole == \"row\" &&\n $headCell.parent.type.spec.tableRole == \"row\" &&\n $anchorCell.index() < $anchorCell.parent.childCount &&\n $headCell.index() < $headCell.parent.childCount &&\n inSameTable($anchorCell, $headCell))\n { return new CellSelection($anchorCell, $headCell) }\n else\n { return Selection.near($headCell, 1) }\n};\n\nfunction drawCellSelection(state) {\n if (!(state.selection instanceof CellSelection)) { return null }\n var cells = [];\n state.selection.forEachCell(function (node, pos) {\n cells.push(Decoration.node(pos, pos + node.nodeSize, {class: \"selectedCell\"}));\n });\n return DecorationSet.create(state.doc, cells)\n}\n\nfunction isCellBoundarySelection(ref) {\n var $from = ref.$from;\n var $to = ref.$to;\n\n if ($from.pos == $to.pos || $from.pos < $from.pos - 6) { return false } // Cheap elimination\n var afterFrom = $from.pos, beforeTo = $to.pos, depth = $from.depth;\n for (; depth >= 0; depth--, afterFrom++)\n { if ($from.after(depth + 1) < $from.end(depth)) { break } }\n for (var d = $to.depth; d >= 0; d--, beforeTo--)\n { if ($to.before(d + 1) > $to.start(d)) { break } }\n return afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole)\n}\n\nfunction isTextSelectionAcrossCells(ref) {\n var $from = ref.$from;\n var $to = ref.$to;\n\n var fromCellBoundaryNode;\n var toCellBoundaryNode;\n\n for (var i = $from.depth; i > 0; i--) {\n var node = $from.node(i);\n if (node.type.spec.tableRole === 'cell' || node.type.spec.tableRole === 'header_cell') {\n fromCellBoundaryNode = node;\n break;\n }\n }\n\n for (var i$1 = $to.depth; i$1 > 0; i$1--) {\n var node$1 = $to.node(i$1);\n if (node$1.type.spec.tableRole === 'cell' || node$1.type.spec.tableRole === 'header_cell') {\n toCellBoundaryNode = node$1;\n break;\n }\n }\n\n return fromCellBoundaryNode !== toCellBoundaryNode && $to.parentOffset === 0\n}\n\nfunction normalizeSelection(state, tr, allowTableNodeSelection) {\n var sel = (tr || state).selection, doc = (tr || state).doc, normalize, role;\n if (sel instanceof NodeSelection && (role = sel.node.type.spec.tableRole)) {\n if (role == \"cell\" || role == \"header_cell\") {\n normalize = CellSelection.create(doc, sel.from);\n } else if (role == \"row\") {\n var $cell = doc.resolve(sel.from + 1);\n normalize = CellSelection.rowSelection($cell, $cell);\n } else if (!allowTableNodeSelection) {\n var map = TableMap.get(sel.node), start = sel.from + 1;\n var lastCell = start + map.map[map.width * map.height - 1];\n normalize = CellSelection.create(doc, start + 1, lastCell);\n }\n } else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) {\n normalize = TextSelection.create(doc, sel.from);\n } else if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) {\n normalize = TextSelection.create(doc, sel.$from.start(), sel.$from.end());\n }\n if (normalize)\n { (tr || (tr = state.tr)).setSelection(normalize); }\n return tr\n}\n\n// Helper for creating a schema that supports tables.\n\nfunction getCellAttrs(dom, extraAttrs) {\n var widthAttr = dom.getAttribute(\"data-colwidth\");\n var widths = widthAttr && /^\\d+(,\\d+)*$/.test(widthAttr) ? widthAttr.split(\",\").map(function (s) { return Number(s); }) : null;\n var colspan = Number(dom.getAttribute(\"colspan\") || 1);\n var result = {\n colspan: colspan,\n rowspan: Number(dom.getAttribute(\"rowspan\") || 1),\n colwidth: widths && widths.length == colspan ? widths : null\n };\n for (var prop in extraAttrs) {\n var getter = extraAttrs[prop].getFromDOM;\n var value = getter && getter(dom);\n if (value != null) { result[prop] = value; }\n }\n return result\n}\n\nfunction setCellAttrs(node, extraAttrs) {\n var attrs = {};\n if (node.attrs.colspan != 1) { attrs.colspan = node.attrs.colspan; }\n if (node.attrs.rowspan != 1) { attrs.rowspan = node.attrs.rowspan; }\n if (node.attrs.colwidth)\n { attrs[\"data-colwidth\"] = node.attrs.colwidth.join(\",\"); }\n for (var prop in extraAttrs) {\n var setter = extraAttrs[prop].setDOMAttr;\n if (setter) { setter(node.attrs[prop], attrs); }\n }\n return attrs\n}\n\n// :: (Object) → Object\n//\n// This function creates a set of [node\n// specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for\n// `table`, `table_row`, and `table_cell` nodes types as used by this\n// module. The result can then be added to the set of nodes when\n// creating a a schema.\n//\n// options::- The following options are understood:\n//\n// tableGroup:: ?string\n// A group name (something like `\"block\"`) to add to the table\n// node type.\n//\n// cellContent:: string\n// The content expression for table cells.\n//\n// cellAttributes:: ?Object\n// Additional attributes to add to cells. Maps attribute names to\n// objects with the following properties:\n//\n// default:: any\n// The attribute's default value.\n//\n// getFromDOM:: ?(dom.Node) → any\n// A function to read the attribute's value from a DOM node.\n//\n// setDOMAttr:: ?(value: any, attrs: Object)\n// A function to add the attribute's value to an attribute\n// object that's used to render the cell's DOM.\nfunction tableNodes(options) {\n var extraAttrs = options.cellAttributes || {};\n var cellAttrs = {\n colspan: {default: 1},\n rowspan: {default: 1},\n colwidth: {default: null}\n };\n for (var prop in extraAttrs)\n { cellAttrs[prop] = {default: extraAttrs[prop].default}; }\n\n return {\n table: {\n content: \"table_row+\",\n tableRole: \"table\",\n isolating: true,\n group: options.tableGroup,\n parseDOM: [{tag: \"table\"}],\n toDOM: function toDOM() { return [\"table\", [\"tbody\", 0]] }\n },\n table_row: {\n content: \"(table_cell | table_header)*\",\n tableRole: \"row\",\n parseDOM: [{tag: \"tr\"}],\n toDOM: function toDOM() { return [\"tr\", 0] }\n },\n table_cell: {\n content: options.cellContent,\n attrs: cellAttrs,\n tableRole: \"cell\",\n isolating: true,\n parseDOM: [{tag: \"td\", getAttrs: function (dom) { return getCellAttrs(dom, extraAttrs); }}],\n toDOM: function toDOM(node) { return [\"td\", setCellAttrs(node, extraAttrs), 0] }\n },\n table_header: {\n content: options.cellContent,\n attrs: cellAttrs,\n tableRole: \"header_cell\",\n isolating: true,\n parseDOM: [{tag: \"th\", getAttrs: function (dom) { return getCellAttrs(dom, extraAttrs); }}],\n toDOM: function toDOM(node) { return [\"th\", setCellAttrs(node, extraAttrs), 0] }\n }\n }\n}\n\nfunction tableNodeTypes(schema) {\n var result = schema.cached.tableNodeTypes;\n if (!result) {\n result = schema.cached.tableNodeTypes = {};\n for (var name in schema.nodes) {\n var type = schema.nodes[name], role = type.spec.tableRole;\n if (role) { result[role] = type; }\n }\n }\n return result\n}\n\n// Utilities used for copy/paste handling.\n\n// Utilities to help with copying and pasting table cells\n\n// : (Slice) → ?{width: number, height: number, rows: [Fragment]}\n// Get a rectangular area of cells from a slice, or null if the outer\n// nodes of the slice aren't table cells or rows.\nfunction pastedCells(slice) {\n if (!slice.size) { return null }\n var content = slice.content;\n var openStart = slice.openStart;\n var openEnd = slice.openEnd;\n while (content.childCount == 1 && (openStart > 0 && openEnd > 0 || content.firstChild.type.spec.tableRole == \"table\")) {\n openStart--;\n openEnd--;\n content = content.firstChild.content;\n }\n var first = content.firstChild, role = first.type.spec.tableRole;\n var schema = first.type.schema, rows = [];\n if (role == \"row\") {\n for (var i = 0; i < content.childCount; i++) {\n var cells = content.child(i).content;\n var left = i ? 0 : Math.max(0, openStart - 1);\n var right = i < content.childCount - 1 ? 0 : Math.max(0, openEnd - 1);\n if (left || right) { cells = fitSlice(tableNodeTypes(schema).row, new Slice(cells, left, right)).content; }\n rows.push(cells);\n }\n } else if (role == \"cell\" || role == \"header_cell\") {\n rows.push(openStart || openEnd ? fitSlice(tableNodeTypes(schema).row, new Slice(content, openStart, openEnd)).content : content);\n } else {\n return null\n }\n return ensureRectangular(schema, rows)\n}\n\n// : (Schema, [Fragment]) → {width: number, height: number, rows: [Fragment]}\n// Compute the width and height of a set of cells, and make sure each\n// row has the same number of cells.\nfunction ensureRectangular(schema, rows) {\n var widths = [];\n for (var i = 0; i < rows.length; i++) {\n var row = rows[i];\n for (var j = row.childCount - 1; j >= 0; j--) {\n var ref = row.child(j).attrs;\n var rowspan = ref.rowspan;\n var colspan = ref.colspan;\n for (var r = i; r < i + rowspan; r++)\n { widths[r] = (widths[r] || 0) + colspan; }\n }\n }\n var width = 0;\n for (var r$1 = 0; r$1 < widths.length; r$1++) { width = Math.max(width, widths[r$1]); }\n for (var r$2 = 0; r$2 < widths.length; r$2++) {\n if (r$2 >= rows.length) { rows.push(Fragment.empty); }\n if (widths[r$2] < width) {\n var empty = tableNodeTypes(schema).cell.createAndFill(), cells = [];\n for (var i$1 = widths[r$2]; i$1 < width; i$1++) { cells.push(empty); }\n rows[r$2] = rows[r$2].append(Fragment.from(cells));\n }\n }\n return {height: rows.length, width: width, rows: rows}\n}\n\nfunction fitSlice(nodeType, slice) {\n var node = nodeType.createAndFill();\n var tr = new Transform(node).replace(0, node.content.size, slice);\n return tr.doc\n}\n\n// : ({width: number, height: number, rows: [Fragment]}, number, number) → {width: number, height: number, rows: [Fragment]}\n// Clip or extend (repeat) the given set of cells to cover the given\n// width and height. Will clip rowspan/colspan cells at the edges when\n// they stick out.\nfunction clipCells(ref, newWidth, newHeight) {\n var width = ref.width;\n var height = ref.height;\n var rows = ref.rows;\n\n if (width != newWidth) {\n var added = [], newRows = [];\n for (var row = 0; row < rows.length; row++) {\n var frag = rows[row], cells = [];\n for (var col = added[row] || 0, i = 0; col < newWidth; i++) {\n var cell = frag.child(i % frag.childCount);\n if (col + cell.attrs.colspan > newWidth)\n { cell = cell.type.create(rmColSpan(cell.attrs, cell.attrs.colspan, col + cell.attrs.colspan - newWidth), cell.content); }\n cells.push(cell);\n col += cell.attrs.colspan;\n for (var j = 1; j < cell.attrs.rowspan; j++)\n { added[row + j] = (added[row + j] || 0) + cell.attrs.colspan; }\n }\n newRows.push(Fragment.from(cells));\n }\n rows = newRows;\n width = newWidth;\n }\n\n if (height != newHeight) {\n var newRows$1 = [];\n for (var row$1 = 0, i$1 = 0; row$1 < newHeight; row$1++, i$1++) {\n var cells$1 = [], source = rows[i$1 % height];\n for (var j$1 = 0; j$1 < source.childCount; j$1++) {\n var cell$1 = source.child(j$1);\n if (row$1 + cell$1.attrs.rowspan > newHeight)\n { cell$1 = cell$1.type.create(setAttr(cell$1.attrs, \"rowspan\", newHeight - cell$1.attrs.rowspan), cell$1.content); }\n cells$1.push(cell$1);\n }\n newRows$1.push(Fragment.from(cells$1));\n }\n rows = newRows$1;\n height = newHeight;\n }\n\n return {width: width, height: height, rows: rows}\n}\n\n// Make sure a table has at least the given width and height. Return\n// true if something was changed.\nfunction growTable(tr, map, table, start, width, height, mapFrom) {\n var schema = tr.doc.type.schema, types = tableNodeTypes(schema), empty, emptyHead;\n if (width > map.width) {\n for (var row = 0, rowEnd = 0; row < map.height; row++) {\n var rowNode = table.child(row);\n rowEnd += rowNode.nodeSize;\n var cells = [], add = (void 0);\n if (rowNode.lastChild == null || rowNode.lastChild.type == types.cell)\n { add = empty || (empty = types.cell.createAndFill()); }\n else\n { add = emptyHead || (emptyHead = types.header_cell.createAndFill()); }\n for (var i = map.width; i < width; i++) { cells.push(add); }\n tr.insert(tr.mapping.slice(mapFrom).map(rowEnd - 1 + start), cells);\n }\n }\n if (height > map.height) {\n var cells$1 = [];\n for (var i$1 = 0, start$1 = (map.height - 1) * map.width; i$1 < Math.max(map.width, width); i$1++) {\n var header = i$1 >= map.width ? false :\n table.nodeAt(map.map[start$1 + i$1]).type == types.header_cell;\n cells$1.push(header\n ? (emptyHead || (emptyHead = types.header_cell.createAndFill()))\n : (empty || (empty = types.cell.createAndFill())));\n }\n\n var emptyRow = types.row.create(null, Fragment.from(cells$1)), rows = [];\n for (var i$2 = map.height; i$2 < height; i$2++) { rows.push(emptyRow); }\n tr.insert(tr.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows);\n }\n return !!(empty || emptyHead)\n}\n\n// Make sure the given line (left, top) to (right, top) doesn't cross\n// any rowspan cells by splitting cells that cross it. Return true if\n// something changed.\nfunction isolateHorizontal(tr, map, table, start, left, right, top, mapFrom) {\n if (top == 0 || top == map.height) { return false }\n var found = false;\n for (var col = left; col < right; col++) {\n var index = top * map.width + col, pos = map.map[index];\n if (map.map[index - map.width] == pos) {\n found = true;\n var cell = table.nodeAt(pos);\n var ref = map.findCell(pos);\n var cellTop = ref.top;\n var cellLeft = ref.left;\n tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, setAttr(cell.attrs, \"rowspan\", top - cellTop));\n tr.insert(tr.mapping.slice(mapFrom).map(map.positionAt(top, cellLeft, table)),\n cell.type.createAndFill(setAttr(cell.attrs, \"rowspan\", (cellTop + cell.attrs.rowspan) - top)));\n col += cell.attrs.colspan - 1;\n }\n }\n return found\n}\n\n// Make sure the given line (left, top) to (left, bottom) doesn't\n// cross any colspan cells by splitting cells that cross it. Return\n// true if something changed.\nfunction isolateVertical(tr, map, table, start, top, bottom, left, mapFrom) {\n if (left == 0 || left == map.width) { return false }\n var found = false;\n for (var row = top; row < bottom; row++) {\n var index = row * map.width + left, pos = map.map[index];\n if (map.map[index - 1] == pos) {\n found = true;\n var cell = table.nodeAt(pos), cellLeft = map.colCount(pos);\n var updatePos = tr.mapping.slice(mapFrom).map(pos + start);\n tr.setNodeMarkup(updatePos, null, rmColSpan(cell.attrs, left - cellLeft, cell.attrs.colspan - (left - cellLeft)));\n tr.insert(updatePos + cell.nodeSize, cell.type.createAndFill(rmColSpan(cell.attrs, 0, left - cellLeft)));\n row += cell.attrs.rowspan - 1;\n }\n }\n return found\n}\n\n// Insert the given set of cells (as returned by `pastedCells`) into a\n// table, at the position pointed at by rect.\nfunction insertCells(state, dispatch, tableStart, rect, cells) {\n var table = tableStart ? state.doc.nodeAt(tableStart - 1) : state.doc, map = TableMap.get(table);\n var top = rect.top;\n var left = rect.left;\n var right = left + cells.width, bottom = top + cells.height;\n var tr = state.tr, mapFrom = 0;\n function recomp() {\n table = tableStart ? tr.doc.nodeAt(tableStart - 1) : tr.doc;\n map = TableMap.get(table);\n mapFrom = tr.mapping.maps.length;\n }\n // Prepare the table to be large enough and not have any cells\n // crossing the boundaries of the rectangle that we want to\n // insert into. If anything about it changes, recompute the table\n // map so that subsequent operations can see the current shape.\n if (growTable(tr, map, table, tableStart, right, bottom, mapFrom)) { recomp(); }\n if (isolateHorizontal(tr, map, table, tableStart, left, right, top, mapFrom)) { recomp(); }\n if (isolateHorizontal(tr, map, table, tableStart, left, right, bottom, mapFrom)) { recomp(); }\n if (isolateVertical(tr, map, table, tableStart, top, bottom, left, mapFrom)) { recomp(); }\n if (isolateVertical(tr, map, table, tableStart, top, bottom, right, mapFrom)) { recomp(); }\n\n for (var row = top; row < bottom; row++) {\n var from = map.positionAt(row, left, table), to = map.positionAt(row, right, table);\n tr.replace(tr.mapping.slice(mapFrom).map(from + tableStart), tr.mapping.slice(mapFrom).map(to + tableStart),\n new Slice(cells.rows[row - top], 0, 0));\n }\n recomp();\n tr.setSelection(new CellSelection(tr.doc.resolve(tableStart + map.positionAt(top, left, table)),\n tr.doc.resolve(tableStart + map.positionAt(bottom - 1, right - 1, table))));\n dispatch(tr);\n}\n\n// This file defines a number of helpers for wiring up user input to\n\nvar handleKeyDown = keydownHandler({\n \"ArrowLeft\": arrow(\"horiz\", -1),\n \"ArrowRight\": arrow(\"horiz\", 1),\n \"ArrowUp\": arrow(\"vert\", -1),\n \"ArrowDown\": arrow(\"vert\", 1),\n\n \"Shift-ArrowLeft\": shiftArrow(\"horiz\", -1),\n \"Shift-ArrowRight\": shiftArrow(\"horiz\", 1),\n \"Shift-ArrowUp\": shiftArrow(\"vert\", -1),\n \"Shift-ArrowDown\": shiftArrow(\"vert\", 1),\n\n \"Backspace\": deleteCellSelection,\n \"Mod-Backspace\": deleteCellSelection,\n \"Delete\": deleteCellSelection,\n \"Mod-Delete\": deleteCellSelection\n});\n\nfunction maybeSetSelection(state, dispatch, selection) {\n if (selection.eq(state.selection)) { return false }\n if (dispatch) { dispatch(state.tr.setSelection(selection).scrollIntoView()); }\n return true\n}\n\nfunction arrow(axis, dir) {\n return function (state, dispatch, view) {\n var sel = state.selection;\n if (sel instanceof CellSelection) {\n return maybeSetSelection(state, dispatch, Selection.near(sel.$headCell, dir))\n }\n if (axis != \"horiz\" && !sel.empty) { return false }\n var end = atEndOfCell(view, axis, dir);\n if (end == null) { return false }\n if (axis == \"horiz\") {\n return maybeSetSelection(state, dispatch, Selection.near(state.doc.resolve(sel.head + dir), dir))\n } else {\n var $cell = state.doc.resolve(end), $next = nextCell($cell, axis, dir), newSel;\n if ($next) { newSel = Selection.near($next, 1); }\n else if (dir < 0) { newSel = Selection.near(state.doc.resolve($cell.before(-1)), -1); }\n else { newSel = Selection.near(state.doc.resolve($cell.after(-1)), 1); }\n return maybeSetSelection(state, dispatch, newSel)\n }\n }\n}\n\nfunction shiftArrow(axis, dir) {\n return function (state, dispatch, view) {\n var sel = state.selection;\n if (!(sel instanceof CellSelection)) {\n var end = atEndOfCell(view, axis, dir);\n if (end == null) { return false }\n sel = new CellSelection(state.doc.resolve(end));\n }\n var $head = nextCell(sel.$headCell, axis, dir);\n if (!$head) { return false }\n return maybeSetSelection(state, dispatch, new CellSelection(sel.$anchorCell, $head))\n }\n}\n\nfunction deleteCellSelection(state, dispatch) {\n var sel = state.selection;\n if (!(sel instanceof CellSelection)) { return false }\n if (dispatch) {\n var tr = state.tr, baseContent = tableNodeTypes(state.schema).cell.createAndFill().content;\n sel.forEachCell(function (cell, pos) {\n if (!cell.content.eq(baseContent))\n { tr.replace(tr.mapping.map(pos + 1), tr.mapping.map(pos + cell.nodeSize - 1),\n new Slice(baseContent, 0, 0)); }\n });\n if (tr.docChanged) { dispatch(tr); }\n }\n return true\n}\n\nfunction handleTripleClick(view, pos) {\n var doc = view.state.doc, $cell = cellAround(doc.resolve(pos));\n if (!$cell) { return false }\n view.dispatch(view.state.tr.setSelection(new CellSelection($cell)));\n return true\n}\n\nfunction handlePaste(view, _, slice) {\n if (!isInTable(view.state)) { return false }\n var cells = pastedCells(slice), sel = view.state.selection;\n if (sel instanceof CellSelection) {\n if (!cells) { cells = {width: 1, height: 1, rows: [Fragment.from(fitSlice(tableNodeTypes(view.state.schema).cell, slice))]}; }\n var table = sel.$anchorCell.node(-1), start = sel.$anchorCell.start(-1);\n var rect = TableMap.get(table).rectBetween(sel.$anchorCell.pos - start, sel.$headCell.pos - start);\n cells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);\n insertCells(view.state, view.dispatch, start, rect, cells);\n return true\n } else if (cells) {\n var $cell = selectionCell(view.state), start$1 = $cell.start(-1);\n insertCells(view.state, view.dispatch, start$1, TableMap.get($cell.node(-1)).findCell($cell.pos - start$1), cells);\n return true\n } else {\n return false\n }\n}\n\nfunction handleMouseDown(view, startEvent) {\n if (startEvent.ctrlKey || startEvent.metaKey) { return }\n\n var startDOMCell = domInCell(view, startEvent.target), $anchor;\n if (startEvent.shiftKey && (view.state.selection instanceof CellSelection)) {\n // Adding to an existing cell selection\n setCellSelection(view.state.selection.$anchorCell, startEvent);\n startEvent.preventDefault();\n } else if (startEvent.shiftKey && startDOMCell &&\n ($anchor = cellAround(view.state.selection.$anchor)) != null &&\n cellUnderMouse(view, startEvent).pos != $anchor.pos) {\n // Adding to a selection that starts in another cell (causing a\n // cell selection to be created).\n setCellSelection($anchor, startEvent);\n startEvent.preventDefault();\n } else if (!startDOMCell) {\n // Not in a cell, let the default behavior happen.\n return\n }\n\n // Create and dispatch a cell selection between the given anchor and\n // the position under the mouse.\n function setCellSelection($anchor, event) {\n var $head = cellUnderMouse(view, event);\n var starting = key.getState(view.state) == null;\n if (!$head || !inSameTable($anchor, $head)) {\n if (starting) { $head = $anchor; }\n else { return }\n }\n var selection = new CellSelection($anchor, $head);\n if (starting || !view.state.selection.eq(selection)) {\n var tr = view.state.tr.setSelection(selection);\n if (starting) { tr.setMeta(key, $anchor.pos); }\n view.dispatch(tr);\n }\n }\n\n // Stop listening to mouse motion events.\n function stop() {\n view.root.removeEventListener(\"mouseup\", stop);\n view.root.removeEventListener(\"dragstart\", stop);\n view.root.removeEventListener(\"mousemove\", move);\n if (key.getState(view.state) != null) { view.dispatch(view.state.tr.setMeta(key, -1)); }\n }\n\n function move(event) {\n var anchor = key.getState(view.state), $anchor;\n if (anchor != null) {\n // Continuing an existing cross-cell selection\n $anchor = view.state.doc.resolve(anchor);\n } else if (domInCell(view, event.target) != startDOMCell) {\n // Moving out of the initial cell -- start a new cell selection\n $anchor = cellUnderMouse(view, startEvent);\n if (!$anchor) { return stop() }\n }\n if ($anchor) { setCellSelection($anchor, event); }\n }\n view.root.addEventListener(\"mouseup\", stop);\n view.root.addEventListener(\"dragstart\", stop);\n view.root.addEventListener(\"mousemove\", move);\n}\n\n// Check whether the cursor is at the end of a cell (so that further\n// motion would move out of the cell)\nfunction atEndOfCell(view, axis, dir) {\n if (!(view.state.selection instanceof TextSelection)) { return null }\n var ref = view.state.selection;\n var $head = ref.$head;\n for (var d = $head.depth - 1; d >= 0; d--) {\n var parent = $head.node(d), index = dir < 0 ? $head.index(d) : $head.indexAfter(d);\n if (index != (dir < 0 ? 0 : parent.childCount)) { return null }\n if (parent.type.spec.tableRole == \"cell\" || parent.type.spec.tableRole == \"header_cell\") {\n var cellPos = $head.before(d);\n var dirStr = axis == \"vert\" ? (dir > 0 ? \"down\" : \"up\") : (dir > 0 ? \"right\" : \"left\");\n return view.endOfTextblock(dirStr) ? cellPos : null\n }\n }\n return null\n}\n\nfunction domInCell(view, dom) {\n for (; dom && dom != view.dom; dom = dom.parentNode)\n { if (dom.nodeName == \"TD\" || dom.nodeName == \"TH\") { return dom } }\n}\n\nfunction cellUnderMouse(view, event) {\n var mousePos = view.posAtCoords({left: event.clientX, top: event.clientY});\n if (!mousePos) { return null }\n return mousePos ? cellAround(view.state.doc.resolve(mousePos.pos)) : null\n}\n\n// This file defines helpers for normalizing tables, making sure no\n\nvar fixTablesKey = new PluginKey(\"fix-tables\");\n\n// Helper for iterating through the nodes in a document that changed\n// compared to the given previous document. Useful for avoiding\n// duplicate work on each transaction.\nfunction changedDescendants(old, cur, offset, f) {\n var oldSize = old.childCount, curSize = cur.childCount;\n outer: for (var i = 0, j = 0; i < curSize; i++) {\n var child = cur.child(i);\n for (var scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {\n if (old.child(scan) == child) {\n j = scan + 1;\n offset += child.nodeSize;\n continue outer\n }\n }\n f(child, offset);\n if (j < oldSize && old.child(j).sameMarkup(child))\n { changedDescendants(old.child(j), child, offset + 1, f); }\n else\n { child.nodesBetween(0, child.content.size, f, offset + 1); }\n offset += child.nodeSize;\n }\n}\n\n// :: (EditorState, ?EditorState) → ?Transaction\n// Inspect all tables in the given state's document and return a\n// transaction that fixes them, if necessary. If `oldState` was\n// provided, that is assumed to hold a previous, known-good state,\n// which will be used to avoid re-scanning unchanged parts of the\n// document.\nfunction fixTables(state, oldState) {\n var tr, check = function (node, pos) {\n if (node.type.spec.tableRole == \"table\") { tr = fixTable(state, node, pos, tr); }\n };\n if (!oldState) { state.doc.descendants(check); }\n else if (oldState.doc != state.doc) { changedDescendants(oldState.doc, state.doc, 0, check); }\n return tr\n}\n\n// : (EditorState, Node, number, ?Transaction) → ?Transaction\n// Fix the given table, if necessary. Will append to the transaction\n// it was given, if non-null, or create a new one if necessary.\nfunction fixTable(state, table, tablePos, tr) {\n var map = TableMap.get(table);\n if (!map.problems) { return tr }\n if (!tr) { tr = state.tr; }\n\n // Track which rows we must add cells to, so that we can adjust that\n // when fixing collisions.\n var mustAdd = [];\n for (var i = 0; i < map.height; i++) { mustAdd.push(0); }\n for (var i$1 = 0; i$1 < map.problems.length; i$1++) {\n var prob = map.problems[i$1];\n if (prob.type == \"collision\") {\n var cell = table.nodeAt(prob.pos);\n for (var j = 0; j < cell.attrs.rowspan; j++) { mustAdd[prob.row + j] += prob.n; }\n tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, rmColSpan(cell.attrs, cell.attrs.colspan - prob.n, prob.n));\n } else if (prob.type == \"missing\") {\n mustAdd[prob.row] += prob.n;\n } else if (prob.type == \"overlong_rowspan\") {\n var cell$1 = table.nodeAt(prob.pos);\n tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, setAttr(cell$1.attrs, \"rowspan\", cell$1.attrs.rowspan - prob.n));\n } else if (prob.type == \"colwidth mismatch\") {\n var cell$2 = table.nodeAt(prob.pos);\n tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, setAttr(cell$2.attrs, \"colwidth\", prob.colwidth));\n }\n }\n var first, last;\n for (var i$2 = 0; i$2 < mustAdd.length; i$2++) { if (mustAdd[i$2]) {\n if (first == null) { first = i$2; }\n last = i$2;\n } }\n // Add the necessary cells, using a heuristic for whether to add the\n // cells at the start or end of the rows (if it looks like a 'bite'\n // was taken out of the table, add cells at the start of the row\n // after the bite. Otherwise add them at the end).\n for (var i$3 = 0, pos = tablePos + 1; i$3 < map.height; i$3++) {\n var row = table.child(i$3);\n var end = pos + row.nodeSize;\n var add = mustAdd[i$3];\n if (add > 0) {\n var tableNodeType = 'cell';\n if (row.firstChild) {\n tableNodeType = row.firstChild.type.spec.tableRole;\n }\n var nodes = [];\n for (var j$1 = 0; j$1 < add; j$1++)\n { nodes.push(tableNodeTypes(state.schema)[tableNodeType].createAndFill()); }\n var side = (i$3 == 0 || first == i$3 - 1) && last == i$3 ? pos + 1 : end - 1;\n tr.insert(tr.mapping.map(side), nodes);\n }\n pos = end;\n }\n return tr.setMeta(fixTablesKey, { fixTables: true })\n}\n\n// This file defines a number of table-related commands.\n\n// Helper to get the selected rectangle in a table, if any. Adds table\n// map, table node, and table start offset to the object for\n// convenience.\nfunction selectedRect(state) {\n var sel = state.selection, $pos = selectionCell(state);\n var table = $pos.node(-1), tableStart = $pos.start(-1), map = TableMap.get(table);\n var rect;\n if (sel instanceof CellSelection)\n { rect = map.rectBetween(sel.$anchorCell.pos - tableStart, sel.$headCell.pos - tableStart); }\n else\n { rect = map.findCell($pos.pos - tableStart); }\n rect.tableStart = tableStart;\n rect.map = map;\n rect.table = table;\n return rect\n}\n\nfunction columnIsHeader(map, table, col) {\n var headerCell = tableNodeTypes(table.type.schema).header_cell;\n for (var row = 0; row < map.height; row++)\n { if (table.nodeAt(map.map[col + row * map.width]).type != headerCell)\n { return false } }\n return true\n}\n\n// Add a column at the given position in a table.\nfunction addColumn(tr, ref, col) {\n var map = ref.map;\n var tableStart = ref.tableStart;\n var table = ref.table;\n\n var refColumn = col > 0 ? -1 : 0;\n if (columnIsHeader(map, table, col + refColumn))\n { refColumn = col == 0 || col == map.width ? null : 0; }\n\n for (var row = 0; row < map.height; row++) {\n var index = row * map.width + col;\n // If this position falls inside a col-spanning cell\n if (col > 0 && col < map.width && map.map[index - 1] == map.map[index]) {\n var pos = map.map[index], cell = table.nodeAt(pos);\n tr.setNodeMarkup(tr.mapping.map(tableStart + pos), null,\n addColSpan(cell.attrs, col - map.colCount(pos)));\n // Skip ahead if rowspan > 1\n row += cell.attrs.rowspan - 1;\n } else {\n var type = refColumn == null ? tableNodeTypes(table.type.schema).cell\n : table.nodeAt(map.map[index + refColumn]).type;\n var pos$1 = map.positionAt(row, col, table);\n tr.insert(tr.mapping.map(tableStart + pos$1), type.createAndFill());\n }\n }\n return tr\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Command to add a column before the column with the selection.\nfunction addColumnBefore(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state);\n dispatch(addColumn(state.tr, rect, rect.left));\n }\n return true\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Command to add a column after the column with the selection.\nfunction addColumnAfter(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state);\n dispatch(addColumn(state.tr, rect, rect.right));\n }\n return true\n}\n\nfunction removeColumn(tr, ref, col) {\n var map = ref.map;\n var table = ref.table;\n var tableStart = ref.tableStart;\n\n var mapStart = tr.mapping.maps.length;\n for (var row = 0; row < map.height;) {\n var index = row * map.width + col, pos = map.map[index], cell = table.nodeAt(pos);\n // If this is part of a col-spanning cell\n if ((col > 0 && map.map[index - 1] == pos) || (col < map.width - 1 && map.map[index + 1] == pos)) {\n tr.setNodeMarkup(tr.mapping.slice(mapStart).map(tableStart + pos), null,\n rmColSpan(cell.attrs, col - map.colCount(pos)));\n } else {\n var start = tr.mapping.slice(mapStart).map(tableStart + pos);\n tr.delete(start, start + cell.nodeSize);\n }\n row += cell.attrs.rowspan;\n }\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Command function that removes the selected columns from a table.\nfunction deleteColumn(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state), tr = state.tr;\n if (rect.left == 0 && rect.right == rect.map.width) { return false }\n for (var i = rect.right - 1;; i--) {\n removeColumn(tr, rect, i);\n if (i == rect.left) { break }\n rect.table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n rect.map = TableMap.get(rect.table);\n }\n dispatch(tr);\n }\n return true\n}\n\nfunction rowIsHeader(map, table, row) {\n var headerCell = tableNodeTypes(table.type.schema).header_cell;\n for (var col = 0; col < map.width; col++)\n { if (table.nodeAt(map.map[col + row * map.width]).type != headerCell)\n { return false } }\n return true\n}\n\nfunction addRow(tr, ref, row) {\n var map = ref.map;\n var tableStart = ref.tableStart;\n var table = ref.table;\n\n var rowPos = tableStart;\n for (var i = 0; i < row; i++) { rowPos += table.child(i).nodeSize; }\n var cells = [], refRow = row > 0 ? -1 : 0;\n if (rowIsHeader(map, table, row + refRow))\n { refRow = row == 0 || row == map.height ? null : 0; }\n for (var col = 0, index = map.width * row; col < map.width; col++, index++) {\n // Covered by a rowspan cell\n if (row > 0 && row < map.height && map.map[index] == map.map[index - map.width]) {\n var pos = map.map[index], attrs = table.nodeAt(pos).attrs;\n tr.setNodeMarkup(tableStart + pos, null, setAttr(attrs, \"rowspan\", attrs.rowspan + 1));\n col += attrs.colspan - 1;\n } else {\n var type = refRow == null ? tableNodeTypes(table.type.schema).cell\n : table.nodeAt(map.map[index + refRow * map.width]).type;\n cells.push(type.createAndFill());\n }\n }\n tr.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));\n return tr\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Add a table row before the selection.\nfunction addRowBefore(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state);\n dispatch(addRow(state.tr, rect, rect.top));\n }\n return true\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Add a table row after the selection.\nfunction addRowAfter(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state);\n dispatch(addRow(state.tr, rect, rect.bottom));\n }\n return true\n}\n\nfunction removeRow(tr, ref, row) {\n var map = ref.map;\n var table = ref.table;\n var tableStart = ref.tableStart;\n\n var rowPos = 0;\n for (var i = 0; i < row; i++) { rowPos += table.child(i).nodeSize; }\n var nextRow = rowPos + table.child(row).nodeSize;\n\n var mapFrom = tr.mapping.maps.length;\n tr.delete(rowPos + tableStart, nextRow + tableStart);\n\n for (var col = 0, index = row * map.width; col < map.width; col++, index++) {\n var pos = map.map[index];\n if (row > 0 && pos == map.map[index - map.width]) {\n // If this cell starts in the row above, simply reduce its rowspan\n var attrs = table.nodeAt(pos).attrs;\n tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, setAttr(attrs, \"rowspan\", attrs.rowspan - 1));\n col += attrs.colspan - 1;\n } else if (row < map.width && pos == map.map[index + map.width]) {\n // Else, if it continues in the row below, it has to be moved down\n var cell = table.nodeAt(pos);\n var copy = cell.type.create(setAttr(cell.attrs, \"rowspan\", cell.attrs.rowspan - 1), cell.content);\n var newPos = map.positionAt(row + 1, col, table);\n tr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);\n col += cell.attrs.colspan - 1;\n }\n }\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Remove the selected rows from a table.\nfunction deleteRow(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state), tr = state.tr;\n if (rect.top == 0 && rect.bottom == rect.map.height) { return false }\n for (var i = rect.bottom - 1;; i--) {\n removeRow(tr, rect, i);\n if (i == rect.top) { break }\n rect.table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n rect.map = TableMap.get(rect.table);\n }\n dispatch(tr);\n }\n return true\n}\n\nfunction isEmpty(cell) {\n var c = cell.content;\n return c.childCount == 1 && c.firstChild.isTextblock && c.firstChild.childCount == 0\n}\n\nfunction cellsOverlapRectangle(ref, rect) {\n var width = ref.width;\n var height = ref.height;\n var map = ref.map;\n\n var indexTop = rect.top * width + rect.left, indexLeft = indexTop;\n var indexBottom = (rect.bottom - 1) * width + rect.left, indexRight = indexTop + (rect.right - rect.left - 1);\n for (var i = rect.top; i < rect.bottom; i++) {\n if (rect.left > 0 && map[indexLeft] == map[indexLeft - 1] ||\n rect.right < width && map[indexRight] == map[indexRight + 1]) { return true }\n indexLeft += width; indexRight += width;\n }\n for (var i$1 = rect.left; i$1 < rect.right; i$1++) {\n if (rect.top > 0 && map[indexTop] == map[indexTop - width] ||\n rect.bottom < height && map[indexBottom] == map[indexBottom + width]) { return true }\n indexTop++; indexBottom++;\n }\n return false\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Merge the selected cells into a single cell. Only available when\n// the selected cells' outline forms a rectangle.\nfunction mergeCells(state, dispatch) {\n var sel = state.selection;\n if (!(sel instanceof CellSelection) || sel.$anchorCell.pos == sel.$headCell.pos) { return false }\n var rect = selectedRect(state);\n var map = rect.map;\n if (cellsOverlapRectangle(map, rect)) { return false }\n if (dispatch) {\n var tr = state.tr, seen = {}, content = Fragment.empty, mergedPos, mergedCell;\n for (var row = rect.top; row < rect.bottom; row++) {\n for (var col = rect.left; col < rect.right; col++) {\n var cellPos = map.map[row * map.width + col], cell = rect.table.nodeAt(cellPos);\n if (seen[cellPos]) { continue }\n seen[cellPos] = true;\n if (mergedPos == null) {\n mergedPos = cellPos;\n mergedCell = cell;\n } else {\n if (!isEmpty(cell)) { content = content.append(cell.content); }\n var mapped = tr.mapping.map(cellPos + rect.tableStart);\n tr.delete(mapped, mapped + cell.nodeSize);\n }\n }\n }\n tr.setNodeMarkup(mergedPos + rect.tableStart, null,\n setAttr(addColSpan(mergedCell.attrs, mergedCell.attrs.colspan, (rect.right - rect.left) - mergedCell.attrs.colspan),\n \"rowspan\", rect.bottom - rect.top));\n if (content.size) {\n var end = mergedPos + 1 + mergedCell.content.size;\n var start = isEmpty(mergedCell) ? mergedPos + 1 : end;\n tr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);\n }\n tr.setSelection(new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart)));\n dispatch(tr);\n }\n return true\n}\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Split a selected cell, whose rowpan or colspan is greater than one,\n// into smaller cells. Use the first cell type for the new cells.\nfunction splitCell(state, dispatch) {\n var nodeTypes = tableNodeTypes(state.schema);\n return splitCellWithType(function (ref) {\n var node = ref.node;\n\n return nodeTypes[node.type.spec.tableRole]\n })(state, dispatch)\n}\n\n// :: (getCellType: ({ row: number, col: number, node: Node}) → NodeType) → (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Split a selected cell, whose rowpan or colspan is greater than one,\n// into smaller cells with the cell type (th, td) returned by getType function.\nfunction splitCellWithType(getCellType) {\n return function (state, dispatch) {\n var sel = state.selection;\n var cellNode, cellPos;\n if (!(sel instanceof CellSelection)) {\n cellNode = cellWrapping(sel.$from);\n if (!cellNode) { return false }\n cellPos = cellAround(sel.$from).pos;\n } else {\n if (sel.$anchorCell.pos != sel.$headCell.pos) { return false }\n cellNode = sel.$anchorCell.nodeAfter;\n cellPos = sel.$anchorCell.pos;\n }\n if (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) {return false}\n if (dispatch) {\n var baseAttrs = cellNode.attrs, attrs = [], colwidth = baseAttrs.colwidth;\n if (baseAttrs.rowspan > 1) { baseAttrs = setAttr(baseAttrs, \"rowspan\", 1); }\n if (baseAttrs.colspan > 1) { baseAttrs = setAttr(baseAttrs, \"colspan\", 1); }\n var rect = selectedRect(state), tr = state.tr;\n for (var i = 0; i < rect.right - rect.left; i++)\n { attrs.push(colwidth ? setAttr(baseAttrs, \"colwidth\", colwidth && colwidth[i] ? [colwidth[i]] : null) : baseAttrs); }\n var lastCell;\n for (var row = rect.top; row < rect.bottom; row++) {\n var pos = rect.map.positionAt(row, rect.left, rect.table);\n if (row == rect.top) { pos += cellNode.nodeSize; }\n for (var col = rect.left, i$1 = 0; col < rect.right; col++, i$1++) {\n if (col == rect.left && row == rect.top) { continue }\n tr.insert(lastCell = tr.mapping.map(pos + rect.tableStart, 1), getCellType({ node: cellNode, row: row, col: col}).createAndFill(attrs[i$1]));\n }\n }\n tr.setNodeMarkup(cellPos, getCellType({ node: cellNode, row: rect.top, col: rect.left}), attrs[0]);\n if (sel instanceof CellSelection)\n { tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos),\n lastCell && tr.doc.resolve(lastCell))); }\n dispatch(tr);\n }\n return true\n }\n}\n\n// :: (string, any) → (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Returns a command that sets the given attribute to the given value,\n// and is only available when the currently selected cell doesn't\n// already have that attribute set to that value.\nfunction setCellAttr(name, value) {\n return function(state, dispatch) {\n if (!isInTable(state)) { return false }\n var $cell = selectionCell(state);\n if ($cell.nodeAfter.attrs[name] === value) { return false }\n if (dispatch) {\n var tr = state.tr;\n if (state.selection instanceof CellSelection)\n { state.selection.forEachCell(function (node, pos) {\n if (node.attrs[name] !== value)\n { tr.setNodeMarkup(pos, null, setAttr(node.attrs, name, value)); }\n }); }\n else\n { tr.setNodeMarkup($cell.pos, null, setAttr($cell.nodeAfter.attrs, name, value)); }\n dispatch(tr);\n }\n return true\n }\n}\n\nfunction deprecated_toggleHeader(type) {\n return function(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var types = tableNodeTypes(state.schema);\n var rect = selectedRect(state), tr = state.tr;\n var cells = rect.map.cellsInRect(type == \"column\" ? new Rect(rect.left, 0, rect.right, rect.map.height) :\n type == \"row\" ? new Rect(0, rect.top, rect.map.width, rect.bottom) : rect);\n var nodes = cells.map(function (pos) { return rect.table.nodeAt(pos); });\n for (var i = 0; i < cells.length; i++) // Remove headers, if any\n { if (nodes[i].type == types.header_cell)\n { tr.setNodeMarkup(rect.tableStart + cells[i], types.cell, nodes[i].attrs); } }\n if (tr.steps.length == 0) { for (var i$1 = 0; i$1 < cells.length; i$1++) // No headers removed, add instead\n { tr.setNodeMarkup(rect.tableStart + cells[i$1], types.header_cell, nodes[i$1].attrs); } }\n dispatch(tr);\n }\n return true\n }\n}\n\nfunction isHeaderEnabledByType(type, rect, types) {\n // Get cell positions for first row or first column\n var cellPositions = rect.map.cellsInRect({\n left: 0,\n top: 0,\n right: type == \"row\" ? rect.map.width : 1,\n bottom: type == \"column\" ? rect.map.height : 1,\n });\n\n for (var i = 0; i < cellPositions.length; i++) {\n var cell = rect.table.nodeAt(cellPositions[i]);\n if (cell && cell.type !== types.header_cell) {\n return false\n }\n }\n\n return true\n}\n\n// :: (string, ?{ useDeprecatedLogic: bool }) → (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Toggles between row/column header and normal cells (Only applies to first row/column).\n// For deprecated behavior pass `useDeprecatedLogic` in options with true.\nfunction toggleHeader(type, options) {\n options = options || { useDeprecatedLogic: false };\n\n if (options.useDeprecatedLogic)\n { return deprecated_toggleHeader(type) }\n\n return function(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var types = tableNodeTypes(state.schema);\n var rect = selectedRect(state), tr = state.tr;\n\n var isHeaderRowEnabled = isHeaderEnabledByType(\"row\", rect, types);\n var isHeaderColumnEnabled = isHeaderEnabledByType(\"column\", rect, types);\n\n var isHeaderEnabled = type === \"column\" ? isHeaderRowEnabled :\n type === \"row\" ? isHeaderColumnEnabled : false;\n\n var selectionStartsAt = isHeaderEnabled ? 1 : 0;\n\n var cellsRect = type == \"column\" ? new Rect(0, selectionStartsAt, 1, rect.map.height) :\n type == \"row\" ? new Rect(selectionStartsAt, 0, rect.map.width, 1) : rect;\n\n var newType = type == \"column\" ? isHeaderColumnEnabled ? types.cell : types.header_cell :\n type == \"row\" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell;\n\n rect.map.cellsInRect(cellsRect).forEach(function (relativeCellPos) {\n var cellPos = relativeCellPos + rect.tableStart;\n var cell = tr.doc.nodeAt(cellPos);\n\n if (cell) {\n tr.setNodeMarkup(cellPos, newType, cell.attrs);\n }\n });\n\n dispatch(tr);\n }\n return true\n }\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Toggles whether the selected row contains header cells.\nvar toggleHeaderRow = toggleHeader(\"row\", { useDeprecatedLogic: true });\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Toggles whether the selected column contains header cells.\nvar toggleHeaderColumn = toggleHeader(\"column\", { useDeprecatedLogic: true });\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Toggles whether the selected cells are header cells.\nvar toggleHeaderCell = toggleHeader(\"cell\", { useDeprecatedLogic: true });\n\nfunction findNextCell($cell, dir) {\n if (dir < 0) {\n var before = $cell.nodeBefore;\n if (before) { return $cell.pos - before.nodeSize }\n for (var row = $cell.index(-1) - 1, rowEnd = $cell.before(); row >= 0; row--) {\n var rowNode = $cell.node(-1).child(row);\n if (rowNode.childCount) { return rowEnd - 1 - rowNode.lastChild.nodeSize }\n rowEnd -= rowNode.nodeSize;\n }\n } else {\n if ($cell.index() < $cell.parent.childCount - 1) { return $cell.pos + $cell.nodeAfter.nodeSize }\n var table = $cell.node(-1);\n for (var row$1 = $cell.indexAfter(-1), rowStart = $cell.after(); row$1 < table.childCount; row$1++) {\n var rowNode$1 = table.child(row$1);\n if (rowNode$1.childCount) { return rowStart + 1 }\n rowStart += rowNode$1.nodeSize;\n }\n }\n}\n\n// :: (number) → (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Returns a command for selecting the next (direction=1) or previous\n// (direction=-1) cell in a table.\nfunction goToNextCell(direction) {\n return function(state, dispatch) {\n if (!isInTable(state)) { return false }\n var cell = findNextCell(selectionCell(state), direction);\n if (cell == null) { return }\n if (dispatch) {\n var $cell = state.doc.resolve(cell);\n dispatch(state.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView());\n }\n return true\n }\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Deletes the table around the selection, if any.\nfunction deleteTable(state, dispatch) {\n var $pos = state.selection.$anchor;\n for (var d = $pos.depth; d > 0; d--) {\n var node = $pos.node(d);\n if (node.type.spec.tableRole == \"table\") {\n if (dispatch) { dispatch(state.tr.delete($pos.before(d), $pos.after(d)).scrollIntoView()); }\n return true\n }\n }\n return false\n}\n\nvar TableView = function TableView(node, cellMinWidth) {\n this.node = node;\n this.cellMinWidth = cellMinWidth;\n this.dom = document.createElement(\"div\");\n this.dom.className = \"tableWrapper\";\n this.table = this.dom.appendChild(document.createElement(\"table\"));\n this.colgroup = this.table.appendChild(document.createElement(\"colgroup\"));\n updateColumns(node, this.colgroup, this.table, cellMinWidth);\n this.contentDOM = this.table.appendChild(document.createElement(\"tbody\"));\n};\n\nTableView.prototype.update = function update (node) {\n if (node.type != this.node.type) { return false }\n this.node = node;\n updateColumns(node, this.colgroup, this.table, this.cellMinWidth);\n return true\n};\n\nTableView.prototype.ignoreMutation = function ignoreMutation (record) {\n return record.type == \"attributes\" && (record.target == this.table || this.colgroup.contains(record.target))\n};\n\nfunction updateColumns(node, colgroup, table, cellMinWidth, overrideCol, overrideValue) {\n var totalWidth = 0, fixedWidth = true;\n var nextDOM = colgroup.firstChild, row = node.firstChild;\n for (var i = 0, col = 0; i < row.childCount; i++) {\n var ref = row.child(i).attrs;\n var colspan = ref.colspan;\n var colwidth = ref.colwidth;\n for (var j = 0; j < colspan; j++, col++) {\n var hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j];\n var cssWidth = hasWidth ? hasWidth + \"px\" : \"\";\n totalWidth += hasWidth || cellMinWidth;\n if (!hasWidth) { fixedWidth = false; }\n if (!nextDOM) {\n colgroup.appendChild(document.createElement(\"col\")).style.width = cssWidth;\n } else {\n if (nextDOM.style.width != cssWidth) { nextDOM.style.width = cssWidth; }\n nextDOM = nextDOM.nextSibling;\n }\n }\n }\n\n while (nextDOM) {\n var after = nextDOM.nextSibling;\n nextDOM.parentNode.removeChild(nextDOM);\n nextDOM = after;\n }\n\n if (fixedWidth) {\n table.style.width = totalWidth + \"px\";\n table.style.minWidth = \"\";\n } else {\n table.style.width = \"\";\n table.style.minWidth = totalWidth + \"px\";\n }\n}\n\nvar key$1 = new PluginKey(\"tableColumnResizing\");\n\nfunction columnResizing(ref) {\n if ( ref === void 0 ) ref = {};\n var handleWidth = ref.handleWidth; if ( handleWidth === void 0 ) handleWidth = 5;\n var cellMinWidth = ref.cellMinWidth; if ( cellMinWidth === void 0 ) cellMinWidth = 25;\n var View = ref.View; if ( View === void 0 ) View = TableView;\n var lastColumnResizable = ref.lastColumnResizable; if ( lastColumnResizable === void 0 ) lastColumnResizable = true;\n\n var plugin = new Plugin({\n key: key$1,\n state: {\n init: function init(_, state) {\n this.spec.props.nodeViews[tableNodeTypes(state.schema).table.name] =\n function (node, view) { return new View(node, cellMinWidth, view); };\n return new ResizeState(-1, false)\n },\n apply: function apply(tr, prev) {\n return prev.apply(tr)\n }\n },\n props: {\n attributes: function attributes(state) {\n var pluginState = key$1.getState(state);\n return pluginState.activeHandle > -1 ? {class: \"resize-cursor\"} : null\n },\n\n handleDOMEvents: {\n mousemove: function mousemove(view, event) { handleMouseMove(view, event, handleWidth, cellMinWidth, lastColumnResizable); },\n mouseleave: function mouseleave(view) { handleMouseLeave(view); },\n mousedown: function mousedown(view, event) { handleMouseDown$1(view, event, cellMinWidth); }\n },\n\n decorations: function decorations(state) {\n var pluginState = key$1.getState(state);\n if (pluginState.activeHandle > -1) { return handleDecorations(state, pluginState.activeHandle) }\n },\n\n nodeViews: {}\n }\n });\n return plugin\n}\n\nvar ResizeState = function ResizeState(activeHandle, dragging) {\n this.activeHandle = activeHandle;\n this.dragging = dragging;\n};\n\nResizeState.prototype.apply = function apply (tr) {\n var state = this, action = tr.getMeta(key$1);\n if (action && action.setHandle != null)\n { return new ResizeState(action.setHandle, null) }\n if (action && action.setDragging !== undefined)\n { return new ResizeState(state.activeHandle, action.setDragging) }\n if (state.activeHandle > -1 && tr.docChanged) {\n var handle = tr.mapping.map(state.activeHandle, -1);\n if (!pointsAtCell(tr.doc.resolve(handle))) { handle = null; }\n state = new ResizeState(handle, state.dragging);\n }\n return state\n};\n\nfunction handleMouseMove(view, event, handleWidth, cellMinWidth, lastColumnResizable) {\n var pluginState = key$1.getState(view.state);\n\n if (!pluginState.dragging) {\n var target = domCellAround(event.target), cell = -1;\n if (target) {\n var ref = target.getBoundingClientRect();\n var left = ref.left;\n var right = ref.right;\n if (event.clientX - left <= handleWidth)\n { cell = edgeCell(view, event, \"left\"); }\n else if (right - event.clientX <= handleWidth)\n { cell = edgeCell(view, event, \"right\"); }\n }\n\n if (cell != pluginState.activeHandle) {\n if (!lastColumnResizable && cell !== -1) {\n var $cell = view.state.doc.resolve(cell);\n var table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n var col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n\n if (col == map.width - 1) {\n return\n }\n }\n\n updateHandle(view, cell);\n }\n }\n}\n\nfunction handleMouseLeave(view) {\n var pluginState = key$1.getState(view.state);\n if (pluginState.activeHandle > -1 && !pluginState.dragging) { updateHandle(view, -1); }\n}\n\nfunction handleMouseDown$1(view, event, cellMinWidth) {\n var pluginState = key$1.getState(view.state);\n if (pluginState.activeHandle == -1 || pluginState.dragging) { return false }\n\n var cell = view.state.doc.nodeAt(pluginState.activeHandle);\n var width = currentColWidth(view, pluginState.activeHandle, cell.attrs);\n view.dispatch(view.state.tr.setMeta(key$1, {setDragging: {startX: event.clientX, startWidth: width}}));\n\n function finish(event) {\n window.removeEventListener(\"mouseup\", finish);\n window.removeEventListener(\"mousemove\", move);\n var pluginState = key$1.getState(view.state);\n if (pluginState.dragging) {\n updateColumnWidth(view, pluginState.activeHandle, draggedWidth(pluginState.dragging, event, cellMinWidth));\n view.dispatch(view.state.tr.setMeta(key$1, {setDragging: null}));\n }\n }\n function move(event) {\n if (!event.which) { return finish(event) }\n var pluginState = key$1.getState(view.state);\n var dragged = draggedWidth(pluginState.dragging, event, cellMinWidth);\n displayColumnWidth(view, pluginState.activeHandle, dragged, cellMinWidth);\n }\n\n window.addEventListener(\"mouseup\", finish);\n window.addEventListener(\"mousemove\", move);\n event.preventDefault();\n return true\n}\n\nfunction currentColWidth(view, cellPos, ref) {\n var colspan = ref.colspan;\n var colwidth = ref.colwidth;\n\n var width = colwidth && colwidth[colwidth.length - 1];\n if (width) { return width }\n var dom = view.domAtPos(cellPos);\n var node = dom.node.childNodes[dom.offset];\n var domWidth = node.offsetWidth, parts = colspan;\n if (colwidth) { for (var i = 0; i < colspan; i++) { if (colwidth[i]) {\n domWidth -= colwidth[i];\n parts--;\n } } }\n return domWidth / parts\n}\n\nfunction domCellAround(target) {\n while (target && target.nodeName != \"TD\" && target.nodeName != \"TH\")\n { target = target.classList.contains(\"ProseMirror\") ? null : target.parentNode; }\n return target\n}\n\nfunction edgeCell(view, event, side) {\n var ref = view.posAtCoords({left: event.clientX, top: event.clientY});\n var pos = ref.pos;\n var $cell = cellAround(view.state.doc.resolve(pos));\n if (!$cell) { return -1 }\n if (side == \"right\") { return $cell.pos }\n var map = TableMap.get($cell.node(-1)), start = $cell.start(-1);\n var index = map.map.indexOf($cell.pos - start);\n return index % map.width == 0 ? -1 : start + map.map[index - 1]\n}\n\nfunction draggedWidth(dragging, event, cellMinWidth) {\n var offset = event.clientX - dragging.startX;\n return Math.max(cellMinWidth, dragging.startWidth + offset)\n}\n\nfunction updateHandle(view, value) {\n view.dispatch(view.state.tr.setMeta(key$1, {setHandle: value}));\n}\n\nfunction updateColumnWidth(view, cell, width) {\n var $cell = view.state.doc.resolve(cell);\n var table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n var col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n var tr = view.state.tr;\n for (var row = 0; row < map.height; row++) {\n var mapIndex = row * map.width + col;\n // Rowspanning cell that has already been handled\n if (row && map.map[mapIndex] == map.map[mapIndex - map.width]) { continue }\n var pos = map.map[mapIndex];\n var ref = table.nodeAt(pos);\n var attrs = ref.attrs;\n var index = attrs.colspan == 1 ? 0 : col - map.colCount(pos);\n if (attrs.colwidth && attrs.colwidth[index] == width) { continue }\n var colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);\n colwidth[index] = width;\n tr.setNodeMarkup(start + pos, null, setAttr(attrs, \"colwidth\", colwidth));\n }\n if (tr.docChanged) { view.dispatch(tr); }\n}\n\nfunction displayColumnWidth(view, cell, width, cellMinWidth) {\n var $cell = view.state.doc.resolve(cell);\n var table = $cell.node(-1), start = $cell.start(-1);\n var col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n var dom = view.domAtPos($cell.start(-1)).node;\n while (dom.nodeName != \"TABLE\") { dom = dom.parentNode; }\n updateColumns(table, dom.firstChild, dom, cellMinWidth, col, width);\n}\n\nfunction zeroes(n) {\n var result = [];\n for (var i = 0; i < n; i++) { result.push(0); }\n return result\n}\n\nfunction handleDecorations(state, cell) {\n var decorations = [];\n var $cell = state.doc.resolve(cell);\n var table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n var col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan;\n for (var row = 0; row < map.height; row++) {\n var index = col + row * map.width - 1;\n // For positions that are have either a different cell or the end\n // of the table to their right, and either the top of the table or\n // a different cell above them, add a decoration\n if ((col == map.width || map.map[index] != map.map[index + 1]) &&\n (row == 0 || map.map[index - 1] != map.map[index - 1 - map.width])) {\n var cellPos = map.map[index];\n var pos = start + cellPos + table.nodeAt(cellPos).nodeSize - 1;\n var dom = document.createElement(\"div\");\n dom.className = \"column-resize-handle\";\n decorations.push(Decoration.widget(pos, dom));\n }\n }\n return DecorationSet.create(state.doc, decorations)\n}\n\n// This file defines a plugin that handles the drawing of cell\n\n// :: () → Plugin\n//\n// Creates a [plugin](http://prosemirror.net/docs/ref/#state.Plugin)\n// that, when added to an editor, enables cell-selection, handles\n// cell-based copy/paste, and makes sure tables stay well-formed (each\n// row has the same width, and cells don't overlap).\n//\n// You should probably put this plugin near the end of your array of\n// plugins, since it handles mouse and arrow key events in tables\n// rather broadly, and other plugins, like the gap cursor or the\n// column-width dragging plugin, might want to get a turn first to\n// perform more specific behavior.\nfunction tableEditing(ref) {\n if ( ref === void 0 ) ref = {};\n var allowTableNodeSelection = ref.allowTableNodeSelection; if ( allowTableNodeSelection === void 0 ) allowTableNodeSelection = false;\n\n return new Plugin({\n key: key,\n\n // This piece of state is used to remember when a mouse-drag\n // cell-selection is happening, so that it can continue even as\n // transactions (which might move its anchor cell) come in.\n state: {\n init: function init() { return null },\n apply: function apply(tr, cur) {\n var set = tr.getMeta(key);\n if (set != null) { return set == -1 ? null : set }\n if (cur == null || !tr.docChanged) { return cur }\n var ref = tr.mapping.mapResult(cur);\n var deleted = ref.deleted;\n var pos = ref.pos;\n return deleted ? null : pos\n }\n },\n\n props: {\n decorations: drawCellSelection,\n\n handleDOMEvents: {\n mousedown: handleMouseDown\n },\n\n createSelectionBetween: function createSelectionBetween(view) {\n if (key.getState(view.state) != null) { return view.state.selection }\n },\n\n handleTripleClick: handleTripleClick,\n\n handleKeyDown: handleKeyDown,\n\n handlePaste: handlePaste\n },\n\n appendTransaction: function appendTransaction(_, oldState, state) {\n return normalizeSelection(state, fixTables(state, oldState), allowTableNodeSelection)\n }\n })\n}\n\nexport { CellSelection, TableMap, clipCells as __clipCells, insertCells as __insertCells, pastedCells as __pastedCells, addColumn, addColumnAfter, addColumnBefore, addRow, addRowAfter, addRowBefore, cellAround, colCount, columnResizing, key$1 as columnResizingPluginKey, deleteColumn, deleteRow, deleteTable, findCell, fixTables, fixTablesKey, goToNextCell, handlePaste, inSameTable, isInTable, mergeCells, moveCellForward, nextCell, removeColumn, removeRow, rowIsHeader, selectedRect, selectionCell, setCellAttr, splitCell, splitCellWithType, tableEditing, key as tableEditingKey, tableNodes, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, updateColumns as updateColumnsOnResize };\n//# sourceMappingURL=index.es.js.map\n","// HTML5 entities map: { name -> utf16string }\n//\n'use strict';\n\n/*eslint quotes:0*/\nmodule.exports = require('entities/maps/entities.json');\n","'use strict';\n\n\nmodule.exports.encode = require('./encode');\nmodule.exports.decode = require('./decode');\nmodule.exports.format = require('./format');\nmodule.exports.parse = require('./parse');\n","module.exports=/[\\0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/","module.exports=/[\\0-\\x1F\\x7F-\\x9F]/","module.exports=/[ \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]/","// Regexps to match html elements\n\n'use strict';\n\nvar attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';\n\nvar unquoted = '[^\"\\'=<>`\\\\x00-\\\\x20]+';\nvar single_quoted = \"'[^']*'\";\nvar double_quoted = '\"[^\"]*\"';\n\nvar attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';\n\nvar attribute = '(?:\\\\s+' + attr_name + '(?:\\\\s*=\\\\s*' + attr_value + ')?)';\n\nvar open_tag = '<[A-Za-z][A-Za-z0-9\\\\-]*' + attribute + '*\\\\s*\\\\/?>';\n\nvar close_tag = '<\\\\/[A-Za-z][A-Za-z0-9\\\\-]*\\\\s*>';\nvar comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';\nvar processing = '<[?].*?[?]>';\nvar declaration = '<![A-Z]+\\\\s+[^>]*>';\nvar cdata = '<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>';\n\nvar HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +\n '|' + processing + '|' + declaration + '|' + cdata + ')');\nvar HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');\n\nmodule.exports.HTML_TAG_RE = HTML_TAG_RE;\nmodule.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;\n","// ~~strike through~~\n//\n'use strict';\n\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nmodule.exports.tokenize = function strikethrough(state, silent) {\n var i, scanned, token, len, ch,\n start = state.pos,\n marker = state.src.charCodeAt(start);\n\n if (silent) { return false; }\n\n if (marker !== 0x7E/* ~ */) { return false; }\n\n scanned = state.scanDelims(state.pos, true);\n len = scanned.length;\n ch = String.fromCharCode(marker);\n\n if (len < 2) { return false; }\n\n if (len % 2) {\n token = state.push('text', '', 0);\n token.content = ch;\n len--;\n }\n\n for (i = 0; i < len; i += 2) {\n token = state.push('text', '', 0);\n token.content = ch + ch;\n\n state.delimiters.push({\n marker: marker,\n jump: i,\n token: state.tokens.length - 1,\n level: state.level,\n end: -1,\n open: scanned.can_open,\n close: scanned.can_close\n });\n }\n\n state.pos += scanned.length;\n\n return true;\n};\n\n\n// Walk through delimiter list and replace text tokens with tags\n//\nmodule.exports.postProcess = function strikethrough(state) {\n var i, j,\n startDelim,\n endDelim,\n token,\n loneMarkers = [],\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = 0; i < max; i++) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x7E/* ~ */) {\n continue;\n }\n\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n token = state.tokens[startDelim.token];\n token.type = 's_open';\n token.tag = 's';\n token.nesting = 1;\n token.markup = '~~';\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = 's_close';\n token.tag = 's';\n token.nesting = -1;\n token.markup = '~~';\n token.content = '';\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === '~') {\n\n loneMarkers.push(endDelim.token - 1);\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n //\n while (loneMarkers.length) {\n i = loneMarkers.pop();\n j = i + 1;\n\n while (j < state.tokens.length && state.tokens[j].type === 's_close') {\n j++;\n }\n\n j--;\n\n if (i !== j) {\n token = state.tokens[j];\n state.tokens[j] = state.tokens[i];\n state.tokens[i] = token;\n }\n }\n};\n","// Process *this* and _that_\n//\n'use strict';\n\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nmodule.exports.tokenize = function emphasis(state, silent) {\n var i, scanned, token,\n start = state.pos,\n marker = state.src.charCodeAt(start);\n\n if (silent) { return false; }\n\n if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }\n\n scanned = state.scanDelims(state.pos, marker === 0x2A);\n\n for (i = 0; i < scanned.length; i++) {\n token = state.push('text', '', 0);\n token.content = String.fromCharCode(marker);\n\n state.delimiters.push({\n // Char code of the starting marker (number).\n //\n marker: marker,\n\n // Total length of these series of delimiters.\n //\n length: scanned.length,\n\n // An amount of characters before this one that's equivalent to\n // current one. In plain English: if this delimiter does not open\n // an emphasis, neither do previous `jump` characters.\n //\n // Used to skip sequences like \"*****\" in one step, for 1st asterisk\n // value will be 0, for 2nd it's 1 and so on.\n //\n jump: i,\n\n // A position of the token this delimiter corresponds to.\n //\n token: state.tokens.length - 1,\n\n // Token level.\n //\n level: state.level,\n\n // If this delimiter is matched as a valid opener, `end` will be\n // equal to its position, otherwise it's `-1`.\n //\n end: -1,\n\n // Boolean flags that determine if this delimiter could open or close\n // an emphasis.\n //\n open: scanned.can_open,\n close: scanned.can_close\n });\n }\n\n state.pos += scanned.length;\n\n return true;\n};\n\n\n// Walk through delimiter list and replace text tokens with tags\n//\nmodule.exports.postProcess = function emphasis(state) {\n var i,\n startDelim,\n endDelim,\n token,\n ch,\n isStrong,\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = max - 1; i >= 0; i--) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {\n continue;\n }\n\n // Process only opening markers\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n // If the previous delimiter has the same marker and is adjacent to this one,\n // merge those into one strong delimiter.\n //\n // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`\n //\n isStrong = i > 0 &&\n delimiters[i - 1].end === startDelim.end + 1 &&\n delimiters[i - 1].token === startDelim.token - 1 &&\n delimiters[startDelim.end + 1].token === endDelim.token + 1 &&\n delimiters[i - 1].marker === startDelim.marker;\n\n ch = String.fromCharCode(startDelim.marker);\n\n token = state.tokens[startDelim.token];\n token.type = isStrong ? 'strong_open' : 'em_open';\n token.tag = isStrong ? 'strong' : 'em';\n token.nesting = 1;\n token.markup = isStrong ? ch + ch : ch;\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = isStrong ? 'strong_close' : 'em_close';\n token.tag = isStrong ? 'strong' : 'em';\n token.nesting = -1;\n token.markup = isStrong ? ch + ch : ch;\n token.content = '';\n\n if (isStrong) {\n state.tokens[delimiters[i - 1].token].content = '';\n state.tokens[delimiters[startDelim.end + 1].token].content = '';\n i--;\n }\n }\n};\n","// Markdown-it plugin to render GitHub-style task lists; see\n//\n// https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments\n// https://github.com/blog/1825-task-lists-in-all-markdown-documents\n\nvar disableCheckboxes = true;\nvar useLabelWrapper = false;\nvar useLabelAfter = false;\n\nmodule.exports = function(md, options) {\n\tif (options) {\n\t\tdisableCheckboxes = !options.enabled;\n\t\tuseLabelWrapper = !!options.label;\n\t\tuseLabelAfter = !!options.labelAfter;\n\t}\n\n\tmd.core.ruler.after('inline', 'github-task-lists', function(state) {\n\t\tvar tokens = state.tokens;\n\t\tfor (var i = 2; i < tokens.length; i++) {\n\t\t\tif (isTodoItem(tokens, i)) {\n\t\t\t\ttodoify(tokens[i], state.Token);\n\t\t\t\tattrSet(tokens[i-2], 'class', 'task-list-item' + (!disableCheckboxes ? ' enabled' : ''));\n\t\t\t\tattrSet(tokens[parentToken(tokens, i-2)], 'class', 'contains-task-list');\n\t\t\t}\n\t\t}\n\t});\n};\n\nfunction attrSet(token, name, value) {\n\tvar index = token.attrIndex(name);\n\tvar attr = [name, value];\n\n\tif (index < 0) {\n\t\ttoken.attrPush(attr);\n\t} else {\n\t\ttoken.attrs[index] = attr;\n\t}\n}\n\nfunction parentToken(tokens, index) {\n\tvar targetLevel = tokens[index].level - 1;\n\tfor (var i = index - 1; i >= 0; i--) {\n\t\tif (tokens[i].level === targetLevel) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\nfunction isTodoItem(tokens, index) {\n\treturn isInline(tokens[index]) &&\n\t isParagraph(tokens[index - 1]) &&\n\t isListItem(tokens[index - 2]) &&\n\t startsWithTodoMarkdown(tokens[index]);\n}\n\nfunction todoify(token, TokenConstructor) {\n\ttoken.children.unshift(makeCheckbox(token, TokenConstructor));\n\ttoken.children[1].content = token.children[1].content.slice(3);\n\ttoken.content = token.content.slice(3);\n\n\tif (useLabelWrapper) {\n\t\tif (useLabelAfter) {\n\t\t\ttoken.children.pop();\n\n\t\t\t// Use large random number as id property of the checkbox.\n\t\t\tvar id = 'task-item-' + Math.ceil(Math.random() * (10000 * 1000) - 1000);\n\t\t\ttoken.children[0].content = token.children[0].content.slice(0, -1) + ' id=\"' + id + '\">';\n\t\t\ttoken.children.push(afterLabel(token.content, id, TokenConstructor));\n\t\t} else {\n\t\t\ttoken.children.unshift(beginLabel(TokenConstructor));\n\t\t\ttoken.children.push(endLabel(TokenConstructor));\n\t\t}\n\t}\n}\n\nfunction makeCheckbox(token, TokenConstructor) {\n\tvar checkbox = new TokenConstructor('html_inline', '', 0);\n\tvar disabledAttr = disableCheckboxes ? ' disabled=\"\" ' : '';\n\tif (token.content.indexOf('[ ] ') === 0) {\n\t\tcheckbox.content = '<input class=\"task-list-item-checkbox\"' + disabledAttr + 'type=\"checkbox\">';\n\t} else if (token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0) {\n\t\tcheckbox.content = '<input class=\"task-list-item-checkbox\" checked=\"\"' + disabledAttr + 'type=\"checkbox\">';\n\t}\n\treturn checkbox;\n}\n\n// these next two functions are kind of hacky; probably should really be a\n// true block-level token with .tag=='label'\nfunction beginLabel(TokenConstructor) {\n\tvar token = new TokenConstructor('html_inline', '', 0);\n\ttoken.content = '<label>';\n\treturn token;\n}\n\nfunction endLabel(TokenConstructor) {\n\tvar token = new TokenConstructor('html_inline', '', 0);\n\ttoken.content = '</label>';\n\treturn token;\n}\n\nfunction afterLabel(content, id, TokenConstructor) {\n\tvar token = new TokenConstructor('html_inline', '', 0);\n\ttoken.content = '<label class=\"task-list-item-label\" for=\"' + id + '\">' + content + '</label>';\n\ttoken.attrs = [{for: id}];\n\treturn token;\n}\n\nfunction isInline(token) { return token.type === 'inline'; }\nfunction isParagraph(token) { return token.type === 'paragraph_open'; }\nfunction isListItem(token) { return token.type === 'list_item_open'; }\n\nfunction startsWithTodoMarkdown(token) {\n\t// leading whitespace in a list item is already trimmed off by markdown-it\n\treturn token.content.indexOf('[ ] ') === 0 || token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0;\n}\n","import { Schema, Mark } from 'prosemirror-model';\nimport markdownit from 'markdown-it';\n\n// ::Schema Document schema for the data model used by CommonMark.\nvar schema = new Schema({\n nodes: {\n doc: {\n content: \"block+\"\n },\n\n paragraph: {\n content: \"inline*\",\n group: \"block\",\n parseDOM: [{tag: \"p\"}],\n toDOM: function toDOM() { return [\"p\", 0] }\n },\n\n blockquote: {\n content: \"block+\",\n group: \"block\",\n parseDOM: [{tag: \"blockquote\"}],\n toDOM: function toDOM() { return [\"blockquote\", 0] }\n },\n\n horizontal_rule: {\n group: \"block\",\n parseDOM: [{tag: \"hr\"}],\n toDOM: function toDOM() { return [\"div\", [\"hr\"]] }\n },\n\n heading: {\n attrs: {level: {default: 1}},\n content: \"inline*\",\n group: \"block\",\n defining: true,\n parseDOM: [{tag: \"h1\", attrs: {level: 1}},\n {tag: \"h2\", attrs: {level: 2}},\n {tag: \"h3\", attrs: {level: 3}},\n {tag: \"h4\", attrs: {level: 4}},\n {tag: \"h5\", attrs: {level: 5}},\n {tag: \"h6\", attrs: {level: 6}}],\n toDOM: function toDOM(node) { return [\"h\" + node.attrs.level, 0] }\n },\n\n code_block: {\n content: \"text*\",\n group: \"block\",\n code: true,\n defining: true,\n marks: \"\",\n attrs: {params: {default: \"\"}},\n parseDOM: [{tag: \"pre\", preserveWhitespace: \"full\", getAttrs: function (node) { return (\n {params: node.getAttribute(\"data-params\") || \"\"}\n ); }}],\n toDOM: function toDOM(node) { return [\"pre\", node.attrs.params ? {\"data-params\": node.attrs.params} : {}, [\"code\", 0]] }\n },\n\n ordered_list: {\n content: \"list_item+\",\n group: \"block\",\n attrs: {order: {default: 1}, tight: {default: false}},\n parseDOM: [{tag: \"ol\", getAttrs: function getAttrs(dom) {\n return {order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1,\n tight: dom.hasAttribute(\"data-tight\")}\n }}],\n toDOM: function toDOM(node) {\n return [\"ol\", {start: node.attrs.order == 1 ? null : node.attrs.order,\n \"data-tight\": node.attrs.tight ? \"true\" : null}, 0]\n }\n },\n\n bullet_list: {\n content: \"list_item+\",\n group: \"block\",\n attrs: {tight: {default: false}},\n parseDOM: [{tag: \"ul\", getAttrs: function (dom) { return ({tight: dom.hasAttribute(\"data-tight\")}); }}],\n toDOM: function toDOM(node) { return [\"ul\", {\"data-tight\": node.attrs.tight ? \"true\" : null}, 0] }\n },\n\n list_item: {\n content: \"paragraph block*\",\n defining: true,\n parseDOM: [{tag: \"li\"}],\n toDOM: function toDOM() { return [\"li\", 0] }\n },\n\n text: {\n group: \"inline\"\n },\n\n image: {\n inline: true,\n attrs: {\n src: {},\n alt: {default: null},\n title: {default: null}\n },\n group: \"inline\",\n draggable: true,\n parseDOM: [{tag: \"img[src]\", getAttrs: function getAttrs(dom) {\n return {\n src: dom.getAttribute(\"src\"),\n title: dom.getAttribute(\"title\"),\n alt: dom.getAttribute(\"alt\")\n }\n }}],\n toDOM: function toDOM(node) { return [\"img\", node.attrs] }\n },\n\n hard_break: {\n inline: true,\n group: \"inline\",\n selectable: false,\n parseDOM: [{tag: \"br\"}],\n toDOM: function toDOM() { return [\"br\"] }\n }\n },\n\n marks: {\n em: {\n parseDOM: [{tag: \"i\"}, {tag: \"em\"},\n {style: \"font-style\", getAttrs: function (value) { return value == \"italic\" && null; }}],\n toDOM: function toDOM() { return [\"em\"] }\n },\n\n strong: {\n parseDOM: [{tag: \"b\"}, {tag: \"strong\"},\n {style: \"font-weight\", getAttrs: function (value) { return /^(bold(er)?|[5-9]\\d{2,})$/.test(value) && null; }}],\n toDOM: function toDOM() { return [\"strong\"] }\n },\n\n link: {\n attrs: {\n href: {},\n title: {default: null}\n },\n inclusive: false,\n parseDOM: [{tag: \"a[href]\", getAttrs: function getAttrs(dom) {\n return {href: dom.getAttribute(\"href\"), title: dom.getAttribute(\"title\")}\n }}],\n toDOM: function toDOM(node) { return [\"a\", node.attrs] }\n },\n\n code: {\n parseDOM: [{tag: \"code\"}],\n toDOM: function toDOM() { return [\"code\"] }\n }\n }\n});\n\nfunction maybeMerge(a, b) {\n if (a.isText && b.isText && Mark.sameSet(a.marks, b.marks))\n { return a.withText(a.text + b.text) }\n}\n\n// Object used to track the context of a running parse.\nvar MarkdownParseState = function MarkdownParseState(schema, tokenHandlers) {\n this.schema = schema;\n this.stack = [{type: schema.topNodeType, content: []}];\n this.marks = Mark.none;\n this.tokenHandlers = tokenHandlers;\n};\n\nMarkdownParseState.prototype.top = function top () {\n return this.stack[this.stack.length - 1]\n};\n\nMarkdownParseState.prototype.push = function push (elt) {\n if (this.stack.length) { this.top().content.push(elt); }\n};\n\n// : (string)\n// Adds the given text to the current position in the document,\n// using the current marks as styling.\nMarkdownParseState.prototype.addText = function addText (text) {\n if (!text) { return }\n var nodes = this.top().content, last = nodes[nodes.length - 1];\n var node = this.schema.text(text, this.marks), merged;\n if (last && (merged = maybeMerge(last, node))) { nodes[nodes.length - 1] = merged; }\n else { nodes.push(node); }\n};\n\n// : (Mark)\n// Adds the given mark to the set of active marks.\nMarkdownParseState.prototype.openMark = function openMark (mark) {\n this.marks = mark.addToSet(this.marks);\n};\n\n// : (Mark)\n// Removes the given mark from the set of active marks.\nMarkdownParseState.prototype.closeMark = function closeMark (mark) {\n this.marks = mark.removeFromSet(this.marks);\n};\n\nMarkdownParseState.prototype.parseTokens = function parseTokens (toks) {\n for (var i = 0; i < toks.length; i++) {\n var tok = toks[i];\n var handler = this.tokenHandlers[tok.type];\n if (!handler)\n { throw new Error(\"Token type `\" + tok.type + \"` not supported by Markdown parser\") }\n handler(this, tok);\n }\n};\n\n// : (NodeType, ?Object, ?[Node]) → ?Node\n// Add a node at the current position.\nMarkdownParseState.prototype.addNode = function addNode (type, attrs, content) {\n var node = type.createAndFill(attrs, content, this.marks);\n if (!node) { return null }\n this.push(node);\n return node\n};\n\n// : (NodeType, ?Object)\n// Wrap subsequent content in a node of the given type.\nMarkdownParseState.prototype.openNode = function openNode (type, attrs) {\n this.stack.push({type: type, attrs: attrs, content: []});\n};\n\n// : () → ?Node\n// Close and return the node that is currently on top of the stack.\nMarkdownParseState.prototype.closeNode = function closeNode () {\n if (this.marks.length) { this.marks = Mark.none; }\n var info = this.stack.pop();\n return this.addNode(info.type, info.attrs, info.content)\n};\n\nfunction attrs(spec, token) {\n if (spec.getAttrs) { return spec.getAttrs(token) }\n // For backwards compatibility when `attrs` is a Function\n else if (spec.attrs instanceof Function) { return spec.attrs(token) }\n else { return spec.attrs }\n}\n\n// Code content is represented as a single token with a `content`\n// property in Markdown-it.\nfunction noOpenClose(type) {\n return type == \"code_inline\" || type == \"code_block\" || type == \"fence\"\n}\n\nfunction withoutTrailingNewline(str) {\n return str[str.length - 1] == \"\\n\" ? str.slice(0, str.length - 1) : str\n}\n\nfunction noOp() {}\n\nfunction tokenHandlers(schema, tokens) {\n var handlers = Object.create(null);\n var loop = function ( type ) {\n var spec = tokens[type];\n if (spec.block) {\n var nodeType = schema.nodeType(spec.block);\n if (noOpenClose(type)) {\n handlers[type] = function (state, tok) {\n state.openNode(nodeType, attrs(spec, tok));\n state.addText(withoutTrailingNewline(tok.content));\n state.closeNode();\n };\n } else {\n handlers[type + \"_open\"] = function (state, tok) { return state.openNode(nodeType, attrs(spec, tok)); };\n handlers[type + \"_close\"] = function (state) { return state.closeNode(); };\n }\n } else if (spec.node) {\n var nodeType$1 = schema.nodeType(spec.node);\n handlers[type] = function (state, tok) { return state.addNode(nodeType$1, attrs(spec, tok)); };\n } else if (spec.mark) {\n var markType = schema.marks[spec.mark];\n if (noOpenClose(type)) {\n handlers[type] = function (state, tok) {\n state.openMark(markType.create(attrs(spec, tok)));\n state.addText(withoutTrailingNewline(tok.content));\n state.closeMark(markType);\n };\n } else {\n handlers[type + \"_open\"] = function (state, tok) { return state.openMark(markType.create(attrs(spec, tok))); };\n handlers[type + \"_close\"] = function (state) { return state.closeMark(markType); };\n }\n } else if (spec.ignore) {\n if (noOpenClose(type)) {\n handlers[type] = noOp;\n } else {\n handlers[type + '_open'] = noOp;\n handlers[type + '_close'] = noOp;\n }\n } else {\n throw new RangeError(\"Unrecognized parsing spec \" + JSON.stringify(spec))\n }\n };\n\n for (var type in tokens) loop( type );\n\n handlers.text = function (state, tok) { return state.addText(tok.content); };\n handlers.inline = function (state, tok) { return state.parseTokens(tok.children); };\n handlers.softbreak = handlers.softbreak || (function (state) { return state.addText(\"\\n\"); });\n\n return handlers\n}\n\n// ::- A configuration of a Markdown parser. Such a parser uses\n// [markdown-it](https://github.com/markdown-it/markdown-it) to\n// tokenize a file, and then runs the custom rules it is given over\n// the tokens to create a ProseMirror document tree.\nvar MarkdownParser = function MarkdownParser(schema, tokenizer, tokens) {\n // :: Object The value of the `tokens` object used to construct\n // this parser. Can be useful to copy and modify to base other\n // parsers on.\n this.tokens = tokens;\n this.schema = schema;\n this.tokenizer = tokenizer;\n this.tokenHandlers = tokenHandlers(schema, tokens);\n};\n\n// :: (string) → Node\n// Parse a string as [CommonMark](http://commonmark.org/) markup,\n// and create a ProseMirror document as prescribed by this parser's\n// rules.\nMarkdownParser.prototype.parse = function parse (text) {\n var state = new MarkdownParseState(this.schema, this.tokenHandlers), doc;\n state.parseTokens(this.tokenizer.parse(text, {}));\n do { doc = state.closeNode(); } while (state.stack.length)\n return doc\n};\n\n// :: MarkdownParser\n// A parser parsing unextended [CommonMark](http://commonmark.org/),\n// without inline HTML, and producing a document in the basic schema.\nvar defaultMarkdownParser = new MarkdownParser(schema, markdownit(\"commonmark\", {html: false}), {\n blockquote: {block: \"blockquote\"},\n paragraph: {block: \"paragraph\"},\n list_item: {block: \"list_item\"},\n bullet_list: {block: \"bullet_list\"},\n ordered_list: {block: \"ordered_list\", getAttrs: function (tok) { return ({order: +tok.attrGet(\"start\") || 1}); }},\n heading: {block: \"heading\", getAttrs: function (tok) { return ({level: +tok.tag.slice(1)}); }},\n code_block: {block: \"code_block\"},\n fence: {block: \"code_block\", getAttrs: function (tok) { return ({params: tok.info || \"\"}); }},\n hr: {node: \"horizontal_rule\"},\n image: {node: \"image\", getAttrs: function (tok) { return ({\n src: tok.attrGet(\"src\"),\n title: tok.attrGet(\"title\") || null,\n alt: tok.children[0] && tok.children[0].content || null\n }); }},\n hardbreak: {node: \"hard_break\"},\n\n em: {mark: \"em\"},\n strong: {mark: \"strong\"},\n link: {mark: \"link\", getAttrs: function (tok) { return ({\n href: tok.attrGet(\"href\"),\n title: tok.attrGet(\"title\") || null\n }); }},\n code_inline: {mark: \"code\"}\n});\n\n// ::- A specification for serializing a ProseMirror document as\n// Markdown/CommonMark text.\nvar MarkdownSerializer = function MarkdownSerializer(nodes, marks) {\n // :: Object<(MarkdownSerializerState, Node)> The node serializer\n // functions for this serializer.\n this.nodes = nodes;\n // :: Object The mark serializer info.\n this.marks = marks;\n};\n\n// :: (Node, ?Object) → string\n// Serialize the content of the given node to\n// [CommonMark](http://commonmark.org/).\nMarkdownSerializer.prototype.serialize = function serialize (content, options) {\n var state = new MarkdownSerializerState(this.nodes, this.marks, options);\n state.renderContent(content);\n return state.out\n};\n\n// :: MarkdownSerializer\n// A serializer for the [basic schema](#schema).\nvar defaultMarkdownSerializer = new MarkdownSerializer({\n blockquote: function blockquote(state, node) {\n state.wrapBlock(\"> \", null, node, function () { return state.renderContent(node); });\n },\n code_block: function code_block(state, node) {\n state.write(\"```\" + (node.attrs.params || \"\") + \"\\n\");\n state.text(node.textContent, false);\n state.ensureNewLine();\n state.write(\"```\");\n state.closeBlock(node);\n },\n heading: function heading(state, node) {\n state.write(state.repeat(\"#\", node.attrs.level) + \" \");\n state.renderInline(node);\n state.closeBlock(node);\n },\n horizontal_rule: function horizontal_rule(state, node) {\n state.write(node.attrs.markup || \"---\");\n state.closeBlock(node);\n },\n bullet_list: function bullet_list(state, node) {\n state.renderList(node, \" \", function () { return (node.attrs.bullet || \"*\") + \" \"; });\n },\n ordered_list: function ordered_list(state, node) {\n var start = node.attrs.order || 1;\n var maxW = String(start + node.childCount - 1).length;\n var space = state.repeat(\" \", maxW + 2);\n state.renderList(node, space, function (i) {\n var nStr = String(start + i);\n return state.repeat(\" \", maxW - nStr.length) + nStr + \". \"\n });\n },\n list_item: function list_item(state, node) {\n state.renderContent(node);\n },\n paragraph: function paragraph(state, node) {\n state.renderInline(node);\n state.closeBlock(node);\n },\n\n image: function image(state, node) {\n state.write(\"![\" + state.esc(node.attrs.alt || \"\") + \"](\" + state.esc(node.attrs.src) +\n (node.attrs.title ? \" \" + state.quote(node.attrs.title) : \"\") + \")\");\n },\n hard_break: function hard_break(state, node, parent, index) {\n for (var i = index + 1; i < parent.childCount; i++)\n { if (parent.child(i).type != node.type) {\n state.write(\"\\\\\\n\");\n return\n } }\n },\n text: function text(state, node) {\n state.text(node.text);\n }\n}, {\n em: {open: \"*\", close: \"*\", mixable: true, expelEnclosingWhitespace: true},\n strong: {open: \"**\", close: \"**\", mixable: true, expelEnclosingWhitespace: true},\n link: {\n open: function open(_state, mark, parent, index) {\n return isPlainURL(mark, parent, index, 1) ? \"<\" : \"[\"\n },\n close: function close(state, mark, parent, index) {\n return isPlainURL(mark, parent, index, -1) ? \">\"\n : \"](\" + state.esc(mark.attrs.href) + (mark.attrs.title ? \" \" + state.quote(mark.attrs.title) : \"\") + \")\"\n }\n },\n code: {open: function open(_state, _mark, parent, index) { return backticksFor(parent.child(index), -1) },\n close: function close(_state, _mark, parent, index) { return backticksFor(parent.child(index - 1), 1) },\n escape: false}\n});\n\nfunction backticksFor(node, side) {\n var ticks = /`+/g, m, len = 0;\n if (node.isText) { while (m = ticks.exec(node.text)) { len = Math.max(len, m[0].length); } }\n var result = len > 0 && side > 0 ? \" `\" : \"`\";\n for (var i = 0; i < len; i++) { result += \"`\"; }\n if (len > 0 && side < 0) { result += \" \"; }\n return result\n}\n\nfunction isPlainURL(link, parent, index, side) {\n if (link.attrs.title || !/^\\w+:/.test(link.attrs.href)) { return false }\n var content = parent.child(index + (side < 0 ? -1 : 0));\n if (!content.isText || content.text != link.attrs.href || content.marks[content.marks.length - 1] != link) { return false }\n if (index == (side < 0 ? 1 : parent.childCount - 1)) { return true }\n var next = parent.child(index + (side < 0 ? -2 : 1));\n return !link.isInSet(next.marks)\n}\n\n// ::- This is an object used to track state and expose\n// methods related to markdown serialization. Instances are passed to\n// node and mark serialization methods (see `toMarkdown`).\nvar MarkdownSerializerState = function MarkdownSerializerState(nodes, marks, options) {\n this.nodes = nodes;\n this.marks = marks;\n this.delim = this.out = \"\";\n this.closed = false;\n this.inTightList = false;\n // :: Object\n // The options passed to the serializer.\n // tightLists:: ?bool\n // Whether to render lists in a tight style. This can be overridden\n // on a node level by specifying a tight attribute on the node.\n // Defaults to false.\n this.options = options || {};\n if (typeof this.options.tightLists == \"undefined\")\n { this.options.tightLists = false; }\n};\n\nMarkdownSerializerState.prototype.flushClose = function flushClose (size) {\n if (this.closed) {\n if (!this.atBlank()) { this.out += \"\\n\"; }\n if (size == null) { size = 2; }\n if (size > 1) {\n var delimMin = this.delim;\n var trim = /\\s+$/.exec(delimMin);\n if (trim) { delimMin = delimMin.slice(0, delimMin.length - trim[0].length); }\n for (var i = 1; i < size; i++)\n { this.out += delimMin + \"\\n\"; }\n }\n this.closed = false;\n }\n};\n\n// :: (string, ?string, Node, ())\n// Render a block, prefixing each line with `delim`, and the first\n// line in `firstDelim`. `node` should be the node that is closed at\n// the end of the block, and `f` is a function that renders the\n// content of the block.\nMarkdownSerializerState.prototype.wrapBlock = function wrapBlock (delim, firstDelim, node, f) {\n var old = this.delim;\n this.write(firstDelim || delim);\n this.delim += delim;\n f();\n this.delim = old;\n this.closeBlock(node);\n};\n\nMarkdownSerializerState.prototype.atBlank = function atBlank () {\n return /(^|\\n)$/.test(this.out)\n};\n\n// :: ()\n// Ensure the current content ends with a newline.\nMarkdownSerializerState.prototype.ensureNewLine = function ensureNewLine () {\n if (!this.atBlank()) { this.out += \"\\n\"; }\n};\n\n// :: (?string)\n// Prepare the state for writing output (closing closed paragraphs,\n// adding delimiters, and so on), and then optionally add content\n// (unescaped) to the output.\nMarkdownSerializerState.prototype.write = function write (content) {\n this.flushClose();\n if (this.delim && this.atBlank())\n { this.out += this.delim; }\n if (content) { this.out += content; }\n};\n\n// :: (Node)\n// Close the block for the given node.\nMarkdownSerializerState.prototype.closeBlock = function closeBlock (node) {\n this.closed = node;\n};\n\n// :: (string, ?bool)\n// Add the given text to the document. When escape is not `false`,\n// it will be escaped.\nMarkdownSerializerState.prototype.text = function text (text$1, escape) {\n var lines = text$1.split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n var startOfLine = this.atBlank() || this.closed;\n this.write();\n this.out += escape !== false ? this.esc(lines[i], startOfLine) : lines[i];\n if (i != lines.length - 1) { this.out += \"\\n\"; }\n }\n};\n\n// :: (Node)\n// Render the given node as a block.\nMarkdownSerializerState.prototype.render = function render (node, parent, index) {\n if (typeof parent == \"number\") { throw new Error(\"!\") }\n this.nodes[node.type.name](this, node, parent, index);\n};\n\n// :: (Node)\n// Render the contents of `parent` as block nodes.\nMarkdownSerializerState.prototype.renderContent = function renderContent (parent) {\n var this$1 = this;\n\n parent.forEach(function (node, _, i) { return this$1.render(node, parent, i); });\n};\n\n// :: (Node)\n// Render the contents of `parent` as inline content.\nMarkdownSerializerState.prototype.renderInline = function renderInline (parent) {\n var this$1 = this;\n\n var active = [], trailing = \"\";\n var progress = function (node, _, index) {\n var marks = node ? node.marks : [];\n\n // Remove marks from `hard_break` that are the last node inside\n // that mark to prevent parser edge cases with new lines just\n // before closing marks.\n // (FIXME it'd be nice if we had a schema-agnostic way to\n // identify nodes that serialize as hard breaks)\n if (node && node.type.name === \"hard_break\")\n { marks = marks.filter(function (m) {\n if (index + 1 == parent.childCount) { return false }\n var next = parent.child(index + 1);\n return m.isInSet(next.marks) && (!next.isText || /\\S/.test(next.text))\n }); }\n\n var leading = trailing;\n trailing = \"\";\n // If whitespace has to be expelled from the node, adjust\n // leading and trailing accordingly.\n if (node && node.isText && marks.some(function (mark) {\n var info = this$1.marks[mark.type.name];\n return info && info.expelEnclosingWhitespace\n })) {\n var ref = /^(\\s*)(.*?)(\\s*)$/m.exec(node.text);\n var _$1 = ref[0];\n var lead = ref[1];\n var inner$1 = ref[2];\n var trail = ref[3];\n leading += lead;\n trailing = trail;\n if (lead || trail) {\n node = inner$1 ? node.withText(inner$1) : null;\n if (!node) { marks = active; }\n }\n }\n\n var inner = marks.length && marks[marks.length - 1], noEsc = inner && this$1.marks[inner.type.name].escape === false;\n var len = marks.length - (noEsc ? 1 : 0);\n\n // Try to reorder 'mixable' marks, such as em and strong, which\n // in Markdown may be opened and closed in different order, so\n // that order of the marks for the token matches the order in\n // active.\n outer: for (var i = 0; i < len; i++) {\n var mark = marks[i];\n if (!this$1.marks[mark.type.name].mixable) { break }\n for (var j = 0; j < active.length; j++) {\n var other = active[j];\n if (!this$1.marks[other.type.name].mixable) { break }\n if (mark.eq(other)) {\n if (i > j)\n { marks = marks.slice(0, j).concat(mark).concat(marks.slice(j, i)).concat(marks.slice(i + 1, len)); }\n else if (j > i)\n { marks = marks.slice(0, i).concat(marks.slice(i + 1, j)).concat(mark).concat(marks.slice(j, len)); }\n continue outer\n }\n }\n }\n\n // Find the prefix of the mark set that didn't change\n var keep = 0;\n while (keep < Math.min(active.length, len) && marks[keep].eq(active[keep])) { ++keep; }\n\n // Close the marks that need to be closed\n while (keep < active.length)\n { this$1.text(this$1.markString(active.pop(), false, parent, index), false); }\n\n // Output any previously expelled trailing whitespace outside the marks\n if (leading) { this$1.text(leading); }\n\n // Open the marks that need to be opened\n if (node) {\n while (active.length < len) {\n var add = marks[active.length];\n active.push(add);\n this$1.text(this$1.markString(add, true, parent, index), false);\n }\n\n // Render the node. Special case code marks, since their content\n // may not be escaped.\n if (noEsc && node.isText)\n { this$1.text(this$1.markString(inner, true, parent, index) + node.text +\n this$1.markString(inner, false, parent, index + 1), false); }\n else\n { this$1.render(node, parent, index); }\n }\n };\n parent.forEach(progress);\n progress(null, null, parent.childCount);\n};\n\n// :: (Node, string, (number) → string)\n// Render a node's content as a list. `delim` should be the extra\n// indentation added to all lines except the first in an item,\n// `firstDelim` is a function going from an item index to a\n// delimiter for the first line of the item.\nMarkdownSerializerState.prototype.renderList = function renderList (node, delim, firstDelim) {\n var this$1 = this;\n\n if (this.closed && this.closed.type == node.type)\n { this.flushClose(3); }\n else if (this.inTightList)\n { this.flushClose(1); }\n\n var isTight = typeof node.attrs.tight != \"undefined\" ? node.attrs.tight : this.options.tightLists;\n var prevTight = this.inTightList;\n this.inTightList = isTight;\n node.forEach(function (child, _, i) {\n if (i && isTight) { this$1.flushClose(1); }\n this$1.wrapBlock(delim, firstDelim(i), node, function () { return this$1.render(child, node, i); });\n });\n this.inTightList = prevTight;\n};\n\n// :: (string, ?bool) → string\n// Escape the given string so that it can safely appear in Markdown\n// content. If `startOfLine` is true, also escape characters that\n// has special meaning only at the start of the line.\nMarkdownSerializerState.prototype.esc = function esc (str, startOfLine) {\n str = str.replace(/[`*\\\\~\\[\\]]/g, \"\\\\$&\");\n if (startOfLine) { str = str.replace(/^[:#\\-*+]/, \"\\\\$&\").replace(/^(\\d+)\\./, \"$1\\\\.\"); }\n return str\n};\n\nMarkdownSerializerState.prototype.quote = function quote (str) {\n var wrap = str.indexOf('\"') == -1 ? '\"\"' : str.indexOf(\"'\") == -1 ? \"''\" : \"()\";\n return wrap[0] + str + wrap[1]\n};\n\n// :: (string, number) → string\n// Repeat the given string `n` times.\nMarkdownSerializerState.prototype.repeat = function repeat (str, n) {\n var out = \"\";\n for (var i = 0; i < n; i++) { out += str; }\n return out\n};\n\n// : (Mark, bool, string?) → string\n// Get the markdown string for a given opening or closing mark.\nMarkdownSerializerState.prototype.markString = function markString (mark, open, parent, index) {\n var info = this.marks[mark.type.name];\n var value = open ? info.open : info.close;\n return typeof value == \"string\" ? value : value(this, mark, parent, index)\n};\n\n// :: (string) → { leading: ?string, trailing: ?string }\n// Get leading and trailing whitespace from a string. Values of\n// leading or trailing property of the return object will be undefined\n// if there is no match.\nMarkdownSerializerState.prototype.getEnclosingWhitespace = function getEnclosingWhitespace (text) {\n return {\n leading: (text.match(/^(\\s+)/) || [])[0],\n trailing: (text.match(/(\\s+)$/) || [])[0]\n }\n};\n\nexport { MarkdownParser, MarkdownSerializer, MarkdownSerializerState, defaultMarkdownParser, defaultMarkdownSerializer, schema };\n//# sourceMappingURL=index.es.js.map\n","'use strict'\n\nvar high = require('highlight.js/lib/highlight.js')\nvar fault = require('fault')\n\n// The lowlight interface, which has to be compatible with highlight.js, as\n// this object is passed to highlight.js syntaxes.\n\nfunction High() {}\n\nHigh.prototype = high\n\n// Expose.\nvar low = new High() // Ha!\n\nmodule.exports = low\n\nlow.highlight = highlight\nlow.highlightAuto = autoHighlight\nlow.registerLanguage = registerLanguage\nlow.listLanguages = listLanguages\nlow.registerAlias = registerAlias\nlow.getLanguage = getLanguage\n\nvar inherit = high.inherit\nvar own = {}.hasOwnProperty\n\nvar defaultPrefix = 'hljs-'\nvar keyInsensitive = 'case_insensitive'\nvar keyCachedVariants = 'cached_variants'\nvar keyTerminatorEnd = 'terminator_end'\nvar space = ' '\nvar verticalBar = '|'\nvar parenOpen = '('\nvar parenClose = ')'\nvar backslash = '\\\\'\nvar commonKeywords = ['of', 'and', 'for', 'in', 'not', 'or', 'if', 'then']\n\n// Maps of syntaxes.\nvar languageNames = []\nvar languages = {}\nvar aliases = {}\n\n// Highlighting with language detection.\n// Accepts a string with the code to highlight.\n// Returns an object with the following properties:\n//\n// * `language` — Detected language\n// * `relevance` — Integer\n// * `value` — HAST tree with highlighting markup\n// * `secondBest` — Object with the same structure for second-best\n// heuristically detected language, may be absent.\nfunction autoHighlight(value, options) {\n var settings = options || {}\n var subset = settings.subset || languageNames\n var prefix = settings.prefix\n var length = subset.length\n var index = -1\n var result\n var secondBest\n var current\n var name\n\n if (prefix === null || prefix === undefined) {\n prefix = defaultPrefix\n }\n\n if (typeof value !== 'string') {\n throw fault('Expected `string` for value, got `%s`', value)\n }\n\n secondBest = normalize({})\n result = normalize({})\n\n while (++index < length) {\n name = subset[index]\n\n if (!getLanguage(name)) {\n continue\n }\n\n current = normalize(coreHighlight(name, value, false, prefix))\n\n current.language = name\n\n if (current.relevance > secondBest.relevance) {\n secondBest = current\n }\n\n if (current.relevance > result.relevance) {\n secondBest = result\n result = current\n }\n }\n\n if (secondBest.language) {\n result.secondBest = secondBest\n }\n\n return result\n}\n\n// Highlighting `value` in the language `language`.\nfunction highlight(language, value, options) {\n var settings = options || {}\n var prefix = settings.prefix\n\n if (prefix === null || prefix === undefined) {\n prefix = defaultPrefix\n }\n\n return normalize(coreHighlight(language, value, true, prefix))\n}\n\n// Register a language.\nfunction registerLanguage(name, syntax) {\n var lang = syntax(low)\n\n lang.rawDefinition = syntax.bind(null, low)\n\n languages[name] = lang\n\n languageNames.push(name)\n\n if (lang.aliases) {\n registerAlias(name, lang.aliases)\n }\n}\n\n// Get a list of all registered languages.\nfunction listLanguages() {\n return languageNames.concat()\n}\n\n// Register more aliases for an already registered language.\nfunction registerAlias(name, alias) {\n var map = name\n var key\n var list\n var length\n var index\n\n if (alias) {\n map = {}\n map[name] = alias\n }\n\n for (key in map) {\n list = map[key]\n list = typeof list === 'string' ? [list] : list\n length = list.length\n index = -1\n\n while (++index < length) {\n aliases[list[index]] = key\n }\n }\n}\n\n// Core highlighting function.\n// Accepts a language name, or an alias, and a string with the code to\n// highlight.\n// eslint-disable-next-line max-params\nfunction coreHighlight(name, value, ignore, prefix, continuation) {\n var lastMatch = {}\n var continuations = {}\n var stack = []\n var modeBuffer = ''\n var relevance = 0\n var language\n var top\n var current\n var currentChildren\n var offset\n var count\n var match\n var children\n\n if (typeof name !== 'string') {\n throw fault('Expected `string` for name, got `%s`', name)\n }\n\n if (typeof value !== 'string') {\n throw fault('Expected `string` for value, got `%s`', value)\n }\n\n language = getLanguage(name)\n top = continuation || language\n children = []\n\n current = top\n currentChildren = children\n\n if (!language) {\n throw fault('Unknown language: `%s` is not registered', name)\n }\n\n compileLanguage(language)\n\n try {\n top.terminators.lastIndex = 0\n offset = 0\n match = top.terminators.exec(value)\n\n while (match) {\n count = processLexeme(value.slice(offset, match.index), match)\n offset = match.index + count\n top.terminators.lastIndex = offset\n match = top.terminators.exec(value)\n }\n\n processLexeme(value.slice(offset))\n current = top\n\n while (current.parent) {\n if (current.className) {\n pop()\n }\n\n current = current.parent\n }\n\n return {\n relevance: relevance,\n value: currentChildren,\n illegal: false,\n language: name,\n top: top\n }\n } catch (error) {\n /* istanbul ignore if - Catch-all */\n if (error.message.indexOf('Illegal') === -1) {\n throw error\n }\n\n return {relevance: 0, illegal: true, value: addText(value, [])}\n }\n\n function escapeRe(value) {\n return new RegExp(value.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'm')\n }\n\n function doBeginMatch(match) {\n var lexeme = match[0]\n var newMode = match.rule\n\n if (newMode && newMode.endSameAsBegin) {\n newMode.endRe = escapeRe(lexeme)\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme\n }\n\n addSiblings(processBuffer(), currentChildren)\n\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme\n }\n }\n\n startNewMode(newMode)\n\n return newMode.returnBegin ? 0 : lexeme.length\n }\n\n function doEndMatch(match) {\n var lexeme = match[0]\n var matchPlusRemainder = value.slice(match.index)\n var endMode = endOfMode(top, matchPlusRemainder)\n\n if (!endMode) {\n return\n }\n\n var origin = top\n\n if (origin.skip) {\n modeBuffer += lexeme\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme\n }\n\n addSiblings(processBuffer(), currentChildren)\n\n if (origin.excludeEnd) {\n modeBuffer = lexeme\n }\n }\n\n do {\n if (top.className) {\n pop()\n }\n\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance\n }\n\n top = top.parent\n } while (top !== endMode.parent)\n\n if (endMode.starts) {\n /* istanbul ignore if - hljs 9.16 added support for this but didn’t use it yet. */\n if (endMode.endSameAsBegin) {\n endMode.starts.endRe = endMode.endRe\n }\n\n startNewMode(endMode.starts)\n }\n\n return origin.returnEnd ? 0 : lexeme.length\n }\n\n function processLexeme(textBeforeMatch, match) {\n var lexeme = match && match[0]\n var processed\n\n // Add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch\n\n if (lexeme === undefined) {\n addSiblings(processBuffer(), currentChildren)\n return 0\n }\n\n // We've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n /* istanbul ignore if - Unknown what this fixes or which case fixes it */\n if (\n lastMatch.type === 'begin' &&\n match.type === 'end' &&\n lastMatch.index === match.index &&\n lexeme === ''\n ) {\n // Spit the “skipped” character that our regex choked on back into the output sequence\n modeBuffer += value.slice(match.index, match.index + 1)\n return 1\n }\n\n lastMatch = match\n\n if (match.type === 'begin') {\n return doBeginMatch(match)\n }\n\n if (match.type === 'end') {\n processed = doEndMatch(match)\n\n if (processed !== undefined) {\n return processed\n }\n }\n\n if (match.type === 'illegal' && !ignore) {\n // Illegal match, we do not continue processing\n throw fault(\n 'Illegal lexeme \"%s\" for mode \"%s\"',\n lexeme,\n top.className || '<unnamed>'\n )\n }\n\n // Why might be find ourselves here?\n // Only one occasion now.\n // An end match that was triggered but could not be completed.\n // When might this happen?\n // When an `endSameasBegin` rule sets the end rule to a specific match.\n // Since the overall mode termination rule that’s being used to scan the\n // text isn’t recompiled that means that any match that LOOKS like the end\n // (but is not, because it is not an exact match to the beginning) will end\n // up here.\n // A definite end match, but when `doEndMatch` tries to “reapply” the end\n // rule and fails to match, we wind up here, and just silently ignore the\n // end.\n // This causes no real harm other than stopping a few times too many.\n modeBuffer += lexeme\n\n return lexeme.length\n }\n\n // Start a new mode with a `lexeme` to process.\n function startNewMode(mode) {\n var node\n\n if (mode.className) {\n node = build(mode.className, [])\n }\n\n // Enter a new mode.\n if (node) {\n currentChildren.push(node)\n stack.push(currentChildren)\n currentChildren = node.children\n }\n\n top = Object.create(mode, {parent: {value: top}})\n }\n\n // Process the buffer.\n function processBuffer() {\n var result = top.subLanguage ? processSubLanguage() : processKeywords()\n modeBuffer = ''\n return result\n }\n\n // Process a sublanguage (returns a list of nodes).\n function processSubLanguage() {\n var explicit = typeof top.subLanguage === 'string'\n var subvalue\n\n /* istanbul ignore if - support non-loaded sublanguages */\n if (explicit && !languages[top.subLanguage]) {\n return addText(modeBuffer, [])\n }\n\n if (explicit) {\n subvalue = coreHighlight(\n top.subLanguage,\n modeBuffer,\n true,\n prefix,\n continuations[top.subLanguage]\n )\n } else {\n subvalue = autoHighlight(modeBuffer, {\n subset: top.subLanguage.length === 0 ? undefined : top.subLanguage,\n prefix: prefix\n })\n }\n\n // If we couldn’t highlight, for example because the requests subset isn’t\n // loaded, return a text node.\n if (!subvalue.language) {\n return [buildText(modeBuffer)]\n }\n\n // Counting embedded language score towards the host language may be\n // disabled with zeroing the containing mode relevance.\n // Usecase in point is Markdown that allows XML everywhere and makes every\n // XML snippet to have a much larger Markdown score.\n if (top.relevance > 0) {\n relevance += subvalue.relevance\n }\n\n if (explicit) {\n continuations[top.subLanguage] = subvalue.top\n }\n\n return [build(subvalue.language, subvalue.value, true)]\n }\n\n // Process keywords. Returns nodes.\n function processKeywords() {\n var nodes = []\n var lastIndex\n var keyword\n var node\n var submatch\n\n if (!top.keywords) {\n return addText(modeBuffer, nodes)\n }\n\n lastIndex = 0\n\n top.lexemesRe.lastIndex = 0\n\n keyword = top.lexemesRe.exec(modeBuffer)\n\n while (keyword) {\n addText(modeBuffer.slice(lastIndex, keyword.index), nodes)\n\n submatch = keywordMatch(top, keyword)\n\n if (submatch) {\n relevance += submatch[1]\n\n node = build(submatch[0], [])\n\n nodes.push(node)\n\n addText(keyword[0], node.children)\n } else {\n addText(keyword[0], nodes)\n }\n\n lastIndex = top.lexemesRe.lastIndex\n keyword = top.lexemesRe.exec(modeBuffer)\n }\n\n addText(modeBuffer.slice(lastIndex), nodes)\n\n return nodes\n }\n\n // Add siblings.\n function addSiblings(siblings, nodes) {\n var length = siblings.length\n var index = -1\n var sibling\n\n while (++index < length) {\n sibling = siblings[index]\n\n if (sibling.type === 'text') {\n addText(sibling.value, nodes)\n } else {\n nodes.push(sibling)\n }\n }\n }\n\n // Add a text.\n function addText(value, nodes) {\n var tail\n\n if (value) {\n tail = nodes[nodes.length - 1]\n\n if (tail && tail.type === 'text') {\n tail.value += value\n } else {\n nodes.push(buildText(value))\n }\n }\n\n return nodes\n }\n\n // Build a text.\n function buildText(value) {\n return {type: 'text', value: value}\n }\n\n // Build a span.\n function build(name, contents, noPrefix) {\n return {\n type: 'element',\n tagName: 'span',\n properties: {\n className: [(noPrefix ? '' : prefix) + name]\n },\n children: contents\n }\n }\n\n // Check if the first word in `keywords` is a keyword.\n function keywordMatch(mode, keywords) {\n var keyword = keywords[0]\n\n if (language[keyInsensitive]) {\n keyword = keyword.toLowerCase()\n }\n\n return own.call(mode.keywords, keyword) && mode.keywords[keyword]\n }\n\n // Check if `lexeme` ends `mode`.\n function endOfMode(mode, lexeme) {\n if (test(mode.endRe, lexeme)) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent\n }\n\n return mode\n }\n\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, lexeme)\n }\n }\n\n // Exit the current context.\n function pop() {\n /* istanbul ignore next - removed in hljs 9.3 */\n currentChildren = stack.pop() || children\n }\n}\n\n// Compile a language.\nfunction compileLanguage(language) {\n compileMode(language)\n\n // Compile a language mode, optionally with a parent.\n function compileMode(mode, parent) {\n if (mode.compiled) {\n return\n }\n\n mode.compiled = true\n\n mode.keywords = mode.keywords || mode.beginKeywords\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language[keyInsensitive])\n }\n\n mode.lexemesRe = langRe(mode.lexemes || /\\w+/, true)\n\n if (parent) {\n if (mode.beginKeywords) {\n mode.begin =\n '\\\\b(' + mode.beginKeywords.split(space).join(verticalBar) + ')\\\\b'\n }\n\n if (!mode.begin) {\n mode.begin = /\\B|\\b/\n }\n\n mode.beginRe = langRe(mode.begin)\n\n if (mode.endSameAsBegin) {\n mode.end = mode.begin\n }\n\n if (!mode.end && !mode.endsWithParent) {\n mode.end = /\\B|\\b/\n }\n\n if (mode.end) {\n mode.endRe = langRe(mode.end)\n }\n\n mode[keyTerminatorEnd] = source(mode.end) || ''\n\n if (mode.endsWithParent && parent[keyTerminatorEnd]) {\n mode[keyTerminatorEnd] +=\n (mode.end ? verticalBar : '') + parent[keyTerminatorEnd]\n }\n }\n\n if (mode.illegal) {\n mode.illegalRe = langRe(mode.illegal)\n }\n\n if (mode.relevance === undefined) {\n mode.relevance = 1\n }\n\n mode.contains = compileContains(mode.contains || [], mode)\n\n if (mode.starts) {\n compileMode(mode.starts, parent)\n }\n\n mode.terminators = buildModeRegex(mode)\n }\n\n function compileContains(contains, mode) {\n var result = []\n var length = contains.length\n var index = -1\n var contained\n\n while (++index < length) {\n contained = contains[index]\n result = result.concat(\n expandOrCloneMode(contained === 'self' ? mode : contained)\n )\n }\n\n length = result.length\n index = -1\n\n while (++index < length) {\n compileMode(result[index], mode)\n }\n\n return result\n }\n\n function buildModeRegex(mode) {\n var indices = {}\n var expression\n var regexes = []\n var matcher = {}\n var matchAt = 1\n var term\n var values = mode.contains\n var length = values.length\n var index = -1\n var terminators = []\n\n while (++index < length) {\n term = values[index]\n\n addRule(\n term,\n term.beginKeywords ? '\\\\.?(?:' + term.begin + ')\\\\.?' : term.begin\n )\n }\n\n if (mode[keyTerminatorEnd]) {\n addRule('end', mode[keyTerminatorEnd])\n }\n\n if (mode.illegal) {\n addRule('illegal', mode.illegal)\n }\n\n length = regexes.length\n index = -1\n\n while (++index < length) {\n terminators[index] = regexes[index][1]\n }\n\n expression = langRe(joinRe(terminators, verticalBar), true)\n\n matcher = {lastIndex: 0, exec: exec}\n\n return matcher\n\n function exec(value) {\n var length\n var index\n var rule\n var match\n var submatch\n\n if (regexes.length === 0) return null\n\n expression.lastIndex = matcher.lastIndex\n match = expression.exec(value)\n\n if (!match) {\n return null\n }\n\n length = match.length\n index = -1\n\n while (++index < length) {\n submatch = match[index]\n\n if (submatch !== undefined && indices[index] !== undefined) {\n rule = indices[index]\n break\n }\n }\n\n // Illegal or end match\n if (typeof rule === 'string') {\n match.type = rule\n match.extra = [mode.illegal, mode.terminator_end]\n } else {\n match.type = 'begin'\n match.rule = rule\n }\n\n return match\n }\n\n function addRule(rule, regex) {\n indices[matchAt] = rule\n regexes.push([rule, regex])\n matchAt += new RegExp(regex.toString() + verticalBar).exec('').length\n }\n }\n\n function joinRe(regexes, separator) {\n var backreferenceRe = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9]\\d*)|\\\\./\n var captures = 0\n var result = ''\n var length = regexes.length\n var index = -1\n var regex\n var offset\n var expression\n var match\n\n while (++index < length) {\n regex = regexes[index]\n expression = source(regex)\n captures += 1\n offset = captures\n\n if (index !== 0) {\n result += separator\n }\n\n result += parenOpen\n\n while (expression.length > 0) {\n match = backreferenceRe.exec(expression)\n\n if (match === null) {\n result += expression\n break\n }\n\n result += expression.slice(0, match.index)\n expression = expression.slice(match.index + match[0].length)\n\n if (match[0][0] === backslash && match[1]) {\n // Adjust the backreference.\n result += backslash + String(Number(match[1]) + offset)\n } else {\n result += match[0]\n\n if (match[0] === parenOpen) {\n captures++\n }\n }\n }\n\n result += parenClose\n }\n\n return result\n }\n\n // Create a regex for `value`.\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm' + (language[keyInsensitive] ? 'i' : '') + (global ? 'g' : '')\n )\n }\n\n // Get the source of an expression or string.\n function source(re) {\n return (re && re.source) || re\n }\n}\n\nfunction compileKeywords(values, caseInsensitive) {\n var compiled = {}\n var key\n\n if (typeof values === 'string') {\n flatten('keyword', values)\n } else {\n for (key in values) {\n flatten(key, values[key])\n }\n }\n\n return compiled\n\n function flatten(key, value) {\n var val = caseInsensitive ? value.toLowerCase() : value\n all(key, val.split(space))\n }\n\n function all(key, values) {\n var length = values.length\n var index = -1\n var pair\n\n while (++index < length) {\n pair = values[index].split(verticalBar)\n compiled[pair[0]] = [key, Number(pair[1]) || common(pair[0]) ? 0 : 1]\n }\n }\n}\n\nfunction common(value) {\n return commonKeywords.indexOf(value.toLowerCase()) !== -1\n}\n\nfunction expandOrCloneMode(mode) {\n var length\n var index\n var variants\n var result\n\n if (mode.variants && !mode[keyCachedVariants]) {\n variants = mode.variants\n length = variants.length\n index = -1\n result = []\n\n while (++index < length) {\n result[index] = inherit(mode, {variants: null}, variants[index])\n }\n\n mode[keyCachedVariants] = result\n }\n\n // Expand.\n if (mode.cached_variants) return mode.cached_variants\n\n // Clone.\n if (dependencyOnParent(mode))\n return [inherit(mode, {starts: mode.starts ? inherit(mode.starts) : null})]\n\n return [mode]\n}\n\nfunction dependencyOnParent(mode) {\n return mode ? mode.endsWithParent || dependencyOnParent(mode.starts) : false\n}\n\n// Normalize a syntax result.\nfunction normalize(result) {\n return {\n relevance: result.relevance || 0,\n language: result.language || null,\n value: result.value || []\n }\n}\n\n// Check if `expression` matches `lexeme`.\nfunction test(expression, lexeme) {\n var match = expression && expression.exec(lexeme)\n return match && match.index === 0\n}\n\n// Get a language by `name`.\nfunction getLanguage(name) {\n name = name.toLowerCase()\n\n return languages[name] || languages[aliases[name]]\n}\n","/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n(function(factory) {\n\n // Find the global object for export to both the browser and web workers.\n var globalObject = typeof window === 'object' && window ||\n typeof self === 'object' && self;\n\n // Setup highlight.js for different environments. First is Node.js or\n // CommonJS.\n // `nodeType` is checked to ensure that `exports` is not a HTML element.\n if(typeof exports !== 'undefined' && !exports.nodeType) {\n factory(exports);\n } else if(globalObject) {\n // Export hljs globally even when using AMD for cases when this script\n // is loaded with others that may still expect a global hljs.\n globalObject.hljs = factory({});\n\n // Finally register the global hljs with AMD.\n if(typeof define === 'function' && define.amd) {\n define([], function() {\n return globalObject.hljs;\n });\n }\n }\n\n}(function(hljs) {\n // Convenience variables for build-in objects\n var ArrayProto = [],\n objectKeys = Object.keys;\n\n // Global internal variables used within the highlight.js library.\n var languages = {},\n aliases = {};\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n var SAFE_MODE = true;\n\n // Regular expressions used throughout the highlight.js library.\n var noHighlightRe = /^(no-?highlight|plain|text)$/i,\n languagePrefixRe = /\\blang(?:uage)?-([\\w-]+)\\b/i,\n fixMarkupRe = /((^(<[^>]+>|\\t|)+|(?:\\n)))/gm;\n\n // The object will be assigned by the build tool. It used to synchronize API\n // of external language files with minified version of the highlight.js library.\n var API_REPLACES;\n\n var spanEndTag = '</span>';\n var LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n var options = {\n classPrefix: 'hljs-',\n tabReplace: null,\n useBR: false,\n languages: undefined\n };\n\n // keywords that should have no default relevance value\n var COMMON_KEYWORDS = 'of and for in not or if then'.split(' ');\n\n\n /* Utility functions */\n\n function escape(value) {\n return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\n }\n\n function tag(node) {\n return node.nodeName.toLowerCase();\n }\n\n function testRe(re, lexeme) {\n var match = re && re.exec(lexeme);\n return match && match.index === 0;\n }\n\n function isNotHighlighted(language) {\n return noHighlightRe.test(language);\n }\n\n function blockLanguage(block) {\n var i, match, length, _class;\n var classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n match = languagePrefixRe.exec(classes);\n if (match) {\n var language = getLanguage(match[1]);\n if (!language) {\n console.warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n console.warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n classes = classes.split(/\\s+/);\n\n for (i = 0, length = classes.length; i < length; i++) {\n _class = classes[i];\n\n if (isNotHighlighted(_class) || getLanguage(_class)) {\n return _class;\n }\n }\n }\n\n /**\n * performs a shallow merge of multiple objects into one\n *\n * @arguments list of objects with properties to merge\n * @returns a single new object\n */\n function inherit(parent) { // inherit(parent, override_obj, override_obj, ...)\n var key;\n var result = {};\n var objects = Array.prototype.slice.call(arguments, 1);\n\n for (key in parent)\n result[key] = parent[key];\n objects.forEach(function(obj) {\n for (key in obj)\n result[key] = obj[key];\n });\n return result;\n }\n\n /* Stream merging */\n\n function nodeStream(node) {\n var result = [];\n (function _nodeStream(node, offset) {\n for (var child = node.firstChild; child; child = child.nextSibling) {\n if (child.nodeType === 3)\n offset += child.nodeValue.length;\n else if (child.nodeType === 1) {\n result.push({\n event: 'start',\n offset: offset,\n node: child\n });\n offset = _nodeStream(child, offset);\n // Prevent void elements from having an end tag that would actually\n // double them in the output. There are more void elements in HTML\n // but we list only those realistically expected in code display.\n if (!tag(child).match(/br|hr|img|input/)) {\n result.push({\n event: 'stop',\n offset: offset,\n node: child\n });\n }\n }\n }\n return offset;\n })(node, 0);\n return result;\n }\n\n function mergeStreams(original, highlighted, value) {\n var processed = 0;\n var result = '';\n var nodeStack = [];\n\n function selectStream() {\n if (!original.length || !highlighted.length) {\n return original.length ? original : highlighted;\n }\n if (original[0].offset !== highlighted[0].offset) {\n return (original[0].offset < highlighted[0].offset) ? original : highlighted;\n }\n\n /*\n To avoid starting the stream just before it should stop the order is\n ensured that original always starts first and closes last:\n\n if (event1 == 'start' && event2 == 'start')\n return original;\n if (event1 == 'start' && event2 == 'stop')\n return highlighted;\n if (event1 == 'stop' && event2 == 'start')\n return original;\n if (event1 == 'stop' && event2 == 'stop')\n return highlighted;\n\n ... which is collapsed to:\n */\n return highlighted[0].event === 'start' ? original : highlighted;\n }\n\n function open(node) {\n function attr_str(a) {\n return ' ' + a.nodeName + '=\"' + escape(a.value).replace(/\"/g, '"') + '\"';\n }\n result += '<' + tag(node) + ArrayProto.map.call(node.attributes, attr_str).join('') + '>';\n }\n\n function close(node) {\n result += '</' + tag(node) + '>';\n }\n\n function render(event) {\n (event.event === 'start' ? open : close)(event.node);\n }\n\n while (original.length || highlighted.length) {\n var stream = selectStream();\n result += escape(value.substring(processed, stream[0].offset));\n processed = stream[0].offset;\n if (stream === original) {\n /*\n On any opening or closing tag of the original markup we first close\n the entire highlighted node stack, then render the original tag along\n with all the following original tags at the same offset and then\n reopen all the tags on the highlighted stack.\n */\n nodeStack.reverse().forEach(close);\n do {\n render(stream.splice(0, 1)[0]);\n stream = selectStream();\n } while (stream === original && stream.length && stream[0].offset === processed);\n nodeStack.reverse().forEach(open);\n } else {\n if (stream[0].event === 'start') {\n nodeStack.push(stream[0].node);\n } else {\n nodeStack.pop();\n }\n render(stream.splice(0, 1)[0]);\n }\n }\n return result + escape(value.substr(processed));\n }\n\n /* Initialization */\n\n function dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n }\n\n function expand_or_clone_mode(mode) {\n if (mode.variants && !mode.cached_variants) {\n mode.cached_variants = mode.variants.map(function(variant) {\n return inherit(mode, {variants: null}, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cached_variants)\n return mode.cached_variants;\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode))\n return [inherit(mode, { starts: mode.starts ? inherit(mode.starts) : null })];\n\n if (Object.isFrozen(mode))\n return [inherit(mode)];\n\n // no special dependency issues, just return ourselves\n return [mode];\n }\n\n function restoreLanguageApi(obj) {\n if(API_REPLACES && !obj.langApiRestored) {\n obj.langApiRestored = true;\n for(var key in API_REPLACES) {\n if (obj[key]) {\n obj[API_REPLACES[key]] = obj[key];\n }\n }\n (obj.contains || []).concat(obj.variants || []).forEach(restoreLanguageApi);\n }\n }\n\n function compileKeywords(rawKeywords, case_insensitive) {\n var compiled_keywords = {};\n\n if (typeof rawKeywords === 'string') { // string\n splitAndCompile('keyword', rawKeywords);\n } else {\n objectKeys(rawKeywords).forEach(function (className) {\n splitAndCompile(className, rawKeywords[className]);\n });\n }\n return compiled_keywords;\n\n // ---\n\n function splitAndCompile(className, str) {\n if (case_insensitive) {\n str = str.toLowerCase();\n }\n str.split(' ').forEach(function(keyword) {\n var pair = keyword.split('|');\n compiled_keywords[pair[0]] = [className, scoreForKeyword(pair[0], pair[1])];\n });\n }\n }\n\n function scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore)\n return Number(providedScore);\n\n return commonKeyword(keyword) ? 0 : 1;\n }\n\n function commonKeyword(word) {\n return COMMON_KEYWORDS.indexOf(word.toLowerCase()) != -1;\n }\n\n function compileLanguage(language) {\n\n function reStr(re) {\n return (re && re.source) || re;\n }\n\n function langRe(value, global) {\n return new RegExp(\n reStr(value),\n 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')\n );\n }\n\n function reCountMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n }\n\n // joinRe logically computes regexps.join(separator), but fixes the\n // backreferences so they continue to match.\n // it also places each individual regular expression into it's own\n // match group, keeping track of the sequencing of those match groups\n // is currently an exercise for the caller. :-)\n function joinRe(regexps, separator) {\n // backreferenceRe matches an open parenthesis or backreference. To avoid\n // an incorrect parse, it additionally matches the following:\n // - [...] elements, where the meaning of parentheses and escapes change\n // - other escape sequences, so we do not misparse escape sequences as\n // interesting elements\n // - non-matching or lookahead parentheses, which do not capture. These\n // follow the '(' with a '?'.\n var backreferenceRe = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n var numCaptures = 0;\n var ret = '';\n for (var i = 0; i < regexps.length; i++) {\n numCaptures += 1;\n var offset = numCaptures;\n var re = reStr(regexps[i]);\n if (i > 0) {\n ret += separator;\n }\n ret += \"(\";\n while (re.length > 0) {\n var match = backreferenceRe.exec(re);\n if (match == null) {\n ret += re;\n break;\n }\n ret += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] == '\\\\' && match[1]) {\n // Adjust the backreference.\n ret += '\\\\' + String(Number(match[1]) + offset);\n } else {\n ret += match[0];\n if (match[0] == '(') {\n numCaptures++;\n }\n }\n }\n ret += \")\";\n }\n return ret;\n }\n\n function buildModeRegex(mode) {\n\n var matchIndexes = {};\n var matcherRe;\n var regexes = [];\n var matcher = {};\n var matchAt = 1;\n\n function addRule(rule, regex) {\n matchIndexes[matchAt] = rule;\n regexes.push([rule, regex]);\n matchAt += reCountMatchGroups(regex) + 1;\n }\n\n var term;\n for (var i=0; i < mode.contains.length; i++) {\n var re;\n term = mode.contains[i];\n if (term.beginKeywords) {\n re = '\\\\.?(?:' + term.begin + ')\\\\.?';\n } else {\n re = term.begin;\n }\n addRule(term, re);\n }\n if (mode.terminator_end)\n addRule(\"end\", mode.terminator_end);\n if (mode.illegal)\n addRule(\"illegal\", mode.illegal);\n\n var terminators = regexes.map(function(el) { return el[1]; });\n matcherRe = langRe(joinRe(terminators, '|'), true);\n\n matcher.lastIndex = 0;\n matcher.exec = function(s) {\n var rule;\n\n if( regexes.length === 0) return null;\n\n matcherRe.lastIndex = matcher.lastIndex;\n var match = matcherRe.exec(s);\n if (!match) { return null; }\n\n for(var i = 0; i<match.length; i++) {\n if (match[i] != undefined && matchIndexes[\"\" +i] != undefined ) {\n rule = matchIndexes[\"\"+i];\n break;\n }\n }\n\n // illegal or end match\n if (typeof rule === \"string\") {\n match.type = rule;\n match.extra = [mode.illegal, mode.terminator_end];\n } else {\n match.type = \"begin\";\n match.rule = rule;\n }\n return match;\n };\n\n return matcher;\n }\n\n function compileMode(mode, parent) {\n if (mode.compiled)\n return;\n mode.compiled = true;\n\n mode.keywords = mode.keywords || mode.beginKeywords;\n if (mode.keywords)\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n\n mode.lexemesRe = langRe(mode.lexemes || /\\w+/, true);\n\n if (parent) {\n if (mode.beginKeywords) {\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\\\b';\n }\n if (!mode.begin)\n mode.begin = /\\B|\\b/;\n mode.beginRe = langRe(mode.begin);\n if (mode.endSameAsBegin)\n mode.end = mode.begin;\n if (!mode.end && !mode.endsWithParent)\n mode.end = /\\B|\\b/;\n if (mode.end)\n mode.endRe = langRe(mode.end);\n mode.terminator_end = reStr(mode.end) || '';\n if (mode.endsWithParent && parent.terminator_end)\n mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end;\n }\n if (mode.illegal)\n mode.illegalRe = langRe(mode.illegal);\n if (mode.relevance == null)\n mode.relevance = 1;\n if (!mode.contains) {\n mode.contains = [];\n }\n mode.contains = Array.prototype.concat.apply([], mode.contains.map(function(c) {\n return expand_or_clone_mode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) {compileMode(c, mode);});\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n mode.terminators = buildModeRegex(mode);\n }\n\n // self is not valid at the top-level\n if (language.contains && language.contains.indexOf('self') != -1) {\n if (!SAFE_MODE) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\")\n } else {\n // silently remove the broken rule (effectively ignoring it), this has historically\n // been the behavior in the past, so this removal preserves compatibility with broken\n // grammars when running in Safe Mode\n language.contains = language.contains.filter(function(mode) { return mode != 'self'; });\n }\n }\n compileMode(language);\n }\n\n\n /**\n * Core highlighting function.\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} code - the code to highlight\n * @param {boolean} ignore_illegals - whether to ignore illegal matches, default is to bail\n * @param {array<mode>} continuation - array of continuation modes\n *\n * @returns an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {mode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(languageName, code, ignore_illegals, continuation) {\n var codeToHighlight = code;\n\n function escapeRe(value) {\n return new RegExp(value.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'm');\n }\n\n function endOfMode(mode, lexeme) {\n if (testRe(mode.endRe, lexeme)) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, lexeme);\n }\n }\n\n function keywordMatch(mode, match) {\n var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0];\n return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str];\n }\n\n function buildSpan(className, insideSpan, leaveOpen, noPrefix) {\n if (!leaveOpen && insideSpan === '') return '';\n if (!className) return insideSpan;\n\n var classPrefix = noPrefix ? '' : options.classPrefix,\n openSpan = '<span class=\"' + classPrefix,\n closeSpan = leaveOpen ? '' : spanEndTag;\n\n openSpan += className + '\">';\n\n return openSpan + insideSpan + closeSpan;\n }\n\n function processKeywords() {\n var keyword_match, last_index, match, result;\n\n if (!top.keywords)\n return escape(mode_buffer);\n\n result = '';\n last_index = 0;\n top.lexemesRe.lastIndex = 0;\n match = top.lexemesRe.exec(mode_buffer);\n\n while (match) {\n result += escape(mode_buffer.substring(last_index, match.index));\n keyword_match = keywordMatch(top, match);\n if (keyword_match) {\n relevance += keyword_match[1];\n result += buildSpan(keyword_match[0], escape(match[0]));\n } else {\n result += escape(match[0]);\n }\n last_index = top.lexemesRe.lastIndex;\n match = top.lexemesRe.exec(mode_buffer);\n }\n return result + escape(mode_buffer.substr(last_index));\n }\n\n function processSubLanguage() {\n var explicit = typeof top.subLanguage === 'string';\n if (explicit && !languages[top.subLanguage]) {\n return escape(mode_buffer);\n }\n\n var result = explicit ?\n highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]) :\n highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : undefined);\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n if (explicit) {\n continuations[top.subLanguage] = result.top;\n }\n return buildSpan(result.language, result.value, false, true);\n }\n\n function processBuffer() {\n result += (top.subLanguage != null ? processSubLanguage() : processKeywords());\n mode_buffer = '';\n }\n\n function startNewMode(mode) {\n result += mode.className? buildSpan(mode.className, '', true): '';\n top = Object.create(mode, {parent: {value: top}});\n }\n\n\n function doBeginMatch(match) {\n var lexeme = match[0];\n var new_mode = match.rule;\n\n if (new_mode && new_mode.endSameAsBegin) {\n new_mode.endRe = escapeRe( lexeme );\n }\n\n if (new_mode.skip) {\n mode_buffer += lexeme;\n } else {\n if (new_mode.excludeBegin) {\n mode_buffer += lexeme;\n }\n processBuffer();\n if (!new_mode.returnBegin && !new_mode.excludeBegin) {\n mode_buffer = lexeme;\n }\n }\n startNewMode(new_mode);\n return new_mode.returnBegin ? 0 : lexeme.length;\n }\n\n function doEndMatch(match) {\n var lexeme = match[0];\n var matchPlusRemainder = codeToHighlight.substr(match.index);\n var end_mode = endOfMode(top, matchPlusRemainder);\n if (!end_mode) { return; }\n\n var origin = top;\n if (origin.skip) {\n mode_buffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n mode_buffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n mode_buffer = lexeme;\n }\n }\n do {\n if (top.className) {\n result += spanEndTag;\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== end_mode.parent);\n if (end_mode.starts) {\n if (end_mode.endSameAsBegin) {\n end_mode.starts.endRe = end_mode.endRe;\n }\n startNewMode(end_mode.starts);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n var lastMatch = {};\n function processLexeme(text_before_match, match) {\n\n var lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n mode_buffer += text_before_match;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type==\"begin\" && match.type==\"end\" && lastMatch.index == match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n mode_buffer += codeToHighlight.slice(match.index, match.index + 1);\n return 1;\n }\n lastMatch = match;\n\n if (match.type===\"begin\") {\n return doBeginMatch(match);\n } else if (match.type===\"illegal\" && !ignore_illegals) {\n // illegal match, we do not continue processing\n throw new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.className || '<unnamed>') + '\"');\n } else if (match.type===\"end\") {\n var processed = doEndMatch(match);\n if (processed != undefined)\n return processed;\n }\n\n /*\n Why might be find ourselves here? Only one occasion now. An end match that was\n triggered but could not be completed. When might this happen? When an `endSameasBegin`\n rule sets the end rule to a specific match. Since the overall mode termination rule that's\n being used to scan the text isn't recompiled that means that any match that LOOKS like\n the end (but is not, because it is not an exact match to the beginning) will\n end up here. A definite end match, but when `doEndMatch` tries to \"reapply\"\n the end rule and fails to match, we wind up here, and just silently ignore the end.\n\n This causes no real harm other than stopping a few times too many.\n */\n\n mode_buffer += lexeme;\n return lexeme.length;\n }\n\n var language = getLanguage(languageName);\n if (!language) {\n console.error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n compileLanguage(language);\n var top = continuation || language;\n var continuations = {}; // keep continuations for sub-languages\n var result = '', current;\n for(current = top; current !== language; current = current.parent) {\n if (current.className) {\n result = buildSpan(current.className, '', true) + result;\n }\n }\n var mode_buffer = '';\n var relevance = 0;\n try {\n var match, count, index = 0;\n while (true) {\n top.terminators.lastIndex = index;\n match = top.terminators.exec(codeToHighlight);\n if (!match)\n break;\n count = processLexeme(codeToHighlight.substring(index, match.index), match);\n index = match.index + count;\n }\n processLexeme(codeToHighlight.substr(index));\n for(current = top; current.parent; current = current.parent) { // close dangling modes\n if (current.className) {\n result += spanEndTag;\n }\n }\n return {\n relevance: relevance,\n value: result,\n illegal:false,\n language: languageName,\n top: top\n };\n } catch (err) {\n if (err.message && err.message.indexOf('Illegal') !== -1) {\n return {\n illegal: true,\n relevance: 0,\n value: escape(codeToHighlight)\n };\n } else if (SAFE_MODE) {\n return {\n relevance: 0,\n value: escape(codeToHighlight),\n language: languageName,\n top: top,\n errorRaised: err\n };\n } else {\n throw err;\n }\n }\n }\n\n /*\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - second_best (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || objectKeys(languages);\n var result = {\n relevance: 0,\n value: escape(code)\n };\n var second_best = result;\n languageSubset.filter(getLanguage).filter(autoDetection).forEach(function(name) {\n var current = highlight(name, code, false);\n current.language = name;\n if (current.relevance > second_best.relevance) {\n second_best = current;\n }\n if (current.relevance > result.relevance) {\n second_best = result;\n result = current;\n }\n });\n if (second_best.language) {\n result.second_best = second_best;\n }\n return result;\n }\n\n /*\n Post-processing of the highlighted markup:\n\n - replace TABs with something more useful\n - replace real line-breaks with '<br>' for non-pre containers\n\n */\n function fixMarkup(value) {\n if (!(options.tabReplace || options.useBR)) {\n return value;\n }\n\n return value.replace(fixMarkupRe, function(match, p1) {\n if (options.useBR && match === '\\n') {\n return '<br>';\n } else if (options.tabReplace) {\n return p1.replace(/\\t/g, options.tabReplace);\n }\n return '';\n });\n }\n\n function buildClassName(prevClassName, currentLang, resultLang) {\n var language = currentLang ? aliases[currentLang] : resultLang,\n result = [prevClassName.trim()];\n\n if (!prevClassName.match(/\\bhljs\\b/)) {\n result.push('hljs');\n }\n\n if (prevClassName.indexOf(language) === -1) {\n result.push(language);\n }\n\n return result.join(' ').trim();\n }\n\n /*\n Applies highlighting to a DOM node containing code. Accepts a DOM node and\n two optional parameters for fixMarkup.\n */\n function highlightBlock(block) {\n var node, originalStream, result, resultNode, text;\n var language = blockLanguage(block);\n\n if (isNotHighlighted(language))\n return;\n\n if (options.useBR) {\n node = document.createElement('div');\n node.innerHTML = block.innerHTML.replace(/\\n/g, '').replace(/<br[ \\/]*>/g, '\\n');\n } else {\n node = block;\n }\n text = node.textContent;\n result = language ? highlight(language, text, true) : highlightAuto(text);\n\n originalStream = nodeStream(node);\n if (originalStream.length) {\n resultNode = document.createElement('div');\n resultNode.innerHTML = result.value;\n result.value = mergeStreams(originalStream, nodeStream(resultNode), text);\n }\n result.value = fixMarkup(result.value);\n\n block.innerHTML = result.value;\n block.className = buildClassName(block.className, language, result.language);\n block.result = {\n language: result.language,\n re: result.relevance\n };\n if (result.second_best) {\n block.second_best = {\n language: result.second_best.language,\n re: result.second_best.relevance\n };\n }\n }\n\n /*\n Updates highlight.js global options with values passed in the form of an object.\n */\n function configure(user_options) {\n options = inherit(options, user_options);\n }\n\n /*\n Applies highlighting to all <pre><code>..</code></pre> blocks on a page.\n */\n function initHighlighting() {\n if (initHighlighting.called)\n return;\n initHighlighting.called = true;\n\n var blocks = document.querySelectorAll('pre code');\n ArrayProto.forEach.call(blocks, highlightBlock);\n }\n\n /*\n Attaches highlighting to the page load event.\n */\n function initHighlightingOnLoad() {\n window.addEventListener('DOMContentLoaded', initHighlighting, false);\n window.addEventListener('load', initHighlighting, false);\n }\n\n var PLAINTEXT_LANGUAGE = { disableAutodetect: true };\n\n function registerLanguage(name, language) {\n var lang;\n try { lang = language(hljs); }\n catch (error) {\n console.error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", name));\n // hard or soft error\n if (!SAFE_MODE) { throw error; } else { console.error(error); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n languages[name] = lang;\n restoreLanguageApi(lang);\n lang.rawDefinition = language.bind(null,hljs);\n\n if (lang.aliases) {\n lang.aliases.forEach(function(alias) {aliases[alias] = name;});\n }\n }\n\n function listLanguages() {\n return objectKeys(languages);\n }\n\n /*\n intended usage: When one language truly requires another\n\n Unlike `getLanguage`, this will throw when the requested language\n is not available.\n */\n function requireLanguage(name) {\n var lang = getLanguage(name);\n if (lang) { return lang; }\n\n var err = new Error('The \\'{}\\' language is required, but not loaded.'.replace('{}',name));\n throw err;\n }\n\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n function autoDetection(name) {\n var lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /* Interface definition */\n\n hljs.highlight = highlight;\n hljs.highlightAuto = highlightAuto;\n hljs.fixMarkup = fixMarkup;\n hljs.highlightBlock = highlightBlock;\n hljs.configure = configure;\n hljs.initHighlighting = initHighlighting;\n hljs.initHighlightingOnLoad = initHighlightingOnLoad;\n hljs.registerLanguage = registerLanguage;\n hljs.listLanguages = listLanguages;\n hljs.getLanguage = getLanguage;\n hljs.requireLanguage = requireLanguage;\n hljs.autoDetection = autoDetection;\n hljs.inherit = inherit;\n hljs.debugMode = function() { SAFE_MODE = false; }\n\n // Common regexps\n hljs.IDENT_RE = '[a-zA-Z]\\\\w*';\n hljs.UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\n hljs.NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\n hljs.C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\n hljs.BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\n hljs.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n // Common modes\n hljs.BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n };\n hljs.APOS_STRING_MODE = {\n className: 'string',\n begin: '\\'', end: '\\'',\n illegal: '\\\\n',\n contains: [hljs.BACKSLASH_ESCAPE]\n };\n hljs.QUOTE_STRING_MODE = {\n className: 'string',\n begin: '\"', end: '\"',\n illegal: '\\\\n',\n contains: [hljs.BACKSLASH_ESCAPE]\n };\n hljs.PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n };\n hljs.COMMENT = function (begin, end, inherits) {\n var mode = hljs.inherit(\n {\n className: 'comment',\n begin: begin, end: end,\n contains: []\n },\n inherits || {}\n );\n mode.contains.push(hljs.PHRASAL_WORDS_MODE);\n mode.contains.push({\n className: 'doctag',\n begin: '(?:TODO|FIXME|NOTE|BUG|XXX):',\n relevance: 0\n });\n return mode;\n };\n hljs.C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$');\n hljs.C_BLOCK_COMMENT_MODE = hljs.COMMENT('/\\\\*', '\\\\*/');\n hljs.HASH_COMMENT_MODE = hljs.COMMENT('#', '$');\n hljs.NUMBER_MODE = {\n className: 'number',\n begin: hljs.NUMBER_RE,\n relevance: 0\n };\n hljs.C_NUMBER_MODE = {\n className: 'number',\n begin: hljs.C_NUMBER_RE,\n relevance: 0\n };\n hljs.BINARY_NUMBER_MODE = {\n className: 'number',\n begin: hljs.BINARY_NUMBER_RE,\n relevance: 0\n };\n hljs.CSS_NUMBER_MODE = {\n className: 'number',\n begin: hljs.NUMBER_RE + '(' +\n '%|em|ex|ch|rem' +\n '|vw|vh|vmin|vmax' +\n '|cm|mm|in|pt|pc|px' +\n '|deg|grad|rad|turn' +\n '|s|ms' +\n '|Hz|kHz' +\n '|dpi|dpcm|dppx' +\n ')?',\n relevance: 0\n };\n hljs.REGEXP_MODE = {\n className: 'regexp',\n begin: /\\//, end: /\\/[gimuy]*/,\n illegal: /\\n/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n {\n begin: /\\[/, end: /\\]/,\n relevance: 0,\n contains: [hljs.BACKSLASH_ESCAPE]\n }\n ]\n };\n hljs.TITLE_MODE = {\n className: 'title',\n begin: hljs.IDENT_RE,\n relevance: 0\n };\n hljs.UNDERSCORE_TITLE_MODE = {\n className: 'title',\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n };\n hljs.METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n };\n\n var constants = [\n hljs.BACKSLASH_ESCAPE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.PHRASAL_WORDS_MODE,\n hljs.COMMENT,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.HASH_COMMENT_MODE,\n hljs.NUMBER_MODE,\n hljs.C_NUMBER_MODE,\n hljs.BINARY_NUMBER_MODE,\n hljs.CSS_NUMBER_MODE,\n hljs.REGEXP_MODE,\n hljs.TITLE_MODE,\n hljs.UNDERSCORE_TITLE_MODE,\n hljs.METHOD_GUARD\n ]\n constants.forEach(function(obj) { deepFreeze(obj); });\n\n // https://github.com/substack/deep-freeze/blob/master/index.js\n function deepFreeze (o) {\n Object.freeze(o);\n\n var objIsFunction = typeof o === 'function';\n\n Object.getOwnPropertyNames(o).forEach(function (prop) {\n if (o.hasOwnProperty(prop)\n && o[prop] !== null\n && (typeof o[prop] === \"object\" || typeof o[prop] === \"function\")\n // IE11 fix: https://github.com/highlightjs/highlight.js/issues/2318\n // TODO: remove in the future\n && (objIsFunction ? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments' : true)\n && !Object.isFrozen(o[prop])) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n };\n\n\n return hljs;\n}));\n","'use strict'\n\nvar formatter = require('format')\n\nvar fault = create(Error)\n\nmodule.exports = fault\n\nfault.eval = create(EvalError)\nfault.range = create(RangeError)\nfault.reference = create(ReferenceError)\nfault.syntax = create(SyntaxError)\nfault.type = create(TypeError)\nfault.uri = create(URIError)\n\nfault.create = create\n\n// Create a new `EConstructor`, with the formatted `format` as a first argument.\nfunction create(EConstructor) {\n FormattedError.displayName = EConstructor.displayName || EConstructor.name\n\n return FormattedError\n\n function FormattedError(format) {\n if (format) {\n format = formatter.apply(null, arguments)\n }\n\n return new EConstructor(format)\n }\n}\n","//\n// format - printf-like string formatting for JavaScript\n// github.com/samsonjs/format\n// @_sjs\n//\n// Copyright 2010 - 2013 Sami Samhuri <sami@samhuri.net>\n//\n// MIT License\n// http://sjs.mit-license.org\n//\n\n;(function() {\n\n //// Export the API\n var namespace;\n\n // CommonJS / Node module\n if (typeof module !== 'undefined') {\n namespace = module.exports = format;\n }\n\n // Browsers and other environments\n else {\n // Get the global object. Works in ES3, ES5, and ES5 strict mode.\n namespace = (function(){ return this || (1,eval)('this') }());\n }\n\n namespace.format = format;\n namespace.vsprintf = vsprintf;\n\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n namespace.printf = printf;\n }\n\n function printf(/* ... */) {\n console.log(format.apply(null, arguments));\n }\n\n function vsprintf(fmt, replacements) {\n return format.apply(null, [fmt].concat(replacements));\n }\n\n function format(fmt) {\n var argIndex = 1 // skip initial format argument\n , args = [].slice.call(arguments)\n , i = 0\n , n = fmt.length\n , result = ''\n , c\n , escaped = false\n , arg\n , tmp\n , leadingZero = false\n , precision\n , nextArg = function() { return args[argIndex++]; }\n , slurpNumber = function() {\n var digits = '';\n while (/\\d/.test(fmt[i])) {\n digits += fmt[i++];\n c = fmt[i];\n }\n return digits.length > 0 ? parseInt(digits) : null;\n }\n ;\n for (; i < n; ++i) {\n c = fmt[i];\n if (escaped) {\n escaped = false;\n if (c == '.') {\n leadingZero = false;\n c = fmt[++i];\n }\n else if (c == '0' && fmt[i + 1] == '.') {\n leadingZero = true;\n i += 2;\n c = fmt[i];\n }\n else {\n leadingZero = true;\n }\n precision = slurpNumber();\n switch (c) {\n case 'b': // number in binary\n result += parseInt(nextArg(), 10).toString(2);\n break;\n case 'c': // character\n arg = nextArg();\n if (typeof arg === 'string' || arg instanceof String)\n result += arg;\n else\n result += String.fromCharCode(parseInt(arg, 10));\n break;\n case 'd': // number in decimal\n result += parseInt(nextArg(), 10);\n break;\n case 'f': // floating point number\n tmp = String(parseFloat(nextArg()).toFixed(precision || 6));\n result += leadingZero ? tmp : tmp.replace(/^0/, '');\n break;\n case 'j': // JSON\n result += JSON.stringify(nextArg());\n break;\n case 'o': // number in octal\n result += '0' + parseInt(nextArg(), 10).toString(8);\n break;\n case 's': // string\n result += nextArg();\n break;\n case 'x': // lowercase hexadecimal\n result += '0x' + parseInt(nextArg(), 10).toString(16);\n break;\n case 'X': // uppercase hexadecimal\n result += '0x' + parseInt(nextArg(), 10).toString(16).toUpperCase();\n break;\n default:\n result += c;\n break;\n }\n } else if (c === '%') {\n escaped = true;\n } else {\n result += c;\n }\n }\n return result;\n }\n\n}());\n","// Main parser class\n\n'use strict';\n\n\nvar utils = require('./common/utils');\nvar helpers = require('./helpers');\nvar Renderer = require('./renderer');\nvar ParserCore = require('./parser_core');\nvar ParserBlock = require('./parser_block');\nvar ParserInline = require('./parser_inline');\nvar LinkifyIt = require('linkify-it');\nvar mdurl = require('mdurl');\nvar punycode = require('punycode');\n\n\nvar config = {\n 'default': require('./presets/default'),\n zero: require('./presets/zero'),\n commonmark: require('./presets/commonmark')\n};\n\n////////////////////////////////////////////////////////////////////////////////\n//\n// This validator can prohibit more than really needed to prevent XSS. It's a\n// tradeoff to keep code simple and to be secure by default.\n//\n// If you need different setup - override validator method as you wish. Or\n// replace it with dummy function and use external sanitizer.\n//\n\nvar BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;\nvar GOOD_DATA_RE = /^data:image\\/(gif|png|jpeg|webp);/;\n\nfunction validateLink(url) {\n // url should be normalized at this point, and existing entities are decoded\n var str = url.trim().toLowerCase();\n\n return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n\nvar RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ];\n\nfunction normalizeLink(url) {\n var parsed = mdurl.parse(url, true);\n\n if (parsed.hostname) {\n // Encode hostnames in urls like:\n // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`\n //\n // We don't encode unknown schemas, because it's likely that we encode\n // something we shouldn't (e.g. `skype:name` treated as `skype:host`)\n //\n if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {\n try {\n parsed.hostname = punycode.toASCII(parsed.hostname);\n } catch (er) { /**/ }\n }\n }\n\n return mdurl.encode(mdurl.format(parsed));\n}\n\nfunction normalizeLinkText(url) {\n var parsed = mdurl.parse(url, true);\n\n if (parsed.hostname) {\n // Encode hostnames in urls like:\n // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`\n //\n // We don't encode unknown schemas, because it's likely that we encode\n // something we shouldn't (e.g. `skype:name` treated as `skype:host`)\n //\n if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {\n try {\n parsed.hostname = punycode.toUnicode(parsed.hostname);\n } catch (er) { /**/ }\n }\n }\n\n return mdurl.decode(mdurl.format(parsed));\n}\n\n\n/**\n * class MarkdownIt\n *\n * Main parser/renderer class.\n *\n * ##### Usage\n *\n * ```javascript\n * // node.js, \"classic\" way:\n * var MarkdownIt = require('markdown-it'),\n * md = new MarkdownIt();\n * var result = md.render('# markdown-it rulezz!');\n *\n * // node.js, the same, but with sugar:\n * var md = require('markdown-it')();\n * var result = md.render('# markdown-it rulezz!');\n *\n * // browser without AMD, added to \"window\" on script load\n * // Note, there are no dash.\n * var md = window.markdownit();\n * var result = md.render('# markdown-it rulezz!');\n * ```\n *\n * Single line rendering, without paragraph wrap:\n *\n * ```javascript\n * var md = require('markdown-it')();\n * var result = md.renderInline('__markdown-it__ rulezz!');\n * ```\n **/\n\n/**\n * new MarkdownIt([presetName, options])\n * - presetName (String): optional, `commonmark` / `zero`\n * - options (Object)\n *\n * Creates parser instanse with given config. Can be called without `new`.\n *\n * ##### presetName\n *\n * MarkdownIt provides named presets as a convenience to quickly\n * enable/disable active syntax rules and options for common use cases.\n *\n * - [\"commonmark\"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -\n * configures parser to strict [CommonMark](http://commonmark.org/) mode.\n * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -\n * similar to GFM, used when no preset name given. Enables all available rules,\n * but still without html, typographer & autolinker.\n * - [\"zero\"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -\n * all rules disabled. Useful to quickly setup your config via `.enable()`.\n * For example, when you need only `bold` and `italic` markup and nothing else.\n *\n * ##### options:\n *\n * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!\n * That's not safe! You may need external sanitizer to protect output from XSS.\n * It's better to extend features via plugins, instead of enabling HTML.\n * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags\n * (`<br />`). This is needed only for full CommonMark compatibility. In real\n * world you will need HTML output.\n * - __breaks__ - `false`. Set `true` to convert `\\n` in paragraphs into `<br>`.\n * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.\n * Can be useful for external highlighters.\n * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.\n * - __typographer__ - `false`. Set `true` to enable [some language-neutral\n * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +\n * quotes beautification (smartquotes).\n * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement\n * pairs, when typographer enabled and smartquotes on. For example, you can\n * use `'«»„“'` for Russian, `'„“‚‘'` for German, and\n * `['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›']` for French (including nbsp).\n * - __highlight__ - `null`. Highlighter function for fenced code blocks.\n * Highlighter `function (str, lang)` should return escaped HTML. It can also\n * return empty string if the source was not changed and should be escaped\n * externaly. If result starts with <pre... internal wrapper is skipped.\n *\n * ##### Example\n *\n * ```javascript\n * // commonmark mode\n * var md = require('markdown-it')('commonmark');\n *\n * // default mode\n * var md = require('markdown-it')();\n *\n * // enable everything\n * var md = require('markdown-it')({\n * html: true,\n * linkify: true,\n * typographer: true\n * });\n * ```\n *\n * ##### Syntax highlighting\n *\n * ```js\n * var hljs = require('highlight.js') // https://highlightjs.org/\n *\n * var md = require('markdown-it')({\n * highlight: function (str, lang) {\n * if (lang && hljs.getLanguage(lang)) {\n * try {\n * return hljs.highlight(lang, str, true).value;\n * } catch (__) {}\n * }\n *\n * return ''; // use external default escaping\n * }\n * });\n * ```\n *\n * Or with full wrapper override (if you need assign class to `<pre>`):\n *\n * ```javascript\n * var hljs = require('highlight.js') // https://highlightjs.org/\n *\n * // Actual default values\n * var md = require('markdown-it')({\n * highlight: function (str, lang) {\n * if (lang && hljs.getLanguage(lang)) {\n * try {\n * return '<pre class=\"hljs\"><code>' +\n * hljs.highlight(lang, str, true).value +\n * '</code></pre>';\n * } catch (__) {}\n * }\n *\n * return '<pre class=\"hljs\"><code>' + md.utils.escapeHtml(str) + '</code></pre>';\n * }\n * });\n * ```\n *\n **/\nfunction MarkdownIt(presetName, options) {\n if (!(this instanceof MarkdownIt)) {\n return new MarkdownIt(presetName, options);\n }\n\n if (!options) {\n if (!utils.isString(presetName)) {\n options = presetName || {};\n presetName = 'default';\n }\n }\n\n /**\n * MarkdownIt#inline -> ParserInline\n *\n * Instance of [[ParserInline]]. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.inline = new ParserInline();\n\n /**\n * MarkdownIt#block -> ParserBlock\n *\n * Instance of [[ParserBlock]]. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.block = new ParserBlock();\n\n /**\n * MarkdownIt#core -> Core\n *\n * Instance of [[Core]] chain executor. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.core = new ParserCore();\n\n /**\n * MarkdownIt#renderer -> Renderer\n *\n * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering\n * rules for new token types, generated by plugins.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * function myToken(tokens, idx, options, env, self) {\n * //...\n * return result;\n * };\n *\n * md.renderer.rules['my_token'] = myToken\n * ```\n *\n * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).\n **/\n this.renderer = new Renderer();\n\n /**\n * MarkdownIt#linkify -> LinkifyIt\n *\n * [linkify-it](https://github.com/markdown-it/linkify-it) instance.\n * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)\n * rule.\n **/\n this.linkify = new LinkifyIt();\n\n /**\n * MarkdownIt#validateLink(url) -> Boolean\n *\n * Link validation function. CommonMark allows too much in links. By default\n * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas\n * except some embedded image types.\n *\n * You can change this behaviour:\n *\n * ```javascript\n * var md = require('markdown-it')();\n * // enable everything\n * md.validateLink = function () { return true; }\n * ```\n **/\n this.validateLink = validateLink;\n\n /**\n * MarkdownIt#normalizeLink(url) -> String\n *\n * Function used to encode link url to a machine-readable format,\n * which includes url-encoding, punycode, etc.\n **/\n this.normalizeLink = normalizeLink;\n\n /**\n * MarkdownIt#normalizeLinkText(url) -> String\n *\n * Function used to decode link url to a human-readable format`\n **/\n this.normalizeLinkText = normalizeLinkText;\n\n\n // Expose utils & helpers for easy acces from plugins\n\n /**\n * MarkdownIt#utils -> utils\n *\n * Assorted utility functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).\n **/\n this.utils = utils;\n\n /**\n * MarkdownIt#helpers -> helpers\n *\n * Link components parser functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).\n **/\n this.helpers = utils.assign({}, helpers);\n\n\n this.options = {};\n this.configure(presetName);\n\n if (options) { this.set(options); }\n}\n\n\n/** chainable\n * MarkdownIt.set(options)\n *\n * Set parser options (in the same format as in constructor). Probably, you\n * will never need it, but you can change options after constructor call.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')()\n * .set({ html: true, breaks: true })\n * .set({ typographer, true });\n * ```\n *\n * __Note:__ To achieve the best possible performance, don't modify a\n * `markdown-it` instance options on the fly. If you need multiple configurations\n * it's best to create multiple instances and initialize each with separate\n * config.\n **/\nMarkdownIt.prototype.set = function (options) {\n utils.assign(this.options, options);\n return this;\n};\n\n\n/** chainable, internal\n * MarkdownIt.configure(presets)\n *\n * Batch load of all options and compenent settings. This is internal method,\n * and you probably will not need it. But if you with - see available presets\n * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)\n *\n * We strongly recommend to use presets instead of direct config loads. That\n * will give better compatibility with next versions.\n **/\nMarkdownIt.prototype.configure = function (presets) {\n var self = this, presetName;\n\n if (utils.isString(presets)) {\n presetName = presets;\n presets = config[presetName];\n if (!presets) { throw new Error('Wrong `markdown-it` preset \"' + presetName + '\", check name'); }\n }\n\n if (!presets) { throw new Error('Wrong `markdown-it` preset, can\\'t be empty'); }\n\n if (presets.options) { self.set(presets.options); }\n\n if (presets.components) {\n Object.keys(presets.components).forEach(function (name) {\n if (presets.components[name].rules) {\n self[name].ruler.enableOnly(presets.components[name].rules);\n }\n if (presets.components[name].rules2) {\n self[name].ruler2.enableOnly(presets.components[name].rules2);\n }\n });\n }\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.enable(list, ignoreInvalid)\n * - list (String|Array): rule name or list of rule names to enable\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable list or rules. It will automatically find appropriate components,\n * containing rules with given names. If rule not found, and `ignoreInvalid`\n * not set - throws exception.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')()\n * .enable(['sub', 'sup'])\n * .disable('smartquotes');\n * ```\n **/\nMarkdownIt.prototype.enable = function (list, ignoreInvalid) {\n var result = [];\n\n if (!Array.isArray(list)) { list = [ list ]; }\n\n [ 'core', 'block', 'inline' ].forEach(function (chain) {\n result = result.concat(this[chain].ruler.enable(list, true));\n }, this);\n\n result = result.concat(this.inline.ruler2.enable(list, true));\n\n var missed = list.filter(function (name) { return result.indexOf(name) < 0; });\n\n if (missed.length && !ignoreInvalid) {\n throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);\n }\n\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.disable(list, ignoreInvalid)\n * - list (String|Array): rule name or list of rule names to disable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * The same as [[MarkdownIt.enable]], but turn specified rules off.\n **/\nMarkdownIt.prototype.disable = function (list, ignoreInvalid) {\n var result = [];\n\n if (!Array.isArray(list)) { list = [ list ]; }\n\n [ 'core', 'block', 'inline' ].forEach(function (chain) {\n result = result.concat(this[chain].ruler.disable(list, true));\n }, this);\n\n result = result.concat(this.inline.ruler2.disable(list, true));\n\n var missed = list.filter(function (name) { return result.indexOf(name) < 0; });\n\n if (missed.length && !ignoreInvalid) {\n throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);\n }\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.use(plugin, params)\n *\n * Load specified plugin with given params into current parser instance.\n * It's just a sugar to call `plugin(md, params)` with curring.\n *\n * ##### Example\n *\n * ```javascript\n * var iterator = require('markdown-it-for-inline');\n * var md = require('markdown-it')()\n * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {\n * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');\n * });\n * ```\n **/\nMarkdownIt.prototype.use = function (plugin /*, params, ... */) {\n var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));\n plugin.apply(plugin, args);\n return this;\n};\n\n\n/** internal\n * MarkdownIt.parse(src, env) -> Array\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Parse input string and returns list of block tokens (special token type\n * \"inline\" will contain list of inline tokens). You should not call this\n * method directly, until you write custom renderer (for example, to produce\n * AST).\n *\n * `env` is used to pass data between \"distributed\" rules and return additional\n * metadata like reference info, needed for the renderer. It also can be used to\n * inject data in specific cases. Usually, you will be ok to pass `{}`,\n * and then pass updated object to renderer.\n **/\nMarkdownIt.prototype.parse = function (src, env) {\n if (typeof src !== 'string') {\n throw new Error('Input data should be a String');\n }\n\n var state = new this.core.State(src, this, env);\n\n this.core.process(state);\n\n return state.tokens;\n};\n\n\n/**\n * MarkdownIt.render(src [, env]) -> String\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Render markdown string into html. It does all magic for you :).\n *\n * `env` can be used to inject additional metadata (`{}` by default).\n * But you will not need it with high probability. See also comment\n * in [[MarkdownIt.parse]].\n **/\nMarkdownIt.prototype.render = function (src, env) {\n env = env || {};\n\n return this.renderer.render(this.parse(src, env), this.options, env);\n};\n\n\n/** internal\n * MarkdownIt.parseInline(src, env) -> Array\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the\n * block tokens list with the single `inline` element, containing parsed inline\n * tokens in `children` property. Also updates `env` object.\n **/\nMarkdownIt.prototype.parseInline = function (src, env) {\n var state = new this.core.State(src, this, env);\n\n state.inlineMode = true;\n this.core.process(state);\n\n return state.tokens;\n};\n\n\n/**\n * MarkdownIt.renderInline(src [, env]) -> String\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Similar to [[MarkdownIt.render]] but for single paragraph content. Result\n * will NOT be wrapped into `<p>` tags.\n **/\nMarkdownIt.prototype.renderInline = function (src, env) {\n env = env || {};\n\n return this.renderer.render(this.parseInline(src, env), this.options, env);\n};\n\n\nmodule.exports = MarkdownIt;\n","\n'use strict';\n\n\nvar encodeCache = {};\n\n\n// Create a lookup array where anything but characters in `chars` string\n// and alphanumeric chars is percent-encoded.\n//\nfunction getEncodeCache(exclude) {\n var i, ch, cache = encodeCache[exclude];\n if (cache) { return cache; }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n}\n\n\n// Encode unsafe characters with percent-encoding, skipping already\n// encoded sequences.\n//\n// - string - string to encode\n// - exclude - list of characters to ignore (in addition to a-zA-Z0-9)\n// - keepEscaped - don't encode '%' in a correct escape sequence (default: true)\n//\nfunction encode(string, exclude, keepEscaped) {\n var i, l, code, nextCode, cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode.defaultChars;\n }\n\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n\n cache = getEncodeCache(exclude);\n\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n\n if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n\n if (code < 128) {\n result += cache[code];\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n result += '%EF%BF%BD';\n continue;\n }\n\n result += encodeURIComponent(string[i]);\n }\n\n return result;\n}\n\nencode.defaultChars = \";/?:@&=+$,-_.!~*'()#\";\nencode.componentChars = \"-_.!~*'()\";\n\n\nmodule.exports = encode;\n","\n'use strict';\n\n\n/* eslint-disable no-bitwise */\n\nvar decodeCache = {};\n\nfunction getDecodeCache(exclude) {\n var i, ch, cache = decodeCache[exclude];\n if (cache) { return cache; }\n\n cache = decodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n cache.push(ch);\n }\n\n for (i = 0; i < exclude.length; i++) {\n ch = exclude.charCodeAt(i);\n cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);\n }\n\n return cache;\n}\n\n\n// Decode percent-encoded string.\n//\nfunction decode(string, exclude) {\n var cache;\n\n if (typeof exclude !== 'string') {\n exclude = decode.defaultChars;\n }\n\n cache = getDecodeCache(exclude);\n\n return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {\n var i, l, b1, b2, b3, b4, chr,\n result = '';\n\n for (i = 0, l = seq.length; i < l; i += 3) {\n b1 = parseInt(seq.slice(i + 1, i + 3), 16);\n\n if (b1 < 0x80) {\n result += cache[b1];\n continue;\n }\n\n if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {\n // 110xxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n\n if ((b2 & 0xC0) === 0x80) {\n chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);\n\n if (chr < 0x80) {\n result += '\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 3;\n continue;\n }\n }\n\n if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {\n // 1110xxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);\n\n if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {\n result += '\\ufffd\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 6;\n continue;\n }\n }\n\n if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {\n // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n b4 = parseInt(seq.slice(i + 10, i + 12), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {\n chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);\n\n if (chr < 0x10000 || chr > 0x10FFFF) {\n result += '\\ufffd\\ufffd\\ufffd\\ufffd';\n } else {\n chr -= 0x10000;\n result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));\n }\n\n i += 9;\n continue;\n }\n }\n\n result += '\\ufffd';\n }\n\n return result;\n });\n}\n\n\ndecode.defaultChars = ';/?:@&=+$,#';\ndecode.componentChars = '';\n\n\nmodule.exports = decode;\n","\n'use strict';\n\n\nmodule.exports = function format(url) {\n var result = '';\n\n result += url.protocol || '';\n result += url.slashes ? '//' : '';\n result += url.auth ? url.auth + '@' : '';\n\n if (url.hostname && url.hostname.indexOf(':') !== -1) {\n // ipv6 address\n result += '[' + url.hostname + ']';\n } else {\n result += url.hostname || '';\n }\n\n result += url.port ? ':' + url.port : '';\n result += url.pathname || '';\n result += url.search || '';\n result += url.hash || '';\n\n return result;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n//\n// Changes from joyent/node:\n//\n// 1. No leading slash in paths,\n// e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`\n//\n// 2. Backslashes are not replaced with slashes,\n// so `http:\\\\example.org\\` is treated like a relative path\n//\n// 3. Trailing colon is treated like a part of the path,\n// i.e. in `http://example.org:foo` pathname is `:foo`\n//\n// 4. Nothing is URL-encoded in the resulting object,\n// (in joyent/node some chars in auth and paths are encoded)\n//\n// 5. `url.parse()` does not have `parseQueryString` argument\n//\n// 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,\n// which can be constructed using other parts of the url.\n//\n\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = [ '<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t' ],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = [ '{', '}', '|', '\\\\', '^', '`' ].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = [ '\\'' ].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),\n hostEndingChars = [ '/', '?', '#' ],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n /* eslint-disable no-script-url */\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n };\n /* eslint-enable no-script-url */\n\nfunction urlParse(url, slashesDenoteHost) {\n if (url && url instanceof Url) { return url; }\n\n var u = new Url();\n u.parse(url, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, slashesDenoteHost) {\n var i, l, lowerProto, hec, slashes,\n rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n lowerProto = proto.toLowerCase();\n this.protocol = proto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (i = 0; i < hostEndingChars.length; i++) {\n hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {\n hostEnd = hec;\n }\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = auth;\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (i = 0; i < nonHostChars.length; i++) {\n hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {\n hostEnd = hec;\n }\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1) {\n hostEnd = rest.length;\n }\n\n if (rest[hostEnd - 1] === ':') { hostEnd--; }\n var host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost(host);\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) { continue; }\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n }\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n }\n }\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n rest = rest.slice(0, qm);\n }\n if (rest) { this.pathname = rest; }\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '';\n }\n\n return this;\n};\n\nUrl.prototype.parseHost = function(host) {\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) { this.hostname = host; }\n};\n\nmodule.exports = urlParse;\n","'use strict';\n\nexports.Any = require('./properties/Any/regex');\nexports.Cc = require('./categories/Cc/regex');\nexports.Cf = require('./categories/Cf/regex');\nexports.P = require('./categories/P/regex');\nexports.Z = require('./categories/Z/regex');\n","module.exports=/[\\xAD\\u0600-\\u0605\\u061C\\u06DD\\u070F\\u08E2\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u206F\\uFEFF\\uFFF9-\\uFFFB]|\\uD804[\\uDCBD\\uDCCD]|\\uD82F[\\uDCA0-\\uDCA3]|\\uD834[\\uDD73-\\uDD7A]|\\uDB40[\\uDC01\\uDC20-\\uDC7F]/","// Just a shortcut for bulk export\n'use strict';\n\n\nexports.parseLinkLabel = require('./parse_link_label');\nexports.parseLinkDestination = require('./parse_link_destination');\nexports.parseLinkTitle = require('./parse_link_title');\n","// Parse link label\n//\n// this function assumes that first character (\"[\") already matches;\n// returns the end of the label\n//\n'use strict';\n\nmodule.exports = function parseLinkLabel(state, start, disableNested) {\n var level, found, marker, prevPos,\n labelEnd = -1,\n max = state.posMax,\n oldPos = state.pos;\n\n state.pos = start + 1;\n level = 1;\n\n while (state.pos < max) {\n marker = state.src.charCodeAt(state.pos);\n if (marker === 0x5D /* ] */) {\n level--;\n if (level === 0) {\n found = true;\n break;\n }\n }\n\n prevPos = state.pos;\n state.md.inline.skipToken(state);\n if (marker === 0x5B /* [ */) {\n if (prevPos === state.pos - 1) {\n // increase level if we find text `[`, which is not a part of any token\n level++;\n } else if (disableNested) {\n state.pos = oldPos;\n return -1;\n }\n }\n }\n\n if (found) {\n labelEnd = state.pos;\n }\n\n // restore old state\n state.pos = oldPos;\n\n return labelEnd;\n};\n","// Parse link destination\n//\n'use strict';\n\n\nvar isSpace = require('../common/utils').isSpace;\nvar unescapeAll = require('../common/utils').unescapeAll;\n\n\nmodule.exports = function parseLinkDestination(str, pos, max) {\n var code, level,\n lines = 0,\n start = pos,\n result = {\n ok: false,\n pos: 0,\n lines: 0,\n str: ''\n };\n\n if (str.charCodeAt(pos) === 0x3C /* < */) {\n pos++;\n while (pos < max) {\n code = str.charCodeAt(pos);\n if (code === 0x0A /* \\n */ || isSpace(code)) { return result; }\n if (code === 0x3E /* > */) {\n result.pos = pos + 1;\n result.str = unescapeAll(str.slice(start + 1, pos));\n result.ok = true;\n return result;\n }\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos += 2;\n continue;\n }\n\n pos++;\n }\n\n // no closing '>'\n return result;\n }\n\n // this should be ... } else { ... branch\n\n level = 0;\n while (pos < max) {\n code = str.charCodeAt(pos);\n\n if (code === 0x20) { break; }\n\n // ascii control characters\n if (code < 0x20 || code === 0x7F) { break; }\n\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos += 2;\n continue;\n }\n\n if (code === 0x28 /* ( */) {\n level++;\n }\n\n if (code === 0x29 /* ) */) {\n if (level === 0) { break; }\n level--;\n }\n\n pos++;\n }\n\n if (start === pos) { return result; }\n if (level !== 0) { return result; }\n\n result.str = unescapeAll(str.slice(start, pos));\n result.lines = lines;\n result.pos = pos;\n result.ok = true;\n return result;\n};\n","// Parse link title\n//\n'use strict';\n\n\nvar unescapeAll = require('../common/utils').unescapeAll;\n\n\nmodule.exports = function parseLinkTitle(str, pos, max) {\n var code,\n marker,\n lines = 0,\n start = pos,\n result = {\n ok: false,\n pos: 0,\n lines: 0,\n str: ''\n };\n\n if (pos >= max) { return result; }\n\n marker = str.charCodeAt(pos);\n\n if (marker !== 0x22 /* \" */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }\n\n pos++;\n\n // if opening marker is \"(\", switch it to closing marker \")\"\n if (marker === 0x28) { marker = 0x29; }\n\n while (pos < max) {\n code = str.charCodeAt(pos);\n if (code === marker) {\n result.pos = pos + 1;\n result.lines = lines;\n result.str = unescapeAll(str.slice(start + 1, pos));\n result.ok = true;\n return result;\n } else if (code === 0x0A) {\n lines++;\n } else if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos++;\n if (str.charCodeAt(pos) === 0x0A) {\n lines++;\n }\n }\n\n pos++;\n }\n\n return result;\n};\n","/**\n * class Renderer\n *\n * Generates HTML from parsed token stream. Each instance has independent\n * copy of rules. Those can be rewritten with ease. Also, you can add new\n * rules if you create plugin and adds new token types.\n **/\n'use strict';\n\n\nvar assign = require('./common/utils').assign;\nvar unescapeAll = require('./common/utils').unescapeAll;\nvar escapeHtml = require('./common/utils').escapeHtml;\n\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar default_rules = {};\n\n\ndefault_rules.code_inline = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n return '<code' + slf.renderAttrs(token) + '>' +\n escapeHtml(tokens[idx].content) +\n '</code>';\n};\n\n\ndefault_rules.code_block = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n return '<pre' + slf.renderAttrs(token) + '><code>' +\n escapeHtml(tokens[idx].content) +\n '</code></pre>\\n';\n};\n\n\ndefault_rules.fence = function (tokens, idx, options, env, slf) {\n var token = tokens[idx],\n info = token.info ? unescapeAll(token.info).trim() : '',\n langName = '',\n highlighted, i, tmpAttrs, tmpToken;\n\n if (info) {\n langName = info.split(/\\s+/g)[0];\n }\n\n if (options.highlight) {\n highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);\n } else {\n highlighted = escapeHtml(token.content);\n }\n\n if (highlighted.indexOf('<pre') === 0) {\n return highlighted + '\\n';\n }\n\n // If language exists, inject class gently, without modifying original token.\n // May be, one day we will add .clone() for token and simplify this part, but\n // now we prefer to keep things local.\n if (info) {\n i = token.attrIndex('class');\n tmpAttrs = token.attrs ? token.attrs.slice() : [];\n\n if (i < 0) {\n tmpAttrs.push([ 'class', options.langPrefix + langName ]);\n } else {\n tmpAttrs[i][1] += ' ' + options.langPrefix + langName;\n }\n\n // Fake token just to render attributes\n tmpToken = {\n attrs: tmpAttrs\n };\n\n return '<pre><code' + slf.renderAttrs(tmpToken) + '>'\n + highlighted\n + '</code></pre>\\n';\n }\n\n\n return '<pre><code' + slf.renderAttrs(token) + '>'\n + highlighted\n + '</code></pre>\\n';\n};\n\n\ndefault_rules.image = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n // \"alt\" attr MUST be set, even if empty. Because it's mandatory and\n // should be placed on proper position for tests.\n //\n // Replace content with actual value\n\n token.attrs[token.attrIndex('alt')][1] =\n slf.renderInlineAsText(token.children, options, env);\n\n return slf.renderToken(tokens, idx, options);\n};\n\n\ndefault_rules.hardbreak = function (tokens, idx, options /*, env */) {\n return options.xhtmlOut ? '<br />\\n' : '<br>\\n';\n};\ndefault_rules.softbreak = function (tokens, idx, options /*, env */) {\n return options.breaks ? (options.xhtmlOut ? '<br />\\n' : '<br>\\n') : '\\n';\n};\n\n\ndefault_rules.text = function (tokens, idx /*, options, env */) {\n return escapeHtml(tokens[idx].content);\n};\n\n\ndefault_rules.html_block = function (tokens, idx /*, options, env */) {\n return tokens[idx].content;\n};\ndefault_rules.html_inline = function (tokens, idx /*, options, env */) {\n return tokens[idx].content;\n};\n\n\n/**\n * new Renderer()\n *\n * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.\n **/\nfunction Renderer() {\n\n /**\n * Renderer#rules -> Object\n *\n * Contains render rules for tokens. Can be updated and extended.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.renderer.rules.strong_open = function () { return '<b>'; };\n * md.renderer.rules.strong_close = function () { return '</b>'; };\n *\n * var result = md.renderInline(...);\n * ```\n *\n * Each rule is called as independent static function with fixed signature:\n *\n * ```javascript\n * function my_token_render(tokens, idx, options, env, renderer) {\n * // ...\n * return renderedHTML;\n * }\n * ```\n *\n * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)\n * for more details and examples.\n **/\n this.rules = assign({}, default_rules);\n}\n\n\n/**\n * Renderer.renderAttrs(token) -> String\n *\n * Render token attributes to string.\n **/\nRenderer.prototype.renderAttrs = function renderAttrs(token) {\n var i, l, result;\n\n if (!token.attrs) { return ''; }\n\n result = '';\n\n for (i = 0, l = token.attrs.length; i < l; i++) {\n result += ' ' + escapeHtml(token.attrs[i][0]) + '=\"' + escapeHtml(token.attrs[i][1]) + '\"';\n }\n\n return result;\n};\n\n\n/**\n * Renderer.renderToken(tokens, idx, options) -> String\n * - tokens (Array): list of tokens\n * - idx (Numbed): token index to render\n * - options (Object): params of parser instance\n *\n * Default token renderer. Can be overriden by custom function\n * in [[Renderer#rules]].\n **/\nRenderer.prototype.renderToken = function renderToken(tokens, idx, options) {\n var nextToken,\n result = '',\n needLf = false,\n token = tokens[idx];\n\n // Tight list paragraphs\n if (token.hidden) {\n return '';\n }\n\n // Insert a newline between hidden paragraph and subsequent opening\n // block-level tag.\n //\n // For example, here we should insert a newline before blockquote:\n // - a\n // >\n //\n if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {\n result += '\\n';\n }\n\n // Add token name, e.g. `<img`\n result += (token.nesting === -1 ? '</' : '<') + token.tag;\n\n // Encode attributes, e.g. `<img src=\"foo\"`\n result += this.renderAttrs(token);\n\n // Add a slash for self-closing tags, e.g. `<img src=\"foo\" /`\n if (token.nesting === 0 && options.xhtmlOut) {\n result += ' /';\n }\n\n // Check if we need to add a newline after this tag\n if (token.block) {\n needLf = true;\n\n if (token.nesting === 1) {\n if (idx + 1 < tokens.length) {\n nextToken = tokens[idx + 1];\n\n if (nextToken.type === 'inline' || nextToken.hidden) {\n // Block-level tag containing an inline tag.\n //\n needLf = false;\n\n } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {\n // Opening tag + closing tag of the same type. E.g. `<li></li>`.\n //\n needLf = false;\n }\n }\n }\n }\n\n result += needLf ? '>\\n' : '>';\n\n return result;\n};\n\n\n/**\n * Renderer.renderInline(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to renter\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * The same as [[Renderer.render]], but for single token of `inline` type.\n **/\nRenderer.prototype.renderInline = function (tokens, options, env) {\n var type,\n result = '',\n rules = this.rules;\n\n for (var i = 0, len = tokens.length; i < len; i++) {\n type = tokens[i].type;\n\n if (typeof rules[type] !== 'undefined') {\n result += rules[type](tokens, i, options, env, this);\n } else {\n result += this.renderToken(tokens, i, options);\n }\n }\n\n return result;\n};\n\n\n/** internal\n * Renderer.renderInlineAsText(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to renter\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * Special kludge for image `alt` attributes to conform CommonMark spec.\n * Don't try to use it! Spec requires to show `alt` content with stripped markup,\n * instead of simple escaping.\n **/\nRenderer.prototype.renderInlineAsText = function (tokens, options, env) {\n var result = '';\n\n for (var i = 0, len = tokens.length; i < len; i++) {\n if (tokens[i].type === 'text') {\n result += tokens[i].content;\n } else if (tokens[i].type === 'image') {\n result += this.renderInlineAsText(tokens[i].children, options, env);\n }\n }\n\n return result;\n};\n\n\n/**\n * Renderer.render(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to renter\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * Takes token stream and generates HTML. Probably, you will never need to call\n * this method directly.\n **/\nRenderer.prototype.render = function (tokens, options, env) {\n var i, len, type,\n result = '',\n rules = this.rules;\n\n for (i = 0, len = tokens.length; i < len; i++) {\n type = tokens[i].type;\n\n if (type === 'inline') {\n result += this.renderInline(tokens[i].children, options, env);\n } else if (typeof rules[type] !== 'undefined') {\n result += rules[tokens[i].type](tokens, i, options, env, this);\n } else {\n result += this.renderToken(tokens, i, options, env);\n }\n }\n\n return result;\n};\n\nmodule.exports = Renderer;\n","/** internal\n * class Core\n *\n * Top-level rules executor. Glues block/inline parsers and does intermediate\n * transformations.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\nvar _rules = [\n [ 'normalize', require('./rules_core/normalize') ],\n [ 'block', require('./rules_core/block') ],\n [ 'inline', require('./rules_core/inline') ],\n [ 'linkify', require('./rules_core/linkify') ],\n [ 'replacements', require('./rules_core/replacements') ],\n [ 'smartquotes', require('./rules_core/smartquotes') ]\n];\n\n\n/**\n * new Core()\n **/\nfunction Core() {\n /**\n * Core#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of core rules.\n **/\n this.ruler = new Ruler();\n\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n}\n\n\n/**\n * Core.process(state)\n *\n * Executes core chain rules.\n **/\nCore.prototype.process = function (state) {\n var i, l, rules;\n\n rules = this.ruler.getRules('');\n\n for (i = 0, l = rules.length; i < l; i++) {\n rules[i](state);\n }\n};\n\nCore.prototype.State = require('./rules_core/state_core');\n\n\nmodule.exports = Core;\n","// Normalize input string\n\n'use strict';\n\n\nvar NEWLINES_RE = /\\r[\\n\\u0085]?|[\\u2424\\u2028\\u0085]/g;\nvar NULL_RE = /\\u0000/g;\n\n\nmodule.exports = function inline(state) {\n var str;\n\n // Normalize newlines\n str = state.src.replace(NEWLINES_RE, '\\n');\n\n // Replace NULL characters\n str = str.replace(NULL_RE, '\\uFFFD');\n\n state.src = str;\n};\n","'use strict';\n\n\nmodule.exports = function block(state) {\n var token;\n\n if (state.inlineMode) {\n token = new state.Token('inline', '', 0);\n token.content = state.src;\n token.map = [ 0, 1 ];\n token.children = [];\n state.tokens.push(token);\n } else {\n state.md.block.parse(state.src, state.md, state.env, state.tokens);\n }\n};\n","'use strict';\n\nmodule.exports = function inline(state) {\n var tokens = state.tokens, tok, i, l;\n\n // Parse inlines\n for (i = 0, l = tokens.length; i < l; i++) {\n tok = tokens[i];\n if (tok.type === 'inline') {\n state.md.inline.parse(tok.content, state.md, state.env, tok.children);\n }\n }\n};\n","// Replace link-like texts with link nodes.\n//\n// Currently restricted by `md.validateLink()` to http/https/ftp\n//\n'use strict';\n\n\nvar arrayReplaceAt = require('../common/utils').arrayReplaceAt;\n\n\nfunction isLinkOpen(str) {\n return /^<a[>\\s]/i.test(str);\n}\nfunction isLinkClose(str) {\n return /^<\\/a\\s*>/i.test(str);\n}\n\n\nmodule.exports = function linkify(state) {\n var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,\n level, htmlLinkLevel, url, fullUrl, urlText,\n blockTokens = state.tokens,\n links;\n\n if (!state.md.options.linkify) { return; }\n\n for (j = 0, l = blockTokens.length; j < l; j++) {\n if (blockTokens[j].type !== 'inline' ||\n !state.md.linkify.pretest(blockTokens[j].content)) {\n continue;\n }\n\n tokens = blockTokens[j].children;\n\n htmlLinkLevel = 0;\n\n // We scan from the end, to keep position when new tags added.\n // Use reversed logic in links start/end match\n for (i = tokens.length - 1; i >= 0; i--) {\n currentToken = tokens[i];\n\n // Skip content of markdown links\n if (currentToken.type === 'link_close') {\n i--;\n while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {\n i--;\n }\n continue;\n }\n\n // Skip content of html tag links\n if (currentToken.type === 'html_inline') {\n if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {\n htmlLinkLevel--;\n }\n if (isLinkClose(currentToken.content)) {\n htmlLinkLevel++;\n }\n }\n if (htmlLinkLevel > 0) { continue; }\n\n if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {\n\n text = currentToken.content;\n links = state.md.linkify.match(text);\n\n // Now split string to nodes\n nodes = [];\n level = currentToken.level;\n lastPos = 0;\n\n for (ln = 0; ln < links.length; ln++) {\n\n url = links[ln].url;\n fullUrl = state.md.normalizeLink(url);\n if (!state.md.validateLink(fullUrl)) { continue; }\n\n urlText = links[ln].text;\n\n // Linkifier might send raw hostnames like \"example.com\", where url\n // starts with domain name. So we prepend http:// in those cases,\n // and remove it afterwards.\n //\n if (!links[ln].schema) {\n urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\\/\\//, '');\n } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {\n urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');\n } else {\n urlText = state.md.normalizeLinkText(urlText);\n }\n\n pos = links[ln].index;\n\n if (pos > lastPos) {\n token = new state.Token('text', '', 0);\n token.content = text.slice(lastPos, pos);\n token.level = level;\n nodes.push(token);\n }\n\n token = new state.Token('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.level = level++;\n token.markup = 'linkify';\n token.info = 'auto';\n nodes.push(token);\n\n token = new state.Token('text', '', 0);\n token.content = urlText;\n token.level = level;\n nodes.push(token);\n\n token = new state.Token('link_close', 'a', -1);\n token.level = --level;\n token.markup = 'linkify';\n token.info = 'auto';\n nodes.push(token);\n\n lastPos = links[ln].lastIndex;\n }\n if (lastPos < text.length) {\n token = new state.Token('text', '', 0);\n token.content = text.slice(lastPos);\n token.level = level;\n nodes.push(token);\n }\n\n // replace current node\n blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);\n }\n }\n }\n};\n","// Simple typographyc replacements\n//\n// (c) (C) → ©\n// (tm) (TM) → ™\n// (r) (R) → ®\n// +- → ±\n// (p) (P) -> §\n// ... → … (also ?.... → ?.., !.... → !..)\n// ???????? → ???, !!!!! → !!!, `,,` → `,`\n// -- → –, --- → —\n//\n'use strict';\n\n// TODO:\n// - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾\n// - miltiplication 2 x 4 -> 2 × 4\n\nvar RARE_RE = /\\+-|\\.\\.|\\?\\?\\?\\?|!!!!|,,|--/;\n\n// Workaround for phantomjs - need regex without /g flag,\n// or root check will fail every second time\nvar SCOPED_ABBR_TEST_RE = /\\((c|tm|r|p)\\)/i;\n\nvar SCOPED_ABBR_RE = /\\((c|tm|r|p)\\)/ig;\nvar SCOPED_ABBR = {\n c: '©',\n r: '®',\n p: '§',\n tm: '™'\n};\n\nfunction replaceFn(match, name) {\n return SCOPED_ABBR[name.toLowerCase()];\n}\n\nfunction replace_scoped(inlineTokens) {\n var i, token, inside_autolink = 0;\n\n for (i = inlineTokens.length - 1; i >= 0; i--) {\n token = inlineTokens[i];\n\n if (token.type === 'text' && !inside_autolink) {\n token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--;\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++;\n }\n }\n}\n\nfunction replace_rare(inlineTokens) {\n var i, token, inside_autolink = 0;\n\n for (i = inlineTokens.length - 1; i >= 0; i--) {\n token = inlineTokens[i];\n\n if (token.type === 'text' && !inside_autolink) {\n if (RARE_RE.test(token.content)) {\n token.content = token.content\n .replace(/\\+-/g, '±')\n // .., ..., ....... -> …\n // but ?..... & !..... -> ?.. & !..\n .replace(/\\.{2,}/g, '…').replace(/([?!])…/g, '$1..')\n .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')\n // em-dash\n .replace(/(^|[^-])---([^-]|$)/mg, '$1\\u2014$2')\n // en-dash\n .replace(/(^|\\s)--(\\s|$)/mg, '$1\\u2013$2')\n .replace(/(^|[^-\\s])--([^-\\s]|$)/mg, '$1\\u2013$2');\n }\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--;\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++;\n }\n }\n}\n\n\nmodule.exports = function replace(state) {\n var blkIdx;\n\n if (!state.md.options.typographer) { return; }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n\n if (state.tokens[blkIdx].type !== 'inline') { continue; }\n\n if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {\n replace_scoped(state.tokens[blkIdx].children);\n }\n\n if (RARE_RE.test(state.tokens[blkIdx].content)) {\n replace_rare(state.tokens[blkIdx].children);\n }\n\n }\n};\n","// Convert straight quotation marks to typographic ones\n//\n'use strict';\n\n\nvar isWhiteSpace = require('../common/utils').isWhiteSpace;\nvar isPunctChar = require('../common/utils').isPunctChar;\nvar isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;\n\nvar QUOTE_TEST_RE = /['\"]/;\nvar QUOTE_RE = /['\"]/g;\nvar APOSTROPHE = '\\u2019'; /* ’ */\n\n\nfunction replaceAt(str, index, ch) {\n return str.substr(0, index) + ch + str.substr(index + 1);\n}\n\nfunction process_inlines(tokens, state) {\n var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,\n isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,\n canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;\n\n stack = [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n\n thisLevel = tokens[i].level;\n\n for (j = stack.length - 1; j >= 0; j--) {\n if (stack[j].level <= thisLevel) { break; }\n }\n stack.length = j + 1;\n\n if (token.type !== 'text') { continue; }\n\n text = token.content;\n pos = 0;\n max = text.length;\n\n /*eslint no-labels:0,block-scoped-var:0*/\n OUTER:\n while (pos < max) {\n QUOTE_RE.lastIndex = pos;\n t = QUOTE_RE.exec(text);\n if (!t) { break; }\n\n canOpen = canClose = true;\n pos = t.index + 1;\n isSingle = (t[0] === \"'\");\n\n // Find previous character,\n // default to space if it's the beginning of the line\n //\n lastChar = 0x20;\n\n if (t.index - 1 >= 0) {\n lastChar = text.charCodeAt(t.index - 1);\n } else {\n for (j = i - 1; j >= 0; j--) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // lastChar defaults to 0x20\n if (tokens[j].type !== 'text') continue;\n\n lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);\n break;\n }\n }\n\n // Find next character,\n // default to space if it's the end of the line\n //\n nextChar = 0x20;\n\n if (pos < max) {\n nextChar = text.charCodeAt(pos);\n } else {\n for (j = i + 1; j < tokens.length; j++) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // nextChar defaults to 0x20\n if (tokens[j].type !== 'text') continue;\n\n nextChar = tokens[j].content.charCodeAt(0);\n break;\n }\n }\n\n isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));\n isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));\n\n isLastWhiteSpace = isWhiteSpace(lastChar);\n isNextWhiteSpace = isWhiteSpace(nextChar);\n\n if (isNextWhiteSpace) {\n canOpen = false;\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n canOpen = false;\n }\n }\n\n if (isLastWhiteSpace) {\n canClose = false;\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n canClose = false;\n }\n }\n\n if (nextChar === 0x22 /* \" */ && t[0] === '\"') {\n if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {\n // special case: 1\"\" - count first quote as an inch\n canClose = canOpen = false;\n }\n }\n\n if (canOpen && canClose) {\n // treat this as the middle of the word\n canOpen = false;\n canClose = isNextPunctChar;\n }\n\n if (!canOpen && !canClose) {\n // middle of word\n if (isSingle) {\n token.content = replaceAt(token.content, t.index, APOSTROPHE);\n }\n continue;\n }\n\n if (canClose) {\n // this could be a closing quote, rewind the stack to get a match\n for (j = stack.length - 1; j >= 0; j--) {\n item = stack[j];\n if (stack[j].level < thisLevel) { break; }\n if (item.single === isSingle && stack[j].level === thisLevel) {\n item = stack[j];\n\n if (isSingle) {\n openQuote = state.md.options.quotes[2];\n closeQuote = state.md.options.quotes[3];\n } else {\n openQuote = state.md.options.quotes[0];\n closeQuote = state.md.options.quotes[1];\n }\n\n // replace token.content *before* tokens[item.token].content,\n // because, if they are pointing at the same token, replaceAt\n // could mess up indices when quote length != 1\n token.content = replaceAt(token.content, t.index, closeQuote);\n tokens[item.token].content = replaceAt(\n tokens[item.token].content, item.pos, openQuote);\n\n pos += closeQuote.length - 1;\n if (item.token === i) { pos += openQuote.length - 1; }\n\n text = token.content;\n max = text.length;\n\n stack.length = j;\n continue OUTER;\n }\n }\n }\n\n if (canOpen) {\n stack.push({\n token: i,\n pos: t.index,\n single: isSingle,\n level: thisLevel\n });\n } else if (canClose && isSingle) {\n token.content = replaceAt(token.content, t.index, APOSTROPHE);\n }\n }\n }\n}\n\n\nmodule.exports = function smartquotes(state) {\n /*eslint max-depth:0*/\n var blkIdx;\n\n if (!state.md.options.typographer) { return; }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n\n if (state.tokens[blkIdx].type !== 'inline' ||\n !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {\n continue;\n }\n\n process_inlines(state.tokens[blkIdx].children, state);\n }\n};\n","// Core state object\n//\n'use strict';\n\nvar Token = require('../token');\n\n\nfunction StateCore(src, md, env) {\n this.src = src;\n this.env = env;\n this.tokens = [];\n this.inlineMode = false;\n this.md = md; // link to parser instance\n}\n\n// re-export Token class to use in core rules\nStateCore.prototype.Token = Token;\n\n\nmodule.exports = StateCore;\n","/** internal\n * class ParserBlock\n *\n * Block-level tokenizer.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\nvar _rules = [\n // First 2 params - rule name & source. Secondary array - list of rules,\n // which can be terminated by this one.\n [ 'table', require('./rules_block/table'), [ 'paragraph', 'reference' ] ],\n [ 'code', require('./rules_block/code') ],\n [ 'fence', require('./rules_block/fence'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'blockquote', require('./rules_block/blockquote'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'hr', require('./rules_block/hr'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'list', require('./rules_block/list'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'reference', require('./rules_block/reference') ],\n [ 'heading', require('./rules_block/heading'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'lheading', require('./rules_block/lheading') ],\n [ 'html_block', require('./rules_block/html_block'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'paragraph', require('./rules_block/paragraph') ]\n];\n\n\n/**\n * new ParserBlock()\n **/\nfunction ParserBlock() {\n /**\n * ParserBlock#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of block rules.\n **/\n this.ruler = new Ruler();\n\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });\n }\n}\n\n\n// Generate tokens for input range\n//\nParserBlock.prototype.tokenize = function (state, startLine, endLine) {\n var ok, i,\n rules = this.ruler.getRules(''),\n len = rules.length,\n line = startLine,\n hasEmptyLines = false,\n maxNesting = state.md.options.maxNesting;\n\n while (line < endLine) {\n state.line = line = state.skipEmptyLines(line);\n if (line >= endLine) { break; }\n\n // Termination condition for nested calls.\n // Nested calls currently used for blockquotes & lists\n if (state.sCount[line] < state.blkIndent) { break; }\n\n // If nesting level exceeded - skip tail to the end. That's not ordinary\n // situation and we should not care about content.\n if (state.level >= maxNesting) {\n state.line = endLine;\n break;\n }\n\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.line`\n // - update `state.tokens`\n // - return true\n\n for (i = 0; i < len; i++) {\n ok = rules[i](state, line, endLine, false);\n if (ok) { break; }\n }\n\n // set state.tight if we had an empty line before current tag\n // i.e. latest empty line should not count\n state.tight = !hasEmptyLines;\n\n // paragraph might \"eat\" one newline after it in nested lists\n if (state.isEmpty(state.line - 1)) {\n hasEmptyLines = true;\n }\n\n line = state.line;\n\n if (line < endLine && state.isEmpty(line)) {\n hasEmptyLines = true;\n line++;\n state.line = line;\n }\n }\n};\n\n\n/**\n * ParserBlock.parse(str, md, env, outTokens)\n *\n * Process input string and push block tokens into `outTokens`\n **/\nParserBlock.prototype.parse = function (src, md, env, outTokens) {\n var state;\n\n if (!src) { return; }\n\n state = new this.State(src, md, env, outTokens);\n\n this.tokenize(state, state.line, state.lineMax);\n};\n\n\nParserBlock.prototype.State = require('./rules_block/state_block');\n\n\nmodule.exports = ParserBlock;\n","// GFM table, non-standard\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nfunction getLine(state, line) {\n var pos = state.bMarks[line] + state.blkIndent,\n max = state.eMarks[line];\n\n return state.src.substr(pos, max - pos);\n}\n\nfunction escapedSplit(str) {\n var result = [],\n pos = 0,\n max = str.length,\n ch,\n escapes = 0,\n lastPos = 0,\n backTicked = false,\n lastBackTick = 0;\n\n ch = str.charCodeAt(pos);\n\n while (pos < max) {\n if (ch === 0x60/* ` */) {\n if (backTicked) {\n // make \\` close code sequence, but not open it;\n // the reason is: `\\` is correct code block\n backTicked = false;\n lastBackTick = pos;\n } else if (escapes % 2 === 0) {\n backTicked = true;\n lastBackTick = pos;\n }\n } else if (ch === 0x7c/* | */ && (escapes % 2 === 0) && !backTicked) {\n result.push(str.substring(lastPos, pos));\n lastPos = pos + 1;\n }\n\n if (ch === 0x5c/* \\ */) {\n escapes++;\n } else {\n escapes = 0;\n }\n\n pos++;\n\n // If there was an un-closed backtick, go back to just after\n // the last backtick, but as if it was a normal character\n if (pos === max && backTicked) {\n backTicked = false;\n pos = lastBackTick + 1;\n }\n\n ch = str.charCodeAt(pos);\n }\n\n result.push(str.substring(lastPos));\n\n return result;\n}\n\n\nmodule.exports = function table(state, startLine, endLine, silent) {\n var ch, lineText, pos, i, nextLine, columns, columnCount, token,\n aligns, t, tableLines, tbodyLines;\n\n // should have at least two lines\n if (startLine + 2 > endLine) { return false; }\n\n nextLine = startLine + 1;\n\n if (state.sCount[nextLine] < state.blkIndent) { return false; }\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }\n\n // first character of the second line should be '|', '-', ':',\n // and no other characters are allowed but spaces;\n // basically, this is the equivalent of /^[-:|][-:|\\s]*$/ regexp\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n if (pos >= state.eMarks[nextLine]) { return false; }\n\n ch = state.src.charCodeAt(pos++);\n if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; }\n\n while (pos < state.eMarks[nextLine]) {\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false; }\n\n pos++;\n }\n\n lineText = getLine(state, startLine + 1);\n\n columns = lineText.split('|');\n aligns = [];\n for (i = 0; i < columns.length; i++) {\n t = columns[i].trim();\n if (!t) {\n // allow empty columns before and after table, but not in between columns;\n // e.g. allow ` |---| `, disallow ` ---||--- `\n if (i === 0 || i === columns.length - 1) {\n continue;\n } else {\n return false;\n }\n }\n\n if (!/^:?-+:?$/.test(t)) { return false; }\n if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {\n aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');\n } else if (t.charCodeAt(0) === 0x3A/* : */) {\n aligns.push('left');\n } else {\n aligns.push('');\n }\n }\n\n lineText = getLine(state, startLine).trim();\n if (lineText.indexOf('|') === -1) { return false; }\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n columns = escapedSplit(lineText.replace(/^\\||\\|$/g, ''));\n\n // header row will define an amount of columns in the entire table,\n // and align row shouldn't be smaller than that (the rest of the rows can)\n columnCount = columns.length;\n if (columnCount > aligns.length) { return false; }\n\n if (silent) { return true; }\n\n token = state.push('table_open', 'table', 1);\n token.map = tableLines = [ startLine, 0 ];\n\n token = state.push('thead_open', 'thead', 1);\n token.map = [ startLine, startLine + 1 ];\n\n token = state.push('tr_open', 'tr', 1);\n token.map = [ startLine, startLine + 1 ];\n\n for (i = 0; i < columns.length; i++) {\n token = state.push('th_open', 'th', 1);\n token.map = [ startLine, startLine + 1 ];\n if (aligns[i]) {\n token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];\n }\n\n token = state.push('inline', '', 0);\n token.content = columns[i].trim();\n token.map = [ startLine, startLine + 1 ];\n token.children = [];\n\n token = state.push('th_close', 'th', -1);\n }\n\n token = state.push('tr_close', 'tr', -1);\n token = state.push('thead_close', 'thead', -1);\n\n token = state.push('tbody_open', 'tbody', 1);\n token.map = tbodyLines = [ startLine + 2, 0 ];\n\n for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n lineText = getLine(state, nextLine).trim();\n if (lineText.indexOf('|') === -1) { break; }\n if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }\n columns = escapedSplit(lineText.replace(/^\\||\\|$/g, ''));\n\n token = state.push('tr_open', 'tr', 1);\n for (i = 0; i < columnCount; i++) {\n token = state.push('td_open', 'td', 1);\n if (aligns[i]) {\n token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];\n }\n\n token = state.push('inline', '', 0);\n token.content = columns[i] ? columns[i].trim() : '';\n token.children = [];\n\n token = state.push('td_close', 'td', -1);\n }\n token = state.push('tr_close', 'tr', -1);\n }\n token = state.push('tbody_close', 'tbody', -1);\n token = state.push('table_close', 'table', -1);\n\n tableLines[1] = tbodyLines[1] = nextLine;\n state.line = nextLine;\n return true;\n};\n","// Code block (4 spaces padded)\n\n'use strict';\n\n\nmodule.exports = function code(state, startLine, endLine/*, silent*/) {\n var nextLine, last, token;\n\n if (state.sCount[startLine] - state.blkIndent < 4) { return false; }\n\n last = nextLine = startLine + 1;\n\n while (nextLine < endLine) {\n if (state.isEmpty(nextLine)) {\n nextLine++;\n continue;\n }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n nextLine++;\n last = nextLine;\n continue;\n }\n break;\n }\n\n state.line = last;\n\n token = state.push('code_block', 'code', 0);\n token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);\n token.map = [ startLine, state.line ];\n\n return true;\n};\n","// fences (``` lang, ~~~ lang)\n\n'use strict';\n\n\nmodule.exports = function fence(state, startLine, endLine, silent) {\n var marker, len, params, nextLine, mem, token, markup,\n haveEndMarker = false,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (pos + 3 > max) { return false; }\n\n marker = state.src.charCodeAt(pos);\n\n if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {\n return false;\n }\n\n // scan marker length\n mem = pos;\n pos = state.skipChars(pos, marker);\n\n len = pos - mem;\n\n if (len < 3) { return false; }\n\n markup = state.src.slice(mem, pos);\n params = state.src.slice(pos, max);\n\n if (params.indexOf(String.fromCharCode(marker)) >= 0) { return false; }\n\n // Since start is found, we can report success here in validation mode\n if (silent) { return true; }\n\n // search end of block\n nextLine = startLine;\n\n for (;;) {\n nextLine++;\n if (nextLine >= endLine) {\n // unclosed block should be autoclosed by end of document.\n // also block seems to be autoclosed by end of parent\n break;\n }\n\n pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos < max && state.sCount[nextLine] < state.blkIndent) {\n // non-empty line with negative indent should stop the list:\n // - ```\n // test\n break;\n }\n\n if (state.src.charCodeAt(pos) !== marker) { continue; }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n // closing fence should be indented less than 4 spaces\n continue;\n }\n\n pos = state.skipChars(pos, marker);\n\n // closing code fence must be at least as long as the opening one\n if (pos - mem < len) { continue; }\n\n // make sure tail has spaces only\n pos = state.skipSpaces(pos);\n\n if (pos < max) { continue; }\n\n haveEndMarker = true;\n // found!\n break;\n }\n\n // If a fence has heading spaces, they should be removed from its inner block\n len = state.sCount[startLine];\n\n state.line = nextLine + (haveEndMarker ? 1 : 0);\n\n token = state.push('fence', 'code', 0);\n token.info = params;\n token.content = state.getLines(startLine + 1, nextLine, len, true);\n token.markup = markup;\n token.map = [ startLine, state.line ];\n\n return true;\n};\n","// Block quotes\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function blockquote(state, startLine, endLine, silent) {\n var adjustTab,\n ch,\n i,\n initial,\n l,\n lastLineEmpty,\n lines,\n nextLine,\n offset,\n oldBMarks,\n oldBSCount,\n oldIndent,\n oldParentType,\n oldSCount,\n oldTShift,\n spaceAfterMarker,\n terminate,\n terminatorRules,\n token,\n wasOutdented,\n oldLineMax = state.lineMax,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n // check the block quote marker\n if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }\n\n // we know that it's going to be a valid blockquote,\n // so no point trying to find the end of it in silent mode\n if (silent) { return true; }\n\n // skip spaces after \">\" and re-calculate offset\n initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n spaceAfterMarker = true;\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true;\n\n if ((state.bsCount[startLine] + offset) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true;\n }\n } else {\n spaceAfterMarker = false;\n }\n\n oldBMarks = [ state.bMarks[startLine] ];\n state.bMarks[startLine] = pos;\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;\n } else {\n offset++;\n }\n } else {\n break;\n }\n\n pos++;\n }\n\n oldBSCount = [ state.bsCount[startLine] ];\n state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);\n\n lastLineEmpty = pos >= max;\n\n oldSCount = [ state.sCount[startLine] ];\n state.sCount[startLine] = offset - initial;\n\n oldTShift = [ state.tShift[startLine] ];\n state.tShift[startLine] = pos - state.bMarks[startLine];\n\n terminatorRules = state.md.block.ruler.getRules('blockquote');\n\n oldParentType = state.parentType;\n state.parentType = 'blockquote';\n wasOutdented = false;\n\n // Search the end of the block\n //\n // Block ends with either:\n // 1. an empty line outside:\n // ```\n // > test\n //\n // ```\n // 2. an empty line inside:\n // ```\n // >\n // test\n // ```\n // 3. another tag:\n // ```\n // > test\n // - - -\n // ```\n for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {\n // check if it's outdented, i.e. it's inside list item and indented\n // less than said list item:\n //\n // ```\n // 1. anything\n // > current blockquote\n // 2. checking this line\n // ```\n if (state.sCount[nextLine] < state.blkIndent) wasOutdented = true;\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos >= max) {\n // Case 1: line is not inside the blockquote, and this line is empty.\n break;\n }\n\n if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !wasOutdented) {\n // This line is inside the blockquote.\n\n // skip spaces after \">\" and re-calculate offset\n initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]);\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n spaceAfterMarker = true;\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true;\n\n if ((state.bsCount[nextLine] + offset) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true;\n }\n } else {\n spaceAfterMarker = false;\n }\n\n oldBMarks.push(state.bMarks[nextLine]);\n state.bMarks[nextLine] = pos;\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;\n } else {\n offset++;\n }\n } else {\n break;\n }\n\n pos++;\n }\n\n lastLineEmpty = pos >= max;\n\n oldBSCount.push(state.bsCount[nextLine]);\n state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);\n\n oldSCount.push(state.sCount[nextLine]);\n state.sCount[nextLine] = offset - initial;\n\n oldTShift.push(state.tShift[nextLine]);\n state.tShift[nextLine] = pos - state.bMarks[nextLine];\n continue;\n }\n\n // Case 2: line is not inside the blockquote, and the last line was empty.\n if (lastLineEmpty) { break; }\n\n // Case 3: another tag found.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n\n if (terminate) {\n // Quirk to enforce \"hard termination mode\" for paragraphs;\n // normally if you call `tokenize(state, startLine, nextLine)`,\n // paragraphs will look below nextLine for paragraph continuation,\n // but if blockquote is terminated by another tag, they shouldn't\n state.lineMax = nextLine;\n\n if (state.blkIndent !== 0) {\n // state.blkIndent was non-zero, we now set it to zero,\n // so we need to re-calculate all offsets to appear as\n // if indent wasn't changed\n oldBMarks.push(state.bMarks[nextLine]);\n oldBSCount.push(state.bsCount[nextLine]);\n oldTShift.push(state.tShift[nextLine]);\n oldSCount.push(state.sCount[nextLine]);\n state.sCount[nextLine] -= state.blkIndent;\n }\n\n break;\n }\n\n oldBMarks.push(state.bMarks[nextLine]);\n oldBSCount.push(state.bsCount[nextLine]);\n oldTShift.push(state.tShift[nextLine]);\n oldSCount.push(state.sCount[nextLine]);\n\n // A negative indentation means that this is a paragraph continuation\n //\n state.sCount[nextLine] = -1;\n }\n\n oldIndent = state.blkIndent;\n state.blkIndent = 0;\n\n token = state.push('blockquote_open', 'blockquote', 1);\n token.markup = '>';\n token.map = lines = [ startLine, 0 ];\n\n state.md.block.tokenize(state, startLine, nextLine);\n\n token = state.push('blockquote_close', 'blockquote', -1);\n token.markup = '>';\n\n state.lineMax = oldLineMax;\n state.parentType = oldParentType;\n lines[1] = state.line;\n\n // Restore original tShift; this might not be necessary since the parser\n // has already been here, but just to make sure we can do that.\n for (i = 0; i < oldTShift.length; i++) {\n state.bMarks[i + startLine] = oldBMarks[i];\n state.tShift[i + startLine] = oldTShift[i];\n state.sCount[i + startLine] = oldSCount[i];\n state.bsCount[i + startLine] = oldBSCount[i];\n }\n state.blkIndent = oldIndent;\n\n return true;\n};\n","// Horizontal rule\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function hr(state, startLine, endLine, silent) {\n var marker, cnt, ch, token,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n marker = state.src.charCodeAt(pos++);\n\n // Check hr marker\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x5F/* _ */) {\n return false;\n }\n\n // markers can be mixed with spaces, but there should be at least 3 of them\n\n cnt = 1;\n while (pos < max) {\n ch = state.src.charCodeAt(pos++);\n if (ch !== marker && !isSpace(ch)) { return false; }\n if (ch === marker) { cnt++; }\n }\n\n if (cnt < 3) { return false; }\n\n if (silent) { return true; }\n\n state.line = startLine + 1;\n\n token = state.push('hr', 'hr', 0);\n token.map = [ startLine, state.line ];\n token.markup = Array(cnt + 1).join(String.fromCharCode(marker));\n\n return true;\n};\n","// Lists\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\n// Search `[-+*][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}\n\n// Search `\\d+[.)][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}\n\nfunction markTightParagraphs(state, idx) {\n var i, l,\n level = state.level + 2;\n\n for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {\n if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {\n state.tokens[i + 2].hidden = true;\n state.tokens[i].hidden = true;\n i += 2;\n }\n }\n}\n\n\nmodule.exports = function list(state, startLine, endLine, silent) {\n var ch,\n contentStart,\n i,\n indent,\n indentAfterMarker,\n initial,\n isOrdered,\n itemLines,\n l,\n listLines,\n listTokIdx,\n markerCharCode,\n markerValue,\n max,\n nextLine,\n offset,\n oldIndent,\n oldLIndent,\n oldParentType,\n oldTShift,\n oldTight,\n pos,\n posAfterMarker,\n prevEmptyEnd,\n start,\n terminate,\n terminatorRules,\n token,\n isTerminatingParagraph = false,\n tight = true;\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n // limit conditions when list can interrupt\n // a paragraph (validation mode only)\n if (silent && state.parentType === 'paragraph') {\n // Next list item should still terminate previous list item;\n //\n // This code can fail if plugins use blkIndent as well as lists,\n // but I hope the spec gets fixed long before that happens.\n //\n if (state.tShift[startLine] >= state.blkIndent) {\n isTerminatingParagraph = true;\n }\n }\n\n // Detect list type and position after marker\n if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {\n isOrdered = true;\n start = state.bMarks[startLine] + state.tShift[startLine];\n markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));\n\n // If we're starting a new ordered list right after\n // a paragraph, it should start with 1.\n if (isTerminatingParagraph && markerValue !== 1) return false;\n\n } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {\n isOrdered = false;\n\n } else {\n return false;\n }\n\n // If we're starting a new unordered list right after\n // a paragraph, first line should not be empty.\n if (isTerminatingParagraph) {\n if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;\n }\n\n // We should terminate list on style change. Remember first one to compare.\n markerCharCode = state.src.charCodeAt(posAfterMarker - 1);\n\n // For validation mode we can terminate immediately\n if (silent) { return true; }\n\n // Start list\n listTokIdx = state.tokens.length;\n\n if (isOrdered) {\n token = state.push('ordered_list_open', 'ol', 1);\n if (markerValue !== 1) {\n token.attrs = [ [ 'start', markerValue ] ];\n }\n\n } else {\n token = state.push('bullet_list_open', 'ul', 1);\n }\n\n token.map = listLines = [ startLine, 0 ];\n token.markup = String.fromCharCode(markerCharCode);\n\n //\n // Iterate list items\n //\n\n nextLine = startLine;\n prevEmptyEnd = false;\n terminatorRules = state.md.block.ruler.getRules('list');\n\n oldParentType = state.parentType;\n state.parentType = 'list';\n\n while (nextLine < endLine) {\n pos = posAfterMarker;\n max = state.eMarks[nextLine];\n\n initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine]) % 4;\n } else if (ch === 0x20) {\n offset++;\n } else {\n break;\n }\n\n pos++;\n }\n\n contentStart = pos;\n\n if (contentStart >= max) {\n // trimming space in \"- \\n 3\" case, indent is 1 here\n indentAfterMarker = 1;\n } else {\n indentAfterMarker = offset - initial;\n }\n\n // If we have more than 4 spaces, the indent is 1\n // (the rest is just indented code block)\n if (indentAfterMarker > 4) { indentAfterMarker = 1; }\n\n // \" - test\"\n // ^^^^^ - calculating total length of this thing\n indent = initial + indentAfterMarker;\n\n // Run subparser & write tokens\n token = state.push('list_item_open', 'li', 1);\n token.markup = String.fromCharCode(markerCharCode);\n token.map = itemLines = [ startLine, 0 ];\n\n oldIndent = state.blkIndent;\n oldTight = state.tight;\n oldTShift = state.tShift[startLine];\n oldLIndent = state.sCount[startLine];\n state.blkIndent = indent;\n state.tight = true;\n state.tShift[startLine] = contentStart - state.bMarks[startLine];\n state.sCount[startLine] = offset;\n\n if (contentStart >= max && state.isEmpty(startLine + 1)) {\n // workaround for this case\n // (list item is empty, list terminates before \"foo\"):\n // ~~~~~~~~\n // -\n //\n // foo\n // ~~~~~~~~\n state.line = Math.min(state.line + 2, endLine);\n } else {\n state.md.block.tokenize(state, startLine, endLine, true);\n }\n\n // If any of list item is tight, mark list as tight\n if (!state.tight || prevEmptyEnd) {\n tight = false;\n }\n // Item become loose if finish with empty line,\n // but we should filter last element, because it means list finish\n prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);\n\n state.blkIndent = oldIndent;\n state.tShift[startLine] = oldTShift;\n state.sCount[startLine] = oldLIndent;\n state.tight = oldTight;\n\n token = state.push('list_item_close', 'li', -1);\n token.markup = String.fromCharCode(markerCharCode);\n\n nextLine = startLine = state.line;\n itemLines[1] = nextLine;\n contentStart = state.bMarks[startLine];\n\n if (nextLine >= endLine) { break; }\n\n //\n // Try to check if list is terminated or continued.\n //\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n // fail if terminating block found\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n\n // fail if list has another type\n if (isOrdered) {\n posAfterMarker = skipOrderedListMarker(state, nextLine);\n if (posAfterMarker < 0) { break; }\n } else {\n posAfterMarker = skipBulletListMarker(state, nextLine);\n if (posAfterMarker < 0) { break; }\n }\n\n if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }\n }\n\n // Finalize list\n if (isOrdered) {\n token = state.push('ordered_list_close', 'ol', -1);\n } else {\n token = state.push('bullet_list_close', 'ul', -1);\n }\n token.markup = String.fromCharCode(markerCharCode);\n\n listLines[1] = nextLine;\n state.line = nextLine;\n\n state.parentType = oldParentType;\n\n // mark paragraphs tight if needed\n if (tight) {\n markTightParagraphs(state, listTokIdx);\n }\n\n return true;\n};\n","'use strict';\n\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function reference(state, startLine, _endLine, silent) {\n var ch,\n destEndPos,\n destEndLineNo,\n endLine,\n href,\n i,\n l,\n label,\n labelEnd,\n oldParentType,\n res,\n start,\n str,\n terminate,\n terminatorRules,\n title,\n lines = 0,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine],\n nextLine = startLine + 1;\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }\n\n // Simple check to quickly interrupt scan on [link](url) at the start of line.\n // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54\n while (++pos < max) {\n if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&\n state.src.charCodeAt(pos - 1) !== 0x5C/* \\ */) {\n if (pos + 1 === max) { return false; }\n if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }\n break;\n }\n }\n\n endLine = state.lineMax;\n\n // jump line-by-line until empty one or EOF\n terminatorRules = state.md.block.ruler.getRules('reference');\n\n oldParentType = state.parentType;\n state.parentType = 'reference';\n\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n max = str.length;\n\n for (pos = 1; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x5B /* [ */) {\n return false;\n } else if (ch === 0x5D /* ] */) {\n labelEnd = pos;\n break;\n } else if (ch === 0x0A /* \\n */) {\n lines++;\n } else if (ch === 0x5C /* \\ */) {\n pos++;\n if (pos < max && str.charCodeAt(pos) === 0x0A) {\n lines++;\n }\n }\n }\n\n if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }\n\n // [label]: destination 'title'\n // ^^^ skip optional whitespace here\n for (pos = labelEnd + 2; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x0A) {\n lines++;\n } else if (isSpace(ch)) {\n /*eslint no-empty:0*/\n } else {\n break;\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^^^^^ parse this\n res = state.md.helpers.parseLinkDestination(str, pos, max);\n if (!res.ok) { return false; }\n\n href = state.md.normalizeLink(res.str);\n if (!state.md.validateLink(href)) { return false; }\n\n pos = res.pos;\n lines += res.lines;\n\n // save cursor state, we could require to rollback later\n destEndPos = pos;\n destEndLineNo = lines;\n\n // [label]: destination 'title'\n // ^^^ skipping those spaces\n start = pos;\n for (; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x0A) {\n lines++;\n } else if (isSpace(ch)) {\n /*eslint no-empty:0*/\n } else {\n break;\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^ parse this\n res = state.md.helpers.parseLinkTitle(str, pos, max);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n lines += res.lines;\n } else {\n title = '';\n pos = destEndPos;\n lines = destEndLineNo;\n }\n\n // skip trailing spaces until the rest of the line\n while (pos < max) {\n ch = str.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n if (title) {\n // garbage at the end of the line after title,\n // but it could still be a valid reference if we roll back\n title = '';\n pos = destEndPos;\n lines = destEndLineNo;\n while (pos < max) {\n ch = str.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n }\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n // garbage at the end of the line\n return false;\n }\n\n label = normalizeReference(str.slice(1, labelEnd));\n if (!label) {\n // CommonMark 0.20 disallows empty labels\n return false;\n }\n\n // Reference can not terminate anything. This check is for safety only.\n /*istanbul ignore if*/\n if (silent) { return true; }\n\n if (typeof state.env.references === 'undefined') {\n state.env.references = {};\n }\n if (typeof state.env.references[label] === 'undefined') {\n state.env.references[label] = { title: title, href: href };\n }\n\n state.parentType = oldParentType;\n\n state.line = startLine + lines + 1;\n return true;\n};\n","// heading (#, ##, ...)\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function heading(state, startLine, endLine, silent) {\n var ch, level, tmp, token,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x23/* # */ || pos >= max) { return false; }\n\n // count heading level\n level = 1;\n ch = state.src.charCodeAt(++pos);\n while (ch === 0x23/* # */ && pos < max && level <= 6) {\n level++;\n ch = state.src.charCodeAt(++pos);\n }\n\n if (level > 6 || (pos < max && !isSpace(ch))) { return false; }\n\n if (silent) { return true; }\n\n // Let's cut tails like ' ### ' from the end of string\n\n max = state.skipSpacesBack(max, pos);\n tmp = state.skipCharsBack(max, 0x23, pos); // #\n if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {\n max = tmp;\n }\n\n state.line = startLine + 1;\n\n token = state.push('heading_open', 'h' + String(level), 1);\n token.markup = '########'.slice(0, level);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = state.src.slice(pos, max).trim();\n token.map = [ startLine, state.line ];\n token.children = [];\n\n token = state.push('heading_close', 'h' + String(level), -1);\n token.markup = '########'.slice(0, level);\n\n return true;\n};\n","// lheading (---, ===)\n\n'use strict';\n\n\nmodule.exports = function lheading(state, startLine, endLine/*, silent*/) {\n var content, terminate, i, l, token, pos, max, level, marker,\n nextLine = startLine + 1, oldParentType,\n terminatorRules = state.md.block.ruler.getRules('paragraph');\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n oldParentType = state.parentType;\n state.parentType = 'paragraph'; // use paragraph to match terminatorRules\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n //\n // Check for underline in setext header\n //\n if (state.sCount[nextLine] >= state.blkIndent) {\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos < max) {\n marker = state.src.charCodeAt(pos);\n\n if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {\n pos = state.skipChars(pos, marker);\n pos = state.skipSpaces(pos);\n\n if (pos >= max) {\n level = (marker === 0x3D/* = */ ? 1 : 2);\n break;\n }\n }\n }\n }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n if (!level) {\n // Didn't find valid underline\n return false;\n }\n\n content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n\n state.line = nextLine + 1;\n\n token = state.push('heading_open', 'h' + String(level), 1);\n token.markup = String.fromCharCode(marker);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = content;\n token.map = [ startLine, state.line - 1 ];\n token.children = [];\n\n token = state.push('heading_close', 'h' + String(level), -1);\n token.markup = String.fromCharCode(marker);\n\n state.parentType = oldParentType;\n\n return true;\n};\n","// HTML block\n\n'use strict';\n\n\nvar block_names = require('../common/html_blocks');\nvar HTML_OPEN_CLOSE_TAG_RE = require('../common/html_re').HTML_OPEN_CLOSE_TAG_RE;\n\n// An array of opening and corresponding closing sequences for html tags,\n// last argument defines whether it can terminate a paragraph or not\n//\nvar HTML_SEQUENCES = [\n [ /^<(script|pre|style)(?=(\\s|>|$))/i, /<\\/(script|pre|style)>/i, true ],\n [ /^<!--/, /-->/, true ],\n [ /^<\\?/, /\\?>/, true ],\n [ /^<![A-Z]/, />/, true ],\n [ /^<!\\[CDATA\\[/, /\\]\\]>/, true ],\n [ new RegExp('^</?(' + block_names.join('|') + ')(?=(\\\\s|/?>|$))', 'i'), /^$/, true ],\n [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\\\s*$'), /^$/, false ]\n];\n\n\nmodule.exports = function html_block(state, startLine, endLine, silent) {\n var i, nextLine, token, lineText,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (!state.md.options.html) { return false; }\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }\n\n lineText = state.src.slice(pos, max);\n\n for (i = 0; i < HTML_SEQUENCES.length; i++) {\n if (HTML_SEQUENCES[i][0].test(lineText)) { break; }\n }\n\n if (i === HTML_SEQUENCES.length) { return false; }\n\n if (silent) {\n // true if this sequence can be a terminator, false otherwise\n return HTML_SEQUENCES[i][2];\n }\n\n nextLine = startLine + 1;\n\n // If we are here - we detected HTML block.\n // Let's roll down till block end.\n if (!HTML_SEQUENCES[i][1].test(lineText)) {\n for (; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n lineText = state.src.slice(pos, max);\n\n if (HTML_SEQUENCES[i][1].test(lineText)) {\n if (lineText.length !== 0) { nextLine++; }\n break;\n }\n }\n }\n\n state.line = nextLine;\n\n token = state.push('html_block', '', 0);\n token.map = [ startLine, nextLine ];\n token.content = state.getLines(startLine, nextLine, state.blkIndent, true);\n\n return true;\n};\n","// List of valid html blocks names, accorting to commonmark spec\n// http://jgm.github.io/CommonMark/spec.html#html-blocks\n\n'use strict';\n\n\nmodule.exports = [\n 'address',\n 'article',\n 'aside',\n 'base',\n 'basefont',\n 'blockquote',\n 'body',\n 'caption',\n 'center',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'frame',\n 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'iframe',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'menu',\n 'menuitem',\n 'meta',\n 'nav',\n 'noframes',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'param',\n 'section',\n 'source',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'track',\n 'ul'\n];\n","// Paragraph\n\n'use strict';\n\n\nmodule.exports = function paragraph(state, startLine/*, endLine*/) {\n var content, terminate, i, l, token, oldParentType,\n nextLine = startLine + 1,\n terminatorRules = state.md.block.ruler.getRules('paragraph'),\n endLine = state.lineMax;\n\n oldParentType = state.parentType;\n state.parentType = 'paragraph';\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n\n state.line = nextLine;\n\n token = state.push('paragraph_open', 'p', 1);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = content;\n token.map = [ startLine, state.line ];\n token.children = [];\n\n token = state.push('paragraph_close', 'p', -1);\n\n state.parentType = oldParentType;\n\n return true;\n};\n","// Parser state class\n\n'use strict';\n\nvar Token = require('../token');\nvar isSpace = require('../common/utils').isSpace;\n\n\nfunction StateBlock(src, md, env, tokens) {\n var ch, s, start, pos, len, indent, offset, indent_found;\n\n this.src = src;\n\n // link to parser instance\n this.md = md;\n\n this.env = env;\n\n //\n // Internal state vartiables\n //\n\n this.tokens = tokens;\n\n this.bMarks = []; // line begin offsets for fast jumps\n this.eMarks = []; // line end offsets for fast jumps\n this.tShift = []; // offsets of the first non-space characters (tabs not expanded)\n this.sCount = []; // indents for each line (tabs expanded)\n\n // An amount of virtual spaces (tabs expanded) between beginning\n // of each line (bMarks) and real beginning of that line.\n //\n // It exists only as a hack because blockquotes override bMarks\n // losing information in the process.\n //\n // It's used only when expanding tabs, you can think about it as\n // an initial tab length, e.g. bsCount=21 applied to string `\\t123`\n // means first tab should be expanded to 4-21%4 === 3 spaces.\n //\n this.bsCount = [];\n\n // block parser variables\n this.blkIndent = 0; // required block content indent\n // (for example, if we are in list)\n this.line = 0; // line index in src\n this.lineMax = 0; // lines count\n this.tight = false; // loose/tight mode for lists\n this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)\n\n // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'\n // used in lists to determine if they interrupt a paragraph\n this.parentType = 'root';\n\n this.level = 0;\n\n // renderer\n this.result = '';\n\n // Create caches\n // Generate markers.\n s = this.src;\n indent_found = false;\n\n for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {\n ch = s.charCodeAt(pos);\n\n if (!indent_found) {\n if (isSpace(ch)) {\n indent++;\n\n if (ch === 0x09) {\n offset += 4 - offset % 4;\n } else {\n offset++;\n }\n continue;\n } else {\n indent_found = true;\n }\n }\n\n if (ch === 0x0A || pos === len - 1) {\n if (ch !== 0x0A) { pos++; }\n this.bMarks.push(start);\n this.eMarks.push(pos);\n this.tShift.push(indent);\n this.sCount.push(offset);\n this.bsCount.push(0);\n\n indent_found = false;\n indent = 0;\n offset = 0;\n start = pos + 1;\n }\n }\n\n // Push fake entry to simplify cache bounds checks\n this.bMarks.push(s.length);\n this.eMarks.push(s.length);\n this.tShift.push(0);\n this.sCount.push(0);\n this.bsCount.push(0);\n\n this.lineMax = this.bMarks.length - 1; // don't count last fake line\n}\n\n// Push new token to \"stream\".\n//\nStateBlock.prototype.push = function (type, tag, nesting) {\n var token = new Token(type, tag, nesting);\n token.block = true;\n\n if (nesting < 0) { this.level--; }\n token.level = this.level;\n if (nesting > 0) { this.level++; }\n\n this.tokens.push(token);\n return token;\n};\n\nStateBlock.prototype.isEmpty = function isEmpty(line) {\n return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];\n};\n\nStateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {\n for (var max = this.lineMax; from < max; from++) {\n if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {\n break;\n }\n }\n return from;\n};\n\n// Skip spaces from given position.\nStateBlock.prototype.skipSpaces = function skipSpaces(pos) {\n var ch;\n\n for (var max = this.src.length; pos < max; pos++) {\n ch = this.src.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n }\n return pos;\n};\n\n// Skip spaces from given position in reverse.\nStateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {\n if (pos <= min) { return pos; }\n\n while (pos > min) {\n if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }\n }\n return pos;\n};\n\n// Skip char codes from given position\nStateBlock.prototype.skipChars = function skipChars(pos, code) {\n for (var max = this.src.length; pos < max; pos++) {\n if (this.src.charCodeAt(pos) !== code) { break; }\n }\n return pos;\n};\n\n// Skip char codes reverse from given position - 1\nStateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {\n if (pos <= min) { return pos; }\n\n while (pos > min) {\n if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }\n }\n return pos;\n};\n\n// cut lines range from source.\nStateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {\n var i, lineIndent, ch, first, last, queue, lineStart,\n line = begin;\n\n if (begin >= end) {\n return '';\n }\n\n queue = new Array(end - begin);\n\n for (i = 0; line < end; line++, i++) {\n lineIndent = 0;\n lineStart = first = this.bMarks[line];\n\n if (line + 1 < end || keepLastLF) {\n // No need for bounds check because we have fake entry on tail.\n last = this.eMarks[line] + 1;\n } else {\n last = this.eMarks[line];\n }\n\n while (first < last && lineIndent < indent) {\n ch = this.src.charCodeAt(first);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;\n } else {\n lineIndent++;\n }\n } else if (first - lineStart < this.tShift[line]) {\n // patched tShift masked characters to look like spaces (blockquotes, list markers)\n lineIndent++;\n } else {\n break;\n }\n\n first++;\n }\n\n if (lineIndent > indent) {\n // partially expanding tabs in code blocks, e.g '\\t\\tfoobar'\n // with indent=2 becomes ' \\tfoobar'\n queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);\n } else {\n queue[i] = this.src.slice(first, last);\n }\n }\n\n return queue.join('');\n};\n\n// re-export Token class to use in block rules\nStateBlock.prototype.Token = Token;\n\n\nmodule.exports = StateBlock;\n","/** internal\n * class ParserInline\n *\n * Tokenizes paragraph content.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Parser rules\n\nvar _rules = [\n [ 'text', require('./rules_inline/text') ],\n [ 'newline', require('./rules_inline/newline') ],\n [ 'escape', require('./rules_inline/escape') ],\n [ 'backticks', require('./rules_inline/backticks') ],\n [ 'strikethrough', require('./rules_inline/strikethrough').tokenize ],\n [ 'emphasis', require('./rules_inline/emphasis').tokenize ],\n [ 'link', require('./rules_inline/link') ],\n [ 'image', require('./rules_inline/image') ],\n [ 'autolink', require('./rules_inline/autolink') ],\n [ 'html_inline', require('./rules_inline/html_inline') ],\n [ 'entity', require('./rules_inline/entity') ]\n];\n\nvar _rules2 = [\n [ 'balance_pairs', require('./rules_inline/balance_pairs') ],\n [ 'strikethrough', require('./rules_inline/strikethrough').postProcess ],\n [ 'emphasis', require('./rules_inline/emphasis').postProcess ],\n [ 'text_collapse', require('./rules_inline/text_collapse') ]\n];\n\n\n/**\n * new ParserInline()\n **/\nfunction ParserInline() {\n var i;\n\n /**\n * ParserInline#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of inline rules.\n **/\n this.ruler = new Ruler();\n\n for (i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n\n /**\n * ParserInline#ruler2 -> Ruler\n *\n * [[Ruler]] instance. Second ruler used for post-processing\n * (e.g. in emphasis-like rules).\n **/\n this.ruler2 = new Ruler();\n\n for (i = 0; i < _rules2.length; i++) {\n this.ruler2.push(_rules2[i][0], _rules2[i][1]);\n }\n}\n\n\n// Skip single token by running all rules in validation mode;\n// returns `true` if any rule reported success\n//\nParserInline.prototype.skipToken = function (state) {\n var ok, i, pos = state.pos,\n rules = this.ruler.getRules(''),\n len = rules.length,\n maxNesting = state.md.options.maxNesting,\n cache = state.cache;\n\n\n if (typeof cache[pos] !== 'undefined') {\n state.pos = cache[pos];\n return;\n }\n\n if (state.level < maxNesting) {\n for (i = 0; i < len; i++) {\n // Increment state.level and decrement it later to limit recursion.\n // It's harmless to do here, because no tokens are created. But ideally,\n // we'd need a separate private state variable for this purpose.\n //\n state.level++;\n ok = rules[i](state, true);\n state.level--;\n\n if (ok) { break; }\n }\n } else {\n // Too much nesting, just skip until the end of the paragraph.\n //\n // NOTE: this will cause links to behave incorrectly in the following case,\n // when an amount of `[` is exactly equal to `maxNesting + 1`:\n //\n // [[[[[[[[[[[[[[[[[[[[[foo]()\n //\n // TODO: remove this workaround when CM standard will allow nested links\n // (we can replace it by preventing links from being parsed in\n // validation mode)\n //\n state.pos = state.posMax;\n }\n\n if (!ok) { state.pos++; }\n cache[pos] = state.pos;\n};\n\n\n// Generate tokens for input range\n//\nParserInline.prototype.tokenize = function (state) {\n var ok, i,\n rules = this.ruler.getRules(''),\n len = rules.length,\n end = state.posMax,\n maxNesting = state.md.options.maxNesting;\n\n while (state.pos < end) {\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.pos`\n // - update `state.tokens`\n // - return true\n\n if (state.level < maxNesting) {\n for (i = 0; i < len; i++) {\n ok = rules[i](state, false);\n if (ok) { break; }\n }\n }\n\n if (ok) {\n if (state.pos >= end) { break; }\n continue;\n }\n\n state.pending += state.src[state.pos++];\n }\n\n if (state.pending) {\n state.pushPending();\n }\n};\n\n\n/**\n * ParserInline.parse(str, md, env, outTokens)\n *\n * Process input string and push inline tokens into `outTokens`\n **/\nParserInline.prototype.parse = function (str, md, env, outTokens) {\n var i, rules, len;\n var state = new this.State(str, md, env, outTokens);\n\n this.tokenize(state);\n\n rules = this.ruler2.getRules('');\n len = rules.length;\n\n for (i = 0; i < len; i++) {\n rules[i](state);\n }\n};\n\n\nParserInline.prototype.State = require('./rules_inline/state_inline');\n\n\nmodule.exports = ParserInline;\n","// Skip text characters for text token, place those to pending buffer\n// and increment current pos\n\n'use strict';\n\n\n// Rule to skip pure text\n// '{}$%@~+=:' reserved for extentions\n\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n\n// !!!! Don't confuse with \"Markdown ASCII Punctuation\" chars\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\nfunction isTerminatorChar(ch) {\n switch (ch) {\n case 0x0A/* \\n */:\n case 0x21/* ! */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2D/* - */:\n case 0x3A/* : */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true;\n default:\n return false;\n }\n}\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos;\n\n while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {\n pos++;\n }\n\n if (pos === state.pos) { return false; }\n\n if (!silent) { state.pending += state.src.slice(state.pos, pos); }\n\n state.pos = pos;\n\n return true;\n};\n\n// Alternative implementation, for memory.\n//\n// It costs 10% of performance, but allows extend terminators list, if place it\n// to `ParcerInline` property. Probably, will switch to it sometime, such\n// flexibility required.\n\n/*\nvar TERMINATOR_RE = /[\\n!#$%&*+\\-:<=>@[\\\\\\]^_`{}~]/;\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos,\n idx = state.src.slice(pos).search(TERMINATOR_RE);\n\n // first char is terminator -> empty text\n if (idx === 0) { return false; }\n\n // no terminator -> text till end of string\n if (idx < 0) {\n if (!silent) { state.pending += state.src.slice(pos); }\n state.pos = state.src.length;\n return true;\n }\n\n if (!silent) { state.pending += state.src.slice(pos, pos + idx); }\n\n state.pos += idx;\n\n return true;\n};*/\n","// Proceess '\\n'\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function newline(state, silent) {\n var pmax, max, pos = state.pos;\n\n if (state.src.charCodeAt(pos) !== 0x0A/* \\n */) { return false; }\n\n pmax = state.pending.length - 1;\n max = state.posMax;\n\n // ' \\n' -> hardbreak\n // Lookup in pending chars is bad practice! Don't copy to other rules!\n // Pending string is stored in concat mode, indexed lookups will cause\n // convertion to flat mode.\n if (!silent) {\n if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {\n if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {\n state.pending = state.pending.replace(/ +$/, '');\n state.push('hardbreak', 'br', 0);\n } else {\n state.pending = state.pending.slice(0, -1);\n state.push('softbreak', 'br', 0);\n }\n\n } else {\n state.push('softbreak', 'br', 0);\n }\n }\n\n pos++;\n\n // skip heading spaces for next line\n while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }\n\n state.pos = pos;\n return true;\n};\n","// Process escaped chars and hardbreaks\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\nvar ESCAPED = [];\n\nfor (var i = 0; i < 256; i++) { ESCAPED.push(0); }\n\n'\\\\!\"#$%&\\'()*+,./:;<=>?@[]^_`{|}~-'\n .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });\n\n\nmodule.exports = function escape(state, silent) {\n var ch, pos = state.pos, max = state.posMax;\n\n if (state.src.charCodeAt(pos) !== 0x5C/* \\ */) { return false; }\n\n pos++;\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (ch < 256 && ESCAPED[ch] !== 0) {\n if (!silent) { state.pending += state.src[pos]; }\n state.pos += 2;\n return true;\n }\n\n if (ch === 0x0A) {\n if (!silent) {\n state.push('hardbreak', 'br', 0);\n }\n\n pos++;\n // skip leading whitespaces from next line\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n\n state.pos = pos;\n return true;\n }\n }\n\n if (!silent) { state.pending += '\\\\'; }\n state.pos++;\n return true;\n};\n","// Parse backticks\n\n'use strict';\n\nmodule.exports = function backtick(state, silent) {\n var start, max, marker, matchStart, matchEnd, token,\n pos = state.pos,\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x60/* ` */) { return false; }\n\n start = pos;\n pos++;\n max = state.posMax;\n\n while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }\n\n marker = state.src.slice(start, pos);\n\n matchStart = matchEnd = pos;\n\n while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {\n matchEnd = matchStart + 1;\n\n while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }\n\n if (matchEnd - matchStart === marker.length) {\n if (!silent) {\n token = state.push('code_inline', 'code', 0);\n token.markup = marker;\n token.content = state.src.slice(pos, matchStart)\n .replace(/[ \\n]+/g, ' ')\n .trim();\n }\n state.pos = matchEnd;\n return true;\n }\n }\n\n if (!silent) { state.pending += marker; }\n state.pos += marker.length;\n return true;\n};\n","// Process [link](<to> \"stuff\")\n\n'use strict';\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function link(state, silent) {\n var attrs,\n code,\n label,\n labelEnd,\n labelStart,\n pos,\n res,\n ref,\n title,\n token,\n href = '',\n oldPos = state.pos,\n max = state.posMax,\n start = state.pos,\n parseReference = true;\n\n if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }\n\n labelStart = state.pos + 1;\n labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false; }\n\n pos = labelEnd + 1;\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // might have found a valid shortcut link, disable reference parsing\n parseReference = false;\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n pos++;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n if (pos >= max) { return false; }\n\n // [link]( <href> \"title\" )\n // ^^^^^^ parsing link destination\n start = pos;\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n if (res.ok) {\n href = state.md.normalizeLink(res.str);\n if (state.md.validateLink(href)) {\n pos = res.pos;\n } else {\n href = '';\n }\n }\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n start = pos;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n\n // [link]( <href> \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n } else {\n title = '';\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n // parsing a valid shortcut link failed, fallback to reference\n parseReference = true;\n }\n pos++;\n }\n\n if (parseReference) {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false; }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1;\n pos = state.md.helpers.parseLinkLabel(state, pos);\n if (pos >= 0) {\n label = state.src.slice(start, pos++);\n } else {\n pos = labelEnd + 1;\n }\n } else {\n pos = labelEnd + 1;\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd); }\n\n ref = state.env.references[normalizeReference(label)];\n if (!ref) {\n state.pos = oldPos;\n return false;\n }\n href = ref.href;\n title = ref.title;\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n state.pos = labelStart;\n state.posMax = labelEnd;\n\n token = state.push('link_open', 'a', 1);\n token.attrs = attrs = [ [ 'href', href ] ];\n if (title) {\n attrs.push([ 'title', title ]);\n }\n\n state.md.inline.tokenize(state);\n\n token = state.push('link_close', 'a', -1);\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n};\n","// Process ![image](<src> \"title\")\n\n'use strict';\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function image(state, silent) {\n var attrs,\n code,\n content,\n label,\n labelEnd,\n labelStart,\n pos,\n ref,\n res,\n title,\n token,\n tokens,\n start,\n href = '',\n oldPos = state.pos,\n max = state.posMax;\n\n if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }\n if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }\n\n labelStart = state.pos + 2;\n labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false; }\n\n pos = labelEnd + 1;\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n pos++;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n if (pos >= max) { return false; }\n\n // [link]( <href> \"title\" )\n // ^^^^^^ parsing link destination\n start = pos;\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n if (res.ok) {\n href = state.md.normalizeLink(res.str);\n if (state.md.validateLink(href)) {\n pos = res.pos;\n } else {\n href = '';\n }\n }\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n start = pos;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n\n // [link]( <href> \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n } else {\n title = '';\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n state.pos = oldPos;\n return false;\n }\n pos++;\n } else {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false; }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1;\n pos = state.md.helpers.parseLinkLabel(state, pos);\n if (pos >= 0) {\n label = state.src.slice(start, pos++);\n } else {\n pos = labelEnd + 1;\n }\n } else {\n pos = labelEnd + 1;\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd); }\n\n ref = state.env.references[normalizeReference(label)];\n if (!ref) {\n state.pos = oldPos;\n return false;\n }\n href = ref.href;\n title = ref.title;\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n content = state.src.slice(labelStart, labelEnd);\n\n state.md.inline.parse(\n content,\n state.md,\n state.env,\n tokens = []\n );\n\n token = state.push('image', 'img', 0);\n token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];\n token.children = tokens;\n token.content = content;\n\n if (title) {\n attrs.push([ 'title', title ]);\n }\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n};\n","// Process autolinks '<protocol:...>'\n\n'use strict';\n\n\n/*eslint max-len:0*/\nvar EMAIL_RE = /^<([a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/;\nvar AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\\-]{1,31}):([^<>\\x00-\\x20]*)>/;\n\n\nmodule.exports = function autolink(state, silent) {\n var tail, linkMatch, emailMatch, url, fullUrl, token,\n pos = state.pos;\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }\n\n tail = state.src.slice(pos);\n\n if (tail.indexOf('>') < 0) { return false; }\n\n if (AUTOLINK_RE.test(tail)) {\n linkMatch = tail.match(AUTOLINK_RE);\n\n url = linkMatch[0].slice(1, -1);\n fullUrl = state.md.normalizeLink(url);\n if (!state.md.validateLink(fullUrl)) { return false; }\n\n if (!silent) {\n token = state.push('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.markup = 'autolink';\n token.info = 'auto';\n\n token = state.push('text', '', 0);\n token.content = state.md.normalizeLinkText(url);\n\n token = state.push('link_close', 'a', -1);\n token.markup = 'autolink';\n token.info = 'auto';\n }\n\n state.pos += linkMatch[0].length;\n return true;\n }\n\n if (EMAIL_RE.test(tail)) {\n emailMatch = tail.match(EMAIL_RE);\n\n url = emailMatch[0].slice(1, -1);\n fullUrl = state.md.normalizeLink('mailto:' + url);\n if (!state.md.validateLink(fullUrl)) { return false; }\n\n if (!silent) {\n token = state.push('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.markup = 'autolink';\n token.info = 'auto';\n\n token = state.push('text', '', 0);\n token.content = state.md.normalizeLinkText(url);\n\n token = state.push('link_close', 'a', -1);\n token.markup = 'autolink';\n token.info = 'auto';\n }\n\n state.pos += emailMatch[0].length;\n return true;\n }\n\n return false;\n};\n","// Process html tags\n\n'use strict';\n\n\nvar HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;\n\n\nfunction isLetter(ch) {\n /*eslint no-bitwise:0*/\n var lc = ch | 0x20; // to lower case\n return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);\n}\n\n\nmodule.exports = function html_inline(state, silent) {\n var ch, match, max, token,\n pos = state.pos;\n\n if (!state.md.options.html) { return false; }\n\n // Check start\n max = state.posMax;\n if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||\n pos + 2 >= max) {\n return false;\n }\n\n // Quick fail on second char\n ch = state.src.charCodeAt(pos + 1);\n if (ch !== 0x21/* ! */ &&\n ch !== 0x3F/* ? */ &&\n ch !== 0x2F/* / */ &&\n !isLetter(ch)) {\n return false;\n }\n\n match = state.src.slice(pos).match(HTML_TAG_RE);\n if (!match) { return false; }\n\n if (!silent) {\n token = state.push('html_inline', '', 0);\n token.content = state.src.slice(pos, pos + match[0].length);\n }\n state.pos += match[0].length;\n return true;\n};\n","// Process html entity - {, ¯, ", ...\n\n'use strict';\n\nvar entities = require('../common/entities');\nvar has = require('../common/utils').has;\nvar isValidEntityCode = require('../common/utils').isValidEntityCode;\nvar fromCodePoint = require('../common/utils').fromCodePoint;\n\n\nvar DIGITAL_RE = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;\nvar NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;\n\n\nmodule.exports = function entity(state, silent) {\n var ch, code, match, pos = state.pos, max = state.posMax;\n\n if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }\n\n if (pos + 1 < max) {\n ch = state.src.charCodeAt(pos + 1);\n\n if (ch === 0x23 /* # */) {\n match = state.src.slice(pos).match(DIGITAL_RE);\n if (match) {\n if (!silent) {\n code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);\n state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);\n }\n state.pos += match[0].length;\n return true;\n }\n } else {\n match = state.src.slice(pos).match(NAMED_RE);\n if (match) {\n if (has(entities, match[1])) {\n if (!silent) { state.pending += entities[match[1]]; }\n state.pos += match[0].length;\n return true;\n }\n }\n }\n }\n\n if (!silent) { state.pending += '&'; }\n state.pos++;\n return true;\n};\n","// For each opening emphasis-like marker find a matching closing one\n//\n'use strict';\n\n\nmodule.exports = function link_pairs(state) {\n var i, j, lastDelim, currDelim,\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = 0; i < max; i++) {\n lastDelim = delimiters[i];\n\n if (!lastDelim.close) { continue; }\n\n j = i - lastDelim.jump - 1;\n\n while (j >= 0) {\n currDelim = delimiters[j];\n\n if (currDelim.open &&\n currDelim.marker === lastDelim.marker &&\n currDelim.end < 0 &&\n currDelim.level === lastDelim.level) {\n\n // typeofs are for backward compatibility with plugins\n var odd_match = (currDelim.close || lastDelim.open) &&\n typeof currDelim.length !== 'undefined' &&\n typeof lastDelim.length !== 'undefined' &&\n (currDelim.length + lastDelim.length) % 3 === 0;\n\n if (!odd_match) {\n lastDelim.jump = i - j;\n lastDelim.open = false;\n currDelim.end = i;\n currDelim.jump = 0;\n break;\n }\n }\n\n j -= currDelim.jump + 1;\n }\n }\n};\n","// Merge adjacent text nodes into one, and re-calculate all token levels\n//\n'use strict';\n\n\nmodule.exports = function text_collapse(state) {\n var curr, last,\n level = 0,\n tokens = state.tokens,\n max = state.tokens.length;\n\n for (curr = last = 0; curr < max; curr++) {\n // re-calculate levels\n level += tokens[curr].nesting;\n tokens[curr].level = level;\n\n if (tokens[curr].type === 'text' &&\n curr + 1 < max &&\n tokens[curr + 1].type === 'text') {\n\n // collapse two adjacent text nodes\n tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;\n } else {\n if (curr !== last) { tokens[last] = tokens[curr]; }\n\n last++;\n }\n }\n\n if (curr !== last) {\n tokens.length = last;\n }\n};\n","// Inline parser state\n\n'use strict';\n\n\nvar Token = require('../token');\nvar isWhiteSpace = require('../common/utils').isWhiteSpace;\nvar isPunctChar = require('../common/utils').isPunctChar;\nvar isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;\n\n\nfunction StateInline(src, md, env, outTokens) {\n this.src = src;\n this.env = env;\n this.md = md;\n this.tokens = outTokens;\n\n this.pos = 0;\n this.posMax = this.src.length;\n this.level = 0;\n this.pending = '';\n this.pendingLevel = 0;\n\n this.cache = {}; // Stores { start: end } pairs. Useful for backtrack\n // optimization of pairs parse (emphasis, strikes).\n\n this.delimiters = []; // Emphasis-like delimiters\n}\n\n\n// Flush pending text\n//\nStateInline.prototype.pushPending = function () {\n var token = new Token('text', '', 0);\n token.content = this.pending;\n token.level = this.pendingLevel;\n this.tokens.push(token);\n this.pending = '';\n return token;\n};\n\n\n// Push new token to \"stream\".\n// If pending text exists - flush it as text token\n//\nStateInline.prototype.push = function (type, tag, nesting) {\n if (this.pending) {\n this.pushPending();\n }\n\n var token = new Token(type, tag, nesting);\n\n if (nesting < 0) { this.level--; }\n token.level = this.level;\n if (nesting > 0) { this.level++; }\n\n this.pendingLevel = this.level;\n this.tokens.push(token);\n return token;\n};\n\n\n// Scan a sequence of emphasis-like markers, and determine whether\n// it can start an emphasis sequence or end an emphasis sequence.\n//\n// - start - position to scan from (it should point at a valid marker);\n// - canSplitWord - determine if these markers can be found inside a word\n//\nStateInline.prototype.scanDelims = function (start, canSplitWord) {\n var pos = start, lastChar, nextChar, count, can_open, can_close,\n isLastWhiteSpace, isLastPunctChar,\n isNextWhiteSpace, isNextPunctChar,\n left_flanking = true,\n right_flanking = true,\n max = this.posMax,\n marker = this.src.charCodeAt(start);\n\n // treat beginning of the line as a whitespace\n lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;\n\n while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }\n\n count = pos - start;\n\n // treat end of the line as a whitespace\n nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;\n\n isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));\n isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));\n\n isLastWhiteSpace = isWhiteSpace(lastChar);\n isNextWhiteSpace = isWhiteSpace(nextChar);\n\n if (isNextWhiteSpace) {\n left_flanking = false;\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n left_flanking = false;\n }\n }\n\n if (isLastWhiteSpace) {\n right_flanking = false;\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n right_flanking = false;\n }\n }\n\n if (!canSplitWord) {\n can_open = left_flanking && (!right_flanking || isLastPunctChar);\n can_close = right_flanking && (!left_flanking || isNextPunctChar);\n } else {\n can_open = left_flanking;\n can_close = right_flanking;\n }\n\n return {\n can_open: can_open,\n can_close: can_close,\n length: count\n };\n};\n\n\n// re-export Token class to use in block rules\nStateInline.prototype.Token = Token;\n\n\nmodule.exports = StateInline;\n","'use strict';\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Helpers\n\n// Merge objects\n//\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n sources.forEach(function (source) {\n if (!source) { return; }\n\n Object.keys(source).forEach(function (key) {\n obj[key] = source[key];\n });\n });\n\n return obj;\n}\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\nfunction isString(obj) { return _class(obj) === '[object String]'; }\nfunction isObject(obj) { return _class(obj) === '[object Object]'; }\nfunction isRegExp(obj) { return _class(obj) === '[object RegExp]'; }\nfunction isFunction(obj) { return _class(obj) === '[object Function]'; }\n\n\nfunction escapeRE(str) { return str.replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&'); }\n\n////////////////////////////////////////////////////////////////////////////////\n\n\nvar defaultOptions = {\n fuzzyLink: true,\n fuzzyEmail: true,\n fuzzyIP: false\n};\n\n\nfunction isOptionsObj(obj) {\n return Object.keys(obj || {}).reduce(function (acc, k) {\n return acc || defaultOptions.hasOwnProperty(k);\n }, false);\n}\n\n\nvar defaultSchemas = {\n 'http:': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.http) {\n // compile lazily, because \"host\"-containing variables can change on tlds update.\n self.re.http = new RegExp(\n '^\\\\/\\\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'\n );\n }\n if (self.re.http.test(tail)) {\n return tail.match(self.re.http)[0].length;\n }\n return 0;\n }\n },\n 'https:': 'http:',\n 'ftp:': 'http:',\n '//': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.no_http) {\n // compile lazily, because \"host\"-containing variables can change on tlds update.\n self.re.no_http = new RegExp(\n '^' +\n self.re.src_auth +\n // Don't allow single-level domains, because of false positives like '//test'\n // with code comments\n '(?:localhost|(?:(?:' + self.re.src_domain + ')\\\\.)+' + self.re.src_domain_root + ')' +\n self.re.src_port +\n self.re.src_host_terminator +\n self.re.src_path,\n\n 'i'\n );\n }\n\n if (self.re.no_http.test(tail)) {\n // should not be `://` & `///`, that protects from errors in protocol name\n if (pos >= 3 && text[pos - 3] === ':') { return 0; }\n if (pos >= 3 && text[pos - 3] === '/') { return 0; }\n return tail.match(self.re.no_http)[0].length;\n }\n return 0;\n }\n },\n 'mailto:': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.mailto) {\n self.re.mailto = new RegExp(\n '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'\n );\n }\n if (self.re.mailto.test(tail)) {\n return tail.match(self.re.mailto)[0].length;\n }\n return 0;\n }\n }\n};\n\n/*eslint-disable max-len*/\n\n// RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)\nvar tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';\n\n// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead\nvar tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');\n\n/*eslint-enable max-len*/\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction resetScanCache(self) {\n self.__index__ = -1;\n self.__text_cache__ = '';\n}\n\nfunction createValidator(re) {\n return function (text, pos) {\n var tail = text.slice(pos);\n\n if (re.test(tail)) {\n return tail.match(re)[0].length;\n }\n return 0;\n };\n}\n\nfunction createNormalizer() {\n return function (match, self) {\n self.normalize(match);\n };\n}\n\n// Schemas compiler. Build regexps.\n//\nfunction compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = require('./lib/re')(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',\n 'i'\n );\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}\n\n/**\n * class Match\n *\n * Match result. Single element of array, returned by [[LinkifyIt#match]]\n **/\nfunction Match(self, shift) {\n var start = self.__index__,\n end = self.__last_index__,\n text = self.__text_cache__.slice(start, end);\n\n /**\n * Match#schema -> String\n *\n * Prefix (protocol) for matched string.\n **/\n this.schema = self.__schema__.toLowerCase();\n /**\n * Match#index -> Number\n *\n * First position of matched string.\n **/\n this.index = start + shift;\n /**\n * Match#lastIndex -> Number\n *\n * Next position after matched string.\n **/\n this.lastIndex = end + shift;\n /**\n * Match#raw -> String\n *\n * Matched string.\n **/\n this.raw = text;\n /**\n * Match#text -> String\n *\n * Notmalized text of matched string.\n **/\n this.text = text;\n /**\n * Match#url -> String\n *\n * Normalized url of matched string.\n **/\n this.url = text;\n}\n\nfunction createMatch(self, shift) {\n var match = new Match(self, shift);\n\n self.__compiled__[match.schema].normalize(match, self);\n\n return match;\n}\n\n\n/**\n * class LinkifyIt\n **/\n\n/**\n * new LinkifyIt(schemas, options)\n * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)\n * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }\n *\n * Creates new linkifier instance with optional additional schemas.\n * Can be called without `new` keyword for convenience.\n *\n * By default understands:\n *\n * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links\n * - \"fuzzy\" links and emails (example.com, foo@bar.com).\n *\n * `schemas` is an object, where each key/value describes protocol/rule:\n *\n * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`\n * for example). `linkify-it` makes shure that prefix is not preceeded with\n * alphanumeric char and symbols. Only whitespaces and punctuation allowed.\n * - __value__ - rule to check tail after link prefix\n * - _String_ - just alias to existing rule\n * - _Object_\n * - _validate_ - validator function (should return matched length on success),\n * or `RegExp`.\n * - _normalize_ - optional function to normalize text & url of matched result\n * (for example, for @twitter mentions).\n *\n * `options`:\n *\n * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.\n * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts\n * like version numbers. Default `false`.\n * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.\n *\n **/\nfunction LinkifyIt(schemas, options) {\n if (!(this instanceof LinkifyIt)) {\n return new LinkifyIt(schemas, options);\n }\n\n if (!options) {\n if (isOptionsObj(schemas)) {\n options = schemas;\n schemas = {};\n }\n }\n\n this.__opts__ = assign({}, defaultOptions, options);\n\n // Cache last tested result. Used to skip repeating steps on next `match` call.\n this.__index__ = -1;\n this.__last_index__ = -1; // Next scan position\n this.__schema__ = '';\n this.__text_cache__ = '';\n\n this.__schemas__ = assign({}, defaultSchemas, schemas);\n this.__compiled__ = {};\n\n this.__tlds__ = tlds_default;\n this.__tlds_replaced__ = false;\n\n this.re = {};\n\n compile(this);\n}\n\n\n/** chainable\n * LinkifyIt#add(schema, definition)\n * - schema (String): rule name (fixed pattern prefix)\n * - definition (String|RegExp|Object): schema definition\n *\n * Add new rule definition. See constructor description for details.\n **/\nLinkifyIt.prototype.add = function add(schema, definition) {\n this.__schemas__[schema] = definition;\n compile(this);\n return this;\n};\n\n\n/** chainable\n * LinkifyIt#set(options)\n * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }\n *\n * Set recognition options for links without schema.\n **/\nLinkifyIt.prototype.set = function set(options) {\n this.__opts__ = assign(this.__opts__, options);\n return this;\n};\n\n\n/**\n * LinkifyIt#test(text) -> Boolean\n *\n * Searches linkifiable pattern and returns `true` on success or `false` on fail.\n **/\nLinkifyIt.prototype.test = function test(text) {\n // Reset scan cache\n this.__text_cache__ = text;\n this.__index__ = -1;\n\n if (!text.length) { return false; }\n\n var m, ml, me, len, shift, next, re, tld_pos, at_pos;\n\n // try to scan for link with schema - that's the most simple rule\n if (this.re.schema_test.test(text)) {\n re = this.re.schema_search;\n re.lastIndex = 0;\n while ((m = re.exec(text)) !== null) {\n len = this.testSchemaAt(text, m[2], re.lastIndex);\n if (len) {\n this.__schema__ = m[2];\n this.__index__ = m.index + m[1].length;\n this.__last_index__ = m.index + m[0].length + len;\n break;\n }\n }\n }\n\n if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {\n // guess schemaless links\n tld_pos = text.search(this.re.host_fuzzy_test);\n if (tld_pos >= 0) {\n // if tld is located after found link - no need to check fuzzy pattern\n if (this.__index__ < 0 || tld_pos < this.__index__) {\n if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {\n\n shift = ml.index + ml[1].length;\n\n if (this.__index__ < 0 || shift < this.__index__) {\n this.__schema__ = '';\n this.__index__ = shift;\n this.__last_index__ = ml.index + ml[0].length;\n }\n }\n }\n }\n }\n\n if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {\n // guess schemaless emails\n at_pos = text.indexOf('@');\n if (at_pos >= 0) {\n // We can't skip this check, because this cases are possible:\n // 192.168.1.1@gmail.com, my.in@example.com\n if ((me = text.match(this.re.email_fuzzy)) !== null) {\n\n shift = me.index + me[1].length;\n next = me.index + me[0].length;\n\n if (this.__index__ < 0 || shift < this.__index__ ||\n (shift === this.__index__ && next > this.__last_index__)) {\n this.__schema__ = 'mailto:';\n this.__index__ = shift;\n this.__last_index__ = next;\n }\n }\n }\n }\n\n return this.__index__ >= 0;\n};\n\n\n/**\n * LinkifyIt#pretest(text) -> Boolean\n *\n * Very quick check, that can give false positives. Returns true if link MAY BE\n * can exists. Can be used for speed optimization, when you need to check that\n * link NOT exists.\n **/\nLinkifyIt.prototype.pretest = function pretest(text) {\n return this.re.pretest.test(text);\n};\n\n\n/**\n * LinkifyIt#testSchemaAt(text, name, position) -> Number\n * - text (String): text to scan\n * - name (String): rule (schema) name\n * - position (Number): text offset to check from\n *\n * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly\n * at given position. Returns length of found pattern (0 on fail).\n **/\nLinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {\n // If not supported schema check requested - terminate\n if (!this.__compiled__[schema.toLowerCase()]) {\n return 0;\n }\n return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);\n};\n\n\n/**\n * LinkifyIt#match(text) -> Array|null\n *\n * Returns array of found link descriptions or `null` on fail. We strongly\n * recommend to use [[LinkifyIt#test]] first, for best speed.\n *\n * ##### Result match description\n *\n * - __schema__ - link schema, can be empty for fuzzy links, or `//` for\n * protocol-neutral links.\n * - __index__ - offset of matched text\n * - __lastIndex__ - index of next char after mathch end\n * - __raw__ - matched text\n * - __text__ - normalized text\n * - __url__ - link, generated from matched text\n **/\nLinkifyIt.prototype.match = function match(text) {\n var shift = 0, result = [];\n\n // Try to take previous element from cache, if .test() called before\n if (this.__index__ >= 0 && this.__text_cache__ === text) {\n result.push(createMatch(this, shift));\n shift = this.__last_index__;\n }\n\n // Cut head if cache was used\n var tail = shift ? text.slice(shift) : text;\n\n // Scan string until end reached\n while (this.test(tail)) {\n result.push(createMatch(this, shift));\n\n tail = tail.slice(this.__last_index__);\n shift += this.__last_index__;\n }\n\n if (result.length) {\n return result;\n }\n\n return null;\n};\n\n\n/** chainable\n * LinkifyIt#tlds(list [, keepOld]) -> this\n * - list (Array): list of tlds\n * - keepOld (Boolean): merge with current list if `true` (`false` by default)\n *\n * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)\n * to avoid false positives. By default this algorythm used:\n *\n * - hostname with any 2-letter root zones are ok.\n * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф\n * are ok.\n * - encoded (`xn--...`) root zones are ok.\n *\n * If list is replaced, then exact match for 2-chars root zones will be checked.\n **/\nLinkifyIt.prototype.tlds = function tlds(list, keepOld) {\n list = Array.isArray(list) ? list : [ list ];\n\n if (!keepOld) {\n this.__tlds__ = list.slice();\n this.__tlds_replaced__ = true;\n compile(this);\n return this;\n }\n\n this.__tlds__ = this.__tlds__.concat(list)\n .sort()\n .filter(function (el, idx, arr) {\n return el !== arr[idx - 1];\n })\n .reverse();\n\n compile(this);\n return this;\n};\n\n/**\n * LinkifyIt#normalize(match)\n *\n * Default normalizer (if schema does not define it's own).\n **/\nLinkifyIt.prototype.normalize = function normalize(match) {\n\n // Do minimal possible changes by default. Need to collect feedback prior\n // to move forward https://github.com/markdown-it/linkify-it/issues/1\n\n if (!match.schema) { match.url = 'http://' + match.url; }\n\n if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {\n match.url = 'mailto:' + match.url;\n }\n};\n\n\n/**\n * LinkifyIt#onCompile()\n *\n * Override to modify basic RegExp-s.\n **/\nLinkifyIt.prototype.onCompile = function onCompile() {\n};\n\n\nmodule.exports = LinkifyIt;\n","'use strict';\n\n\nmodule.exports = function (opts) {\n var re = {};\n\n // Use direct extract instead of `regenerate` to reduse browserified size\n re.src_Any = require('uc.micro/properties/Any/regex').source;\n re.src_Cc = require('uc.micro/categories/Cc/regex').source;\n re.src_Z = require('uc.micro/categories/Z/regex').source;\n re.src_P = require('uc.micro/categories/P/regex').source;\n\n // \\p{\\Z\\P\\Cc\\CF} (white spaces + control + format + punctuation)\n re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');\n\n // \\p{\\Z\\Cc} (white spaces + control)\n re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');\n\n // Experimental. List of chars, completely prohibited in links\n // because can separate it from other part of text\n var text_separators = '[><\\uff5c]';\n\n // All possible word characters (everything without punctuation, spaces & controls)\n // Defined via punctuation & spaces to save space\n // Should be something like \\p{\\L\\N\\S\\M} (\\w but without `_`)\n re.src_pseudo_letter = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';\n // The same as abothe but without [0-9]\n // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';\n\n ////////////////////////////////////////////////////////////////////////////////\n\n re.src_ip4 =\n\n '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';\n\n // Prohibit any of \"@/[]()\" in user/pass to avoid wrong domain fetch.\n re.src_auth = '(?:(?:(?!' + re.src_ZCc + '|[@/\\\\[\\\\]()]).)+@)?';\n\n re.src_port =\n\n '(?::(?:6(?:[0-4]\\\\d{3}|5(?:[0-4]\\\\d{2}|5(?:[0-2]\\\\d|3[0-5])))|[1-5]?\\\\d{1,4}))?';\n\n re.src_host_terminator =\n\n '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\\\d|\\\\.-|\\\\.(?!$|' + re.src_ZPCc + '))';\n\n re.src_path =\n\n '(?:' +\n '[/?#]' +\n '(?:' +\n '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\\\]{}.,\"\\'?!\\\\-]).|' +\n '\\\\[(?:(?!' + re.src_ZCc + '|\\\\]).)*\\\\]|' +\n '\\\\((?:(?!' + re.src_ZCc + '|[)]).)*\\\\)|' +\n '\\\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\\\}|' +\n '\\\\\"(?:(?!' + re.src_ZCc + '|[\"]).)+\\\\\"|' +\n \"\\\\'(?:(?!\" + re.src_ZCc + \"|[']).)+\\\\'|\" +\n \"\\\\'(?=\" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found\n '\\\\.{2,4}[a-zA-Z0-9%/]|' + // github has ... in commit range links,\n // google has .... in links (issue #66)\n // Restrict to\n // - english\n // - percent-encoded\n // - parts of file path\n // until more examples found.\n '\\\\.(?!' + re.src_ZCc + '|[.]).|' +\n (opts && opts['---'] ?\n '\\\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate\n :\n '\\\\-+|'\n ) +\n '\\\\,(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths\n '\\\\!(?!' + re.src_ZCc + '|[!]).|' +\n '\\\\?(?!' + re.src_ZCc + '|[?]).' +\n ')+' +\n '|\\\\/' +\n ')?';\n\n // Allow anything in markdown spec, forbid quote (\") at the first position\n // because emails enclosed in quotes are far more common\n re.src_email_name =\n\n '[\\\\-;:&=\\\\+\\\\$,\\\\.a-zA-Z0-9_][\\\\-;:&=\\\\+\\\\$,\\\\\"\\\\.a-zA-Z0-9_]*';\n\n re.src_xn =\n\n 'xn--[a-z0-9\\\\-]{1,59}';\n\n // More to read about domain names\n // http://serverfault.com/questions/638260/\n\n re.src_domain_root =\n\n // Allow letters & digits (http://test1)\n '(?:' +\n re.src_xn +\n '|' +\n re.src_pseudo_letter + '{1,63}' +\n ')';\n\n re.src_domain =\n\n '(?:' +\n re.src_xn +\n '|' +\n '(?:' + re.src_pseudo_letter + ')' +\n '|' +\n '(?:' + re.src_pseudo_letter + '(?:-|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +\n ')';\n\n re.src_host =\n\n '(?:' +\n // Don't need IP check, because digits are already allowed in normal domain names\n // src_ip4 +\n // '|' +\n '(?:(?:(?:' + re.src_domain + ')\\\\.)*' + re.src_domain/*_root*/ + ')' +\n ')';\n\n re.tpl_host_fuzzy =\n\n '(?:' +\n re.src_ip4 +\n '|' +\n '(?:(?:(?:' + re.src_domain + ')\\\\.)+(?:%TLDS%))' +\n ')';\n\n re.tpl_host_no_ip_fuzzy =\n\n '(?:(?:(?:' + re.src_domain + ')\\\\.)+(?:%TLDS%))';\n\n re.src_host_strict =\n\n re.src_host + re.src_host_terminator;\n\n re.tpl_host_fuzzy_strict =\n\n re.tpl_host_fuzzy + re.src_host_terminator;\n\n re.src_host_port_strict =\n\n re.src_host + re.src_port + re.src_host_terminator;\n\n re.tpl_host_port_fuzzy_strict =\n\n re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;\n\n re.tpl_host_port_no_ip_fuzzy_strict =\n\n re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;\n\n\n ////////////////////////////////////////////////////////////////////////////////\n // Main rules\n\n // Rude test fuzzy links by host, for quick deny\n re.tpl_host_fuzzy_test =\n\n 'localhost|www\\\\.|\\\\.\\\\d{1,3}\\\\.|(?:\\\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';\n\n re.tpl_email_fuzzy =\n\n '(^|' + text_separators + '|\"|\\\\(|' + re.src_ZCc + ')' +\n '(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';\n\n re.tpl_link_fuzzy =\n // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n // but can start with > (markdown blockquote)\n '(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|' + re.src_ZPCc + '))' +\n '((?![$+<=>^`|\\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';\n\n re.tpl_link_no_ip_fuzzy =\n // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n // but can start with > (markdown blockquote)\n '(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|' + re.src_ZPCc + '))' +\n '((?![$+<=>^`|\\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';\n\n return re;\n};\n","/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","// markdown-it default options\n\n'use strict';\n\n\nmodule.exports = {\n options: {\n html: false, // Enable HTML tags in source\n xhtmlOut: false, // Use '/' to close single tags (<br />)\n breaks: false, // Convert '\\n' in paragraphs into <br>\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n maxNesting: 100 // Internal protection, recursion limit\n },\n\n components: {\n\n core: {},\n block: {},\n inline: {}\n }\n};\n","// \"Zero\" preset, with nothing enabled. Useful for manual configuring of simple\n// modes. For example, to parse bold/italic only.\n\n'use strict';\n\n\nmodule.exports = {\n options: {\n html: false, // Enable HTML tags in source\n xhtmlOut: false, // Use '/' to close single tags (<br />)\n breaks: false, // Convert '\\n' in paragraphs into <br>\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n maxNesting: 20 // Internal protection, recursion limit\n },\n\n components: {\n\n core: {\n rules: [\n 'normalize',\n 'block',\n 'inline'\n ]\n },\n\n block: {\n rules: [\n 'paragraph'\n ]\n },\n\n inline: {\n rules: [\n 'text'\n ],\n rules2: [\n 'balance_pairs',\n 'text_collapse'\n ]\n }\n }\n};\n","// Commonmark default options\n\n'use strict';\n\n\nmodule.exports = {\n options: {\n html: true, // Enable HTML tags in source\n xhtmlOut: true, // Use '/' to close single tags (<br />)\n breaks: false, // Convert '\\n' in paragraphs into <br>\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n maxNesting: 20 // Internal protection, recursion limit\n },\n\n components: {\n\n core: {\n rules: [\n 'normalize',\n 'block',\n 'inline'\n ]\n },\n\n block: {\n rules: [\n 'blockquote',\n 'code',\n 'fence',\n 'heading',\n 'hr',\n 'html_block',\n 'lheading',\n 'list',\n 'reference',\n 'paragraph'\n ]\n },\n\n inline: {\n rules: [\n 'autolink',\n 'backticks',\n 'emphasis',\n 'entity',\n 'escape',\n 'html_inline',\n 'image',\n 'link',\n 'newline',\n 'text'\n ],\n rules2: [\n 'balance_pairs',\n 'emphasis',\n 'text_collapse'\n ]\n }\n }\n};\n"],"sourceRoot":""}
\ No newline at end of file +{"version":3,"sources":["webpack:///./node_modules/markdown-it/lib/common/utils.js","webpack:///./node_modules/prosemirror-commands/dist/index.es.js","webpack:///./node_modules/prosemirror-state/dist/index.es.js","webpack:///./node_modules/prosemirror-dropcursor/dist/index.es.js","webpack:///./node_modules/prosemirror-gapcursor/dist/index.es.js","webpack:///./node_modules/tiptap/dist/tiptap.esm.js","webpack:///./node_modules/orderedmap/index.es.js","webpack:///./node_modules/prosemirror-model/dist/index.es.js","webpack:///./node_modules/prosemirror-transform/dist/index.es.js","webpack:///./node_modules/rope-sequence/dist/index.es.js","webpack:///./node_modules/prosemirror-history/dist/index.es.js","webpack:///./node_modules/tiptap-extensions/dist/extensions.esm.js","webpack:///./node_modules/prosemirror-schema-list/dist/index.es.js","webpack:///./node_modules/tiptap-commands/dist/commands.esm.js","webpack:///./node_modules/prosemirror-inputrules/dist/index.es.js","webpack:///./node_modules/prosemirror-utils/dist/index.js","webpack:///./node_modules/prosemirror-view/dist/index.es.js","webpack:///./node_modules/escape-html/index.js","webpack:///./node_modules/prosemirror-collab/dist/index.es.js","webpack:///./node_modules/tiptap-utils/dist/utils.esm.js","webpack:///./node_modules/markdown-it/index.js","webpack:///./node_modules/uc.micro/categories/P/regex.js","webpack:///./node_modules/markdown-it/lib/ruler.js","webpack:///./node_modules/markdown-it/lib/token.js","webpack:///./node_modules/w3c-keyname/index.es.js","webpack:///./node_modules/prosemirror-keymap/dist/index.es.js","webpack:///./node_modules/prosemirror-tables/dist/index.es.js","webpack:///./node_modules/markdown-it/lib/common/entities.js","webpack:///./node_modules/mdurl/index.js","webpack:///./node_modules/uc.micro/properties/Any/regex.js","webpack:///./node_modules/uc.micro/categories/Cc/regex.js","webpack:///./node_modules/uc.micro/categories/Z/regex.js","webpack:///./node_modules/markdown-it/lib/common/html_re.js","webpack:///./node_modules/markdown-it/lib/rules_inline/strikethrough.js","webpack:///./node_modules/markdown-it/lib/rules_inline/emphasis.js","webpack:///./node_modules/markdown-it-task-lists/index.js","webpack:///./node_modules/prosemirror-markdown/dist/index.es.js","webpack:///./node_modules/lowlight/lib/core.js","webpack:///./node_modules/highlight.js/lib/highlight.js","webpack:///./node_modules/fault/index.js","webpack:///./node_modules/format/format.js","webpack:///./node_modules/markdown-it/lib/index.js","webpack:///./node_modules/mdurl/encode.js","webpack:///./node_modules/mdurl/decode.js","webpack:///./node_modules/mdurl/format.js","webpack:///./node_modules/mdurl/parse.js","webpack:///./node_modules/uc.micro/index.js","webpack:///./node_modules/uc.micro/categories/Cf/regex.js","webpack:///./node_modules/markdown-it/lib/helpers/index.js","webpack:///./node_modules/markdown-it/lib/helpers/parse_link_label.js","webpack:///./node_modules/markdown-it/lib/helpers/parse_link_destination.js","webpack:///./node_modules/markdown-it/lib/helpers/parse_link_title.js","webpack:///./node_modules/markdown-it/lib/renderer.js","webpack:///./node_modules/markdown-it/lib/parser_core.js","webpack:///./node_modules/markdown-it/lib/rules_core/normalize.js","webpack:///./node_modules/markdown-it/lib/rules_core/block.js","webpack:///./node_modules/markdown-it/lib/rules_core/inline.js","webpack:///./node_modules/markdown-it/lib/rules_core/linkify.js","webpack:///./node_modules/markdown-it/lib/rules_core/replacements.js","webpack:///./node_modules/markdown-it/lib/rules_core/smartquotes.js","webpack:///./node_modules/markdown-it/lib/rules_core/state_core.js","webpack:///./node_modules/markdown-it/lib/parser_block.js","webpack:///./node_modules/markdown-it/lib/rules_block/table.js","webpack:///./node_modules/markdown-it/lib/rules_block/code.js","webpack:///./node_modules/markdown-it/lib/rules_block/fence.js","webpack:///./node_modules/markdown-it/lib/rules_block/blockquote.js","webpack:///./node_modules/markdown-it/lib/rules_block/hr.js","webpack:///./node_modules/markdown-it/lib/rules_block/list.js","webpack:///./node_modules/markdown-it/lib/rules_block/reference.js","webpack:///./node_modules/markdown-it/lib/rules_block/heading.js","webpack:///./node_modules/markdown-it/lib/rules_block/lheading.js","webpack:///./node_modules/markdown-it/lib/rules_block/html_block.js","webpack:///./node_modules/markdown-it/lib/common/html_blocks.js","webpack:///./node_modules/markdown-it/lib/rules_block/paragraph.js","webpack:///./node_modules/markdown-it/lib/rules_block/state_block.js","webpack:///./node_modules/markdown-it/lib/parser_inline.js","webpack:///./node_modules/markdown-it/lib/rules_inline/text.js","webpack:///./node_modules/markdown-it/lib/rules_inline/newline.js","webpack:///./node_modules/markdown-it/lib/rules_inline/escape.js","webpack:///./node_modules/markdown-it/lib/rules_inline/backticks.js","webpack:///./node_modules/markdown-it/lib/rules_inline/link.js","webpack:///./node_modules/markdown-it/lib/rules_inline/image.js","webpack:///./node_modules/markdown-it/lib/rules_inline/autolink.js","webpack:///./node_modules/markdown-it/lib/rules_inline/html_inline.js","webpack:///./node_modules/markdown-it/lib/rules_inline/entity.js","webpack:///./node_modules/markdown-it/lib/rules_inline/balance_pairs.js","webpack:///./node_modules/markdown-it/lib/rules_inline/text_collapse.js","webpack:///./node_modules/markdown-it/lib/rules_inline/state_inline.js","webpack:///./node_modules/linkify-it/index.js","webpack:///./node_modules/linkify-it/lib/re.js","webpack:///./node_modules/punycode/punycode.js","webpack:///(webpack)/buildin/module.js","webpack:///./node_modules/markdown-it/lib/presets/default.js","webpack:///./node_modules/markdown-it/lib/presets/zero.js","webpack:///./node_modules/markdown-it/lib/presets/commonmark.js"],"names":["_hasOwnProperty","Object","prototype","hasOwnProperty","has","object","key","call","isValidEntityCode","c","fromCodePoint","surrogate1","surrogate2","String","fromCharCode","UNESCAPE_MD_RE","UNESCAPE_ALL_RE","RegExp","source","DIGITAL_ENTITY_TEST_RE","entities","HTML_ESCAPE_TEST_RE","HTML_ESCAPE_REPLACE_RE","HTML_REPLACEMENTS","replaceUnsafeChar","ch","REGEXP_ESCAPE_RE","UNICODE_PUNCT_RE","exports","lib","mdurl","ucmicro","assign","obj","sources","Array","slice","arguments","forEach","TypeError","keys","isString","toString","_class","unescapeMd","str","indexOf","replace","unescapeAll","match","escaped","entity","name","code","charCodeAt","test","toLowerCase","parseInt","replaceEntityPattern","escapeHtml","arrayReplaceAt","src","pos","newElements","concat","isSpace","isWhiteSpace","isMdAsciiPunct","isPunctChar","escapeRE","normalizeReference","trim","toUpperCase","deleteSelection","state","dispatch","selection","empty","tr","scrollIntoView","textblockAt","node","side","firstChild","lastChild","isTextblock","findCutBefore","$pos","parent","type","spec","isolating","i","depth","index","doc","resolve","before","findCutAfter","childCount","after","lift","ref","$from","$to","range","blockRange","target","defaultBlockAt","edgeCount","edge","hasRequiredAttrs","exitCode","$head","$anchor","sameParent","above","indexAfter","contentMatchAt","canReplaceWith","replaceWith","createAndFill","setSelection","near","splitBlock","isBlock","parentOffset","split","atEnd","content","size","deflt","types","can","mapping","map","canReplace","from","create","setNodeMarkup","deleteBarrier","$cut","conn","nodeBefore","nodeAfter","compatibleContent","delete","nodeSize","clearIncompatible","join","joinMaybeClear","findWrapping","matchType","validEnd","end","wrap","length","copy","step","joinAt","selAfter","findFrom","wrapIn","nodeType","attrs","wrapping","setBlockType","to","applicable","nodesBetween","hasMarkup","toggleMark","markType","$cursor","ranges","loop","allowsMarkType","inlineContent","v","returned","markApplies","isInSet","storedMarks","marks","removeStoredMark","addStoredMark","ref$1","rangeHasMark","i$1","ref$2","$from$1","$to$1","removeMark","addMark","chainCommands","commands","len","view","backspace","endOfTextblock","isSelectable","deleteRange","isAtom","del","pcBaseKeymap","insertText","insert","macBaseKeymap","baseKeymap","navigator","platform","os","classesById","Selection","this","SelectionRange","min","max","prototypeAccessors","anchor","configurable","head","get","lastNode","lastParent","openEnd","mapFrom","steps","replaceRange","selectionToInsertionEnd","isInline","replaceRangeWith","dir","textOnly","inner","TextSelection","findSelectionIn","found","bias","AllSelection","atStart","fromJSON","json","RangeError","cls","jsonID","id","selectionClass","getBookmark","between","defineProperties","visible","__proto__","constructor","prototypeAccessors$1","marksAcross","ensureMarks","eq","other","TextBookmark","toJSON","dPos","NodeSelection","$end","mapResult","deleted","NodeBookmark","isText","selectable","sel","AllBookmark","text","child","startLen","last","maps","_from","_to","_newFrom","newTo","Transaction","Transform","time","Date","now","curSelection","curSelectionFor","updated","meta","selectionSet","storedMarksSet","isGeneric","scrolledIntoView","setStoredMarks","sameSet","mark","addToSet","removeFromSet","addStep","setTime","replaceSelection","replaceSelectionWith","inheritMarks","none","schema","setMeta","value","getMeta","_","bind","f","self","FieldDesc","desc","init","apply","baseFields","config","topNodeType","instance","_marks","_old","prev","Configuration","plugins","this$1","fields","pluginsByKey","plugin","push","EditorState","applyTransaction","filterTransaction","ignore","rootTr","transactions","trs","newState","applyInner","seen","haveNew","appendTransaction","n","oldState","j","newInstance","field","applyListeners","$config","reconfigure","pluginFields","result","m","prop","markFromJSON","addApplyListener","removeApplyListener","splice","Plugin","props","bindProps","val","Function","createKey","getState","PluginKey","DropCursorView","editorView","options","width","color","class","cursorPos","element","timeout","handlers","handler","e","dom","addEventListener","destroy","removeEventListener","update","prevState","updateOverlay","setCursor","parentNode","removeChild","rect","nodeRect","nodeDOM","getBoundingClientRect","top","bottom","left","right","coords","coordsAtPos","offsetParent","appendChild","document","createElement","className","style","cssText","parentRect","body","getComputedStyle","position","pageXOffset","pageYOffset","height","scheduleRemoval","clearTimeout","setTimeout","dragover","event","editable","posAtCoords","clientX","clientY","dragging","dragend","drop","dragleave","contains","relatedTarget","GapCursor","valid","GapBookmark","d","closedBefore","closedAfter","override","allowGapCursor","defaultType","mustMove","search","next","$cur","inside","$cur$1","handleKeyDown","arrow","axis","dirStr","$start","$found","handleClick","nodeAt","drawGapCursor","widget","_typeof","Symbol","iterator","_classCallCheck","Constructor","_defineProperties","descriptor","enumerable","writable","defineProperty","_createClass","protoProps","staticProps","_defineProperty","ownKeys","enumerableOnly","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","_objectSpread2","getOwnPropertyDescriptors","_inherits","subClass","superClass","_setPrototypeOf","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","p","_isNativeReflectConstruct","Reflect","construct","sham","Proxy","_possibleConstructorReturn","ReferenceError","_assertThisInitialized","_createSuper","Derived","Super","NewTarget","_slicedToArray","arr","isArray","_arrayWithHoles","_arr","_n","_d","_e","undefined","_s","_i","done","err","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_toConsumableArray","_arrayLikeToArray","_arrayWithoutHoles","iter","_iterableToArray","_nonIterableSpread","minLen","arr2","camelCase","word","ComponentView","component","_ref","editor","extension","decorations","getPos","isNode","isMark","getMarkPos","captureEvents","createDOM","contentDOM","vm","$refs","_this","Component","extend","selected","updateAttrs","propsData","$mount","$el","updateComponentProps","_this2","_props","originalSilent","silent","entries","_ref2","_ref3","newAttrs","transaction","mutation","_this3","stopEvent","draggable","dragHandle","closest","once","isCopy","isPaste","isCut","isDrag","startsWith","posAtDOM","resolvedPos","$destroy","Emitter","fn","_callbacks","_len","args","_key","callbacks","callback","cb","Extension","defaultOptions","ExtensionManager","extensions","bindEditor","extensionKeymaps","includes","nodeMarkKeymaps","excludedExtensions","allowedExtensions","extensionInputRules","inputRules","nodeMarkInputRules","reduce","allInputRules","extensionPasteRules","pasteRules","nodeMarkPasteRules","allPasteRules","_ref4","allCommands","focus","handle","_name","_value","_ref5","_ref6","commandName","commandValue","nodes","_ref7","set","changed","updateState","_ref8","allPlugins","_ref9","injectCSS","css","textContent","insertBefore","Mark","_Extension","_super","minMax","Math","Node","Doc","_Node","Paragraph","group","parseDOM","tag","toDOM","Text","_Emitter","Editor","editorProps","autoFocus","topNode","emptyDocument","useBuiltInExtensions","disableInputRules","disablePasteRules","dropCursor","parseOptions","onInit","onTransaction","onUpdate","onFocus","onBlur","onPaste","onDrop","events","setOptions","focused","createExtensions","createNodes","createMarks","createSchema","createPlugins","keymaps","createKeymaps","createInputRules","createPasteRules","createView","createCommands","setActiveNodesAndMarks","on","emit","builtInExtensions","createDocument","rules","Backspace","createSelectionBetween","_view","attributes","tabindex","handleDOMEvents","blur","nodeFromJSON","error","console","warn","innerHTML","fromSchema","parse","_this4","createState","handlePaste","handleDrop","_len2","_key2","dispatchTransaction","setProps","nodeViews","initNodeViews","_this5","getHTML","getJSON","docChanged","emitUpdate","_this6","_this$resolveSelectio","resolveSelection","_this$state","resolvedFrom","resolvedEnd","JSON","stringify","div","fragment","serializeFragment","_this$state2","setContent","_this7","activeMarks","activeMarkAttrs","activeNodes","docView","EditorContent","default","watch","immediate","$nextTick","setParentComponent","render","beforeDestroy","Menu","preventHide","mousedownHandler","capture","blurHandler","off","EditorMenuBar","data","registerPlugin","$scopedSlots","isActive","getMarkAttrs","getNodeAttrs","textRange","createRange","setEnd","nodeValue","setStart","singleRect","rects","getClientRects","_view$docView$domFrom","domFromPos","offset","childNodes","_child","x","Menu$1","keepInBounds","focusHandler","hide","lastState","composing","_state$selection","start","box","el","round","sendUpdate","EditorMenuBubble","Boolean","menu","$emit","unregisterPlugin","OrderedMap","find","newKey","remove","addToStart","addToEnd","addBefore","place","without","prepend","subtract","append","Fragment","nodeStart","descendants","textBetween","blockSeparator","leafText","separated","isLeaf","first","sameMarkup","withText","cut","cutByIndex","replaceChild","current","maybeChild","findDiffStart","a","b","childA","childB","findDiffEnd","otherPos","posA","posB","iA","iB","same","minSize","findIndex","retIndex","curPos","toStringInner","fromArray","array","joined","compareDeep","p$1","ReplaceError","message","Error","placed","excludes","rank","setFrom","sort","Slice","openStart","replaceOuter","$along","extra","resolveNoCache","prepareSliceForReplace","replaceThreeWay","joinable","addRange","checkJoin","addNode","replaceTwoWay","main","sub","$before","$after","startIndex","endIndex","textOffset","validContent","insertAt","insertInto","dist","removeBetween","removeRange","indexTo","offsetTo","maxOpen","openIsolating","n$1","ResolvedPos","path","prototypeAccessors$2","resolveDepth","dOff","tmp","inclusive","sharedDepth","pred","NodeRange","rem","resolveCached","resolveCache","cached","resolveCachePos","resolveCacheSize","prototypeAccessors$1$1","emptyAttrs","prototypeAccessors$3","startPos","defaultAttrs","includeParents","childAfter","childBefore","toDebugString","wrapMarks","contentMatch","matchFragment","replacement","one","two","allowsMarks","canAppend","check","TextNode","base","ContentMatch","wrapCache","prototypeAccessors$4","string","nodeTypes","stream","TokenStream","expr","parseExpr","nfa","labeled","explore","states","out","term","known","nullFrom","states$1","cmp","dfa","connect","compile","exprs","loop$1","cur","next$1","i$2","next$2","edges","work","dead","checkForDeadEnds","frag","compatible","fillBefore","toEnd","finished","tp","computed","computeWrapping","active","via","shift","reverse","scan","inline","tokens","pop","unshift","prototypeAccessors$1$2","parseExprSeq","eat","parseExprSubscript","typeName","type$1","groups","resolveName","parseExprAtom","parseExprRange","parseNum","Number","defaults","attrName","attr","hasDefault","computeAttrs","built","given","initAttrs","Attribute","tok","SyntaxError","NodeType","markSet","prototypeAccessors$5","atom","isRequired","createChecked","allowedMarks","topType","prototypeAccessors$1$3","MarkType","excluded","contentExprCache","prop$1","contentExpr","markExpr","gatherMarks","prop$2","excl","wrappings","ok","mark$1","text$1","DOMParser","tags","styles","rule","context","ParseContext","addAll","finish","parseSlice","matchTag","matches","namespace","namespaceURI","matchesContext","getAttrs","matchStyle","schemaRules","priority","rules$1","name$1","domParser","blockTags","address","article","aside","blockquote","canvas","dd","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","noscript","ol","output","pre","section","table","tfoot","ul","ignoreTags","script","title","listTags","wsOptionsFor","preserveWhitespace","NodeContext","pendingMarks","solid","fill","exec","applyPending","nextType","pending","markMayApply","parser","open","isOpen","topContext","topOptions","topMatch","findPositions","needsBlock","prototypeAccessors$6","currentPos","selector","msMatchesSelector","webkitMatchesSelector","mozMatchesSelector","addDOM","addTextNode","getAttribute","readStyles","re","parseStyles","addPendingMark","addElement","removePendingMark","domNodeBefore","previousSibling","nodeName","insertNode","findInText","findInside","prevItem","nextSibling","normalizeList","ruleFromNode","skip","sync","oldNeedsBlock","leafFallback","addElementByRule","ownerDocument","createTextNode","enter","startIn","getContent","contentElement","querySelector","findAround","findAtPoint","findPlace","route","cx","enterInner","block","textblockFromContext","closeExtra","preserveWS","topOpen","compareDocumentPosition","textNode","some","parts","option","useRoot","minDepth","part","$context","upto","level","lastIndexOf","DOMSerializer","gatherToDOM","window","createDocumentFragment","keep","rendered","spanning","add","markDOM","serializeMark","serializeNode","renderSpec","onContent","serializeNodeAndMarks","structure","xmlNS","tagName","space","createElementNS","space$1","setAttributeNS","setAttribute","innerContent","domSerializer","nodesFromSchema","marksFromSchema","factor16","pow","recoverIndex","MapResult","recover","StepMap","inverted","diff","recoverOffset","assoc","_map","simple","oldIndex","newIndex","oldSize","newSize","touches","oldStart","newStart","invert","Mapping","mirror","TransformError","appendMap","mirrors","setMirror","appendMapping","startSize","mirr","getMirror","appendMappingInverted","totalSize","inverse","recoverables","rec","corr","docs","mustOverride","maybeStep","failed","getMap","stepsByID","Step","_doc","_mapping","merge","_other","stepType","stepClass","StepResult","fail","fromReplace","ReplaceStep","contentBetween","slice$1","ReplaceAroundStep","gapFrom","gapTo","gap","inserted","canCut","liftTarget","innerRange","around","outer","findWrappingOutside","innerMatch","findWrappingInside","withAttrs","canSplit","typesAfter","innerType","index$1","rest","baseType","canJoin","joinPoint","dropPoint","pass","insertPos","mapFragment","mapped","gapStart","gapEnd","splitting","d$1","splitting$1","wrappers","canChangeType","startM","endM","newNode","typeAfter","AddMarkStep","oldSlice","RemoveMarkStep","fitsTrivially","removed","added","removing","adding","newSet","s","matched","toRemove","found$1","parentType","delSteps","allowed","Fitter","fit","replaceStep","unplaced","frontier","dropFromFragment","count","addToFragment","contentAt","closeNodeStart","contentAfterFits","invalidMarks","closeFragment","oldOpen","newOpen","coveredDepths","findFittable","placeNodes","openMore","dropNode","moveInline","mustMoveInline","placedSize","close","sliceDepth","frontierDepth","inject","openAtEnd","closeFrontierNode","openFrontierNode","taken","openEndCount","findCloseLevel","match$1","targetDepths","preferredTarget","defining","preferredTargetIndex","leftNodes","preferredDepth","openDepth","targetDepth","expand","startSteps","point","insertPoint","covered","RopeSequence","leafAppend","leafPrepend","appendInner","Append","sliceInner","getInner","forEachInner","forEachInvertedInner","elt","values","Leaf","flatten","leftLen","Branch","items","eventCount","popEvent","preserveItems","remap","remapping","remaining","transform","addAfter","item","Item","addTransform","histOptions","newItems","oldItems","lastItem","merged","cutPoint","overflow","DEPTH_OVERFLOW","mirrorPos","mirrorOffset","addMaps","rebased","rebasedTransform","rebasedCount","rebasedItems","newUntil","iRebased","newMaps","branch","emptyItemCount","compress","newItem","HistoryState","undone","prevRanges","prevTime","rangesFor","mapRanges","histTransaction","history","redo","mustPreserveItems","historyKey","newHist","historyState","cachedPreserveItems","cachedPreserveItemsPlugins","historyPreserveItems","closeHistoryKey","newGroupDelay","hist","historyTr","appended","newGroup","adjacent","isAdjacentTo","undo","undoDepth","redoDepth","Blockquote","paragraph","BulletList","list_item","CodeBlock","getDecorations","blocks","list","parseNodes","classes","properties","children","highlightAuto","decoration","CodeBlockHighlight","languages","registerLanguage","decorationSet","oldNodeName","newNodeName","oldNodes","newNodes","HardBreak","command","Heading","levels","HorizontalRule","IMAGE_INPUT_REGEX","Image","_match","alt","dataTransfer","files","images","file","preventDefault","coordinates","image","reader","FileReader","onload","readerEvent","readAsDataURL","ListItem","Enter","Tab","SuggestionsPlugin","_ref2$matcher","matcher","char","allowSpaces","startOfLine","_ref2$appendText","appendText","_ref2$suggestionClass","suggestionClass","_ref2$command","_command","_ref2$items","_ref2$onEnter","onEnter","_ref2$onChange","onChange","_ref2$onExit","onExit","_ref2$onKeyDown","onKeyDown","_ref2$onFilter","onFilter","searchItems","query","moved","started","stopped","handleStart","handleChange","handleExit","decorationNode","decorationId","virtualNode","clientWidth","clientHeight","_ref$char","_ref$allowSpaces","_ref$startOfLine","$position","escapedChar","suffix","prefix","regexp","textFrom","textTo","matchPrefix","input","random","substr","_this$getState","editorState","_this$getState2","OrderedList","order","hasAttribute","TableNodes","tableGroup","cellContent","cellAttributes","background","getFromDOM","backgroundColor","setDOMAttr","_Mark","Bold","fontWeight","Code","Italic","Link","href","url","openOnClick","rel","link","HTMLAnchorElement","stopPropagation","Strike","Collaboration","getSendableSteps","debounce","sendable","onSendable","version","clientID","delay","floor","_this2$editor","History","Placeholder","emptyEditorClass","emptyNodeClass","emptyNodeText","showOnlyWhenEditable","showOnlyCurrent","isEditorEmpty","hasAnchor","isNodeEmpty","wrapInList","listType","doJoin","outerRange","$insert","joinBefore","splitDepth","splitPos","doWrapInList","splitListItem","itemType","grandParent","keepItem","tr$1","liftListItem","endOfList","liftToOuterList","indexBefore","liftOutOfList","sinkListItem","nestedBefore","markInputRule","markEnd","markStart","matchStart","matchEnd","textStart","textEnd","getMarksBetween","nodeInputRule","pasteRule","transformPasted","markPasteRule","isLink","replaceText","splitToDefaultListItem","_tr","_index","toggleBlockType","toggletype","isList","bullet_list","ordered_list","todo_list","toggleList","parentList","toggleWrap","updateMark","InputRule","cutOff","stored","handleTextInput","run","compositionend","isInputRules","textBefore","undoInputRule","undoable","toUndo","wrappingInputRule","joinPredicate","textblockTypeInputRule","prosemirrorState","prosemirrorModel","prosemirrorTables","replaceParentNodeOfType","findParentNodeOfType","newTr","replaceNodeAtPos","replaceSelectedNode","isNodeSelection","_tr$selection","cloneTr","setTextSelection","nextSelection","isSelectableNode","shouldSelectNode","safeInsert","tryToReplace","hasPosition","$insertPos","isEmptyParagraph","canInsert","_pos","_pos2","equalNodeType","removeNodeAtPos","tableNodeTypes","roles","tableRole","createCell","cellType","isRectSelected","TableMap","$anchorCell","cells","cellsInRect","selectedCells","rectBetween","$headCell","transpose","column","convertTableNodeToArrayOfRows","tableNode","rows","rowIndex","rowCells","colIndex","cellPos","cell","findCell","convertArrayOfRowsToTableNode","arrayOfNodes","rowsPM","row","newCell","moveRowInArrayOfRows","indexesOrigin","indexesTarget","directionOverride","direction","rowsExtracted","positionOffset","checkInvalidMovements","originIndex","targetIndex","targets","errorMessage","findParentNode","predicate","findParentNodeClosestToPos","findParentDomRef","domAtPos","findDomRefAtPos","hasParentNode","findPositionOfNodeBefore","maybeSelection","TEXT_NODE","descend","findChildren","findChildrenByType","findTable","isCellSelection","CellSelection","isTableSelected","getCellsInColumn","columnIndex","acc","nodePos","getCellsInRow","select","isRowSelection","findCellClosestToPos","selRect","cellsInFirstRow","cellsInLastRow","selectColumn","selectRow","cloneRowAt","tableNodes","rowPos","cloneRow","rowWidth","rowspan","colspan","rowSpanCells","_loop","foundCells","filterCellsInRow","setCellAttrs","removeColumnAt","removeTable","removeColumn","tableStart","removeRowAt","removeRow","findCellRectClosestToPos","findTableClosestToPos","getSelectionRangeInColumn","_loop2","maybeEndIndex","_loop3","indexes","maybeCells","firstSelectedColumnCells","firstRowCells","headCell","_i3","columnCells","getSelectionRangeInRow","_loop4","_loop5","firstSelectedRowCells","firstColumnCells","_i4","findParentNodeOfTypeClosestToPos","hasParentNodeOfType","findParentDomRefOfType","findSelectedNodeOfType","findTextNodes","findInlineNodes","findBlockNodes","findChildrenByAttr","findChildrenByMark","getSelectionRect","isColumnSelected","isRowSelected","getCellsInTable","selectTable","emptyCell","addColumnAt","addColumn","moveRow","originRowIndex","targetRowIndex","opts","tryToFit","indexesOriginRow","indexesTargetRow","newTable","moveTableRow","moveColumn","originColumnIndex","targetColumnIndex","indexesOriginColumn","indexesTargetColumn","moveTableColumn","addRowAt","clonePreviousRow","cloneRowIndex","addRow","removeSelectedColumns","pmTableRect","removeSelectedRows","removeColumnClosestToPos","removeRowClosestToPos","forEachCellInColumn","cellTransform","setCursorToLastCell","forEachCellInRow","createTable","rowsCount","colsCount","withHeaderRow","_tableNodeTypes","tableCell","tableHeader","header_cell","tableRow","headerCells","_i2","removeParentNodeOfType","removeSelectedNode","setParentNodeMarkup","selectParentNodeOfType","removeNodeBefore","ie_edge","userAgent","ie_upto10","ie_11up","mac","ie","ie_version","documentMode","gecko","gecko_version","chrome","chrome_version","ios","android","webkit","documentElement","safari","vendor","webkit_version","domIndex","host","isEquivalentPosition","targetNode","targetOff","scanFor","atomElements","hasBlockDesc","contentEditable","pmViewDesc","selectionCollapsed","domSel","collapsed","isCollapsed","rangeCount","getRangeAt","keyEvent","keyCode","createEvent","initEvent","windowRect","win","innerWidth","innerHeight","getSide","scrollRectIntoView","startDOM","scrollThreshold","someProp","scrollMargin","defaultView","atTop","bounding","moveX","moveY","scrollBy","startX","scrollLeft","startY","scrollTop","dX","dY","scrollStack","stack","restoreScrollStack","dTop","preventScrollSupported","findOffsetInNode","coordsClosest","dxClosest","rowBot","rowTop","childIndex","dx","inRect","findOffsetInText","assign$1","root","caretPositionFromPoint","pos$1","offsetNode","caretRangeFromPoint","startContainer","startOffset","elementFromPoint","startI","targetKludge","box$1","outside","nearestDesc","posBefore","posAfter","posFromDOM","posFromCaret","posFromElement","posAtStart","border","rectBefore","rectAfter","flattenV","rect$1","y","flattenH","rect$2","target$1","rect$3","withFlushedState","viewState","activeElement","maybeRTL","cachedState","cachedDir","cachedResult","nearest","boxes","endOfTextblockVertical","getSelection","modify","oldRange","oldNode","focusNode","oldOff","focusOffset","oldBidiLevel","caretBidiLevel","domAfterPos","removeAllRanges","endOfTextblockHorizontal","ViewDesc","dirty","beforePosition","posAtEnd","contentLost","matchesWidget","matchesMark","matchesNode","matchesHack","parseRule","posBeforeChild","localPosFromDOM","domBefore","domAfter","desc$1","search$1","onlyNodes","getDesc","descAt","parseRange","fromOffset","toOffset","childBase","emptyChildAt","j$1","force","anchorDOM","headDOM","anchorNode","anchorOffset","collapse","ignoreMutation","markDirty","startInside","endInside","markParentsDirty","nothing","WidgetViewDesc","raw","classList","stop","ignoreSelection","CompositionViewDesc","textDOM","mut","oldValue","MarkViewDesc","custom","replaceNodes","NodeViewDesc","outerDeco","innerDeco","updateChildren","descObj","applyOuterDeco","CustomNodeViewDesc","TextViewDesc","reparseInView","sameOuterDeco","composition","localCompositionNode","updater","ViewTreeUpdater","deco","onWidget","onNode","locals","forChild","decoIndex","restNode","parentIndex","widgets","compareSide","child$1","cutAt","i$3","iterDeco","insideNode","syncToMarks","placeWidget","findNodeMatch","updateNextNode","addTextblockHacks","destroyRest","protectLocalComposition","renderChildren","renderDescs","parentDOM","descs","childDOM","rm","oldCSS","listStyle","iosHacks","nearbyTextNode","textPos","childStart","findTextInFragment","compositionNodes","updateInner","updateOuterDeco","needsWrap","oldDOM","patchOuterDeco","computeOuterDeco","selectNode","deselectNode","removeAttribute","docViewDesc","inParent","BRHackViewDesc","OuterDecoLevel","noDeco","outerDOM","prevComputed","curComputed","curDOM","patchAttributes","prevList","curList","removeProperty","lockedNode","lock","preMatch","preMatched","preMatchOffset","moveSelectionBlock","$side","selectHorizontally","mods","nodeLen","isIgnorable","skipIgnoredNodesLeft","moveNode","moveOffset","isBlockNode","setSelFocus","skipIgnoredNodesRight","domObserver","setCurSelection","selectVertically","beyond","stopNativeHorizontalDelete","nextNode","switchEditable","captureKeyDown","ctrlKey","metaKey","altKey","shiftKey","getMods","chromeDownArrowBug","selectionFromDOM","origin","inWidget","isOnEdge","selectionBetween","selectionToDOM","syncNodeSelection","hasFocus","hasSelection","disconnectSelection","cursorWrapper","img","disabled","selectCursorWrapper","resetEditableFrom","resetEditableTo","brokenSelectBetweenUneditable","temporarilyEditableNear","resetEditable","hideSelectionGuard","removeClassOnSelectionChange","connectSelection","getPreMatch","destroyBetween","maxKeep","markDesc","nextDOM","setEditable","wasDraggable","lastSelectedViewDesc","clearNodeSelection","readDOMChange","typeOver","addedNodes","lastSelectionTime","lastSelectionOrigin","newSel","shared","preferredPos","preferredSide","from_","to_","lastKeyCode","startDoc","editableContent","anchor$1","parseBetween","compare","lastKeyCodeTime","change","endA","endB","adjust","findDiff","sel$1","domChangeCount","nextSel","lastIOSEnter","old","$newStart","$newEnd","skipClosingAndOpening","$next","looksLikeJoin","suppressSelectionUpdates","markChange","$from1","chFrom","chTo","curMarks","prevMarks","isMarkChange","sel$2","parsedSel","fromEnd","mayOpen","serializeForClipboard","serializer","detachedDoc","wrapMap","wrapper","parseFromClipboard","html","plainText","inCode","asText","parsed","metas","firstTag","readHTML","contextNode","sliceData","addContext","closeRange","closeSlice","lastWrap","inLast","addToSibling","sibling","withWrappers","closeRight","wrapped","normalizeSiblings","thead","tbody","caption","colgroup","col","td","th","_detachedDoc","implementation","createHTMLDocument","observeOptions","childList","characterData","characterDataOldValue","attributeOldValue","subtree","useCharData","SelectionState","DOMObserver","handleDOMChange","queue","flushingSoon","observer","MutationObserver","mutations","removedNodes","flushSoon","flush","currentSelection","onCharData","prevValue","onSelectionChange","suppressingSelectionUpdates","forceFlush","observe","take","takeRecords","disconnect","ignoreSelectionChange","container","commonAncestorContainer","result$1","registerMutation","brs","cssChecked","whiteSpace","checkCSS","attributeName","editHandlers","setSelectionOrigin","ensureListeners","currentHandlers","eventHandlers","runCustomHandler","defaultPrevented","eventCoords","runHandlerOnContext","propName","updateSelection","handleSingleClick","selectedNode","selectAt","selectClickedNode","selectClickedLeaf","handleDoubleClick","handleTripleClick","defaultTripleClick","forceDOMFlush","endComposition","keydown","inOrNearComposition","keyup","keypress","charCode","selectNodeModifier","mousedown","flushed","lastClick","click","dy","isNear","mouseDown","MouseDown","targetPos","allowDefault","mightDrag","targetDesc","addAttr","setUneditable","up","move","abs","timeStamp","compositionEndedAt","touchdown","contextmenu","timeoutComposition","scheduleComposeEnd","composingTimeout","forceUpdate","compositionstart","compositionupdate","markCursor","brokenClipboardAPI","doPaste","singleNode","sliceSingleNode","clipboardData","clearData","setData","selectNodeContents","captureCopy","paste","getData","capturePaste","Dragging","dragCopyModifier","dragstart","dragenter","eventPos","$mouse","beforeInsert","beforeinput","inputType","compareObjs","WidgetType","noSpec","span","oldOffset","Decoration","InlineType","inclusiveStart","inclusiveEnd","is","DecorationSet","local","buildTree","findInner","childOff","mapInner","newLocal","onRemove","oldChildren","oldEnd","newEnd","dSize","mustRebuild","fromLocal","toLocal","childOffset","childNode","gather","mapAndGatherRemainingDecorations","from$1","byPos","mapChildren","addInner","baseOffset","takeSpansForNode","moveSpans","withoutNulls","removeInner","span$1","dec","localSet","DecorationGroup","removeOverlap","localsInner","members","spans","hasNulls","localStart","working","insertAhead","viewDecorations","sorted","EditorView","_root","mount","mounted","getEditable","updateCursorWrapper","buildNodeViews","computeDocDeco","bubbles","eventBelongsToView","initInput","pluginViews","updatePluginViews","contenteditable","selectionContext","updateStateInner","reconfigured","redraw","nA","nB","changedNodeViews","sel1","sel2","refDOM","refTop","newRefTop","scroll","scrollToSelection","updateDoc","updateSel","oldScrollPos","overflowAnchor","localRect","storeScrollPos","forceSelUpdate","selContext","newContext","needChromeSelectionReset","destroyPluginViews","pluginView","setActive","preventScroll","focusPreventScroll","destroyInput","dispatchEvent","matchHtmlRegExp","module","escape","lastIndex","substring","Rebaseable","CollabState","unconfirmed","collabKey","collab","unconfirmedFrom","receiveTransaction","clientIDs","collabState","ourID","ours","nUnconfirmed","over","rebaseSteps","newCollabState","mapSelectionBackward","sendableSteps","_origins","getVersion","markItem","nodeItem","getMarkRange","endPos","markIsActive","nodeEqualsType","nodeIsActive","Ruler","__rules__","__cache__","__find__","__compile__","chains","enabled","altName","chain","at","opt","beforeName","ruleName","afterName","enable","ignoreInvalid","idx","enableOnly","disable","getRules","chainName","Token","nesting","markup","info","hidden","attrIndex","attrPush","attrData","attrSet","attrGet","attrJoin","8","9","10","12","13","16","17","18","20","27","32","33","34","35","36","37","38","39","40","44","45","46","59","61","91","92","106","107","108","109","110","111","144","145","160","161","162","163","164","165","173","186","187","188","189","190","191","192","219","220","221","222","229","48","49","50","51","52","53","54","55","56","57","brokenModifierNames","normalizeKeyName","ctrl","mod","modifiers","keymap","bindings","keydownHandler","normalize","baseName","keyName","isChar","direct","fromCode","withShift","readFromCache","addToCache","WeakMap","cache","cache$1","cachePos","Rect","problems","freshColWidth","colwidth","colCount","nextCell","leftA","rightA","topA","bottomA","leftB","rightB","topB","bottomB","positionAt","rowStart","rowEnd","rowEndIndex","hasRowSpan","rowNode","prevRow","cell$1","findWidth","mapPos","colWidths","cellNode","h","w","colW","widthIndex","expectedPos","missing","tableMap","badWidths","colWidth","findBadColWidths","computeMap","cellAround","isInTable","selectionCell","role","role$1","cellNear","pointsAtCell","moveCellForward","inSameTable","$a","$b","setAttr","rmColSpan","addColSpan","tableChanged","rowSelection","isColSelection","colSelection","rowContent","cellRect","extraLeft","extraRight","attrs$1","forEachCell","anchorTop","headTop","anchorBot","headBot","anchorRect","headRect","anchorLeft","headLeft","anchorRight","headRight","anchorCell","CellBookmark","drawCellSelection","getCellAttrs","extraAttrs","widthAttr","widths","getter","setter","cellAttrs","table_row","table_cell","table_header","pastedCells","fitSlice","r","r$1","r$2","ensureRectangular","clipCells","newWidth","newHeight","newRows","newRows$1","row$1","cells$1","isolateHorizontal","cellTop","cellLeft","isolateVertical","updatePos","insertCells","recomp","emptyHead","start$1","emptyRow","growTable","shiftArrow","deleteCellSelection","maybeSetSelection","atEndOfCell","$cell","baseContent","handleMouseDown","startEvent","startDOMCell","domInCell","setCellSelection","cellUnderMouse","starting","mousePos","fixTablesKey","fixTables","tablePos","mustAdd","prob","cell$2","tableNodeType","fixTable","changedDescendants","curSize","selectedRect","refColumn","headerCell","columnIsHeader","addColumnBefore","addColumnAfter","mapStart","deleteColumn","rowIsHeader","refRow","addRowBefore","addRowAfter","nextRow","newPos","deleteRow","isEmpty","mergeCells","indexTop","indexLeft","indexBottom","indexRight","cellsOverlapRectangle","mergedPos","mergedCell","splitCell","splitCellWithType","getCellType","cellWrapping","baseAttrs","lastCell","setCellAttr","isHeaderEnabledByType","cellPositions","toggleHeader","useDeprecatedLogic","deprecated_toggleHeader","isHeaderRowEnabled","isHeaderColumnEnabled","selectionStartsAt","cellsRect","newType","relativeCellPos","toggleHeaderRow","toggleHeaderColumn","toggleHeaderCell","goToNextCell","rowNode$1","findNextCell","deleteTable","TableView","cellMinWidth","updateColumns","overrideCol","overrideValue","totalWidth","fixedWidth","hasWidth","cssWidth","minWidth","record","key$1","columnResizing","handleWidth","View","lastColumnResizable","ResizeState","activeHandle","mousemove","pluginState","domCellAround","edgeCell","updateHandle","handleMouseMove","mouseleave","handleMouseLeave","domWidth","offsetWidth","currentColWidth","mapIndex","zeroes","updateColumnWidth","draggedWidth","setDragging","which","dragged","displayColumnWidth","startWidth","handleMouseDown$1","handleDecorations","setHandle","tableEditing","allowTableNodeSelection","afterFrom","beforeTo","isCellBoundarySelection","fromCellBoundaryNode","toCellBoundaryNode","node$1","isTextSelectionAcrossCells","normalizeSelection","action","encode","decode","format","open_tag","close_tag","HTML_TAG_RE","HTML_OPEN_CLOSE_TAG_RE","tokenize","scanned","marker","scanDelims","delimiters","jump","token","can_open","can_close","postProcess","startDelim","endDelim","loneMarkers","isStrong","disableCheckboxes","useLabelWrapper","useLabelAfter","parentToken","targetLevel","isTodoItem","isParagraph","isListItem","startsWithTodoMarkdown","todoify","TokenConstructor","checkbox","disabledAttr","makeCheckbox","ceil","for","afterLabel","beginLabel","endLabel","md","label","labelAfter","core","ruler","horizontal_rule","heading","code_block","params","tight","hard_break","em","strong","MarkdownParseState","tokenHandlers","noOpenClose","withoutTrailingNewline","noOp","addText","maybeMerge","openMark","closeMark","parseTokens","toks","openNode","closeNode","MarkdownParser","tokenizer","nodeType$1","softbreak","fence","hardbreak","code_inline","MarkdownSerializer","serialize","MarkdownSerializerState","renderContent","defaultMarkdownSerializer","wrapBlock","write","ensureNewLine","closeBlock","repeat","renderInline","renderList","bullet","maxW","nStr","esc","quote","mixable","expelEnclosingWhitespace","_state","isPlainURL","_mark","backticksFor","ticks","delim","closed","inTightList","tightLists","flushClose","atBlank","delimMin","firstDelim","lines","trailing","progress","leading","lead","inner$1","trail","noEsc","markString","isTight","prevTight","getEnclosingWhitespace","high","fault","High","low","highlight","language","coreHighlight","autoHighlight","syntax","lang","rawDefinition","languageNames","aliases","registerAlias","listLanguages","getLanguage","inherit","own","commonKeywords","secondBest","settings","subset","relevance","alias","continuation","currentChildren","lastMatch","continuations","modeBuffer","compileMode","mode","compiled","keywords","beginKeywords","caseInsensitive","pair","common","all","compileKeywords","lexemesRe","langRe","lexemes","begin","beginRe","endSameAsBegin","endsWithParent","endRe","illegal","illegalRe","contained","expandOrCloneMode","compileContains","starts","terminators","expression","indices","regexes","matchAt","addRule","separator","regex","backreferenceRe","captures","joinRe","terminator_end","buildModeRegex","global","compileLanguage","processLexeme","doBeginMatch","lexeme","newMode","escapeRe","excludeBegin","addSiblings","processBuffer","returnBegin","startNewMode","doEndMatch","matchPlusRemainder","endMode","endOfMode","endsParent","returnEnd","excludeEnd","subLanguage","textBeforeMatch","processed","build","subvalue","explicit","buildText","processSubLanguage","keyword","submatch","keywordMatch","processKeywords","siblings","tail","contents","noPrefix","variants","cached_variants","dependencyOnParent","factory","globalObject","hljs","ArrayProto","objectKeys","SAFE_MODE","noHighlightRe","languagePrefixRe","fixMarkupRe","LANGUAGE_NOT_FOUND","classPrefix","tabReplace","useBR","COMMON_KEYWORDS","isNotHighlighted","objects","nodeStream","_nodeStream","expand_or_clone_mode","variant","isFrozen","scoreForKeyword","providedScore","reStr","case_insensitive","matcherRe","matchIndexes","reCountMatchGroups","regexps","numCaptures","ret","rawKeywords","compiled_keywords","splitAndCompile","languageName","ignore_illegals","codeToHighlight","match_str","buildSpan","insideSpan","leaveOpen","openSpan","mode_buffer","keyword_match","last_index","new_mode","end_mode","testRe","text_before_match","errorRaised","languageSubset","second_best","autoDetection","fixMarkup","p1","highlightBlock","originalStream","resultNode","blockLanguage","original","highlighted","nodeStack","selectStream","mergeStreams","prevClassName","currentLang","resultLang","buildClassName","initHighlighting","called","querySelectorAll","PLAINTEXT_LANGUAGE","disableAutodetect","configure","user_options","initHighlightingOnLoad","requireLanguage","debugMode","IDENT_RE","UNDERSCORE_IDENT_RE","NUMBER_RE","C_NUMBER_RE","BINARY_NUMBER_RE","RE_STARTERS_RE","BACKSLASH_ESCAPE","APOS_STRING_MODE","QUOTE_STRING_MODE","PHRASAL_WORDS_MODE","COMMENT","inherits","C_LINE_COMMENT_MODE","C_BLOCK_COMMENT_MODE","HASH_COMMENT_MODE","NUMBER_MODE","C_NUMBER_MODE","BINARY_NUMBER_MODE","CSS_NUMBER_MODE","REGEXP_MODE","TITLE_MODE","UNDERSCORE_TITLE_MODE","METHOD_GUARD","deepFreeze","freeze","objIsFunction","getOwnPropertyNames","formatter","EConstructor","FormattedError","displayName","eval","EvalError","reference","uri","URIError","fmt","arg","precision","argIndex","leadingZero","nextArg","slurpNumber","digits","parseFloat","toFixed","vsprintf","replacements","log","printf","utils","helpers","Renderer","ParserCore","ParserBlock","ParserInline","LinkifyIt","punycode","zero","commonmark","BAD_PROTO_RE","GOOD_DATA_RE","validateLink","RECODE_HOSTNAME_FOR","normalizeLink","hostname","protocol","toASCII","er","normalizeLinkText","toUnicode","MarkdownIt","presetName","renderer","linkify","presets","components","rules2","ruler2","missed","use","env","State","process","parseInline","inlineMode","encodeCache","exclude","keepEscaped","l","nextCode","defaultChars","getEncodeCache","encodeURIComponent","componentChars","decodeCache","getDecodeCache","seq","b1","b2","b3","b4","chr","slashes","auth","port","pathname","hash","Url","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","hostlessProtocol","slashedProtocol","slashesDenoteHost","lowerProto","hec","simplePath","proto","atSign","hostEnd","parseHost","ipv6Hostname","hostparts","newpart","k","validParts","notHost","bit","qm","u","Any","Cc","Cf","P","Z","parseLinkLabel","parseLinkDestination","parseLinkTitle","disableNested","prevPos","labelEnd","posMax","oldPos","skipToken","default_rules","slf","renderAttrs","tmpAttrs","tmpToken","langName","langPrefix","renderInlineAsText","renderToken","xhtmlOut","breaks","html_block","html_inline","nextToken","needLf","_rules","Core","NEWLINES_RE","NULL_RE","isLinkClose","currentToken","ln","lastPos","htmlLinkLevel","fullUrl","urlText","links","blockTokens","pretest","RARE_RE","SCOPED_ABBR_TEST_RE","SCOPED_ABBR_RE","SCOPED_ABBR","tm","replaceFn","replace_scoped","inlineTokens","inside_autolink","replace_rare","blkIdx","typographer","QUOTE_TEST_RE","QUOTE_RE","replaceAt","process_inlines","t","thisLevel","lastChar","nextChar","isLastPunctChar","isNextPunctChar","isLastWhiteSpace","isNextWhiteSpace","canOpen","canClose","isSingle","openQuote","closeQuote","OUTER","single","quotes","StateCore","startLine","endLine","line","hasEmptyLines","maxNesting","skipEmptyLines","sCount","blkIndent","outTokens","lineMax","getLine","bMarks","eMarks","escapedSplit","escapes","backTicked","lastBackTick","lineText","nextLine","columns","columnCount","aligns","tableLines","tbodyLines","tShift","getLines","mem","haveEndMarker","skipChars","skipSpaces","adjustTab","initial","lastLineEmpty","oldBMarks","oldBSCount","oldIndent","oldParentType","oldSCount","oldTShift","spaceAfterMarker","terminate","terminatorRules","wasOutdented","oldLineMax","bsCount","cnt","skipBulletListMarker","skipOrderedListMarker","contentStart","indent","indentAfterMarker","isOrdered","itemLines","listLines","listTokIdx","markerCharCode","markerValue","oldLIndent","oldTight","posAfterMarker","prevEmptyEnd","isTerminatingParagraph","markTightParagraphs","_endLine","destEndPos","destEndLineNo","res","references","skipSpacesBack","skipCharsBack","block_names","HTML_SEQUENCES","StateBlock","indent_found","ddIndent","keepLastLF","lineIndent","lineStart","_rules2","pushPending","isTerminatorChar","pmax","ESCAPED","labelStart","parseReference","EMAIL_RE","AUTOLINK_RE","linkMatch","emailMatch","lc","isLetter","DIGITAL_RE","NAMED_RE","lastDelim","currDelim","curr","StateInline","pendingLevel","canSplitWord","left_flanking","right_flanking","isFunction","fuzzyLink","fuzzyEmail","fuzzyIP","defaultSchemas","validate","http","src_auth","src_host_port_strict","src_path","no_http","src_domain","src_domain_root","src_port","src_host_terminator","mailto","src_email_name","src_host_strict","tlds_default","__opts__","tlds","__tlds__","untpl","tpl","src_tlds","onCompile","__tlds_replaced__","src_xn","email_fuzzy","tpl_email_fuzzy","link_fuzzy","tpl_link_fuzzy","link_no_ip_fuzzy","tpl_link_no_ip_fuzzy","host_fuzzy_test","tpl_host_fuzzy_test","schemaError","__compiled__","__schemas__","isRegExp","createValidator","slist","schema_test","src_ZPCc","schema_search","__index__","__text_cache__","resetScanCache","Match","__last_index__","__schema__","createMatch","schemas","definition","ml","me","tld_pos","testSchemaAt","keepOld","src_Any","src_Cc","src_Z","src_P","src_ZCc","src_pseudo_letter","src_ip4","src_host","tpl_host_fuzzy","tpl_host_no_ip_fuzzy","tpl_host_fuzzy_strict","tpl_host_port_fuzzy_strict","tpl_host_port_no_ip_fuzzy_strict","freeGlobal","maxInt","regexPunycode","regexNonASCII","regexSeparators","errors","stringFromCharCode","mapDomain","ucs2decode","counter","ucs2encode","digitToBasic","digit","flag","adapt","delta","numPoints","firstTime","baseMinusTMin","basic","oldi","baseMinusT","codePoint","inputLength","handledCPCount","basicLength","q","currentValue","handledCPCountPlusOne","qMinusT","webpackPolyfill","deprecate","paths"],"mappings":"oGASA,IAAIA,EAAkBC,OAAOC,UAAUC,eAEvC,SAASC,EAAIC,EAAQC,GACnB,OAAON,EAAgBO,KAAKF,EAAQC,GA+BtC,SAASE,EAAkBC,GAGzB,QAAIA,GAAK,OAAUA,GAAK,WAEpBA,GAAK,OAAUA,GAAK,SACH,QAAZ,MAAJA,IAA2C,QAAZ,MAAJA,OAE5BA,GAAK,GAAQA,GAAK,KACZ,KAANA,MACAA,GAAK,IAAQA,GAAK,QAClBA,GAAK,KAAQA,GAAK,QAElBA,EAAI,eAIV,SAASC,EAAcD,GAErB,GAAIA,EAAI,MAAQ,CAEd,IAAIE,EAAa,QADjBF,GAAK,QAC2B,IAC5BG,EAAa,OAAc,KAAJH,GAE3B,OAAOI,OAAOC,aAAaH,EAAYC,GAEzC,OAAOC,OAAOC,aAAaL,GAI7B,IAAIM,EAAkB,8CAElBC,EAAkB,IAAIC,OAAOF,EAAeG,OAAS,IADnC,6BACmDA,OAAQ,MAE7EC,EAAyB,q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V5U,KAAM,GACNrqD,MAAO,GACPvK,OAAQ,M,iCChCZs6C,EAAOvzE,QAAU,CACfoV,QAAS,CACPgvD,MAAc,EACdyjC,UAAc,EACdC,QAAc,EACdJ,WAAc,YACdnF,SAAc,EAGdqH,aAAc,EAOdoB,OAAQ,OAQRrY,UAAW,KAEX2Y,WAAc,IAGhB7I,WAAY,CAEV5U,KAAM,CACJ1lE,MAAO,CACL,YACA,QACA,WAIJqb,MAAO,CACLrb,MAAO,CACL,cAIJ8Q,OAAQ,CACN9Q,MAAO,CACL,QAEFu6E,OAAQ,CACN,gBACA,qB,iCCpDRnvB,EAAOvzE,QAAU,CACfoV,QAAS,CACPgvD,MAAc,EACdyjC,UAAc,EACdC,QAAc,EACdJ,WAAc,YACdnF,SAAc,EAGdqH,aAAc,EAOdoB,OAAQ,OAQRrY,UAAW,KAEX2Y,WAAc,IAGhB7I,WAAY,CAEV5U,KAAM,CACJ1lE,MAAO,CACL,YACA,QACA,WAIJqb,MAAO,CACLrb,MAAO,CACL,aACA,OACA,QACA,UACA,KACA,aACA,WACA,OACA,YACA,cAIJ8Q,OAAQ,CACN9Q,MAAO,CACL,WACA,YACA,WACA,SACA,SACA,cACA,QACA,OACA,UACA,QAEFu6E,OAAQ,CACN,gBACA,WACA","file":"vendors~editor~preview.js?v=0e7d04021bc53d1471b5","sourcesContent":["// Utilities\n//\n'use strict';\n\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\n\nfunction isString(obj) { return _class(obj) === '[object String]'; }\n\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction has(object, key) {\n return _hasOwnProperty.call(object, key);\n}\n\n// Merge objects\n//\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n sources.forEach(function (source) {\n if (!source) { return; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be object');\n }\n\n Object.keys(source).forEach(function (key) {\n obj[key] = source[key];\n });\n });\n\n return obj;\n}\n\n// Remove element from array and put another array at those position.\n// Useful for some operations with tokens\nfunction arrayReplaceAt(src, pos, newElements) {\n return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction isValidEntityCode(c) {\n /*eslint no-bitwise:0*/\n // broken sequence\n if (c >= 0xD800 && c <= 0xDFFF) { return false; }\n // never used\n if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }\n if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }\n // control codes\n if (c >= 0x00 && c <= 0x08) { return false; }\n if (c === 0x0B) { return false; }\n if (c >= 0x0E && c <= 0x1F) { return false; }\n if (c >= 0x7F && c <= 0x9F) { return false; }\n // out of range\n if (c > 0x10FFFF) { return false; }\n return true;\n}\n\nfunction fromCodePoint(c) {\n /*eslint no-bitwise:0*/\n if (c > 0xffff) {\n c -= 0x10000;\n var surrogate1 = 0xd800 + (c >> 10),\n surrogate2 = 0xdc00 + (c & 0x3ff);\n\n return String.fromCharCode(surrogate1, surrogate2);\n }\n return String.fromCharCode(c);\n}\n\n\nvar UNESCAPE_MD_RE = /\\\\([!\"#$%&'()*+,\\-.\\/:;<=>?@[\\\\\\]^_`{|}~])/g;\nvar ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;\nvar UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');\n\nvar DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;\n\nvar entities = require('./entities');\n\nfunction replaceEntityPattern(match, name) {\n var code = 0;\n\n if (has(entities, name)) {\n return entities[name];\n }\n\n if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {\n code = name[1].toLowerCase() === 'x' ?\n parseInt(name.slice(2), 16)\n :\n parseInt(name.slice(1), 10);\n if (isValidEntityCode(code)) {\n return fromCodePoint(code);\n }\n }\n\n return match;\n}\n\n/*function replaceEntities(str) {\n if (str.indexOf('&') < 0) { return str; }\n\n return str.replace(ENTITY_RE, replaceEntityPattern);\n}*/\n\nfunction unescapeMd(str) {\n if (str.indexOf('\\\\') < 0) { return str; }\n return str.replace(UNESCAPE_MD_RE, '$1');\n}\n\nfunction unescapeAll(str) {\n if (str.indexOf('\\\\') < 0 && str.indexOf('&') < 0) { return str; }\n\n return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {\n if (escaped) { return escaped; }\n return replaceEntityPattern(match, entity);\n });\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar HTML_ESCAPE_TEST_RE = /[&<>\"]/;\nvar HTML_ESCAPE_REPLACE_RE = /[&<>\"]/g;\nvar HTML_REPLACEMENTS = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"'\n};\n\nfunction replaceUnsafeChar(ch) {\n return HTML_REPLACEMENTS[ch];\n}\n\nfunction escapeHtml(str) {\n if (HTML_ESCAPE_TEST_RE.test(str)) {\n return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);\n }\n return str;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar REGEXP_ESCAPE_RE = /[.?*+^$[\\]\\\\(){}|-]/g;\n\nfunction escapeRE(str) {\n return str.replace(REGEXP_ESCAPE_RE, '\\\\$&');\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction isSpace(code) {\n switch (code) {\n case 0x09:\n case 0x20:\n return true;\n }\n return false;\n}\n\n// Zs (unicode class) || [\\t\\f\\v\\r\\n]\nfunction isWhiteSpace(code) {\n if (code >= 0x2000 && code <= 0x200A) { return true; }\n switch (code) {\n case 0x09: // \\t\n case 0x0A: // \\n\n case 0x0B: // \\v\n case 0x0C: // \\f\n case 0x0D: // \\r\n case 0x20:\n case 0xA0:\n case 0x1680:\n case 0x202F:\n case 0x205F:\n case 0x3000:\n return true;\n }\n return false;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n/*eslint-disable max-len*/\nvar UNICODE_PUNCT_RE = require('uc.micro/categories/P/regex');\n\n// Currently without astral characters support.\nfunction isPunctChar(ch) {\n return UNICODE_PUNCT_RE.test(ch);\n}\n\n\n// Markdown ASCII punctuation characters.\n//\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\n//\n// Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.\n//\nfunction isMdAsciiPunct(ch) {\n switch (ch) {\n case 0x21/* ! */:\n case 0x22/* \" */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x27/* ' */:\n case 0x28/* ( */:\n case 0x29/* ) */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2C/* , */:\n case 0x2D/* - */:\n case 0x2E/* . */:\n case 0x2F/* / */:\n case 0x3A/* : */:\n case 0x3B/* ; */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x3F/* ? */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7C/* | */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true;\n default:\n return false;\n }\n}\n\n// Hepler to unify [reference labels].\n//\nfunction normalizeReference(str) {\n // use .toUpperCase() instead of .toLowerCase()\n // here to avoid a conflict with Object.prototype\n // members (most notably, `__proto__`)\n return str.trim().replace(/\\s+/g, ' ').toUpperCase();\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Re-export libraries commonly used in both markdown-it and its plugins,\n// so plugins won't have to depend on them explicitly, which reduces their\n// bundled size (e.g. a browser build).\n//\nexports.lib = {};\nexports.lib.mdurl = require('mdurl');\nexports.lib.ucmicro = require('uc.micro');\n\nexports.assign = assign;\nexports.isString = isString;\nexports.has = has;\nexports.unescapeMd = unescapeMd;\nexports.unescapeAll = unescapeAll;\nexports.isValidEntityCode = isValidEntityCode;\nexports.fromCodePoint = fromCodePoint;\n// exports.replaceEntities = replaceEntities;\nexports.escapeHtml = escapeHtml;\nexports.arrayReplaceAt = arrayReplaceAt;\nexports.isSpace = isSpace;\nexports.isWhiteSpace = isWhiteSpace;\nexports.isMdAsciiPunct = isMdAsciiPunct;\nexports.isPunctChar = isPunctChar;\nexports.escapeRE = escapeRE;\nexports.normalizeReference = normalizeReference;\n","import { liftTarget, canJoin, joinPoint, canSplit, ReplaceAroundStep, findWrapping } from 'prosemirror-transform';\nimport { Fragment, Slice } from 'prosemirror-model';\nimport { NodeSelection, Selection, TextSelection, AllSelection } from 'prosemirror-state';\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Delete the selection, if there is one.\nfunction deleteSelection(state, dispatch) {\n if (state.selection.empty) { return false }\n if (dispatch) { dispatch(state.tr.deleteSelection().scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// If the selection is empty and at the start of a textblock, try to\n// reduce the distance between that block and the one before it—if\n// there's a block directly before it that can be joined, join them.\n// If not, try to move the selected block closer to the next one in\n// the document structure by lifting it out of its parent or moving it\n// into a parent of the previous block. Will use the view for accurate\n// (bidi-aware) start-of-textblock detection if given.\nfunction joinBackward(state, dispatch, view) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || (view ? !view.endOfTextblock(\"backward\", state)\n : $cursor.parentOffset > 0))\n { return false }\n\n var $cut = findCutBefore($cursor);\n\n // If there is no node before this, try to lift\n if (!$cut) {\n var range = $cursor.blockRange(), target = range && liftTarget(range);\n if (target == null) { return false }\n if (dispatch) { dispatch(state.tr.lift(range, target).scrollIntoView()); }\n return true\n }\n\n var before = $cut.nodeBefore;\n // Apply the joining algorithm\n if (!before.type.spec.isolating && deleteBarrier(state, $cut, dispatch))\n { return true }\n\n // If the node below has no content and the node above is\n // selectable, delete the node below and select the one above.\n if ($cursor.parent.content.size == 0 &&\n (textblockAt(before, \"end\") || NodeSelection.isSelectable(before))) {\n if (dispatch) {\n var tr = state.tr.deleteRange($cursor.before(), $cursor.after());\n tr.setSelection(textblockAt(before, \"end\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1)\n : NodeSelection.create(tr.doc, $cut.pos - before.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true\n }\n\n // If the node before is an atom, delete it\n if (before.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch) { dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView()); }\n return true\n }\n\n return false\n}\n\nfunction textblockAt(node, side) {\n for (; node; node = (side == \"start\" ? node.firstChild : node.lastChild))\n { if (node.isTextblock) { return true } }\n return false\n}\n\n// :: (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// When the selection is empty and at the start of a textblock, select\n// the node before that textblock, if possible. This is intended to be\n// bound to keys like backspace, after\n// [`joinBackward`](#commands.joinBackward) or other deleting\n// commands, as a fall-back behavior when the schema doesn't allow\n// deletion at the selected point.\nfunction selectNodeBackward(state, dispatch, view) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || (view ? !view.endOfTextblock(\"backward\", state)\n : $cursor.parentOffset > 0))\n { return false }\n\n var $cut = findCutBefore($cursor), node = $cut && $cut.nodeBefore;\n if (!node || !NodeSelection.isSelectable(node)) { return false }\n if (dispatch)\n { dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView()); }\n return true\n}\n\nfunction findCutBefore($pos) {\n if (!$pos.parent.type.spec.isolating) { for (var i = $pos.depth - 1; i >= 0; i--) {\n if ($pos.index(i) > 0) { return $pos.doc.resolve($pos.before(i + 1)) }\n if ($pos.node(i).type.spec.isolating) { break }\n } }\n return null\n}\n\n// :: (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// If the selection is empty and the cursor is at the end of a\n// textblock, try to reduce or remove the boundary between that block\n// and the one after it, either by joining them or by moving the other\n// block closer to this one in the tree structure. Will use the view\n// for accurate start-of-textblock detection if given.\nfunction joinForward(state, dispatch, view) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || (view ? !view.endOfTextblock(\"forward\", state)\n : $cursor.parentOffset < $cursor.parent.content.size))\n { return false }\n\n var $cut = findCutAfter($cursor);\n\n // If there is no node after this, there's nothing to do\n if (!$cut) { return false }\n\n var after = $cut.nodeAfter;\n // Try the joining algorithm\n if (deleteBarrier(state, $cut, dispatch)) { return true }\n\n // If the node above has no content and the node below is\n // selectable, delete the node above and select the one below.\n if ($cursor.parent.content.size == 0 &&\n (textblockAt(after, \"start\") || NodeSelection.isSelectable(after))) {\n if (dispatch) {\n var tr = state.tr.deleteRange($cursor.before(), $cursor.after());\n tr.setSelection(textblockAt(after, \"start\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1)\n : NodeSelection.create(tr.doc, tr.mapping.map($cut.pos)));\n dispatch(tr.scrollIntoView());\n }\n return true\n }\n\n // If the next node is an atom, delete it\n if (after.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch) { dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView()); }\n return true\n }\n\n return false\n}\n\n// :: (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// When the selection is empty and at the end of a textblock, select\n// the node coming after that textblock, if possible. This is intended\n// to be bound to keys like delete, after\n// [`joinForward`](#commands.joinForward) and similar deleting\n// commands, to provide a fall-back behavior when the schema doesn't\n// allow deletion at the selected point.\nfunction selectNodeForward(state, dispatch, view) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || (view ? !view.endOfTextblock(\"forward\", state)\n : $cursor.parentOffset < $cursor.parent.content.size))\n { return false }\n\n var $cut = findCutAfter($cursor), node = $cut && $cut.nodeAfter;\n if (!node || !NodeSelection.isSelectable(node)) { return false }\n if (dispatch)\n { dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos)).scrollIntoView()); }\n return true\n}\n\nfunction findCutAfter($pos) {\n if (!$pos.parent.type.spec.isolating) { for (var i = $pos.depth - 1; i >= 0; i--) {\n var parent = $pos.node(i);\n if ($pos.index(i) + 1 < parent.childCount) { return $pos.doc.resolve($pos.after(i + 1)) }\n if (parent.type.spec.isolating) { break }\n } }\n return null\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Join the selected block or, if there is a text selection, the\n// closest ancestor block of the selection that can be joined, with\n// the sibling above it.\nfunction joinUp(state, dispatch) {\n var sel = state.selection, nodeSel = sel instanceof NodeSelection, point;\n if (nodeSel) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.from)) { return false }\n point = sel.from;\n } else {\n point = joinPoint(state.doc, sel.from, -1);\n if (point == null) { return false }\n }\n if (dispatch) {\n var tr = state.tr.join(point);\n if (nodeSel) { tr.setSelection(NodeSelection.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize)); }\n dispatch(tr.scrollIntoView());\n }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Join the selected block, or the closest ancestor of the selection\n// that can be joined, with the sibling after it.\nfunction joinDown(state, dispatch) {\n var sel = state.selection, point;\n if (sel instanceof NodeSelection) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.to)) { return false }\n point = sel.to;\n } else {\n point = joinPoint(state.doc, sel.to, 1);\n if (point == null) { return false }\n }\n if (dispatch)\n { dispatch(state.tr.join(point).scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Lift the selected block, or the closest ancestor block of the\n// selection that can be lifted, out of its parent node.\nfunction lift(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to), target = range && liftTarget(range);\n if (target == null) { return false }\n if (dispatch) { dispatch(state.tr.lift(range, target).scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// If the selection is in a node whose type has a truthy\n// [`code`](#model.NodeSpec.code) property in its spec, replace the\n// selection with a newline character.\nfunction newlineInCode(state, dispatch) {\n var ref = state.selection;\n var $head = ref.$head;\n var $anchor = ref.$anchor;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) { return false }\n if (dispatch) { dispatch(state.tr.insertText(\"\\n\").scrollIntoView()); }\n return true\n}\n\nfunction defaultBlockAt(match) {\n for (var i = 0; i < match.edgeCount; i++) {\n var ref = match.edge(i);\n var type = ref.type;\n if (type.isTextblock && !type.hasRequiredAttrs()) { return type }\n }\n return null\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// When the selection is in a node with a truthy\n// [`code`](#model.NodeSpec.code) property in its spec, create a\n// default block after the code block, and move the cursor there.\nfunction exitCode(state, dispatch) {\n var ref = state.selection;\n var $head = ref.$head;\n var $anchor = ref.$anchor;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) { return false }\n var above = $head.node(-1), after = $head.indexAfter(-1), type = defaultBlockAt(above.contentMatchAt(after));\n if (!above.canReplaceWith(after, after, type)) { return false }\n if (dispatch) {\n var pos = $head.after(), tr = state.tr.replaceWith(pos, pos, type.createAndFill());\n tr.setSelection(Selection.near(tr.doc.resolve(pos), 1));\n dispatch(tr.scrollIntoView());\n }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// If a block node is selected, create an empty paragraph before (if\n// it is its parent's first child) or after it.\nfunction createParagraphNear(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n if ($from.parent.inlineContent || $to.parent.inlineContent) { return false }\n var type = defaultBlockAt($from.parent.contentMatchAt($to.indexAfter()));\n if (!type || !type.isTextblock) { return false }\n if (dispatch) {\n var side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;\n var tr = state.tr.insert(side, type.createAndFill());\n tr.setSelection(TextSelection.create(tr.doc, side + 1));\n dispatch(tr.scrollIntoView());\n }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// If the cursor is in an empty textblock that can be lifted, lift the\n// block.\nfunction liftEmptyBlock(state, dispatch) {\n var ref = state.selection;\n var $cursor = ref.$cursor;\n if (!$cursor || $cursor.parent.content.size) { return false }\n if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {\n var before = $cursor.before();\n if (canSplit(state.doc, before)) {\n if (dispatch) { dispatch(state.tr.split(before).scrollIntoView()); }\n return true\n }\n }\n var range = $cursor.blockRange(), target = range && liftTarget(range);\n if (target == null) { return false }\n if (dispatch) { dispatch(state.tr.lift(range, target).scrollIntoView()); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Split the parent block of the selection. If the selection is a text\n// selection, also delete its content.\nfunction splitBlock(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {\n if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) { return false }\n if (dispatch) { dispatch(state.tr.split($from.pos).scrollIntoView()); }\n return true\n }\n\n if (!$from.parent.isBlock) { return false }\n\n if (dispatch) {\n var atEnd = $to.parentOffset == $to.parent.content.size;\n var tr = state.tr;\n if (state.selection instanceof TextSelection) { tr.deleteSelection(); }\n var deflt = $from.depth == 0 ? null : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));\n var types = atEnd && deflt ? [{type: deflt}] : null;\n var can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);\n if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt && [{type: deflt}])) {\n types = [{type: deflt}];\n can = true;\n }\n if (can) {\n tr.split(tr.mapping.map($from.pos), 1, types);\n if (!atEnd && !$from.parentOffset && $from.parent.type != deflt &&\n $from.node(-1).canReplace($from.index(-1), $from.indexAfter(-1), Fragment.from(deflt.create(), $from.parent)))\n { tr.setNodeMarkup(tr.mapping.map($from.before()), deflt); }\n }\n dispatch(tr.scrollIntoView());\n }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Acts like [`splitBlock`](#commands.splitBlock), but without\n// resetting the set of active marks at the cursor.\nfunction splitBlockKeepMarks(state, dispatch) {\n return splitBlock(state, dispatch && (function (tr) {\n var marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n if (marks) { tr.ensureMarks(marks); }\n dispatch(tr);\n }))\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Move the selection to the node wrapping the current selection, if\n// any. (Will not select the document node.)\nfunction selectParentNode(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var to = ref.to;\n var pos;\n var same = $from.sharedDepth(to);\n if (same == 0) { return false }\n pos = $from.before(same);\n if (dispatch) { dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos))); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Select the whole document.\nfunction selectAll(state, dispatch) {\n if (dispatch) { dispatch(state.tr.setSelection(new AllSelection(state.doc))); }\n return true\n}\n\nfunction joinMaybeClear(state, $pos, dispatch) {\n var before = $pos.nodeBefore, after = $pos.nodeAfter, index = $pos.index();\n if (!before || !after || !before.type.compatibleContent(after.type)) { return false }\n if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {\n if (dispatch) { dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView()); }\n return true\n }\n if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos)))\n { return false }\n if (dispatch)\n { dispatch(state.tr\n .clearIncompatible($pos.pos, before.type, before.contentMatchAt(before.childCount))\n .join($pos.pos)\n .scrollIntoView()); }\n return true\n}\n\nfunction deleteBarrier(state, $cut, dispatch) {\n var before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match;\n if (before.type.spec.isolating || after.type.spec.isolating) { return false }\n if (joinMaybeClear(state, $cut, dispatch)) { return true }\n\n if ($cut.parent.canReplace($cut.index(), $cut.index() + 1) &&\n (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) &&\n match.matchType(conn[0] || after.type).validEnd) {\n if (dispatch) {\n var end = $cut.pos + after.nodeSize, wrap = Fragment.empty;\n for (var i = conn.length - 1; i >= 0; i--)\n { wrap = Fragment.from(conn[i].create(null, wrap)); }\n wrap = Fragment.from(before.copy(wrap));\n var tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap, 1, 0), conn.length, true));\n var joinAt = end + 2 * conn.length;\n if (canJoin(tr.doc, joinAt)) { tr.join(joinAt); }\n dispatch(tr.scrollIntoView());\n }\n return true\n }\n\n var selAfter = Selection.findFrom($cut, 1);\n var range = selAfter && selAfter.$from.blockRange(selAfter.$to), target = range && liftTarget(range);\n if (target != null && target >= $cut.depth) {\n if (dispatch) { dispatch(state.tr.lift(range, target).scrollIntoView()); }\n return true\n }\n\n return false\n}\n\n// Parameterized commands\n\n// :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Wrap the selection in a node of the given type with the given\n// attributes.\nfunction wrapIn(nodeType, attrs) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to), wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping) { return false }\n if (dispatch) { dispatch(state.tr.wrap(range, wrapping).scrollIntoView()); }\n return true\n }\n}\n\n// :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Returns a command that tries to set the selected textblocks to the\n// given node type with the given attributes.\nfunction setBlockType(nodeType, attrs) {\n return function(state, dispatch) {\n var ref = state.selection;\n var from = ref.from;\n var to = ref.to;\n var applicable = false;\n state.doc.nodesBetween(from, to, function (node, pos) {\n if (applicable) { return false }\n if (!node.isTextblock || node.hasMarkup(nodeType, attrs)) { return }\n if (node.type == nodeType) {\n applicable = true;\n } else {\n var $pos = state.doc.resolve(pos), index = $pos.index();\n applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);\n }\n });\n if (!applicable) { return false }\n if (dispatch) { dispatch(state.tr.setBlockType(from, to, nodeType, attrs).scrollIntoView()); }\n return true\n }\n}\n\nfunction markApplies(doc, ranges, type) {\n var loop = function ( i ) {\n var ref = ranges[i];\n var $from = ref.$from;\n var $to = ref.$to;\n var can = $from.depth == 0 ? doc.type.allowsMarkType(type) : false;\n doc.nodesBetween($from.pos, $to.pos, function (node) {\n if (can) { return false }\n can = node.inlineContent && node.type.allowsMarkType(type);\n });\n if (can) { return { v: true } }\n };\n\n for (var i = 0; i < ranges.length; i++) {\n var returned = loop( i );\n\n if ( returned ) return returned.v;\n }\n return false\n}\n\n// :: (MarkType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Create a command function that toggles the given mark with the\n// given attributes. Will return `false` when the current selection\n// doesn't support that mark. This will remove the mark if any marks\n// of that type exist in the selection, or add it otherwise. If the\n// selection is empty, this applies to the [stored\n// marks](#state.EditorState.storedMarks) instead of a range of the\n// document.\nfunction toggleMark(markType, attrs) {\n return function(state, dispatch) {\n var ref = state.selection;\n var empty = ref.empty;\n var $cursor = ref.$cursor;\n var ranges = ref.ranges;\n if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType)) { return false }\n if (dispatch) {\n if ($cursor) {\n if (markType.isInSet(state.storedMarks || $cursor.marks()))\n { dispatch(state.tr.removeStoredMark(markType)); }\n else\n { dispatch(state.tr.addStoredMark(markType.create(attrs))); }\n } else {\n var has = false, tr = state.tr;\n for (var i = 0; !has && i < ranges.length; i++) {\n var ref$1 = ranges[i];\n var $from = ref$1.$from;\n var $to = ref$1.$to;\n has = state.doc.rangeHasMark($from.pos, $to.pos, markType);\n }\n for (var i$1 = 0; i$1 < ranges.length; i$1++) {\n var ref$2 = ranges[i$1];\n var $from$1 = ref$2.$from;\n var $to$1 = ref$2.$to;\n if (has) { tr.removeMark($from$1.pos, $to$1.pos, markType); }\n else { tr.addMark($from$1.pos, $to$1.pos, markType.create(attrs)); }\n }\n dispatch(tr.scrollIntoView());\n }\n }\n return true\n }\n}\n\nfunction wrapDispatchForJoin(dispatch, isJoinable) {\n return function (tr) {\n if (!tr.isGeneric) { return dispatch(tr) }\n\n var ranges = [];\n for (var i = 0; i < tr.mapping.maps.length; i++) {\n var map = tr.mapping.maps[i];\n for (var j = 0; j < ranges.length; j++)\n { ranges[j] = map.map(ranges[j]); }\n map.forEach(function (_s, _e, from, to) { return ranges.push(from, to); });\n }\n\n // Figure out which joinable points exist inside those ranges,\n // by checking all node boundaries in their parent nodes.\n var joinable = [];\n for (var i$1 = 0; i$1 < ranges.length; i$1 += 2) {\n var from = ranges[i$1], to = ranges[i$1 + 1];\n var $from = tr.doc.resolve(from), depth = $from.sharedDepth(to), parent = $from.node(depth);\n for (var index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {\n var after = parent.maybeChild(index);\n if (!after) { break }\n if (index && joinable.indexOf(pos) == -1) {\n var before = parent.child(index - 1);\n if (before.type == after.type && isJoinable(before, after))\n { joinable.push(pos); }\n }\n pos += after.nodeSize;\n }\n }\n // Join the joinable points\n joinable.sort(function (a, b) { return a - b; });\n for (var i$2 = joinable.length - 1; i$2 >= 0; i$2--) {\n if (canJoin(tr.doc, joinable[i$2])) { tr.join(joinable[i$2]); }\n }\n dispatch(tr);\n }\n}\n\n// :: ((state: EditorState, ?(tr: Transaction)) → bool, union<(before: Node, after: Node) → bool, [string]>) → (state: EditorState, ?(tr: Transaction)) → bool\n// Wrap a command so that, when it produces a transform that causes\n// two joinable nodes to end up next to each other, those are joined.\n// Nodes are considered joinable when they are of the same type and\n// when the `isJoinable` predicate returns true for them or, if an\n// array of strings was passed, if their node type name is in that\n// array.\nfunction autoJoin(command, isJoinable) {\n if (Array.isArray(isJoinable)) {\n var types = isJoinable;\n isJoinable = function (node) { return types.indexOf(node.type.name) > -1; };\n }\n return function (state, dispatch) { return command(state, dispatch && wrapDispatchForJoin(dispatch, isJoinable)); }\n}\n\n// :: (...[(EditorState, ?(tr: Transaction), ?EditorView) → bool]) → (EditorState, ?(tr: Transaction), ?EditorView) → bool\n// Combine a number of command functions into a single function (which\n// calls them one by one until one returns true).\nfunction chainCommands() {\n var commands = [], len = arguments.length;\n while ( len-- ) commands[ len ] = arguments[ len ];\n\n return function(state, dispatch, view) {\n for (var i = 0; i < commands.length; i++)\n { if (commands[i](state, dispatch, view)) { return true } }\n return false\n }\n}\n\nvar backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward);\nvar del = chainCommands(deleteSelection, joinForward, selectNodeForward);\n\n// :: Object\n// A basic keymap containing bindings not specific to any schema.\n// Binds the following keys (when multiple commands are listed, they\n// are chained with [`chainCommands`](#commands.chainCommands)):\n//\n// * **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`\n// * **Mod-Enter** to `exitCode`\n// * **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`\n// * **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n// * **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n// * **Mod-a** to `selectAll`\nvar pcBaseKeymap = {\n \"Enter\": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock),\n \"Mod-Enter\": exitCode,\n \"Backspace\": backspace,\n \"Mod-Backspace\": backspace,\n \"Delete\": del,\n \"Mod-Delete\": del,\n \"Mod-a\": selectAll\n};\n\n// :: Object\n// A copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,\n// **Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and\n// **Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like\n// Ctrl-Delete.\nvar macBaseKeymap = {\n \"Ctrl-h\": pcBaseKeymap[\"Backspace\"],\n \"Alt-Backspace\": pcBaseKeymap[\"Mod-Backspace\"],\n \"Ctrl-d\": pcBaseKeymap[\"Delete\"],\n \"Ctrl-Alt-Backspace\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-Delete\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-d\": pcBaseKeymap[\"Mod-Delete\"]\n};\nfor (var key in pcBaseKeymap) { macBaseKeymap[key] = pcBaseKeymap[key]; }\n\n// declare global: os, navigator\nvar mac = typeof navigator != \"undefined\" ? /Mac/.test(navigator.platform)\n : typeof os != \"undefined\" ? os.platform() == \"darwin\" : false;\n\n// :: Object\n// Depending on the detected platform, this will hold\n// [`pcBasekeymap`](#commands.pcBaseKeymap) or\n// [`macBaseKeymap`](#commands.macBaseKeymap).\nvar baseKeymap = mac ? macBaseKeymap : pcBaseKeymap;\n\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, setBlockType, splitBlock, splitBlockKeepMarks, toggleMark, wrapIn };\n//# sourceMappingURL=index.es.js.map\n","import { Slice, Fragment, Mark, Node } from 'prosemirror-model';\nimport { ReplaceStep, ReplaceAroundStep, Transform } from 'prosemirror-transform';\n\nvar classesById = Object.create(null);\n\n// ::- Superclass for editor selections. Every selection type should\n// extend this. Should not be instantiated directly.\nvar Selection = function Selection($anchor, $head, ranges) {\n // :: [SelectionRange]\n // The ranges covered by the selection.\n this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];\n // :: ResolvedPos\n // The resolved anchor of the selection (the side that stays in\n // place when the selection is modified).\n this.$anchor = $anchor;\n // :: ResolvedPos\n // The resolved head of the selection (the side that moves when\n // the selection is modified).\n this.$head = $head;\n};\n\nvar prototypeAccessors = { anchor: { configurable: true },head: { configurable: true },from: { configurable: true },to: { configurable: true },$from: { configurable: true },$to: { configurable: true },empty: { configurable: true } };\n\n// :: number\n// The selection's anchor, as an unresolved position.\nprototypeAccessors.anchor.get = function () { return this.$anchor.pos };\n\n// :: number\n// The selection's head.\nprototypeAccessors.head.get = function () { return this.$head.pos };\n\n// :: number\n// The lower bound of the selection's main range.\nprototypeAccessors.from.get = function () { return this.$from.pos };\n\n// :: number\n// The upper bound of the selection's main range.\nprototypeAccessors.to.get = function () { return this.$to.pos };\n\n// :: ResolvedPos\n// The resolved lowerbound of the selection's main range.\nprototypeAccessors.$from.get = function () {\n return this.ranges[0].$from\n};\n\n// :: ResolvedPos\n// The resolved upper bound of the selection's main range.\nprototypeAccessors.$to.get = function () {\n return this.ranges[0].$to\n};\n\n// :: bool\n// Indicates whether the selection contains any content.\nprototypeAccessors.empty.get = function () {\n var ranges = this.ranges;\n for (var i = 0; i < ranges.length; i++)\n { if (ranges[i].$from.pos != ranges[i].$to.pos) { return false } }\n return true\n};\n\n// eq:: (Selection) → bool\n// Test whether the selection is the same as another selection.\n\n// map:: (doc: Node, mapping: Mappable) → Selection\n// Map this selection through a [mappable](#transform.Mappable) thing. `doc`\n// should be the new document to which we are mapping.\n\n// :: () → Slice\n// Get the content of this selection as a slice.\nSelection.prototype.content = function content () {\n return this.$from.node(0).slice(this.from, this.to, true)\n};\n\n// :: (Transaction, ?Slice)\n// Replace the selection with a slice or, if no slice is given,\n// delete the selection. Will append to the given transaction.\nSelection.prototype.replace = function replace (tr, content) {\n if ( content === void 0 ) content = Slice.empty;\n\n // Put the new selection at the position after the inserted\n // content. When that ended in an inline node, search backwards,\n // to get the position after that node. If not, search forward.\n var lastNode = content.content.lastChild, lastParent = null;\n for (var i = 0; i < content.openEnd; i++) {\n lastParent = lastNode;\n lastNode = lastNode.lastChild;\n }\n\n var mapFrom = tr.steps.length, ranges = this.ranges;\n for (var i$1 = 0; i$1 < ranges.length; i$1++) {\n var ref = ranges[i$1];\n var $from = ref.$from;\n var $to = ref.$to;\n var mapping = tr.mapping.slice(mapFrom);\n tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i$1 ? Slice.empty : content);\n if (i$1 == 0)\n { selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1); }\n }\n};\n\n// :: (Transaction, Node)\n// Replace the selection with the given node, appending the changes\n// to the given transaction.\nSelection.prototype.replaceWith = function replaceWith (tr, node) {\n var mapFrom = tr.steps.length, ranges = this.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var ref = ranges[i];\n var $from = ref.$from;\n var $to = ref.$to;\n var mapping = tr.mapping.slice(mapFrom);\n var from = mapping.map($from.pos), to = mapping.map($to.pos);\n if (i) {\n tr.deleteRange(from, to);\n } else {\n tr.replaceRangeWith(from, to, node);\n selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);\n }\n }\n};\n\n// toJSON:: () → Object\n// Convert the selection to a JSON representation. When implementing\n// this for a custom selection class, make sure to give the object a\n// `type` property whose value matches the ID under which you\n// [registered](#state.Selection^jsonID) your class.\n\n// :: (ResolvedPos, number, ?bool) → ?Selection\n// Find a valid cursor or leaf node selection starting at the given\n// position and searching back if `dir` is negative, and forward if\n// positive. When `textOnly` is true, only consider cursor\n// selections. Will return null when no valid selection position is\n// found.\nSelection.findFrom = function findFrom ($pos, dir, textOnly) {\n var inner = $pos.parent.inlineContent ? new TextSelection($pos)\n : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);\n if (inner) { return inner }\n\n for (var depth = $pos.depth - 1; depth >= 0; depth--) {\n var found = dir < 0\n ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly)\n : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);\n if (found) { return found }\n }\n};\n\n// :: (ResolvedPos, ?number) → Selection\n// Find a valid cursor or leaf node selection near the given\n// position. Searches forward first by default, but if `bias` is\n// negative, it will search backwards first.\nSelection.near = function near ($pos, bias) {\n if ( bias === void 0 ) bias = 1;\n\n return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0))\n};\n\n// :: (Node) → Selection\n// Find the cursor or leaf node selection closest to the start of\n// the given document. Will return an\n// [`AllSelection`](#state.AllSelection) if no valid position\n// exists.\nSelection.atStart = function atStart (doc) {\n return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc)\n};\n\n// :: (Node) → Selection\n// Find the cursor or leaf node selection closest to the end of the\n// given document.\nSelection.atEnd = function atEnd (doc) {\n return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc)\n};\n\n// :: (Node, Object) → Selection\n// Deserialize the JSON representation of a selection. Must be\n// implemented for custom classes (as a static class method).\nSelection.fromJSON = function fromJSON (doc, json) {\n if (!json || !json.type) { throw new RangeError(\"Invalid input for Selection.fromJSON\") }\n var cls = classesById[json.type];\n if (!cls) { throw new RangeError((\"No selection type \" + (json.type) + \" defined\")) }\n return cls.fromJSON(doc, json)\n};\n\n// :: (string, constructor<Selection>)\n// To be able to deserialize selections from JSON, custom selection\n// classes must register themselves with an ID string, so that they\n// can be disambiguated. Try to pick something that's unlikely to\n// clash with classes from other modules.\nSelection.jsonID = function jsonID (id, selectionClass) {\n if (id in classesById) { throw new RangeError(\"Duplicate use of selection JSON ID \" + id) }\n classesById[id] = selectionClass;\n selectionClass.prototype.jsonID = id;\n return selectionClass\n};\n\n// :: () → SelectionBookmark\n// Get a [bookmark](#state.SelectionBookmark) for this selection,\n// which is a value that can be mapped without having access to a\n// current document, and later resolved to a real selection for a\n// given document again. (This is used mostly by the history to\n// track and restore old selections.) The default implementation of\n// this method just converts the selection to a text selection and\n// returns the bookmark for that.\nSelection.prototype.getBookmark = function getBookmark () {\n return TextSelection.between(this.$anchor, this.$head).getBookmark()\n};\n\nObject.defineProperties( Selection.prototype, prototypeAccessors );\n\n// :: bool\n// Controls whether, when a selection of this type is active in the\n// browser, the selected range should be visible to the user. Defaults\n// to `true`.\nSelection.prototype.visible = true;\n\n// SelectionBookmark:: interface\n// A lightweight, document-independent representation of a selection.\n// You can define a custom bookmark type for a custom selection class\n// to make the history handle it well.\n//\n// map:: (mapping: Mapping) → SelectionBookmark\n// Map the bookmark through a set of changes.\n//\n// resolve:: (doc: Node) → Selection\n// Resolve the bookmark to a real selection again. This may need to\n// do some error checking and may fall back to a default (usually\n// [`TextSelection.between`](#state.TextSelection^between)) if\n// mapping made the bookmark invalid.\n\n// ::- Represents a selected range in a document.\nvar SelectionRange = function SelectionRange($from, $to) {\n // :: ResolvedPos\n // The lower bound of the range.\n this.$from = $from;\n // :: ResolvedPos\n // The upper bound of the range.\n this.$to = $to;\n};\n\n// ::- A text selection represents a classical editor selection, with\n// a head (the moving side) and anchor (immobile side), both of which\n// point into textblock nodes. It can be empty (a regular cursor\n// position).\nvar TextSelection = /*@__PURE__*/(function (Selection) {\n function TextSelection($anchor, $head) {\n if ( $head === void 0 ) $head = $anchor;\n\n Selection.call(this, $anchor, $head);\n }\n\n if ( Selection ) TextSelection.__proto__ = Selection;\n TextSelection.prototype = Object.create( Selection && Selection.prototype );\n TextSelection.prototype.constructor = TextSelection;\n\n var prototypeAccessors$1 = { $cursor: { configurable: true } };\n\n // :: ?ResolvedPos\n // Returns a resolved position if this is a cursor selection (an\n // empty text selection), and null otherwise.\n prototypeAccessors$1.$cursor.get = function () { return this.$anchor.pos == this.$head.pos ? this.$head : null };\n\n TextSelection.prototype.map = function map (doc, mapping) {\n var $head = doc.resolve(mapping.map(this.head));\n if (!$head.parent.inlineContent) { return Selection.near($head) }\n var $anchor = doc.resolve(mapping.map(this.anchor));\n return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head)\n };\n\n TextSelection.prototype.replace = function replace (tr, content) {\n if ( content === void 0 ) content = Slice.empty;\n\n Selection.prototype.replace.call(this, tr, content);\n if (content == Slice.empty) {\n var marks = this.$from.marksAcross(this.$to);\n if (marks) { tr.ensureMarks(marks); }\n }\n };\n\n TextSelection.prototype.eq = function eq (other) {\n return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head\n };\n\n TextSelection.prototype.getBookmark = function getBookmark () {\n return new TextBookmark(this.anchor, this.head)\n };\n\n TextSelection.prototype.toJSON = function toJSON () {\n return {type: \"text\", anchor: this.anchor, head: this.head}\n };\n\n TextSelection.fromJSON = function fromJSON (doc, json) {\n if (typeof json.anchor != \"number\" || typeof json.head != \"number\")\n { throw new RangeError(\"Invalid input for TextSelection.fromJSON\") }\n return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head))\n };\n\n // :: (Node, number, ?number) → TextSelection\n // Create a text selection from non-resolved positions.\n TextSelection.create = function create (doc, anchor, head) {\n if ( head === void 0 ) head = anchor;\n\n var $anchor = doc.resolve(anchor);\n return new this($anchor, head == anchor ? $anchor : doc.resolve(head))\n };\n\n // :: (ResolvedPos, ResolvedPos, ?number) → Selection\n // Return a text selection that spans the given positions or, if\n // they aren't text positions, find a text selection near them.\n // `bias` determines whether the method searches forward (default)\n // or backwards (negative number) first. Will fall back to calling\n // [`Selection.near`](#state.Selection^near) when the document\n // doesn't contain a valid text position.\n TextSelection.between = function between ($anchor, $head, bias) {\n var dPos = $anchor.pos - $head.pos;\n if (!bias || dPos) { bias = dPos >= 0 ? 1 : -1; }\n if (!$head.parent.inlineContent) {\n var found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);\n if (found) { $head = found.$head; }\n else { return Selection.near($head, bias) }\n }\n if (!$anchor.parent.inlineContent) {\n if (dPos == 0) {\n $anchor = $head;\n } else {\n $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;\n if (($anchor.pos < $head.pos) != (dPos < 0)) { $anchor = $head; }\n }\n }\n return new TextSelection($anchor, $head)\n };\n\n Object.defineProperties( TextSelection.prototype, prototypeAccessors$1 );\n\n return TextSelection;\n}(Selection));\n\nSelection.jsonID(\"text\", TextSelection);\n\nvar TextBookmark = function TextBookmark(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n};\nTextBookmark.prototype.map = function map (mapping) {\n return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head))\n};\nTextBookmark.prototype.resolve = function resolve (doc) {\n return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head))\n};\n\n// ::- A node selection is a selection that points at a single node.\n// All nodes marked [selectable](#model.NodeSpec.selectable) can be\n// the target of a node selection. In such a selection, `from` and\n// `to` point directly before and after the selected node, `anchor`\n// equals `from`, and `head` equals `to`..\nvar NodeSelection = /*@__PURE__*/(function (Selection) {\n function NodeSelection($pos) {\n var node = $pos.nodeAfter;\n var $end = $pos.node(0).resolve($pos.pos + node.nodeSize);\n Selection.call(this, $pos, $end);\n // :: Node The selected node.\n this.node = node;\n }\n\n if ( Selection ) NodeSelection.__proto__ = Selection;\n NodeSelection.prototype = Object.create( Selection && Selection.prototype );\n NodeSelection.prototype.constructor = NodeSelection;\n\n NodeSelection.prototype.map = function map (doc, mapping) {\n var ref = mapping.mapResult(this.anchor);\n var deleted = ref.deleted;\n var pos = ref.pos;\n var $pos = doc.resolve(pos);\n if (deleted) { return Selection.near($pos) }\n return new NodeSelection($pos)\n };\n\n NodeSelection.prototype.content = function content () {\n return new Slice(Fragment.from(this.node), 0, 0)\n };\n\n NodeSelection.prototype.eq = function eq (other) {\n return other instanceof NodeSelection && other.anchor == this.anchor\n };\n\n NodeSelection.prototype.toJSON = function toJSON () {\n return {type: \"node\", anchor: this.anchor}\n };\n\n NodeSelection.prototype.getBookmark = function getBookmark () { return new NodeBookmark(this.anchor) };\n\n NodeSelection.fromJSON = function fromJSON (doc, json) {\n if (typeof json.anchor != \"number\")\n { throw new RangeError(\"Invalid input for NodeSelection.fromJSON\") }\n return new NodeSelection(doc.resolve(json.anchor))\n };\n\n // :: (Node, number) → NodeSelection\n // Create a node selection from non-resolved positions.\n NodeSelection.create = function create (doc, from) {\n return new this(doc.resolve(from))\n };\n\n // :: (Node) → bool\n // Determines whether the given node may be selected as a node\n // selection.\n NodeSelection.isSelectable = function isSelectable (node) {\n return !node.isText && node.type.spec.selectable !== false\n };\n\n return NodeSelection;\n}(Selection));\n\nNodeSelection.prototype.visible = false;\n\nSelection.jsonID(\"node\", NodeSelection);\n\nvar NodeBookmark = function NodeBookmark(anchor) {\n this.anchor = anchor;\n};\nNodeBookmark.prototype.map = function map (mapping) {\n var ref = mapping.mapResult(this.anchor);\n var deleted = ref.deleted;\n var pos = ref.pos;\n return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos)\n};\nNodeBookmark.prototype.resolve = function resolve (doc) {\n var $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;\n if (node && NodeSelection.isSelectable(node)) { return new NodeSelection($pos) }\n return Selection.near($pos)\n};\n\n// ::- A selection type that represents selecting the whole document\n// (which can not necessarily be expressed with a text selection, when\n// there are for example leaf block nodes at the start or end of the\n// document).\nvar AllSelection = /*@__PURE__*/(function (Selection) {\n function AllSelection(doc) {\n Selection.call(this, doc.resolve(0), doc.resolve(doc.content.size));\n }\n\n if ( Selection ) AllSelection.__proto__ = Selection;\n AllSelection.prototype = Object.create( Selection && Selection.prototype );\n AllSelection.prototype.constructor = AllSelection;\n\n AllSelection.prototype.replace = function replace (tr, content) {\n if ( content === void 0 ) content = Slice.empty;\n\n if (content == Slice.empty) {\n tr.delete(0, tr.doc.content.size);\n var sel = Selection.atStart(tr.doc);\n if (!sel.eq(tr.selection)) { tr.setSelection(sel); }\n } else {\n Selection.prototype.replace.call(this, tr, content);\n }\n };\n\n AllSelection.prototype.toJSON = function toJSON () { return {type: \"all\"} };\n\n AllSelection.fromJSON = function fromJSON (doc) { return new AllSelection(doc) };\n\n AllSelection.prototype.map = function map (doc) { return new AllSelection(doc) };\n\n AllSelection.prototype.eq = function eq (other) { return other instanceof AllSelection };\n\n AllSelection.prototype.getBookmark = function getBookmark () { return AllBookmark };\n\n return AllSelection;\n}(Selection));\n\nSelection.jsonID(\"all\", AllSelection);\n\nvar AllBookmark = {\n map: function map() { return this },\n resolve: function resolve(doc) { return new AllSelection(doc) }\n};\n\n// FIXME we'll need some awareness of text direction when scanning for selections\n\n// Try to find a selection inside the given node. `pos` points at the\n// position where the search starts. When `text` is true, only return\n// text selections.\nfunction findSelectionIn(doc, node, pos, index, dir, text) {\n if (node.inlineContent) { return TextSelection.create(doc, pos) }\n for (var i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {\n var child = node.child(i);\n if (!child.isAtom) {\n var inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);\n if (inner) { return inner }\n } else if (!text && NodeSelection.isSelectable(child)) {\n return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0))\n }\n pos += child.nodeSize * dir;\n }\n}\n\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n var last = tr.steps.length - 1;\n if (last < startLen) { return }\n var step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) { return }\n var map = tr.mapping.maps[last], end;\n map.forEach(function (_from, _to, _newFrom, newTo) { if (end == null) { end = newTo; } });\n tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\n\nvar UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;\n\n// ::- An editor state transaction, which can be applied to a state to\n// create an updated state. Use\n// [`EditorState.tr`](#state.EditorState.tr) to create an instance.\n//\n// Transactions track changes to the document (they are a subclass of\n// [`Transform`](#transform.Transform)), but also other state changes,\n// like selection updates and adjustments of the set of [stored\n// marks](#state.EditorState.storedMarks). In addition, you can store\n// metadata properties in a transaction, which are extra pieces of\n// information that client code or plugins can use to describe what a\n// transacion represents, so that they can update their [own\n// state](#state.StateField) accordingly.\n//\n// The [editor view](#view.EditorView) uses a few metadata properties:\n// it will attach a property `\"pointer\"` with the value `true` to\n// selection transactions directly caused by mouse or touch input, and\n// a `\"uiEvent\"` property of that may be `\"paste\"`, `\"cut\"`, or `\"drop\"`.\nvar Transaction = /*@__PURE__*/(function (Transform) {\n function Transaction(state) {\n Transform.call(this, state.doc);\n // :: number\n // The timestamp associated with this transaction, in the same\n // format as `Date.now()`.\n this.time = Date.now();\n this.curSelection = state.selection;\n // The step count for which the current selection is valid.\n this.curSelectionFor = 0;\n // :: ?[Mark]\n // The stored marks set by this transaction, if any.\n this.storedMarks = state.storedMarks;\n // Bitfield to track which aspects of the state were updated by\n // this transaction.\n this.updated = 0;\n // Object used to store metadata properties for the transaction.\n this.meta = Object.create(null);\n }\n\n if ( Transform ) Transaction.__proto__ = Transform;\n Transaction.prototype = Object.create( Transform && Transform.prototype );\n Transaction.prototype.constructor = Transaction;\n\n var prototypeAccessors = { selection: { configurable: true },selectionSet: { configurable: true },storedMarksSet: { configurable: true },isGeneric: { configurable: true },scrolledIntoView: { configurable: true } };\n\n // :: Selection\n // The transaction's current selection. This defaults to the editor\n // selection [mapped](#state.Selection.map) through the steps in the\n // transaction, but can be overwritten with\n // [`setSelection`](#state.Transaction.setSelection).\n prototypeAccessors.selection.get = function () {\n if (this.curSelectionFor < this.steps.length) {\n this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));\n this.curSelectionFor = this.steps.length;\n }\n return this.curSelection\n };\n\n // :: (Selection) → Transaction\n // Update the transaction's current selection. Will determine the\n // selection that the editor gets when the transaction is applied.\n Transaction.prototype.setSelection = function setSelection (selection) {\n if (selection.$from.doc != this.doc)\n { throw new RangeError(\"Selection passed to setSelection must point at the current document\") }\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this\n };\n\n // :: bool\n // Whether the selection was explicitly updated by this transaction.\n prototypeAccessors.selectionSet.get = function () {\n return (this.updated & UPDATED_SEL) > 0\n };\n\n // :: (?[Mark]) → Transaction\n // Set the current stored marks.\n Transaction.prototype.setStoredMarks = function setStoredMarks (marks) {\n this.storedMarks = marks;\n this.updated |= UPDATED_MARKS;\n return this\n };\n\n // :: ([Mark]) → Transaction\n // Make sure the current stored marks or, if that is null, the marks\n // at the selection, match the given set of marks. Does nothing if\n // this is already the case.\n Transaction.prototype.ensureMarks = function ensureMarks (marks) {\n if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))\n { this.setStoredMarks(marks); }\n return this\n };\n\n // :: (Mark) → Transaction\n // Add a mark to the set of stored marks.\n Transaction.prototype.addStoredMark = function addStoredMark (mark) {\n return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()))\n };\n\n // :: (union<Mark, MarkType>) → Transaction\n // Remove a mark or mark type from the set of stored marks.\n Transaction.prototype.removeStoredMark = function removeStoredMark (mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()))\n };\n\n // :: bool\n // Whether the stored marks were explicitly set for this transaction.\n prototypeAccessors.storedMarksSet.get = function () {\n return (this.updated & UPDATED_MARKS) > 0\n };\n\n Transaction.prototype.addStep = function addStep (step, doc) {\n Transform.prototype.addStep.call(this, step, doc);\n this.updated = this.updated & ~UPDATED_MARKS;\n this.storedMarks = null;\n };\n\n // :: (number) → Transaction\n // Update the timestamp for the transaction.\n Transaction.prototype.setTime = function setTime (time) {\n this.time = time;\n return this\n };\n\n // :: (Slice) → Transaction\n // Replace the current selection with the given slice.\n Transaction.prototype.replaceSelection = function replaceSelection (slice) {\n this.selection.replace(this, slice);\n return this\n };\n\n // :: (Node, ?bool) → Transaction\n // Replace the selection with the given node. When `inheritMarks` is\n // true and the content is inline, it inherits the marks from the\n // place where it is inserted.\n Transaction.prototype.replaceSelectionWith = function replaceSelectionWith (node, inheritMarks) {\n var selection = this.selection;\n if (inheritMarks !== false)\n { node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || Mark.none))); }\n selection.replaceWith(this, node);\n return this\n };\n\n // :: () → Transaction\n // Delete the selection.\n Transaction.prototype.deleteSelection = function deleteSelection () {\n this.selection.replace(this);\n return this\n };\n\n // :: (string, from: ?number, to: ?number) → Transaction\n // Replace the given range, or the selection if no range is given,\n // with a text node containing the given string.\n Transaction.prototype.insertText = function insertText (text, from, to) {\n if ( to === void 0 ) to = from;\n\n var schema = this.doc.type.schema;\n if (from == null) {\n if (!text) { return this.deleteSelection() }\n return this.replaceSelectionWith(schema.text(text), true)\n } else {\n if (!text) { return this.deleteRange(from, to) }\n var marks = this.storedMarks;\n if (!marks) {\n var $from = this.doc.resolve(from);\n marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));\n }\n this.replaceRangeWith(from, to, schema.text(text, marks));\n if (!this.selection.empty) { this.setSelection(Selection.near(this.selection.$to)); }\n return this\n }\n };\n\n // :: (union<string, Plugin, PluginKey>, any) → Transaction\n // Store a metadata property in this transaction, keyed either by\n // name or by plugin.\n Transaction.prototype.setMeta = function setMeta (key, value) {\n this.meta[typeof key == \"string\" ? key : key.key] = value;\n return this\n };\n\n // :: (union<string, Plugin, PluginKey>) → any\n // Retrieve a metadata property for a given name or plugin.\n Transaction.prototype.getMeta = function getMeta (key) {\n return this.meta[typeof key == \"string\" ? key : key.key]\n };\n\n // :: bool\n // Returns true if this transaction doesn't contain any metadata,\n // and can thus safely be extended.\n prototypeAccessors.isGeneric.get = function () {\n for (var _ in this.meta) { return false }\n return true\n };\n\n // :: () → Transaction\n // Indicate that the editor should scroll the selection into view\n // when updated to the state produced by this transaction.\n Transaction.prototype.scrollIntoView = function scrollIntoView () {\n this.updated |= UPDATED_SCROLL;\n return this\n };\n\n prototypeAccessors.scrolledIntoView.get = function () {\n return (this.updated & UPDATED_SCROLL) > 0\n };\n\n Object.defineProperties( Transaction.prototype, prototypeAccessors );\n\n return Transaction;\n}(Transform));\n\nfunction bind(f, self) {\n return !self || !f ? f : f.bind(self)\n}\n\nvar FieldDesc = function FieldDesc(name, desc, self) {\n this.name = name;\n this.init = bind(desc.init, self);\n this.apply = bind(desc.apply, self);\n};\n\nvar baseFields = [\n new FieldDesc(\"doc\", {\n init: function init(config) { return config.doc || config.schema.topNodeType.createAndFill() },\n apply: function apply(tr) { return tr.doc }\n }),\n\n new FieldDesc(\"selection\", {\n init: function init(config, instance) { return config.selection || Selection.atStart(instance.doc) },\n apply: function apply(tr) { return tr.selection }\n }),\n\n new FieldDesc(\"storedMarks\", {\n init: function init(config) { return config.storedMarks || null },\n apply: function apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null }\n }),\n\n new FieldDesc(\"scrollToSelection\", {\n init: function init() { return 0 },\n apply: function apply(tr, prev) { return tr.scrolledIntoView ? prev + 1 : prev }\n })\n];\n\n// Object wrapping the part of a state object that stays the same\n// across transactions. Stored in the state's `config` property.\nvar Configuration = function Configuration(schema, plugins) {\n var this$1 = this;\n\n this.schema = schema;\n this.fields = baseFields.concat();\n this.plugins = [];\n this.pluginsByKey = Object.create(null);\n if (plugins) { plugins.forEach(function (plugin) {\n if (this$1.pluginsByKey[plugin.key])\n { throw new RangeError(\"Adding different instances of a keyed plugin (\" + plugin.key + \")\") }\n this$1.plugins.push(plugin);\n this$1.pluginsByKey[plugin.key] = plugin;\n if (plugin.spec.state)\n { this$1.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin)); }\n }); }\n};\n\n// ::- The state of a ProseMirror editor is represented by an object\n// of this type. A state is a persistent data structure—it isn't\n// updated, but rather a new state value is computed from an old one\n// using the [`apply`](#state.EditorState.apply) method.\n//\n// A state holds a number of built-in fields, and plugins can\n// [define](#state.PluginSpec.state) additional fields.\nvar EditorState = function EditorState(config) {\n this.config = config;\n};\n\nvar prototypeAccessors$1 = { schema: { configurable: true },plugins: { configurable: true },tr: { configurable: true } };\n\n// doc:: Node\n// The current document.\n\n// selection:: Selection\n// The selection.\n\n// storedMarks:: ?[Mark]\n// A set of marks to apply to the next input. Will be null when\n// no explicit marks have been set.\n\n// :: Schema\n// The schema of the state's document.\nprototypeAccessors$1.schema.get = function () {\n return this.config.schema\n};\n\n// :: [Plugin]\n// The plugins that are active in this state.\nprototypeAccessors$1.plugins.get = function () {\n return this.config.plugins\n};\n\n// :: (Transaction) → EditorState\n// Apply the given transaction to produce a new state.\nEditorState.prototype.apply = function apply (tr) {\n return this.applyTransaction(tr).state\n};\n\n// : (Transaction) → bool\nEditorState.prototype.filterTransaction = function filterTransaction (tr, ignore) {\n if ( ignore === void 0 ) ignore = -1;\n\n for (var i = 0; i < this.config.plugins.length; i++) { if (i != ignore) {\n var plugin = this.config.plugins[i];\n if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))\n { return false }\n } }\n return true\n};\n\n// :: (Transaction) → {state: EditorState, transactions: [Transaction]}\n// Verbose variant of [`apply`](#state.EditorState.apply) that\n// returns the precise transactions that were applied (which might\n// be influenced by the [transaction\n// hooks](#state.PluginSpec.filterTransaction) of\n// plugins) along with the new state.\nEditorState.prototype.applyTransaction = function applyTransaction (rootTr) {\n if (!this.filterTransaction(rootTr)) { return {state: this, transactions: []} }\n\n var trs = [rootTr], newState = this.applyInner(rootTr), seen = null;\n // This loop repeatedly gives plugins a chance to respond to\n // transactions as new transactions are added, making sure to only\n // pass the transactions the plugin did not see before.\n for (;;) {\n var haveNew = false;\n for (var i = 0; i < this.config.plugins.length; i++) {\n var plugin = this.config.plugins[i];\n if (plugin.spec.appendTransaction) {\n var n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;\n var tr = n < trs.length &&\n plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);\n if (tr && newState.filterTransaction(tr, i)) {\n tr.setMeta(\"appendedTransaction\", rootTr);\n if (!seen) {\n seen = [];\n for (var j = 0; j < this.config.plugins.length; j++)\n { seen.push(j < i ? {state: newState, n: trs.length} : {state: this, n: 0}); }\n }\n trs.push(tr);\n newState = newState.applyInner(tr);\n haveNew = true;\n }\n if (seen) { seen[i] = {state: newState, n: trs.length}; }\n }\n }\n if (!haveNew) { return {state: newState, transactions: trs} }\n }\n};\n\n// : (Transaction) → EditorState\nEditorState.prototype.applyInner = function applyInner (tr) {\n if (!tr.before.eq(this.doc)) { throw new RangeError(\"Applying a mismatched transaction\") }\n var newInstance = new EditorState(this.config), fields = this.config.fields;\n for (var i = 0; i < fields.length; i++) {\n var field = fields[i];\n newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);\n }\n for (var i$1 = 0; i$1 < applyListeners.length; i$1++) { applyListeners[i$1](this, tr, newInstance); }\n return newInstance\n};\n\n// :: Transaction\n// Start a [transaction](#state.Transaction) from this state.\nprototypeAccessors$1.tr.get = function () { return new Transaction(this) };\n\n// :: (Object) → EditorState\n// Create a new state.\n//\n// config::- Configuration options. Must contain `schema` or `doc` (or both).\n//\n// schema:: ?Schema\n// The schema to use.\n//\n// doc:: ?Node\n// The starting document.\n//\n// selection:: ?Selection\n// A valid selection in the document.\n//\n// storedMarks:: ?[Mark]\n// The initial set of [stored marks](#state.EditorState.storedMarks).\n//\n// plugins:: ?[Plugin]\n// The plugins that should be active in this state.\nEditorState.create = function create (config) {\n var $config = new Configuration(config.schema || config.doc.type.schema, config.plugins);\n var instance = new EditorState($config);\n for (var i = 0; i < $config.fields.length; i++)\n { instance[$config.fields[i].name] = $config.fields[i].init(config, instance); }\n return instance\n};\n\n// :: (Object) → EditorState\n// Create a new state based on this one, but with an adjusted set of\n// active plugins. State fields that exist in both sets of plugins\n// are kept unchanged. Those that no longer exist are dropped, and\n// those that are new are initialized using their\n// [`init`](#state.StateField.init) method, passing in the new\n// configuration object..\n//\n// config::- configuration options\n//\n// schema:: ?Schema\n// New schema to use.\n//\n// plugins:: ?[Plugin]\n// New set of active plugins.\nEditorState.prototype.reconfigure = function reconfigure (config) {\n var $config = new Configuration(config.schema || this.schema, config.plugins);\n var fields = $config.fields, instance = new EditorState($config);\n for (var i = 0; i < fields.length; i++) {\n var name = fields[i].name;\n instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);\n }\n return instance\n};\n\n// :: (?union<Object<Plugin>, string, number>) → Object\n// Serialize this state to JSON. If you want to serialize the state\n// of plugins, pass an object mapping property names to use in the\n// resulting JSON object to plugin objects. The argument may also be\n// a string or number, in which case it is ignored, to support the\n// way `JSON.stringify` calls `toString` methods.\nEditorState.prototype.toJSON = function toJSON (pluginFields) {\n var result = {doc: this.doc.toJSON(), selection: this.selection.toJSON()};\n if (this.storedMarks) { result.storedMarks = this.storedMarks.map(function (m) { return m.toJSON(); }); }\n if (pluginFields && typeof pluginFields == 'object') { for (var prop in pluginFields) {\n if (prop == \"doc\" || prop == \"selection\")\n { throw new RangeError(\"The JSON fields `doc` and `selection` are reserved\") }\n var plugin = pluginFields[prop], state = plugin.spec.state;\n if (state && state.toJSON) { result[prop] = state.toJSON.call(plugin, this[plugin.key]); }\n } }\n return result\n};\n\n// :: (Object, Object, ?Object<Plugin>) → EditorState\n// Deserialize a JSON representation of a state. `config` should\n// have at least a `schema` field, and should contain array of\n// plugins to initialize the state with. `pluginFields` can be used\n// to deserialize the state of plugins, by associating plugin\n// instances with the property names they use in the JSON object.\n//\n// config::- configuration options\n//\n// schema:: Schema\n// The schema to use.\n//\n// plugins:: ?[Plugin]\n// The set of active plugins.\nEditorState.fromJSON = function fromJSON (config, json, pluginFields) {\n if (!json) { throw new RangeError(\"Invalid input for EditorState.fromJSON\") }\n if (!config.schema) { throw new RangeError(\"Required config field 'schema' missing\") }\n var $config = new Configuration(config.schema, config.plugins);\n var instance = new EditorState($config);\n $config.fields.forEach(function (field) {\n if (field.name == \"doc\") {\n instance.doc = Node.fromJSON(config.schema, json.doc);\n } else if (field.name == \"selection\") {\n instance.selection = Selection.fromJSON(instance.doc, json.selection);\n } else if (field.name == \"storedMarks\") {\n if (json.storedMarks) { instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON); }\n } else {\n if (pluginFields) { for (var prop in pluginFields) {\n var plugin = pluginFields[prop], state = plugin.spec.state;\n if (plugin.key == field.name && state && state.fromJSON &&\n Object.prototype.hasOwnProperty.call(json, prop)) {\n // This field belongs to a plugin mapped to a JSON field, read it from there.\n instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);\n return\n }\n } }\n instance[field.name] = field.init(config, instance);\n }\n });\n return instance\n};\n\n// Kludge to allow the view to track mappings between different\n// instances of a state.\n//\n// FIXME this is no longer needed as of prosemirror-view 1.9.0,\n// though due to backwards-compat we should probably keep it around\n// for a while (if only as a no-op)\nEditorState.addApplyListener = function addApplyListener (f) {\n applyListeners.push(f);\n};\nEditorState.removeApplyListener = function removeApplyListener (f) {\n var found = applyListeners.indexOf(f);\n if (found > -1) { applyListeners.splice(found, 1); }\n};\n\nObject.defineProperties( EditorState.prototype, prototypeAccessors$1 );\n\nvar applyListeners = [];\n\n// PluginSpec:: interface\n//\n// This is the type passed to the [`Plugin`](#state.Plugin)\n// constructor. It provides a definition for a plugin.\n//\n// props:: ?EditorProps\n// The [view props](#view.EditorProps) added by this plugin. Props\n// that are functions will be bound to have the plugin instance as\n// their `this` binding.\n//\n// state:: ?StateField<any>\n// Allows a plugin to define a [state field](#state.StateField), an\n// extra slot in the state object in which it can keep its own data.\n//\n// key:: ?PluginKey\n// Can be used to make this a keyed plugin. You can have only one\n// plugin with a given key in a given state, but it is possible to\n// access the plugin's configuration and state through the key,\n// without having access to the plugin instance object.\n//\n// view:: ?(EditorView) → Object\n// When the plugin needs to interact with the editor view, or\n// set something up in the DOM, use this field. The function\n// will be called when the plugin's state is associated with an\n// editor view.\n//\n// return::-\n// Should return an object with the following optional\n// properties:\n//\n// update:: ?(view: EditorView, prevState: EditorState)\n// Called whenever the view's state is updated.\n//\n// destroy:: ?()\n// Called when the view is destroyed or receives a state\n// with different plugins.\n//\n// filterTransaction:: ?(Transaction, EditorState) → bool\n// When present, this will be called before a transaction is\n// applied by the state, allowing the plugin to cancel it (by\n// returning false).\n//\n// appendTransaction:: ?(transactions: [Transaction], oldState: EditorState, newState: EditorState) → ?Transaction\n// Allows the plugin to append another transaction to be applied\n// after the given array of transactions. When another plugin\n// appends a transaction after this was called, it is called again\n// with the new state and new transactions—but only the new\n// transactions, i.e. it won't be passed transactions that it\n// already saw.\n\nfunction bindProps(obj, self, target) {\n for (var prop in obj) {\n var val = obj[prop];\n if (val instanceof Function) { val = val.bind(self); }\n else if (prop == \"handleDOMEvents\") { val = bindProps(val, self, {}); }\n target[prop] = val;\n }\n return target\n}\n\n// ::- Plugins bundle functionality that can be added to an editor.\n// They are part of the [editor state](#state.EditorState) and\n// may influence that state and the view that contains it.\nvar Plugin = function Plugin(spec) {\n // :: EditorProps\n // The [props](#view.EditorProps) exported by this plugin.\n this.props = {};\n if (spec.props) { bindProps(spec.props, this, this.props); }\n // :: Object\n // The plugin's [spec object](#state.PluginSpec).\n this.spec = spec;\n this.key = spec.key ? spec.key.key : createKey(\"plugin\");\n};\n\n// :: (EditorState) → any\n// Extract the plugin's state field from an editor state.\nPlugin.prototype.getState = function getState (state) { return state[this.key] };\n\n// StateField:: interface<T>\n// A plugin spec may provide a state field (under its\n// [`state`](#state.PluginSpec.state) property) of this type, which\n// describes the state it wants to keep. Functions provided here are\n// always called with the plugin instance as their `this` binding.\n//\n// init:: (config: Object, instance: EditorState) → T\n// Initialize the value of the field. `config` will be the object\n// passed to [`EditorState.create`](#state.EditorState^create). Note\n// that `instance` is a half-initialized state instance, and will\n// not have values for plugin fields initialized after this one.\n//\n// apply:: (tr: Transaction, value: T, oldState: EditorState, newState: EditorState) → T\n// Apply the given transaction to this state field, producing a new\n// field value. Note that the `newState` argument is again a partially\n// constructed state does not yet contain the state from plugins\n// coming after this one.\n//\n// toJSON:: ?(value: T) → *\n// Convert this field to JSON. Optional, can be left off to disable\n// JSON serialization for the field.\n//\n// fromJSON:: ?(config: Object, value: *, state: EditorState) → T\n// Deserialize the JSON representation of this field. Note that the\n// `state` argument is again a half-initialized state.\n\nvar keys = Object.create(null);\n\nfunction createKey(name) {\n if (name in keys) { return name + \"$\" + ++keys[name] }\n keys[name] = 0;\n return name + \"$\"\n}\n\n// ::- A key is used to [tag](#state.PluginSpec.key)\n// plugins in a way that makes it possible to find them, given an\n// editor state. Assigning a key does mean only one plugin of that\n// type can be active in a state.\nvar PluginKey = function PluginKey(name) {\nif ( name === void 0 ) name = \"key\";\n this.key = createKey(name); };\n\n// :: (EditorState) → ?Plugin\n// Get the active plugin with this key, if any, from an editor\n// state.\nPluginKey.prototype.get = function get (state) { return state.config.pluginsByKey[this.key] };\n\n// :: (EditorState) → ?any\n// Get the plugin's state from an editor state.\nPluginKey.prototype.getState = function getState (state) { return state[this.key] };\n\nexport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection, Transaction };\n//# sourceMappingURL=index.es.js.map\n","import { Plugin } from 'prosemirror-state';\nimport { dropPoint } from 'prosemirror-transform';\n\n// :: (options: ?Object) → Plugin\n// Create a plugin that, when added to a ProseMirror instance,\n// causes a decoration to show up at the drop position when something\n// is dragged over the editor.\n//\n// options::- These options are supported:\n//\n// color:: ?string\n// The color of the cursor. Defaults to `black`.\n//\n// width:: ?number\n// The precise width of the cursor in pixels. Defaults to 1.\n//\n// class:: ?string\n// A CSS class name to add to the cursor element.\nfunction dropCursor(options) {\n if ( options === void 0 ) options = {};\n\n return new Plugin({\n view: function view(editorView) { return new DropCursorView(editorView, options) }\n })\n}\n\nvar DropCursorView = function DropCursorView(editorView, options) {\n var this$1 = this;\n\n this.editorView = editorView;\n this.width = options.width || 1;\n this.color = options.color || \"black\";\n this.class = options.class;\n this.cursorPos = null;\n this.element = null;\n this.timeout = null;\n\n this.handlers = [\"dragover\", \"dragend\", \"drop\", \"dragleave\"].map(function (name) {\n var handler = function (e) { return this$1[name](e); };\n editorView.dom.addEventListener(name, handler);\n return {name: name, handler: handler}\n });\n};\n\nDropCursorView.prototype.destroy = function destroy () {\n var this$1 = this;\n\n this.handlers.forEach(function (ref) {\n var name = ref.name;\n var handler = ref.handler;\n\n return this$1.editorView.dom.removeEventListener(name, handler);\n });\n};\n\nDropCursorView.prototype.update = function update (editorView, prevState) {\n if (this.cursorPos != null && prevState.doc != editorView.state.doc) { this.updateOverlay(); }\n};\n\nDropCursorView.prototype.setCursor = function setCursor (pos) {\n if (pos == this.cursorPos) { return }\n this.cursorPos = pos;\n if (pos == null) {\n this.element.parentNode.removeChild(this.element);\n this.element = null;\n } else {\n this.updateOverlay();\n }\n};\n\nDropCursorView.prototype.updateOverlay = function updateOverlay () {\n var $pos = this.editorView.state.doc.resolve(this.cursorPos), rect;\n if (!$pos.parent.inlineContent) {\n var before = $pos.nodeBefore, after = $pos.nodeAfter;\n if (before || after) {\n var nodeRect = this.editorView.nodeDOM(this.cursorPos - (before ?before.nodeSize : 0)).getBoundingClientRect();\n var top = before ? nodeRect.bottom : nodeRect.top;\n if (before && after)\n { top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2; }\n rect = {left: nodeRect.left, right: nodeRect.right, top: top - this.width / 2, bottom: top + this.width / 2};\n }\n }\n if (!rect) {\n var coords = this.editorView.coordsAtPos(this.cursorPos);\n rect = {left: coords.left - this.width / 2, right: coords.left + this.width / 2, top: coords.top, bottom: coords.bottom};\n }\n\n var parent = this.editorView.dom.offsetParent;\n if (!this.element) {\n this.element = parent.appendChild(document.createElement(\"div\"));\n if (this.class) { this.element.className = this.class; }\n this.element.style.cssText = \"position: absolute; z-index: 50; pointer-events: none; background-color: \" + this.color;\n }\n var parentRect = !parent || parent == document.body && getComputedStyle(parent).position == \"static\"\n ? {left: -pageXOffset, top: -pageYOffset} : parent.getBoundingClientRect();\n this.element.style.left = (rect.left - parentRect.left) + \"px\";\n this.element.style.top = (rect.top - parentRect.top) + \"px\";\n this.element.style.width = (rect.right - rect.left) + \"px\";\n this.element.style.height = (rect.bottom - rect.top) + \"px\";\n};\n\nDropCursorView.prototype.scheduleRemoval = function scheduleRemoval (timeout) {\n var this$1 = this;\n\n clearTimeout(this.timeout);\n this.timeout = setTimeout(function () { return this$1.setCursor(null); }, timeout);\n};\n\nDropCursorView.prototype.dragover = function dragover (event) {\n if (!this.editorView.editable) { return }\n var pos = this.editorView.posAtCoords({left: event.clientX, top: event.clientY});\n if (pos) {\n var target = pos.pos;\n if (this.editorView.dragging && this.editorView.dragging.slice) {\n target = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);\n if (target == null) { target = pos.pos; }\n }\n this.setCursor(target);\n this.scheduleRemoval(5000);\n }\n};\n\nDropCursorView.prototype.dragend = function dragend () {\n this.scheduleRemoval(20);\n};\n\nDropCursorView.prototype.drop = function drop () {\n this.scheduleRemoval(20);\n};\n\nDropCursorView.prototype.dragleave = function dragleave (event) {\n if (event.target == this.editorView.dom || !this.editorView.dom.contains(event.relatedTarget))\n { this.setCursor(null); }\n};\n\nexport { dropCursor };\n//# sourceMappingURL=index.es.js.map\n","import { keydownHandler } from 'prosemirror-keymap';\nimport { NodeSelection, Selection, Plugin, TextSelection } from 'prosemirror-state';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\nimport { Slice } from 'prosemirror-model';\n\n// ::- Gap cursor selections are represented using this class. Its\n// `$anchor` and `$head` properties both point at the cursor position.\nvar GapCursor = /*@__PURE__*/(function (Selection) {\n function GapCursor($pos) {\n Selection.call(this, $pos, $pos);\n }\n\n if ( Selection ) GapCursor.__proto__ = Selection;\n GapCursor.prototype = Object.create( Selection && Selection.prototype );\n GapCursor.prototype.constructor = GapCursor;\n\n GapCursor.prototype.map = function map (doc, mapping) {\n var $pos = doc.resolve(mapping.map(this.head));\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos)\n };\n\n GapCursor.prototype.content = function content () { return Slice.empty };\n\n GapCursor.prototype.eq = function eq (other) {\n return other instanceof GapCursor && other.head == this.head\n };\n\n GapCursor.prototype.toJSON = function toJSON () {\n return {type: \"gapcursor\", pos: this.head}\n };\n\n GapCursor.fromJSON = function fromJSON (doc, json) {\n if (typeof json.pos != \"number\") { throw new RangeError(\"Invalid input for GapCursor.fromJSON\") }\n return new GapCursor(doc.resolve(json.pos))\n };\n\n GapCursor.prototype.getBookmark = function getBookmark () { return new GapBookmark(this.anchor) };\n\n GapCursor.valid = function valid ($pos) {\n var parent = $pos.parent;\n if (parent.isTextblock || !closedBefore($pos) || !closedAfter($pos)) { return false }\n var override = parent.type.spec.allowGapCursor;\n if (override != null) { return override }\n var deflt = parent.contentMatchAt($pos.index()).defaultType;\n return deflt && deflt.isTextblock\n };\n\n GapCursor.findFrom = function findFrom ($pos, dir, mustMove) {\n search: for (;;) {\n if (!mustMove && GapCursor.valid($pos)) { return $pos }\n var pos = $pos.pos, next = null;\n // Scan up from this position\n for (var d = $pos.depth;; d--) {\n var parent = $pos.node(d);\n if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {\n next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);\n break\n } else if (d == 0) {\n return null\n }\n pos += dir;\n var $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur)) { return $cur }\n }\n\n // And then down into the next node\n for (;;) {\n var inside = dir > 0 ? next.firstChild : next.lastChild;\n if (!inside) {\n if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {\n $pos = $pos.doc.resolve(pos + next.nodeSize * dir);\n mustMove = false;\n continue search\n }\n break\n }\n next = inside;\n pos += dir;\n var $cur$1 = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur$1)) { return $cur$1 }\n }\n\n return null\n }\n };\n\n return GapCursor;\n}(Selection));\n\nGapCursor.prototype.visible = false;\n\nSelection.jsonID(\"gapcursor\", GapCursor);\n\nvar GapBookmark = function GapBookmark(pos) {\n this.pos = pos;\n};\nGapBookmark.prototype.map = function map (mapping) {\n return new GapBookmark(mapping.map(this.pos))\n};\nGapBookmark.prototype.resolve = function resolve (doc) {\n var $pos = doc.resolve(this.pos);\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos)\n};\n\nfunction closedBefore($pos) {\n for (var d = $pos.depth; d >= 0; d--) {\n var index = $pos.index(d);\n // At the start of this parent, look at next one\n if (index == 0) { continue }\n // See if the node before (or its first ancestor) is closed\n for (var before = $pos.node(d).child(index - 1);; before = before.lastChild) {\n if ((before.childCount == 0 && !before.inlineContent) || before.isAtom || before.type.spec.isolating) { return true }\n if (before.inlineContent) { return false }\n }\n }\n // Hit start of document\n return true\n}\n\nfunction closedAfter($pos) {\n for (var d = $pos.depth; d >= 0; d--) {\n var index = $pos.indexAfter(d), parent = $pos.node(d);\n if (index == parent.childCount) { continue }\n for (var after = parent.child(index);; after = after.firstChild) {\n if ((after.childCount == 0 && !after.inlineContent) || after.isAtom || after.type.spec.isolating) { return true }\n if (after.inlineContent) { return false }\n }\n }\n return true\n}\n\n// :: () → Plugin\n// Create a gap cursor plugin. When enabled, this will capture clicks\n// near and arrow-key-motion past places that don't have a normally\n// selectable position nearby, and create a gap cursor selection for\n// them. The cursor is drawn as an element with class\n// `ProseMirror-gapcursor`. You can either include\n// `style/gapcursor.css` from the package's directory or add your own\n// styles to make it visible.\nvar gapCursor = function() {\n return new Plugin({\n props: {\n decorations: drawGapCursor,\n\n createSelectionBetween: function createSelectionBetween(_view, $anchor, $head) {\n if ($anchor.pos == $head.pos && GapCursor.valid($head)) { return new GapCursor($head) }\n },\n\n handleClick: handleClick,\n handleKeyDown: handleKeyDown\n }\n })\n};\n\nvar handleKeyDown = keydownHandler({\n \"ArrowLeft\": arrow(\"horiz\", -1),\n \"ArrowRight\": arrow(\"horiz\", 1),\n \"ArrowUp\": arrow(\"vert\", -1),\n \"ArrowDown\": arrow(\"vert\", 1)\n});\n\nfunction arrow(axis, dir) {\n var dirStr = axis == \"vert\" ? (dir > 0 ? \"down\" : \"up\") : (dir > 0 ? \"right\" : \"left\");\n return function(state, dispatch, view) {\n var sel = state.selection;\n var $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;\n if (sel instanceof TextSelection) {\n if (!view.endOfTextblock(dirStr) || $start.depth == 0) { return false }\n mustMove = false;\n $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());\n }\n var $found = GapCursor.findFrom($start, dir, mustMove);\n if (!$found) { return false }\n if (dispatch) { dispatch(state.tr.setSelection(new GapCursor($found))); }\n return true\n }\n}\n\nfunction handleClick(view, pos, event) {\n if (!view.editable) { return false }\n var $pos = view.state.doc.resolve(pos);\n if (!GapCursor.valid($pos)) { return false }\n var ref = view.posAtCoords({left: event.clientX, top: event.clientY});\n var inside = ref.inside;\n if (inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(inside))) { return false }\n view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));\n return true\n}\n\nfunction drawGapCursor(state) {\n if (!(state.selection instanceof GapCursor)) { return null }\n var node = document.createElement(\"div\");\n node.className = \"ProseMirror-gapcursor\";\n return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, {key: \"gapcursor\"})])\n}\n\nexport { GapCursor, gapCursor };\n//# sourceMappingURL=index.es.js.map\n","\n /*!\n * tiptap v1.26.8\n * (c) 2020 Scrumpy UG (limited liability)\n * @license MIT\n */\n \nimport { EditorState, Plugin, PluginKey, TextSelection } from 'prosemirror-state';\nexport { NodeSelection, Plugin, PluginKey, TextSelection } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { Schema, DOMParser, DOMSerializer } from 'prosemirror-model';\nimport { dropCursor } from 'prosemirror-dropcursor';\nimport { gapCursor } from 'prosemirror-gapcursor';\nimport { keymap } from 'prosemirror-keymap';\nimport { baseKeymap } from 'prosemirror-commands';\nimport { inputRules, undoInputRule } from 'prosemirror-inputrules';\nimport { getMarkRange, getMarkAttrs, getNodeAttrs, markIsActive, nodeIsActive } from 'tiptap-utils';\nimport Vue from 'vue';\nimport { setBlockType } from 'tiptap-commands';\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n return function () {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (_isNativeReflectConstruct()) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction camelCase (str) {\n return str.replace(/(?:^\\w|[A-Z]|\\b\\w)/g, function (word, index) {\n return index === 0 ? word.toLowerCase() : word.toUpperCase();\n }).replace(/\\s+/g, '');\n}\n\nvar ComponentView = /*#__PURE__*/function () {\n function ComponentView(component, _ref) {\n var editor = _ref.editor,\n extension = _ref.extension,\n parent = _ref.parent,\n node = _ref.node,\n view = _ref.view,\n decorations = _ref.decorations,\n getPos = _ref.getPos;\n\n _classCallCheck(this, ComponentView);\n\n this.component = component;\n this.editor = editor;\n this.extension = extension;\n this.parent = parent;\n this.node = node;\n this.view = view;\n this.decorations = decorations;\n this.isNode = !!this.node.marks;\n this.isMark = !this.isNode;\n this.getPos = this.isMark ? this.getMarkPos : getPos;\n this.captureEvents = true;\n this.dom = this.createDOM();\n this.contentDOM = this.vm.$refs.content;\n }\n\n _createClass(ComponentView, [{\n key: \"createDOM\",\n value: function createDOM() {\n var _this = this;\n\n var Component = Vue.extend(this.component);\n var props = {\n editor: this.editor,\n node: this.node,\n view: this.view,\n getPos: function getPos() {\n return _this.getPos();\n },\n decorations: this.decorations,\n selected: false,\n options: this.extension.options,\n updateAttrs: function updateAttrs(attrs) {\n return _this.updateAttrs(attrs);\n }\n };\n\n if (typeof this.extension.setSelection === 'function') {\n this.setSelection = this.extension.setSelection;\n }\n\n if (typeof this.extension.update === 'function') {\n this.update = this.extension.update;\n }\n\n this.vm = new Component({\n parent: this.parent,\n propsData: props\n }).$mount();\n return this.vm.$el;\n }\n }, {\n key: \"update\",\n value: function update(node, decorations) {\n if (node.type !== this.node.type) {\n return false;\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true;\n }\n\n this.node = node;\n this.decorations = decorations;\n this.updateComponentProps({\n node: node,\n decorations: decorations\n });\n return true;\n }\n }, {\n key: \"updateComponentProps\",\n value: function updateComponentProps(props) {\n var _this2 = this;\n\n if (!this.vm._props) {\n return;\n } // Update props in component\n // TODO: Avoid mutating a prop directly.\n // Maybe there is a better way to do this?\n\n\n var originalSilent = Vue.config.silent;\n Vue.config.silent = true;\n Object.entries(props).forEach(function (_ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n key = _ref3[0],\n value = _ref3[1];\n\n _this2.vm._props[key] = value;\n }); // this.vm._props.node = node\n // this.vm._props.decorations = decorations\n\n Vue.config.silent = originalSilent;\n }\n }, {\n key: \"updateAttrs\",\n value: function updateAttrs(attrs) {\n if (!this.view.editable) {\n return;\n }\n\n var state = this.view.state;\n var type = this.node.type;\n var pos = this.getPos();\n\n var newAttrs = _objectSpread2({}, this.node.attrs, {}, attrs);\n\n var transaction = this.isMark ? state.tr.removeMark(pos.from, pos.to, type).addMark(pos.from, pos.to, type.create(newAttrs)) : state.tr.setNodeMarkup(pos, null, newAttrs);\n this.view.dispatch(transaction);\n } // prevent a full re-render of the vue component on update\n // we'll handle prop updates in `update()`\n\n }, {\n key: \"ignoreMutation\",\n value: function ignoreMutation(mutation) {\n // allow leaf nodes to be selected\n if (mutation.type === 'selection') {\n return false;\n }\n\n if (!this.contentDOM) {\n return true;\n }\n\n return !this.contentDOM.contains(mutation.target);\n } // disable (almost) all prosemirror event listener for node views\n\n }, {\n key: \"stopEvent\",\n value: function stopEvent(event) {\n var _this3 = this;\n\n if (typeof this.extension.stopEvent === 'function') {\n return this.extension.stopEvent(event);\n }\n\n var draggable = !!this.extension.schema.draggable; // support a custom drag handle\n\n if (draggable && event.type === 'mousedown') {\n var dragHandle = event.target.closest && event.target.closest('[data-drag-handle]');\n var isValidDragHandle = dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle));\n\n if (isValidDragHandle) {\n this.captureEvents = false;\n document.addEventListener('dragend', function () {\n _this3.captureEvents = true;\n }, {\n once: true\n });\n }\n }\n\n var isCopy = event.type === 'copy';\n var isPaste = event.type === 'paste';\n var isCut = event.type === 'cut';\n var isDrag = event.type.startsWith('drag') || event.type === 'drop';\n\n if (draggable && isDrag || isCopy || isPaste || isCut) {\n return false;\n }\n\n return this.captureEvents;\n }\n }, {\n key: \"selectNode\",\n value: function selectNode() {\n this.updateComponentProps({\n selected: true\n });\n }\n }, {\n key: \"deselectNode\",\n value: function deselectNode() {\n this.updateComponentProps({\n selected: false\n });\n }\n }, {\n key: \"getMarkPos\",\n value: function getMarkPos() {\n var pos = this.view.posAtDOM(this.dom);\n var resolvedPos = this.view.state.doc.resolve(pos);\n var range = getMarkRange(resolvedPos, this.node.type);\n return range;\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.vm.$destroy();\n }\n }]);\n\n return ComponentView;\n}();\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n }\n\n _createClass(Emitter, [{\n key: \"on\",\n // Add an event listener for given event\n value: function on(event, fn) {\n this._callbacks = this._callbacks || {}; // Create namespace for this event\n\n if (!this._callbacks[event]) {\n this._callbacks[event] = [];\n }\n\n this._callbacks[event].push(fn);\n\n return this;\n }\n }, {\n key: \"emit\",\n value: function emit(event) {\n var _this = this;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n this._callbacks = this._callbacks || {};\n var callbacks = this._callbacks[event];\n\n if (callbacks) {\n callbacks.forEach(function (callback) {\n return callback.apply(_this, args);\n });\n }\n\n return this;\n } // Remove event listener for given event.\n // If fn is not provided, all event listeners for that event will be removed.\n // If neither is provided, all event listeners will be removed.\n\n }, {\n key: \"off\",\n value: function off(event, fn) {\n if (!arguments.length) {\n this._callbacks = {};\n } else {\n // event listeners for the given event\n var callbacks = this._callbacks ? this._callbacks[event] : null;\n\n if (callbacks) {\n if (fn) {\n this._callbacks[event] = callbacks.filter(function (cb) {\n return cb !== fn;\n }); // remove specific handler\n } else {\n delete this._callbacks[event]; // remove all handlers\n }\n }\n }\n\n return this;\n }\n }]);\n\n return Emitter;\n}();\n\nvar Extension = /*#__PURE__*/function () {\n function Extension() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Extension);\n\n this.options = _objectSpread2({}, this.defaultOptions, {}, options);\n }\n\n _createClass(Extension, [{\n key: \"init\",\n value: function init() {\n return null;\n }\n }, {\n key: \"bindEditor\",\n value: function bindEditor() {\n var editor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.editor = editor;\n }\n }, {\n key: \"inputRules\",\n value: function inputRules() {\n return [];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules() {\n return [];\n }\n }, {\n key: \"keys\",\n value: function keys() {\n return {};\n }\n }, {\n key: \"name\",\n get: function get() {\n return null;\n }\n }, {\n key: \"type\",\n get: function get() {\n return 'extension';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {};\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [];\n }\n }]);\n\n return Extension;\n}();\n\nvar ExtensionManager = /*#__PURE__*/function () {\n function ExtensionManager() {\n var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var editor = arguments.length > 1 ? arguments[1] : undefined;\n\n _classCallCheck(this, ExtensionManager);\n\n extensions.forEach(function (extension) {\n extension.bindEditor(editor);\n extension.init();\n });\n this.extensions = extensions;\n }\n\n _createClass(ExtensionManager, [{\n key: \"keymaps\",\n value: function keymaps(_ref) {\n var schema = _ref.schema;\n var extensionKeymaps = this.extensions.filter(function (extension) {\n return ['extension'].includes(extension.type);\n }).filter(function (extension) {\n return extension.keys;\n }).map(function (extension) {\n return extension.keys({\n schema: schema\n });\n });\n var nodeMarkKeymaps = this.extensions.filter(function (extension) {\n return ['node', 'mark'].includes(extension.type);\n }).filter(function (extension) {\n return extension.keys;\n }).map(function (extension) {\n return extension.keys({\n type: schema[\"\".concat(extension.type, \"s\")][extension.name],\n schema: schema\n });\n });\n return [].concat(_toConsumableArray(extensionKeymaps), _toConsumableArray(nodeMarkKeymaps)).map(function (keys) {\n return keymap(keys);\n });\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref2) {\n var schema = _ref2.schema,\n excludedExtensions = _ref2.excludedExtensions;\n if (!(excludedExtensions instanceof Array) && excludedExtensions) return [];\n var allowedExtensions = excludedExtensions instanceof Array ? this.extensions.filter(function (extension) {\n return !excludedExtensions.includes(extension.name);\n }) : this.extensions;\n var extensionInputRules = allowedExtensions.filter(function (extension) {\n return ['extension'].includes(extension.type);\n }).filter(function (extension) {\n return extension.inputRules;\n }).map(function (extension) {\n return extension.inputRules({\n schema: schema\n });\n });\n var nodeMarkInputRules = allowedExtensions.filter(function (extension) {\n return ['node', 'mark'].includes(extension.type);\n }).filter(function (extension) {\n return extension.inputRules;\n }).map(function (extension) {\n return extension.inputRules({\n type: schema[\"\".concat(extension.type, \"s\")][extension.name],\n schema: schema\n });\n });\n return [].concat(_toConsumableArray(extensionInputRules), _toConsumableArray(nodeMarkInputRules)).reduce(function (allInputRules, inputRules) {\n return [].concat(_toConsumableArray(allInputRules), _toConsumableArray(inputRules));\n }, []);\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref3) {\n var schema = _ref3.schema,\n excludedExtensions = _ref3.excludedExtensions;\n if (!(excludedExtensions instanceof Array) && excludedExtensions) return [];\n var allowedExtensions = excludedExtensions instanceof Array ? this.extensions.filter(function (extension) {\n return !excludedExtensions.includes(extension.name);\n }) : this.extensions;\n var extensionPasteRules = allowedExtensions.filter(function (extension) {\n return ['extension'].includes(extension.type);\n }).filter(function (extension) {\n return extension.pasteRules;\n }).map(function (extension) {\n return extension.pasteRules({\n schema: schema\n });\n });\n var nodeMarkPasteRules = allowedExtensions.filter(function (extension) {\n return ['node', 'mark'].includes(extension.type);\n }).filter(function (extension) {\n return extension.pasteRules;\n }).map(function (extension) {\n return extension.pasteRules({\n type: schema[\"\".concat(extension.type, \"s\")][extension.name],\n schema: schema\n });\n });\n return [].concat(_toConsumableArray(extensionPasteRules), _toConsumableArray(nodeMarkPasteRules)).reduce(function (allPasteRules, pasteRules) {\n return [].concat(_toConsumableArray(allPasteRules), _toConsumableArray(pasteRules));\n }, []);\n }\n }, {\n key: \"commands\",\n value: function commands(_ref4) {\n var schema = _ref4.schema,\n view = _ref4.view;\n return this.extensions.filter(function (extension) {\n return extension.commands;\n }).reduce(function (allCommands, extension) {\n var name = extension.name,\n type = extension.type;\n var commands = {};\n var value = extension.commands(_objectSpread2({\n schema: schema\n }, ['node', 'mark'].includes(type) ? {\n type: schema[\"\".concat(type, \"s\")][name]\n } : {}));\n\n var apply = function apply(cb, attrs) {\n if (!view.editable) {\n return false;\n }\n\n view.focus();\n return cb(attrs)(view.state, view.dispatch, view);\n };\n\n var handle = function handle(_name, _value) {\n if (Array.isArray(_value)) {\n commands[_name] = function (attrs) {\n return _value.forEach(function (callback) {\n return apply(callback, attrs);\n });\n };\n } else if (typeof _value === 'function') {\n commands[_name] = function (attrs) {\n return apply(_value, attrs);\n };\n }\n };\n\n if (_typeof(value) === 'object') {\n Object.entries(value).forEach(function (_ref5) {\n var _ref6 = _slicedToArray(_ref5, 2),\n commandName = _ref6[0],\n commandValue = _ref6[1];\n\n handle(commandName, commandValue);\n });\n } else {\n handle(name, value);\n }\n\n return _objectSpread2({}, allCommands, {}, commands);\n }, {});\n }\n }, {\n key: \"nodes\",\n get: function get() {\n return this.extensions.filter(function (extension) {\n return extension.type === 'node';\n }).reduce(function (nodes, _ref7) {\n var name = _ref7.name,\n schema = _ref7.schema;\n return _objectSpread2({}, nodes, _defineProperty({}, name, schema));\n }, {});\n }\n }, {\n key: \"options\",\n get: function get() {\n var view = this.view;\n return this.extensions.reduce(function (nodes, extension) {\n return _objectSpread2({}, nodes, _defineProperty({}, extension.name, new Proxy(extension.options, {\n set: function set(obj, prop, value) {\n var changed = obj[prop] !== value;\n Object.assign(obj, _defineProperty({}, prop, value));\n\n if (changed) {\n view.updateState(view.state);\n }\n\n return true;\n }\n })));\n }, {});\n }\n }, {\n key: \"marks\",\n get: function get() {\n return this.extensions.filter(function (extension) {\n return extension.type === 'mark';\n }).reduce(function (marks, _ref8) {\n var name = _ref8.name,\n schema = _ref8.schema;\n return _objectSpread2({}, marks, _defineProperty({}, name, schema));\n }, {});\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return this.extensions.filter(function (extension) {\n return extension.plugins;\n }).reduce(function (allPlugins, _ref9) {\n var plugins = _ref9.plugins;\n return [].concat(_toConsumableArray(allPlugins), _toConsumableArray(plugins));\n }, []);\n }\n }]);\n\n return ExtensionManager;\n}();\n\nfunction injectCSS (css) {\n if (process.env.NODE_ENV !== 'test') {\n var style = document.createElement('style');\n style.type = 'text/css';\n style.textContent = css;\n var _document = document,\n head = _document.head;\n var firstChild = head.firstChild;\n\n if (firstChild) {\n head.insertBefore(style, firstChild);\n } else {\n head.appendChild(style);\n }\n }\n}\n\nvar Mark = /*#__PURE__*/function (_Extension) {\n _inherits(Mark, _Extension);\n\n var _super = _createSuper(Mark);\n\n function Mark() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Mark);\n\n return _super.call(this, options);\n }\n\n _createClass(Mark, [{\n key: \"command\",\n value: function command() {\n return function () {};\n }\n }, {\n key: \"type\",\n get: function get() {\n return 'mark';\n }\n }, {\n key: \"view\",\n get: function get() {\n return null;\n }\n }, {\n key: \"schema\",\n get: function get() {\n return null;\n }\n }]);\n\n return Mark;\n}(Extension);\n\nfunction minMax() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n return Math.min(Math.max(parseInt(value, 10), min), max);\n}\n\nvar Node = /*#__PURE__*/function (_Extension) {\n _inherits(Node, _Extension);\n\n var _super = _createSuper(Node);\n\n function Node() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Node);\n\n return _super.call(this, options);\n }\n\n _createClass(Node, [{\n key: \"command\",\n value: function command() {\n return function () {};\n }\n }, {\n key: \"type\",\n get: function get() {\n return 'node';\n }\n }, {\n key: \"view\",\n get: function get() {\n return null;\n }\n }, {\n key: \"schema\",\n get: function get() {\n return null;\n }\n }]);\n\n return Node;\n}(Extension);\n\nvar Doc = /*#__PURE__*/function (_Node) {\n _inherits(Doc, _Node);\n\n var _super = _createSuper(Doc);\n\n function Doc() {\n _classCallCheck(this, Doc);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Doc, [{\n key: \"name\",\n get: function get() {\n return 'doc';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'block+'\n };\n }\n }]);\n\n return Doc;\n}(Node);\n\nvar Paragraph = /*#__PURE__*/function (_Node) {\n _inherits(Paragraph, _Node);\n\n var _super = _createSuper(Paragraph);\n\n function Paragraph() {\n _classCallCheck(this, Paragraph);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Paragraph, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type;\n return function () {\n return setBlockType(type);\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'paragraph';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'inline*',\n group: 'block',\n draggable: false,\n parseDOM: [{\n tag: 'p'\n }],\n toDOM: function toDOM() {\n return ['p', 0];\n }\n };\n }\n }]);\n\n return Paragraph;\n}(Node);\n\nvar Text = /*#__PURE__*/function (_Node) {\n _inherits(Text, _Node);\n\n var _super = _createSuper(Text);\n\n function Text() {\n _classCallCheck(this, Text);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Text, [{\n key: \"name\",\n get: function get() {\n return 'text';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n group: 'inline'\n };\n }\n }]);\n\n return Text;\n}(Node);\n\nvar css = \".ProseMirror {\\n position: relative;\\n}\\n\\n.ProseMirror {\\n word-wrap: break-word;\\n white-space: pre-wrap;\\n -webkit-font-variant-ligatures: none;\\n font-variant-ligatures: none;\\n}\\n\\n.ProseMirror pre {\\n white-space: pre-wrap;\\n}\\n\\n.ProseMirror-gapcursor {\\n display: none;\\n pointer-events: none;\\n position: absolute;\\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\";\n\nvar Editor = /*#__PURE__*/function (_Emitter) {\n _inherits(Editor, _Emitter);\n\n var _super = _createSuper(Editor);\n\n function Editor() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Editor);\n\n _this = _super.call(this);\n _this.defaultOptions = {\n editorProps: {},\n editable: true,\n autoFocus: null,\n extensions: [],\n content: '',\n topNode: 'doc',\n emptyDocument: {\n type: 'doc',\n content: [{\n type: 'paragraph'\n }]\n },\n useBuiltInExtensions: true,\n disableInputRules: false,\n disablePasteRules: false,\n dropCursor: {},\n parseOptions: {},\n injectCSS: true,\n onInit: function onInit() {},\n onTransaction: function onTransaction() {},\n onUpdate: function onUpdate() {},\n onFocus: function onFocus() {},\n onBlur: function onBlur() {},\n onPaste: function onPaste() {},\n onDrop: function onDrop() {}\n };\n _this.events = ['init', 'transaction', 'update', 'focus', 'blur', 'paste', 'drop'];\n\n _this.init(options);\n\n return _this;\n }\n\n _createClass(Editor, [{\n key: \"init\",\n value: function init() {\n var _this2 = this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.setOptions(_objectSpread2({}, this.defaultOptions, {}, options));\n this.focused = false;\n this.selection = {\n from: 0,\n to: 0\n };\n this.element = document.createElement('div');\n this.extensions = this.createExtensions();\n this.nodes = this.createNodes();\n this.marks = this.createMarks();\n this.schema = this.createSchema();\n this.plugins = this.createPlugins();\n this.keymaps = this.createKeymaps();\n this.inputRules = this.createInputRules();\n this.pasteRules = this.createPasteRules();\n this.view = this.createView();\n this.commands = this.createCommands();\n this.setActiveNodesAndMarks();\n\n if (this.options.injectCSS) {\n injectCSS(css);\n }\n\n if (this.options.autoFocus !== null) {\n this.focus(this.options.autoFocus);\n }\n\n this.events.forEach(function (name) {\n _this2.on(name, _this2.options[camelCase(\"on \".concat(name))] || function () {});\n });\n this.emit('init', {\n view: this.view,\n state: this.state\n }); // give extension manager access to our view\n\n this.extensions.view = this.view;\n }\n }, {\n key: \"setOptions\",\n value: function setOptions(options) {\n this.options = _objectSpread2({}, this.options, {}, options);\n\n if (this.view && this.state) {\n this.view.updateState(this.state);\n }\n }\n }, {\n key: \"createExtensions\",\n value: function createExtensions() {\n return new ExtensionManager([].concat(_toConsumableArray(this.builtInExtensions), _toConsumableArray(this.options.extensions)), this);\n }\n }, {\n key: \"createPlugins\",\n value: function createPlugins() {\n return this.extensions.plugins;\n }\n }, {\n key: \"createKeymaps\",\n value: function createKeymaps() {\n return this.extensions.keymaps({\n schema: this.schema\n });\n }\n }, {\n key: \"createInputRules\",\n value: function createInputRules() {\n return this.extensions.inputRules({\n schema: this.schema,\n excludedExtensions: this.options.disableInputRules\n });\n }\n }, {\n key: \"createPasteRules\",\n value: function createPasteRules() {\n return this.extensions.pasteRules({\n schema: this.schema,\n excludedExtensions: this.options.disablePasteRules\n });\n }\n }, {\n key: \"createCommands\",\n value: function createCommands() {\n return this.extensions.commands({\n schema: this.schema,\n view: this.view\n });\n }\n }, {\n key: \"createNodes\",\n value: function createNodes() {\n return this.extensions.nodes;\n }\n }, {\n key: \"createMarks\",\n value: function createMarks() {\n return this.extensions.marks;\n }\n }, {\n key: \"createSchema\",\n value: function createSchema() {\n return new Schema({\n topNode: this.options.topNode,\n nodes: this.nodes,\n marks: this.marks\n });\n }\n }, {\n key: \"createState\",\n value: function createState() {\n var _this3 = this;\n\n return EditorState.create({\n schema: this.schema,\n doc: this.createDocument(this.options.content),\n plugins: [].concat(_toConsumableArray(this.plugins), [inputRules({\n rules: this.inputRules\n })], _toConsumableArray(this.pasteRules), _toConsumableArray(this.keymaps), [keymap({\n Backspace: undoInputRule\n }), keymap(baseKeymap), dropCursor(this.options.dropCursor), gapCursor(), new Plugin({\n key: new PluginKey('editable'),\n props: {\n editable: function editable() {\n return _this3.options.editable;\n }\n }\n }), new Plugin({\n props: {\n attributes: {\n tabindex: 0\n },\n handleDOMEvents: {\n focus: function focus(view, event) {\n _this3.focused = true;\n\n _this3.emit('focus', {\n event: event,\n state: view.state,\n view: view\n });\n\n var transaction = _this3.state.tr.setMeta('focused', true);\n\n _this3.view.dispatch(transaction);\n },\n blur: function blur(view, event) {\n _this3.focused = false;\n\n _this3.emit('blur', {\n event: event,\n state: view.state,\n view: view\n });\n\n var transaction = _this3.state.tr.setMeta('focused', false);\n\n _this3.view.dispatch(transaction);\n }\n }\n }\n }), new Plugin({\n props: this.options.editorProps\n })])\n });\n }\n }, {\n key: \"createDocument\",\n value: function createDocument(content) {\n var parseOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.parseOptions;\n\n if (content === null) {\n return this.schema.nodeFromJSON(this.options.emptyDocument);\n }\n\n if (_typeof(content) === 'object') {\n try {\n return this.schema.nodeFromJSON(content);\n } catch (error) {\n console.warn('[tiptap warn]: Invalid content.', 'Passed value:', content, 'Error:', error);\n return this.schema.nodeFromJSON(this.options.emptyDocument);\n }\n }\n\n if (typeof content === 'string') {\n var element = document.createElement('div');\n element.innerHTML = content.trim();\n return DOMParser.fromSchema(this.schema).parse(element, parseOptions);\n }\n\n return false;\n }\n }, {\n key: \"createView\",\n value: function createView() {\n var _this4 = this;\n\n return new EditorView(this.element, {\n state: this.createState(),\n handlePaste: function handlePaste() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this4.emit.apply(_this4, ['paste'].concat(args));\n },\n handleDrop: function handleDrop() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n _this4.emit.apply(_this4, ['drop'].concat(args));\n },\n dispatchTransaction: this.dispatchTransaction.bind(this)\n });\n }\n }, {\n key: \"setParentComponent\",\n value: function setParentComponent() {\n var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (!component) {\n return;\n }\n\n this.view.setProps({\n nodeViews: this.initNodeViews({\n parent: component,\n extensions: [].concat(_toConsumableArray(this.builtInExtensions), _toConsumableArray(this.options.extensions))\n })\n });\n }\n }, {\n key: \"initNodeViews\",\n value: function initNodeViews(_ref) {\n var _this5 = this;\n\n var parent = _ref.parent,\n extensions = _ref.extensions;\n return extensions.filter(function (extension) {\n return ['node', 'mark'].includes(extension.type);\n }).filter(function (extension) {\n return extension.view;\n }).reduce(function (nodeViews, extension) {\n var nodeView = function nodeView(node, view, getPos, decorations) {\n var component = extension.view;\n return new ComponentView(component, {\n editor: _this5,\n extension: extension,\n parent: parent,\n node: node,\n view: view,\n getPos: getPos,\n decorations: decorations\n });\n };\n\n return _objectSpread2({}, nodeViews, _defineProperty({}, extension.name, nodeView));\n }, {});\n }\n }, {\n key: \"dispatchTransaction\",\n value: function dispatchTransaction(transaction) {\n var newState = this.state.apply(transaction);\n this.view.updateState(newState);\n this.selection = {\n from: this.state.selection.from,\n to: this.state.selection.to\n };\n this.setActiveNodesAndMarks();\n this.emit('transaction', {\n getHTML: this.getHTML.bind(this),\n getJSON: this.getJSON.bind(this),\n state: this.state,\n transaction: transaction\n });\n\n if (!transaction.docChanged || transaction.getMeta('preventUpdate')) {\n return;\n }\n\n this.emitUpdate(transaction);\n }\n }, {\n key: \"emitUpdate\",\n value: function emitUpdate(transaction) {\n this.emit('update', {\n getHTML: this.getHTML.bind(this),\n getJSON: this.getJSON.bind(this),\n state: this.state,\n transaction: transaction\n });\n }\n }, {\n key: \"resolveSelection\",\n value: function resolveSelection() {\n var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (this.selection && position === null) {\n return this.selection;\n }\n\n if (position === 'start' || position === true) {\n return {\n from: 0,\n to: 0\n };\n }\n\n if (position === 'end') {\n var doc = this.state.doc;\n return {\n from: doc.content.size,\n to: doc.content.size\n };\n }\n\n return {\n from: position,\n to: position\n };\n }\n }, {\n key: \"focus\",\n value: function focus() {\n var _this6 = this;\n\n var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (this.view.focused && position === null || position === false) {\n return;\n }\n\n var _this$resolveSelectio = this.resolveSelection(position),\n from = _this$resolveSelectio.from,\n to = _this$resolveSelectio.to;\n\n this.setSelection(from, to);\n setTimeout(function () {\n return _this6.view.focus();\n }, 10);\n }\n }, {\n key: \"setSelection\",\n value: function setSelection() {\n var from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var _this$state = this.state,\n doc = _this$state.doc,\n tr = _this$state.tr;\n var resolvedFrom = minMax(from, 0, doc.content.size);\n var resolvedEnd = minMax(to, 0, doc.content.size);\n var selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);\n var transaction = tr.setSelection(selection);\n this.view.dispatch(transaction);\n }\n }, {\n key: \"blur\",\n value: function blur() {\n this.view.dom.blur();\n }\n }, {\n key: \"getSchemaJSON\",\n value: function getSchemaJSON() {\n return JSON.parse(JSON.stringify({\n nodes: this.extensions.nodes,\n marks: this.extensions.marks\n }));\n }\n }, {\n key: \"getHTML\",\n value: function getHTML() {\n var div = document.createElement('div');\n var fragment = DOMSerializer.fromSchema(this.schema).serializeFragment(this.state.doc.content);\n div.appendChild(fragment);\n return div.innerHTML;\n }\n }, {\n key: \"getJSON\",\n value: function getJSON() {\n return this.state.doc.toJSON();\n }\n }, {\n key: \"setContent\",\n value: function setContent() {\n var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var emitUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var parseOptions = arguments.length > 2 ? arguments[2] : undefined;\n var _this$state2 = this.state,\n doc = _this$state2.doc,\n tr = _this$state2.tr;\n var document = this.createDocument(content, parseOptions);\n var selection = TextSelection.create(doc, 0, doc.content.size);\n var transaction = tr.setSelection(selection).replaceSelectionWith(document, false).setMeta('preventUpdate', !emitUpdate);\n this.view.dispatch(transaction);\n }\n }, {\n key: \"clearContent\",\n value: function clearContent() {\n var emitUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.setContent(this.options.emptyDocument, emitUpdate);\n }\n }, {\n key: \"setActiveNodesAndMarks\",\n value: function setActiveNodesAndMarks() {\n var _this7 = this;\n\n this.activeMarks = Object.entries(this.schema.marks).reduce(function (marks, _ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n name = _ref3[0],\n mark = _ref3[1];\n\n return _objectSpread2({}, marks, _defineProperty({}, name, function () {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return markIsActive(_this7.state, mark, attrs);\n }));\n }, {});\n this.activeMarkAttrs = Object.entries(this.schema.marks).reduce(function (marks, _ref4) {\n var _ref5 = _slicedToArray(_ref4, 2),\n name = _ref5[0],\n mark = _ref5[1];\n\n return _objectSpread2({}, marks, _defineProperty({}, name, getMarkAttrs(_this7.state, mark)));\n }, {});\n this.activeNodes = Object.entries(this.schema.nodes).reduce(function (nodes, _ref6) {\n var _ref7 = _slicedToArray(_ref6, 2),\n name = _ref7[0],\n node = _ref7[1];\n\n return _objectSpread2({}, nodes, _defineProperty({}, name, function () {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return nodeIsActive(_this7.state, node, attrs);\n }));\n }, {});\n }\n }, {\n key: \"getMarkAttrs\",\n value: function getMarkAttrs() {\n var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n return this.activeMarkAttrs[type];\n }\n }, {\n key: \"getNodeAttrs\",\n value: function getNodeAttrs$1() {\n var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n return _objectSpread2({}, getNodeAttrs(this.state, this.schema.nodes[type]));\n }\n }, {\n key: \"registerPlugin\",\n value: function registerPlugin() {\n var plugin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (!plugin) {\n return;\n }\n\n var newState = this.state.reconfigure({\n plugins: this.state.plugins.concat([plugin])\n });\n this.view.updateState(newState);\n }\n }, {\n key: \"unregisterPlugin\",\n value: function unregisterPlugin() {\n var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n if (!name || !this.view.docView) {\n return;\n }\n\n var newState = this.state.reconfigure({\n plugins: this.state.plugins.filter(function (plugin) {\n return !plugin.key.startsWith(\"\".concat(name, \"$\"));\n })\n });\n this.view.updateState(newState);\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n if (!this.view) {\n return;\n }\n\n this.view.destroy();\n }\n }, {\n key: \"builtInExtensions\",\n get: function get() {\n if (!this.options.useBuiltInExtensions) {\n return [];\n }\n\n return [new Doc(), new Text(), new Paragraph()];\n }\n }, {\n key: \"state\",\n get: function get() {\n return this.view ? this.view.state : null;\n }\n }, {\n key: \"isActive\",\n get: function get() {\n return Object.entries(_objectSpread2({}, this.activeMarks, {}, this.activeNodes)).reduce(function (types, _ref8) {\n var _ref9 = _slicedToArray(_ref8, 2),\n name = _ref9[0],\n value = _ref9[1];\n\n return _objectSpread2({}, types, _defineProperty({}, name, function () {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return value(attrs);\n }));\n }, {});\n }\n }]);\n\n return Editor;\n}(Emitter);\n\nvar EditorContent = {\n props: {\n editor: {\n default: null,\n type: Object\n }\n },\n watch: {\n editor: {\n immediate: true,\n handler: function handler(editor) {\n var _this = this;\n\n if (editor && editor.element) {\n this.$nextTick(function () {\n _this.$el.appendChild(editor.element.firstChild);\n\n editor.setParentComponent(_this);\n });\n }\n }\n }\n },\n render: function render(createElement) {\n return createElement('div');\n },\n beforeDestroy: function beforeDestroy() {\n this.editor.element = this.$el;\n }\n};\n\nvar Menu = /*#__PURE__*/function () {\n function Menu(_ref) {\n var _this = this;\n\n var options = _ref.options;\n\n _classCallCheck(this, Menu);\n\n this.options = options;\n this.preventHide = false; // the mousedown event is fired before blur so we can prevent it\n\n this.mousedownHandler = this.handleClick.bind(this);\n this.options.element.addEventListener('mousedown', this.mousedownHandler, {\n capture: true\n });\n\n this.blurHandler = function () {\n if (_this.preventHide) {\n _this.preventHide = false;\n return;\n }\n\n _this.options.editor.emit('menubar:focusUpdate', false);\n };\n\n this.options.editor.on('blur', this.blurHandler);\n }\n\n _createClass(Menu, [{\n key: \"handleClick\",\n value: function handleClick() {\n this.preventHide = true;\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.options.element.removeEventListener('mousedown', this.mousedownHandler);\n this.options.editor.off('blur', this.blurHandler);\n }\n }]);\n\n return Menu;\n}();\n\nfunction MenuBar (options) {\n return new Plugin({\n key: new PluginKey('menu_bar'),\n view: function view(editorView) {\n return new Menu({\n editorView: editorView,\n options: options\n });\n }\n });\n}\n\nvar EditorMenuBar = {\n props: {\n editor: {\n default: null,\n type: Object\n }\n },\n data: function data() {\n return {\n focused: false\n };\n },\n watch: {\n editor: {\n immediate: true,\n handler: function handler(editor) {\n var _this = this;\n\n if (editor) {\n this.$nextTick(function () {\n editor.registerPlugin(MenuBar({\n editor: editor,\n element: _this.$el\n }));\n _this.focused = editor.focused;\n editor.on('focus', function () {\n _this.focused = true;\n });\n editor.on('menubar:focusUpdate', function (focused) {\n _this.focused = focused;\n });\n });\n }\n }\n }\n },\n render: function render() {\n if (!this.editor) {\n return null;\n }\n\n return this.$scopedSlots.default({\n focused: this.focused,\n focus: this.editor.focus,\n commands: this.editor.commands,\n isActive: this.editor.isActive,\n getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor),\n getNodeAttrs: this.editor.getNodeAttrs.bind(this.editor)\n });\n }\n};\n\nfunction textRange(node, from, to) {\n var range = document.createRange();\n range.setEnd(node, to == null ? node.nodeValue.length : to);\n range.setStart(node, from || 0);\n return range;\n}\n\nfunction singleRect(object, bias) {\n var rects = object.getClientRects();\n return !rects.length ? object.getBoundingClientRect() : rects[bias < 0 ? 0 : rects.length - 1];\n}\n\nfunction coordsAtPos(view, pos) {\n var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n var _view$docView$domFrom = view.docView.domFromPos(pos),\n node = _view$docView$domFrom.node,\n offset = _view$docView$domFrom.offset;\n\n var side;\n var rect;\n\n if (node.nodeType === 3) {\n if (end && offset < node.nodeValue.length) {\n rect = singleRect(textRange(node, offset - 1, offset), -1);\n side = 'right';\n } else if (offset < node.nodeValue.length) {\n rect = singleRect(textRange(node, offset, offset + 1), -1);\n side = 'left';\n }\n } else if (node.firstChild) {\n if (offset < node.childNodes.length) {\n var child = node.childNodes[offset];\n rect = singleRect(child.nodeType === 3 ? textRange(child) : child, -1);\n side = 'left';\n }\n\n if ((!rect || rect.top === rect.bottom) && offset) {\n var _child = node.childNodes[offset - 1];\n rect = singleRect(_child.nodeType === 3 ? textRange(_child) : _child, 1);\n side = 'right';\n }\n } else {\n rect = node.getBoundingClientRect();\n side = 'left';\n }\n\n var x = rect[side];\n return {\n top: rect.top,\n bottom: rect.bottom,\n left: x,\n right: x\n };\n}\n\nvar Menu$1 = /*#__PURE__*/function () {\n function Menu(_ref) {\n var _this = this;\n\n var options = _ref.options,\n editorView = _ref.editorView;\n\n _classCallCheck(this, Menu);\n\n this.options = _objectSpread2({}, {\n element: null,\n keepInBounds: true,\n onUpdate: function onUpdate() {\n return false;\n }\n }, {}, options);\n this.editorView = editorView;\n this.isActive = false;\n this.left = 0;\n this.bottom = 0;\n this.top = 0;\n this.preventHide = false; // the mousedown event is fired before blur so we can prevent it\n\n this.mousedownHandler = this.handleClick.bind(this);\n this.options.element.addEventListener('mousedown', this.mousedownHandler, {\n capture: true\n });\n\n this.focusHandler = function (_ref2) {\n var view = _ref2.view;\n\n _this.update(view);\n };\n\n this.options.editor.on('focus', this.focusHandler);\n\n this.blurHandler = function (_ref3) {\n var event = _ref3.event;\n\n if (_this.preventHide) {\n _this.preventHide = false;\n return;\n }\n\n _this.hide(event);\n };\n\n this.options.editor.on('blur', this.blurHandler);\n }\n\n _createClass(Menu, [{\n key: \"handleClick\",\n value: function handleClick() {\n this.preventHide = true;\n }\n }, {\n key: \"update\",\n value: function update(view, lastState) {\n var state = view.state;\n\n if (view.composing) {\n return;\n } // Don't do anything if the document/selection didn't change\n\n\n if (lastState && lastState.doc.eq(state.doc) && lastState.selection.eq(state.selection)) {\n return;\n } // Hide the tooltip if the selection is empty\n\n\n if (state.selection.empty) {\n this.hide();\n return;\n } // Otherwise, reposition it and update its content\n\n\n var _state$selection = state.selection,\n from = _state$selection.from,\n to = _state$selection.to; // These are in screen coordinates\n // We can't use EditorView.cordsAtPos here because it can't handle linebreaks correctly\n // See: https://github.com/ProseMirror/prosemirror-view/pull/47\n\n var start = coordsAtPos(view, from);\n var end = coordsAtPos(view, to, true); // The box in which the tooltip is positioned, to use as base\n\n var parent = this.options.element.offsetParent;\n\n if (!parent) {\n this.hide();\n return;\n }\n\n var box = parent.getBoundingClientRect();\n var el = this.options.element.getBoundingClientRect(); // Find a center-ish x position from the selection endpoints (when\n // crossing lines, end may be more to the left)\n\n var left = (start.left + end.left) / 2 - box.left; // Keep the menuBubble in the bounding box of the offsetParent i\n\n this.left = Math.round(this.options.keepInBounds ? Math.min(box.width - el.width / 2, Math.max(left, el.width / 2)) : left);\n this.bottom = Math.round(box.bottom - start.top);\n this.top = Math.round(end.bottom - box.top);\n this.isActive = true;\n this.sendUpdate();\n }\n }, {\n key: \"sendUpdate\",\n value: function sendUpdate() {\n this.options.onUpdate({\n isActive: this.isActive,\n left: this.left,\n bottom: this.bottom,\n top: this.top\n });\n }\n }, {\n key: \"hide\",\n value: function hide(event) {\n if (event && event.relatedTarget && this.options.element.parentNode && this.options.element.parentNode.contains(event.relatedTarget)) {\n return;\n }\n\n this.isActive = false;\n this.sendUpdate();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.options.element.removeEventListener('mousedown', this.mousedownHandler);\n this.options.editor.off('focus', this.focusHandler);\n this.options.editor.off('blur', this.blurHandler);\n }\n }]);\n\n return Menu;\n}();\n\nfunction MenuBubble (options) {\n return new Plugin({\n key: new PluginKey('menu_bubble'),\n view: function view(editorView) {\n return new Menu$1({\n editorView: editorView,\n options: options\n });\n }\n });\n}\n\nvar EditorMenuBubble = {\n props: {\n editor: {\n default: null,\n type: Object\n },\n keepInBounds: {\n default: true,\n type: Boolean\n }\n },\n data: function data() {\n return {\n menu: {\n isActive: false,\n left: 0,\n bottom: 0\n }\n };\n },\n watch: {\n editor: {\n immediate: true,\n handler: function handler(editor) {\n var _this = this;\n\n if (editor) {\n this.$nextTick(function () {\n editor.registerPlugin(MenuBubble({\n editor: editor,\n element: _this.$el,\n keepInBounds: _this.keepInBounds,\n onUpdate: function onUpdate(menu) {\n // the second check ensures event is fired only once\n if (menu.isActive && _this.menu.isActive === false) {\n _this.$emit('show', menu);\n } else if (!menu.isActive && _this.menu.isActive === true) {\n _this.$emit('hide', menu);\n }\n\n _this.menu = menu;\n }\n }));\n });\n }\n }\n }\n },\n render: function render() {\n if (!this.editor) {\n return null;\n }\n\n return this.$scopedSlots.default({\n focused: this.editor.view.focused,\n focus: this.editor.focus,\n commands: this.editor.commands,\n isActive: this.editor.isActive,\n getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor),\n getNodeAttrs: this.editor.getNodeAttrs.bind(this.editor),\n menu: this.menu\n });\n },\n beforeDestroy: function beforeDestroy() {\n this.editor.unregisterPlugin('menu_bubble');\n }\n};\n\nvar Menu$2 = /*#__PURE__*/function () {\n function Menu(_ref) {\n var _this = this;\n\n var options = _ref.options,\n editorView = _ref.editorView;\n\n _classCallCheck(this, Menu);\n\n this.options = _objectSpread2({}, {\n resizeObserver: true,\n element: null,\n onUpdate: function onUpdate() {\n return false;\n }\n }, {}, options);\n this.preventHide = false;\n this.editorView = editorView;\n this.isActive = false;\n this.top = 0; // the mousedown event is fired before blur so we can prevent it\n\n this.mousedownHandler = this.handleClick.bind(this);\n this.options.element.addEventListener('mousedown', this.mousedownHandler, {\n capture: true\n });\n\n this.focusHandler = function (_ref2) {\n var view = _ref2.view;\n\n _this.update(view);\n };\n\n this.options.editor.on('focus', this.focusHandler);\n\n this.blurHandler = function (_ref3) {\n var event = _ref3.event;\n\n if (_this.preventHide) {\n _this.preventHide = false;\n return;\n }\n\n _this.hide(event);\n };\n\n this.options.editor.on('blur', this.blurHandler); // sometimes we have to update the position\n // because of a loaded images for example\n\n if (this.options.resizeObserver && window.ResizeObserver) {\n this.resizeObserver = new ResizeObserver(function () {\n if (_this.isActive) {\n _this.update(_this.editorView);\n }\n });\n this.resizeObserver.observe(this.editorView.dom);\n }\n }\n\n _createClass(Menu, [{\n key: \"handleClick\",\n value: function handleClick() {\n this.preventHide = true;\n }\n }, {\n key: \"update\",\n value: function update(view, lastState) {\n var state = view.state; // Don't do anything if the document/selection didn't change\n\n if (lastState && lastState.doc.eq(state.doc) && lastState.selection.eq(state.selection)) {\n return;\n }\n\n if (!state.selection.empty) {\n this.hide();\n return;\n }\n\n var currentDom = view.domAtPos(state.selection.anchor);\n var isActive = currentDom.node.innerHTML === '<br>' && currentDom.node.tagName === 'P' && currentDom.node.parentNode === view.dom;\n\n if (!isActive) {\n this.hide();\n return;\n }\n\n var parent = this.options.element.offsetParent;\n\n if (!parent) {\n this.hide();\n return;\n }\n\n var editorBoundings = parent.getBoundingClientRect();\n var cursorBoundings = view.coordsAtPos(state.selection.anchor);\n var top = cursorBoundings.top - editorBoundings.top;\n this.isActive = true;\n this.top = top;\n this.sendUpdate();\n }\n }, {\n key: \"sendUpdate\",\n value: function sendUpdate() {\n this.options.onUpdate({\n isActive: this.isActive,\n top: this.top\n });\n }\n }, {\n key: \"hide\",\n value: function hide(event) {\n if (event && event.relatedTarget && this.options.element.parentNode && this.options.element.parentNode.contains(event.relatedTarget)) {\n return;\n }\n\n this.isActive = false;\n this.sendUpdate();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.options.element.removeEventListener('mousedown', this.mousedownHandler);\n\n if (this.resizeObserver) {\n this.resizeObserver.unobserve(this.editorView.dom);\n }\n\n this.options.editor.off('focus', this.focusHandler);\n this.options.editor.off('blur', this.blurHandler);\n }\n }]);\n\n return Menu;\n}();\n\nfunction FloatingMenu (options) {\n return new Plugin({\n key: new PluginKey('floating_menu'),\n view: function view(editorView) {\n return new Menu$2({\n editorView: editorView,\n options: options\n });\n }\n });\n}\n\nvar EditorFloatingMenu = {\n props: {\n editor: {\n default: null,\n type: Object\n }\n },\n data: function data() {\n return {\n menu: {\n isActive: false,\n left: 0,\n bottom: 0\n }\n };\n },\n watch: {\n editor: {\n immediate: true,\n handler: function handler(editor) {\n var _this = this;\n\n if (editor) {\n this.$nextTick(function () {\n editor.registerPlugin(FloatingMenu({\n editor: editor,\n element: _this.$el,\n onUpdate: function onUpdate(menu) {\n // the second check ensures event is fired only once\n if (menu.isActive && _this.menu.isActive === false) {\n _this.$emit('show', menu);\n } else if (!menu.isActive && _this.menu.isActive === true) {\n _this.$emit('hide', menu);\n }\n\n _this.menu = menu;\n }\n }));\n });\n }\n }\n }\n },\n render: function render() {\n if (!this.editor) {\n return null;\n }\n\n return this.$scopedSlots.default({\n focused: this.editor.view.focused,\n focus: this.editor.focus,\n commands: this.editor.commands,\n isActive: this.editor.isActive,\n getMarkAttrs: this.editor.getMarkAttrs.bind(this.editor),\n getNodeAttrs: this.editor.getNodeAttrs.bind(this.editor),\n menu: this.menu\n });\n },\n beforeDestroy: function beforeDestroy() {\n this.editor.unregisterPlugin('floating_menu');\n }\n};\n\nexport { Doc, Editor, EditorContent, EditorFloatingMenu, EditorMenuBar, EditorMenuBubble, Extension, Mark, Node, Paragraph, Text };\n","// ::- Persistent data structure representing an ordered mapping from\n// strings to values, with some convenient update methods.\nfunction OrderedMap(content) {\n this.content = content;\n}\n\nOrderedMap.prototype = {\n constructor: OrderedMap,\n\n find: function(key) {\n for (var i = 0; i < this.content.length; i += 2)\n if (this.content[i] === key) return i\n return -1\n },\n\n // :: (string) → ?any\n // Retrieve the value stored under `key`, or return undefined when\n // no such key exists.\n get: function(key) {\n var found = this.find(key);\n return found == -1 ? undefined : this.content[found + 1]\n },\n\n // :: (string, any, ?string) → OrderedMap\n // Create a new map by replacing the value of `key` with a new\n // value, or adding a binding to the end of the map. If `newKey` is\n // given, the key of the binding will be replaced with that key.\n update: function(key, value, newKey) {\n var self = newKey && newKey != key ? this.remove(newKey) : this;\n var found = self.find(key), content = self.content.slice();\n if (found == -1) {\n content.push(newKey || key, value);\n } else {\n content[found + 1] = value;\n if (newKey) content[found] = newKey;\n }\n return new OrderedMap(content)\n },\n\n // :: (string) → OrderedMap\n // Return a map with the given key removed, if it existed.\n remove: function(key) {\n var found = this.find(key);\n if (found == -1) return this\n var content = this.content.slice();\n content.splice(found, 2);\n return new OrderedMap(content)\n },\n\n // :: (string, any) → OrderedMap\n // Add a new key to the start of the map.\n addToStart: function(key, value) {\n return new OrderedMap([key, value].concat(this.remove(key).content))\n },\n\n // :: (string, any) → OrderedMap\n // Add a new key to the end of the map.\n addToEnd: function(key, value) {\n var content = this.remove(key).content.slice();\n content.push(key, value);\n return new OrderedMap(content)\n },\n\n // :: (string, string, any) → OrderedMap\n // Add a key after the given key. If `place` is not found, the new\n // key is added to the end.\n addBefore: function(place, key, value) {\n var without = this.remove(key), content = without.content.slice();\n var found = without.find(place);\n content.splice(found == -1 ? content.length : found, 0, key, value);\n return new OrderedMap(content)\n },\n\n // :: ((key: string, value: any))\n // Call the given function for each key/value pair in the map, in\n // order.\n forEach: function(f) {\n for (var i = 0; i < this.content.length; i += 2)\n f(this.content[i], this.content[i + 1]);\n },\n\n // :: (union<Object, OrderedMap>) → OrderedMap\n // Create a new map by prepending the keys in this map that don't\n // appear in `map` before the keys in `map`.\n prepend: function(map) {\n map = OrderedMap.from(map);\n if (!map.size) return this\n return new OrderedMap(map.content.concat(this.subtract(map).content))\n },\n\n // :: (union<Object, OrderedMap>) → OrderedMap\n // Create a new map by appending the keys in this map that don't\n // appear in `map` after the keys in `map`.\n append: function(map) {\n map = OrderedMap.from(map);\n if (!map.size) return this\n return new OrderedMap(this.subtract(map).content.concat(map.content))\n },\n\n // :: (union<Object, OrderedMap>) → OrderedMap\n // Create a map containing all the keys in this map that don't\n // appear in `map`.\n subtract: function(map) {\n var result = this;\n map = OrderedMap.from(map);\n for (var i = 0; i < map.content.length; i += 2)\n result = result.remove(map.content[i]);\n return result\n },\n\n // :: number\n // The amount of keys in this map.\n get size() {\n return this.content.length >> 1\n }\n};\n\n// :: (?union<Object, OrderedMap>) → OrderedMap\n// Return a map with the given content. If null, create an empty\n// map. If given an ordered map, return that map itself. If given an\n// object, create a map from the object's properties.\nOrderedMap.from = function(value) {\n if (value instanceof OrderedMap) return value\n var content = [];\n if (value) for (var prop in value) content.push(prop, value[prop]);\n return new OrderedMap(content)\n};\n\nvar orderedmap = OrderedMap;\n\nexport default orderedmap;\n","import OrderedMap from 'orderedmap';\n\nfunction findDiffStart(a, b, pos) {\n for (var i = 0;; i++) {\n if (i == a.childCount || i == b.childCount)\n { return a.childCount == b.childCount ? null : pos }\n\n var childA = a.child(i), childB = b.child(i);\n if (childA == childB) { pos += childA.nodeSize; continue }\n\n if (!childA.sameMarkup(childB)) { return pos }\n\n if (childA.isText && childA.text != childB.text) {\n for (var j = 0; childA.text[j] == childB.text[j]; j++)\n { pos++; }\n return pos\n }\n if (childA.content.size || childB.content.size) {\n var inner = findDiffStart(childA.content, childB.content, pos + 1);\n if (inner != null) { return inner }\n }\n pos += childA.nodeSize;\n }\n}\n\nfunction findDiffEnd(a, b, posA, posB) {\n for (var iA = a.childCount, iB = b.childCount;;) {\n if (iA == 0 || iB == 0)\n { return iA == iB ? null : {a: posA, b: posB} }\n\n var childA = a.child(--iA), childB = b.child(--iB), size = childA.nodeSize;\n if (childA == childB) {\n posA -= size; posB -= size;\n continue\n }\n\n if (!childA.sameMarkup(childB)) { return {a: posA, b: posB} }\n\n if (childA.isText && childA.text != childB.text) {\n var same = 0, minSize = Math.min(childA.text.length, childB.text.length);\n while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {\n same++; posA--; posB--;\n }\n return {a: posA, b: posB}\n }\n if (childA.content.size || childB.content.size) {\n var inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);\n if (inner) { return inner }\n }\n posA -= size; posB -= size;\n }\n}\n\n// ::- A fragment represents a node's collection of child nodes.\n//\n// Like nodes, fragments are persistent data structures, and you\n// should not mutate them or their content. Rather, you create new\n// instances whenever needed. The API tries to make this easy.\nvar Fragment = function Fragment(content, size) {\n this.content = content;\n // :: number\n // The size of the fragment, which is the total of the size of its\n // content nodes.\n this.size = size || 0;\n if (size == null) { for (var i = 0; i < content.length; i++)\n { this.size += content[i].nodeSize; } }\n};\n\nvar prototypeAccessors = { firstChild: { configurable: true },lastChild: { configurable: true },childCount: { configurable: true } };\n\n// :: (number, number, (node: Node, start: number, parent: Node, index: number) → ?bool, ?number)\n// Invoke a callback for all descendant nodes between the given two\n// positions (relative to start of this fragment). Doesn't descend\n// into a node when the callback returns `false`.\nFragment.prototype.nodesBetween = function nodesBetween (from, to, f, nodeStart, parent) {\n if ( nodeStart === void 0 ) nodeStart = 0;\n\n for (var i = 0, pos = 0; pos < to; i++) {\n var child = this.content[i], end = pos + child.nodeSize;\n if (end > from && f(child, nodeStart + pos, parent, i) !== false && child.content.size) {\n var start = pos + 1;\n child.nodesBetween(Math.max(0, from - start),\n Math.min(child.content.size, to - start),\n f, nodeStart + start);\n }\n pos = end;\n }\n};\n\n// :: ((node: Node, pos: number, parent: Node) → ?bool)\n// Call the given callback for every descendant node. The callback\n// may return `false` to prevent traversal of a given node's children.\nFragment.prototype.descendants = function descendants (f) {\n this.nodesBetween(0, this.size, f);\n};\n\n// : (number, number, ?string, ?string) → string\nFragment.prototype.textBetween = function textBetween (from, to, blockSeparator, leafText) {\n var text = \"\", separated = true;\n this.nodesBetween(from, to, function (node, pos) {\n if (node.isText) {\n text += node.text.slice(Math.max(from, pos) - pos, to - pos);\n separated = !blockSeparator;\n } else if (node.isLeaf && leafText) {\n text += leafText;\n separated = !blockSeparator;\n } else if (!separated && node.isBlock) {\n text += blockSeparator;\n separated = true;\n }\n }, 0);\n return text\n};\n\n// :: (Fragment) → Fragment\n// Create a new fragment containing the combined content of this\n// fragment and the other.\nFragment.prototype.append = function append (other) {\n if (!other.size) { return this }\n if (!this.size) { return other }\n var last = this.lastChild, first = other.firstChild, content = this.content.slice(), i = 0;\n if (last.isText && last.sameMarkup(first)) {\n content[content.length - 1] = last.withText(last.text + first.text);\n i = 1;\n }\n for (; i < other.content.length; i++) { content.push(other.content[i]); }\n return new Fragment(content, this.size + other.size)\n};\n\n// :: (number, ?number) → Fragment\n// Cut out the sub-fragment between the two given positions.\nFragment.prototype.cut = function cut (from, to) {\n if (to == null) { to = this.size; }\n if (from == 0 && to == this.size) { return this }\n var result = [], size = 0;\n if (to > from) { for (var i = 0, pos = 0; pos < to; i++) {\n var child = this.content[i], end = pos + child.nodeSize;\n if (end > from) {\n if (pos < from || end > to) {\n if (child.isText)\n { child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos)); }\n else\n { child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1)); }\n }\n result.push(child);\n size += child.nodeSize;\n }\n pos = end;\n } }\n return new Fragment(result, size)\n};\n\nFragment.prototype.cutByIndex = function cutByIndex (from, to) {\n if (from == to) { return Fragment.empty }\n if (from == 0 && to == this.content.length) { return this }\n return new Fragment(this.content.slice(from, to))\n};\n\n// :: (number, Node) → Fragment\n// Create a new fragment in which the node at the given index is\n// replaced by the given node.\nFragment.prototype.replaceChild = function replaceChild (index, node) {\n var current = this.content[index];\n if (current == node) { return this }\n var copy = this.content.slice();\n var size = this.size + node.nodeSize - current.nodeSize;\n copy[index] = node;\n return new Fragment(copy, size)\n};\n\n// : (Node) → Fragment\n// Create a new fragment by prepending the given node to this\n// fragment.\nFragment.prototype.addToStart = function addToStart (node) {\n return new Fragment([node].concat(this.content), this.size + node.nodeSize)\n};\n\n// : (Node) → Fragment\n// Create a new fragment by appending the given node to this\n// fragment.\nFragment.prototype.addToEnd = function addToEnd (node) {\n return new Fragment(this.content.concat(node), this.size + node.nodeSize)\n};\n\n// :: (Fragment) → bool\n// Compare this fragment to another one.\nFragment.prototype.eq = function eq (other) {\n if (this.content.length != other.content.length) { return false }\n for (var i = 0; i < this.content.length; i++)\n { if (!this.content[i].eq(other.content[i])) { return false } }\n return true\n};\n\n// :: ?Node\n// The first child of the fragment, or `null` if it is empty.\nprototypeAccessors.firstChild.get = function () { return this.content.length ? this.content[0] : null };\n\n// :: ?Node\n// The last child of the fragment, or `null` if it is empty.\nprototypeAccessors.lastChild.get = function () { return this.content.length ? this.content[this.content.length - 1] : null };\n\n// :: number\n// The number of child nodes in this fragment.\nprototypeAccessors.childCount.get = function () { return this.content.length };\n\n// :: (number) → Node\n// Get the child node at the given index. Raise an error when the\n// index is out of range.\nFragment.prototype.child = function child (index) {\n var found = this.content[index];\n if (!found) { throw new RangeError(\"Index \" + index + \" out of range for \" + this) }\n return found\n};\n\n// :: (number) → ?Node\n// Get the child node at the given index, if it exists.\nFragment.prototype.maybeChild = function maybeChild (index) {\n return this.content[index]\n};\n\n// :: ((node: Node, offset: number, index: number))\n// Call `f` for every child node, passing the node, its offset\n// into this parent node, and its index.\nFragment.prototype.forEach = function forEach (f) {\n for (var i = 0, p = 0; i < this.content.length; i++) {\n var child = this.content[i];\n f(child, p, i);\n p += child.nodeSize;\n }\n};\n\n// :: (Fragment) → ?number\n// Find the first position at which this fragment and another\n// fragment differ, or `null` if they are the same.\nFragment.prototype.findDiffStart = function findDiffStart$1 (other, pos) {\n if ( pos === void 0 ) pos = 0;\n\n return findDiffStart(this, other, pos)\n};\n\n// :: (Fragment) → ?{a: number, b: number}\n// Find the first position, searching from the end, at which this\n// fragment and the given fragment differ, or `null` if they are the\n// same. Since this position will not be the same in both nodes, an\n// object with two separate positions is returned.\nFragment.prototype.findDiffEnd = function findDiffEnd$1 (other, pos, otherPos) {\n if ( pos === void 0 ) pos = this.size;\n if ( otherPos === void 0 ) otherPos = other.size;\n\n return findDiffEnd(this, other, pos, otherPos)\n};\n\n// : (number, ?number) → {index: number, offset: number}\n// Find the index and inner offset corresponding to a given relative\n// position in this fragment. The result object will be reused\n// (overwritten) the next time the function is called. (Not public.)\nFragment.prototype.findIndex = function findIndex (pos, round) {\n if ( round === void 0 ) round = -1;\n\n if (pos == 0) { return retIndex(0, pos) }\n if (pos == this.size) { return retIndex(this.content.length, pos) }\n if (pos > this.size || pos < 0) { throw new RangeError((\"Position \" + pos + \" outside of fragment (\" + (this) + \")\")) }\n for (var i = 0, curPos = 0;; i++) {\n var cur = this.child(i), end = curPos + cur.nodeSize;\n if (end >= pos) {\n if (end == pos || round > 0) { return retIndex(i + 1, end) }\n return retIndex(i, curPos)\n }\n curPos = end;\n }\n};\n\n// :: () → string\n// Return a debugging string that describes this fragment.\nFragment.prototype.toString = function toString () { return \"<\" + this.toStringInner() + \">\" };\n\nFragment.prototype.toStringInner = function toStringInner () { return this.content.join(\", \") };\n\n// :: () → ?Object\n// Create a JSON-serializeable representation of this fragment.\nFragment.prototype.toJSON = function toJSON () {\n return this.content.length ? this.content.map(function (n) { return n.toJSON(); }) : null\n};\n\n// :: (Schema, ?Object) → Fragment\n// Deserialize a fragment from its JSON representation.\nFragment.fromJSON = function fromJSON (schema, value) {\n if (!value) { return Fragment.empty }\n if (!Array.isArray(value)) { throw new RangeError(\"Invalid input for Fragment.fromJSON\") }\n return new Fragment(value.map(schema.nodeFromJSON))\n};\n\n// :: ([Node]) → Fragment\n// Build a fragment from an array of nodes. Ensures that adjacent\n// text nodes with the same marks are joined together.\nFragment.fromArray = function fromArray (array) {\n if (!array.length) { return Fragment.empty }\n var joined, size = 0;\n for (var i = 0; i < array.length; i++) {\n var node = array[i];\n size += node.nodeSize;\n if (i && node.isText && array[i - 1].sameMarkup(node)) {\n if (!joined) { joined = array.slice(0, i); }\n joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);\n } else if (joined) {\n joined.push(node);\n }\n }\n return new Fragment(joined || array, size)\n};\n\n// :: (?union<Fragment, Node, [Node]>) → Fragment\n// Create a fragment from something that can be interpreted as a set\n// of nodes. For `null`, it returns the empty fragment. For a\n// fragment, the fragment itself. For a node or array of nodes, a\n// fragment containing those nodes.\nFragment.from = function from (nodes) {\n if (!nodes) { return Fragment.empty }\n if (nodes instanceof Fragment) { return nodes }\n if (Array.isArray(nodes)) { return this.fromArray(nodes) }\n if (nodes.attrs) { return new Fragment([nodes], nodes.nodeSize) }\n throw new RangeError(\"Can not convert \" + nodes + \" to a Fragment\" +\n (nodes.nodesBetween ? \" (looks like multiple versions of prosemirror-model were loaded)\" : \"\"))\n};\n\nObject.defineProperties( Fragment.prototype, prototypeAccessors );\n\nvar found = {index: 0, offset: 0};\nfunction retIndex(index, offset) {\n found.index = index;\n found.offset = offset;\n return found\n}\n\n// :: Fragment\n// An empty fragment. Intended to be reused whenever a node doesn't\n// contain anything (rather than allocating a new empty fragment for\n// each leaf node).\nFragment.empty = new Fragment([], 0);\n\nfunction compareDeep(a, b) {\n if (a === b) { return true }\n if (!(a && typeof a == \"object\") ||\n !(b && typeof b == \"object\")) { return false }\n var array = Array.isArray(a);\n if (Array.isArray(b) != array) { return false }\n if (array) {\n if (a.length != b.length) { return false }\n for (var i = 0; i < a.length; i++) { if (!compareDeep(a[i], b[i])) { return false } }\n } else {\n for (var p in a) { if (!(p in b) || !compareDeep(a[p], b[p])) { return false } }\n for (var p$1 in b) { if (!(p$1 in a)) { return false } }\n }\n return true\n}\n\n// ::- A mark is a piece of information that can be attached to a node,\n// such as it being emphasized, in code font, or a link. It has a type\n// and optionally a set of attributes that provide further information\n// (such as the target of the link). Marks are created through a\n// `Schema`, which controls which types exist and which\n// attributes they have.\nvar Mark = function Mark(type, attrs) {\n // :: MarkType\n // The type of this mark.\n this.type = type;\n // :: Object\n // The attributes associated with this mark.\n this.attrs = attrs;\n};\n\n// :: ([Mark]) → [Mark]\n// Given a set of marks, create a new set which contains this one as\n// well, in the right position. If this mark is already in the set,\n// the set itself is returned. If any marks that are set to be\n// [exclusive](#model.MarkSpec.excludes) with this mark are present,\n// those are replaced by this one.\nMark.prototype.addToSet = function addToSet (set) {\n var copy, placed = false;\n for (var i = 0; i < set.length; i++) {\n var other = set[i];\n if (this.eq(other)) { return set }\n if (this.type.excludes(other.type)) {\n if (!copy) { copy = set.slice(0, i); }\n } else if (other.type.excludes(this.type)) {\n return set\n } else {\n if (!placed && other.type.rank > this.type.rank) {\n if (!copy) { copy = set.slice(0, i); }\n copy.push(this);\n placed = true;\n }\n if (copy) { copy.push(other); }\n }\n }\n if (!copy) { copy = set.slice(); }\n if (!placed) { copy.push(this); }\n return copy\n};\n\n// :: ([Mark]) → [Mark]\n// Remove this mark from the given set, returning a new set. If this\n// mark is not in the set, the set itself is returned.\nMark.prototype.removeFromSet = function removeFromSet (set) {\n for (var i = 0; i < set.length; i++)\n { if (this.eq(set[i]))\n { return set.slice(0, i).concat(set.slice(i + 1)) } }\n return set\n};\n\n// :: ([Mark]) → bool\n// Test whether this mark is in the given set of marks.\nMark.prototype.isInSet = function isInSet (set) {\n for (var i = 0; i < set.length; i++)\n { if (this.eq(set[i])) { return true } }\n return false\n};\n\n// :: (Mark) → bool\n// Test whether this mark has the same type and attributes as\n// another mark.\nMark.prototype.eq = function eq (other) {\n return this == other ||\n (this.type == other.type && compareDeep(this.attrs, other.attrs))\n};\n\n// :: () → Object\n// Convert this mark to a JSON-serializeable representation.\nMark.prototype.toJSON = function toJSON () {\n var obj = {type: this.type.name};\n for (var _ in this.attrs) {\n obj.attrs = this.attrs;\n break\n }\n return obj\n};\n\n// :: (Schema, Object) → Mark\nMark.fromJSON = function fromJSON (schema, json) {\n if (!json) { throw new RangeError(\"Invalid input for Mark.fromJSON\") }\n var type = schema.marks[json.type];\n if (!type) { throw new RangeError((\"There is no mark type \" + (json.type) + \" in this schema\")) }\n return type.create(json.attrs)\n};\n\n// :: ([Mark], [Mark]) → bool\n// Test whether two sets of marks are identical.\nMark.sameSet = function sameSet (a, b) {\n if (a == b) { return true }\n if (a.length != b.length) { return false }\n for (var i = 0; i < a.length; i++)\n { if (!a[i].eq(b[i])) { return false } }\n return true\n};\n\n// :: (?union<Mark, [Mark]>) → [Mark]\n// Create a properly sorted mark set from null, a single mark, or an\n// unsorted array of marks.\nMark.setFrom = function setFrom (marks) {\n if (!marks || marks.length == 0) { return Mark.none }\n if (marks instanceof Mark) { return [marks] }\n var copy = marks.slice();\n copy.sort(function (a, b) { return a.type.rank - b.type.rank; });\n return copy\n};\n\n// :: [Mark] The empty set of marks.\nMark.none = [];\n\n// ReplaceError:: class extends Error\n// Error type raised by [`Node.replace`](#model.Node.replace) when\n// given an invalid replacement.\n\nfunction ReplaceError(message) {\n var err = Error.call(this, message);\n err.__proto__ = ReplaceError.prototype;\n return err\n}\n\nReplaceError.prototype = Object.create(Error.prototype);\nReplaceError.prototype.constructor = ReplaceError;\nReplaceError.prototype.name = \"ReplaceError\";\n\n// ::- A slice represents a piece cut out of a larger document. It\n// stores not only a fragment, but also the depth up to which nodes on\n// both side are ‘open’ (cut through).\nvar Slice = function Slice(content, openStart, openEnd) {\n // :: Fragment The slice's content.\n this.content = content;\n // :: number The open depth at the start.\n this.openStart = openStart;\n // :: number The open depth at the end.\n this.openEnd = openEnd;\n};\n\nvar prototypeAccessors$1 = { size: { configurable: true } };\n\n// :: number\n// The size this slice would add when inserted into a document.\nprototypeAccessors$1.size.get = function () {\n return this.content.size - this.openStart - this.openEnd\n};\n\nSlice.prototype.insertAt = function insertAt (pos, fragment) {\n var content = insertInto(this.content, pos + this.openStart, fragment, null);\n return content && new Slice(content, this.openStart, this.openEnd)\n};\n\nSlice.prototype.removeBetween = function removeBetween (from, to) {\n return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd)\n};\n\n// :: (Slice) → bool\n// Tests whether this slice is equal to another slice.\nSlice.prototype.eq = function eq (other) {\n return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd\n};\n\nSlice.prototype.toString = function toString () {\n return this.content + \"(\" + this.openStart + \",\" + this.openEnd + \")\"\n};\n\n// :: () → ?Object\n// Convert a slice to a JSON-serializable representation.\nSlice.prototype.toJSON = function toJSON () {\n if (!this.content.size) { return null }\n var json = {content: this.content.toJSON()};\n if (this.openStart > 0) { json.openStart = this.openStart; }\n if (this.openEnd > 0) { json.openEnd = this.openEnd; }\n return json\n};\n\n// :: (Schema, ?Object) → Slice\n// Deserialize a slice from its JSON representation.\nSlice.fromJSON = function fromJSON (schema, json) {\n if (!json) { return Slice.empty }\n var openStart = json.openStart || 0, openEnd = json.openEnd || 0;\n if (typeof openStart != \"number\" || typeof openEnd != \"number\")\n { throw new RangeError(\"Invalid input for Slice.fromJSON\") }\n return new Slice(Fragment.fromJSON(schema, json.content), json.openStart || 0, json.openEnd || 0)\n};\n\n// :: (Fragment, ?bool) → Slice\n// Create a slice from a fragment by taking the maximum possible\n// open value on both side of the fragment.\nSlice.maxOpen = function maxOpen (fragment, openIsolating) {\n if ( openIsolating === void 0 ) openIsolating=true;\n\n var openStart = 0, openEnd = 0;\n for (var n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) { openStart++; }\n for (var n$1 = fragment.lastChild; n$1 && !n$1.isLeaf && (openIsolating || !n$1.type.spec.isolating); n$1 = n$1.lastChild) { openEnd++; }\n return new Slice(fragment, openStart, openEnd)\n};\n\nObject.defineProperties( Slice.prototype, prototypeAccessors$1 );\n\nfunction removeRange(content, from, to) {\n var ref = content.findIndex(from);\n var index = ref.index;\n var offset = ref.offset;\n var child = content.maybeChild(index);\n var ref$1 = content.findIndex(to);\n var indexTo = ref$1.index;\n var offsetTo = ref$1.offset;\n if (offset == from || child.isText) {\n if (offsetTo != to && !content.child(indexTo).isText) { throw new RangeError(\"Removing non-flat range\") }\n return content.cut(0, from).append(content.cut(to))\n }\n if (index != indexTo) { throw new RangeError(\"Removing non-flat range\") }\n return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)))\n}\n\nfunction insertInto(content, dist, insert, parent) {\n var ref = content.findIndex(dist);\n var index = ref.index;\n var offset = ref.offset;\n var child = content.maybeChild(index);\n if (offset == dist || child.isText) {\n if (parent && !parent.canReplace(index, index, insert)) { return null }\n return content.cut(0, dist).append(insert).append(content.cut(dist))\n }\n var inner = insertInto(child.content, dist - offset - 1, insert);\n return inner && content.replaceChild(index, child.copy(inner))\n}\n\n// :: Slice\n// The empty slice.\nSlice.empty = new Slice(Fragment.empty, 0, 0);\n\nfunction replace($from, $to, slice) {\n if (slice.openStart > $from.depth)\n { throw new ReplaceError(\"Inserted content deeper than insertion position\") }\n if ($from.depth - slice.openStart != $to.depth - slice.openEnd)\n { throw new ReplaceError(\"Inconsistent open depths\") }\n return replaceOuter($from, $to, slice, 0)\n}\n\nfunction replaceOuter($from, $to, slice, depth) {\n var index = $from.index(depth), node = $from.node(depth);\n if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {\n var inner = replaceOuter($from, $to, slice, depth + 1);\n return node.copy(node.content.replaceChild(index, inner))\n } else if (!slice.content.size) {\n return close(node, replaceTwoWay($from, $to, depth))\n } else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) { // Simple, flat case\n var parent = $from.parent, content = parent.content;\n return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)))\n } else {\n var ref = prepareSliceForReplace(slice, $from);\n var start = ref.start;\n var end = ref.end;\n return close(node, replaceThreeWay($from, start, end, $to, depth))\n }\n}\n\nfunction checkJoin(main, sub) {\n if (!sub.type.compatibleContent(main.type))\n { throw new ReplaceError(\"Cannot join \" + sub.type.name + \" onto \" + main.type.name) }\n}\n\nfunction joinable($before, $after, depth) {\n var node = $before.node(depth);\n checkJoin(node, $after.node(depth));\n return node\n}\n\nfunction addNode(child, target) {\n var last = target.length - 1;\n if (last >= 0 && child.isText && child.sameMarkup(target[last]))\n { target[last] = child.withText(target[last].text + child.text); }\n else\n { target.push(child); }\n}\n\nfunction addRange($start, $end, depth, target) {\n var node = ($end || $start).node(depth);\n var startIndex = 0, endIndex = $end ? $end.index(depth) : node.childCount;\n if ($start) {\n startIndex = $start.index(depth);\n if ($start.depth > depth) {\n startIndex++;\n } else if ($start.textOffset) {\n addNode($start.nodeAfter, target);\n startIndex++;\n }\n }\n for (var i = startIndex; i < endIndex; i++) { addNode(node.child(i), target); }\n if ($end && $end.depth == depth && $end.textOffset)\n { addNode($end.nodeBefore, target); }\n}\n\nfunction close(node, content) {\n if (!node.type.validContent(content))\n { throw new ReplaceError(\"Invalid content for node \" + node.type.name) }\n return node.copy(content)\n}\n\nfunction replaceThreeWay($from, $start, $end, $to, depth) {\n var openStart = $from.depth > depth && joinable($from, $start, depth + 1);\n var openEnd = $to.depth > depth && joinable($end, $to, depth + 1);\n\n var content = [];\n addRange(null, $from, depth, content);\n if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {\n checkJoin(openStart, openEnd);\n addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);\n } else {\n if (openStart)\n { addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content); }\n addRange($start, $end, depth, content);\n if (openEnd)\n { addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content); }\n }\n addRange($to, null, depth, content);\n return new Fragment(content)\n}\n\nfunction replaceTwoWay($from, $to, depth) {\n var content = [];\n addRange(null, $from, depth, content);\n if ($from.depth > depth) {\n var type = joinable($from, $to, depth + 1);\n addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content)\n}\n\nfunction prepareSliceForReplace(slice, $along) {\n var extra = $along.depth - slice.openStart, parent = $along.node(extra);\n var node = parent.copy(slice.content);\n for (var i = extra - 1; i >= 0; i--)\n { node = $along.node(i).copy(Fragment.from(node)); }\n return {start: node.resolveNoCache(slice.openStart + extra),\n end: node.resolveNoCache(node.content.size - slice.openEnd - extra)}\n}\n\n// ::- You can [_resolve_](#model.Node.resolve) a position to get more\n// information about it. Objects of this class represent such a\n// resolved position, providing various pieces of context information,\n// and some helper methods.\n//\n// Throughout this interface, methods that take an optional `depth`\n// parameter will interpret undefined as `this.depth` and negative\n// numbers as `this.depth + value`.\nvar ResolvedPos = function ResolvedPos(pos, path, parentOffset) {\n // :: number The position that was resolved.\n this.pos = pos;\n this.path = path;\n // :: number\n // The number of levels the parent node is from the root. If this\n // position points directly into the root node, it is 0. If it\n // points into a top-level paragraph, 1, and so on.\n this.depth = path.length / 3 - 1;\n // :: number The offset this position has into its parent node.\n this.parentOffset = parentOffset;\n};\n\nvar prototypeAccessors$2 = { parent: { configurable: true },doc: { configurable: true },textOffset: { configurable: true },nodeAfter: { configurable: true },nodeBefore: { configurable: true } };\n\nResolvedPos.prototype.resolveDepth = function resolveDepth (val) {\n if (val == null) { return this.depth }\n if (val < 0) { return this.depth + val }\n return val\n};\n\n// :: Node\n// The parent node that the position points into. Note that even if\n// a position points into a text node, that node is not considered\n// the parent—text nodes are ‘flat’ in this model, and have no content.\nprototypeAccessors$2.parent.get = function () { return this.node(this.depth) };\n\n// :: Node\n// The root node in which the position was resolved.\nprototypeAccessors$2.doc.get = function () { return this.node(0) };\n\n// :: (?number) → Node\n// The ancestor node at the given level. `p.node(p.depth)` is the\n// same as `p.parent`.\nResolvedPos.prototype.node = function node (depth) { return this.path[this.resolveDepth(depth) * 3] };\n\n// :: (?number) → number\n// The index into the ancestor at the given level. If this points at\n// the 3rd node in the 2nd paragraph on the top level, for example,\n// `p.index(0)` is 1 and `p.index(1)` is 2.\nResolvedPos.prototype.index = function index (depth) { return this.path[this.resolveDepth(depth) * 3 + 1] };\n\n// :: (?number) → number\n// The index pointing after this position into the ancestor at the\n// given level.\nResolvedPos.prototype.indexAfter = function indexAfter (depth) {\n depth = this.resolveDepth(depth);\n return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1)\n};\n\n// :: (?number) → number\n// The (absolute) position at the start of the node at the given\n// level.\nResolvedPos.prototype.start = function start (depth) {\n depth = this.resolveDepth(depth);\n return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1\n};\n\n// :: (?number) → number\n// The (absolute) position at the end of the node at the given\n// level.\nResolvedPos.prototype.end = function end (depth) {\n depth = this.resolveDepth(depth);\n return this.start(depth) + this.node(depth).content.size\n};\n\n// :: (?number) → number\n// The (absolute) position directly before the wrapping node at the\n// given level, or, when `depth` is `this.depth + 1`, the original\n// position.\nResolvedPos.prototype.before = function before (depth) {\n depth = this.resolveDepth(depth);\n if (!depth) { throw new RangeError(\"There is no position before the top-level node\") }\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1]\n};\n\n// :: (?number) → number\n// The (absolute) position directly after the wrapping node at the\n// given level, or the original position when `depth` is `this.depth + 1`.\nResolvedPos.prototype.after = function after (depth) {\n depth = this.resolveDepth(depth);\n if (!depth) { throw new RangeError(\"There is no position after the top-level node\") }\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize\n};\n\n// :: number\n// When this position points into a text node, this returns the\n// distance between the position and the start of the text node.\n// Will be zero for positions that point between nodes.\nprototypeAccessors$2.textOffset.get = function () { return this.pos - this.path[this.path.length - 1] };\n\n// :: ?Node\n// Get the node directly after the position, if any. If the position\n// points into a text node, only the part of that node after the\n// position is returned.\nprototypeAccessors$2.nodeAfter.get = function () {\n var parent = this.parent, index = this.index(this.depth);\n if (index == parent.childCount) { return null }\n var dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index);\n return dOff ? parent.child(index).cut(dOff) : child\n};\n\n// :: ?Node\n// Get the node directly before the position, if any. If the\n// position points into a text node, only the part of that node\n// before the position is returned.\nprototypeAccessors$2.nodeBefore.get = function () {\n var index = this.index(this.depth);\n var dOff = this.pos - this.path[this.path.length - 1];\n if (dOff) { return this.parent.child(index).cut(0, dOff) }\n return index == 0 ? null : this.parent.child(index - 1)\n};\n\n// :: () → [Mark]\n// Get the marks at this position, factoring in the surrounding\n// marks' [`inclusive`](#model.MarkSpec.inclusive) property. If the\n// position is at the start of a non-empty node, the marks of the\n// node after it (if any) are returned.\nResolvedPos.prototype.marks = function marks () {\n var parent = this.parent, index = this.index();\n\n // In an empty parent, return the empty array\n if (parent.content.size == 0) { return Mark.none }\n\n // When inside a text node, just return the text node's marks\n if (this.textOffset) { return parent.child(index).marks }\n\n var main = parent.maybeChild(index - 1), other = parent.maybeChild(index);\n // If the `after` flag is true of there is no node before, make\n // the node after this position the main reference.\n if (!main) { var tmp = main; main = other; other = tmp; }\n\n // Use all marks in the main node, except those that have\n // `inclusive` set to false and are not present in the other node.\n var marks = main.marks;\n for (var i = 0; i < marks.length; i++)\n { if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks)))\n { marks = marks[i--].removeFromSet(marks); } }\n\n return marks\n};\n\n// :: (ResolvedPos) → ?[Mark]\n// Get the marks after the current position, if any, except those\n// that are non-inclusive and not present at position `$end`. This\n// is mostly useful for getting the set of marks to preserve after a\n// deletion. Will return `null` if this position is at the end of\n// its parent node or its parent node isn't a textblock (in which\n// case no marks should be preserved).\nResolvedPos.prototype.marksAcross = function marksAcross ($end) {\n var after = this.parent.maybeChild(this.index());\n if (!after || !after.isInline) { return null }\n\n var marks = after.marks, next = $end.parent.maybeChild($end.index());\n for (var i = 0; i < marks.length; i++)\n { if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks)))\n { marks = marks[i--].removeFromSet(marks); } }\n return marks\n};\n\n// :: (number) → number\n// The depth up to which this position and the given (non-resolved)\n// position share the same parent nodes.\nResolvedPos.prototype.sharedDepth = function sharedDepth (pos) {\n for (var depth = this.depth; depth > 0; depth--)\n { if (this.start(depth) <= pos && this.end(depth) >= pos) { return depth } }\n return 0\n};\n\n// :: (?ResolvedPos, ?(Node) → bool) → ?NodeRange\n// Returns a range based on the place where this position and the\n// given position diverge around block content. If both point into\n// the same textblock, for example, a range around that textblock\n// will be returned. If they point into different blocks, the range\n// around those blocks in their shared ancestor is returned. You can\n// pass in an optional predicate that will be called with a parent\n// node to see if a range into that parent is acceptable.\nResolvedPos.prototype.blockRange = function blockRange (other, pred) {\n if ( other === void 0 ) other = this;\n\n if (other.pos < this.pos) { return other.blockRange(this) }\n for (var d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--)\n { if (other.pos <= this.end(d) && (!pred || pred(this.node(d))))\n { return new NodeRange(this, other, d) } }\n};\n\n// :: (ResolvedPos) → bool\n// Query whether the given position shares the same parent node.\nResolvedPos.prototype.sameParent = function sameParent (other) {\n return this.pos - this.parentOffset == other.pos - other.parentOffset\n};\n\n// :: (ResolvedPos) → ResolvedPos\n// Return the greater of this and the given position.\nResolvedPos.prototype.max = function max (other) {\n return other.pos > this.pos ? other : this\n};\n\n// :: (ResolvedPos) → ResolvedPos\n// Return the smaller of this and the given position.\nResolvedPos.prototype.min = function min (other) {\n return other.pos < this.pos ? other : this\n};\n\nResolvedPos.prototype.toString = function toString () {\n var str = \"\";\n for (var i = 1; i <= this.depth; i++)\n { str += (str ? \"/\" : \"\") + this.node(i).type.name + \"_\" + this.index(i - 1); }\n return str + \":\" + this.parentOffset\n};\n\nResolvedPos.resolve = function resolve (doc, pos) {\n if (!(pos >= 0 && pos <= doc.content.size)) { throw new RangeError(\"Position \" + pos + \" out of range\") }\n var path = [];\n var start = 0, parentOffset = pos;\n for (var node = doc;;) {\n var ref = node.content.findIndex(parentOffset);\n var index = ref.index;\n var offset = ref.offset;\n var rem = parentOffset - offset;\n path.push(node, index, start + offset);\n if (!rem) { break }\n node = node.child(index);\n if (node.isText) { break }\n parentOffset = rem - 1;\n start += offset + 1;\n }\n return new ResolvedPos(pos, path, parentOffset)\n};\n\nResolvedPos.resolveCached = function resolveCached (doc, pos) {\n for (var i = 0; i < resolveCache.length; i++) {\n var cached = resolveCache[i];\n if (cached.pos == pos && cached.doc == doc) { return cached }\n }\n var result = resolveCache[resolveCachePos] = ResolvedPos.resolve(doc, pos);\n resolveCachePos = (resolveCachePos + 1) % resolveCacheSize;\n return result\n};\n\nObject.defineProperties( ResolvedPos.prototype, prototypeAccessors$2 );\n\nvar resolveCache = [], resolveCachePos = 0, resolveCacheSize = 12;\n\n// ::- Represents a flat range of content, i.e. one that starts and\n// ends in the same node.\nvar NodeRange = function NodeRange($from, $to, depth) {\n // :: ResolvedPos A resolved position along the start of the\n // content. May have a `depth` greater than this object's `depth`\n // property, since these are the positions that were used to\n // compute the range, not re-resolved positions directly at its\n // boundaries.\n this.$from = $from;\n // :: ResolvedPos A position along the end of the content. See\n // caveat for [`$from`](#model.NodeRange.$from).\n this.$to = $to;\n // :: number The depth of the node that this range points into.\n this.depth = depth;\n};\n\nvar prototypeAccessors$1$1 = { start: { configurable: true },end: { configurable: true },parent: { configurable: true },startIndex: { configurable: true },endIndex: { configurable: true } };\n\n// :: number The position at the start of the range.\nprototypeAccessors$1$1.start.get = function () { return this.$from.before(this.depth + 1) };\n// :: number The position at the end of the range.\nprototypeAccessors$1$1.end.get = function () { return this.$to.after(this.depth + 1) };\n\n// :: Node The parent node that the range points into.\nprototypeAccessors$1$1.parent.get = function () { return this.$from.node(this.depth) };\n// :: number The start index of the range in the parent node.\nprototypeAccessors$1$1.startIndex.get = function () { return this.$from.index(this.depth) };\n// :: number The end index of the range in the parent node.\nprototypeAccessors$1$1.endIndex.get = function () { return this.$to.indexAfter(this.depth) };\n\nObject.defineProperties( NodeRange.prototype, prototypeAccessors$1$1 );\n\nvar emptyAttrs = Object.create(null);\n\n// ::- This class represents a node in the tree that makes up a\n// ProseMirror document. So a document is an instance of `Node`, with\n// children that are also instances of `Node`.\n//\n// Nodes are persistent data structures. Instead of changing them, you\n// create new ones with the content you want. Old ones keep pointing\n// at the old document shape. This is made cheaper by sharing\n// structure between the old and new data as much as possible, which a\n// tree shape like this (without back pointers) makes easy.\n//\n// **Do not** directly mutate the properties of a `Node` object. See\n// [the guide](/docs/guide/#doc) for more information.\nvar Node = function Node(type, attrs, content, marks) {\n // :: NodeType\n // The type of node that this is.\n this.type = type;\n\n // :: Object\n // An object mapping attribute names to values. The kind of\n // attributes allowed and required are\n // [determined](#model.NodeSpec.attrs) by the node type.\n this.attrs = attrs;\n\n // :: Fragment\n // A container holding the node's children.\n this.content = content || Fragment.empty;\n\n // :: [Mark]\n // The marks (things like whether it is emphasized or part of a\n // link) applied to this node.\n this.marks = marks || Mark.none;\n};\n\nvar prototypeAccessors$3 = { nodeSize: { configurable: true },childCount: { configurable: true },textContent: { configurable: true },firstChild: { configurable: true },lastChild: { configurable: true },isBlock: { configurable: true },isTextblock: { configurable: true },inlineContent: { configurable: true },isInline: { configurable: true },isText: { configurable: true },isLeaf: { configurable: true },isAtom: { configurable: true } };\n\n// text:: ?string\n// For text nodes, this contains the node's text content.\n\n// :: number\n// The size of this node, as defined by the integer-based [indexing\n// scheme](/docs/guide/#doc.indexing). For text nodes, this is the\n// amount of characters. For other leaf nodes, it is one. For\n// non-leaf nodes, it is the size of the content plus two (the start\n// and end token).\nprototypeAccessors$3.nodeSize.get = function () { return this.isLeaf ? 1 : 2 + this.content.size };\n\n// :: number\n// The number of children that the node has.\nprototypeAccessors$3.childCount.get = function () { return this.content.childCount };\n\n// :: (number) → Node\n// Get the child node at the given index. Raises an error when the\n// index is out of range.\nNode.prototype.child = function child (index) { return this.content.child(index) };\n\n// :: (number) → ?Node\n// Get the child node at the given index, if it exists.\nNode.prototype.maybeChild = function maybeChild (index) { return this.content.maybeChild(index) };\n\n// :: ((node: Node, offset: number, index: number))\n// Call `f` for every child node, passing the node, its offset\n// into this parent node, and its index.\nNode.prototype.forEach = function forEach (f) { this.content.forEach(f); };\n\n// :: (number, number, (node: Node, pos: number, parent: Node, index: number) → ?bool, ?number)\n// Invoke a callback for all descendant nodes recursively between\n// the given two positions that are relative to start of this node's\n// content. The callback is invoked with the node, its\n// parent-relative position, its parent node, and its child index.\n// When the callback returns false for a given node, that node's\n// children will not be recursed over. The last parameter can be\n// used to specify a starting position to count from.\nNode.prototype.nodesBetween = function nodesBetween (from, to, f, startPos) {\n if ( startPos === void 0 ) startPos = 0;\n\n this.content.nodesBetween(from, to, f, startPos, this);\n};\n\n// :: ((node: Node, pos: number, parent: Node) → ?bool)\n// Call the given callback for every descendant node. Doesn't\n// descend into a node when the callback returns `false`.\nNode.prototype.descendants = function descendants (f) {\n this.nodesBetween(0, this.content.size, f);\n};\n\n// :: string\n// Concatenates all the text nodes found in this fragment and its\n// children.\nprototypeAccessors$3.textContent.get = function () { return this.textBetween(0, this.content.size, \"\") };\n\n// :: (number, number, ?string, ?string) → string\n// Get all text between positions `from` and `to`. When\n// `blockSeparator` is given, it will be inserted whenever a new\n// block node is started. When `leafText` is given, it'll be\n// inserted for every non-text leaf node encountered.\nNode.prototype.textBetween = function textBetween (from, to, blockSeparator, leafText) {\n return this.content.textBetween(from, to, blockSeparator, leafText)\n};\n\n// :: ?Node\n// Returns this node's first child, or `null` if there are no\n// children.\nprototypeAccessors$3.firstChild.get = function () { return this.content.firstChild };\n\n// :: ?Node\n// Returns this node's last child, or `null` if there are no\n// children.\nprototypeAccessors$3.lastChild.get = function () { return this.content.lastChild };\n\n// :: (Node) → bool\n// Test whether two nodes represent the same piece of document.\nNode.prototype.eq = function eq (other) {\n return this == other || (this.sameMarkup(other) && this.content.eq(other.content))\n};\n\n// :: (Node) → bool\n// Compare the markup (type, attributes, and marks) of this node to\n// those of another. Returns `true` if both have the same markup.\nNode.prototype.sameMarkup = function sameMarkup (other) {\n return this.hasMarkup(other.type, other.attrs, other.marks)\n};\n\n// :: (NodeType, ?Object, ?[Mark]) → bool\n// Check whether this node's markup correspond to the given type,\n// attributes, and marks.\nNode.prototype.hasMarkup = function hasMarkup (type, attrs, marks) {\n return this.type == type &&\n compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) &&\n Mark.sameSet(this.marks, marks || Mark.none)\n};\n\n// :: (?Fragment) → Node\n// Create a new node with the same markup as this node, containing\n// the given content (or empty, if no content is given).\nNode.prototype.copy = function copy (content) {\n if ( content === void 0 ) content = null;\n\n if (content == this.content) { return this }\n return new this.constructor(this.type, this.attrs, content, this.marks)\n};\n\n// :: ([Mark]) → Node\n// Create a copy of this node, with the given set of marks instead\n// of the node's own marks.\nNode.prototype.mark = function mark (marks) {\n return marks == this.marks ? this : new this.constructor(this.type, this.attrs, this.content, marks)\n};\n\n// :: (number, ?number) → Node\n// Create a copy of this node with only the content between the\n// given positions. If `to` is not given, it defaults to the end of\n// the node.\nNode.prototype.cut = function cut (from, to) {\n if (from == 0 && to == this.content.size) { return this }\n return this.copy(this.content.cut(from, to))\n};\n\n// :: (number, ?number) → Slice\n// Cut out the part of the document between the given positions, and\n// return it as a `Slice` object.\nNode.prototype.slice = function slice (from, to, includeParents) {\n if ( to === void 0 ) to = this.content.size;\n if ( includeParents === void 0 ) includeParents = false;\n\n if (from == to) { return Slice.empty }\n\n var $from = this.resolve(from), $to = this.resolve(to);\n var depth = includeParents ? 0 : $from.sharedDepth(to);\n var start = $from.start(depth), node = $from.node(depth);\n var content = node.content.cut($from.pos - start, $to.pos - start);\n return new Slice(content, $from.depth - depth, $to.depth - depth)\n};\n\n// :: (number, number, Slice) → Node\n// Replace the part of the document between the given positions with\n// the given slice. The slice must 'fit', meaning its open sides\n// must be able to connect to the surrounding content, and its\n// content nodes must be valid children for the node they are placed\n// into. If any of this is violated, an error of type\n// [`ReplaceError`](#model.ReplaceError) is thrown.\nNode.prototype.replace = function replace$1 (from, to, slice) {\n return replace(this.resolve(from), this.resolve(to), slice)\n};\n\n// :: (number) → ?Node\n// Find the node directly after the given position.\nNode.prototype.nodeAt = function nodeAt (pos) {\n for (var node = this;;) {\n var ref = node.content.findIndex(pos);\n var index = ref.index;\n var offset = ref.offset;\n node = node.maybeChild(index);\n if (!node) { return null }\n if (offset == pos || node.isText) { return node }\n pos -= offset + 1;\n }\n};\n\n// :: (number) → {node: ?Node, index: number, offset: number}\n// Find the (direct) child node after the given offset, if any,\n// and return it along with its index and offset relative to this\n// node.\nNode.prototype.childAfter = function childAfter (pos) {\n var ref = this.content.findIndex(pos);\n var index = ref.index;\n var offset = ref.offset;\n return {node: this.content.maybeChild(index), index: index, offset: offset}\n};\n\n// :: (number) → {node: ?Node, index: number, offset: number}\n// Find the (direct) child node before the given offset, if any,\n// and return it along with its index and offset relative to this\n// node.\nNode.prototype.childBefore = function childBefore (pos) {\n if (pos == 0) { return {node: null, index: 0, offset: 0} }\n var ref = this.content.findIndex(pos);\n var index = ref.index;\n var offset = ref.offset;\n if (offset < pos) { return {node: this.content.child(index), index: index, offset: offset} }\n var node = this.content.child(index - 1);\n return {node: node, index: index - 1, offset: offset - node.nodeSize}\n};\n\n// :: (number) → ResolvedPos\n// Resolve the given position in the document, returning an\n// [object](#model.ResolvedPos) with information about its context.\nNode.prototype.resolve = function resolve (pos) { return ResolvedPos.resolveCached(this, pos) };\n\nNode.prototype.resolveNoCache = function resolveNoCache (pos) { return ResolvedPos.resolve(this, pos) };\n\n// :: (number, number, MarkType) → bool\n// Test whether a mark of the given type occurs in this document\n// between the two given positions.\nNode.prototype.rangeHasMark = function rangeHasMark (from, to, type) {\n var found = false;\n if (to > from) { this.nodesBetween(from, to, function (node) {\n if (type.isInSet(node.marks)) { found = true; }\n return !found\n }); }\n return found\n};\n\n// :: bool\n// True when this is a block (non-inline node)\nprototypeAccessors$3.isBlock.get = function () { return this.type.isBlock };\n\n// :: bool\n// True when this is a textblock node, a block node with inline\n// content.\nprototypeAccessors$3.isTextblock.get = function () { return this.type.isTextblock };\n\n// :: bool\n// True when this node allows inline content.\nprototypeAccessors$3.inlineContent.get = function () { return this.type.inlineContent };\n\n// :: bool\n// True when this is an inline node (a text node or a node that can\n// appear among text).\nprototypeAccessors$3.isInline.get = function () { return this.type.isInline };\n\n// :: bool\n// True when this is a text node.\nprototypeAccessors$3.isText.get = function () { return this.type.isText };\n\n// :: bool\n// True when this is a leaf node.\nprototypeAccessors$3.isLeaf.get = function () { return this.type.isLeaf };\n\n// :: bool\n// True when this is an atom, i.e. when it does not have directly\n// editable content. This is usually the same as `isLeaf`, but can\n// be configured with the [`atom` property](#model.NodeSpec.atom) on\n// a node's spec (typically used when the node is displayed as an\n// uneditable [node view](#view.NodeView)).\nprototypeAccessors$3.isAtom.get = function () { return this.type.isAtom };\n\n// :: () → string\n// Return a string representation of this node for debugging\n// purposes.\nNode.prototype.toString = function toString () {\n if (this.type.spec.toDebugString) { return this.type.spec.toDebugString(this) }\n var name = this.type.name;\n if (this.content.size)\n { name += \"(\" + this.content.toStringInner() + \")\"; }\n return wrapMarks(this.marks, name)\n};\n\n// :: (number) → ContentMatch\n// Get the content match in this node at the given index.\nNode.prototype.contentMatchAt = function contentMatchAt (index) {\n var match = this.type.contentMatch.matchFragment(this.content, 0, index);\n if (!match) { throw new Error(\"Called contentMatchAt on a node with invalid content\") }\n return match\n};\n\n// :: (number, number, ?Fragment, ?number, ?number) → bool\n// Test whether replacing the range between `from` and `to` (by\n// child index) with the given replacement fragment (which defaults\n// to the empty fragment) would leave the node's content valid. You\n// can optionally pass `start` and `end` indices into the\n// replacement fragment.\nNode.prototype.canReplace = function canReplace (from, to, replacement, start, end) {\n if ( replacement === void 0 ) replacement = Fragment.empty;\n if ( start === void 0 ) start = 0;\n if ( end === void 0 ) end = replacement.childCount;\n\n var one = this.contentMatchAt(from).matchFragment(replacement, start, end);\n var two = one && one.matchFragment(this.content, to);\n if (!two || !two.validEnd) { return false }\n for (var i = start; i < end; i++) { if (!this.type.allowsMarks(replacement.child(i).marks)) { return false } }\n return true\n};\n\n// :: (number, number, NodeType, ?[Mark]) → bool\n// Test whether replacing the range `from` to `to` (by index) with a\n// node of the given type would leave the node's content valid.\nNode.prototype.canReplaceWith = function canReplaceWith (from, to, type, marks) {\n if (marks && !this.type.allowsMarks(marks)) { return false }\n var start = this.contentMatchAt(from).matchType(type);\n var end = start && start.matchFragment(this.content, to);\n return end ? end.validEnd : false\n};\n\n// :: (Node) → bool\n// Test whether the given node's content could be appended to this\n// node. If that node is empty, this will only return true if there\n// is at least one node type that can appear in both nodes (to avoid\n// merging completely incompatible nodes).\nNode.prototype.canAppend = function canAppend (other) {\n if (other.content.size) { return this.canReplace(this.childCount, this.childCount, other.content) }\n else { return this.type.compatibleContent(other.type) }\n};\n\n// :: ()\n// Check whether this node and its descendants conform to the\n// schema, and raise error when they do not.\nNode.prototype.check = function check () {\n if (!this.type.validContent(this.content))\n { throw new RangeError((\"Invalid content for node \" + (this.type.name) + \": \" + (this.content.toString().slice(0, 50)))) }\n this.content.forEach(function (node) { return node.check(); });\n};\n\n// :: () → Object\n// Return a JSON-serializeable representation of this node.\nNode.prototype.toJSON = function toJSON () {\n var obj = {type: this.type.name};\n for (var _ in this.attrs) {\n obj.attrs = this.attrs;\n break\n }\n if (this.content.size)\n { obj.content = this.content.toJSON(); }\n if (this.marks.length)\n { obj.marks = this.marks.map(function (n) { return n.toJSON(); }); }\n return obj\n};\n\n// :: (Schema, Object) → Node\n// Deserialize a node from its JSON representation.\nNode.fromJSON = function fromJSON (schema, json) {\n if (!json) { throw new RangeError(\"Invalid input for Node.fromJSON\") }\n var marks = null;\n if (json.marks) {\n if (!Array.isArray(json.marks)) { throw new RangeError(\"Invalid mark data for Node.fromJSON\") }\n marks = json.marks.map(schema.markFromJSON);\n }\n if (json.type == \"text\") {\n if (typeof json.text != \"string\") { throw new RangeError(\"Invalid text node in JSON\") }\n return schema.text(json.text, marks)\n }\n var content = Fragment.fromJSON(schema, json.content);\n return schema.nodeType(json.type).create(json.attrs, content, marks)\n};\n\nObject.defineProperties( Node.prototype, prototypeAccessors$3 );\n\nvar TextNode = /*@__PURE__*/(function (Node) {\n function TextNode(type, attrs, content, marks) {\n Node.call(this, type, attrs, null, marks);\n\n if (!content) { throw new RangeError(\"Empty text nodes are not allowed\") }\n\n this.text = content;\n }\n\n if ( Node ) TextNode.__proto__ = Node;\n TextNode.prototype = Object.create( Node && Node.prototype );\n TextNode.prototype.constructor = TextNode;\n\n var prototypeAccessors$1 = { textContent: { configurable: true },nodeSize: { configurable: true } };\n\n TextNode.prototype.toString = function toString () {\n if (this.type.spec.toDebugString) { return this.type.spec.toDebugString(this) }\n return wrapMarks(this.marks, JSON.stringify(this.text))\n };\n\n prototypeAccessors$1.textContent.get = function () { return this.text };\n\n TextNode.prototype.textBetween = function textBetween (from, to) { return this.text.slice(from, to) };\n\n prototypeAccessors$1.nodeSize.get = function () { return this.text.length };\n\n TextNode.prototype.mark = function mark (marks) {\n return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks)\n };\n\n TextNode.prototype.withText = function withText (text) {\n if (text == this.text) { return this }\n return new TextNode(this.type, this.attrs, text, this.marks)\n };\n\n TextNode.prototype.cut = function cut (from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.text.length;\n\n if (from == 0 && to == this.text.length) { return this }\n return this.withText(this.text.slice(from, to))\n };\n\n TextNode.prototype.eq = function eq (other) {\n return this.sameMarkup(other) && this.text == other.text\n };\n\n TextNode.prototype.toJSON = function toJSON () {\n var base = Node.prototype.toJSON.call(this);\n base.text = this.text;\n return base\n };\n\n Object.defineProperties( TextNode.prototype, prototypeAccessors$1 );\n\n return TextNode;\n}(Node));\n\nfunction wrapMarks(marks, str) {\n for (var i = marks.length - 1; i >= 0; i--)\n { str = marks[i].type.name + \"(\" + str + \")\"; }\n return str\n}\n\n// ::- Instances of this class represent a match state of a node\n// type's [content expression](#model.NodeSpec.content), and can be\n// used to find out whether further content matches here, and whether\n// a given position is a valid end of the node.\nvar ContentMatch = function ContentMatch(validEnd) {\n // :: bool\n // True when this match state represents a valid end of the node.\n this.validEnd = validEnd;\n this.next = [];\n this.wrapCache = [];\n};\n\nvar prototypeAccessors$4 = { inlineContent: { configurable: true },defaultType: { configurable: true },edgeCount: { configurable: true } };\n\nContentMatch.parse = function parse (string, nodeTypes) {\n var stream = new TokenStream(string, nodeTypes);\n if (stream.next == null) { return ContentMatch.empty }\n var expr = parseExpr(stream);\n if (stream.next) { stream.err(\"Unexpected trailing text\"); }\n var match = dfa(nfa(expr));\n checkForDeadEnds(match, stream);\n return match\n};\n\n// :: (NodeType) → ?ContentMatch\n// Match a node type, returning a match after that node if\n// successful.\nContentMatch.prototype.matchType = function matchType (type) {\n for (var i = 0; i < this.next.length; i += 2)\n { if (this.next[i] == type) { return this.next[i + 1] } }\n return null\n};\n\n// :: (Fragment, ?number, ?number) → ?ContentMatch\n// Try to match a fragment. Returns the resulting match when\n// successful.\nContentMatch.prototype.matchFragment = function matchFragment (frag, start, end) {\n if ( start === void 0 ) start = 0;\n if ( end === void 0 ) end = frag.childCount;\n\n var cur = this;\n for (var i = start; cur && i < end; i++)\n { cur = cur.matchType(frag.child(i).type); }\n return cur\n};\n\nprototypeAccessors$4.inlineContent.get = function () {\n var first = this.next[0];\n return first ? first.isInline : false\n};\n\n// :: ?NodeType\n// Get the first matching node type at this match position that can\n// be generated.\nprototypeAccessors$4.defaultType.get = function () {\n for (var i = 0; i < this.next.length; i += 2) {\n var type = this.next[i];\n if (!(type.isText || type.hasRequiredAttrs())) { return type }\n }\n};\n\nContentMatch.prototype.compatible = function compatible (other) {\n for (var i = 0; i < this.next.length; i += 2)\n { for (var j = 0; j < other.next.length; j += 2)\n { if (this.next[i] == other.next[j]) { return true } } }\n return false\n};\n\n// :: (Fragment, bool, ?number) → ?Fragment\n// Try to match the given fragment, and if that fails, see if it can\n// be made to match by inserting nodes in front of it. When\n// successful, return a fragment of inserted nodes (which may be\n// empty if nothing had to be inserted). When `toEnd` is true, only\n// return a fragment if the resulting match goes to the end of the\n// content expression.\nContentMatch.prototype.fillBefore = function fillBefore (after, toEnd, startIndex) {\n if ( toEnd === void 0 ) toEnd = false;\n if ( startIndex === void 0 ) startIndex = 0;\n\n var seen = [this];\n function search(match, types) {\n var finished = match.matchFragment(after, startIndex);\n if (finished && (!toEnd || finished.validEnd))\n { return Fragment.from(types.map(function (tp) { return tp.createAndFill(); })) }\n\n for (var i = 0; i < match.next.length; i += 2) {\n var type = match.next[i], next = match.next[i + 1];\n if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {\n seen.push(next);\n var found = search(next, types.concat(type));\n if (found) { return found }\n }\n }\n }\n\n return search(this, [])\n};\n\n// :: (NodeType) → ?[NodeType]\n// Find a set of wrapping node types that would allow a node of the\n// given type to appear at this position. The result may be empty\n// (when it fits directly) and will be null when no such wrapping\n// exists.\nContentMatch.prototype.findWrapping = function findWrapping (target) {\n for (var i = 0; i < this.wrapCache.length; i += 2)\n { if (this.wrapCache[i] == target) { return this.wrapCache[i + 1] } }\n var computed = this.computeWrapping(target);\n this.wrapCache.push(target, computed);\n return computed\n};\n\nContentMatch.prototype.computeWrapping = function computeWrapping (target) {\n var seen = Object.create(null), active = [{match: this, type: null, via: null}];\n while (active.length) {\n var current = active.shift(), match = current.match;\n if (match.matchType(target)) {\n var result = [];\n for (var obj = current; obj.type; obj = obj.via)\n { result.push(obj.type); }\n return result.reverse()\n }\n for (var i = 0; i < match.next.length; i += 2) {\n var type = match.next[i];\n if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || match.next[i + 1].validEnd)) {\n active.push({match: type.contentMatch, type: type, via: current});\n seen[type.name] = true;\n }\n }\n }\n};\n\n// :: number\n// The number of outgoing edges this node has in the finite\n// automaton that describes the content expression.\nprototypeAccessors$4.edgeCount.get = function () {\n return this.next.length >> 1\n};\n\n// :: (number) → {type: NodeType, next: ContentMatch}\n// Get the _n_th outgoing edge from this node in the finite\n// automaton that describes the content expression.\nContentMatch.prototype.edge = function edge (n) {\n var i = n << 1;\n if (i >= this.next.length) { throw new RangeError((\"There's no \" + n + \"th edge in this content match\")) }\n return {type: this.next[i], next: this.next[i + 1]}\n};\n\nContentMatch.prototype.toString = function toString () {\n var seen = [];\n function scan(m) {\n seen.push(m);\n for (var i = 1; i < m.next.length; i += 2)\n { if (seen.indexOf(m.next[i]) == -1) { scan(m.next[i]); } }\n }\n scan(this);\n return seen.map(function (m, i) {\n var out = i + (m.validEnd ? \"*\" : \" \") + \" \";\n for (var i$1 = 0; i$1 < m.next.length; i$1 += 2)\n { out += (i$1 ? \", \" : \"\") + m.next[i$1].name + \"->\" + seen.indexOf(m.next[i$1 + 1]); }\n return out\n }).join(\"\\n\")\n};\n\nObject.defineProperties( ContentMatch.prototype, prototypeAccessors$4 );\n\nContentMatch.empty = new ContentMatch(true);\n\nvar TokenStream = function TokenStream(string, nodeTypes) {\n this.string = string;\n this.nodeTypes = nodeTypes;\n this.inline = null;\n this.pos = 0;\n this.tokens = string.split(/\\s*(?=\\b|\\W|$)/);\n if (this.tokens[this.tokens.length - 1] == \"\") { this.tokens.pop(); }\n if (this.tokens[0] == \"\") { this.tokens.unshift(); }\n};\n\nvar prototypeAccessors$1$2 = { next: { configurable: true } };\n\nprototypeAccessors$1$2.next.get = function () { return this.tokens[this.pos] };\n\nTokenStream.prototype.eat = function eat (tok) { return this.next == tok && (this.pos++ || true) };\n\nTokenStream.prototype.err = function err (str) { throw new SyntaxError(str + \" (in content expression '\" + this.string + \"')\") };\n\nObject.defineProperties( TokenStream.prototype, prototypeAccessors$1$2 );\n\nfunction parseExpr(stream) {\n var exprs = [];\n do { exprs.push(parseExprSeq(stream)); }\n while (stream.eat(\"|\"))\n return exprs.length == 1 ? exprs[0] : {type: \"choice\", exprs: exprs}\n}\n\nfunction parseExprSeq(stream) {\n var exprs = [];\n do { exprs.push(parseExprSubscript(stream)); }\n while (stream.next && stream.next != \")\" && stream.next != \"|\")\n return exprs.length == 1 ? exprs[0] : {type: \"seq\", exprs: exprs}\n}\n\nfunction parseExprSubscript(stream) {\n var expr = parseExprAtom(stream);\n for (;;) {\n if (stream.eat(\"+\"))\n { expr = {type: \"plus\", expr: expr}; }\n else if (stream.eat(\"*\"))\n { expr = {type: \"star\", expr: expr}; }\n else if (stream.eat(\"?\"))\n { expr = {type: \"opt\", expr: expr}; }\n else if (stream.eat(\"{\"))\n { expr = parseExprRange(stream, expr); }\n else { break }\n }\n return expr\n}\n\nfunction parseNum(stream) {\n if (/\\D/.test(stream.next)) { stream.err(\"Expected number, got '\" + stream.next + \"'\"); }\n var result = Number(stream.next);\n stream.pos++;\n return result\n}\n\nfunction parseExprRange(stream, expr) {\n var min = parseNum(stream), max = min;\n if (stream.eat(\",\")) {\n if (stream.next != \"}\") { max = parseNum(stream); }\n else { max = -1; }\n }\n if (!stream.eat(\"}\")) { stream.err(\"Unclosed braced range\"); }\n return {type: \"range\", min: min, max: max, expr: expr}\n}\n\nfunction resolveName(stream, name) {\n var types = stream.nodeTypes, type = types[name];\n if (type) { return [type] }\n var result = [];\n for (var typeName in types) {\n var type$1 = types[typeName];\n if (type$1.groups.indexOf(name) > -1) { result.push(type$1); }\n }\n if (result.length == 0) { stream.err(\"No node type or group '\" + name + \"' found\"); }\n return result\n}\n\nfunction parseExprAtom(stream) {\n if (stream.eat(\"(\")) {\n var expr = parseExpr(stream);\n if (!stream.eat(\")\")) { stream.err(\"Missing closing paren\"); }\n return expr\n } else if (!/\\W/.test(stream.next)) {\n var exprs = resolveName(stream, stream.next).map(function (type) {\n if (stream.inline == null) { stream.inline = type.isInline; }\n else if (stream.inline != type.isInline) { stream.err(\"Mixing inline and block content\"); }\n return {type: \"name\", value: type}\n });\n stream.pos++;\n return exprs.length == 1 ? exprs[0] : {type: \"choice\", exprs: exprs}\n } else {\n stream.err(\"Unexpected token '\" + stream.next + \"'\");\n }\n}\n\n// The code below helps compile a regular-expression-like language\n// into a deterministic finite automaton. For a good introduction to\n// these concepts, see https://swtch.com/~rsc/regexp/regexp1.html\n\n// : (Object) → [[{term: ?any, to: number}]]\n// Construct an NFA from an expression as returned by the parser. The\n// NFA is represented as an array of states, which are themselves\n// arrays of edges, which are `{term, to}` objects. The first state is\n// the entry state and the last node is the success state.\n//\n// Note that unlike typical NFAs, the edge ordering in this one is\n// significant, in that it is used to contruct filler content when\n// necessary.\nfunction nfa(expr) {\n var nfa = [[]];\n connect(compile(expr, 0), node());\n return nfa\n\n function node() { return nfa.push([]) - 1 }\n function edge(from, to, term) {\n var edge = {term: term, to: to};\n nfa[from].push(edge);\n return edge\n }\n function connect(edges, to) { edges.forEach(function (edge) { return edge.to = to; }); }\n\n function compile(expr, from) {\n if (expr.type == \"choice\") {\n return expr.exprs.reduce(function (out, expr) { return out.concat(compile(expr, from)); }, [])\n } else if (expr.type == \"seq\") {\n for (var i = 0;; i++) {\n var next = compile(expr.exprs[i], from);\n if (i == expr.exprs.length - 1) { return next }\n connect(next, from = node());\n }\n } else if (expr.type == \"star\") {\n var loop = node();\n edge(from, loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)]\n } else if (expr.type == \"plus\") {\n var loop$1 = node();\n connect(compile(expr.expr, from), loop$1);\n connect(compile(expr.expr, loop$1), loop$1);\n return [edge(loop$1)]\n } else if (expr.type == \"opt\") {\n return [edge(from)].concat(compile(expr.expr, from))\n } else if (expr.type == \"range\") {\n var cur = from;\n for (var i$1 = 0; i$1 < expr.min; i$1++) {\n var next$1 = node();\n connect(compile(expr.expr, cur), next$1);\n cur = next$1;\n }\n if (expr.max == -1) {\n connect(compile(expr.expr, cur), cur);\n } else {\n for (var i$2 = expr.min; i$2 < expr.max; i$2++) {\n var next$2 = node();\n edge(cur, next$2);\n connect(compile(expr.expr, cur), next$2);\n cur = next$2;\n }\n }\n return [edge(cur)]\n } else if (expr.type == \"name\") {\n return [edge(from, null, expr.value)]\n }\n }\n}\n\nfunction cmp(a, b) { return b - a }\n\n// Get the set of nodes reachable by null edges from `node`. Omit\n// nodes with only a single null-out-edge, since they may lead to\n// needless duplicated nodes.\nfunction nullFrom(nfa, node) {\n var result = [];\n scan(node);\n return result.sort(cmp)\n\n function scan(node) {\n var edges = nfa[node];\n if (edges.length == 1 && !edges[0].term) { return scan(edges[0].to) }\n result.push(node);\n for (var i = 0; i < edges.length; i++) {\n var ref = edges[i];\n var term = ref.term;\n var to = ref.to;\n if (!term && result.indexOf(to) == -1) { scan(to); }\n }\n }\n}\n\n// : ([[{term: ?any, to: number}]]) → ContentMatch\n// Compiles an NFA as produced by `nfa` into a DFA, modeled as a set\n// of state objects (`ContentMatch` instances) with transitions\n// between them.\nfunction dfa(nfa) {\n var labeled = Object.create(null);\n return explore(nullFrom(nfa, 0))\n\n function explore(states) {\n var out = [];\n states.forEach(function (node) {\n nfa[node].forEach(function (ref) {\n var term = ref.term;\n var to = ref.to;\n\n if (!term) { return }\n var known = out.indexOf(term), set = known > -1 && out[known + 1];\n nullFrom(nfa, to).forEach(function (node) {\n if (!set) { out.push(term, set = []); }\n if (set.indexOf(node) == -1) { set.push(node); }\n });\n });\n });\n var state = labeled[states.join(\",\")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);\n for (var i = 0; i < out.length; i += 2) {\n var states$1 = out[i + 1].sort(cmp);\n state.next.push(out[i], labeled[states$1.join(\",\")] || explore(states$1));\n }\n return state\n }\n}\n\nfunction checkForDeadEnds(match, stream) {\n for (var i = 0, work = [match]; i < work.length; i++) {\n var state = work[i], dead = !state.validEnd, nodes = [];\n for (var j = 0; j < state.next.length; j += 2) {\n var node = state.next[j], next = state.next[j + 1];\n nodes.push(node.name);\n if (dead && !(node.isText || node.hasRequiredAttrs())) { dead = false; }\n if (work.indexOf(next) == -1) { work.push(next); }\n }\n if (dead) { stream.err(\"Only non-generatable nodes (\" + nodes.join(\", \") + \") in a required position\"); }\n }\n}\n\n// For node types where all attrs have a default value (or which don't\n// have any attributes), build up a single reusable default attribute\n// object, and use it for all nodes that don't specify specific\n// attributes.\nfunction defaultAttrs(attrs) {\n var defaults = Object.create(null);\n for (var attrName in attrs) {\n var attr = attrs[attrName];\n if (!attr.hasDefault) { return null }\n defaults[attrName] = attr.default;\n }\n return defaults\n}\n\nfunction computeAttrs(attrs, value) {\n var built = Object.create(null);\n for (var name in attrs) {\n var given = value && value[name];\n if (given === undefined) {\n var attr = attrs[name];\n if (attr.hasDefault) { given = attr.default; }\n else { throw new RangeError(\"No value supplied for attribute \" + name) }\n }\n built[name] = given;\n }\n return built\n}\n\nfunction initAttrs(attrs) {\n var result = Object.create(null);\n if (attrs) { for (var name in attrs) { result[name] = new Attribute(attrs[name]); } }\n return result\n}\n\n// ::- Node types are objects allocated once per `Schema` and used to\n// [tag](#model.Node.type) `Node` instances. They contain information\n// about the node type, such as its name and what kind of node it\n// represents.\nvar NodeType = function NodeType(name, schema, spec) {\n // :: string\n // The name the node type has in this schema.\n this.name = name;\n\n // :: Schema\n // A link back to the `Schema` the node type belongs to.\n this.schema = schema;\n\n // :: NodeSpec\n // The spec that this type is based on\n this.spec = spec;\n\n this.groups = spec.group ? spec.group.split(\" \") : [];\n this.attrs = initAttrs(spec.attrs);\n\n this.defaultAttrs = defaultAttrs(this.attrs);\n\n // :: ContentMatch\n // The starting match of the node type's content expression.\n this.contentMatch = null;\n\n // : ?[MarkType]\n // The set of marks allowed in this node. `null` means all marks\n // are allowed.\n this.markSet = null;\n\n // :: bool\n // True if this node type has inline content.\n this.inlineContent = null;\n\n // :: bool\n // True if this is a block type\n this.isBlock = !(spec.inline || name == \"text\");\n\n // :: bool\n // True if this is the text node type.\n this.isText = name == \"text\";\n};\n\nvar prototypeAccessors$5 = { isInline: { configurable: true },isTextblock: { configurable: true },isLeaf: { configurable: true },isAtom: { configurable: true } };\n\n// :: bool\n// True if this is an inline type.\nprototypeAccessors$5.isInline.get = function () { return !this.isBlock };\n\n// :: bool\n// True if this is a textblock type, a block that contains inline\n// content.\nprototypeAccessors$5.isTextblock.get = function () { return this.isBlock && this.inlineContent };\n\n// :: bool\n// True for node types that allow no content.\nprototypeAccessors$5.isLeaf.get = function () { return this.contentMatch == ContentMatch.empty };\n\n// :: bool\n// True when this node is an atom, i.e. when it does not have\n// directly editable content.\nprototypeAccessors$5.isAtom.get = function () { return this.isLeaf || this.spec.atom };\n\n// :: () → bool\n// Tells you whether this node type has any required attributes.\nNodeType.prototype.hasRequiredAttrs = function hasRequiredAttrs () {\n for (var n in this.attrs) { if (this.attrs[n].isRequired) { return true } }\n return false\n};\n\nNodeType.prototype.compatibleContent = function compatibleContent (other) {\n return this == other || this.contentMatch.compatible(other.contentMatch)\n};\n\nNodeType.prototype.computeAttrs = function computeAttrs$1 (attrs) {\n if (!attrs && this.defaultAttrs) { return this.defaultAttrs }\n else { return computeAttrs(this.attrs, attrs) }\n};\n\n// :: (?Object, ?union<Fragment, Node, [Node]>, ?[Mark]) → Node\n// Create a `Node` of this type. The given attributes are\n// checked and defaulted (you can pass `null` to use the type's\n// defaults entirely, if no required attributes exist). `content`\n// may be a `Fragment`, a node, an array of nodes, or\n// `null`. Similarly `marks` may be `null` to default to the empty\n// set of marks.\nNodeType.prototype.create = function create (attrs, content, marks) {\n if (this.isText) { throw new Error(\"NodeType.create can't construct text nodes\") }\n return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks))\n};\n\n// :: (?Object, ?union<Fragment, Node, [Node]>, ?[Mark]) → Node\n// Like [`create`](#model.NodeType.create), but check the given content\n// against the node type's content restrictions, and throw an error\n// if it doesn't match.\nNodeType.prototype.createChecked = function createChecked (attrs, content, marks) {\n content = Fragment.from(content);\n if (!this.validContent(content))\n { throw new RangeError(\"Invalid content for node \" + this.name) }\n return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks))\n};\n\n// :: (?Object, ?union<Fragment, Node, [Node]>, ?[Mark]) → ?Node\n// Like [`create`](#model.NodeType.create), but see if it is necessary to\n// add nodes to the start or end of the given fragment to make it\n// fit the node. If no fitting wrapping can be found, return null.\n// Note that, due to the fact that required nodes can always be\n// created, this will always succeed if you pass null or\n// `Fragment.empty` as content.\nNodeType.prototype.createAndFill = function createAndFill (attrs, content, marks) {\n attrs = this.computeAttrs(attrs);\n content = Fragment.from(content);\n if (content.size) {\n var before = this.contentMatch.fillBefore(content);\n if (!before) { return null }\n content = before.append(content);\n }\n var after = this.contentMatch.matchFragment(content).fillBefore(Fragment.empty, true);\n if (!after) { return null }\n return new Node(this, attrs, content.append(after), Mark.setFrom(marks))\n};\n\n// :: (Fragment) → bool\n// Returns true if the given fragment is valid content for this node\n// type with the given attributes.\nNodeType.prototype.validContent = function validContent (content) {\n var result = this.contentMatch.matchFragment(content);\n if (!result || !result.validEnd) { return false }\n for (var i = 0; i < content.childCount; i++)\n { if (!this.allowsMarks(content.child(i).marks)) { return false } }\n return true\n};\n\n// :: (MarkType) → bool\n// Check whether the given mark type is allowed in this node.\nNodeType.prototype.allowsMarkType = function allowsMarkType (markType) {\n return this.markSet == null || this.markSet.indexOf(markType) > -1\n};\n\n// :: ([Mark]) → bool\n// Test whether the given set of marks are allowed in this node.\nNodeType.prototype.allowsMarks = function allowsMarks (marks) {\n if (this.markSet == null) { return true }\n for (var i = 0; i < marks.length; i++) { if (!this.allowsMarkType(marks[i].type)) { return false } }\n return true\n};\n\n// :: ([Mark]) → [Mark]\n// Removes the marks that are not allowed in this node from the given set.\nNodeType.prototype.allowedMarks = function allowedMarks (marks) {\n if (this.markSet == null) { return marks }\n var copy;\n for (var i = 0; i < marks.length; i++) {\n if (!this.allowsMarkType(marks[i].type)) {\n if (!copy) { copy = marks.slice(0, i); }\n } else if (copy) {\n copy.push(marks[i]);\n }\n }\n return !copy ? marks : copy.length ? copy : Mark.empty\n};\n\nNodeType.compile = function compile (nodes, schema) {\n var result = Object.create(null);\n nodes.forEach(function (name, spec) { return result[name] = new NodeType(name, schema, spec); });\n\n var topType = schema.spec.topNode || \"doc\";\n if (!result[topType]) { throw new RangeError(\"Schema is missing its top node type ('\" + topType + \"')\") }\n if (!result.text) { throw new RangeError(\"Every schema needs a 'text' type\") }\n for (var _ in result.text.attrs) { throw new RangeError(\"The text node type should not have attributes\") }\n\n return result\n};\n\nObject.defineProperties( NodeType.prototype, prototypeAccessors$5 );\n\n// Attribute descriptors\n\nvar Attribute = function Attribute(options) {\n this.hasDefault = Object.prototype.hasOwnProperty.call(options, \"default\");\n this.default = options.default;\n};\n\nvar prototypeAccessors$1$3 = { isRequired: { configurable: true } };\n\nprototypeAccessors$1$3.isRequired.get = function () {\n return !this.hasDefault\n};\n\nObject.defineProperties( Attribute.prototype, prototypeAccessors$1$3 );\n\n// Marks\n\n// ::- Like nodes, marks (which are associated with nodes to signify\n// things like emphasis or being part of a link) are\n// [tagged](#model.Mark.type) with type objects, which are\n// instantiated once per `Schema`.\nvar MarkType = function MarkType(name, rank, schema, spec) {\n // :: string\n // The name of the mark type.\n this.name = name;\n\n // :: Schema\n // The schema that this mark type instance is part of.\n this.schema = schema;\n\n // :: MarkSpec\n // The spec on which the type is based.\n this.spec = spec;\n\n this.attrs = initAttrs(spec.attrs);\n\n this.rank = rank;\n this.excluded = null;\n var defaults = defaultAttrs(this.attrs);\n this.instance = defaults && new Mark(this, defaults);\n};\n\n// :: (?Object) → Mark\n// Create a mark of this type. `attrs` may be `null` or an object\n// containing only some of the mark's attributes. The others, if\n// they have defaults, will be added.\nMarkType.prototype.create = function create (attrs) {\n if (!attrs && this.instance) { return this.instance }\n return new Mark(this, computeAttrs(this.attrs, attrs))\n};\n\nMarkType.compile = function compile (marks, schema) {\n var result = Object.create(null), rank = 0;\n marks.forEach(function (name, spec) { return result[name] = new MarkType(name, rank++, schema, spec); });\n return result\n};\n\n// :: ([Mark]) → [Mark]\n// When there is a mark of this type in the given set, a new set\n// without it is returned. Otherwise, the input set is returned.\nMarkType.prototype.removeFromSet = function removeFromSet (set) {\n for (var i = 0; i < set.length; i++)\n { if (set[i].type == this)\n { return set.slice(0, i).concat(set.slice(i + 1)) } }\n return set\n};\n\n// :: ([Mark]) → ?Mark\n// Tests whether there is a mark of this type in the given set.\nMarkType.prototype.isInSet = function isInSet (set) {\n for (var i = 0; i < set.length; i++)\n { if (set[i].type == this) { return set[i] } }\n};\n\n// :: (MarkType) → bool\n// Queries whether a given mark type is\n// [excluded](#model.MarkSpec.excludes) by this one.\nMarkType.prototype.excludes = function excludes (other) {\n return this.excluded.indexOf(other) > -1\n};\n\n// SchemaSpec:: interface\n// An object describing a schema, as passed to the [`Schema`](#model.Schema)\n// constructor.\n//\n// nodes:: union<Object<NodeSpec>, OrderedMap<NodeSpec>>\n// The node types in this schema. Maps names to\n// [`NodeSpec`](#model.NodeSpec) objects that describe the node type\n// associated with that name. Their order is significant—it\n// determines which [parse rules](#model.NodeSpec.parseDOM) take\n// precedence by default, and which nodes come first in a given\n// [group](#model.NodeSpec.group).\n//\n// marks:: ?union<Object<MarkSpec>, OrderedMap<MarkSpec>>\n// The mark types that exist in this schema. The order in which they\n// are provided determines the order in which [mark\n// sets](#model.Mark.addToSet) are sorted and in which [parse\n// rules](#model.MarkSpec.parseDOM) are tried.\n//\n// topNode:: ?string\n// The name of the default top-level node for the schema. Defaults\n// to `\"doc\"`.\n\n// NodeSpec:: interface\n//\n// content:: ?string\n// The content expression for this node, as described in the [schema\n// guide](/docs/guide/#schema.content_expressions). When not given,\n// the node does not allow any content.\n//\n// marks:: ?string\n// The marks that are allowed inside of this node. May be a\n// space-separated string referring to mark names or groups, `\"_\"`\n// to explicitly allow all marks, or `\"\"` to disallow marks. When\n// not given, nodes with inline content default to allowing all\n// marks, other nodes default to not allowing marks.\n//\n// group:: ?string\n// The group or space-separated groups to which this node belongs,\n// which can be referred to in the content expressions for the\n// schema.\n//\n// inline:: ?bool\n// Should be set to true for inline nodes. (Implied for text nodes.)\n//\n// atom:: ?bool\n// Can be set to true to indicate that, though this isn't a [leaf\n// node](#model.NodeType.isLeaf), it doesn't have directly editable\n// content and should be treated as a single unit in the view.\n//\n// attrs:: ?Object<AttributeSpec>\n// The attributes that nodes of this type get.\n//\n// selectable:: ?bool\n// Controls whether nodes of this type can be selected as a [node\n// selection](#state.NodeSelection). Defaults to true for non-text\n// nodes.\n//\n// draggable:: ?bool\n// Determines whether nodes of this type can be dragged without\n// being selected. Defaults to false.\n//\n// code:: ?bool\n// Can be used to indicate that this node contains code, which\n// causes some commands to behave differently.\n//\n// defining:: ?bool\n// Determines whether this node is considered an important parent\n// node during replace operations (such as paste). Non-defining (the\n// default) nodes get dropped when their entire content is replaced,\n// whereas defining nodes persist and wrap the inserted content.\n// Likewise, in _inserted_ content the defining parents of the\n// content are preserved when possible. Typically,\n// non-default-paragraph textblock types, and possibly list items,\n// are marked as defining.\n//\n// isolating:: ?bool\n// When enabled (default is false), the sides of nodes of this type\n// count as boundaries that regular editing operations, like\n// backspacing or lifting, won't cross. An example of a node that\n// should probably have this enabled is a table cell.\n//\n// toDOM:: ?(node: Node) → DOMOutputSpec\n// Defines the default way a node of this type should be serialized\n// to DOM/HTML (as used by\n// [`DOMSerializer.fromSchema`](#model.DOMSerializer^fromSchema)).\n// Should return a DOM node or an [array\n// structure](#model.DOMOutputSpec) that describes one, with an\n// optional number zero (“hole”) in it to indicate where the node's\n// content should be inserted.\n//\n// For text nodes, the default is to create a text DOM node. Though\n// it is possible to create a serializer where text is rendered\n// differently, this is not supported inside the editor, so you\n// shouldn't override that in your text node spec.\n//\n// parseDOM:: ?[ParseRule]\n// Associates DOM parser information with this node, which can be\n// used by [`DOMParser.fromSchema`](#model.DOMParser^fromSchema) to\n// automatically derive a parser. The `node` field in the rules is\n// implied (the name of this node will be filled in automatically).\n// If you supply your own parser, you do not need to also specify\n// parsing rules in your schema.\n//\n// toDebugString:: ?(node: Node) -> string\n// Defines the default way a node of this type should be serialized\n// to a string representation for debugging (e.g. in error messages).\n\n// MarkSpec:: interface\n//\n// attrs:: ?Object<AttributeSpec>\n// The attributes that marks of this type get.\n//\n// inclusive:: ?bool\n// Whether this mark should be active when the cursor is positioned\n// at its end (or at its start when that is also the start of the\n// parent node). Defaults to true.\n//\n// excludes:: ?string\n// Determines which other marks this mark can coexist with. Should\n// be a space-separated strings naming other marks or groups of marks.\n// When a mark is [added](#model.Mark.addToSet) to a set, all marks\n// that it excludes are removed in the process. If the set contains\n// any mark that excludes the new mark but is not, itself, excluded\n// by the new mark, the mark can not be added an the set. You can\n// use the value `\"_\"` to indicate that the mark excludes all\n// marks in the schema.\n//\n// Defaults to only being exclusive with marks of the same type. You\n// can set it to an empty string (or any string not containing the\n// mark's own name) to allow multiple marks of a given type to\n// coexist (as long as they have different attributes).\n//\n// group:: ?string\n// The group or space-separated groups to which this mark belongs.\n//\n// spanning:: ?bool\n// Determines whether marks of this type can span multiple adjacent\n// nodes when serialized to DOM/HTML. Defaults to true.\n//\n// toDOM:: ?(mark: Mark, inline: bool) → DOMOutputSpec\n// Defines the default way marks of this type should be serialized\n// to DOM/HTML. When the resulting spec contains a hole, that is\n// where the marked content is placed. Otherwise, it is appended to\n// the top node.\n//\n// parseDOM:: ?[ParseRule]\n// Associates DOM parser information with this mark (see the\n// corresponding [node spec field](#model.NodeSpec.parseDOM)). The\n// `mark` field in the rules is implied.\n\n// AttributeSpec:: interface\n//\n// Used to [define](#model.NodeSpec.attrs) attributes on nodes or\n// marks.\n//\n// default:: ?any\n// The default value for this attribute, to use when no explicit\n// value is provided. Attributes that have no default must be\n// provided whenever a node or mark of a type that has them is\n// created.\n\n// ::- A document schema. Holds [node](#model.NodeType) and [mark\n// type](#model.MarkType) objects for the nodes and marks that may\n// occur in conforming documents, and provides functionality for\n// creating and deserializing such documents.\nvar Schema = function Schema(spec) {\n // :: SchemaSpec\n // The [spec](#model.SchemaSpec) on which the schema is based,\n // with the added guarantee that its `nodes` and `marks`\n // properties are\n // [`OrderedMap`](https://github.com/marijnh/orderedmap) instances\n // (not raw objects).\n this.spec = {};\n for (var prop in spec) { this.spec[prop] = spec[prop]; }\n this.spec.nodes = OrderedMap.from(spec.nodes);\n this.spec.marks = OrderedMap.from(spec.marks);\n\n // :: Object<NodeType>\n // An object mapping the schema's node names to node type objects.\n this.nodes = NodeType.compile(this.spec.nodes, this);\n\n // :: Object<MarkType>\n // A map from mark names to mark type objects.\n this.marks = MarkType.compile(this.spec.marks, this);\n\n var contentExprCache = Object.create(null);\n for (var prop$1 in this.nodes) {\n if (prop$1 in this.marks)\n { throw new RangeError(prop$1 + \" can not be both a node and a mark\") }\n var type = this.nodes[prop$1], contentExpr = type.spec.content || \"\", markExpr = type.spec.marks;\n type.contentMatch = contentExprCache[contentExpr] ||\n (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));\n type.inlineContent = type.contentMatch.inlineContent;\n type.markSet = markExpr == \"_\" ? null :\n markExpr ? gatherMarks(this, markExpr.split(\" \")) :\n markExpr == \"\" || !type.inlineContent ? [] : null;\n }\n for (var prop$2 in this.marks) {\n var type$1 = this.marks[prop$2], excl = type$1.spec.excludes;\n type$1.excluded = excl == null ? [type$1] : excl == \"\" ? [] : gatherMarks(this, excl.split(\" \"));\n }\n\n this.nodeFromJSON = this.nodeFromJSON.bind(this);\n this.markFromJSON = this.markFromJSON.bind(this);\n\n // :: NodeType\n // The type of the [default top node](#model.SchemaSpec.topNode)\n // for this schema.\n this.topNodeType = this.nodes[this.spec.topNode || \"doc\"];\n\n // :: Object\n // An object for storing whatever values modules may want to\n // compute and cache per schema. (If you want to store something\n // in it, try to use property names unlikely to clash.)\n this.cached = Object.create(null);\n this.cached.wrappings = Object.create(null);\n};\n\n// :: (union<string, NodeType>, ?Object, ?union<Fragment, Node, [Node]>, ?[Mark]) → Node\n// Create a node in this schema. The `type` may be a string or a\n// `NodeType` instance. Attributes will be extended\n// with defaults, `content` may be a `Fragment`,\n// `null`, a `Node`, or an array of nodes.\nSchema.prototype.node = function node (type, attrs, content, marks) {\n if (typeof type == \"string\")\n { type = this.nodeType(type); }\n else if (!(type instanceof NodeType))\n { throw new RangeError(\"Invalid node type: \" + type) }\n else if (type.schema != this)\n { throw new RangeError(\"Node type from different schema used (\" + type.name + \")\") }\n\n return type.createChecked(attrs, content, marks)\n};\n\n// :: (string, ?[Mark]) → Node\n// Create a text node in the schema. Empty text nodes are not\n// allowed.\nSchema.prototype.text = function text (text$1, marks) {\n var type = this.nodes.text;\n return new TextNode(type, type.defaultAttrs, text$1, Mark.setFrom(marks))\n};\n\n// :: (union<string, MarkType>, ?Object) → Mark\n// Create a mark with the given type and attributes.\nSchema.prototype.mark = function mark (type, attrs) {\n if (typeof type == \"string\") { type = this.marks[type]; }\n return type.create(attrs)\n};\n\n// :: (Object) → Node\n// Deserialize a node from its JSON representation. This method is\n// bound.\nSchema.prototype.nodeFromJSON = function nodeFromJSON (json) {\n return Node.fromJSON(this, json)\n};\n\n// :: (Object) → Mark\n// Deserialize a mark from its JSON representation. This method is\n// bound.\nSchema.prototype.markFromJSON = function markFromJSON (json) {\n return Mark.fromJSON(this, json)\n};\n\nSchema.prototype.nodeType = function nodeType (name) {\n var found = this.nodes[name];\n if (!found) { throw new RangeError(\"Unknown node type: \" + name) }\n return found\n};\n\nfunction gatherMarks(schema, marks) {\n var found = [];\n for (var i = 0; i < marks.length; i++) {\n var name = marks[i], mark = schema.marks[name], ok = mark;\n if (mark) {\n found.push(mark);\n } else {\n for (var prop in schema.marks) {\n var mark$1 = schema.marks[prop];\n if (name == \"_\" || (mark$1.spec.group && mark$1.spec.group.split(\" \").indexOf(name) > -1))\n { found.push(ok = mark$1); }\n }\n }\n if (!ok) { throw new SyntaxError(\"Unknown mark type: '\" + marks[i] + \"'\") }\n }\n return found\n}\n\n// ParseOptions:: interface\n// These are the options recognized by the\n// [`parse`](#model.DOMParser.parse) and\n// [`parseSlice`](#model.DOMParser.parseSlice) methods.\n//\n// preserveWhitespace:: ?union<bool, \"full\">\n// By default, whitespace is collapsed as per HTML's rules. Pass\n// `true` to preserve whitespace, but normalize newlines to\n// spaces, and `\"full\"` to preserve whitespace entirely.\n//\n// findPositions:: ?[{node: dom.Node, offset: number}]\n// When given, the parser will, beside parsing the content,\n// record the document positions of the given DOM positions. It\n// will do so by writing to the objects, adding a `pos` property\n// that holds the document position. DOM positions that are not\n// in the parsed content will not be written to.\n//\n// from:: ?number\n// The child node index to start parsing from.\n//\n// to:: ?number\n// The child node index to stop parsing at.\n//\n// topNode:: ?Node\n// By default, the content is parsed into the schema's default\n// [top node type](#model.Schema.topNodeType). You can pass this\n// option to use the type and attributes from a different node\n// as the top container.\n//\n// topMatch:: ?ContentMatch\n// Provide the starting content match that content parsed into the\n// top node is matched against.\n//\n// context:: ?ResolvedPos\n// A set of additional nodes to count as\n// [context](#model.ParseRule.context) when parsing, above the\n// given [top node](#model.ParseOptions.topNode).\n\n// ParseRule:: interface\n// A value that describes how to parse a given DOM node or inline\n// style as a ProseMirror node or mark.\n//\n// tag:: ?string\n// A CSS selector describing the kind of DOM elements to match. A\n// single rule should have _either_ a `tag` or a `style` property.\n//\n// namespace:: ?string\n// The namespace to match. This should be used with `tag`.\n// Nodes are only matched when the namespace matches or this property\n// is null.\n//\n// style:: ?string\n// A CSS property name to match. When given, this rule matches\n// inline styles that list that property. May also have the form\n// `\"property=value\"`, in which case the rule only matches if the\n// propery's value exactly matches the given value. (For more\n// complicated filters, use [`getAttrs`](#model.ParseRule.getAttrs)\n// and return false to indicate that the match failed.)\n//\n// priority:: ?number\n// Can be used to change the order in which the parse rules in a\n// schema are tried. Those with higher priority come first. Rules\n// without a priority are counted as having priority 50. This\n// property is only meaningful in a schema—when directly\n// constructing a parser, the order of the rule array is used.\n//\n// context:: ?string\n// When given, restricts this rule to only match when the current\n// context—the parent nodes into which the content is being\n// parsed—matches this expression. Should contain one or more node\n// names or node group names followed by single or double slashes.\n// For example `\"paragraph/\"` means the rule only matches when the\n// parent node is a paragraph, `\"blockquote/paragraph/\"` restricts\n// it to be in a paragraph that is inside a blockquote, and\n// `\"section//\"` matches any position inside a section—a double\n// slash matches any sequence of ancestor nodes. To allow multiple\n// different contexts, they can be separated by a pipe (`|`)\n// character, as in `\"blockquote/|list_item/\"`.\n//\n// node:: ?string\n// The name of the node type to create when this rule matches. Only\n// valid for rules with a `tag` property, not for style rules. Each\n// rule should have one of a `node`, `mark`, or `ignore` property\n// (except when it appears in a [node](#model.NodeSpec.parseDOM) or\n// [mark spec](#model.MarkSpec.parseDOM), in which case the `node`\n// or `mark` property will be derived from its position).\n//\n// mark:: ?string\n// The name of the mark type to wrap the matched content in.\n//\n// ignore:: ?bool\n// When true, ignore content that matches this rule.\n//\n// skip:: ?bool\n// When true, ignore the node that matches this rule, but do parse\n// its content.\n//\n// attrs:: ?Object\n// Attributes for the node or mark created by this rule. When\n// `getAttrs` is provided, it takes precedence.\n//\n// getAttrs:: ?(union<dom.Node, string>) → ?union<Object, false>\n// A function used to compute the attributes for the node or mark\n// created by this rule. Can also be used to describe further\n// conditions the DOM element or style must match. When it returns\n// `false`, the rule won't match. When it returns null or undefined,\n// that is interpreted as an empty/default set of attributes.\n//\n// Called with a DOM Element for `tag` rules, and with a string (the\n// style's value) for `style` rules.\n//\n// contentElement:: ?union<string, (dom.Node) → dom.Node>\n// For `tag` rules that produce non-leaf nodes or marks, by default\n// the content of the DOM element is parsed as content of the mark\n// or node. If the child nodes are in a descendent node, this may be\n// a CSS selector string that the parser must use to find the actual\n// content element, or a function that returns the actual content\n// element to the parser.\n//\n// getContent:: ?(dom.Node, schema: Schema) → Fragment\n// Can be used to override the content of a matched node. When\n// present, instead of parsing the node's child nodes, the result of\n// this function is used.\n//\n// preserveWhitespace:: ?union<bool, \"full\">\n// Controls whether whitespace should be preserved when parsing the\n// content inside the matched element. `false` means whitespace may\n// be collapsed, `true` means that whitespace should be preserved\n// but newlines normalized to spaces, and `\"full\"` means that\n// newlines should also be preserved.\n\n// ::- A DOM parser represents a strategy for parsing DOM content into\n// a ProseMirror document conforming to a given schema. Its behavior\n// is defined by an array of [rules](#model.ParseRule).\nvar DOMParser = function DOMParser(schema, rules) {\n var this$1 = this;\n\n // :: Schema\n // The schema into which the parser parses.\n this.schema = schema;\n // :: [ParseRule]\n // The set of [parse rules](#model.ParseRule) that the parser\n // uses, in order of precedence.\n this.rules = rules;\n this.tags = [];\n this.styles = [];\n\n rules.forEach(function (rule) {\n if (rule.tag) { this$1.tags.push(rule); }\n else if (rule.style) { this$1.styles.push(rule); }\n });\n};\n\n// :: (dom.Node, ?ParseOptions) → Node\n// Parse a document from the content of a DOM node.\nDOMParser.prototype.parse = function parse (dom, options) {\n if ( options === void 0 ) options = {};\n\n var context = new ParseContext(this, options, false);\n context.addAll(dom, null, options.from, options.to);\n return context.finish()\n};\n\n// :: (dom.Node, ?ParseOptions) → Slice\n// Parses the content of the given DOM node, like\n// [`parse`](#model.DOMParser.parse), and takes the same set of\n// options. But unlike that method, which produces a whole node,\n// this one returns a slice that is open at the sides, meaning that\n// the schema constraints aren't applied to the start of nodes to\n// the left of the input and the end of nodes at the end.\nDOMParser.prototype.parseSlice = function parseSlice (dom, options) {\n if ( options === void 0 ) options = {};\n\n var context = new ParseContext(this, options, true);\n context.addAll(dom, null, options.from, options.to);\n return Slice.maxOpen(context.finish())\n};\n\nDOMParser.prototype.matchTag = function matchTag (dom, context) {\n for (var i = 0; i < this.tags.length; i++) {\n var rule = this.tags[i];\n if (matches(dom, rule.tag) &&\n (rule.namespace === undefined || dom.namespaceURI == rule.namespace) &&\n (!rule.context || context.matchesContext(rule.context))) {\n if (rule.getAttrs) {\n var result = rule.getAttrs(dom);\n if (result === false) { continue }\n rule.attrs = result;\n }\n return rule\n }\n }\n};\n\nDOMParser.prototype.matchStyle = function matchStyle (prop, value, context) {\n for (var i = 0; i < this.styles.length; i++) {\n var rule = this.styles[i];\n if (rule.style.indexOf(prop) != 0 ||\n rule.context && !context.matchesContext(rule.context) ||\n // Test that the style string either precisely matches the prop,\n // or has an '=' sign after the prop, followed by the given\n // value.\n rule.style.length > prop.length &&\n (rule.style.charCodeAt(prop.length) != 61 || rule.style.slice(prop.length + 1) != value))\n { continue }\n if (rule.getAttrs) {\n var result = rule.getAttrs(value);\n if (result === false) { continue }\n rule.attrs = result;\n }\n return rule\n }\n};\n\n// : (Schema) → [ParseRule]\nDOMParser.schemaRules = function schemaRules (schema) {\n var result = [];\n function insert(rule) {\n var priority = rule.priority == null ? 50 : rule.priority, i = 0;\n for (; i < result.length; i++) {\n var next = result[i], nextPriority = next.priority == null ? 50 : next.priority;\n if (nextPriority < priority) { break }\n }\n result.splice(i, 0, rule);\n }\n\n var loop = function ( name ) {\n var rules = schema.marks[name].spec.parseDOM;\n if (rules) { rules.forEach(function (rule) {\n insert(rule = copy(rule));\n rule.mark = name;\n }); }\n };\n\n for (var name in schema.marks) loop( name );\n var loop$1 = function ( name ) {\n var rules$1 = schema.nodes[name$1].spec.parseDOM;\n if (rules$1) { rules$1.forEach(function (rule) {\n insert(rule = copy(rule));\n rule.node = name$1;\n }); }\n };\n\n for (var name$1 in schema.nodes) loop$1();\n return result\n};\n\n// :: (Schema) → DOMParser\n// Construct a DOM parser using the parsing rules listed in a\n// schema's [node specs](#model.NodeSpec.parseDOM), reordered by\n// [priority](#model.ParseRule.priority).\nDOMParser.fromSchema = function fromSchema (schema) {\n return schema.cached.domParser ||\n (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)))\n};\n\n// : Object<bool> The block-level tags in HTML5\nvar blockTags = {\n address: true, article: true, aside: true, blockquote: true, canvas: true,\n dd: true, div: true, dl: true, fieldset: true, figcaption: true, figure: true,\n footer: true, form: true, h1: true, h2: true, h3: true, h4: true, h5: true,\n h6: true, header: true, hgroup: true, hr: true, li: true, noscript: true, ol: true,\n output: true, p: true, pre: true, section: true, table: true, tfoot: true, ul: true\n};\n\n// : Object<bool> The tags that we normally ignore.\nvar ignoreTags = {\n head: true, noscript: true, object: true, script: true, style: true, title: true\n};\n\n// : Object<bool> List tags.\nvar listTags = {ol: true, ul: true};\n\n// Using a bitfield for node context options\nvar OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;\n\nfunction wsOptionsFor(preserveWhitespace) {\n return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === \"full\" ? OPT_PRESERVE_WS_FULL : 0)\n}\n\nvar NodeContext = function NodeContext(type, attrs, marks, pendingMarks, solid, match, options) {\n this.type = type;\n this.attrs = attrs;\n this.solid = solid;\n this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);\n this.options = options;\n this.content = [];\n // Marks applied to this node itself\n this.marks = marks;\n // Marks applied to its children\n this.activeMarks = Mark.none;\n // Marks that can't apply here, but will be used in children if possible\n this.pendingMarks = pendingMarks;\n};\n\nNodeContext.prototype.findWrapping = function findWrapping (node) {\n if (!this.match) {\n if (!this.type) { return [] }\n var fill = this.type.contentMatch.fillBefore(Fragment.from(node));\n if (fill) {\n this.match = this.type.contentMatch.matchFragment(fill);\n } else {\n var start = this.type.contentMatch, wrap;\n if (wrap = start.findWrapping(node.type)) {\n this.match = start;\n return wrap\n } else {\n return null\n }\n }\n }\n return this.match.findWrapping(node.type)\n};\n\nNodeContext.prototype.finish = function finish (openEnd) {\n if (!(this.options & OPT_PRESERVE_WS)) { // Strip trailing whitespace\n var last = this.content[this.content.length - 1], m;\n if (last && last.isText && (m = /[ \\t\\r\\n\\u000c]+$/.exec(last.text))) {\n if (last.text.length == m[0].length) { this.content.pop(); }\n else { this.content[this.content.length - 1] = last.withText(last.text.slice(0, last.text.length - m[0].length)); }\n }\n }\n var content = Fragment.from(this.content);\n if (!openEnd && this.match)\n { content = content.append(this.match.fillBefore(Fragment.empty, true)); }\n return this.type ? this.type.create(this.attrs, content, this.marks) : content\n};\n\nNodeContext.prototype.applyPending = function applyPending (nextType) {\n for (var i = 0, pending = this.pendingMarks; i < pending.length; i++) {\n var mark = pending[i];\n if ((this.type ? this.type.allowsMarkType(mark.type) : markMayApply(mark.type, nextType)) &&\n !mark.isInSet(this.activeMarks)) {\n this.activeMarks = mark.addToSet(this.activeMarks);\n this.pendingMarks = mark.removeFromSet(this.pendingMarks);\n }\n }\n};\n\nvar ParseContext = function ParseContext(parser, options, open) {\n // : DOMParser The parser we are using.\n this.parser = parser;\n // : Object The options passed to this parse.\n this.options = options;\n this.isOpen = open;\n var topNode = options.topNode, topContext;\n var topOptions = wsOptionsFor(options.preserveWhitespace) | (open ? OPT_OPEN_LEFT : 0);\n if (topNode)\n { topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, Mark.none, true,\n options.topMatch || topNode.type.contentMatch, topOptions); }\n else if (open)\n { topContext = new NodeContext(null, null, Mark.none, Mark.none, true, null, topOptions); }\n else\n { topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, Mark.none, true, null, topOptions); }\n this.nodes = [topContext];\n // : [Mark] The current set of marks\n this.open = 0;\n this.find = options.findPositions;\n this.needsBlock = false;\n};\n\nvar prototypeAccessors$6 = { top: { configurable: true },currentPos: { configurable: true } };\n\nprototypeAccessors$6.top.get = function () {\n return this.nodes[this.open]\n};\n\n// : (dom.Node)\n// Add a DOM node to the content. Text is inserted as text node,\n// otherwise, the node is passed to `addElement` or, if it has a\n// `style` attribute, `addElementWithStyles`.\nParseContext.prototype.addDOM = function addDOM (dom) {\n if (dom.nodeType == 3) {\n this.addTextNode(dom);\n } else if (dom.nodeType == 1) {\n var style = dom.getAttribute(\"style\");\n var marks = style ? this.readStyles(parseStyles(style)) : null, top = this.top;\n if (marks != null) { for (var i = 0; i < marks.length; i++) { this.addPendingMark(marks[i]); } }\n this.addElement(dom);\n if (marks != null) { for (var i$1 = 0; i$1 < marks.length; i$1++) { this.removePendingMark(marks[i$1], top); } }\n }\n};\n\nParseContext.prototype.addTextNode = function addTextNode (dom) {\n var value = dom.nodeValue;\n var top = this.top;\n if ((top.type ? top.type.inlineContent : top.content.length && top.content[0].isInline) || /[^ \\t\\r\\n\\u000c]/.test(value)) {\n if (!(top.options & OPT_PRESERVE_WS)) {\n value = value.replace(/[ \\t\\r\\n\\u000c]+/g, \" \");\n // If this starts with whitespace, and there is no node before it, or\n // a hard break, or a text node that ends with whitespace, strip the\n // leading space.\n if (/^[ \\t\\r\\n\\u000c]/.test(value) && this.open == this.nodes.length - 1) {\n var nodeBefore = top.content[top.content.length - 1];\n var domNodeBefore = dom.previousSibling;\n if (!nodeBefore ||\n (domNodeBefore && domNodeBefore.nodeName == 'BR') ||\n (nodeBefore.isText && /[ \\t\\r\\n\\u000c]$/.test(nodeBefore.text)))\n { value = value.slice(1); }\n }\n } else if (!(top.options & OPT_PRESERVE_WS_FULL)) {\n value = value.replace(/\\r?\\n|\\r/g, \" \");\n }\n if (value) { this.insertNode(this.parser.schema.text(value)); }\n this.findInText(dom);\n } else {\n this.findInside(dom);\n }\n};\n\n// : (dom.Element)\n// Try to find a handler for the given tag and use that to parse. If\n// none is found, the element's content nodes are added directly.\nParseContext.prototype.addElement = function addElement (dom) {\n var name = dom.nodeName.toLowerCase();\n if (listTags.hasOwnProperty(name)) { normalizeList(dom); }\n var rule = (this.options.ruleFromNode && this.options.ruleFromNode(dom)) || this.parser.matchTag(dom, this);\n if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {\n this.findInside(dom);\n } else if (!rule || rule.skip) {\n if (rule && rule.skip.nodeType) { dom = rule.skip; }\n var sync, top = this.top, oldNeedsBlock = this.needsBlock;\n if (blockTags.hasOwnProperty(name)) {\n sync = true;\n if (!top.type) { this.needsBlock = true; }\n } else if (!dom.firstChild) {\n this.leafFallback(dom);\n return\n }\n this.addAll(dom);\n if (sync) { this.sync(top); }\n this.needsBlock = oldNeedsBlock;\n } else {\n this.addElementByRule(dom, rule);\n }\n};\n\n// Called for leaf DOM nodes that would otherwise be ignored\nParseContext.prototype.leafFallback = function leafFallback (dom) {\n if (dom.nodeName == \"BR\" && this.top.type && this.top.type.inlineContent)\n { this.addTextNode(dom.ownerDocument.createTextNode(\"\\n\")); }\n};\n\n// Run any style parser associated with the node's styles. Either\n// return an array of marks, or null to indicate some of the styles\n// had a rule with `ignore` set.\nParseContext.prototype.readStyles = function readStyles (styles) {\n var marks = Mark.none;\n for (var i = 0; i < styles.length; i += 2) {\n var rule = this.parser.matchStyle(styles[i], styles[i + 1], this);\n if (!rule) { continue }\n if (rule.ignore) { return null }\n marks = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(marks);\n }\n return marks\n};\n\n// : (dom.Element, ParseRule) → bool\n// Look up a handler for the given node. If none are found, return\n// false. Otherwise, apply it, use its return value to drive the way\n// the node's content is wrapped, and return true.\nParseContext.prototype.addElementByRule = function addElementByRule (dom, rule) {\n var this$1 = this;\n\n var sync, nodeType, markType, mark;\n if (rule.node) {\n nodeType = this.parser.schema.nodes[rule.node];\n if (!nodeType.isLeaf) {\n sync = this.enter(nodeType, rule.attrs, rule.preserveWhitespace);\n } else if (!this.insertNode(nodeType.create(rule.attrs))) {\n this.leafFallback(dom);\n }\n } else {\n markType = this.parser.schema.marks[rule.mark];\n mark = markType.create(rule.attrs);\n this.addPendingMark(mark);\n }\n var startIn = this.top;\n\n if (nodeType && nodeType.isLeaf) {\n this.findInside(dom);\n } else if (rule.getContent) {\n this.findInside(dom);\n rule.getContent(dom, this.parser.schema).forEach(function (node) { return this$1.insertNode(node); });\n } else {\n var contentDOM = rule.contentElement;\n if (typeof contentDOM == \"string\") { contentDOM = dom.querySelector(contentDOM); }\n else if (typeof contentDOM == \"function\") { contentDOM = contentDOM(dom); }\n if (!contentDOM) { contentDOM = dom; }\n this.findAround(dom, contentDOM, true);\n this.addAll(contentDOM, sync);\n }\n if (sync) { this.sync(startIn); this.open--; }\n if (mark) { this.removePendingMark(mark, startIn); }\n};\n\n// : (dom.Node, ?NodeBuilder, ?number, ?number)\n// Add all child nodes between `startIndex` and `endIndex` (or the\n// whole node, if not given). If `sync` is passed, use it to\n// synchronize after every block element.\nParseContext.prototype.addAll = function addAll (parent, sync, startIndex, endIndex) {\n var index = startIndex || 0;\n for (var dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild,\n end = endIndex == null ? null : parent.childNodes[endIndex];\n dom != end; dom = dom.nextSibling, ++index) {\n this.findAtPoint(parent, index);\n this.addDOM(dom);\n if (sync && blockTags.hasOwnProperty(dom.nodeName.toLowerCase()))\n { this.sync(sync); }\n }\n this.findAtPoint(parent, index);\n};\n\n// Try to find a way to fit the given node type into the current\n// context. May add intermediate wrappers and/or leave non-solid\n// nodes that we're in.\nParseContext.prototype.findPlace = function findPlace (node) {\n var route, sync;\n for (var depth = this.open; depth >= 0; depth--) {\n var cx = this.nodes[depth];\n var found = cx.findWrapping(node);\n if (found && (!route || route.length > found.length)) {\n route = found;\n sync = cx;\n if (!found.length) { break }\n }\n if (cx.solid) { break }\n }\n if (!route) { return false }\n this.sync(sync);\n for (var i = 0; i < route.length; i++)\n { this.enterInner(route[i], null, false); }\n return true\n};\n\n// : (Node) → ?Node\n// Try to insert the given node, adjusting the context when needed.\nParseContext.prototype.insertNode = function insertNode (node) {\n if (node.isInline && this.needsBlock && !this.top.type) {\n var block = this.textblockFromContext();\n if (block) { this.enterInner(block); }\n }\n if (this.findPlace(node)) {\n this.closeExtra();\n var top = this.top;\n top.applyPending(node.type);\n if (top.match) { top.match = top.match.matchType(node.type); }\n var marks = top.activeMarks;\n for (var i = 0; i < node.marks.length; i++)\n { if (!top.type || top.type.allowsMarkType(node.marks[i].type))\n { marks = node.marks[i].addToSet(marks); } }\n top.content.push(node.mark(marks));\n return true\n }\n return false\n};\n\n// : (NodeType, ?Object) → bool\n// Try to start a node of the given type, adjusting the context when\n// necessary.\nParseContext.prototype.enter = function enter (type, attrs, preserveWS) {\n var ok = this.findPlace(type.create(attrs));\n if (ok) { this.enterInner(type, attrs, true, preserveWS); }\n return ok\n};\n\n// Open a node of the given type\nParseContext.prototype.enterInner = function enterInner (type, attrs, solid, preserveWS) {\n this.closeExtra();\n var top = this.top;\n top.applyPending(type);\n top.match = top.match && top.match.matchType(type, attrs);\n var options = preserveWS == null ? top.options & ~OPT_OPEN_LEFT : wsOptionsFor(preserveWS);\n if ((top.options & OPT_OPEN_LEFT) && top.content.length == 0) { options |= OPT_OPEN_LEFT; }\n this.nodes.push(new NodeContext(type, attrs, top.activeMarks, top.pendingMarks, solid, null, options));\n this.open++;\n};\n\n// Make sure all nodes above this.open are finished and added to\n// their parents\nParseContext.prototype.closeExtra = function closeExtra (openEnd) {\n var i = this.nodes.length - 1;\n if (i > this.open) {\n for (; i > this.open; i--) { this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd)); }\n this.nodes.length = this.open + 1;\n }\n};\n\nParseContext.prototype.finish = function finish () {\n this.open = 0;\n this.closeExtra(this.isOpen);\n return this.nodes[0].finish(this.isOpen || this.options.topOpen)\n};\n\nParseContext.prototype.sync = function sync (to) {\n for (var i = this.open; i >= 0; i--) { if (this.nodes[i] == to) {\n this.open = i;\n return\n } }\n};\n\nprototypeAccessors$6.currentPos.get = function () {\n this.closeExtra();\n var pos = 0;\n for (var i = this.open; i >= 0; i--) {\n var content = this.nodes[i].content;\n for (var j = content.length - 1; j >= 0; j--)\n { pos += content[j].nodeSize; }\n if (i) { pos++; }\n }\n return pos\n};\n\nParseContext.prototype.findAtPoint = function findAtPoint (parent, offset) {\n if (this.find) { for (var i = 0; i < this.find.length; i++) {\n if (this.find[i].node == parent && this.find[i].offset == offset)\n { this.find[i].pos = this.currentPos; }\n } }\n};\n\nParseContext.prototype.findInside = function findInside (parent) {\n if (this.find) { for (var i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node))\n { this.find[i].pos = this.currentPos; }\n } }\n};\n\nParseContext.prototype.findAround = function findAround (parent, content, before) {\n if (parent != content && this.find) { for (var i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {\n var pos = content.compareDocumentPosition(this.find[i].node);\n if (pos & (before ? 2 : 4))\n { this.find[i].pos = this.currentPos; }\n }\n } }\n};\n\nParseContext.prototype.findInText = function findInText (textNode) {\n if (this.find) { for (var i = 0; i < this.find.length; i++) {\n if (this.find[i].node == textNode)\n { this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset); }\n } }\n};\n\n// : (string) → bool\n// Determines whether the given [context\n// string](#ParseRule.context) matches this context.\nParseContext.prototype.matchesContext = function matchesContext (context) {\n var this$1 = this;\n\n if (context.indexOf(\"|\") > -1)\n { return context.split(/\\s*\\|\\s*/).some(this.matchesContext, this) }\n\n var parts = context.split(\"/\");\n var option = this.options.context;\n var useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);\n var minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);\n var match = function (i, depth) {\n for (; i >= 0; i--) {\n var part = parts[i];\n if (part == \"\") {\n if (i == parts.length - 1 || i == 0) { continue }\n for (; depth >= minDepth; depth--)\n { if (match(i - 1, depth)) { return true } }\n return false\n } else {\n var next = depth > 0 || (depth == 0 && useRoot) ? this$1.nodes[depth].type\n : option && depth >= minDepth ? option.node(depth - minDepth).type\n : null;\n if (!next || (next.name != part && next.groups.indexOf(part) == -1))\n { return false }\n depth--;\n }\n }\n return true\n };\n return match(parts.length - 1, this.open)\n};\n\nParseContext.prototype.textblockFromContext = function textblockFromContext () {\n var $context = this.options.context;\n if ($context) { for (var d = $context.depth; d >= 0; d--) {\n var deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;\n if (deflt && deflt.isTextblock && deflt.defaultAttrs) { return deflt }\n } }\n for (var name in this.parser.schema.nodes) {\n var type = this.parser.schema.nodes[name];\n if (type.isTextblock && type.defaultAttrs) { return type }\n }\n};\n\nParseContext.prototype.addPendingMark = function addPendingMark (mark) {\n this.top.pendingMarks = mark.addToSet(this.top.pendingMarks);\n};\n\nParseContext.prototype.removePendingMark = function removePendingMark (mark, upto) {\n for (var depth = this.open; depth >= 0; depth--) {\n var level = this.nodes[depth];\n var found = level.pendingMarks.lastIndexOf(mark);\n if (found > -1) { level.pendingMarks = mark.removeFromSet(level.pendingMarks); }\n else { level.activeMarks = mark.removeFromSet(level.activeMarks); }\n if (level == upto) { break }\n }\n};\n\nObject.defineProperties( ParseContext.prototype, prototypeAccessors$6 );\n\n// Kludge to work around directly nested list nodes produced by some\n// tools and allowed by browsers to mean that the nested list is\n// actually part of the list item above it.\nfunction normalizeList(dom) {\n for (var child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {\n var name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;\n if (name && listTags.hasOwnProperty(name) && prevItem) {\n prevItem.appendChild(child);\n child = prevItem;\n } else if (name == \"li\") {\n prevItem = child;\n } else if (name) {\n prevItem = null;\n }\n }\n}\n\n// Apply a CSS selector.\nfunction matches(dom, selector) {\n return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector)\n}\n\n// : (string) → [string]\n// Tokenize a style attribute into property/value pairs.\nfunction parseStyles(style) {\n var re = /\\s*([\\w-]+)\\s*:\\s*([^;]+)/g, m, result = [];\n while (m = re.exec(style)) { result.push(m[1], m[2].trim()); }\n return result\n}\n\nfunction copy(obj) {\n var copy = {};\n for (var prop in obj) { copy[prop] = obj[prop]; }\n return copy\n}\n\n// Used when finding a mark at the top level of a fragment parse.\n// Checks whether it would be reasonable to apply a given mark type to\n// a given node, by looking at the way the mark occurs in the schema.\nfunction markMayApply(markType, nodeType) {\n var nodes = nodeType.schema.nodes;\n var loop = function ( name ) {\n var parent = nodes[name];\n if (!parent.allowsMarkType(markType)) { return }\n var seen = [], scan = function (match) {\n seen.push(match);\n for (var i = 0; i < match.edgeCount; i++) {\n var ref = match.edge(i);\n var type = ref.type;\n var next = ref.next;\n if (type == nodeType) { return true }\n if (seen.indexOf(next) < 0 && scan(next)) { return true }\n }\n };\n if (scan(parent.contentMatch)) { return { v: true } }\n };\n\n for (var name in nodes) {\n var returned = loop( name );\n\n if ( returned ) return returned.v;\n }\n}\n\n// DOMOutputSpec:: interface\n// A description of a DOM structure. Can be either a string, which is\n// interpreted as a text node, a DOM node, which is interpreted as\n// itself, or an array.\n//\n// An array describes a DOM element. The first value in the array\n// should be a string—the name of the DOM element, optionally prefixed\n// by a namespace URL and a space. If the second element is plain\n// object, it is interpreted as a set of attributes for the element.\n// Any elements after that (including the 2nd if it's not an attribute\n// object) are interpreted as children of the DOM elements, and must\n// either be valid `DOMOutputSpec` values, or the number zero.\n//\n// The number zero (pronounced “hole”) is used to indicate the place\n// where a node's child nodes should be inserted. If it occurs in an\n// output spec, it should be the only child element in its parent\n// node.\n\n// ::- A DOM serializer knows how to convert ProseMirror nodes and\n// marks of various types to DOM nodes.\nvar DOMSerializer = function DOMSerializer(nodes, marks) {\n // :: Object<(node: Node) → DOMOutputSpec>\n // The node serialization functions.\n this.nodes = nodes || {};\n // :: Object<?(mark: Mark, inline: bool) → DOMOutputSpec>\n // The mark serialization functions.\n this.marks = marks || {};\n};\n\n// :: (Fragment, ?Object) → dom.DocumentFragment\n// Serialize the content of this fragment to a DOM fragment. When\n// not in the browser, the `document` option, containing a DOM\n// document, should be passed so that the serializer can create\n// nodes.\nDOMSerializer.prototype.serializeFragment = function serializeFragment (fragment, options, target) {\n var this$1 = this;\n if ( options === void 0 ) options = {};\n\n if (!target) { target = doc(options).createDocumentFragment(); }\n\n var top = target, active = null;\n fragment.forEach(function (node) {\n if (active || node.marks.length) {\n if (!active) { active = []; }\n var keep = 0, rendered = 0;\n while (keep < active.length && rendered < node.marks.length) {\n var next = node.marks[rendered];\n if (!this$1.marks[next.type.name]) { rendered++; continue }\n if (!next.eq(active[keep]) || next.type.spec.spanning === false) { break }\n keep += 2; rendered++;\n }\n while (keep < active.length) {\n top = active.pop();\n active.pop();\n }\n while (rendered < node.marks.length) {\n var add = node.marks[rendered++];\n var markDOM = this$1.serializeMark(add, node.isInline, options);\n if (markDOM) {\n active.push(add, top);\n top.appendChild(markDOM.dom);\n top = markDOM.contentDOM || markDOM.dom;\n }\n }\n }\n top.appendChild(this$1.serializeNode(node, options));\n });\n\n return target\n};\n\n// :: (Node, ?Object) → dom.Node\n// Serialize this node to a DOM node. This can be useful when you\n// need to serialize a part of a document, as opposed to the whole\n// document. To serialize a whole document, use\n// [`serializeFragment`](#model.DOMSerializer.serializeFragment) on\n// its [content](#model.Node.content).\nDOMSerializer.prototype.serializeNode = function serializeNode (node, options) {\n if ( options === void 0 ) options = {};\n\n var ref =\n DOMSerializer.renderSpec(doc(options), this.nodes[node.type.name](node));\n var dom = ref.dom;\n var contentDOM = ref.contentDOM;\n if (contentDOM) {\n if (node.isLeaf)\n { throw new RangeError(\"Content hole not allowed in a leaf node spec\") }\n if (options.onContent)\n { options.onContent(node, contentDOM, options); }\n else\n { this.serializeFragment(node.content, options, contentDOM); }\n }\n return dom\n};\n\nDOMSerializer.prototype.serializeNodeAndMarks = function serializeNodeAndMarks (node, options) {\n if ( options === void 0 ) options = {};\n\n var dom = this.serializeNode(node, options);\n for (var i = node.marks.length - 1; i >= 0; i--) {\n var wrap = this.serializeMark(node.marks[i], node.isInline, options);\n if (wrap) {\n(wrap.contentDOM || wrap.dom).appendChild(dom);\n dom = wrap.dom;\n }\n }\n return dom\n};\n\nDOMSerializer.prototype.serializeMark = function serializeMark (mark, inline, options) {\n if ( options === void 0 ) options = {};\n\n var toDOM = this.marks[mark.type.name];\n return toDOM && DOMSerializer.renderSpec(doc(options), toDOM(mark, inline))\n};\n\n// :: (dom.Document, DOMOutputSpec) → {dom: dom.Node, contentDOM: ?dom.Node}\n// Render an [output spec](#model.DOMOutputSpec) to a DOM node. If\n// the spec has a hole (zero) in it, `contentDOM` will point at the\n// node with the hole.\nDOMSerializer.renderSpec = function renderSpec (doc, structure, xmlNS) {\n if ( xmlNS === void 0 ) xmlNS = null;\n\n if (typeof structure == \"string\")\n { return {dom: doc.createTextNode(structure)} }\n if (structure.nodeType != null)\n { return {dom: structure} }\n var tagName = structure[0], space = tagName.indexOf(\" \");\n if (space > 0) {\n xmlNS = tagName.slice(0, space);\n tagName = tagName.slice(space + 1);\n }\n var contentDOM = null, dom = xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName);\n var attrs = structure[1], start = 1;\n if (attrs && typeof attrs == \"object\" && attrs.nodeType == null && !Array.isArray(attrs)) {\n start = 2;\n for (var name in attrs) { if (attrs[name] != null) {\n var space$1 = name.indexOf(\" \");\n if (space$1 > 0) { dom.setAttributeNS(name.slice(0, space$1), name.slice(space$1 + 1), attrs[name]); }\n else { dom.setAttribute(name, attrs[name]); }\n } }\n }\n for (var i = start; i < structure.length; i++) {\n var child = structure[i];\n if (child === 0) {\n if (i < structure.length - 1 || i > start)\n { throw new RangeError(\"Content hole must be the only child of its parent node\") }\n return {dom: dom, contentDOM: dom}\n } else {\n var ref = DOMSerializer.renderSpec(doc, child, xmlNS);\n var inner = ref.dom;\n var innerContent = ref.contentDOM;\n dom.appendChild(inner);\n if (innerContent) {\n if (contentDOM) { throw new RangeError(\"Multiple content holes\") }\n contentDOM = innerContent;\n }\n }\n }\n return {dom: dom, contentDOM: contentDOM}\n};\n\n// :: (Schema) → DOMSerializer\n// Build a serializer using the [`toDOM`](#model.NodeSpec.toDOM)\n// properties in a schema's node and mark specs.\nDOMSerializer.fromSchema = function fromSchema (schema) {\n return schema.cached.domSerializer ||\n (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)))\n};\n\n// : (Schema) → Object<(node: Node) → DOMOutputSpec>\n// Gather the serializers in a schema's node specs into an object.\n// This can be useful as a base to build a custom serializer from.\nDOMSerializer.nodesFromSchema = function nodesFromSchema (schema) {\n var result = gatherToDOM(schema.nodes);\n if (!result.text) { result.text = function (node) { return node.text; }; }\n return result\n};\n\n// : (Schema) → Object<(mark: Mark) → DOMOutputSpec>\n// Gather the serializers in a schema's mark specs into an object.\nDOMSerializer.marksFromSchema = function marksFromSchema (schema) {\n return gatherToDOM(schema.marks)\n};\n\nfunction gatherToDOM(obj) {\n var result = {};\n for (var name in obj) {\n var toDOM = obj[name].spec.toDOM;\n if (toDOM) { result[name] = toDOM; }\n }\n return result\n}\n\nfunction doc(options) {\n // declare global: window\n return options.document || window.document\n}\n\nexport { ContentMatch, DOMParser, DOMSerializer, Fragment, Mark, MarkType, Node, NodeRange, NodeType, ReplaceError, ResolvedPos, Schema, Slice };\n//# sourceMappingURL=index.es.js.map\n","import { ReplaceError, Slice, Fragment, MarkType } from 'prosemirror-model';\n\n// Mappable:: interface\n// There are several things that positions can be mapped through.\n// Such objects conform to this interface.\n//\n// map:: (pos: number, assoc: ?number) → number\n// Map a position through this object. When given, `assoc` (should\n// be -1 or 1, defaults to 1) determines with which side the\n// position is associated, which determines in which direction to\n// move when a chunk of content is inserted at the mapped position.\n//\n// mapResult:: (pos: number, assoc: ?number) → MapResult\n// Map a position, and return an object containing additional\n// information about the mapping. The result's `deleted` field tells\n// you whether the position was deleted (completely enclosed in a\n// replaced range) during the mapping. When content on only one side\n// is deleted, the position itself is only considered deleted when\n// `assoc` points in the direction of the deleted content.\n\n// Recovery values encode a range index and an offset. They are\n// represented as numbers, because tons of them will be created when\n// mapping, for example, a large number of decorations. The number's\n// lower 16 bits provide the index, the remaining bits the offset.\n//\n// Note: We intentionally don't use bit shift operators to en- and\n// decode these, since those clip to 32 bits, which we might in rare\n// cases want to overflow. A 64-bit float can represent 48-bit\n// integers precisely.\n\nvar lower16 = 0xffff;\nvar factor16 = Math.pow(2, 16);\n\nfunction makeRecover(index, offset) { return index + offset * factor16 }\nfunction recoverIndex(value) { return value & lower16 }\nfunction recoverOffset(value) { return (value - (value & lower16)) / factor16 }\n\n// ::- An object representing a mapped position with extra\n// information.\nvar MapResult = function MapResult(pos, deleted, recover) {\n if ( deleted === void 0 ) deleted = false;\n if ( recover === void 0 ) recover = null;\n\n // :: number The mapped version of the position.\n this.pos = pos;\n // :: bool Tells you whether the position was deleted, that is,\n // whether the step removed its surroundings from the document.\n this.deleted = deleted;\n this.recover = recover;\n};\n\n// :: class extends Mappable\n// A map describing the deletions and insertions made by a step, which\n// can be used to find the correspondence between positions in the\n// pre-step version of a document and the same position in the\n// post-step version.\nvar StepMap = function StepMap(ranges, inverted) {\n if ( inverted === void 0 ) inverted = false;\n\n this.ranges = ranges;\n this.inverted = inverted;\n};\n\nStepMap.prototype.recover = function recover (value) {\n var diff = 0, index = recoverIndex(value);\n if (!this.inverted) { for (var i = 0; i < index; i++)\n { diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1]; } }\n return this.ranges[index * 3] + diff + recoverOffset(value)\n};\n\n// : (number, ?number) → MapResult\nStepMap.prototype.mapResult = function mapResult (pos, assoc) {\n if ( assoc === void 0 ) assoc = 1;\n return this._map(pos, assoc, false) };\n\n// : (number, ?number) → number\nStepMap.prototype.map = function map (pos, assoc) {\n if ( assoc === void 0 ) assoc = 1;\n return this._map(pos, assoc, true) };\n\nStepMap.prototype._map = function _map (pos, assoc, simple) {\n var diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (var i = 0; i < this.ranges.length; i += 3) {\n var start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos) { break }\n var oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;\n if (pos <= end) {\n var side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;\n var result = start + diff + (side < 0 ? 0 : newSize);\n if (simple) { return result }\n var recover = makeRecover(i / 3, pos - start);\n return new MapResult(result, assoc < 0 ? pos != start : pos != end, recover)\n }\n diff += newSize - oldSize;\n }\n return simple ? pos + diff : new MapResult(pos + diff)\n};\n\nStepMap.prototype.touches = function touches (pos, recover) {\n var diff = 0, index = recoverIndex(recover);\n var oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (var i = 0; i < this.ranges.length; i += 3) {\n var start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos) { break }\n var oldSize = this.ranges[i + oldIndex], end = start + oldSize;\n if (pos <= end && i == index * 3) { return true }\n diff += this.ranges[i + newIndex] - oldSize;\n }\n return false\n};\n\n// :: ((oldStart: number, oldEnd: number, newStart: number, newEnd: number))\n// Calls the given function on each of the changed ranges included in\n// this map.\nStepMap.prototype.forEach = function forEach (f) {\n var oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (var i = 0, diff = 0; i < this.ranges.length; i += 3) {\n var start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);\n var oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];\n f(oldStart, oldStart + oldSize, newStart, newStart + newSize);\n diff += newSize - oldSize;\n }\n};\n\n// :: () → StepMap\n// Create an inverted version of this map. The result can be used to\n// map positions in the post-step document to the pre-step document.\nStepMap.prototype.invert = function invert () {\n return new StepMap(this.ranges, !this.inverted)\n};\n\nStepMap.prototype.toString = function toString () {\n return (this.inverted ? \"-\" : \"\") + JSON.stringify(this.ranges)\n};\n\n// :: (n: number) → StepMap\n// Create a map that moves all positions by offset `n` (which may be\n// negative). This can be useful when applying steps meant for a\n// sub-document to a larger document, or vice-versa.\nStepMap.offset = function offset (n) {\n return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n])\n};\n\nStepMap.empty = new StepMap([]);\n\n// :: class extends Mappable\n// A mapping represents a pipeline of zero or more [step\n// maps](#transform.StepMap). It has special provisions for losslessly\n// handling mapping positions through a series of steps in which some\n// steps are inverted versions of earlier steps. (This comes up when\n// ‘[rebasing](/docs/guide/#transform.rebasing)’ steps for\n// collaboration or history management.)\nvar Mapping = function Mapping(maps, mirror, from, to) {\n // :: [StepMap]\n // The step maps in this mapping.\n this.maps = maps || [];\n // :: number\n // The starting position in the `maps` array, used when `map` or\n // `mapResult` is called.\n this.from = from || 0;\n // :: number\n // The end position in the `maps` array.\n this.to = to == null ? this.maps.length : to;\n this.mirror = mirror;\n};\n\n// :: (?number, ?number) → Mapping\n// Create a mapping that maps only through a part of this one.\nMapping.prototype.slice = function slice (from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.maps.length;\n\n return new Mapping(this.maps, this.mirror, from, to)\n};\n\nMapping.prototype.copy = function copy () {\n return new Mapping(this.maps.slice(), this.mirror && this.mirror.slice(), this.from, this.to)\n};\n\n// :: (StepMap, ?number)\n// Add a step map to the end of this mapping. If `mirrors` is\n// given, it should be the index of the step map that is the mirror\n// image of this one.\nMapping.prototype.appendMap = function appendMap (map, mirrors) {\n this.to = this.maps.push(map);\n if (mirrors != null) { this.setMirror(this.maps.length - 1, mirrors); }\n};\n\n// :: (Mapping)\n// Add all the step maps in a given mapping to this one (preserving\n// mirroring information).\nMapping.prototype.appendMapping = function appendMapping (mapping) {\n for (var i = 0, startSize = this.maps.length; i < mapping.maps.length; i++) {\n var mirr = mapping.getMirror(i);\n this.appendMap(mapping.maps[i], mirr != null && mirr < i ? startSize + mirr : null);\n }\n};\n\n// :: (number) → ?number\n// Finds the offset of the step map that mirrors the map at the\n// given offset, in this mapping (as per the second argument to\n// `appendMap`).\nMapping.prototype.getMirror = function getMirror (n) {\n if (this.mirror) { for (var i = 0; i < this.mirror.length; i++)\n { if (this.mirror[i] == n) { return this.mirror[i + (i % 2 ? -1 : 1)] } } }\n};\n\nMapping.prototype.setMirror = function setMirror (n, m) {\n if (!this.mirror) { this.mirror = []; }\n this.mirror.push(n, m);\n};\n\n// :: (Mapping)\n// Append the inverse of the given mapping to this one.\nMapping.prototype.appendMappingInverted = function appendMappingInverted (mapping) {\n for (var i = mapping.maps.length - 1, totalSize = this.maps.length + mapping.maps.length; i >= 0; i--) {\n var mirr = mapping.getMirror(i);\n this.appendMap(mapping.maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : null);\n }\n};\n\n// :: () → Mapping\n// Create an inverted version of this mapping.\nMapping.prototype.invert = function invert () {\n var inverse = new Mapping;\n inverse.appendMappingInverted(this);\n return inverse\n};\n\n// : (number, ?number) → number\n// Map a position through this mapping.\nMapping.prototype.map = function map (pos, assoc) {\n if ( assoc === void 0 ) assoc = 1;\n\n if (this.mirror) { return this._map(pos, assoc, true) }\n for (var i = this.from; i < this.to; i++)\n { pos = this.maps[i].map(pos, assoc); }\n return pos\n};\n\n// : (number, ?number) → MapResult\n// Map a position through this mapping, returning a mapping\n// result.\nMapping.prototype.mapResult = function mapResult (pos, assoc) {\n if ( assoc === void 0 ) assoc = 1;\n return this._map(pos, assoc, false) };\n\nMapping.prototype._map = function _map (pos, assoc, simple) {\n var deleted = false, recoverables = null;\n\n for (var i = this.from; i < this.to; i++) {\n var map = this.maps[i], rec = recoverables && recoverables[i];\n if (rec != null && map.touches(pos, rec)) {\n pos = map.recover(rec);\n continue\n }\n\n var result = map.mapResult(pos, assoc);\n if (result.recover != null) {\n var corr = this.getMirror(i);\n if (corr != null && corr > i && corr < this.to) {\n if (result.deleted) {\n i = corr;\n pos = this.maps[corr].recover(result.recover);\n continue\n } else {\n(recoverables || (recoverables = Object.create(null)))[corr] = result.recover;\n }\n }\n }\n\n if (result.deleted) { deleted = true; }\n pos = result.pos;\n }\n\n return simple ? pos : new MapResult(pos, deleted)\n};\n\nfunction TransformError(message) {\n var err = Error.call(this, message);\n err.__proto__ = TransformError.prototype;\n return err\n}\n\nTransformError.prototype = Object.create(Error.prototype);\nTransformError.prototype.constructor = TransformError;\nTransformError.prototype.name = \"TransformError\";\n\n// ::- Abstraction to build up and track an array of\n// [steps](#transform.Step) representing a document transformation.\n//\n// Most transforming methods return the `Transform` object itself, so\n// that they can be chained.\nvar Transform = function Transform(doc) {\n // :: Node\n // The current document (the result of applying the steps in the\n // transform).\n this.doc = doc;\n // :: [Step]\n // The steps in this transform.\n this.steps = [];\n // :: [Node]\n // The documents before each of the steps.\n this.docs = [];\n // :: Mapping\n // A mapping with the maps for each of the steps in this transform.\n this.mapping = new Mapping;\n};\n\nvar prototypeAccessors = { before: { configurable: true },docChanged: { configurable: true } };\n\n// :: Node The starting document.\nprototypeAccessors.before.get = function () { return this.docs.length ? this.docs[0] : this.doc };\n\n// :: (step: Step) → this\n// Apply a new step in this transform, saving the result. Throws an\n// error when the step fails.\nTransform.prototype.step = function step (object) {\n var result = this.maybeStep(object);\n if (result.failed) { throw new TransformError(result.failed) }\n return this\n};\n\n// :: (Step) → StepResult\n// Try to apply a step in this transformation, ignoring it if it\n// fails. Returns the step result.\nTransform.prototype.maybeStep = function maybeStep (step) {\n var result = step.apply(this.doc);\n if (!result.failed) { this.addStep(step, result.doc); }\n return result\n};\n\n// :: bool\n// True when the document has been changed (when there are any\n// steps).\nprototypeAccessors.docChanged.get = function () {\n return this.steps.length > 0\n};\n\nTransform.prototype.addStep = function addStep (step, doc) {\n this.docs.push(this.doc);\n this.steps.push(step);\n this.mapping.appendMap(step.getMap());\n this.doc = doc;\n};\n\nObject.defineProperties( Transform.prototype, prototypeAccessors );\n\nfunction mustOverride() { throw new Error(\"Override me\") }\n\nvar stepsByID = Object.create(null);\n\n// ::- A step object represents an atomic change. It generally applies\n// only to the document it was created for, since the positions\n// stored in it will only make sense for that document.\n//\n// New steps are defined by creating classes that extend `Step`,\n// overriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`\n// methods, and registering your class with a unique\n// JSON-serialization identifier using\n// [`Step.jsonID`](#transform.Step^jsonID).\nvar Step = function Step () {};\n\nStep.prototype.apply = function apply (_doc) { return mustOverride() };\n\n// :: () → StepMap\n// Get the step map that represents the changes made by this step,\n// and which can be used to transform between positions in the old\n// and the new document.\nStep.prototype.getMap = function getMap () { return StepMap.empty };\n\n// :: (doc: Node) → Step\n// Create an inverted version of this step. Needs the document as it\n// was before the step as argument.\nStep.prototype.invert = function invert (_doc) { return mustOverride() };\n\n// :: (mapping: Mappable) → ?Step\n// Map this step through a mappable thing, returning either a\n// version of that step with its positions adjusted, or `null` if\n// the step was entirely deleted by the mapping.\nStep.prototype.map = function map (_mapping) { return mustOverride() };\n\n// :: (other: Step) → ?Step\n// Try to merge this step with another one, to be applied directly\n// after it. Returns the merged step when possible, null if the\n// steps can't be merged.\nStep.prototype.merge = function merge (_other) { return null };\n\n// :: () → Object\n// Create a JSON-serializeable representation of this step. When\n// defining this for a custom subclass, make sure the result object\n// includes the step type's [JSON id](#transform.Step^jsonID) under\n// the `stepType` property.\nStep.prototype.toJSON = function toJSON () { return mustOverride() };\n\n// :: (Schema, Object) → Step\n// Deserialize a step from its JSON representation. Will call\n// through to the step class' own implementation of this method.\nStep.fromJSON = function fromJSON (schema, json) {\n if (!json || !json.stepType) { throw new RangeError(\"Invalid input for Step.fromJSON\") }\n var type = stepsByID[json.stepType];\n if (!type) { throw new RangeError((\"No step type \" + (json.stepType) + \" defined\")) }\n return type.fromJSON(schema, json)\n};\n\n// :: (string, constructor<Step>)\n// To be able to serialize steps to JSON, each step needs a string\n// ID to attach to its JSON representation. Use this method to\n// register an ID for your step classes. Try to pick something\n// that's unlikely to clash with steps from other modules.\nStep.jsonID = function jsonID (id, stepClass) {\n if (id in stepsByID) { throw new RangeError(\"Duplicate use of step JSON ID \" + id) }\n stepsByID[id] = stepClass;\n stepClass.prototype.jsonID = id;\n return stepClass\n};\n\n// ::- The result of [applying](#transform.Step.apply) a step. Contains either a\n// new document or a failure value.\nvar StepResult = function StepResult(doc, failed) {\n // :: ?Node The transformed document.\n this.doc = doc;\n // :: ?string Text providing information about a failed step.\n this.failed = failed;\n};\n\n// :: (Node) → StepResult\n// Create a successful step result.\nStepResult.ok = function ok (doc) { return new StepResult(doc, null) };\n\n// :: (string) → StepResult\n// Create a failed step result.\nStepResult.fail = function fail (message) { return new StepResult(null, message) };\n\n// :: (Node, number, number, Slice) → StepResult\n// Call [`Node.replace`](#model.Node.replace) with the given\n// arguments. Create a successful result if it succeeds, and a\n// failed one if it throws a `ReplaceError`.\nStepResult.fromReplace = function fromReplace (doc, from, to, slice) {\n try {\n return StepResult.ok(doc.replace(from, to, slice))\n } catch (e) {\n if (e instanceof ReplaceError) { return StepResult.fail(e.message) }\n throw e\n }\n};\n\n// ::- Replace a part of the document with a slice of new content.\nvar ReplaceStep = /*@__PURE__*/(function (Step) {\n function ReplaceStep(from, to, slice, structure) {\n Step.call(this);\n this.from = from;\n this.to = to;\n this.slice = slice;\n this.structure = !!structure;\n }\n\n if ( Step ) ReplaceStep.__proto__ = Step;\n ReplaceStep.prototype = Object.create( Step && Step.prototype );\n ReplaceStep.prototype.constructor = ReplaceStep;\n\n ReplaceStep.prototype.apply = function apply (doc) {\n if (this.structure && contentBetween(doc, this.from, this.to))\n { return StepResult.fail(\"Structure replace would overwrite content\") }\n return StepResult.fromReplace(doc, this.from, this.to, this.slice)\n };\n\n ReplaceStep.prototype.getMap = function getMap () {\n return new StepMap([this.from, this.to - this.from, this.slice.size])\n };\n\n ReplaceStep.prototype.invert = function invert (doc) {\n return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to))\n };\n\n ReplaceStep.prototype.map = function map (mapping) {\n var from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted) { return null }\n return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice)\n };\n\n ReplaceStep.prototype.merge = function merge (other) {\n if (!(other instanceof ReplaceStep) || other.structure != this.structure) { return null }\n\n if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {\n var slice = this.slice.size + other.slice.size == 0 ? Slice.empty\n : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);\n return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure)\n } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {\n var slice$1 = this.slice.size + other.slice.size == 0 ? Slice.empty\n : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);\n return new ReplaceStep(other.from, this.to, slice$1, this.structure)\n } else {\n return null\n }\n };\n\n ReplaceStep.prototype.toJSON = function toJSON () {\n var json = {stepType: \"replace\", from: this.from, to: this.to};\n if (this.slice.size) { json.slice = this.slice.toJSON(); }\n if (this.structure) { json.structure = true; }\n return json\n };\n\n ReplaceStep.fromJSON = function fromJSON (schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n { throw new RangeError(\"Invalid input for ReplaceStep.fromJSON\") }\n return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure)\n };\n\n return ReplaceStep;\n}(Step));\n\nStep.jsonID(\"replace\", ReplaceStep);\n\n// ::- Replace a part of the document with a slice of content, but\n// preserve a range of the replaced content by moving it into the\n// slice.\nvar ReplaceAroundStep = /*@__PURE__*/(function (Step) {\n function ReplaceAroundStep(from, to, gapFrom, gapTo, slice, insert, structure) {\n Step.call(this);\n this.from = from;\n this.to = to;\n this.gapFrom = gapFrom;\n this.gapTo = gapTo;\n this.slice = slice;\n this.insert = insert;\n this.structure = !!structure;\n }\n\n if ( Step ) ReplaceAroundStep.__proto__ = Step;\n ReplaceAroundStep.prototype = Object.create( Step && Step.prototype );\n ReplaceAroundStep.prototype.constructor = ReplaceAroundStep;\n\n ReplaceAroundStep.prototype.apply = function apply (doc) {\n if (this.structure && (contentBetween(doc, this.from, this.gapFrom) ||\n contentBetween(doc, this.gapTo, this.to)))\n { return StepResult.fail(\"Structure gap-replace would overwrite content\") }\n\n var gap = doc.slice(this.gapFrom, this.gapTo);\n if (gap.openStart || gap.openEnd)\n { return StepResult.fail(\"Gap is not a flat range\") }\n var inserted = this.slice.insertAt(this.insert, gap.content);\n if (!inserted) { return StepResult.fail(\"Content does not fit in gap\") }\n return StepResult.fromReplace(doc, this.from, this.to, inserted)\n };\n\n ReplaceAroundStep.prototype.getMap = function getMap () {\n return new StepMap([this.from, this.gapFrom - this.from, this.insert,\n this.gapTo, this.to - this.gapTo, this.slice.size - this.insert])\n };\n\n ReplaceAroundStep.prototype.invert = function invert (doc) {\n var gap = this.gapTo - this.gapFrom;\n return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap,\n this.from + this.insert, this.from + this.insert + gap,\n doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from),\n this.gapFrom - this.from, this.structure)\n };\n\n ReplaceAroundStep.prototype.map = function map (mapping) {\n var from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n var gapFrom = mapping.map(this.gapFrom, -1), gapTo = mapping.map(this.gapTo, 1);\n if ((from.deleted && to.deleted) || gapFrom < from.pos || gapTo > to.pos) { return null }\n return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure)\n };\n\n ReplaceAroundStep.prototype.toJSON = function toJSON () {\n var json = {stepType: \"replaceAround\", from: this.from, to: this.to,\n gapFrom: this.gapFrom, gapTo: this.gapTo, insert: this.insert};\n if (this.slice.size) { json.slice = this.slice.toJSON(); }\n if (this.structure) { json.structure = true; }\n return json\n };\n\n ReplaceAroundStep.fromJSON = function fromJSON (schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\" ||\n typeof json.gapFrom != \"number\" || typeof json.gapTo != \"number\" || typeof json.insert != \"number\")\n { throw new RangeError(\"Invalid input for ReplaceAroundStep.fromJSON\") }\n return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo,\n Slice.fromJSON(schema, json.slice), json.insert, !!json.structure)\n };\n\n return ReplaceAroundStep;\n}(Step));\n\nStep.jsonID(\"replaceAround\", ReplaceAroundStep);\n\nfunction contentBetween(doc, from, to) {\n var $from = doc.resolve(from), dist = to - from, depth = $from.depth;\n while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {\n depth--;\n dist--;\n }\n if (dist > 0) {\n var next = $from.node(depth).maybeChild($from.indexAfter(depth));\n while (dist > 0) {\n if (!next || next.isLeaf) { return true }\n next = next.firstChild;\n dist--;\n }\n }\n return false\n}\n\nfunction canCut(node, start, end) {\n return (start == 0 || node.canReplace(start, node.childCount)) &&\n (end == node.childCount || node.canReplace(0, end))\n}\n\n// :: (NodeRange) → ?number\n// Try to find a target depth to which the content in the given range\n// can be lifted. Will not go across\n// [isolating](#model.NodeSpec.isolating) parent nodes.\nfunction liftTarget(range) {\n var parent = range.parent;\n var content = parent.content.cutByIndex(range.startIndex, range.endIndex);\n for (var depth = range.depth;; --depth) {\n var node = range.$from.node(depth);\n var index = range.$from.index(depth), endIndex = range.$to.indexAfter(depth);\n if (depth < range.depth && node.canReplace(index, endIndex, content))\n { return depth }\n if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex)) { break }\n }\n}\n\n// :: (NodeRange, number) → this\n// Split the content in the given range off from its parent, if there\n// is sibling content before or after it, and move it up the tree to\n// the depth specified by `target`. You'll probably want to use\n// [`liftTarget`](#transform.liftTarget) to compute `target`, to make\n// sure the lift is valid.\nTransform.prototype.lift = function(range, target) {\n var $from = range.$from;\n var $to = range.$to;\n var depth = range.depth;\n\n var gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);\n var start = gapStart, end = gapEnd;\n\n var before = Fragment.empty, openStart = 0;\n for (var d = depth, splitting = false; d > target; d--)\n { if (splitting || $from.index(d) > 0) {\n splitting = true;\n before = Fragment.from($from.node(d).copy(before));\n openStart++;\n } else {\n start--;\n } }\n var after = Fragment.empty, openEnd = 0;\n for (var d$1 = depth, splitting$1 = false; d$1 > target; d$1--)\n { if (splitting$1 || $to.after(d$1 + 1) < $to.end(d$1)) {\n splitting$1 = true;\n after = Fragment.from($to.node(d$1).copy(after));\n openEnd++;\n } else {\n end++;\n } }\n\n return this.step(new ReplaceAroundStep(start, end, gapStart, gapEnd,\n new Slice(before.append(after), openStart, openEnd),\n before.size - openStart, true))\n};\n\n// :: (NodeRange, NodeType, ?Object, ?NodeRange) → ?[{type: NodeType, attrs: ?Object}]\n// Try to find a valid way to wrap the content in the given range in a\n// node of the given type. May introduce extra nodes around and inside\n// the wrapper node, if necessary. Returns null if no valid wrapping\n// could be found. When `innerRange` is given, that range's content is\n// used as the content to fit into the wrapping, instead of the\n// content of `range`.\nfunction findWrapping(range, nodeType, attrs, innerRange) {\n if ( innerRange === void 0 ) innerRange = range;\n\n var around = findWrappingOutside(range, nodeType);\n var inner = around && findWrappingInside(innerRange, nodeType);\n if (!inner) { return null }\n return around.map(withAttrs).concat({type: nodeType, attrs: attrs}).concat(inner.map(withAttrs))\n}\n\nfunction withAttrs(type) { return {type: type, attrs: null} }\n\nfunction findWrappingOutside(range, type) {\n var parent = range.parent;\n var startIndex = range.startIndex;\n var endIndex = range.endIndex;\n var around = parent.contentMatchAt(startIndex).findWrapping(type);\n if (!around) { return null }\n var outer = around.length ? around[0] : type;\n return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null\n}\n\nfunction findWrappingInside(range, type) {\n var parent = range.parent;\n var startIndex = range.startIndex;\n var endIndex = range.endIndex;\n var inner = parent.child(startIndex);\n var inside = type.contentMatch.findWrapping(inner.type);\n if (!inside) { return null }\n var lastType = inside.length ? inside[inside.length - 1] : type;\n var innerMatch = lastType.contentMatch;\n for (var i = startIndex; innerMatch && i < endIndex; i++)\n { innerMatch = innerMatch.matchType(parent.child(i).type); }\n if (!innerMatch || !innerMatch.validEnd) { return null }\n return inside\n}\n\n// :: (NodeRange, [{type: NodeType, attrs: ?Object}]) → this\n// Wrap the given [range](#model.NodeRange) in the given set of wrappers.\n// The wrappers are assumed to be valid in this position, and should\n// probably be computed with [`findWrapping`](#transform.findWrapping).\nTransform.prototype.wrap = function(range, wrappers) {\n var content = Fragment.empty;\n for (var i = wrappers.length - 1; i >= 0; i--)\n { content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content)); }\n\n var start = range.start, end = range.end;\n return this.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true))\n};\n\n// :: (number, ?number, NodeType, ?Object) → this\n// Set the type of all textblocks (partly) between `from` and `to` to\n// the given node type with the given attributes.\nTransform.prototype.setBlockType = function(from, to, type, attrs) {\n var this$1 = this;\n if ( to === void 0 ) to = from;\n\n if (!type.isTextblock) { throw new RangeError(\"Type given to setBlockType should be a textblock\") }\n var mapFrom = this.steps.length;\n this.doc.nodesBetween(from, to, function (node, pos) {\n if (node.isTextblock && !node.hasMarkup(type, attrs) && canChangeType(this$1.doc, this$1.mapping.slice(mapFrom).map(pos), type)) {\n // Ensure all markup that isn't allowed in the new node type is cleared\n this$1.clearIncompatible(this$1.mapping.slice(mapFrom).map(pos, 1), type);\n var mapping = this$1.mapping.slice(mapFrom);\n var startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);\n this$1.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1,\n new Slice(Fragment.from(type.create(attrs, null, node.marks)), 0, 0), 1, true));\n return false\n }\n });\n return this\n};\n\nfunction canChangeType(doc, pos, type) {\n var $pos = doc.resolve(pos), index = $pos.index();\n return $pos.parent.canReplaceWith(index, index + 1, type)\n}\n\n// :: (number, ?NodeType, ?Object, ?[Mark]) → this\n// Change the type, attributes, and/or marks of the node at `pos`.\n// When `type` isn't given, the existing node type is preserved,\nTransform.prototype.setNodeMarkup = function(pos, type, attrs, marks) {\n var node = this.doc.nodeAt(pos);\n if (!node) { throw new RangeError(\"No node at given position\") }\n if (!type) { type = node.type; }\n var newNode = type.create(attrs, null, marks || node.marks);\n if (node.isLeaf)\n { return this.replaceWith(pos, pos + node.nodeSize, newNode) }\n\n if (!type.validContent(node.content))\n { throw new RangeError(\"Invalid content for node type \" + type.name) }\n\n return this.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1,\n new Slice(Fragment.from(newNode), 0, 0), 1, true))\n};\n\n// :: (Node, number, number, ?[?{type: NodeType, attrs: ?Object}]) → bool\n// Check whether splitting at the given position is allowed.\nfunction canSplit(doc, pos, depth, typesAfter) {\n if ( depth === void 0 ) depth = 1;\n\n var $pos = doc.resolve(pos), base = $pos.depth - depth;\n var innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating ||\n !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) ||\n !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))\n { return false }\n for (var d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n var node = $pos.node(d), index$1 = $pos.index(d);\n if (node.type.spec.isolating) { return false }\n var rest = node.content.cutByIndex(index$1, node.childCount);\n var after = (typesAfter && typesAfter[i]) || node;\n if (after != node) { rest = rest.replaceChild(0, after.type.create(after.attrs)); }\n if (!node.canReplace(index$1 + 1, node.childCount) || !after.type.validContent(rest))\n { return false }\n }\n var index = $pos.indexAfter(base);\n var baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type)\n}\n\n// :: (number, ?number, ?[?{type: NodeType, attrs: ?Object}]) → this\n// Split the node at the given position, and optionally, if `depth` is\n// greater than one, any number of nodes above that. By default, the\n// parts split off will inherit the node type of the original node.\n// This can be changed by passing an array of types and attributes to\n// use after the split.\nTransform.prototype.split = function(pos, depth, typesAfter) {\n if ( depth === void 0 ) depth = 1;\n\n var $pos = this.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty;\n for (var d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {\n before = Fragment.from($pos.node(d).copy(before));\n var typeAfter = typesAfter && typesAfter[i];\n after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));\n }\n return this.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true))\n};\n\n// :: (Node, number) → bool\n// Test whether the blocks before and after a given position can be\n// joined.\nfunction canJoin(doc, pos) {\n var $pos = doc.resolve(pos), index = $pos.index();\n return joinable($pos.nodeBefore, $pos.nodeAfter) &&\n $pos.parent.canReplace(index, index + 1)\n}\n\nfunction joinable(a, b) {\n return a && b && !a.isLeaf && a.canAppend(b)\n}\n\n// :: (Node, number, ?number) → ?number\n// Find an ancestor of the given position that can be joined to the\n// block before (or after if `dir` is positive). Returns the joinable\n// point, if any.\nfunction joinPoint(doc, pos, dir) {\n if ( dir === void 0 ) dir = -1;\n\n var $pos = doc.resolve(pos);\n for (var d = $pos.depth;; d--) {\n var before = (void 0), after = (void 0), index = $pos.index(d);\n if (d == $pos.depth) {\n before = $pos.nodeBefore;\n after = $pos.nodeAfter;\n } else if (dir > 0) {\n before = $pos.node(d + 1);\n index++;\n after = $pos.node(d).maybeChild(index);\n } else {\n before = $pos.node(d).maybeChild(index - 1);\n after = $pos.node(d + 1);\n }\n if (before && !before.isTextblock && joinable(before, after) &&\n $pos.node(d).canReplace(index, index + 1)) { return pos }\n if (d == 0) { break }\n pos = dir < 0 ? $pos.before(d) : $pos.after(d);\n }\n}\n\n// :: (number, ?number) → this\n// Join the blocks around the given position. If depth is 2, their\n// last and first siblings are also joined, and so on.\nTransform.prototype.join = function(pos, depth) {\n if ( depth === void 0 ) depth = 1;\n\n var step = new ReplaceStep(pos - depth, pos + depth, Slice.empty, true);\n return this.step(step)\n};\n\n// :: (Node, number, NodeType) → ?number\n// Try to find a point where a node of the given type can be inserted\n// near `pos`, by searching up the node hierarchy when `pos` itself\n// isn't a valid place but is at the start or end of a node. Return\n// null if no position was found.\nfunction insertPoint(doc, pos, nodeType) {\n var $pos = doc.resolve(pos);\n if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) { return pos }\n\n if ($pos.parentOffset == 0)\n { for (var d = $pos.depth - 1; d >= 0; d--) {\n var index = $pos.index(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType)) { return $pos.before(d + 1) }\n if (index > 0) { return null }\n } }\n if ($pos.parentOffset == $pos.parent.content.size)\n { for (var d$1 = $pos.depth - 1; d$1 >= 0; d$1--) {\n var index$1 = $pos.indexAfter(d$1);\n if ($pos.node(d$1).canReplaceWith(index$1, index$1, nodeType)) { return $pos.after(d$1 + 1) }\n if (index$1 < $pos.node(d$1).childCount) { return null }\n } }\n}\n\n// :: (Node, number, Slice) → ?number\n// Finds a position at or around the given position where the given\n// slice can be inserted. Will look at parent nodes' nearest boundary\n// and try there, even if the original position wasn't directly at the\n// start or end of that node. Returns null when no position was found.\nfunction dropPoint(doc, pos, slice) {\n var $pos = doc.resolve(pos);\n if (!slice.content.size) { return pos }\n var content = slice.content;\n for (var i = 0; i < slice.openStart; i++) { content = content.firstChild.content; }\n for (var pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {\n for (var d = $pos.depth; d >= 0; d--) {\n var bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;\n var insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);\n if (pass == 1\n ? $pos.node(d).canReplace(insertPos, insertPos, content)\n : $pos.node(d).contentMatchAt(insertPos).findWrapping(content.firstChild.type))\n { return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1) }\n }\n }\n return null\n}\n\nfunction mapFragment(fragment, f, parent) {\n var mapped = [];\n for (var i = 0; i < fragment.childCount; i++) {\n var child = fragment.child(i);\n if (child.content.size) { child = child.copy(mapFragment(child.content, f, child)); }\n if (child.isInline) { child = f(child, parent, i); }\n mapped.push(child);\n }\n return Fragment.fromArray(mapped)\n}\n\n// ::- Add a mark to all inline content between two positions.\nvar AddMarkStep = /*@__PURE__*/(function (Step) {\n function AddMarkStep(from, to, mark) {\n Step.call(this);\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n\n if ( Step ) AddMarkStep.__proto__ = Step;\n AddMarkStep.prototype = Object.create( Step && Step.prototype );\n AddMarkStep.prototype.constructor = AddMarkStep;\n\n AddMarkStep.prototype.apply = function apply (doc) {\n var this$1 = this;\n\n var oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);\n var parent = $from.node($from.sharedDepth(this.to));\n var slice = new Slice(mapFragment(oldSlice.content, function (node, parent) {\n if (!parent.type.allowsMarkType(this$1.mark.type)) { return node }\n return node.mark(this$1.mark.addToSet(node.marks))\n }, parent), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice)\n };\n\n AddMarkStep.prototype.invert = function invert () {\n return new RemoveMarkStep(this.from, this.to, this.mark)\n };\n\n AddMarkStep.prototype.map = function map (mapping) {\n var from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos) { return null }\n return new AddMarkStep(from.pos, to.pos, this.mark)\n };\n\n AddMarkStep.prototype.merge = function merge (other) {\n if (other instanceof AddMarkStep &&\n other.mark.eq(this.mark) &&\n this.from <= other.to && this.to >= other.from)\n { return new AddMarkStep(Math.min(this.from, other.from),\n Math.max(this.to, other.to), this.mark) }\n };\n\n AddMarkStep.prototype.toJSON = function toJSON () {\n return {stepType: \"addMark\", mark: this.mark.toJSON(),\n from: this.from, to: this.to}\n };\n\n AddMarkStep.fromJSON = function fromJSON (schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n { throw new RangeError(\"Invalid input for AddMarkStep.fromJSON\") }\n return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark))\n };\n\n return AddMarkStep;\n}(Step));\n\nStep.jsonID(\"addMark\", AddMarkStep);\n\n// ::- Remove a mark from all inline content between two positions.\nvar RemoveMarkStep = /*@__PURE__*/(function (Step) {\n function RemoveMarkStep(from, to, mark) {\n Step.call(this);\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n\n if ( Step ) RemoveMarkStep.__proto__ = Step;\n RemoveMarkStep.prototype = Object.create( Step && Step.prototype );\n RemoveMarkStep.prototype.constructor = RemoveMarkStep;\n\n RemoveMarkStep.prototype.apply = function apply (doc) {\n var this$1 = this;\n\n var oldSlice = doc.slice(this.from, this.to);\n var slice = new Slice(mapFragment(oldSlice.content, function (node) {\n return node.mark(this$1.mark.removeFromSet(node.marks))\n }), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice)\n };\n\n RemoveMarkStep.prototype.invert = function invert () {\n return new AddMarkStep(this.from, this.to, this.mark)\n };\n\n RemoveMarkStep.prototype.map = function map (mapping) {\n var from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos) { return null }\n return new RemoveMarkStep(from.pos, to.pos, this.mark)\n };\n\n RemoveMarkStep.prototype.merge = function merge (other) {\n if (other instanceof RemoveMarkStep &&\n other.mark.eq(this.mark) &&\n this.from <= other.to && this.to >= other.from)\n { return new RemoveMarkStep(Math.min(this.from, other.from),\n Math.max(this.to, other.to), this.mark) }\n };\n\n RemoveMarkStep.prototype.toJSON = function toJSON () {\n return {stepType: \"removeMark\", mark: this.mark.toJSON(),\n from: this.from, to: this.to}\n };\n\n RemoveMarkStep.fromJSON = function fromJSON (schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\")\n { throw new RangeError(\"Invalid input for RemoveMarkStep.fromJSON\") }\n return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark))\n };\n\n return RemoveMarkStep;\n}(Step));\n\nStep.jsonID(\"removeMark\", RemoveMarkStep);\n\n// :: (number, number, Mark) → this\n// Add the given mark to the inline content between `from` and `to`.\nTransform.prototype.addMark = function(from, to, mark) {\n var this$1 = this;\n\n var removed = [], added = [], removing = null, adding = null;\n this.doc.nodesBetween(from, to, function (node, pos, parent) {\n if (!node.isInline) { return }\n var marks = node.marks;\n if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {\n var start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);\n var newSet = mark.addToSet(marks);\n\n for (var i = 0; i < marks.length; i++) {\n if (!marks[i].isInSet(newSet)) {\n if (removing && removing.to == start && removing.mark.eq(marks[i]))\n { removing.to = end; }\n else\n { removed.push(removing = new RemoveMarkStep(start, end, marks[i])); }\n }\n }\n\n if (adding && adding.to == start)\n { adding.to = end; }\n else\n { added.push(adding = new AddMarkStep(start, end, mark)); }\n }\n });\n\n removed.forEach(function (s) { return this$1.step(s); });\n added.forEach(function (s) { return this$1.step(s); });\n return this\n};\n\n// :: (number, number, ?union<Mark, MarkType>) → this\n// Remove marks from inline nodes between `from` and `to`. When `mark`\n// is a single mark, remove precisely that mark. When it is a mark type,\n// remove all marks of that type. When it is null, remove all marks of\n// any type.\nTransform.prototype.removeMark = function(from, to, mark) {\n var this$1 = this;\n if ( mark === void 0 ) mark = null;\n\n var matched = [], step = 0;\n this.doc.nodesBetween(from, to, function (node, pos) {\n if (!node.isInline) { return }\n step++;\n var toRemove = null;\n if (mark instanceof MarkType) {\n var found = mark.isInSet(node.marks);\n if (found) { toRemove = [found]; }\n } else if (mark) {\n if (mark.isInSet(node.marks)) { toRemove = [mark]; }\n } else {\n toRemove = node.marks;\n }\n if (toRemove && toRemove.length) {\n var end = Math.min(pos + node.nodeSize, to);\n for (var i = 0; i < toRemove.length; i++) {\n var style = toRemove[i], found$1 = (void 0);\n for (var j = 0; j < matched.length; j++) {\n var m = matched[j];\n if (m.step == step - 1 && style.eq(matched[j].style)) { found$1 = m; }\n }\n if (found$1) {\n found$1.to = end;\n found$1.step = step;\n } else {\n matched.push({style: style, from: Math.max(pos, from), to: end, step: step});\n }\n }\n }\n });\n matched.forEach(function (m) { return this$1.step(new RemoveMarkStep(m.from, m.to, m.style)); });\n return this\n};\n\n// :: (number, NodeType, ?ContentMatch) → this\n// Removes all marks and nodes from the content of the node at `pos`\n// that don't match the given new parent node type. Accepts an\n// optional starting [content match](#model.ContentMatch) as third\n// argument.\nTransform.prototype.clearIncompatible = function(pos, parentType, match) {\n if ( match === void 0 ) match = parentType.contentMatch;\n\n var node = this.doc.nodeAt(pos);\n var delSteps = [], cur = pos + 1;\n for (var i = 0; i < node.childCount; i++) {\n var child = node.child(i), end = cur + child.nodeSize;\n var allowed = match.matchType(child.type, child.attrs);\n if (!allowed) {\n delSteps.push(new ReplaceStep(cur, end, Slice.empty));\n } else {\n match = allowed;\n for (var j = 0; j < child.marks.length; j++) { if (!parentType.allowsMarkType(child.marks[j].type))\n { this.step(new RemoveMarkStep(cur, end, child.marks[j])); } }\n }\n cur = end;\n }\n if (!match.validEnd) {\n var fill = match.fillBefore(Fragment.empty, true);\n this.replace(cur, cur, new Slice(fill, 0, 0));\n }\n for (var i$1 = delSteps.length - 1; i$1 >= 0; i$1--) { this.step(delSteps[i$1]); }\n return this\n};\n\n// :: (Node, number, ?number, ?Slice) → ?Step\n// ‘Fit’ a slice into a given position in the document, producing a\n// [step](#transform.Step) that inserts it. Will return null if\n// there's no meaningful way to insert the slice here, or inserting it\n// would be a no-op (an empty slice over an empty range).\nfunction replaceStep(doc, from, to, slice) {\n if ( to === void 0 ) to = from;\n if ( slice === void 0 ) slice = Slice.empty;\n\n if (from == to && !slice.size) { return null }\n\n var $from = doc.resolve(from), $to = doc.resolve(to);\n // Optimization -- avoid work if it's obvious that it's not needed.\n if (fitsTrivially($from, $to, slice)) { return new ReplaceStep(from, to, slice) }\n return new Fitter($from, $to, slice).fit()\n}\n\n// :: (number, ?number, ?Slice) → this\n// Replace the part of the document between `from` and `to` with the\n// given `slice`.\nTransform.prototype.replace = function(from, to, slice) {\n if ( to === void 0 ) to = from;\n if ( slice === void 0 ) slice = Slice.empty;\n\n var step = replaceStep(this.doc, from, to, slice);\n if (step) { this.step(step); }\n return this\n};\n\n// :: (number, number, union<Fragment, Node, [Node]>) → this\n// Replace the given range with the given content, which may be a\n// fragment, node, or array of nodes.\nTransform.prototype.replaceWith = function(from, to, content) {\n return this.replace(from, to, new Slice(Fragment.from(content), 0, 0))\n};\n\n// :: (number, number) → this\n// Delete the content between the given positions.\nTransform.prototype.delete = function(from, to) {\n return this.replace(from, to, Slice.empty)\n};\n\n// :: (number, union<Fragment, Node, [Node]>) → this\n// Insert the given content at the given position.\nTransform.prototype.insert = function(pos, content) {\n return this.replaceWith(pos, pos, content)\n};\n\nfunction fitsTrivially($from, $to, slice) {\n return !slice.openStart && !slice.openEnd && $from.start() == $to.start() &&\n $from.parent.canReplace($from.index(), $to.index(), slice.content)\n}\n\n// Algorithm for 'placing' the elements of a slice into a gap:\n//\n// We consider the content of each node that is open to the left to be\n// independently placeable. I.e. in <p(\"foo\"), p(\"bar\")>, when the\n// paragraph on the left is open, \"foo\" can be placed (somewhere on\n// the left side of the replacement gap) independently from p(\"bar\").\n//\n// This class tracks the state of the placement progress in the\n// following properties:\n//\n// - `frontier` holds a stack of `{type, match}` objects that\n// represent the open side of the replacement. It starts at\n// `$from`, then moves forward as content is placed, and is finally\n// reconciled with `$to`.\n//\n// - `unplaced` is a slice that represents the content that hasn't\n// been placed yet.\n//\n// - `placed` is a fragment of placed content. Its open-start value\n// is implicit in `$from`, and its open-end value in `frontier`.\nvar Fitter = function Fitter($from, $to, slice) {\n this.$to = $to;\n this.$from = $from;\n this.unplaced = slice;\n\n this.frontier = [];\n for (var i = 0; i <= $from.depth; i++) {\n var node = $from.node(i);\n this.frontier.push({\n type: node.type,\n match: node.contentMatchAt($from.indexAfter(i))\n });\n }\n\n this.placed = Fragment.empty;\n for (var i$1 = $from.depth; i$1 > 0; i$1--)\n { this.placed = Fragment.from($from.node(i$1).copy(this.placed)); }\n};\n\nvar prototypeAccessors$1 = { depth: { configurable: true } };\n\nprototypeAccessors$1.depth.get = function () { return this.frontier.length - 1 };\n\nFitter.prototype.fit = function fit () {\n // As long as there's unplaced content, try to place some of it.\n // If that fails, either increase the open score of the unplaced\n // slice, or drop nodes from it, and then try again.\n while (this.unplaced.size) {\n var fit = this.findFittable();\n if (fit) { this.placeNodes(fit); }\n else { this.openMore() || this.dropNode(); }\n }\n // When there's inline content directly after the frontier _and_\n // directly after `this.$to`, we must generate a `ReplaceAround`\n // step that pulls that content into the node after the frontier.\n // That means the fitting must be done to the end of the textblock\n // node after `this.$to`, not `this.$to` itself.\n var moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth;\n var $from = this.$from, $to = moveInline < 0 ? this.$to : $from.doc.resolve(moveInline);\n if (this.close($to)) { // If closing to `$to` succeeded, create a step\n var content = this.placed, openStart = $from.depth, openEnd = $to.depth;\n while (openStart && openEnd && content.childCount == 1) { // Normalize by dropping open parent nodes\n content = content.firstChild.content;\n openStart--; openEnd--;\n }\n var slice = new Slice(content, openStart, openEnd);\n if (moveInline > -1)\n { return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize) }\n if (slice.size || $from.pos != this.$to.pos) // Don't generate no-op steps\n { return new ReplaceStep($from.pos, $to.pos, slice) }\n }\n return null\n};\n\n// Find a position on the start spine of `this.unplaced` that has\n// content that can be moved somewhere on the frontier. Returns two\n// depths, one for the slice and one for the frontier.\nFitter.prototype.findFittable = function findFittable () {\n // Only try wrapping nodes (pass 2) after finding a place without\n // wrapping failed.\n for (var pass = 1; pass <= 2; pass++) {\n for (var sliceDepth = this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {\n var fragment = (void 0), parent = (void 0);\n if (sliceDepth) {\n parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;\n fragment = parent.content;\n } else {\n fragment = this.unplaced.content;\n }\n var first = fragment.firstChild;\n for (var frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {\n var ref = this.frontier[frontierDepth];\n var type = ref.type;\n var match = ref.match;\n var wrap = (void 0), inject = (void 0);\n // In pass 1, if the next node matches, or there is no next\n // node but the parents look compatible, we've found a\n // place.\n if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false))\n : type.compatibleContent(parent.type)))\n { return {sliceDepth: sliceDepth, frontierDepth: frontierDepth, parent: parent, inject: inject} }\n // In pass 2, look for a set of wrapping nodes that make\n // `first` fit here.\n else if (pass == 2 && first && (wrap = match.findWrapping(first.type)))\n { return {sliceDepth: sliceDepth, frontierDepth: frontierDepth, parent: parent, wrap: wrap} }\n // Don't continue looking further up if the parent node\n // would fit here.\n if (parent && match.matchType(parent.type)) { break }\n }\n }\n }\n};\n\nFitter.prototype.openMore = function openMore () {\n var ref = this.unplaced;\n var content = ref.content;\n var openStart = ref.openStart;\n var openEnd = ref.openEnd;\n var inner = contentAt(content, openStart);\n if (!inner.childCount || inner.firstChild.isLeaf) { return false }\n this.unplaced = new Slice(content, openStart + 1,\n Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));\n return true\n};\n\nFitter.prototype.dropNode = function dropNode () {\n var ref = this.unplaced;\n var content = ref.content;\n var openStart = ref.openStart;\n var openEnd = ref.openEnd;\n var inner = contentAt(content, openStart);\n if (inner.childCount <= 1 && openStart > 0) {\n var openAtEnd = content.size - openStart <= openStart + inner.size;\n this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1,\n openAtEnd ? openStart - 1 : openEnd);\n } else {\n this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);\n }\n};\n\n// : ({sliceDepth: number, frontierDepth: number, parent: ?Node, wrap: ?[NodeType], inject: ?Fragment})\n// Move content from the unplaced slice at `sliceDepth` to the\n// frontier node at `frontierDepth`. Close that frontier node when\n// applicable.\nFitter.prototype.placeNodes = function placeNodes (ref) {\n var sliceDepth = ref.sliceDepth;\n var frontierDepth = ref.frontierDepth;\n var parent = ref.parent;\n var inject = ref.inject;\n var wrap = ref.wrap;\n\n while (this.depth > frontierDepth) { this.closeFrontierNode(); }\n if (wrap) { for (var i = 0; i < wrap.length; i++) { this.openFrontierNode(wrap[i]); } }\n\n var slice = this.unplaced, fragment = parent ? parent.content : slice.content;\n var openStart = slice.openStart - sliceDepth;\n var taken = 0, add = [];\n var ref$1 = this.frontier[frontierDepth];\n var match = ref$1.match;\n var type = ref$1.type;\n if (inject) {\n for (var i$1 = 0; i$1 < inject.childCount; i$1++) { add.push(inject.child(i$1)); }\n match = match.matchFragment(inject);\n }\n // Computes the amount of (end) open nodes at the end of the\n // fragment. When 0, the parent is open, but no more. When\n // negative, nothing is open.\n var openEndCount = (fragment.size + sliceDepth) - (slice.content.size - slice.openEnd);\n // Scan over the fragment, fitting as many child nodes as\n // possible.\n while (taken < fragment.childCount) {\n var next = fragment.child(taken), matches = match.matchType(next.type);\n if (!matches) { break }\n taken++;\n if (taken > 1 || openStart == 0 || next.content.size) { // Drop empty open nodes\n match = matches;\n add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0,\n taken == fragment.childCount ? openEndCount : -1));\n }\n }\n var toEnd = taken == fragment.childCount;\n if (!toEnd) { openEndCount = -1; }\n\n // If the parent types match, and the entire node was moved, and\n // it's not open, close this frontier node right away.\n if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type) { this.closeFrontierNode(); }\n else { this.frontier[frontierDepth].match = match; }\n\n // Add new frontier nodes for any open nodes at the end.\n for (var i$2 = 0, cur = fragment; i$2 < openEndCount; i$2++) {\n var node = cur.lastChild;\n this.frontier.push({type: node.type, match: node.contentMatchAt(node.childCount)});\n cur = node.content;\n }\n\n // Update `this.unplaced`. Drop the entire node from which we\n // placed it we got to its end, otherwise just drop the placed\n // nodes.\n this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd)\n : sliceDepth == 0 ? Slice.empty\n : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1),\n sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);\n this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));\n};\n\nFitter.prototype.mustMoveInline = function mustMoveInline () {\n if (!this.$to.parent.isTextblock) { return -1 }\n var top = this.frontier[this.depth], level;\n if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) ||\n (this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth)) { return -1 }\n\n var ref = this.$to;\n var depth = ref.depth;\n var after = this.$to.after(depth);\n while (depth > 1 && after == this.$to.end(--depth)) { ++after; }\n return after\n};\n\nFitter.prototype.findCloseLevel = function findCloseLevel ($to) {\n scan: for (var i = Math.min(this.depth, $to.depth); i >= 0; i--) {\n var ref = this.frontier[i];\n var match = ref.match;\n var type = ref.type;\n var fit = contentAfterFits($to, i, type, match, false);\n if (!fit) { continue }\n for (var d = i - 1; d >= 0; d--) {\n var ref$1 = this.frontier[d];\n var match$1 = ref$1.match;\n var type$1 = ref$1.type;\n var matches = contentAfterFits($to, d, type$1, match$1, true);\n if (!matches || matches.childCount) { continue scan }\n }\n return {depth: i, fit: fit}\n }\n};\n\nFitter.prototype.close = function close ($to) {\n var close = this.findCloseLevel($to);\n if (!close) { return false }\n\n while (this.depth > close.depth) { this.closeFrontierNode(); }\n if (close.fit.childCount) { this.placed = addToFragment(this.placed, close.depth, close.fit); }\n for (var d = close.depth + 1; d <= $to.depth; d++) {\n var node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));\n this.openFrontierNode(node.type, node.attrs, add);\n }\n return true\n};\n\nFitter.prototype.openFrontierNode = function openFrontierNode (type, attrs, content) {\n var top = this.frontier[this.depth];\n top.match = top.match.matchType(type);\n this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));\n this.frontier.push({type: type, match: type.contentMatch});\n};\n\nFitter.prototype.closeFrontierNode = function closeFrontierNode () {\n var open = this.frontier.pop();\n var add = open.match.fillBefore(Fragment.empty, true);\n if (add.childCount) { this.placed = addToFragment(this.placed, this.frontier.length, add); }\n};\n\nObject.defineProperties( Fitter.prototype, prototypeAccessors$1 );\n\nfunction dropFromFragment(fragment, depth, count) {\n if (depth == 0) { return fragment.cutByIndex(count) }\n return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)))\n}\n\nfunction addToFragment(fragment, depth, content) {\n if (depth == 0) { return fragment.append(content) }\n return fragment.replaceChild(fragment.childCount - 1,\n fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)))\n}\n\nfunction contentAt(fragment, depth) {\n for (var i = 0; i < depth; i++) { fragment = fragment.firstChild.content; }\n return fragment\n}\n\nfunction closeNodeStart(node, openStart, openEnd) {\n if (openStart <= 0) { return node }\n var frag = node.content;\n if (openStart > 1)\n { frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0)); }\n if (openStart > 0) {\n frag = node.type.contentMatch.fillBefore(frag).append(frag);\n if (openEnd <= 0) { frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true)); }\n }\n return node.copy(frag)\n}\n\nfunction contentAfterFits($to, depth, type, match, open) {\n var node = $to.node(depth), index = open ? $to.indexAfter(depth) : $to.index(depth);\n if (index == node.childCount && !type.compatibleContent(node.type)) { return null }\n var fit = match.fillBefore(node.content, true, index);\n return fit && !invalidMarks(type, node.content, index) ? fit : null\n}\n\nfunction invalidMarks(type, fragment, start) {\n for (var i = start; i < fragment.childCount; i++)\n { if (!type.allowsMarks(fragment.child(i).marks)) { return true } }\n return false\n}\n\n// :: (number, number, Slice) → this\n// Replace a range of the document with a given slice, using `from`,\n// `to`, and the slice's [`openStart`](#model.Slice.openStart) property\n// as hints, rather than fixed start and end points. This method may\n// grow the replaced area or close open nodes in the slice in order to\n// get a fit that is more in line with WYSIWYG expectations, by\n// dropping fully covered parent nodes of the replaced region when\n// they are marked [non-defining](#model.NodeSpec.defining), or\n// including an open parent node from the slice that _is_ marked as\n// [defining](#model.NodeSpec.defining).\n//\n// This is the method, for example, to handle paste. The similar\n// [`replace`](#transform.Transform.replace) method is a more\n// primitive tool which will _not_ move the start and end of its given\n// range, and is useful in situations where you need more precise\n// control over what happens.\nTransform.prototype.replaceRange = function(from, to, slice) {\n if (!slice.size) { return this.deleteRange(from, to) }\n\n var $from = this.doc.resolve(from), $to = this.doc.resolve(to);\n if (fitsTrivially($from, $to, slice))\n { return this.step(new ReplaceStep(from, to, slice)) }\n\n var targetDepths = coveredDepths($from, this.doc.resolve(to));\n // Can't replace the whole document, so remove 0 if it's present\n if (targetDepths[targetDepths.length - 1] == 0) { targetDepths.pop(); }\n // Negative numbers represent not expansion over the whole node at\n // that depth, but replacing from $from.before(-D) to $to.pos.\n var preferredTarget = -($from.depth + 1);\n targetDepths.unshift(preferredTarget);\n // This loop picks a preferred target depth, if one of the covering\n // depths is not outside of a defining node, and adds negative\n // depths for any depth that has $from at its start and does not\n // cross a defining node.\n for (var d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {\n var spec = $from.node(d).type.spec;\n if (spec.defining || spec.isolating) { break }\n if (targetDepths.indexOf(d) > -1) { preferredTarget = d; }\n else if ($from.before(d) == pos) { targetDepths.splice(1, 0, -d); }\n }\n // Try to fit each possible depth of the slice into each possible\n // target depth, starting with the preferred depths.\n var preferredTargetIndex = targetDepths.indexOf(preferredTarget);\n\n var leftNodes = [], preferredDepth = slice.openStart;\n for (var content = slice.content, i = 0;; i++) {\n var node = content.firstChild;\n leftNodes.push(node);\n if (i == slice.openStart) { break }\n content = node.content;\n }\n // Back up if the node directly above openStart, or the node above\n // that separated only by a non-defining textblock node, is defining.\n if (preferredDepth > 0 && leftNodes[preferredDepth - 1].type.spec.defining &&\n $from.node(preferredTargetIndex).type != leftNodes[preferredDepth - 1].type)\n { preferredDepth -= 1; }\n else if (preferredDepth >= 2 && leftNodes[preferredDepth - 1].isTextblock && leftNodes[preferredDepth - 2].type.spec.defining &&\n $from.node(preferredTargetIndex).type != leftNodes[preferredDepth - 2].type)\n { preferredDepth -= 2; }\n\n for (var j = slice.openStart; j >= 0; j--) {\n var openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);\n var insert = leftNodes[openDepth];\n if (!insert) { continue }\n for (var i$1 = 0; i$1 < targetDepths.length; i$1++) {\n // Loop over possible expansion levels, starting with the\n // preferred one\n var targetDepth = targetDepths[(i$1 + preferredTargetIndex) % targetDepths.length], expand = true;\n if (targetDepth < 0) { expand = false; targetDepth = -targetDepth; }\n var parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);\n if (parent.canReplaceWith(index, index, insert.type, insert.marks))\n { return this.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to,\n new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth),\n openDepth, slice.openEnd)) }\n }\n }\n\n var startSteps = this.steps.length;\n for (var i$2 = targetDepths.length - 1; i$2 >= 0; i$2--) {\n this.replace(from, to, slice);\n if (this.steps.length > startSteps) { break }\n var depth = targetDepths[i$2];\n if (i$2 < 0) { continue }\n from = $from.before(depth); to = $to.after(depth);\n }\n return this\n};\n\nfunction closeFragment(fragment, depth, oldOpen, newOpen, parent) {\n if (depth < oldOpen) {\n var first = fragment.firstChild;\n fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));\n }\n if (depth > newOpen) {\n var match = parent.contentMatchAt(0);\n var start = match.fillBefore(fragment).append(fragment);\n fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));\n }\n return fragment\n}\n\n// :: (number, number, Node) → this\n// Replace the given range with a node, but use `from` and `to` as\n// hints, rather than precise positions. When from and to are the same\n// and are at the start or end of a parent node in which the given\n// node doesn't fit, this method may _move_ them out towards a parent\n// that does allow the given node to be placed. When the given range\n// completely covers a parent node, this method may completely replace\n// that parent node.\nTransform.prototype.replaceRangeWith = function(from, to, node) {\n if (!node.isInline && from == to && this.doc.resolve(from).parent.content.size) {\n var point = insertPoint(this.doc, from, node.type);\n if (point != null) { from = to = point; }\n }\n return this.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0))\n};\n\n// :: (number, number) → this\n// Delete the given range, expanding it to cover fully covered\n// parent nodes until a valid replace is found.\nTransform.prototype.deleteRange = function(from, to) {\n var $from = this.doc.resolve(from), $to = this.doc.resolve(to);\n var covered = coveredDepths($from, $to);\n for (var i = 0; i < covered.length; i++) {\n var depth = covered[i], last = i == covered.length - 1;\n if ((last && depth == 0) || $from.node(depth).type.contentMatch.validEnd)\n { return this.delete($from.start(depth), $to.end(depth)) }\n if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))\n { return this.delete($from.before(depth), $to.after(depth)) }\n }\n for (var d = 1; d <= $from.depth && d <= $to.depth; d++) {\n if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d)\n { return this.delete($from.before(d), to) }\n }\n return this.delete(from, to)\n};\n\n// : (ResolvedPos, ResolvedPos) → [number]\n// Returns an array of all depths for which $from - $to spans the\n// whole content of the nodes at that depth.\nfunction coveredDepths($from, $to) {\n var result = [], minDepth = Math.min($from.depth, $to.depth);\n for (var d = minDepth; d >= 0; d--) {\n var start = $from.start(d);\n if (start < $from.pos - ($from.depth - d) ||\n $to.end(d) > $to.pos + ($to.depth - d) ||\n $from.node(d).type.spec.isolating ||\n $to.node(d).type.spec.isolating) { break }\n if (start == $to.start(d)) { result.push(d); }\n }\n return result\n}\n\nexport { AddMarkStep, MapResult, Mapping, RemoveMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, TransformError, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep };\n//# sourceMappingURL=index.es.js.map\n","var GOOD_LEAF_SIZE = 200;\n\n// :: class<T> A rope sequence is a persistent sequence data structure\n// that supports appending, prepending, and slicing without doing a\n// full copy. It is represented as a mostly-balanced tree.\nvar RopeSequence = function RopeSequence () {};\n\nRopeSequence.prototype.append = function append (other) {\n if (!other.length) { return this }\n other = RopeSequence.from(other);\n\n return (!this.length && other) ||\n (other.length < GOOD_LEAF_SIZE && this.leafAppend(other)) ||\n (this.length < GOOD_LEAF_SIZE && other.leafPrepend(this)) ||\n this.appendInner(other)\n};\n\n// :: (union<[T], RopeSequence<T>>) → RopeSequence<T>\n// Prepend an array or other rope to this one, returning a new rope.\nRopeSequence.prototype.prepend = function prepend (other) {\n if (!other.length) { return this }\n return RopeSequence.from(other).append(this)\n};\n\nRopeSequence.prototype.appendInner = function appendInner (other) {\n return new Append(this, other)\n};\n\n// :: (?number, ?number) → RopeSequence<T>\n// Create a rope repesenting a sub-sequence of this rope.\nRopeSequence.prototype.slice = function slice (from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.length;\n\n if (from >= to) { return RopeSequence.empty }\n return this.sliceInner(Math.max(0, from), Math.min(this.length, to))\n};\n\n// :: (number) → T\n// Retrieve the element at the given position from this rope.\nRopeSequence.prototype.get = function get (i) {\n if (i < 0 || i >= this.length) { return undefined }\n return this.getInner(i)\n};\n\n// :: ((element: T, index: number) → ?bool, ?number, ?number)\n// Call the given function for each element between the given\n// indices. This tends to be more efficient than looping over the\n// indices and calling `get`, because it doesn't have to descend the\n// tree for every element.\nRopeSequence.prototype.forEach = function forEach (f, from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.length;\n\n if (from <= to)\n { this.forEachInner(f, from, to, 0); }\n else\n { this.forEachInvertedInner(f, from, to, 0); }\n};\n\n// :: ((element: T, index: number) → U, ?number, ?number) → [U]\n// Map the given functions over the elements of the rope, producing\n// a flat array.\nRopeSequence.prototype.map = function map (f, from, to) {\n if ( from === void 0 ) from = 0;\n if ( to === void 0 ) to = this.length;\n\n var result = [];\n this.forEach(function (elt, i) { return result.push(f(elt, i)); }, from, to);\n return result\n};\n\n// :: (?union<[T], RopeSequence<T>>) → RopeSequence<T>\n// Create a rope representing the given array, or return the rope\n// itself if a rope was given.\nRopeSequence.from = function from (values) {\n if (values instanceof RopeSequence) { return values }\n return values && values.length ? new Leaf(values) : RopeSequence.empty\n};\n\nvar Leaf = /*@__PURE__*/(function (RopeSequence) {\n function Leaf(values) {\n RopeSequence.call(this);\n this.values = values;\n }\n\n if ( RopeSequence ) Leaf.__proto__ = RopeSequence;\n Leaf.prototype = Object.create( RopeSequence && RopeSequence.prototype );\n Leaf.prototype.constructor = Leaf;\n\n var prototypeAccessors = { length: { configurable: true },depth: { configurable: true } };\n\n Leaf.prototype.flatten = function flatten () {\n return this.values\n };\n\n Leaf.prototype.sliceInner = function sliceInner (from, to) {\n if (from == 0 && to == this.length) { return this }\n return new Leaf(this.values.slice(from, to))\n };\n\n Leaf.prototype.getInner = function getInner (i) {\n return this.values[i]\n };\n\n Leaf.prototype.forEachInner = function forEachInner (f, from, to, start) {\n for (var i = from; i < to; i++)\n { if (f(this.values[i], start + i) === false) { return false } }\n };\n\n Leaf.prototype.forEachInvertedInner = function forEachInvertedInner (f, from, to, start) {\n for (var i = from - 1; i >= to; i--)\n { if (f(this.values[i], start + i) === false) { return false } }\n };\n\n Leaf.prototype.leafAppend = function leafAppend (other) {\n if (this.length + other.length <= GOOD_LEAF_SIZE)\n { return new Leaf(this.values.concat(other.flatten())) }\n };\n\n Leaf.prototype.leafPrepend = function leafPrepend (other) {\n if (this.length + other.length <= GOOD_LEAF_SIZE)\n { return new Leaf(other.flatten().concat(this.values)) }\n };\n\n prototypeAccessors.length.get = function () { return this.values.length };\n\n prototypeAccessors.depth.get = function () { return 0 };\n\n Object.defineProperties( Leaf.prototype, prototypeAccessors );\n\n return Leaf;\n}(RopeSequence));\n\n// :: RopeSequence\n// The empty rope sequence.\nRopeSequence.empty = new Leaf([]);\n\nvar Append = /*@__PURE__*/(function (RopeSequence) {\n function Append(left, right) {\n RopeSequence.call(this);\n this.left = left;\n this.right = right;\n this.length = left.length + right.length;\n this.depth = Math.max(left.depth, right.depth) + 1;\n }\n\n if ( RopeSequence ) Append.__proto__ = RopeSequence;\n Append.prototype = Object.create( RopeSequence && RopeSequence.prototype );\n Append.prototype.constructor = Append;\n\n Append.prototype.flatten = function flatten () {\n return this.left.flatten().concat(this.right.flatten())\n };\n\n Append.prototype.getInner = function getInner (i) {\n return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length)\n };\n\n Append.prototype.forEachInner = function forEachInner (f, from, to, start) {\n var leftLen = this.left.length;\n if (from < leftLen &&\n this.left.forEachInner(f, from, Math.min(to, leftLen), start) === false)\n { return false }\n if (to > leftLen &&\n this.right.forEachInner(f, Math.max(from - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false)\n { return false }\n };\n\n Append.prototype.forEachInvertedInner = function forEachInvertedInner (f, from, to, start) {\n var leftLen = this.left.length;\n if (from > leftLen &&\n this.right.forEachInvertedInner(f, from - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false)\n { return false }\n if (to < leftLen &&\n this.left.forEachInvertedInner(f, Math.min(from, leftLen), to, start) === false)\n { return false }\n };\n\n Append.prototype.sliceInner = function sliceInner (from, to) {\n if (from == 0 && to == this.length) { return this }\n var leftLen = this.left.length;\n if (to <= leftLen) { return this.left.slice(from, to) }\n if (from >= leftLen) { return this.right.slice(from - leftLen, to - leftLen) }\n return this.left.slice(from, leftLen).append(this.right.slice(0, to - leftLen))\n };\n\n Append.prototype.leafAppend = function leafAppend (other) {\n var inner = this.right.leafAppend(other);\n if (inner) { return new Append(this.left, inner) }\n };\n\n Append.prototype.leafPrepend = function leafPrepend (other) {\n var inner = this.left.leafPrepend(other);\n if (inner) { return new Append(inner, this.right) }\n };\n\n Append.prototype.appendInner = function appendInner (other) {\n if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1)\n { return new Append(this.left, new Append(this.right, other)) }\n return new Append(this, other)\n };\n\n return Append;\n}(RopeSequence));\n\nvar ropeSequence = RopeSequence;\n\nexport default ropeSequence;\n","import RopeSequence from 'rope-sequence';\nimport { Mapping } from 'prosemirror-transform';\nimport { PluginKey, Plugin } from 'prosemirror-state';\n\n// ProseMirror's history isn't simply a way to roll back to a previous\n// state, because ProseMirror supports applying changes without adding\n// them to the history (for example during collaboration).\n//\n// To this end, each 'Branch' (one for the undo history and one for\n// the redo history) keeps an array of 'Items', which can optionally\n// hold a step (an actual undoable change), and always hold a position\n// map (which is needed to move changes below them to apply to the\n// current document).\n//\n// An item that has both a step and a selection bookmark is the start\n// of an 'event' — a group of changes that will be undone or redone at\n// once. (It stores only the bookmark, since that way we don't have to\n// provide a document until the selection is actually applied, which\n// is useful when compressing.)\n\n// Used to schedule history compression\nvar max_empty_items = 500;\n\nvar Branch = function Branch(items, eventCount) {\n this.items = items;\n this.eventCount = eventCount;\n};\n\n// : (EditorState, bool) → ?{transform: Transform, selection: ?SelectionBookmark, remaining: Branch}\n// Pop the latest event off the branch's history and apply it\n// to a document transform.\nBranch.prototype.popEvent = function popEvent (state, preserveItems) {\n var this$1 = this;\n\n if (this.eventCount == 0) { return null }\n\n var end = this.items.length;\n for (;; end--) {\n var next = this.items.get(end - 1);\n if (next.selection) { --end; break }\n }\n\n var remap, mapFrom;\n if (preserveItems) {\n remap = this.remapping(end, this.items.length);\n mapFrom = remap.maps.length;\n }\n var transform = state.tr;\n var selection, remaining;\n var addAfter = [], addBefore = [];\n\n this.items.forEach(function (item, i) {\n if (!item.step) {\n if (!remap) {\n remap = this$1.remapping(end, i + 1);\n mapFrom = remap.maps.length;\n }\n mapFrom--;\n addBefore.push(item);\n return\n }\n\n if (remap) {\n addBefore.push(new Item(item.map));\n var step = item.step.map(remap.slice(mapFrom)), map;\n\n if (step && transform.maybeStep(step).doc) {\n map = transform.mapping.maps[transform.mapping.maps.length - 1];\n addAfter.push(new Item(map, null, null, addAfter.length + addBefore.length));\n }\n mapFrom--;\n if (map) { remap.appendMap(map, mapFrom); }\n } else {\n transform.maybeStep(item.step);\n }\n\n if (item.selection) {\n selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;\n remaining = new Branch(this$1.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this$1.eventCount - 1);\n return false\n }\n }, this.items.length, 0);\n\n return {remaining: remaining, transform: transform, selection: selection}\n};\n\n// : (Transform, ?SelectionBookmark, Object) → Branch\n// Create a new branch with the given transform added.\nBranch.prototype.addTransform = function addTransform (transform, selection, histOptions, preserveItems) {\n var newItems = [], eventCount = this.eventCount;\n var oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;\n\n for (var i = 0; i < transform.steps.length; i++) {\n var step = transform.steps[i].invert(transform.docs[i]);\n var item = new Item(transform.mapping.maps[i], step, selection), merged = (void 0);\n if (merged = lastItem && lastItem.merge(item)) {\n item = merged;\n if (i) { newItems.pop(); }\n else { oldItems = oldItems.slice(0, oldItems.length - 1); }\n }\n newItems.push(item);\n if (selection) {\n eventCount++;\n selection = null;\n }\n if (!preserveItems) { lastItem = item; }\n }\n var overflow = eventCount - histOptions.depth;\n if (overflow > DEPTH_OVERFLOW) {\n oldItems = cutOffEvents(oldItems, overflow);\n eventCount -= overflow;\n }\n return new Branch(oldItems.append(newItems), eventCount)\n};\n\nBranch.prototype.remapping = function remapping (from, to) {\n var maps = new Mapping;\n this.items.forEach(function (item, i) {\n var mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from\n ? maps.maps.length - item.mirrorOffset : null;\n maps.appendMap(item.map, mirrorPos);\n }, from, to);\n return maps\n};\n\nBranch.prototype.addMaps = function addMaps (array) {\n if (this.eventCount == 0) { return this }\n return new Branch(this.items.append(array.map(function (map) { return new Item(map); })), this.eventCount)\n};\n\n// : (Transform, number)\n// When the collab module receives remote changes, the history has\n// to know about those, so that it can adjust the steps that were\n// rebased on top of the remote changes, and include the position\n// maps for the remote changes in its array of items.\nBranch.prototype.rebased = function rebased (rebasedTransform, rebasedCount) {\n if (!this.eventCount) { return this }\n\n var rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);\n\n var mapping = rebasedTransform.mapping;\n var newUntil = rebasedTransform.steps.length;\n var eventCount = this.eventCount;\n this.items.forEach(function (item) { if (item.selection) { eventCount--; } }, start);\n\n var iRebased = rebasedCount;\n this.items.forEach(function (item) {\n var pos = mapping.getMirror(--iRebased);\n if (pos == null) { return }\n newUntil = Math.min(newUntil, pos);\n var map = mapping.maps[pos];\n if (item.step) {\n var step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);\n var selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));\n if (selection) { eventCount++; }\n rebasedItems.push(new Item(map, step, selection));\n } else {\n rebasedItems.push(new Item(map));\n }\n }, start);\n\n var newMaps = [];\n for (var i = rebasedCount; i < newUntil; i++)\n { newMaps.push(new Item(mapping.maps[i])); }\n var items = this.items.slice(0, start).append(newMaps).append(rebasedItems);\n var branch = new Branch(items, eventCount);\n\n if (branch.emptyItemCount() > max_empty_items)\n { branch = branch.compress(this.items.length - rebasedItems.length); }\n return branch\n};\n\nBranch.prototype.emptyItemCount = function emptyItemCount () {\n var count = 0;\n this.items.forEach(function (item) { if (!item.step) { count++; } });\n return count\n};\n\n// Compressing a branch means rewriting it to push the air (map-only\n// items) out. During collaboration, these naturally accumulate\n// because each remote change adds one. The `upto` argument is used\n// to ensure that only the items below a given level are compressed,\n// because `rebased` relies on a clean, untouched set of items in\n// order to associate old items with rebased steps.\nBranch.prototype.compress = function compress (upto) {\n if ( upto === void 0 ) upto = this.items.length;\n\n var remap = this.remapping(0, upto), mapFrom = remap.maps.length;\n var items = [], events = 0;\n this.items.forEach(function (item, i) {\n if (i >= upto) {\n items.push(item);\n if (item.selection) { events++; }\n } else if (item.step) {\n var step = item.step.map(remap.slice(mapFrom)), map = step && step.getMap();\n mapFrom--;\n if (map) { remap.appendMap(map, mapFrom); }\n if (step) {\n var selection = item.selection && item.selection.map(remap.slice(mapFrom));\n if (selection) { events++; }\n var newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;\n if (merged = items.length && items[last].merge(newItem))\n { items[last] = merged; }\n else\n { items.push(newItem); }\n }\n } else if (item.map) {\n mapFrom--;\n }\n }, this.items.length, 0);\n return new Branch(RopeSequence.from(items.reverse()), events)\n};\n\nBranch.empty = new Branch(RopeSequence.empty, 0);\n\nfunction cutOffEvents(items, n) {\n var cutPoint;\n items.forEach(function (item, i) {\n if (item.selection && (n-- == 0)) {\n cutPoint = i;\n return false\n }\n });\n return items.slice(cutPoint)\n}\n\nvar Item = function Item(map, step, selection, mirrorOffset) {\n // The (forward) step map for this item.\n this.map = map;\n // The inverted step\n this.step = step;\n // If this is non-null, this item is the start of a group, and\n // this selection is the starting selection for the group (the one\n // that was active before the first step was applied)\n this.selection = selection;\n // If this item is the inverse of a previous mapping on the stack,\n // this points at the inverse's offset\n this.mirrorOffset = mirrorOffset;\n};\n\nItem.prototype.merge = function merge (other) {\n if (this.step && other.step && !other.selection) {\n var step = other.step.merge(this.step);\n if (step) { return new Item(step.getMap().invert(), step, this.selection) }\n }\n};\n\n// The value of the state field that tracks undo/redo history for that\n// state. Will be stored in the plugin state when the history plugin\n// is active.\nvar HistoryState = function HistoryState(done, undone, prevRanges, prevTime) {\n this.done = done;\n this.undone = undone;\n this.prevRanges = prevRanges;\n this.prevTime = prevTime;\n};\n\nvar DEPTH_OVERFLOW = 20;\n\n// : (HistoryState, EditorState, Transaction, Object)\n// Record a transformation in undo history.\nfunction applyTransaction(history, state, tr, options) {\n var historyTr = tr.getMeta(historyKey), rebased;\n if (historyTr) { return historyTr.historyState }\n\n if (tr.getMeta(closeHistoryKey)) { history = new HistoryState(history.done, history.undone, null, 0); }\n\n var appended = tr.getMeta(\"appendedTransaction\");\n\n if (tr.steps.length == 0) {\n return history\n } else if (appended && appended.getMeta(historyKey)) {\n if (appended.getMeta(historyKey).redo)\n { return new HistoryState(history.done.addTransform(tr, null, options, mustPreserveItems(state)),\n history.undone, rangesFor(tr.mapping.maps[tr.steps.length - 1]), history.prevTime) }\n else\n { return new HistoryState(history.done, history.undone.addTransform(tr, null, options, mustPreserveItems(state)),\n null, history.prevTime) }\n } else if (tr.getMeta(\"addToHistory\") !== false && !(appended && appended.getMeta(\"addToHistory\") === false)) {\n // Group transforms that occur in quick succession into one event.\n var newGroup = history.prevTime == 0 || !appended && (history.prevTime < (tr.time || 0) - options.newGroupDelay ||\n !isAdjacentTo(tr, history.prevRanges));\n var prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1]);\n return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : null,\n options, mustPreserveItems(state)),\n Branch.empty, prevRanges, tr.time)\n } else if (rebased = tr.getMeta(\"rebased\")) {\n // Used by the collab module to tell the history that some of its\n // content has been rebased.\n return new HistoryState(history.done.rebased(tr, rebased),\n history.undone.rebased(tr, rebased),\n mapRanges(history.prevRanges, tr.mapping), history.prevTime)\n } else {\n return new HistoryState(history.done.addMaps(tr.mapping.maps),\n history.undone.addMaps(tr.mapping.maps),\n mapRanges(history.prevRanges, tr.mapping), history.prevTime)\n }\n}\n\nfunction isAdjacentTo(transform, prevRanges) {\n if (!prevRanges) { return false }\n if (!transform.docChanged) { return true }\n var adjacent = false;\n transform.mapping.maps[0].forEach(function (start, end) {\n for (var i = 0; i < prevRanges.length; i += 2)\n { if (start <= prevRanges[i + 1] && end >= prevRanges[i])\n { adjacent = true; } }\n });\n return adjacent\n}\n\nfunction rangesFor(map) {\n var result = [];\n map.forEach(function (_from, _to, from, to) { return result.push(from, to); });\n return result\n}\n\nfunction mapRanges(ranges, mapping) {\n if (!ranges) { return null }\n var result = [];\n for (var i = 0; i < ranges.length; i += 2) {\n var from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);\n if (from <= to) { result.push(from, to); }\n }\n return result\n}\n\n// : (HistoryState, EditorState, (tr: Transaction), bool)\n// Apply the latest event from one branch to the document and shift the event\n// onto the other branch.\nfunction histTransaction(history, state, dispatch, redo) {\n var preserveItems = mustPreserveItems(state), histOptions = historyKey.get(state).spec.config;\n var pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);\n if (!pop) { return }\n\n var selection = pop.selection.resolve(pop.transform.doc);\n var added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(),\n histOptions, preserveItems);\n\n var newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0);\n dispatch(pop.transform.setSelection(selection).setMeta(historyKey, {redo: redo, historyState: newHist}).scrollIntoView());\n}\n\nvar cachedPreserveItems = false, cachedPreserveItemsPlugins = null;\n// Check whether any plugin in the given state has a\n// `historyPreserveItems` property in its spec, in which case we must\n// preserve steps exactly as they came in, so that they can be\n// rebased.\nfunction mustPreserveItems(state) {\n var plugins = state.plugins;\n if (cachedPreserveItemsPlugins != plugins) {\n cachedPreserveItems = false;\n cachedPreserveItemsPlugins = plugins;\n for (var i = 0; i < plugins.length; i++) { if (plugins[i].spec.historyPreserveItems) {\n cachedPreserveItems = true;\n break\n } }\n }\n return cachedPreserveItems\n}\n\n// :: (Transaction) → Transaction\n// Set a flag on the given transaction that will prevent further steps\n// from being appended to an existing history event (so that they\n// require a separate undo command to undo).\nfunction closeHistory(tr) {\n return tr.setMeta(closeHistoryKey, true)\n}\n\nvar historyKey = new PluginKey(\"history\");\nvar closeHistoryKey = new PluginKey(\"closeHistory\");\n\n// :: (?Object) → Plugin\n// Returns a plugin that enables the undo history for an editor. The\n// plugin will track undo and redo stacks, which can be used with the\n// [`undo`](#history.undo) and [`redo`](#history.redo) commands.\n//\n// You can set an `\"addToHistory\"` [metadata\n// property](#state.Transaction.setMeta) of `false` on a transaction\n// to prevent it from being rolled back by undo.\n//\n// config::-\n// Supports the following configuration options:\n//\n// depth:: ?number\n// The amount of history events that are collected before the\n// oldest events are discarded. Defaults to 100.\n//\n// newGroupDelay:: ?number\n// The delay between changes after which a new group should be\n// started. Defaults to 500 (milliseconds). Note that when changes\n// aren't adjacent, a new group is always started.\nfunction history(config) {\n config = {depth: config && config.depth || 100,\n newGroupDelay: config && config.newGroupDelay || 500};\n return new Plugin({\n key: historyKey,\n\n state: {\n init: function init() {\n return new HistoryState(Branch.empty, Branch.empty, null, 0)\n },\n apply: function apply(tr, hist, state) {\n return applyTransaction(hist, state, tr, config)\n }\n },\n\n config: config\n })\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// A command function that undoes the last change, if any.\nfunction undo(state, dispatch) {\n var hist = historyKey.getState(state);\n if (!hist || hist.done.eventCount == 0) { return false }\n if (dispatch) { histTransaction(hist, state, dispatch, false); }\n return true\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// A command function that redoes the last undone change, if any.\nfunction redo(state, dispatch) {\n var hist = historyKey.getState(state);\n if (!hist || hist.undone.eventCount == 0) { return false }\n if (dispatch) { histTransaction(hist, state, dispatch, true); }\n return true\n}\n\n// :: (EditorState) → number\n// The amount of undoable events available in a given state.\nfunction undoDepth(state) {\n var hist = historyKey.getState(state);\n return hist ? hist.done.eventCount : 0\n}\n\n// :: (EditorState) → number\n// The amount of redoable events available in a given editor state.\nfunction redoDepth(state) {\n var hist = historyKey.getState(state);\n return hist ? hist.undone.eventCount : 0\n}\n\nexport { HistoryState, closeHistory, history, redo, redoDepth, undo, undoDepth };\n//# sourceMappingURL=index.es.js.map\n","\n /*!\n * tiptap-extensions v1.28.8\n * (c) 2020 Scrumpy UG (limited liability)\n * @license MIT\n */\n \nimport { Node, Plugin, PluginKey, Mark, Extension } from 'tiptap';\nimport { toggleWrap, wrappingInputRule, toggleList, toggleBlockType, setBlockType, textblockTypeInputRule, chainCommands, exitCode, nodeInputRule, splitListItem, sinkListItem, liftListItem, insertText, replaceText, splitToDefaultListItem, toggleMark, markInputRule, markPasteRule, updateMark, removeMark, pasteRule } from 'tiptap-commands';\nimport low from 'lowlight/lib/core';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\nimport { findBlockNodes, createTable } from 'prosemirror-utils';\nimport { Plugin as Plugin$1, PluginKey as PluginKey$1, TextSelection } from 'prosemirror-state';\nimport { tableNodes, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, deleteTable, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, setCellAttr, fixTables, goToNextCell, columnResizing, tableEditing } from 'prosemirror-tables';\nimport { getMarkAttrs, nodeEqualsType } from 'tiptap-utils';\nimport { Step } from 'prosemirror-transform';\nimport { sendableSteps, getVersion, receiveTransaction, collab } from 'prosemirror-collab';\nimport { undo, redo, undoDepth, redoDepth, history } from 'prosemirror-history';\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n return function () {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (_isNativeReflectConstruct()) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nvar Blockquote = /*#__PURE__*/function (_Node) {\n _inherits(Blockquote, _Node);\n\n var _super = _createSuper(Blockquote);\n\n function Blockquote() {\n _classCallCheck(this, Blockquote);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Blockquote, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleWrap(type, schema.nodes.paragraph);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type;\n return {\n 'Ctrl->': toggleWrap(type)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [wrappingInputRule(/^\\s*>\\s$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'blockquote';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'block*',\n group: 'block',\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'blockquote'\n }],\n toDOM: function toDOM() {\n return ['blockquote', 0];\n }\n };\n }\n }]);\n\n return Blockquote;\n}(Node);\n\nvar BulletList = /*#__PURE__*/function (_Node) {\n _inherits(BulletList, _Node);\n\n var _super = _createSuper(BulletList);\n\n function BulletList() {\n _classCallCheck(this, BulletList);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(BulletList, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleList(type, schema.nodes.list_item);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type,\n schema = _ref2.schema;\n return {\n 'Shift-Ctrl-8': toggleList(type, schema.nodes.list_item)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [wrappingInputRule(/^\\s*([-+*])\\s$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'bullet_list';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'list_item+',\n group: 'block',\n parseDOM: [{\n tag: 'ul'\n }],\n toDOM: function toDOM() {\n return ['ul', 0];\n }\n };\n }\n }]);\n\n return BulletList;\n}(Node);\n\nvar CodeBlock = /*#__PURE__*/function (_Node) {\n _inherits(CodeBlock, _Node);\n\n var _super = _createSuper(CodeBlock);\n\n function CodeBlock() {\n _classCallCheck(this, CodeBlock);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(CodeBlock, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleBlockType(type, schema.nodes.paragraph);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type;\n return {\n 'Shift-Ctrl-\\\\': setBlockType(type)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [textblockTypeInputRule(/^```$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'code_block';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'text*',\n marks: '',\n group: 'block',\n code: true,\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'pre',\n preserveWhitespace: 'full'\n }],\n toDOM: function toDOM() {\n return ['pre', ['code', 0]];\n }\n };\n }\n }]);\n\n return CodeBlock;\n}(Node);\n\nfunction getDecorations(_ref) {\n var doc = _ref.doc,\n name = _ref.name;\n var decorations = [];\n var blocks = findBlockNodes(doc).filter(function (item) {\n return item.node.type.name === name;\n });\n\n var flatten = function flatten(list) {\n return list.reduce(function (a, b) {\n return a.concat(Array.isArray(b) ? flatten(b) : b);\n }, []);\n };\n\n function parseNodes(nodes) {\n var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n return nodes.map(function (node) {\n var classes = [].concat(_toConsumableArray(className), _toConsumableArray(node.properties ? node.properties.className : []));\n\n if (node.children) {\n return parseNodes(node.children, classes);\n }\n\n return {\n text: node.value,\n classes: classes\n };\n });\n }\n\n blocks.forEach(function (block) {\n var startPos = block.pos + 1;\n var nodes = low.highlightAuto(block.node.textContent).value;\n flatten(parseNodes(nodes)).map(function (node) {\n var from = startPos;\n var to = from + node.text.length;\n startPos = to;\n return _objectSpread2({}, node, {\n from: from,\n to: to\n });\n }).forEach(function (node) {\n var decoration = Decoration.inline(node.from, node.to, {\n class: node.classes.join(' ')\n });\n decorations.push(decoration);\n });\n });\n return DecorationSet.create(doc, decorations);\n}\n\nfunction HighlightPlugin(_ref2) {\n var name = _ref2.name;\n return new Plugin({\n name: new PluginKey('highlight'),\n state: {\n init: function init(_, _ref3) {\n var doc = _ref3.doc;\n return getDecorations({\n doc: doc,\n name: name\n });\n },\n apply: function apply(transaction, decorationSet, oldState, newState) {\n // TODO: find way to cache decorations\n // https://discuss.prosemirror.net/t/how-to-update-multiple-inline-decorations-on-node-change/1493\n var oldNodeName = oldState.selection.$head.parent.type.name;\n var newNodeName = newState.selection.$head.parent.type.name;\n var oldNodes = findBlockNodes(oldState.doc).filter(function (item) {\n return item.node.type.name === name;\n });\n var newNodes = findBlockNodes(newState.doc).filter(function (item) {\n return item.node.type.name === name;\n }); // Apply decorations if selection includes named node, or transaction changes named node.\n\n if (transaction.docChanged && ([oldNodeName, newNodeName].includes(name) || newNodes.length !== oldNodes.length)) {\n return getDecorations({\n doc: transaction.doc,\n name: name\n });\n }\n\n return decorationSet.map(transaction.mapping, transaction.doc);\n }\n },\n props: {\n decorations: function decorations(state) {\n return this.getState(state);\n }\n }\n });\n}\n\nvar CodeBlockHighlight = /*#__PURE__*/function (_Node) {\n _inherits(CodeBlockHighlight, _Node);\n\n var _super = _createSuper(CodeBlockHighlight);\n\n function CodeBlockHighlight() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, CodeBlockHighlight);\n\n _this = _super.call(this, options);\n\n try {\n Object.entries(_this.options.languages).forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n name = _ref2[0],\n mapping = _ref2[1];\n\n low.registerLanguage(name, mapping);\n });\n } catch (err) {\n throw new Error('Invalid syntax highlight definitions: define at least one highlight.js language mapping');\n }\n\n return _this;\n }\n\n _createClass(CodeBlockHighlight, [{\n key: \"commands\",\n value: function commands(_ref3) {\n var type = _ref3.type,\n schema = _ref3.schema;\n return function () {\n return toggleBlockType(type, schema.nodes.paragraph);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref4) {\n var type = _ref4.type;\n return {\n 'Shift-Ctrl-\\\\': setBlockType(type)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref5) {\n var type = _ref5.type;\n return [textblockTypeInputRule(/^```$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'code_block';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n languages: {}\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'text*',\n marks: '',\n group: 'block',\n code: true,\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'pre',\n preserveWhitespace: 'full'\n }],\n toDOM: function toDOM() {\n return ['pre', ['code', 0]];\n }\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [HighlightPlugin({\n name: this.name\n })];\n }\n }]);\n\n return CodeBlockHighlight;\n}(Node);\n\nvar HardBreak = /*#__PURE__*/function (_Node) {\n _inherits(HardBreak, _Node);\n\n var _super = _createSuper(HardBreak);\n\n function HardBreak() {\n _classCallCheck(this, HardBreak);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(HardBreak, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n var command = chainCommands(exitCode, function (state, dispatch) {\n dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView());\n return true;\n });\n return {\n 'Mod-Enter': command,\n 'Shift-Enter': command\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'hard_break';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n inline: true,\n group: 'inline',\n selectable: false,\n parseDOM: [{\n tag: 'br'\n }],\n toDOM: function toDOM() {\n return ['br'];\n }\n };\n }\n }]);\n\n return HardBreak;\n}(Node);\n\nvar Heading = /*#__PURE__*/function (_Node) {\n _inherits(Heading, _Node);\n\n var _super = _createSuper(Heading);\n\n function Heading() {\n _classCallCheck(this, Heading);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Heading, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function (attrs) {\n return toggleBlockType(type, schema.nodes.paragraph, attrs);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type;\n return this.options.levels.reduce(function (items, level) {\n return _objectSpread2({}, items, {}, _defineProperty({}, \"Shift-Ctrl-\".concat(level), setBlockType(type, {\n level: level\n })));\n }, {});\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return this.options.levels.map(function (level) {\n return textblockTypeInputRule(new RegExp(\"^(#{1,\".concat(level, \"})\\\\s$\")), type, function () {\n return {\n level: level\n };\n });\n });\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'heading';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n levels: [1, 2, 3, 4, 5, 6]\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n attrs: {\n level: {\n default: 1\n }\n },\n content: 'inline*',\n group: 'block',\n defining: true,\n draggable: false,\n parseDOM: this.options.levels.map(function (level) {\n return {\n tag: \"h\".concat(level),\n attrs: {\n level: level\n }\n };\n }),\n toDOM: function toDOM(node) {\n return [\"h\".concat(node.attrs.level), 0];\n }\n };\n }\n }]);\n\n return Heading;\n}(Node);\n\nvar HorizontalRule = /*#__PURE__*/function (_Node) {\n _inherits(HorizontalRule, _Node);\n\n var _super = _createSuper(HorizontalRule);\n\n function HorizontalRule() {\n _classCallCheck(this, HorizontalRule);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(HorizontalRule, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type;\n return function () {\n return function (state, dispatch) {\n return dispatch(state.tr.replaceSelectionWith(type.create()));\n };\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref2) {\n var type = _ref2.type;\n return [nodeInputRule(/^(?:---|___\\s|\\*\\*\\*\\s)$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'horizontal_rule';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n group: 'block',\n parseDOM: [{\n tag: 'hr'\n }],\n toDOM: function toDOM() {\n return ['hr'];\n }\n };\n }\n }]);\n\n return HorizontalRule;\n}(Node);\n\n/**\n * Matches following attributes in Markdown-typed image: [, alt, src, title]\n *\n * Example:\n * ![Lorem](image.jpg) -> [, \"Lorem\", \"image.jpg\"]\n * ![](image.jpg \"Ipsum\") -> [, \"\", \"image.jpg\", \"Ipsum\"]\n * ![Lorem](image.jpg \"Ipsum\") -> [, \"Lorem\", \"image.jpg\", \"Ipsum\"]\n */\n\nvar IMAGE_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\n\nvar Image = /*#__PURE__*/function (_Node) {\n _inherits(Image, _Node);\n\n var _super = _createSuper(Image);\n\n function Image() {\n _classCallCheck(this, Image);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Image, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type;\n return function (attrs) {\n return function (state, dispatch) {\n var selection = state.selection;\n var position = selection.$cursor ? selection.$cursor.pos : selection.$to.pos;\n var node = type.create(attrs);\n var transaction = state.tr.insert(position, node);\n dispatch(transaction);\n };\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref2) {\n var type = _ref2.type;\n return [nodeInputRule(IMAGE_INPUT_REGEX, type, function (match) {\n var _match = _slicedToArray(match, 4),\n alt = _match[1],\n src = _match[2],\n title = _match[3];\n\n return {\n src: src,\n alt: alt,\n title: title\n };\n })];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'image';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n inline: true,\n attrs: {\n src: {},\n alt: {\n default: null\n },\n title: {\n default: null\n }\n },\n group: 'inline',\n draggable: true,\n parseDOM: [{\n tag: 'img[src]',\n getAttrs: function getAttrs(dom) {\n return {\n src: dom.getAttribute('src'),\n title: dom.getAttribute('title'),\n alt: dom.getAttribute('alt')\n };\n }\n }],\n toDOM: function toDOM(node) {\n return ['img', node.attrs];\n }\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [new Plugin({\n props: {\n handleDOMEvents: {\n drop: function drop(view, event) {\n var hasFiles = event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length;\n\n if (!hasFiles) {\n return;\n }\n\n var images = Array.from(event.dataTransfer.files).filter(function (file) {\n return /image/i.test(file.type);\n });\n\n if (images.length === 0) {\n return;\n }\n\n event.preventDefault();\n var schema = view.state.schema;\n var coordinates = view.posAtCoords({\n left: event.clientX,\n top: event.clientY\n });\n images.forEach(function (image) {\n var reader = new FileReader();\n\n reader.onload = function (readerEvent) {\n var node = schema.nodes.image.create({\n src: readerEvent.target.result\n });\n var transaction = view.state.tr.insert(coordinates.pos, node);\n view.dispatch(transaction);\n };\n\n reader.readAsDataURL(image);\n });\n }\n }\n }\n })];\n }\n }]);\n\n return Image;\n}(Node);\n\nvar ListItem = /*#__PURE__*/function (_Node) {\n _inherits(ListItem, _Node);\n\n var _super = _createSuper(ListItem);\n\n function ListItem() {\n _classCallCheck(this, ListItem);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(ListItem, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n Enter: splitListItem(type),\n Tab: sinkListItem(type),\n 'Shift-Tab': liftListItem(type)\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'list_item';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n content: 'paragraph block*',\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'li'\n }],\n toDOM: function toDOM() {\n return ['li', 0];\n }\n };\n }\n }]);\n\n return ListItem;\n}(Node);\n\nfunction triggerCharacter(_ref) {\n var _ref$char = _ref.char,\n char = _ref$char === void 0 ? '@' : _ref$char,\n _ref$allowSpaces = _ref.allowSpaces,\n allowSpaces = _ref$allowSpaces === void 0 ? false : _ref$allowSpaces,\n _ref$startOfLine = _ref.startOfLine,\n startOfLine = _ref$startOfLine === void 0 ? false : _ref$startOfLine;\n return function ($position) {\n // cancel if top level node\n if ($position.depth <= 0) {\n return false;\n } // Matching expressions used for later\n\n\n var escapedChar = \"\\\\\".concat(char);\n var suffix = new RegExp(\"\\\\s\".concat(escapedChar, \"$\"));\n var prefix = startOfLine ? '^' : '';\n var regexp = allowSpaces ? new RegExp(\"\".concat(prefix).concat(escapedChar, \".*?(?=\\\\s\").concat(escapedChar, \"|$)\"), 'gm') : new RegExp(\"\".concat(prefix, \"(?:^)?\").concat(escapedChar, \"[^\\\\s\").concat(escapedChar, \"]*\"), 'gm'); // Lookup the boundaries of the current node\n\n var textFrom = $position.before();\n var textTo = $position.end();\n var text = $position.doc.textBetween(textFrom, textTo, '\\0', '\\0');\n var match = regexp.exec(text);\n var position;\n\n while (match !== null) {\n // JavaScript doesn't have lookbehinds; this hacks a check that first character is \" \"\n // or the line beginning\n var matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index);\n\n if (/^[\\s\\0]?$/.test(matchPrefix)) {\n // The absolute position of the match in the document\n var from = match.index + $position.start();\n var to = from + match[0].length; // Edge case handling; if spaces are allowed and we're directly in between\n // two triggers\n\n if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {\n match[0] += ' ';\n to += 1;\n } // If the $position is located within the matched substring, return that range\n\n\n if (from < $position.pos && to >= $position.pos) {\n position = {\n range: {\n from: from,\n to: to\n },\n query: match[0].slice(char.length),\n text: match[0]\n };\n }\n }\n\n match = regexp.exec(text);\n }\n\n return position;\n };\n}\n\nfunction SuggestionsPlugin(_ref2) {\n var _ref2$matcher = _ref2.matcher,\n matcher = _ref2$matcher === void 0 ? {\n char: '@',\n allowSpaces: false,\n startOfLine: false\n } : _ref2$matcher,\n _ref2$appendText = _ref2.appendText,\n appendText = _ref2$appendText === void 0 ? null : _ref2$appendText,\n _ref2$suggestionClass = _ref2.suggestionClass,\n suggestionClass = _ref2$suggestionClass === void 0 ? 'suggestion' : _ref2$suggestionClass,\n _ref2$command = _ref2.command,\n _command = _ref2$command === void 0 ? function () {\n return false;\n } : _ref2$command,\n _ref2$items = _ref2.items,\n items = _ref2$items === void 0 ? [] : _ref2$items,\n _ref2$onEnter = _ref2.onEnter,\n onEnter = _ref2$onEnter === void 0 ? function () {\n return false;\n } : _ref2$onEnter,\n _ref2$onChange = _ref2.onChange,\n onChange = _ref2$onChange === void 0 ? function () {\n return false;\n } : _ref2$onChange,\n _ref2$onExit = _ref2.onExit,\n onExit = _ref2$onExit === void 0 ? function () {\n return false;\n } : _ref2$onExit,\n _ref2$onKeyDown = _ref2.onKeyDown,\n onKeyDown = _ref2$onKeyDown === void 0 ? function () {\n return false;\n } : _ref2$onKeyDown,\n _ref2$onFilter = _ref2.onFilter,\n onFilter = _ref2$onFilter === void 0 ? function (searchItems, query) {\n if (!query) {\n return searchItems;\n }\n\n return searchItems.filter(function (item) {\n return JSON.stringify(item).toLowerCase().includes(query.toLowerCase());\n });\n } : _ref2$onFilter;\n\n return new Plugin$1({\n key: new PluginKey$1('suggestions'),\n view: function view() {\n var _this = this;\n\n return {\n update: function update(view, prevState) {\n var prev = _this.key.getState(prevState);\n\n var next = _this.key.getState(view.state); // See how the state changed\n\n\n var moved = prev.active && next.active && prev.range.from !== next.range.from;\n var started = !prev.active && next.active;\n var stopped = prev.active && !next.active;\n var changed = !started && !stopped && prev.query !== next.query;\n var handleStart = started || moved;\n var handleChange = changed && !moved;\n var handleExit = stopped || moved; // Cancel when suggestion isn't active\n\n if (!handleStart && !handleChange && !handleExit) {\n return;\n }\n\n var state = handleExit ? prev : next;\n var decorationNode = document.querySelector(\"[data-decoration-id=\\\"\".concat(state.decorationId, \"\\\"]\")); // build a virtual node for popper.js or tippy.js\n // this can be used for building popups without a DOM node\n\n var virtualNode = decorationNode ? {\n getBoundingClientRect: function getBoundingClientRect() {\n return decorationNode.getBoundingClientRect();\n },\n clientWidth: decorationNode.clientWidth,\n clientHeight: decorationNode.clientHeight\n } : null;\n var props = {\n view: view,\n range: state.range,\n query: state.query,\n text: state.text,\n decorationNode: decorationNode,\n virtualNode: virtualNode,\n items: onFilter(Array.isArray(items) ? items : items(), state.query),\n command: function command(_ref3) {\n var range = _ref3.range,\n attrs = _ref3.attrs;\n\n _command({\n range: range,\n attrs: attrs,\n schema: view.state.schema\n })(view.state, view.dispatch, view);\n\n if (appendText) {\n insertText(appendText)(view.state, view.dispatch, view);\n }\n }\n }; // Trigger the hooks when necessary\n\n if (handleExit) {\n onExit(props);\n }\n\n if (handleChange) {\n onChange(props);\n }\n\n if (handleStart) {\n onEnter(props);\n }\n }\n };\n },\n state: {\n // Initialize the plugin's internal state.\n init: function init() {\n return {\n active: false,\n range: {},\n query: null,\n text: null\n };\n },\n // Apply changes to the plugin state from a view transaction.\n apply: function apply(tr, prev) {\n var selection = tr.selection;\n\n var next = _objectSpread2({}, prev); // We can only be suggesting if there is no selection\n\n\n if (selection.from === selection.to) {\n // Reset active state if we just left the previous suggestion range\n if (selection.from < prev.range.from || selection.from > prev.range.to) {\n next.active = false;\n } // Try to match against where our cursor currently is\n\n\n var $position = selection.$from;\n var match = triggerCharacter(matcher)($position);\n var decorationId = (Math.random() + 1).toString(36).substr(2, 5); // If we found a match, update the current state to show it\n\n if (match) {\n next.active = true;\n next.decorationId = prev.decorationId ? prev.decorationId : decorationId;\n next.range = match.range;\n next.query = match.query;\n next.text = match.text;\n } else {\n next.active = false;\n }\n } else {\n next.active = false;\n } // Make sure to empty the range if suggestion is inactive\n\n\n if (!next.active) {\n next.decorationId = null;\n next.range = {};\n next.query = null;\n next.text = null;\n }\n\n return next;\n }\n },\n props: {\n // Call the keydown hook if suggestion is active.\n handleKeyDown: function handleKeyDown(view, event) {\n var _this$getState = this.getState(view.state),\n active = _this$getState.active,\n range = _this$getState.range;\n\n if (!active) return false;\n return onKeyDown({\n view: view,\n event: event,\n range: range\n });\n },\n // Setup decorator on the currently active suggestion.\n decorations: function decorations(editorState) {\n var _this$getState2 = this.getState(editorState),\n active = _this$getState2.active,\n range = _this$getState2.range,\n decorationId = _this$getState2.decorationId;\n\n if (!active) return null;\n return DecorationSet.create(editorState.doc, [Decoration.inline(range.from, range.to, {\n nodeName: 'span',\n class: suggestionClass,\n 'data-decoration-id': decorationId\n })]);\n }\n }\n });\n}\n\nvar Mention = /*#__PURE__*/function (_Node) {\n _inherits(Mention, _Node);\n\n var _super = _createSuper(Mention);\n\n function Mention() {\n _classCallCheck(this, Mention);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Mention, [{\n key: \"commands\",\n value: function commands(_ref) {\n var _this = this;\n\n var schema = _ref.schema;\n return function (attrs) {\n return replaceText(null, schema.nodes[_this.name], attrs);\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'mention';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n matcher: {\n char: '@',\n allowSpaces: false,\n startOfLine: false\n },\n mentionClass: 'mention',\n suggestionClass: 'mention-suggestion'\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n var _this2 = this;\n\n return {\n attrs: {\n id: {},\n label: {}\n },\n group: 'inline',\n inline: true,\n selectable: false,\n atom: true,\n toDOM: function toDOM(node) {\n return ['span', {\n class: _this2.options.mentionClass,\n 'data-mention-id': node.attrs.id\n }, \"\".concat(_this2.options.matcher.char).concat(node.attrs.label)];\n },\n parseDOM: [{\n tag: 'span[data-mention-id]',\n getAttrs: function getAttrs(dom) {\n var id = dom.getAttribute('data-mention-id');\n var label = dom.innerText.split(_this2.options.matcher.char).join('');\n return {\n id: id,\n label: label\n };\n }\n }]\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this3 = this;\n\n return [SuggestionsPlugin({\n command: function command(_ref2) {\n var range = _ref2.range,\n attrs = _ref2.attrs,\n schema = _ref2.schema;\n return replaceText(range, schema.nodes[_this3.name], attrs);\n },\n appendText: ' ',\n matcher: this.options.matcher,\n items: this.options.items,\n onEnter: this.options.onEnter,\n onChange: this.options.onChange,\n onExit: this.options.onExit,\n onKeyDown: this.options.onKeyDown,\n onFilter: this.options.onFilter,\n suggestionClass: this.options.suggestionClass\n })];\n }\n }]);\n\n return Mention;\n}(Node);\n\nvar OrderedList = /*#__PURE__*/function (_Node) {\n _inherits(OrderedList, _Node);\n\n var _super = _createSuper(OrderedList);\n\n function OrderedList() {\n _classCallCheck(this, OrderedList);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(OrderedList, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleList(type, schema.nodes.list_item);\n };\n }\n }, {\n key: \"keys\",\n value: function keys(_ref2) {\n var type = _ref2.type,\n schema = _ref2.schema;\n return {\n 'Shift-Ctrl-9': toggleList(type, schema.nodes.list_item)\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [wrappingInputRule(/^(\\d+)\\.\\s$/, type, function (match) {\n return {\n order: +match[1]\n };\n }, function (match, node) {\n return node.childCount + node.attrs.order === +match[1];\n })];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'ordered_list';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n attrs: {\n order: {\n default: 1\n }\n },\n content: 'list_item+',\n group: 'block',\n parseDOM: [{\n tag: 'ol',\n getAttrs: function getAttrs(dom) {\n return {\n order: dom.hasAttribute('start') ? +dom.getAttribute('start') : 1\n };\n }\n }],\n toDOM: function toDOM(node) {\n return node.attrs.order === 1 ? ['ol', 0] : ['ol', {\n start: node.attrs.order\n }, 0];\n }\n };\n }\n }]);\n\n return OrderedList;\n}(Node);\n\nvar TableNodes = tableNodes({\n tableGroup: 'block',\n cellContent: 'block+',\n cellAttributes: {\n background: {\n default: null,\n getFromDOM: function getFromDOM(dom) {\n return dom.style.backgroundColor || null;\n },\n setDOMAttr: function setDOMAttr(value, attrs) {\n if (value) {\n var style = {\n style: \"\".concat(attrs.style || '', \"background-color: \").concat(value, \";\")\n };\n Object.assign(attrs, style);\n }\n }\n }\n }\n});\n\nvar Table = /*#__PURE__*/function (_Node) {\n _inherits(Table, _Node);\n\n var _super = _createSuper(Table);\n\n function Table() {\n _classCallCheck(this, Table);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Table, [{\n key: \"commands\",\n value: function commands(_ref) {\n var schema = _ref.schema;\n return {\n createTable: function createTable$1(_ref2) {\n var rowsCount = _ref2.rowsCount,\n colsCount = _ref2.colsCount,\n withHeaderRow = _ref2.withHeaderRow;\n return function (state, dispatch) {\n var offset = state.tr.selection.anchor + 1;\n\n var nodes = createTable(schema, rowsCount, colsCount, withHeaderRow);\n\n var tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();\n var resolvedPos = tr.doc.resolve(offset);\n tr.setSelection(TextSelection.near(resolvedPos));\n dispatch(tr);\n };\n },\n addColumnBefore: function addColumnBefore$1() {\n return addColumnBefore;\n },\n addColumnAfter: function addColumnAfter$1() {\n return addColumnAfter;\n },\n deleteColumn: function deleteColumn$1() {\n return deleteColumn;\n },\n addRowBefore: function addRowBefore$1() {\n return addRowBefore;\n },\n addRowAfter: function addRowAfter$1() {\n return addRowAfter;\n },\n deleteRow: function deleteRow$1() {\n return deleteRow;\n },\n deleteTable: function deleteTable$1() {\n return deleteTable;\n },\n toggleCellMerge: function toggleCellMerge() {\n return function (state, dispatch) {\n if (mergeCells(state, dispatch)) {\n return;\n }\n\n splitCell(state, dispatch);\n };\n },\n mergeCells: function mergeCells$1() {\n return mergeCells;\n },\n splitCell: function splitCell$1() {\n return splitCell;\n },\n toggleHeaderColumn: function toggleHeaderColumn$1() {\n return toggleHeaderColumn;\n },\n toggleHeaderRow: function toggleHeaderRow$1() {\n return toggleHeaderRow;\n },\n toggleHeaderCell: function toggleHeaderCell$1() {\n return toggleHeaderCell;\n },\n setCellAttr: function setCellAttr$1() {\n return setCellAttr;\n },\n fixTables: function fixTables$1() {\n return fixTables;\n }\n };\n }\n }, {\n key: \"keys\",\n value: function keys() {\n return {\n Tab: goToNextCell(1),\n 'Shift-Tab': goToNextCell(-1)\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'table';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n resizable: false\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n return TableNodes.table;\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [].concat(_toConsumableArray(this.options.resizable ? [columnResizing()] : []), [tableEditing()]);\n }\n }]);\n\n return Table;\n}(Node);\n\nvar TableHeader = /*#__PURE__*/function (_Node) {\n _inherits(TableHeader, _Node);\n\n var _super = _createSuper(TableHeader);\n\n function TableHeader() {\n _classCallCheck(this, TableHeader);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(TableHeader, [{\n key: \"name\",\n get: function get() {\n return 'table_header';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return TableNodes.table_header;\n }\n }]);\n\n return TableHeader;\n}(Node);\n\nvar TableCell = /*#__PURE__*/function (_Node) {\n _inherits(TableCell, _Node);\n\n var _super = _createSuper(TableCell);\n\n function TableCell() {\n _classCallCheck(this, TableCell);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(TableCell, [{\n key: \"name\",\n get: function get() {\n return 'table_cell';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return TableNodes.table_cell;\n }\n }]);\n\n return TableCell;\n}(Node);\n\nvar TableRow = /*#__PURE__*/function (_Node) {\n _inherits(TableRow, _Node);\n\n var _super = _createSuper(TableRow);\n\n function TableRow() {\n _classCallCheck(this, TableRow);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(TableRow, [{\n key: \"name\",\n get: function get() {\n return 'table_row';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return TableNodes.table_row;\n }\n }]);\n\n return TableRow;\n}(Node);\n\nvar TodoItem = /*#__PURE__*/function (_Node) {\n _inherits(TodoItem, _Node);\n\n var _super = _createSuper(TodoItem);\n\n function TodoItem() {\n _classCallCheck(this, TodoItem);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(TodoItem, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n Enter: splitToDefaultListItem(type),\n Tab: this.options.nested ? sinkListItem(type) : function () {},\n 'Shift-Tab': liftListItem(type)\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'todo_item';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n nested: false\n };\n }\n }, {\n key: \"view\",\n get: function get() {\n return {\n props: ['node', 'updateAttrs', 'view'],\n methods: {\n onChange: function onChange() {\n this.updateAttrs({\n done: !this.node.attrs.done\n });\n }\n },\n template: \"\\n <li :data-type=\\\"node.type.name\\\" :data-done=\\\"node.attrs.done.toString()\\\" data-drag-handle>\\n <span class=\\\"todo-checkbox\\\" contenteditable=\\\"false\\\" @click=\\\"onChange\\\"></span>\\n <div class=\\\"todo-content\\\" ref=\\\"content\\\" :contenteditable=\\\"view.editable.toString()\\\"></div>\\n </li>\\n \"\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n var _this = this;\n\n return {\n attrs: {\n done: {\n default: false\n }\n },\n draggable: true,\n content: this.options.nested ? '(paragraph|todo_list)+' : 'paragraph+',\n toDOM: function toDOM(node) {\n var done = node.attrs.done;\n return ['li', {\n 'data-type': _this.name,\n 'data-done': done.toString()\n }, ['span', {\n class: 'todo-checkbox',\n contenteditable: 'false'\n }], ['div', {\n class: 'todo-content'\n }, 0]];\n },\n parseDOM: [{\n priority: 51,\n tag: \"[data-type=\\\"\".concat(this.name, \"\\\"]\"),\n getAttrs: function getAttrs(dom) {\n return {\n done: dom.getAttribute('data-done') === 'true'\n };\n }\n }]\n };\n }\n }]);\n\n return TodoItem;\n}(Node);\n\nvar TodoList = /*#__PURE__*/function (_Node) {\n _inherits(TodoList, _Node);\n\n var _super = _createSuper(TodoList);\n\n function TodoList() {\n _classCallCheck(this, TodoList);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(TodoList, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type,\n schema = _ref.schema;\n return function () {\n return toggleList(type, schema.nodes.todo_item);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref2) {\n var type = _ref2.type;\n return [wrappingInputRule(/^\\s*(\\[ \\])\\s$/, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'todo_list';\n }\n }, {\n key: \"schema\",\n get: function get() {\n var _this = this;\n\n return {\n group: 'block',\n content: 'todo_item+',\n toDOM: function toDOM() {\n return ['ul', {\n 'data-type': _this.name\n }, 0];\n },\n parseDOM: [{\n priority: 51,\n tag: \"[data-type=\\\"\".concat(this.name, \"\\\"]\")\n }]\n };\n }\n }]);\n\n return TodoList;\n}(Node);\n\nvar Bold = /*#__PURE__*/function (_Mark) {\n _inherits(Bold, _Mark);\n\n var _super = _createSuper(Bold);\n\n function Bold() {\n _classCallCheck(this, Bold);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Bold, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-b': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [markInputRule(/(?:\\*\\*|__)([^*_]+)(?:\\*\\*|__)$/, type)];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref4) {\n var type = _ref4.type;\n return [markPasteRule(/(?:\\*\\*|__)([^*_]+)(?:\\*\\*|__)/g, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'bold';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n parseDOM: [{\n tag: 'strong'\n }, {\n tag: 'b',\n getAttrs: function getAttrs(node) {\n return node.style.fontWeight !== 'normal' && null;\n }\n }, {\n style: 'font-weight',\n getAttrs: function getAttrs(value) {\n return /^(bold(er)?|[5-9]\\d{2,})$/.test(value) && null;\n }\n }],\n toDOM: function toDOM() {\n return ['strong', 0];\n }\n };\n }\n }]);\n\n return Bold;\n}(Mark);\n\nvar Code = /*#__PURE__*/function (_Mark) {\n _inherits(Code, _Mark);\n\n var _super = _createSuper(Code);\n\n function Code() {\n _classCallCheck(this, Code);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Code, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-`': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [markInputRule(/(?:`)([^`]+)(?:`)$/, type)];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref4) {\n var type = _ref4.type;\n return [markPasteRule(/(?:`)([^`]+)(?:`)/g, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'code';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n excludes: '_',\n parseDOM: [{\n tag: 'code'\n }],\n toDOM: function toDOM() {\n return ['code', 0];\n }\n };\n }\n }]);\n\n return Code;\n}(Mark);\n\nvar Italic = /*#__PURE__*/function (_Mark) {\n _inherits(Italic, _Mark);\n\n var _super = _createSuper(Italic);\n\n function Italic() {\n _classCallCheck(this, Italic);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Italic, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-i': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [markInputRule(/(?:^|[^_])(_([^_]+)_)$/, type), markInputRule(/(?:^|[^*])(\\*([^*]+)\\*)$/, type)];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref4) {\n var type = _ref4.type;\n return [markPasteRule(/_([^_]+)_/g, type), markPasteRule(/\\*([^*]+)\\*/g, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'italic';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n parseDOM: [{\n tag: 'i'\n }, {\n tag: 'em'\n }, {\n style: 'font-style=italic'\n }],\n toDOM: function toDOM() {\n return ['em', 0];\n }\n };\n }\n }]);\n\n return Italic;\n}(Mark);\n\nvar Link = /*#__PURE__*/function (_Mark) {\n _inherits(Link, _Mark);\n\n var _super = _createSuper(Link);\n\n function Link() {\n _classCallCheck(this, Link);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Link, [{\n key: \"commands\",\n value: function commands(_ref) {\n var type = _ref.type;\n return function (attrs) {\n if (attrs.href) {\n return updateMark(type, attrs);\n }\n\n return removeMark(type);\n };\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref2) {\n var type = _ref2.type;\n return [pasteRule(/https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-zA-Z]{2,}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g, type, function (url) {\n return {\n href: url\n };\n })];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'link';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n openOnClick: true\n };\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n attrs: {\n href: {\n default: null\n }\n },\n inclusive: false,\n parseDOM: [{\n tag: 'a[href]',\n getAttrs: function getAttrs(dom) {\n return {\n href: dom.getAttribute('href')\n };\n }\n }],\n toDOM: function toDOM(node) {\n return ['a', _objectSpread2({}, node.attrs, {\n rel: 'noopener noreferrer nofollow'\n }), 0];\n }\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n if (!this.options.openOnClick) {\n return [];\n }\n\n return [new Plugin({\n props: {\n handleClick: function handleClick(view, pos, event) {\n var schema = view.state.schema;\n var attrs = getMarkAttrs(view.state, schema.marks.link);\n\n if (attrs.href && event.target instanceof HTMLAnchorElement) {\n event.stopPropagation();\n window.open(attrs.href);\n }\n }\n }\n })];\n }\n }]);\n\n return Link;\n}(Mark);\n\nvar Strike = /*#__PURE__*/function (_Mark) {\n _inherits(Strike, _Mark);\n\n var _super = _createSuper(Strike);\n\n function Strike() {\n _classCallCheck(this, Strike);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Strike, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-d': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"inputRules\",\n value: function inputRules(_ref3) {\n var type = _ref3.type;\n return [markInputRule(/~([^~]+)~$/, type)];\n }\n }, {\n key: \"pasteRules\",\n value: function pasteRules(_ref4) {\n var type = _ref4.type;\n return [markPasteRule(/~([^~]+)~/g, type)];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'strike';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n parseDOM: [{\n tag: 's'\n }, {\n tag: 'del'\n }, {\n tag: 'strike'\n }, {\n style: 'text-decoration',\n getAttrs: function getAttrs(value) {\n return value === 'line-through';\n }\n }],\n toDOM: function toDOM() {\n return ['s', 0];\n }\n };\n }\n }]);\n\n return Strike;\n}(Mark);\n\nvar Underline = /*#__PURE__*/function (_Mark) {\n _inherits(Underline, _Mark);\n\n var _super = _createSuper(Underline);\n\n function Underline() {\n _classCallCheck(this, Underline);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Underline, [{\n key: \"keys\",\n value: function keys(_ref) {\n var type = _ref.type;\n return {\n 'Mod-u': toggleMark(type)\n };\n }\n }, {\n key: \"commands\",\n value: function commands(_ref2) {\n var type = _ref2.type;\n return function () {\n return toggleMark(type);\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'underline';\n }\n }, {\n key: \"schema\",\n get: function get() {\n return {\n parseDOM: [{\n tag: 'u'\n }, {\n style: 'text-decoration',\n getAttrs: function getAttrs(value) {\n return value === 'underline';\n }\n }],\n toDOM: function toDOM() {\n return ['u', 0];\n }\n };\n }\n }]);\n\n return Underline;\n}(Mark);\n\nvar Collaboration = /*#__PURE__*/function (_Extension) {\n _inherits(Collaboration, _Extension);\n\n var _super = _createSuper(Collaboration);\n\n function Collaboration() {\n _classCallCheck(this, Collaboration);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Collaboration, [{\n key: \"init\",\n value: function init() {\n var _this = this;\n\n this.getSendableSteps = this.debounce(function (state) {\n var sendable = sendableSteps(state);\n\n if (sendable) {\n _this.options.onSendable({\n editor: _this.editor,\n sendable: {\n version: sendable.version,\n steps: sendable.steps.map(function (step) {\n return step.toJSON();\n }),\n clientID: sendable.clientID\n }\n });\n }\n }, this.options.debounce);\n this.editor.on('transaction', function (_ref) {\n var state = _ref.state;\n\n _this.getSendableSteps(state);\n });\n }\n }, {\n key: \"debounce\",\n value: function debounce(fn, delay) {\n var timeout;\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(function () {\n fn.apply(void 0, args);\n timeout = null;\n }, delay);\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'collaboration';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n var _this2 = this;\n\n return {\n version: 0,\n clientID: Math.floor(Math.random() * 0xFFFFFFFF),\n debounce: 250,\n onSendable: function onSendable() {},\n update: function update(_ref2) {\n var steps = _ref2.steps,\n version = _ref2.version;\n var _this2$editor = _this2.editor,\n state = _this2$editor.state,\n view = _this2$editor.view,\n schema = _this2$editor.schema;\n\n if (getVersion(state) > version) {\n return;\n }\n\n view.dispatch(receiveTransaction(state, steps.map(function (item) {\n return Step.fromJSON(schema, item.step);\n }), steps.map(function (item) {\n return item.clientID;\n })));\n }\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [collab({\n version: this.options.version,\n clientID: this.options.clientID\n })];\n }\n }]);\n\n return Collaboration;\n}(Extension);\n\nvar Focus = /*#__PURE__*/function (_Extension) {\n _inherits(Focus, _Extension);\n\n var _super = _createSuper(Focus);\n\n function Focus() {\n _classCallCheck(this, Focus);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Focus, [{\n key: \"name\",\n get: function get() {\n return 'focus';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n className: 'has-focus',\n nested: false\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this = this;\n\n return [new Plugin({\n props: {\n decorations: function decorations(_ref) {\n var doc = _ref.doc,\n plugins = _ref.plugins,\n selection = _ref.selection;\n var editablePlugin = plugins.find(function (plugin) {\n return plugin.key.startsWith('editable$');\n });\n var editable = editablePlugin.props.editable();\n var active = editable && _this.options.className;\n var focused = _this.editor.focused;\n var anchor = selection.anchor;\n var decorations = [];\n\n if (!active || !focused) {\n return false;\n }\n\n doc.descendants(function (node, pos) {\n var hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;\n\n if (hasAnchor && !node.isText) {\n var decoration = Decoration.node(pos, pos + node.nodeSize, {\n class: _this.options.className\n });\n decorations.push(decoration);\n }\n\n return _this.options.nested;\n });\n return DecorationSet.create(doc, decorations);\n }\n }\n })];\n }\n }]);\n\n return Focus;\n}(Extension);\n\nvar History = /*#__PURE__*/function (_Extension) {\n _inherits(History, _Extension);\n\n var _super = _createSuper(History);\n\n function History() {\n _classCallCheck(this, History);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(History, [{\n key: \"keys\",\n value: function keys() {\n var keymap = {\n 'Mod-z': undo,\n 'Mod-y': redo,\n 'Shift-Mod-z': redo\n };\n return keymap;\n }\n }, {\n key: \"commands\",\n value: function commands() {\n return {\n undo: function undo$1() {\n return undo;\n },\n redo: function redo$1() {\n return redo;\n },\n undoDepth: function undoDepth$1() {\n return undoDepth;\n },\n redoDepth: function redoDepth$1() {\n return redoDepth;\n }\n };\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'history';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n depth: '',\n newGroupDelay: ''\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n return [history({\n depth: this.options.depth,\n newGroupDelay: this.options.newGroupDelay\n })];\n }\n }]);\n\n return History;\n}(Extension);\n\nvar Placeholder = /*#__PURE__*/function (_Extension) {\n _inherits(Placeholder, _Extension);\n\n var _super = _createSuper(Placeholder);\n\n function Placeholder() {\n _classCallCheck(this, Placeholder);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Placeholder, [{\n key: \"name\",\n get: function get() {\n return 'placeholder';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n emptyEditorClass: 'is-editor-empty',\n emptyNodeClass: 'is-empty',\n emptyNodeText: 'Write something …',\n showOnlyWhenEditable: true,\n showOnlyCurrent: true\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this = this;\n\n return [new Plugin({\n props: {\n decorations: function decorations(_ref) {\n var doc = _ref.doc,\n plugins = _ref.plugins,\n selection = _ref.selection;\n var editablePlugin = plugins.find(function (plugin) {\n return plugin.key.startsWith('editable$');\n });\n var editable = editablePlugin.props.editable();\n var active = editable || !_this.options.showOnlyWhenEditable;\n var anchor = selection.anchor;\n var decorations = [];\n var isEditorEmpty = doc.textContent.length === 0;\n\n if (!active) {\n return false;\n }\n\n doc.descendants(function (node, pos) {\n var hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;\n var isNodeEmpty = node.content.size === 0;\n\n if ((hasAnchor || !_this.options.showOnlyCurrent) && isNodeEmpty) {\n var classes = [_this.options.emptyNodeClass];\n\n if (isEditorEmpty) {\n classes.push(_this.options.emptyEditorClass);\n }\n\n var decoration = Decoration.node(pos, pos + node.nodeSize, {\n class: classes.join(' '),\n 'data-empty-text': typeof _this.options.emptyNodeText === 'function' ? _this.options.emptyNodeText(node) : _this.options.emptyNodeText\n });\n decorations.push(decoration);\n }\n\n return false;\n });\n return DecorationSet.create(doc, decorations);\n }\n }\n })];\n }\n }]);\n\n return Placeholder;\n}(Extension);\n\nvar Search = /*#__PURE__*/function (_Extension) {\n _inherits(Search, _Extension);\n\n var _super = _createSuper(Search);\n\n function Search() {\n var _this;\n\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Search);\n\n _this = _super.call(this, options);\n _this.results = [];\n _this.searchTerm = null;\n _this._updating = false;\n return _this;\n }\n\n _createClass(Search, [{\n key: \"commands\",\n value: function commands() {\n var _this2 = this;\n\n return {\n find: function find(attrs) {\n return _this2.find(attrs);\n },\n replace: function replace(attrs) {\n return _this2.replace(attrs);\n },\n replaceAll: function replaceAll(attrs) {\n return _this2.replaceAll(attrs);\n },\n clearSearch: function clearSearch() {\n return _this2.clear();\n }\n };\n }\n }, {\n key: \"_search\",\n value: function _search(doc) {\n var _this3 = this;\n\n this.results = [];\n var mergedTextNodes = [];\n var index = 0;\n\n if (!this.searchTerm) {\n return;\n }\n\n doc.descendants(function (node, pos) {\n if (node.isText) {\n if (mergedTextNodes[index]) {\n mergedTextNodes[index] = {\n text: mergedTextNodes[index].text + node.text,\n pos: mergedTextNodes[index].pos\n };\n } else {\n mergedTextNodes[index] = {\n text: node.text,\n pos: pos\n };\n }\n } else {\n index += 1;\n }\n });\n mergedTextNodes.forEach(function (_ref) {\n var text = _ref.text,\n pos = _ref.pos;\n var search = _this3.findRegExp;\n var m; // eslint-disable-next-line no-cond-assign\n\n while (m = search.exec(text)) {\n if (m[0] === '') {\n break;\n }\n\n _this3.results.push({\n from: pos + m.index,\n to: pos + m.index + m[0].length\n });\n }\n });\n }\n }, {\n key: \"replace\",\n value: function replace(_replace) {\n var _this4 = this;\n\n return function (state, dispatch) {\n var firstResult = _this4.results[0];\n\n if (!firstResult) {\n return;\n }\n\n var _this4$results$ = _this4.results[0],\n from = _this4$results$.from,\n to = _this4$results$.to;\n dispatch(state.tr.insertText(_replace, from, to));\n\n _this4.editor.commands.find(_this4.searchTerm);\n };\n }\n }, {\n key: \"rebaseNextResult\",\n value: function rebaseNextResult(replace, index) {\n var lastOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var nextIndex = index + 1;\n\n if (!this.results[nextIndex]) {\n return null;\n }\n\n var _this$results$index = this.results[index],\n currentFrom = _this$results$index.from,\n currentTo = _this$results$index.to;\n var offset = currentTo - currentFrom - replace.length + lastOffset;\n var _this$results$nextInd = this.results[nextIndex],\n from = _this$results$nextInd.from,\n to = _this$results$nextInd.to;\n this.results[nextIndex] = {\n to: to - offset,\n from: from - offset\n };\n return offset;\n }\n }, {\n key: \"replaceAll\",\n value: function replaceAll(replace) {\n var _this5 = this;\n\n return function (_ref2, dispatch) {\n var tr = _ref2.tr;\n var offset;\n\n if (!_this5.results.length) {\n return;\n }\n\n _this5.results.forEach(function (_ref3, index) {\n var from = _ref3.from,\n to = _ref3.to;\n tr.insertText(replace, from, to);\n offset = _this5.rebaseNextResult(replace, index, offset);\n });\n\n dispatch(tr);\n\n _this5.editor.commands.find(_this5.searchTerm);\n };\n }\n }, {\n key: \"find\",\n value: function find(searchTerm) {\n var _this6 = this;\n\n return function (state, dispatch) {\n _this6.searchTerm = _this6.options.disableRegex ? searchTerm.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&') : searchTerm;\n\n _this6.updateView(state, dispatch);\n };\n }\n }, {\n key: \"clear\",\n value: function clear() {\n var _this7 = this;\n\n return function (state, dispatch) {\n _this7.searchTerm = null;\n\n _this7.updateView(state, dispatch);\n };\n }\n }, {\n key: \"updateView\",\n value: function updateView(_ref4, dispatch) {\n var tr = _ref4.tr;\n this._updating = true;\n dispatch(tr);\n this._updating = false;\n }\n }, {\n key: \"createDeco\",\n value: function createDeco(doc) {\n this._search(doc);\n\n return this.decorations ? DecorationSet.create(doc, this.decorations) : [];\n }\n }, {\n key: \"name\",\n get: function get() {\n return 'search';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n autoSelectNext: true,\n findClass: 'find',\n searching: false,\n caseSensitive: false,\n disableRegex: true,\n alwaysSearch: false\n };\n }\n }, {\n key: \"findRegExp\",\n get: function get() {\n return RegExp(this.searchTerm, !this.options.caseSensitive ? 'gui' : 'gu');\n }\n }, {\n key: \"decorations\",\n get: function get() {\n var _this8 = this;\n\n return this.results.map(function (deco) {\n return Decoration.inline(deco.from, deco.to, {\n class: _this8.options.findClass\n });\n });\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this9 = this;\n\n return [new Plugin({\n state: {\n init: function init() {\n return DecorationSet.empty;\n },\n apply: function apply(tr, old) {\n if (_this9._updating || _this9.options.searching || tr.docChanged && _this9.options.alwaysSearch) {\n return _this9.createDeco(tr.doc);\n }\n\n if (tr.docChanged) {\n return old.map(tr.mapping, tr.doc);\n }\n\n return old;\n }\n },\n props: {\n decorations: function decorations(state) {\n return this.getState(state);\n }\n }\n })];\n }\n }]);\n\n return Search;\n}(Extension);\n\nvar TrailingNode = /*#__PURE__*/function (_Extension) {\n _inherits(TrailingNode, _Extension);\n\n var _super = _createSuper(TrailingNode);\n\n function TrailingNode() {\n _classCallCheck(this, TrailingNode);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(TrailingNode, [{\n key: \"name\",\n get: function get() {\n return 'trailing_node';\n }\n }, {\n key: \"defaultOptions\",\n get: function get() {\n return {\n node: 'paragraph',\n notAfter: ['paragraph']\n };\n }\n }, {\n key: \"plugins\",\n get: function get() {\n var _this = this;\n\n var plugin = new PluginKey(this.name);\n var disabledNodes = Object.entries(this.editor.schema.nodes).map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n value = _ref2[1];\n\n return value;\n }).filter(function (node) {\n return _this.options.notAfter.includes(node.name);\n });\n return [new Plugin({\n key: plugin,\n view: function view() {\n return {\n update: function update(view) {\n var state = view.state;\n var insertNodeAtEnd = plugin.getState(state);\n\n if (!insertNodeAtEnd) {\n return;\n }\n\n var doc = state.doc,\n schema = state.schema,\n tr = state.tr;\n var type = schema.nodes[_this.options.node];\n var transaction = tr.insert(doc.content.size, type.create());\n view.dispatch(transaction);\n }\n };\n },\n state: {\n init: function init(_, state) {\n var lastNode = state.tr.doc.lastChild;\n return !nodeEqualsType({\n node: lastNode,\n types: disabledNodes\n });\n },\n apply: function apply(tr, value) {\n if (!tr.docChanged) {\n return value;\n }\n\n var lastNode = tr.doc.lastChild;\n return !nodeEqualsType({\n node: lastNode,\n types: disabledNodes\n });\n }\n }\n })];\n }\n }]);\n\n return TrailingNode;\n}(Extension);\n\nexport { Blockquote, Bold, BulletList, Code, CodeBlock, CodeBlockHighlight, Collaboration, Focus, HardBreak, Heading, HighlightPlugin as Highlight, History, HorizontalRule, Image, Italic, Link, ListItem, Mention, OrderedList, Placeholder, Search, Strike, SuggestionsPlugin as Suggestions, Table, TableCell, TableHeader, TableRow, TodoItem, TodoList, TrailingNode, Underline };\n","import { findWrapping, ReplaceAroundStep, canSplit, liftTarget } from 'prosemirror-transform';\nimport { NodeRange, Fragment, Slice } from 'prosemirror-model';\n\nvar olDOM = [\"ol\", 0], ulDOM = [\"ul\", 0], liDOM = [\"li\", 0];\n\n// :: NodeSpec\n// An ordered list [node spec](#model.NodeSpec). Has a single\n// attribute, `order`, which determines the number at which the list\n// starts counting, and defaults to 1. Represented as an `<ol>`\n// element.\nvar orderedList = {\n attrs: {order: {default: 1}},\n parseDOM: [{tag: \"ol\", getAttrs: function getAttrs(dom) {\n return {order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1}\n }}],\n toDOM: function toDOM(node) {\n return node.attrs.order == 1 ? olDOM : [\"ol\", {start: node.attrs.order}, 0]\n }\n};\n\n// :: NodeSpec\n// A bullet list node spec, represented in the DOM as `<ul>`.\nvar bulletList = {\n parseDOM: [{tag: \"ul\"}],\n toDOM: function toDOM() { return ulDOM }\n};\n\n// :: NodeSpec\n// A list item (`<li>`) spec.\nvar listItem = {\n parseDOM: [{tag: \"li\"}],\n toDOM: function toDOM() { return liDOM },\n defining: true\n};\n\nfunction add(obj, props) {\n var copy = {};\n for (var prop in obj) { copy[prop] = obj[prop]; }\n for (var prop$1 in props) { copy[prop$1] = props[prop$1]; }\n return copy\n}\n\n// :: (OrderedMap<NodeSpec>, string, ?string) → OrderedMap<NodeSpec>\n// Convenience function for adding list-related node types to a map\n// specifying the nodes for a schema. Adds\n// [`orderedList`](#schema-list.orderedList) as `\"ordered_list\"`,\n// [`bulletList`](#schema-list.bulletList) as `\"bullet_list\"`, and\n// [`listItem`](#schema-list.listItem) as `\"list_item\"`.\n//\n// `itemContent` determines the content expression for the list items.\n// If you want the commands defined in this module to apply to your\n// list structure, it should have a shape like `\"paragraph block*\"` or\n// `\"paragraph (ordered_list | bullet_list)*\"`. `listGroup` can be\n// given to assign a group name to the list node types, for example\n// `\"block\"`.\nfunction addListNodes(nodes, itemContent, listGroup) {\n return nodes.append({\n ordered_list: add(orderedList, {content: \"list_item+\", group: listGroup}),\n bullet_list: add(bulletList, {content: \"list_item+\", group: listGroup}),\n list_item: add(listItem, {content: itemContent})\n })\n}\n\n// :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Returns a command function that wraps the selection in a list with\n// the given type an attributes. If `dispatch` is null, only return a\n// value to indicate whether this is possible, but don't actually\n// perform the change.\nfunction wrapInList(listType, attrs) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to), doJoin = false, outerRange = range;\n if (!range) { return false }\n // This is at the top of an existing list item\n if (range.depth >= 2 && $from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {\n // Don't do anything if this is the top of the list\n if ($from.index(range.depth - 1) == 0) { return false }\n var $insert = state.doc.resolve(range.start - 2);\n outerRange = new NodeRange($insert, $insert, range.depth);\n if (range.endIndex < range.parent.childCount)\n { range = new NodeRange($from, state.doc.resolve($to.end(range.depth)), range.depth); }\n doJoin = true;\n }\n var wrap = findWrapping(outerRange, listType, attrs, range);\n if (!wrap) { return false }\n if (dispatch) { dispatch(doWrapInList(state.tr, range, wrap, doJoin, listType).scrollIntoView()); }\n return true\n }\n}\n\nfunction doWrapInList(tr, range, wrappers, joinBefore, listType) {\n var content = Fragment.empty;\n for (var i = wrappers.length - 1; i >= 0; i--)\n { content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content)); }\n\n tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end,\n new Slice(content, 0, 0), wrappers.length, true));\n\n var found = 0;\n for (var i$1 = 0; i$1 < wrappers.length; i$1++) { if (wrappers[i$1].type == listType) { found = i$1 + 1; } }\n var splitDepth = wrappers.length - found;\n\n var splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;\n for (var i$2 = range.startIndex, e = range.endIndex, first = true; i$2 < e; i$2++, first = false) {\n if (!first && canSplit(tr.doc, splitPos, splitDepth)) {\n tr.split(splitPos, splitDepth);\n splitPos += 2 * splitDepth;\n }\n splitPos += parent.child(i$2).nodeSize;\n }\n return tr\n}\n\n// :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Build a command that splits a non-empty textblock at the top level\n// of a list item by also splitting that list item.\nfunction splitListItem(itemType) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var node = ref.node;\n if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to)) { return false }\n var grandParent = $from.node(-1);\n if (grandParent.type != itemType) { return false }\n if ($from.parent.content.size == 0) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 2 || $from.node(-3).type != itemType ||\n $from.index(-2) != $from.node(-2).childCount - 1) { return false }\n if (dispatch) {\n var wrap = Fragment.empty, keepItem = $from.index(-1) > 0;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (var d = $from.depth - (keepItem ? 1 : 2); d >= $from.depth - 3; d--)\n { wrap = Fragment.from($from.node(d).copy(wrap)); }\n // Add a second list item with an empty default start node\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n var tr$1 = state.tr.replace($from.before(keepItem ? null : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));\n tr$1.setSelection(state.selection.constructor.near(tr$1.doc.resolve($from.pos + (keepItem ? 3 : 2))));\n dispatch(tr$1.scrollIntoView());\n }\n return true\n }\n var nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n var tr = state.tr.delete($from.pos, $to.pos);\n var types = nextType && [null, {type: nextType}];\n if (!canSplit(tr.doc, $from.pos, 2, types)) { return false }\n if (dispatch) { dispatch(tr.split($from.pos, 2, types).scrollIntoView()); }\n return true\n }\n}\n\n// :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Create a command to lift the list item around the selection up into\n// a wrapping list.\nfunction liftListItem(itemType) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to, function (node) { return node.childCount && node.firstChild.type == itemType; });\n if (!range) { return false }\n if (!dispatch) { return true }\n if ($from.node(range.depth - 1).type == itemType) // Inside a parent list\n { return liftToOuterList(state, dispatch, itemType, range) }\n else // Outer list node\n { return liftOutOfList(state, dispatch, range) }\n }\n}\n\nfunction liftToOuterList(state, dispatch, itemType, range) {\n var tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);\n if (end < endOfList) {\n // There are siblings after the lifted items, which must become\n // children of the last item\n tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList,\n new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));\n range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);\n }\n dispatch(tr.lift(range, liftTarget(range)).scrollIntoView());\n return true\n}\n\nfunction liftOutOfList(state, dispatch, range) {\n var tr = state.tr, list = range.parent;\n // Merge the list items into a single big item\n for (var pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {\n pos -= list.child(i).nodeSize;\n tr.delete(pos - 1, pos + 1);\n }\n var $start = tr.doc.resolve(range.start), item = $start.nodeAfter;\n var atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;\n var parent = $start.node(-1), indexBefore = $start.index(-1);\n if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1,\n item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))\n { return false }\n var start = $start.pos, end = start + item.nodeSize;\n // Strip off the surrounding list. At the sides where we're not at\n // the end of the list, the existing list is closed. At sides where\n // this is the end, it is overwritten to its end.\n tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1,\n new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty)))\n .append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))),\n atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));\n dispatch(tr.scrollIntoView());\n return true\n}\n\n// :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool\n// Create a command to sink the list item around the selection down\n// into an inner list.\nfunction sinkListItem(itemType) {\n return function(state, dispatch) {\n var ref = state.selection;\n var $from = ref.$from;\n var $to = ref.$to;\n var range = $from.blockRange($to, function (node) { return node.childCount && node.firstChild.type == itemType; });\n if (!range) { return false }\n var startIndex = range.startIndex;\n if (startIndex == 0) { return false }\n var parent = range.parent, nodeBefore = parent.child(startIndex - 1);\n if (nodeBefore.type != itemType) { return false }\n\n if (dispatch) {\n var nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;\n var inner = Fragment.from(nestedBefore ? itemType.create() : null);\n var slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))),\n nestedBefore ? 3 : 1, 0);\n var before = range.start, after = range.end;\n dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after,\n before, after, slice, 1, true))\n .scrollIntoView());\n }\n return true\n }\n}\n\nexport { addListNodes, bulletList, liftListItem, listItem, orderedList, sinkListItem, splitListItem, wrapInList };\n//# sourceMappingURL=index.es.js.map\n","\n /*!\n * tiptap-commands v1.12.7\n * (c) 2020 Scrumpy UG (limited liability)\n * @license MIT\n */\n \nimport { setBlockType, lift, wrapIn } from 'prosemirror-commands';\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, setBlockType, splitBlock, splitBlockKeepMarks, toggleMark, wrapIn } from 'prosemirror-commands';\nimport { liftListItem, wrapInList } from 'prosemirror-schema-list';\nexport { addListNodes, liftListItem, sinkListItem, splitListItem, wrapInList } from 'prosemirror-schema-list';\nimport { InputRule } from 'prosemirror-inputrules';\nexport { textblockTypeInputRule, wrappingInputRule } from 'prosemirror-inputrules';\nimport { Plugin } from 'prosemirror-state';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { getMarkRange, nodeIsActive } from 'tiptap-utils';\nimport { findParentNode } from 'prosemirror-utils';\n\nfunction insertText () {\n var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n return function (state, dispatch) {\n var $from = state.selection.$from;\n var pos = $from.pos.pos;\n dispatch(state.tr.insertText(text, pos));\n return true;\n };\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction getMarksBetween(start, end, state) {\n var marks = [];\n state.doc.nodesBetween(start, end, function (node, pos) {\n marks = [].concat(_toConsumableArray(marks), _toConsumableArray(node.marks.map(function (mark) {\n return {\n start: pos,\n end: pos + node.nodeSize,\n mark: mark\n };\n })));\n });\n return marks;\n}\n\nfunction markInputRule (regexp, markType, getAttrs) {\n return new InputRule(regexp, function (state, match, start, end) {\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n var tr = state.tr;\n var m = match.length - 1;\n var markEnd = end;\n var markStart = start;\n\n if (match[m]) {\n var matchStart = start + match[0].indexOf(match[m - 1]);\n var matchEnd = matchStart + match[m - 1].length - 1;\n var textStart = matchStart + match[m - 1].lastIndexOf(match[m]);\n var textEnd = textStart + match[m].length;\n var excludedMarks = getMarksBetween(start, end, state).filter(function (item) {\n var excluded = item.mark.type.excluded;\n return excluded.find(function (type) {\n return type.name === markType.name;\n });\n }).filter(function (item) {\n return item.end > matchStart;\n });\n\n if (excludedMarks.length) {\n return false;\n }\n\n if (textEnd < matchEnd) {\n tr.delete(textEnd, matchEnd);\n }\n\n if (textStart > matchStart) {\n tr.delete(matchStart, textStart);\n }\n\n markStart = matchStart;\n markEnd = markStart + match[m].length;\n }\n\n tr.addMark(markStart, markEnd, markType.create(attrs));\n tr.removeStoredMark(markType);\n return tr;\n });\n}\n\nfunction nodeInputRule (regexp, type, getAttrs) {\n return new InputRule(regexp, function (state, match, start, end) {\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n var tr = state.tr;\n\n if (match[0]) {\n tr.replaceWith(start - 1, end, type.create(attrs));\n }\n\n return tr;\n });\n}\n\nfunction pasteRule (regexp, type, getAttrs) {\n var handler = function handler(fragment) {\n var nodes = [];\n fragment.forEach(function (child) {\n if (child.isText) {\n var text = child.text;\n var pos = 0;\n var match;\n\n do {\n match = regexp.exec(text);\n\n if (match) {\n var start = match.index;\n var end = start + match[0].length;\n var attrs = getAttrs instanceof Function ? getAttrs(match[0]) : getAttrs;\n\n if (start > 0) {\n nodes.push(child.cut(pos, start));\n }\n\n nodes.push(child.cut(start, end).mark(type.create(attrs).addToSet(child.marks)));\n pos = end;\n }\n } while (match);\n\n if (pos < text.length) {\n nodes.push(child.cut(pos));\n }\n } else {\n nodes.push(child.copy(handler(child.content)));\n }\n });\n return Fragment.fromArray(nodes);\n };\n\n return new Plugin({\n props: {\n transformPasted: function transformPasted(slice) {\n return new Slice(handler(slice.content), slice.openStart, slice.openEnd);\n }\n }\n });\n}\n\nfunction markPasteRule (regexp, type, getAttrs) {\n var handler = function handler(fragment, parent) {\n var nodes = [];\n fragment.forEach(function (child) {\n if (child.isText) {\n var text = child.text,\n marks = child.marks;\n var pos = 0;\n var match;\n var isLink = !!marks.filter(function (x) {\n return x.type.name === 'link';\n })[0]; // eslint-disable-next-line\n\n while (!isLink && (match = regexp.exec(text)) !== null) {\n if (parent.type.allowsMarkType(type) && match[1]) {\n var start = match.index;\n var end = start + match[0].length;\n var textStart = start + match[0].indexOf(match[1]);\n var textEnd = textStart + match[1].length;\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs; // adding text before markdown to nodes\n\n if (start > 0) {\n nodes.push(child.cut(pos, start));\n } // adding the markdown part to nodes\n\n\n nodes.push(child.cut(textStart, textEnd).mark(type.create(attrs).addToSet(child.marks)));\n pos = end;\n }\n } // adding rest of text to nodes\n\n\n if (pos < text.length) {\n nodes.push(child.cut(pos));\n }\n } else {\n nodes.push(child.copy(handler(child.content, child)));\n }\n });\n return Fragment.fromArray(nodes);\n };\n\n return new Plugin({\n props: {\n transformPasted: function transformPasted(slice) {\n return new Slice(handler(slice.content), slice.openStart, slice.openEnd);\n }\n }\n });\n}\n\nfunction removeMark (type) {\n return function (state, dispatch) {\n var tr = state.tr,\n selection = state.selection;\n var from = selection.from,\n to = selection.to;\n var $from = selection.$from,\n empty = selection.empty;\n\n if (empty) {\n var range = getMarkRange($from, type);\n from = range.from;\n to = range.to;\n }\n\n tr.removeMark(from, to, type);\n return dispatch(tr);\n };\n}\n\nfunction replaceText () {\n var range = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var type = arguments.length > 1 ? arguments[1] : undefined;\n var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return function (state, dispatch) {\n var _state$selection = state.selection,\n $from = _state$selection.$from,\n $to = _state$selection.$to;\n var index = $from.index();\n var from = range ? range.from : $from.pos;\n var to = range ? range.to : $to.pos;\n\n if (!$from.parent.canReplaceWith(index, index, type)) {\n return false;\n }\n\n if (dispatch) {\n dispatch(state.tr.replaceWith(from, to, type.create(attrs)));\n }\n\n return true;\n };\n}\n\nfunction setInlineBlockType (type) {\n var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return function (state, dispatch) {\n var $from = state.selection.$from;\n var index = $from.index();\n\n if (!$from.parent.canReplaceWith(index, index, type)) {\n return false;\n }\n\n if (dispatch) {\n dispatch(state.tr.replaceSelectionWith(type.create(attrs)));\n }\n\n return true;\n };\n}\n\n// see https://github.com/ProseMirror/prosemirror-transform/blob/master/src/structure.js\n// Since this piece of code was \"borrowed\" from prosemirror, ESLint rules are ignored.\n\n/* eslint-disable max-len, no-plusplus, no-undef, eqeqeq */\n\nfunction canSplit(doc, pos) {\n var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var typesAfter = arguments.length > 3 ? arguments[3] : undefined;\n var $pos = doc.resolve(pos);\n var base = $pos.depth - depth;\n var innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;\n\n for (var d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n var node = $pos.node(d);\n\n var _index = $pos.index(d);\n\n if (node.type.spec.isolating) return false;\n var rest = node.content.cutByIndex(_index, node.childCount);\n var after = typesAfter && typesAfter[i] || node;\n if (after != node) rest = rest.replaceChild(0, after.type.create(after.attrs));\n /* Change starts from here */\n // if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest))\n // return false\n\n if (!node.canReplace(_index + 1, node.childCount)) return false;\n /* Change ends here */\n }\n\n var index = $pos.indexAfter(base);\n var baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);\n} // this is a copy of splitListItem\n// see https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js\n\n\nfunction splitToDefaultListItem(itemType) {\n return function (state, dispatch) {\n var _state$selection = state.selection,\n $from = _state$selection.$from,\n $to = _state$selection.$to,\n node = _state$selection.node;\n if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;\n var grandParent = $from.node(-1);\n if (grandParent.type != itemType) return false;\n\n if ($from.parent.content.size == 0) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 2 || $from.node(-3).type != itemType || $from.index(-2) != $from.node(-2).childCount - 1) return false;\n\n if (dispatch) {\n var wrap = Fragment.empty;\n var keepItem = $from.index(-1) > 0; // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n\n for (var d = $from.depth - (keepItem ? 1 : 2); d >= $from.depth - 3; d--) {\n wrap = Fragment.from($from.node(d).copy(wrap));\n } // Add a second list item with an empty default start node\n\n\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n\n var _tr = state.tr.replace($from.before(keepItem ? null : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));\n\n _tr.setSelection(state.selection.constructor.near(_tr.doc.resolve($from.pos + (keepItem ? 3 : 2))));\n\n dispatch(_tr.scrollIntoView());\n }\n\n return true;\n }\n\n var nextType = $to.pos == $from.end() ? grandParent.contentMatchAt($from.indexAfter(-1)).defaultType : null;\n var tr = state.tr.delete($from.pos, $to.pos);\n /* Change starts from here */\n // let types = nextType && [null, {type: nextType}]\n\n var types = nextType && [{\n type: itemType\n }, {\n type: nextType\n }];\n if (!types) types = [{\n type: itemType\n }, null];\n /* Change ends here */\n\n if (!canSplit(tr.doc, $from.pos, 2, types)) return false;\n if (dispatch) dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n return true;\n };\n}\n/* eslint-enable max-len, no-plusplus, no-undef, eqeqeq */\n\nfunction toggleBlockType (type, toggletype) {\n var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return function (state, dispatch, view) {\n var isActive = nodeIsActive(state, type, attrs);\n\n if (isActive) {\n return setBlockType(toggletype)(state, dispatch, view);\n }\n\n return setBlockType(type, attrs)(state, dispatch, view);\n };\n}\n\nfunction isList(node, schema) {\n return node.type === schema.nodes.bullet_list || node.type === schema.nodes.ordered_list || node.type === schema.nodes.todo_list;\n}\n\nfunction toggleList(listType, itemType) {\n return function (state, dispatch, view) {\n var schema = state.schema,\n selection = state.selection;\n var $from = selection.$from,\n $to = selection.$to;\n var range = $from.blockRange($to);\n\n if (!range) {\n return false;\n }\n\n var parentList = findParentNode(function (node) {\n return isList(node, schema);\n })(selection);\n\n if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {\n if (parentList.node.type === listType) {\n return liftListItem(itemType)(state, dispatch, view);\n }\n\n if (isList(parentList.node, schema) && listType.validContent(parentList.node.content)) {\n var tr = state.tr;\n tr.setNodeMarkup(parentList.pos, listType);\n\n if (dispatch) {\n dispatch(tr);\n }\n\n return false;\n }\n }\n\n return wrapInList(listType)(state, dispatch, view);\n };\n}\n\nfunction toggleWrap (type) {\n return function (state, dispatch, view) {\n var isActive = nodeIsActive(state, type);\n\n if (isActive) {\n return lift(state, dispatch);\n }\n\n return wrapIn(type)(state, dispatch, view);\n };\n}\n\nfunction updateMark (type, attrs) {\n return function (state, dispatch) {\n var tr = state.tr,\n selection = state.selection,\n doc = state.doc;\n var from = selection.from,\n to = selection.to;\n var $from = selection.$from,\n empty = selection.empty;\n\n if (empty) {\n var range = getMarkRange($from, type);\n from = range.from;\n to = range.to;\n }\n\n var hasMark = doc.rangeHasMark(from, to, type);\n\n if (hasMark) {\n tr.removeMark(from, to, type);\n }\n\n tr.addMark(from, to, type.create(attrs));\n return dispatch(tr);\n };\n}\n\nexport { insertText, markInputRule, markPasteRule, nodeInputRule, pasteRule, removeMark, replaceText, setInlineBlockType, splitToDefaultListItem, toggleBlockType, toggleList, toggleWrap, updateMark };\n","import { Plugin } from 'prosemirror-state';\nimport { findWrapping, canJoin } from 'prosemirror-transform';\n\n// ::- Input rules are regular expressions describing a piece of text\n// that, when typed, causes something to happen. This might be\n// changing two dashes into an emdash, wrapping a paragraph starting\n// with `\"> \"` into a blockquote, or something entirely different.\nvar InputRule = function InputRule(match, handler) {\n this.match = match;\n this.handler = typeof handler == \"string\" ? stringHandler(handler) : handler;\n};\n\nfunction stringHandler(string) {\n return function(state, match, start, end) {\n var insert = string;\n if (match[1]) {\n var offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n var cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n return state.tr.insertText(insert, start, end)\n }\n}\n\nvar MAX_MATCH = 500;\n\n// :: (config: {rules: [InputRule]}) → Plugin\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.\nfunction inputRules(ref) {\n var rules = ref.rules;\n\n var plugin = new Plugin({\n state: {\n init: function init() { return null },\n apply: function apply(tr, prev) {\n var stored = tr.getMeta(this);\n if (stored) { return stored }\n return tr.selectionSet || tr.docChanged ? null : prev\n }\n },\n\n props: {\n handleTextInput: function handleTextInput(view, from, to, text) {\n return run(view, from, to, text, rules, plugin)\n },\n handleDOMEvents: {\n compositionend: function (view) {\n setTimeout(function () {\n var ref = view.state.selection;\n var $cursor = ref.$cursor;\n if ($cursor) { run(view, $cursor.pos, $cursor.pos, \"\", rules, plugin); }\n });\n }\n }\n },\n\n isInputRules: true\n });\n return plugin\n}\n\nfunction run(view, from, to, text, rules, plugin) {\n if (view.composing) { return false }\n var state = view.state, $from = state.doc.resolve(from);\n if ($from.parent.type.spec.code) { return false }\n var textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - MAX_MATCH), $from.parentOffset,\n null, \"\\ufffc\") + text;\n for (var i = 0; i < rules.length; i++) {\n var match = rules[i].match.exec(textBefore);\n var tr = match && rules[i].handler(state, match, from - (match[0].length - text.length), to);\n if (!tr) { continue }\n view.dispatch(tr.setMeta(plugin, {transform: tr, from: from, to: to, text: text}));\n return true\n }\n return false\n}\n\n// :: (EditorState, ?(Transaction)) → bool\n// This is a command that will undo an input rule, if applying such a\n// rule was the last thing that the user did.\nfunction undoInputRule(state, dispatch) {\n var plugins = state.plugins;\n for (var i = 0; i < plugins.length; i++) {\n var plugin = plugins[i], undoable = (void 0);\n if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n if (dispatch) {\n var tr = state.tr, toUndo = undoable.transform;\n for (var j = toUndo.steps.length - 1; j >= 0; j--)\n { tr.step(toUndo.steps[j].invert(toUndo.docs[j])); }\n var marks = tr.doc.resolve(undoable.from).marks();\n dispatch(tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks)));\n }\n return true\n }\n }\n return false\n}\n\n// :: InputRule Converts double dashes to an emdash.\nvar emDash = new InputRule(/--$/, \"—\");\n// :: InputRule Converts three dots to an ellipsis character.\nvar ellipsis = new InputRule(/\\.\\.\\.$/, \"…\");\n// :: InputRule “Smart” opening double quotes.\nvar openDoubleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(\")$/, \"“\");\n// :: InputRule “Smart” closing double quotes.\nvar closeDoubleQuote = new InputRule(/\"$/, \"”\");\n// :: InputRule “Smart” opening single quotes.\nvar openSingleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(')$/, \"‘\");\n// :: InputRule “Smart” closing single quotes.\nvar closeSingleQuote = new InputRule(/'$/, \"’\");\n\n// :: [InputRule] Smart-quote related input rules.\nvar smartQuotes = [openDoubleQuote, closeDoubleQuote, openSingleQuote, closeSingleQuote];\n\n// :: (RegExp, NodeType, ?union<Object, ([string]) → ?Object>, ?([string], Node) → bool) → InputRule\n// Build an input rule for automatically wrapping a textblock when a\n// given string is typed. The `regexp` argument is\n// directly passed through to the `InputRule` constructor. 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// `nodeType` is the type of node to wrap in. If it needs attributes,\n// you can either pass them directly, or pass a function that will\n// compute them from the regular expression match.\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](#transform.Transform.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.\nfunction wrappingInputRule(regexp, nodeType, getAttrs, joinPredicate) {\n return new InputRule(regexp, function (state, match, start, end) {\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n var tr = state.tr.delete(start, end);\n var $start = tr.doc.resolve(start), range = $start.blockRange(), wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping) { return null }\n tr.wrap(range, wrapping);\n var before = tr.doc.resolve(start - 1).nodeBefore;\n if (before && before.type == nodeType && canJoin(tr.doc, start - 1) &&\n (!joinPredicate || joinPredicate(match, before)))\n { tr.join(start - 1); }\n return tr\n })\n}\n\n// :: (RegExp, NodeType, ?union<Object, ([string]) → ?Object>) → InputRule\n// Build an input rule that changes the type of a textblock when the\n// matched text is typed into it. You'll usually want to start your\n// regexp with `^` to that it is only matched at the start of a\n// textblock. The optional `getAttrs` parameter can be used to compute\n// the new node's attributes, and works the same as in the\n// `wrappingInputRule` function.\nfunction textblockTypeInputRule(regexp, nodeType, getAttrs) {\n return new InputRule(regexp, function (state, match, start, end) {\n var $start = state.doc.resolve(start);\n var attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType)) { return null }\n return state.tr\n .delete(start, end)\n .setBlockType(start, start, nodeType, attrs)\n })\n}\n\nexport { InputRule, closeDoubleQuote, closeSingleQuote, ellipsis, emDash, inputRules, openDoubleQuote, openSingleQuote, smartQuotes, textblockTypeInputRule, undoInputRule, wrappingInputRule };\n//# sourceMappingURL=index.es.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar prosemirrorState = require('prosemirror-state');\nvar prosemirrorModel = require('prosemirror-model');\nvar prosemirrorTables = require('prosemirror-tables');\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a node of a given `nodeType`. It will return an original transaction if parent node hasn't been found.\n//\n// ```javascript\n// dispatch(\n// removeParentNodeOfType(schema.nodes.table)(tr)\n// );\n// ```\nvar removeParentNodeOfType = function removeParentNodeOfType(nodeType) {\n return function (tr) {\n var parent = findParentNodeOfType(nodeType)(tr.selection);\n if (parent) {\n return removeNodeAtPos(parent.pos)(tr);\n }\n return tr;\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>, content: union<ProseMirrorNode, Fragment>) → (tr: Transaction) → Transaction\n// Returns a new transaction that replaces parent node of a given `nodeType` with the given `content`. It will return an original transaction if either parent node hasn't been found or replacing is not possible.\n//\n// ```javascript\n// const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));\n//\n// dispatch(\n// replaceParentNodeOfType(schema.nodes.table, node)(tr)\n// );\n// ```\nvar replaceParentNodeOfType = function replaceParentNodeOfType(nodeType, content) {\n return function (tr) {\n if (!Array.isArray(nodeType)) {\n nodeType = [nodeType];\n }\n for (var i = 0, count = nodeType.length; i < count; i++) {\n var parent = findParentNodeOfType(nodeType[i])(tr.selection);\n if (parent) {\n var newTr = replaceNodeAtPos(parent.pos, content)(tr);\n if (newTr !== tr) {\n return newTr;\n }\n }\n }\n return tr;\n };\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected node. It will return an original transaction if current selection is not a `NodeSelection`.\n//\n// ```javascript\n// dispatch(\n// removeSelectedNode(tr)\n// );\n// ```\nvar removeSelectedNode = function removeSelectedNode(tr) {\n if (isNodeSelection(tr.selection)) {\n var from = tr.selection.$from.pos;\n var to = tr.selection.$to.pos;\n return cloneTr(tr.delete(from, to));\n }\n return tr;\n};\n\n// :: (content: union<ProseMirrorNode, ProseMirrorFragment>) → (tr: Transaction) → Transaction\n// Returns a new transaction that replaces selected node with a given `node`, keeping NodeSelection on the new `node`.\n// It will return the original transaction if either current selection is not a NodeSelection or replacing is not possible.\n//\n// ```javascript\n// const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));\n// dispatch(\n// replaceSelectedNode(node)(tr)\n// );\n// ```\nvar replaceSelectedNode = function replaceSelectedNode(content) {\n return function (tr) {\n if (isNodeSelection(tr.selection)) {\n var _tr$selection = tr.selection,\n $from = _tr$selection.$from,\n $to = _tr$selection.$to;\n\n if (content instanceof prosemirrorModel.Fragment && $from.parent.canReplace($from.index(), $from.indexAfter(), content) || $from.parent.canReplaceWith($from.index(), $from.indexAfter(), content.type)) {\n return cloneTr(tr.replaceWith($from.pos, $to.pos, content)\n // restore node selection\n .setSelection(new prosemirrorState.NodeSelection(tr.doc.resolve($from.pos))));\n }\n }\n return tr;\n };\n};\n\n// :: (position: number, dir: ?number) → (tr: Transaction) → Transaction\n// Returns a new transaction that tries to find a valid cursor selection starting at the given `position`\n// and searching back if `dir` is negative, and forward if positive.\n// If a valid cursor position hasn't been found, it will return the original transaction.\n//\n// ```javascript\n// dispatch(\n// setTextSelection(5)(tr)\n// );\n// ```\nvar setTextSelection = function setTextSelection(position) {\n var dir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n return function (tr) {\n var nextSelection = prosemirrorState.Selection.findFrom(tr.doc.resolve(position), dir, true);\n if (nextSelection) {\n return tr.setSelection(nextSelection);\n }\n return tr;\n };\n};\n\nvar isSelectableNode = function isSelectableNode(node) {\n return node.type && node.type.spec.selectable;\n};\nvar shouldSelectNode = function shouldSelectNode(node) {\n return isSelectableNode(node) && node.type.isLeaf;\n};\n\nvar setSelection = function setSelection(node, pos, tr) {\n if (shouldSelectNode(node)) {\n return tr.setSelection(new prosemirrorState.NodeSelection(tr.doc.resolve(pos)));\n }\n return setTextSelection(pos)(tr);\n};\n\n// :: (content: union<ProseMirrorNode, Fragment>, position: ?number, tryToReplace?: boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that inserts a given `content` at the current cursor position, or at a given `position`, if it is allowed by schema. If schema restricts such nesting, it will try to find an appropriate place for a given node in the document, looping through parent nodes up until the root document node.\n// If `tryToReplace` is true and current selection is a NodeSelection, it will replace selected node with inserted content if its allowed by schema.\n// If cursor is inside of an empty paragraph, it will try to replace that paragraph with the given content. If insertion is successful and inserted node has content, it will set cursor inside of that content.\n// It will return an original transaction if the place for insertion hasn't been found.\n//\n// ```javascript\n// const node = schema.nodes.extension.createChecked({});\n// dispatch(\n// safeInsert(node)(tr)\n// );\n// ```\nvar safeInsert = function safeInsert(content, position, tryToReplace) {\n return function (tr) {\n var hasPosition = typeof position === 'number';\n var $from = tr.selection.$from;\n\n var $insertPos = hasPosition ? tr.doc.resolve(position) : isNodeSelection(tr.selection) ? tr.doc.resolve($from.pos + 1) : $from;\n var parent = $insertPos.parent;\n\n // try to replace selected node\n\n if (isNodeSelection(tr.selection) && tryToReplace) {\n var oldTr = tr;\n tr = replaceSelectedNode(content)(tr);\n if (oldTr !== tr) {\n return tr;\n }\n }\n\n // try to replace an empty paragraph\n if (isEmptyParagraph(parent)) {\n var _oldTr = tr;\n tr = replaceParentNodeOfType(parent.type, content)(tr);\n if (_oldTr !== tr) {\n var pos = isSelectableNode(content) ? // for selectable node, selection position would be the position of the replaced parent\n $insertPos.before($insertPos.depth) : $insertPos.pos;\n return setSelection(content, pos, tr);\n }\n }\n\n // given node is allowed at the current cursor position\n if (canInsert($insertPos, content)) {\n tr.insert($insertPos.pos, content);\n var _pos = hasPosition ? $insertPos.pos : isSelectableNode(content) ? // for atom nodes selection position after insertion is the previous pos\n tr.selection.$anchor.pos - 1 : tr.selection.$anchor.pos;\n return cloneTr(setSelection(content, _pos, tr));\n }\n\n // looking for a place in the doc where the node is allowed\n for (var i = $insertPos.depth; i > 0; i--) {\n var _pos2 = $insertPos.after(i);\n var $pos = tr.doc.resolve(_pos2);\n if (canInsert($pos, content)) {\n tr.insert(_pos2, content);\n return cloneTr(setSelection(content, _pos2, tr));\n }\n }\n return tr;\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>, type: ?union<NodeType, null>, attrs: ?union<Object, null>, marks?: [Mark]) → (tr: Transaction) → Transaction\n// Returns a transaction that changes the type, attributes, and/or marks of the parent node of a given `nodeType`.\n//\n// ```javascript\n// const node = schema.nodes.extension.createChecked({});\n// dispatch(\n// setParentNodeMarkup(schema.nodes.panel, null, { panelType })(tr);\n// );\n// ```\nvar setParentNodeMarkup = function setParentNodeMarkup(nodeType, type, attrs, marks) {\n return function (tr) {\n var parent = findParentNodeOfType(nodeType)(tr.selection);\n if (parent) {\n return cloneTr(tr.setNodeMarkup(parent.pos, type, Object.assign({}, parent.node.attrs, attrs), marks));\n }\n return tr;\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (tr: Transaction) → Transaction\n// Returns a new transaction that sets a `NodeSelection` on a parent node of a `given nodeType`.\n//\n// ```javascript\n// dispatch(\n// selectParentNodeOfType([tableCell, tableHeader])(state.tr)\n// );\n// ```\nvar selectParentNodeOfType = function selectParentNodeOfType(nodeType) {\n return function (tr) {\n if (!isNodeSelection(tr.selection)) {\n var parent = findParentNodeOfType(nodeType)(tr.selection);\n if (parent) {\n return cloneTr(tr.setSelection(prosemirrorState.NodeSelection.create(tr.doc, parent.pos)));\n }\n }\n return tr;\n };\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that deletes previous node.\n//\n// ```javascript\n// dispatch(\n// removeNodeBefore(state.tr)\n// );\n// ```\nvar removeNodeBefore = function removeNodeBefore(tr) {\n var position = findPositionOfNodeBefore(tr.selection);\n if (typeof position === 'number') {\n return removeNodeAtPos(position)(tr);\n }\n return tr;\n};\n\n// :: (selection: Selection) → boolean\n// Checks if current selection is a `NodeSelection`.\n//\n// ```javascript\n// if (isNodeSelection(tr.selection)) {\n// // ...\n// }\n// ```\nvar isNodeSelection = function isNodeSelection(selection) {\n return selection instanceof prosemirrorState.NodeSelection;\n};\n\n// (nodeType: union<NodeType, [NodeType]>) → boolean\n// Checks if the type a given `node` equals to a given `nodeType`.\nvar equalNodeType = function equalNodeType(nodeType, node) {\n return Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1 || node.type === nodeType;\n};\n\n// (tr: Transaction) → Transaction\n// Creates a new transaction object from a given transaction\nvar cloneTr = function cloneTr(tr) {\n return Object.assign(Object.create(tr), tr).setTime(Date.now());\n};\n\n// (position: number, content: union<ProseMirrorNode, Fragment>) → (tr: Transaction) → Transaction\n// Returns a `replace` transaction that replaces a node at a given position with the given `content`.\n// It will return the original transaction if replacing is not possible.\n// `position` should point at the position immediately before the node.\nvar replaceNodeAtPos = function replaceNodeAtPos(position, content) {\n return function (tr) {\n var node = tr.doc.nodeAt(position);\n var $pos = tr.doc.resolve(position);\n if (canReplace($pos, content)) {\n tr = tr.replaceWith(position, position + node.nodeSize, content);\n var start = tr.selection.$from.pos - 1;\n // put cursor inside of the inserted node\n tr = setTextSelection(Math.max(start, 0), -1)(tr);\n // move cursor to the start of the node\n tr = setTextSelection(tr.selection.$from.start())(tr);\n return cloneTr(tr);\n }\n return tr;\n };\n};\n\n// ($pos: ResolvedPos, doc: ProseMirrorNode, content: union<ProseMirrorNode, Fragment>, ) → boolean\n// Checks if replacing a node at a given `$pos` inside of the `doc` node with the given `content` is possible.\nvar canReplace = function canReplace($pos, content) {\n var node = $pos.node($pos.depth);\n return node && node.type.validContent(content instanceof prosemirrorModel.Fragment ? content : prosemirrorModel.Fragment.from(content));\n};\n\n// (position: number) → (tr: Transaction) → Transaction\n// Returns a `delete` transaction that removes a node at a given position with the given `node`.\n// `position` should point at the position immediately before the node.\nvar removeNodeAtPos = function removeNodeAtPos(position) {\n return function (tr) {\n var node = tr.doc.nodeAt(position);\n return cloneTr(tr.delete(position, position + node.nodeSize));\n };\n};\n\n// (schema: Schema) → {[key: string]: NodeType}\n// Returns a map where keys are tableRoles and values are NodeTypes.\nvar tableNodeTypes = function tableNodeTypes(schema) {\n if (schema.cached.tableNodeTypes) {\n return schema.cached.tableNodeTypes;\n }\n var roles = {};\n Object.keys(schema.nodes).forEach(function (type) {\n var nodeType = schema.nodes[type];\n if (nodeType.spec.tableRole) {\n roles[nodeType.spec.tableRole] = nodeType;\n }\n });\n schema.cached.tableNodeTypes = roles;\n return roles;\n};\n\n// :: ($pos: ResolvedPos, content: union<ProseMirrorNode, Fragment>) → boolean\n// Checks if a given `content` can be inserted at the given `$pos`\n//\n// ```javascript\n// const { selection: { $from } } = state;\n// const node = state.schema.nodes.atom.createChecked();\n// if (canInsert($from, node)) {\n// // ...\n// }\n// ```\nvar canInsert = function canInsert($pos, content) {\n var index = $pos.index();\n\n if (content instanceof prosemirrorModel.Fragment) {\n return $pos.parent.canReplace(index, index, content);\n } else if (content instanceof prosemirrorModel.Node) {\n return $pos.parent.canReplaceWith(index, index, content.type);\n }\n return false;\n};\n\n// (node: ProseMirrorNode) → boolean\n// Checks if a given `node` is an empty paragraph\nvar isEmptyParagraph = function isEmptyParagraph(node) {\n return !node || node.type.name === 'paragraph' && node.nodeSize === 2;\n};\n\n// ($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning a table node closest to a given `$pos`.\n//\n// ```javascript\n// const table = findTableClosestToPos(state.doc.resolve(10));\n// ```\nvar findTableClosestToPos = function findTableClosestToPos($pos) {\n var predicate = function predicate(node) {\n return node.type.spec.tableRole && /table/i.test(node.type.spec.tableRole);\n };\n return findParentNodeClosestToPos($pos, predicate);\n};\n\nvar createCell = function createCell(cellType) {\n var cellContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n if (cellContent) {\n return cellType.createChecked(null, cellContent);\n }\n\n return cellType.createAndFill();\n};\n\n// (rect: {left: number, right: number, top: number, bottom: number}) → (selection: Selection) → boolean\n// Checks if a given CellSelection rect is selected\nvar isRectSelected = function isRectSelected(rect) {\n return function (selection) {\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n var start = selection.$anchorCell.start(-1);\n var cells = map.cellsInRect(rect);\n var selectedCells = map.cellsInRect(map.rectBetween(selection.$anchorCell.pos - start, selection.$headCell.pos - start));\n\n for (var i = 0, count = cells.length; i < count; i++) {\n if (selectedCells.indexOf(cells[i]) === -1) {\n return false;\n }\n }\n\n return true;\n };\n};\n\n// This function transposes an array of array flipping the columns for rows,\n// transposition is a familiar algebra concept;\n// you can get more details here:\n// https://en.wikipedia.org/wiki/Transpose\n//\n// ```javascript\n//\n// const arr = [\n// ['a1', 'a2', 'a3'],\n// ['b1', 'b2', 'b3'],\n// ['c1', 'c2', 'c3'],\n// ['d1', 'd2', 'd3'],\n// ];\n//\n// const result = transpose(arr);\n//\n// result === [\n// ['a1', 'b1', 'c1', 'd1'],\n// ['a2', 'b2', 'c2', 'd2'],\n// ['a3', 'b3', 'c3', 'd3'],\n// ]\n// ```\nvar transpose = function transpose(array) {\n return array[0].map(function (_, i) {\n return array.map(function (column) {\n return column[i];\n });\n });\n};\n\n// :: (tableNode: Node) -> Array<Node>\n// This function will transform the table node\n// into a matrix of rows and columns respecting merged cells,\n// for example this table will be convert to the below:\n//\n// ```\n// ____________________________\n// | | | |\n// | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// | A3 | B3 | C2 | |\n// |______|______|______|______|\n// ```\n//\n//\n// ```javascript\n// array = [\n// [A1, B1, C1, null],\n// [A2, B2, null, D1],\n// [A3. B3, C2, null],\n// ]\n// ```\nvar convertTableNodeToArrayOfRows = function convertTableNodeToArrayOfRows(tableNode) {\n var map = prosemirrorTables.TableMap.get(tableNode);\n var rows = [];\n for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {\n var rowCells = [];\n var seen = {};\n\n for (var colIndex = 0; colIndex < map.width; colIndex++) {\n var cellPos = map.map[rowIndex * map.width + colIndex];\n var cell = tableNode.nodeAt(cellPos);\n var rect = map.findCell(cellPos);\n if (seen[cellPos] || rect.top !== rowIndex) {\n rowCells.push(null);\n continue;\n }\n seen[cellPos] = true;\n\n rowCells.push(cell);\n }\n\n rows.push(rowCells);\n }\n\n return rows;\n};\n\n// :: (tableNode: Node, tableArray: Array<Node>) -> Node\n// This function will transform a matrix of nodes\n// into table node respecting merged cells and rows configurations,\n// for example this array will be convert to the table below:\n//\n// ```javascript\n// array = [\n// [A1, B1, C1, null],\n// [A2, B2, null, D1],\n// [A3. B3, C2, null],\n// ]\n// ```\n//\n// ```\n// ____________________________\n// | | | |\n// | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// | A3 | B3 | C2 | |\n// |______|______|______|______|\n// ```\n//\nvar convertArrayOfRowsToTableNode = function convertArrayOfRowsToTableNode(tableNode, arrayOfNodes) {\n var rowsPM = [];\n var map = prosemirrorTables.TableMap.get(tableNode);\n for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {\n var row = tableNode.child(rowIndex);\n var rowCells = [];\n\n for (var colIndex = 0; colIndex < map.width; colIndex++) {\n if (!arrayOfNodes[rowIndex][colIndex]) {\n continue;\n }\n var cellPos = map.map[rowIndex * map.width + colIndex];\n\n var cell = arrayOfNodes[rowIndex][colIndex];\n var oldCell = tableNode.nodeAt(cellPos);\n var newCell = oldCell.type.createChecked(Object.assign({}, cell.attrs), cell.content, cell.marks);\n rowCells.push(newCell);\n }\n\n rowsPM.push(row.type.createChecked(row.attrs, rowCells, row.marks));\n }\n\n var newTable = tableNode.type.createChecked(tableNode.attrs, rowsPM, tableNode.marks);\n\n return newTable;\n};\n\nvar moveTableColumn = function moveTableColumn(table, indexesOrigin, indexesTarget, direction) {\n var rows = transpose(convertTableNodeToArrayOfRows(table.node));\n\n rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n rows = transpose(rows);\n\n return convertArrayOfRowsToTableNode(table.node, rows);\n};\n\nvar moveTableRow = function moveTableRow(table, indexesOrigin, indexesTarget, direction) {\n var rows = convertTableNodeToArrayOfRows(table.node);\n\n rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n\n return convertArrayOfRowsToTableNode(table.node, rows);\n};\n\nvar moveRowInArrayOfRows = function moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, directionOverride) {\n var direction = indexesOrigin[0] > indexesTarget[0] ? -1 : 1;\n\n var rowsExtracted = rows.splice(indexesOrigin[0], indexesOrigin.length);\n var positionOffset = rowsExtracted.length % 2 === 0 ? 1 : 0;\n var target = void 0;\n\n if (directionOverride === -1 && direction === 1) {\n target = indexesTarget[0] - 1;\n } else if (directionOverride === 1 && direction === -1) {\n target = indexesTarget[indexesTarget.length - 1] - positionOffset + 1;\n } else {\n target = direction === -1 ? indexesTarget[0] : indexesTarget[indexesTarget.length - 1] - positionOffset;\n }\n\n rows.splice.apply(rows, [target, 0].concat(rowsExtracted));\n return rows;\n};\n\nvar checkInvalidMovements = function checkInvalidMovements(originIndex, targetIndex, targets, type) {\n var direction = originIndex > targetIndex ? -1 : 1;\n var errorMessage = 'Target position is invalid, you can\\'t move the ' + type + ' ' + originIndex + ' to ' + targetIndex + ', the target can\\'t be split. You could use tryToFit option.';\n\n if (direction === 1) {\n if (targets.slice(0, targets.length - 1).indexOf(targetIndex) !== -1) {\n throw new Error(errorMessage);\n }\n } else {\n if (targets.slice(1).indexOf(targetIndex) !== -1) {\n throw new Error(errorMessage);\n }\n }\n\n return true;\n};\n\n// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const predicate = node => node.type === schema.nodes.blockquote;\n// const parent = findParentNode(predicate)(selection);\n// ```\nvar findParentNode = function findParentNode(predicate) {\n return function (_ref) {\n var $from = _ref.$from;\n return findParentNodeClosestToPos($from, predicate);\n };\n};\n\n// :: ($pos: ResolvedPos, predicate: (node: ProseMirrorNode) → boolean) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes starting from the given `$pos`, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const predicate = node => node.type === schema.nodes.blockquote;\n// const parent = findParentNodeClosestToPos(state.doc.resolve(5), predicate);\n// ```\nvar findParentNodeClosestToPos = function findParentNodeClosestToPos($pos, predicate) {\n for (var i = $pos.depth; i > 0; i--) {\n var node = $pos.node(i);\n if (predicate(node)) {\n return {\n pos: i > 0 ? $pos.before(i) : 0,\n start: $pos.start(i),\n depth: i,\n node: node\n };\n }\n }\n};\n\n// :: (predicate: (node: ProseMirrorNode) → boolean, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → (selection: Selection) → ?dom.Node\n// Iterates over parent nodes, returning DOM reference of the closest node `predicate` returns truthy for.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const predicate = node => node.type === schema.nodes.table;\n// const parent = findParentDomRef(predicate, domAtPos)(selection); // <table>\n// ```\nvar findParentDomRef = function findParentDomRef(predicate, domAtPos) {\n return function (selection) {\n var parent = findParentNode(predicate)(selection);\n if (parent) {\n return findDomRefAtPos(parent.pos, domAtPos);\n }\n };\n};\n\n// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → boolean\n// Checks if there's a parent node `predicate` returns truthy for.\n//\n// ```javascript\n// if (hasParentNode(node => node.type === schema.nodes.table)(selection)) {\n// // ....\n// }\n// ```\nvar hasParentNode = function hasParentNode(predicate) {\n return function (selection) {\n return !!findParentNode(predicate)(selection);\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const parent = findParentNodeOfType(schema.nodes.paragraph)(selection);\n// ```\nvar findParentNodeOfType = function findParentNodeOfType(nodeType) {\n return function (selection) {\n return findParentNode(function (node) {\n return equalNodeType(nodeType, node);\n })(selection);\n };\n};\n\n// :: ($pos: ResolvedPos, nodeType: union<NodeType, [NodeType]>) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes starting from the given `$pos`, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const parent = findParentNodeOfTypeClosestToPos(state.doc.resolve(10), schema.nodes.paragraph);\n// ```\nvar findParentNodeOfTypeClosestToPos = function findParentNodeOfTypeClosestToPos($pos, nodeType) {\n return findParentNodeClosestToPos($pos, function (node) {\n return equalNodeType(nodeType, node);\n });\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (selection: Selection) → boolean\n// Checks if there's a parent node of a given `nodeType`.\n//\n// ```javascript\n// if (hasParentNodeOfType(schema.nodes.table)(selection)) {\n// // ....\n// }\n// ```\nvar hasParentNodeOfType = function hasParentNodeOfType(nodeType) {\n return function (selection) {\n return hasParentNode(function (node) {\n return equalNodeType(nodeType, node);\n })(selection);\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → (selection: Selection) → ?dom.Node\n// Iterates over parent nodes, returning DOM reference of the closest node of a given `nodeType`.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const parent = findParentDomRefOfType(schema.nodes.codeBlock, domAtPos)(selection); // <pre>\n// ```\nvar findParentDomRefOfType = function findParentDomRefOfType(nodeType, domAtPos) {\n return function (selection) {\n return findParentDomRef(function (node) {\n return equalNodeType(nodeType, node);\n }, domAtPos)(selection);\n };\n};\n\n// :: (nodeType: union<NodeType, [NodeType]>) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Returns a node of a given `nodeType` if it is selected. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const { extension, inlineExtension, bodiedExtension } = schema.nodes;\n// const selectedNode = findSelectedNodeOfType([\n// extension,\n// inlineExtension,\n// bodiedExtension,\n// ])(selection);\n// ```\nvar findSelectedNodeOfType = function findSelectedNodeOfType(nodeType) {\n return function (selection) {\n if (isNodeSelection(selection)) {\n var node = selection.node,\n $from = selection.$from;\n\n if (equalNodeType(nodeType, node)) {\n return { node: node, pos: $from.pos, depth: $from.depth };\n }\n }\n };\n};\n\n// :: (selection: Selection) → ?number\n// Returns position of the previous node.\n//\n// ```javascript\n// const pos = findPositionOfNodeBefore(tr.selection);\n// ```\nvar findPositionOfNodeBefore = function findPositionOfNodeBefore(selection) {\n var nodeBefore = selection.$from.nodeBefore;\n\n var maybeSelection = prosemirrorState.Selection.findFrom(selection.$from, -1);\n if (maybeSelection && nodeBefore) {\n // leaf node\n var parent = findParentNodeOfType(nodeBefore.type)(maybeSelection);\n if (parent) {\n return parent.pos;\n }\n return maybeSelection.$from.pos;\n }\n};\n\n// :: (position: number, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → dom.Node\n// Returns DOM reference of a node at a given `position`. If the node type is of type `TEXT_NODE` it will return the reference of the parent node.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const ref = findDomRefAtPos($from.pos, domAtPos);\n// ```\nvar findDomRefAtPos = function findDomRefAtPos(position, domAtPos) {\n var dom = domAtPos(position);\n var node = dom.node.childNodes[dom.offset];\n\n if (dom.node.nodeType === Node.TEXT_NODE) {\n return dom.node.parentNode;\n }\n\n if (!node || node.nodeType === Node.TEXT_NODE) {\n return dom.node;\n }\n\n return node;\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Flattens descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const children = flatten(node);\n// ```\nvar flatten = function flatten(node) {\n var descend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n if (!node) {\n throw new Error('Invalid \"node\" parameter');\n }\n var result = [];\n node.descendants(function (child, pos) {\n result.push({ node: child, pos: pos });\n if (!descend) {\n return false;\n }\n });\n return result;\n};\n\n// :: (node: ProseMirrorNode, predicate: (node: ProseMirrorNode) → boolean, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const textNodes = findChildren(node, child => child.isText, false);\n// ```\nvar findChildren = function findChildren(node, predicate, descend) {\n if (!node) {\n throw new Error('Invalid \"node\" parameter');\n } else if (!predicate) {\n throw new Error('Invalid \"predicate\" parameter');\n }\n return flatten(node, descend).filter(function (child) {\n return predicate(child.node);\n });\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns text nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const textNodes = findTextNodes(node);\n// ```\nvar findTextNodes = function findTextNodes(node, descend) {\n return findChildren(node, function (child) {\n return child.isText;\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns inline nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const inlineNodes = findInlineNodes(node);\n// ```\nvar findInlineNodes = function findInlineNodes(node, descend) {\n return findChildren(node, function (child) {\n return child.isInline;\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns block descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const blockNodes = findBlockNodes(node);\n// ```\nvar findBlockNodes = function findBlockNodes(node, descend) {\n return findChildren(node, function (child) {\n return child.isBlock;\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, predicate: (attrs: ?Object) → boolean, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const mergedCells = findChildrenByAttr(table, attrs => attrs.colspan === 2);\n// ```\nvar findChildrenByAttr = function findChildrenByAttr(node, predicate, descend) {\n return findChildren(node, function (child) {\n return !!predicate(child.attrs);\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, nodeType: NodeType, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes of a given nodeType. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const cells = findChildrenByType(table, schema.nodes.tableCell);\n// ```\nvar findChildrenByType = function findChildrenByType(node, nodeType, descend) {\n return findChildren(node, function (child) {\n return child.type === nodeType;\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, markType: markType, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes that have a mark of a given markType. It doesn't descend into a `node` when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const nodes = findChildrenByMark(state.doc, schema.marks.strong);\n// ```\nvar findChildrenByMark = function findChildrenByMark(node, markType, descend) {\n return findChildren(node, function (child) {\n return markType.isInSet(child.marks);\n }, descend);\n};\n\n// :: (node: ProseMirrorNode, nodeType: NodeType) → boolean\n// Returns `true` if a given node contains nodes of a given `nodeType`\n//\n// ```javascript\n// if (contains(panel, schema.nodes.listItem)) {\n// // ...\n// }\n// ```\nvar contains = function contains(node, nodeType) {\n return !!findChildrenByType(node, nodeType).length;\n};\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n// :: (selection: Selection) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning the closest table node.\n//\n// ```javascript\n// const table = findTable(selection);\n// ```\nvar findTable = function findTable(selection) {\n return findParentNode(function (node) {\n return node.type.spec.tableRole && node.type.spec.tableRole === 'table';\n })(selection);\n};\n\n// :: (selection: Selection) → boolean\n// Checks if current selection is a `CellSelection`.\n//\n// ```javascript\n// if (isCellSelection(selection)) {\n// // ...\n// }\n// ```\nvar isCellSelection = function isCellSelection(selection) {\n return selection instanceof prosemirrorTables.CellSelection;\n};\n\n// :: (selection: Selection) → ?{left: number, right: number, top: number, bottom: number}\n// Get the selection rectangle. Returns `undefined` if selection is not a CellSelection.\n//\n// ```javascript\n// const rect = getSelectionRect(selection);\n// ```\nvar getSelectionRect = function getSelectionRect(selection) {\n if (!isCellSelection(selection)) {\n return;\n }\n var start = selection.$anchorCell.start(-1);\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n return map.rectBetween(selection.$anchorCell.pos - start, selection.$headCell.pos - start);\n};\n\n// :: (columnIndex: number) → (selection: Selection) → boolean\n// Checks if entire column at index `columnIndex` is selected.\n//\n// ```javascript\n// const className = isColumnSelected(i)(selection) ? 'selected' : '';\n// ```\nvar isColumnSelected = function isColumnSelected(columnIndex) {\n return function (selection) {\n if (isCellSelection(selection)) {\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n return isRectSelected({\n left: columnIndex,\n right: columnIndex + 1,\n top: 0,\n bottom: map.height\n })(selection);\n }\n\n return false;\n };\n};\n\n// :: (rowIndex: number) → (selection: Selection) → boolean\n// Checks if entire row at index `rowIndex` is selected.\n//\n// ```javascript\n// const className = isRowSelected(i)(selection) ? 'selected' : '';\n// ```\nvar isRowSelected = function isRowSelected(rowIndex) {\n return function (selection) {\n if (isCellSelection(selection)) {\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n return isRectSelected({\n left: 0,\n right: map.width,\n top: rowIndex,\n bottom: rowIndex + 1\n })(selection);\n }\n\n return false;\n };\n};\n\n// :: (selection: Selection) → boolean\n// Checks if entire table is selected\n//\n// ```javascript\n// const className = isTableSelected(selection) ? 'selected' : '';\n// ```\nvar isTableSelected = function isTableSelected(selection) {\n if (isCellSelection(selection)) {\n var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));\n return isRectSelected({\n left: 0,\n right: map.width,\n top: 0,\n bottom: map.height\n })(selection);\n }\n\n return false;\n};\n\n// :: (columnIndex: union<number, [number]>) → (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of cells in a column(s), where `columnIndex` could be a column index or an array of column indexes.\n//\n// ```javascript\n// const cells = getCellsInColumn(i)(selection); // [{node, pos}, {node, pos}]\n// ```\nvar getCellsInColumn = function getCellsInColumn(columnIndex) {\n return function (selection) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var indexes = Array.isArray(columnIndex) ? columnIndex : Array.from([columnIndex]);\n return indexes.reduce(function (acc, index) {\n if (index >= 0 && index <= map.width - 1) {\n var cells = map.cellsInRect({\n left: index,\n right: index + 1,\n top: 0,\n bottom: map.height\n });\n return acc.concat(cells.map(function (nodePos) {\n var node = table.node.nodeAt(nodePos);\n var pos = nodePos + table.start;\n return { pos: pos, start: pos + 1, node: node };\n }));\n }\n }, []);\n }\n };\n};\n\n// :: (rowIndex: union<number, [number]>) → (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of cells in a row(s), where `rowIndex` could be a row index or an array of row indexes.\n//\n// ```javascript\n// const cells = getCellsInRow(i)(selection); // [{node, pos}, {node, pos}]\n// ```\nvar getCellsInRow = function getCellsInRow(rowIndex) {\n return function (selection) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var indexes = Array.isArray(rowIndex) ? rowIndex : Array.from([rowIndex]);\n return indexes.reduce(function (acc, index) {\n if (index >= 0 && index <= map.height - 1) {\n var cells = map.cellsInRect({\n left: 0,\n right: map.width,\n top: index,\n bottom: index + 1\n });\n return acc.concat(cells.map(function (nodePos) {\n var node = table.node.nodeAt(nodePos);\n var pos = nodePos + table.start;\n return { pos: pos, start: pos + 1, node: node };\n }));\n }\n }, []);\n }\n };\n};\n\n// :: (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of all cells in a table.\n//\n// ```javascript\n// const cells = getCellsInTable(selection); // [{node, pos}, {node, pos}]\n// ```\nvar getCellsInTable = function getCellsInTable(selection) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var cells = map.cellsInRect({\n left: 0,\n right: map.width,\n top: 0,\n bottom: map.height\n });\n return cells.map(function (nodePos) {\n var node = table.node.nodeAt(nodePos);\n var pos = nodePos + table.start;\n return { pos: pos, start: pos + 1, node: node };\n });\n }\n};\n\nvar select = function select(type) {\n return function (index, expand) {\n return function (tr) {\n var table = findTable(tr.selection);\n var isRowSelection = type === 'row';\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n\n // Check if the index is valid\n if (index >= 0 && index < (isRowSelection ? map.height : map.width)) {\n var left = isRowSelection ? 0 : index;\n var top = isRowSelection ? index : 0;\n var right = isRowSelection ? map.width : index + 1;\n var bottom = isRowSelection ? index + 1 : map.height;\n\n if (expand) {\n var cell = findCellClosestToPos(tr.selection.$from);\n if (!cell) {\n return tr;\n }\n\n var selRect = map.findCell(cell.pos - table.start);\n if (isRowSelection) {\n top = Math.min(top, selRect.top);\n bottom = Math.max(bottom, selRect.bottom);\n } else {\n left = Math.min(left, selRect.left);\n right = Math.max(right, selRect.right);\n }\n }\n\n var cellsInFirstRow = map.cellsInRect({\n left: left,\n top: top,\n right: isRowSelection ? right : left + 1,\n bottom: isRowSelection ? top + 1 : bottom\n });\n\n var cellsInLastRow = bottom - top === 1 ? cellsInFirstRow : map.cellsInRect({\n left: isRowSelection ? left : right - 1,\n top: isRowSelection ? bottom - 1 : top,\n right: right,\n bottom: bottom\n });\n\n var head = table.start + cellsInFirstRow[0];\n var anchor = table.start + cellsInLastRow[cellsInLastRow.length - 1];\n var $head = tr.doc.resolve(head);\n var $anchor = tr.doc.resolve(anchor);\n\n return cloneTr(tr.setSelection(new prosemirrorTables.CellSelection($anchor, $head)));\n }\n }\n return tr;\n };\n };\n};\n\n// :: (columnIndex: number, expand: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on a column at index `columnIndex`.\n// Use the optional `expand` param to extend from current selection.\n//\n// ```javascript\n// dispatch(\n// selectColumn(i)(state.tr)\n// );\n// ```\nvar selectColumn = select('column');\n\n// :: (rowIndex: number, expand: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on a column at index `rowIndex`.\n// Use the optional `expand` param to extend from current selection.\n//\n// ```javascript\n// dispatch(\n// selectRow(i)(state.tr)\n// );\n// ```\nvar selectRow = select('row');\n\n// :: (selection: Selection) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on the entire table.\n//\n// ```javascript\n// dispatch(\n// selectTable(i)(state.tr)\n// );\n// ```\nvar selectTable = function selectTable(tr) {\n var table = findTable(tr.selection);\n if (table) {\n var _TableMap$get = prosemirrorTables.TableMap.get(table.node),\n map = _TableMap$get.map;\n\n if (map && map.length) {\n var head = table.start + map[0];\n var anchor = table.start + map[map.length - 1];\n var $head = tr.doc.resolve(head);\n var $anchor = tr.doc.resolve(anchor);\n\n return cloneTr(tr.setSelection(new prosemirrorTables.CellSelection($anchor, $head)));\n }\n }\n return tr;\n};\n\n// :: (cell: {pos: number, node: ProseMirrorNode}, schema: Schema) → (tr: Transaction) → Transaction\n// Returns a new transaction that clears the content of a given `cell`.\n//\n// ```javascript\n// const $pos = state.doc.resolve(13);\n// dispatch(\n// emptyCell(findCellClosestToPos($pos), state.schema)(state.tr)\n// );\n// ```\nvar emptyCell = function emptyCell(cell, schema) {\n return function (tr) {\n if (cell) {\n var _tableNodeTypes$cell$ = tableNodeTypes(schema).cell.createAndFill(),\n content = _tableNodeTypes$cell$.content;\n\n if (!cell.node.content.eq(content)) {\n tr.replaceWith(cell.pos + 1, cell.pos + cell.node.nodeSize, content);\n return cloneTr(tr);\n }\n }\n return tr;\n };\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new column at index `columnIndex`.\n//\n// ```javascript\n// dispatch(\n// addColumnAt(i)(state.tr)\n// );\n// ```\nvar addColumnAt = function addColumnAt(columnIndex) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n if (columnIndex >= 0 && columnIndex <= map.width) {\n return cloneTr(prosemirrorTables.addColumn(tr, {\n map: map,\n tableStart: table.start,\n table: table.node\n }, columnIndex));\n }\n }\n return tr;\n };\n};\n\n// :: (originRowIndex: number, targetRowIndex: targetColumnIndex, options?: MovementOptions) → (tr: Transaction) → Transaction\n// Returns a new transaction that moves the origin row to the target index;\n//\n// by default \"tryToFit\" is false, that means if you try to move a row to a place\n// where we will need to split a row with merged cells it'll throw an exception, for example:\n//\n// ```\n// ____________________________\n// | | | |\n// 0 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// 1 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 2 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// ```\n//\n// if you try to move the row 0 to the row index 1 with tryToFit false,\n// it'll throw an exception since you can't split the row 1;\n// but if \"tryToFit\" is true, it'll move the row using the current direction.\n//\n// We defined current direction using the target and origin values\n// if the origin is greater than the target, that means the course is `bottom-to-top`,\n// so the `tryToFit` logic will use this direction to determine\n// if we should move the column to the right or the left.\n//\n// for example, if you call the function using `moveRow(0, 1, { tryToFit: true })`\n// the result will be:\n// ```\n// ____________________________\n// | | | |\n// 0 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 1 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 2 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// ```\n//\n// since we could put the row zero on index one,\n// we pushed to the best place to fit the row index 0,\n// in this case, row index 2.\n//\n//\n// -------- HOW TO OVERRIDE DIRECTION --------\n//\n// If you set \"tryToFit\" to \"true\", it will try to figure out the best direction\n// place to fit using the origin and target index, for example:\n//\n//\n// ```\n// ____________________________\n// | | | |\n// 0 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// 1 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 2 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 3 | A4 | B4 | |\n// |______|______ ______| |\n// | | | | D2 |\n// 4 | A5 | B5 | C3 | |\n// |______|______|______|______|\n// ```\n//\n//\n// If you try to move the row 0 to row index 4 with \"tryToFit\" enabled, by default,\n// the code will put it on after the merged rows,\n// but you can override it using the \"direction\" option.\n//\n// -1: Always put the origin before the target\n// ```\n// ____________________________\n// | | | |\n// 0 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 1 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 2 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// 3 | A4 | B4 | |\n// |______|______ ______| |\n// | | | | D2 |\n// 4 | A5 | B5 | C3 | |\n// |______|______|______|______|\n// ```\n//\n// 0: Automatically decide the best place to fit\n// ```\n// ____________________________\n// | | | |\n// 0 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 1 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 2 | A4 | B4 | |\n// |______|______ ______| |\n// | | | | D2 |\n// 3 | A5 | B5 | C3 | |\n// |______|______|______|______|\n// | | | |\n// 4 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// ```\n//\n// 1: Always put the origin after the target\n// ```\n// ____________________________\n// | | | |\n// 0 | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// 1 | A3 | B3 | C2 | |\n// |______|______|______|______|\n// | | | |\n// 2 | A4 | B4 | |\n// |______|______ ______| |\n// | | | | D2 |\n// 3 | A5 | B5 | C3 | |\n// |______|______|______|______|\n// | | | |\n// 4 | A1 | B1 | C1 |\n// |______|______|______ ______|\n// ```\n//\n// ```javascript\n// dispatch(\n// moveRow(x, y, options)(state.tr)\n// );\n// ```\nvar moveRow = function moveRow(originRowIndex, targetRowIndex, opts) {\n return function (tr) {\n var defaultOptions = { tryToFit: false, direction: 0 };\n var options = Object.assign(defaultOptions, opts);\n var table = findTable(tr.selection);\n if (!table) {\n return tr;\n }\n\n var _getSelectionRangeInR = getSelectionRangeInRow(originRowIndex)(tr),\n indexesOriginRow = _getSelectionRangeInR.indexes;\n\n var _getSelectionRangeInR2 = getSelectionRangeInRow(targetRowIndex)(tr),\n indexesTargetRow = _getSelectionRangeInR2.indexes;\n\n if (indexesOriginRow.indexOf(targetRowIndex) > -1) {\n return tr;\n }\n\n if (!options.tryToFit && indexesTargetRow.length > 1) {\n checkInvalidMovements(originRowIndex, targetRowIndex, indexesTargetRow, 'row');\n }\n\n var newTable = moveTableRow(table, indexesOriginRow, indexesTargetRow, options.direction);\n\n return cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);\n };\n};\n\n// :: (originColumnIndex: number, targetColumnIndex: targetColumnIndex, options?: MovementOptions) → (tr: Transaction) → Transaction\n// Returns a new transaction that moves the origin column to the target index;\n//\n// by default \"tryToFit\" is false, that means if you try to move a column to a place\n// where we will need to split a column with merged cells it'll throw an exception, for example:\n//\n// ```\n// 0 1 2\n// ____________________________\n// | | | |\n// | A1 | B1 | C1 |\n// |______|______|______ ______|\n// | | | |\n// | A2 | B2 | |\n// |______|______ ______| |\n// | | | | D1 |\n// | A3 | B3 | C2 | |\n// |______|______|______|______|\n// ```\n//\n//\n// if you try to move the column 0 to the column index 1 with tryToFit false,\n// it'll throw an exception since you can't split the column 1;\n// but if \"tryToFit\" is true, it'll move the column using the current direction.\n//\n// We defined current direction using the target and origin values\n// if the origin is greater than the target, that means the course is `right-to-left`,\n// so the `tryToFit` logic will use this direction to determine\n// if we should move the column to the right or the left.\n//\n// for example, if you call the function using `moveColumn(0, 1, { tryToFit: true })`\n// the result will be:\n//\n// ```\n// 0 1 2\n// _____________________ _______\n// | | | |\n// | B1 | C1 | A1 |\n// |______|______ ______|______|\n// | | | |\n// | B2 | | A2 |\n// |______ ______| |______|\n// | | | D1 | |\n// | B3 | C2 | | A3 |\n// |______|______|______|______|\n// ```\n//\n// since we could put the column zero on index one,\n// we pushed to the best place to fit the column 0, in this case, column index 2.\n//\n// -------- HOW TO OVERRIDE DIRECTION --------\n//\n// If you set \"tryToFit\" to \"true\", it will try to figure out the best direction\n// place to fit using the origin and target index, for example:\n//\n//\n// ```\n// 0 1 2 3 4 5 6\n// _________________________________________________\n// | | | | | |\n// | A1 | B1 | C1 | E1 | F1 |\n// |______|______|______ ______|______|______ ______|\n// | | | | | |\n// | A2 | B2 | | E2 | |\n// |______|______ ______| |______ ______| |\n// | | | | D1 | | | G2 |\n// | A3 | B3 | C3 | | E3 | F3 | |\n// |______|______|______|______|______|______|______|\n// ```\n//\n//\n// If you try to move the column 0 to column index 5 with \"tryToFit\" enabled, by default,\n// the code will put it on after the merged columns,\n// but you can override it using the \"direction\" option.\n//\n// -1: Always put the origin before the target\n//\n// ```\n// 0 1 2 3 4 5 6\n// _________________________________________________\n// | | | | | |\n// | B1 | C1 | A1 | E1 | F1 |\n// |______|______ ______|______|______|______ ______|\n// | | | | | |\n// | B2 | | A2 | E2 | |\n// |______ ______| |______|______ ______| |\n// | | | D1 | | | | G2 |\n// | B3 | C3 | | A3 | E3 | F3 | |\n// |______|______|______|______|______|______|______|\n// ```\n//\n// 0: Automatically decide the best place to fit\n//\n// ```\n// 0 1 2 3 4 5 6\n// _________________________________________________\n// | | | | | |\n// | B1 | C1 | E1 | F1 | A1 |\n// |______|______ ______|______|______ ______|______|\n// | | | | | |\n// | B2 | | E2 | | A2 |\n// |______ ______| |______ ______| |______|\n// | | | D1 | | | G2 | |\n// | B3 | C3 | | E3 | F3 | | A3 |\n// |______|______|______|______|______|______|______|\n// ```\n//\n// 1: Always put the origin after the target\n//\n// ```\n// 0 1 2 3 4 5 6\n// _________________________________________________\n// | | | | | |\n// | B1 | C1 | E1 | F1 | A1 |\n// |______|______ ______|______|______ ______|______|\n// | | | | | |\n// | B2 | | E2 | | A2 |\n// |______ ______| |______ ______| |______|\n// | | | D1 | | | G2 | |\n// | B3 | C3 | | E3 | F3 | | A3 |\n// |______|______|______|______|______|______|______|\n// ```\n//\n// ```javascript\n// dispatch(\n// moveColumn(x, y, options)(state.tr)\n// );\n// ```\nvar moveColumn = function moveColumn(originColumnIndex, targetColumnIndex, opts) {\n return function (tr) {\n var defaultOptions = { tryToFit: false, direction: 0 };\n var options = Object.assign(defaultOptions, opts);\n var table = findTable(tr.selection);\n if (!table) {\n return tr;\n }\n\n var _getSelectionRangeInC = getSelectionRangeInColumn(originColumnIndex)(tr),\n indexesOriginColumn = _getSelectionRangeInC.indexes;\n\n var _getSelectionRangeInC2 = getSelectionRangeInColumn(targetColumnIndex)(tr),\n indexesTargetColumn = _getSelectionRangeInC2.indexes;\n\n if (indexesOriginColumn.indexOf(targetColumnIndex) > -1) {\n return tr;\n }\n\n if (!options.tryToFit && indexesTargetColumn.length > 1) {\n checkInvalidMovements(originColumnIndex, targetColumnIndex, indexesTargetColumn, 'column');\n }\n\n var newTable = moveTableColumn(table, indexesOriginColumn, indexesTargetColumn, options.direction);\n\n return cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);\n };\n};\n\n// :: (rowIndex: number, clonePreviousRow?: boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new row at index `rowIndex`. Optionally clone the previous row.\n//\n// ```javascript\n// dispatch(\n// addRowAt(i)(state.tr)\n// );\n// ```\n//\n// ```javascript\n// dispatch(\n// addRowAt(i, true)(state.tr)\n// );\n// ```\nvar addRowAt = function addRowAt(rowIndex, clonePreviousRow) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var cloneRowIndex = rowIndex - 1;\n\n if (clonePreviousRow && cloneRowIndex >= 0) {\n return cloneTr(cloneRowAt(cloneRowIndex)(tr));\n }\n\n if (rowIndex >= 0 && rowIndex <= map.height) {\n return cloneTr(prosemirrorTables.addRow(tr, {\n map: map,\n tableStart: table.start,\n table: table.node\n }, rowIndex));\n }\n }\n return tr;\n };\n};\n\n// :: (cloneRowIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new row after `cloneRowIndex`, cloning the row attributes at `cloneRowIndex`.\n//\n// ```javascript\n// dispatch(\n// cloneRowAt(i)(state.tr)\n// );\n// ```\nvar cloneRowAt = function cloneRowAt(rowIndex) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n\n if (rowIndex >= 0 && rowIndex <= map.height) {\n var tableNode = table.node;\n var tableNodes = tableNodeTypes(tableNode.type.schema);\n\n var rowPos = table.start;\n for (var i = 0; i < rowIndex + 1; i++) {\n rowPos += tableNode.child(i).nodeSize;\n }\n\n var cloneRow = tableNode.child(rowIndex);\n // Re-create the same nodes with same attrs, dropping the node content.\n var cells = [];\n var rowWidth = 0;\n cloneRow.forEach(function (cell) {\n // If we're copying a row with rowspan somewhere, we dont want to copy that cell\n // We'll increment its span below.\n if (cell.attrs.rowspan === 1) {\n rowWidth += cell.attrs.colspan;\n cells.push(tableNodes[cell.type.spec.tableRole].createAndFill(cell.attrs, cell.marks));\n }\n });\n\n // If a higher row spans past our clone row, bump the higher row to cover this new row too.\n if (rowWidth < map.width) {\n var rowSpanCells = [];\n\n var _loop = function _loop(_i) {\n var foundCells = filterCellsInRow(_i, function (cell, tr) {\n var rowspan = cell.node.attrs.rowspan;\n var spanRange = _i + rowspan;\n return rowspan > 1 && spanRange > rowIndex;\n })(tr);\n rowSpanCells.push.apply(rowSpanCells, _toConsumableArray(foundCells));\n };\n\n for (var _i = rowIndex; _i >= 0; _i--) {\n _loop(_i);\n }\n\n if (rowSpanCells.length) {\n rowSpanCells.forEach(function (cell) {\n tr = setCellAttrs(cell, {\n rowspan: cell.node.attrs.rowspan + 1\n })(tr);\n });\n }\n }\n\n return safeInsert(tableNodes.row.create(cloneRow.attrs, cells), rowPos)(tr);\n }\n }\n return tr;\n };\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a column at index `columnIndex`. If there is only one column left, it will remove the entire table.\n//\n// ```javascript\n// dispatch(\n// removeColumnAt(i)(state.tr)\n// );\n// ```\nvar removeColumnAt = function removeColumnAt(columnIndex) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n if (columnIndex === 0 && map.width === 1) {\n return removeTable(tr);\n } else if (columnIndex >= 0 && columnIndex <= map.width) {\n prosemirrorTables.removeColumn(tr, {\n map: map,\n tableStart: table.start,\n table: table.node\n }, columnIndex);\n return cloneTr(tr);\n }\n }\n return tr;\n };\n};\n\n// :: (rowIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a row at index `rowIndex`. If there is only one row left, it will remove the entire table.\n//\n// ```javascript\n// dispatch(\n// removeRowAt(i)(state.tr)\n// );\n// ```\nvar removeRowAt = function removeRowAt(rowIndex) {\n return function (tr) {\n var table = findTable(tr.selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n if (rowIndex === 0 && map.height === 1) {\n return removeTable(tr);\n } else if (rowIndex >= 0 && rowIndex <= map.height) {\n prosemirrorTables.removeRow(tr, {\n map: map,\n tableStart: table.start,\n table: table.node\n }, rowIndex);\n return cloneTr(tr);\n }\n }\n return tr;\n };\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes a table node if the cursor is inside of it.\n//\n// ```javascript\n// dispatch(\n// removeTable(state.tr)\n// );\n// ```\nvar removeTable = function removeTable(tr) {\n var $from = tr.selection.$from;\n\n for (var depth = $from.depth; depth > 0; depth--) {\n var node = $from.node(depth);\n if (node.type.spec.tableRole === 'table') {\n return cloneTr(tr.delete($from.before(depth), $from.after(depth)));\n }\n }\n return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected columns.\n//\n// ```javascript\n// dispatch(\n// removeSelectedColumns(state.tr)\n// );\n// ```\nvar removeSelectedColumns = function removeSelectedColumns(tr) {\n var selection = tr.selection;\n\n if (isTableSelected(selection)) {\n return removeTable(tr);\n }\n if (isCellSelection(selection)) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var rect = map.rectBetween(selection.$anchorCell.pos - table.start, selection.$headCell.pos - table.start);\n\n if (rect.left == 0 && rect.right == map.width) {\n return false;\n }\n\n var pmTableRect = Object.assign({}, rect, {\n map: map,\n table: table.node,\n tableStart: table.start\n });\n\n for (var i = pmTableRect.right - 1;; i--) {\n prosemirrorTables.removeColumn(tr, pmTableRect, i);\n if (i === pmTableRect.left) {\n break;\n }\n pmTableRect.table = pmTableRect.tableStart ? tr.doc.nodeAt(pmTableRect.tableStart - 1) : tr.doc;\n pmTableRect.map = prosemirrorTables.TableMap.get(pmTableRect.table);\n }\n return cloneTr(tr);\n }\n }\n return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected rows.\n//\n// ```javascript\n// dispatch(\n// removeSelectedRows(state.tr)\n// );\n// ```\nvar removeSelectedRows = function removeSelectedRows(tr) {\n var selection = tr.selection;\n\n if (isTableSelected(selection)) {\n return removeTable(tr);\n }\n if (isCellSelection(selection)) {\n var table = findTable(selection);\n if (table) {\n var map = prosemirrorTables.TableMap.get(table.node);\n var rect = map.rectBetween(selection.$anchorCell.pos - table.start, selection.$headCell.pos - table.start);\n\n if (rect.top == 0 && rect.bottom == map.height) {\n return false;\n }\n\n var pmTableRect = Object.assign({}, rect, {\n map: map,\n table: table.node,\n tableStart: table.start\n });\n\n for (var i = pmTableRect.bottom - 1;; i--) {\n prosemirrorTables.removeRow(tr, pmTableRect, i);\n if (i === pmTableRect.top) {\n break;\n }\n pmTableRect.table = pmTableRect.tableStart ? tr.doc.nodeAt(pmTableRect.tableStart - 1) : tr.doc;\n pmTableRect.map = prosemirrorTables.TableMap.get(pmTableRect.table);\n }\n\n return cloneTr(tr);\n }\n }\n return tr;\n};\n\n// :: ($pos: ResolvedPos) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a column closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n// removeColumnClosestToPos(state.doc.resolve(3))(state.tr)\n// );\n// ```\nvar removeColumnClosestToPos = function removeColumnClosestToPos($pos) {\n return function (tr) {\n var rect = findCellRectClosestToPos($pos);\n if (rect) {\n return removeColumnAt(rect.left)(setTextSelection($pos.pos)(tr));\n }\n return tr;\n };\n};\n\n// :: ($pos: ResolvedPos) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a row closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n// removeRowClosestToPos(state.doc.resolve(3))(state.tr)\n// );\n// ```\nvar removeRowClosestToPos = function removeRowClosestToPos($pos) {\n return function (tr) {\n var rect = findCellRectClosestToPos($pos);\n if (rect) {\n return removeRowAt(rect.top)(setTextSelection($pos.pos)(tr));\n }\n return tr;\n };\n};\n\n// :: (columnIndex: number, cellTransform: (cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that maps a given `cellTransform` function to each cell in a column at a given `columnIndex`.\n// It will set the selection into the last cell of the column if `setCursorToLastCell` param is set to `true`.\n//\n// ```javascript\n// dispatch(\n// forEachCellInColumn(0, (cell, tr) => emptyCell(cell, state.schema)(tr))(state.tr)\n// );\n// ```\nvar forEachCellInColumn = function forEachCellInColumn(columnIndex, cellTransform, setCursorToLastCell) {\n return function (tr) {\n var cells = getCellsInColumn(columnIndex)(tr.selection);\n if (cells) {\n for (var i = cells.length - 1; i >= 0; i--) {\n tr = cellTransform(cells[i], tr);\n }\n if (setCursorToLastCell) {\n var $pos = tr.doc.resolve(tr.mapping.map(cells[cells.length - 1].pos));\n tr.setSelection(prosemirrorState.Selection.near($pos));\n }\n return cloneTr(tr);\n }\n return tr;\n };\n};\n\n// :: (rowIndex: number, cellTransform: (cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that maps a given `cellTransform` function to each cell in a row at a given `rowIndex`.\n// It will set the selection into the last cell of the row if `setCursorToLastCell` param is set to `true`.\n//\n// ```javascript\n// dispatch(\n// forEachCellInRow(0, (cell, tr) => setCellAttrs(cell, { background: 'red' })(tr))(state.tr)\n// );\n// ```\nvar forEachCellInRow = function forEachCellInRow(rowIndex, cellTransform, setCursorToLastCell) {\n return function (tr) {\n var cells = getCellsInRow(rowIndex)(tr.selection);\n if (cells) {\n for (var i = cells.length - 1; i >= 0; i--) {\n tr = cellTransform(cells[i], tr);\n }\n if (setCursorToLastCell) {\n var $pos = tr.doc.resolve(tr.mapping.map(cells[cells.length - 1].pos));\n tr.setSelection(prosemirrorState.Selection.near($pos));\n }\n }\n return tr;\n };\n};\n\n// :: (cell: {pos: number, start: number, node: ProseMirrorNode}, attrs: Object) → (tr: Transaction) → Transaction\n// Returns a new transaction that sets given `attrs` to a given `cell`.\n//\n// ```javascript\n// dispatch(\n// setCellAttrs(findCellClosestToPos($pos), { background: 'blue' })(tr);\n// );\n// ```\nvar setCellAttrs = function setCellAttrs(cell, attrs) {\n return function (tr) {\n if (cell) {\n tr.setNodeMarkup(cell.pos, null, Object.assign({}, cell.node.attrs, attrs));\n return cloneTr(tr);\n }\n return tr;\n };\n};\n\n// :: (schema: Schema, rowsCount: ?number, colsCount: ?number, withHeaderRow: ?boolean, cellContent: ?Node) → Node\n// Returns a table node of a given size.\n// `withHeaderRow` defines whether the first row of the table will be a header row.\n// `cellContent` defines the content of each cell.\n//\n// ```javascript\n// const table = createTable(state.schema); // 3x3 table node\n// dispatch(\n// tr.replaceSelectionWith(table).scrollIntoView()\n// );\n// ```\nvar createTable = function createTable(schema) {\n var rowsCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;\n var colsCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;\n var withHeaderRow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n var cellContent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;\n\n var _tableNodeTypes = tableNodeTypes(schema),\n tableCell = _tableNodeTypes.cell,\n tableHeader = _tableNodeTypes.header_cell,\n tableRow = _tableNodeTypes.row,\n table = _tableNodeTypes.table;\n\n var cells = [];\n var headerCells = [];\n for (var i = 0; i < colsCount; i++) {\n cells.push(createCell(tableCell, cellContent));\n\n if (withHeaderRow) {\n headerCells.push(createCell(tableHeader, cellContent));\n }\n }\n\n var rows = [];\n for (var _i2 = 0; _i2 < rowsCount; _i2++) {\n rows.push(tableRow.createChecked(null, withHeaderRow && _i2 === 0 ? headerCells : cells));\n }\n\n return table.createChecked(null, rows);\n};\n\n// :: ($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning a table cell or a table header node closest to a given `$pos`.\n//\n// ```javascript\n// const cell = findCellClosestToPos(state.selection.$from);\n// ```\nvar findCellClosestToPos = function findCellClosestToPos($pos) {\n var predicate = function predicate(node) {\n return node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole);\n };\n return findParentNodeClosestToPos($pos, predicate);\n};\n\n// :: ($pos: ResolvedPos) → ?{left: number, top: number, right: number, bottom: number}\n// Returns the rectangle spanning a cell closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n// findCellRectClosestToPos(state.selection.$from)\n// );\n// ```\nvar findCellRectClosestToPos = function findCellRectClosestToPos($pos) {\n var cell = findCellClosestToPos($pos);\n if (cell) {\n var table = findTableClosestToPos($pos);\n var map = prosemirrorTables.TableMap.get(table.node);\n var cellPos = cell.pos - table.start;\n return map.rectBetween(cellPos, cellPos);\n }\n};\n\nvar filterCellsInRow = function filterCellsInRow(rowIndex, predicate) {\n return function (tr) {\n var foundCells = [];\n var cells = getCellsInRow(rowIndex)(tr.selection);\n if (cells) {\n for (var j = cells.length - 1; j >= 0; j--) {\n if (predicate(cells[j], tr)) {\n foundCells.push(cells[j]);\n }\n }\n }\n\n return foundCells;\n };\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}\n// Returns a range of rectangular selection spanning all merged cells around a column at index `columnIndex`.\n//\n// ```javascript\n// const range = getSelectionRangeInColumn(3)(state.tr);\n// ```\nvar getSelectionRangeInColumn = function getSelectionRangeInColumn(columnIndex) {\n return function (tr) {\n var startIndex = columnIndex;\n var endIndex = columnIndex;\n\n // looking for selection start column (startIndex)\n\n var _loop2 = function _loop2(i) {\n var cells = getCellsInColumn(i)(tr.selection);\n if (cells) {\n cells.forEach(function (cell) {\n var maybeEndIndex = cell.node.attrs.colspan + i - 1;\n if (maybeEndIndex >= startIndex) {\n startIndex = i;\n }\n if (maybeEndIndex > endIndex) {\n endIndex = maybeEndIndex;\n }\n });\n }\n };\n\n for (var i = columnIndex; i >= 0; i--) {\n _loop2(i);\n }\n // looking for selection end column (endIndex)\n\n var _loop3 = function _loop3(i) {\n var cells = getCellsInColumn(i)(tr.selection);\n if (cells) {\n cells.forEach(function (cell) {\n var maybeEndIndex = cell.node.attrs.colspan + i - 1;\n if (cell.node.attrs.colspan > 1 && maybeEndIndex > endIndex) {\n endIndex = maybeEndIndex;\n }\n });\n }\n };\n\n for (var i = columnIndex; i <= endIndex; i++) {\n _loop3(i);\n }\n\n // filter out columns without cells (where all rows have colspan > 1 in the same column)\n var indexes = [];\n for (var i = startIndex; i <= endIndex; i++) {\n var maybeCells = getCellsInColumn(i)(tr.selection);\n if (maybeCells && maybeCells.length) {\n indexes.push(i);\n }\n }\n startIndex = indexes[0];\n endIndex = indexes[indexes.length - 1];\n\n var firstSelectedColumnCells = getCellsInColumn(startIndex)(tr.selection);\n var firstRowCells = getCellsInRow(0)(tr.selection);\n var $anchor = tr.doc.resolve(firstSelectedColumnCells[firstSelectedColumnCells.length - 1].pos);\n\n var headCell = void 0;\n for (var _i3 = endIndex; _i3 >= startIndex; _i3--) {\n var columnCells = getCellsInColumn(_i3)(tr.selection);\n if (columnCells && columnCells.length) {\n for (var j = firstRowCells.length - 1; j >= 0; j--) {\n if (firstRowCells[j].pos === columnCells[0].pos) {\n headCell = columnCells[0];\n break;\n }\n }\n if (headCell) {\n break;\n }\n }\n }\n\n var $head = tr.doc.resolve(headCell.pos);\n return { $anchor: $anchor, $head: $head, indexes: indexes };\n };\n};\n\n// :: (rowIndex: number) → (tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}\n// Returns a range of rectangular selection spanning all merged cells around a row at index `rowIndex`.\n//\n// ```javascript\n// const range = getSelectionRangeInRow(3)(state.tr);\n// ```\nvar getSelectionRangeInRow = function getSelectionRangeInRow(rowIndex) {\n return function (tr) {\n var startIndex = rowIndex;\n var endIndex = rowIndex;\n // looking for selection start row (startIndex)\n\n var _loop4 = function _loop4(i) {\n var cells = getCellsInRow(i)(tr.selection);\n cells.forEach(function (cell) {\n var maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n if (maybeEndIndex >= startIndex) {\n startIndex = i;\n }\n if (maybeEndIndex > endIndex) {\n endIndex = maybeEndIndex;\n }\n });\n };\n\n for (var i = rowIndex; i >= 0; i--) {\n _loop4(i);\n }\n // looking for selection end row (endIndex)\n\n var _loop5 = function _loop5(i) {\n var cells = getCellsInRow(i)(tr.selection);\n cells.forEach(function (cell) {\n var maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n if (cell.node.attrs.rowspan > 1 && maybeEndIndex > endIndex) {\n endIndex = maybeEndIndex;\n }\n });\n };\n\n for (var i = rowIndex; i <= endIndex; i++) {\n _loop5(i);\n }\n\n // filter out rows without cells (where all columns have rowspan > 1 in the same row)\n var indexes = [];\n for (var i = startIndex; i <= endIndex; i++) {\n var maybeCells = getCellsInRow(i)(tr.selection);\n if (maybeCells && maybeCells.length) {\n indexes.push(i);\n }\n }\n startIndex = indexes[0];\n endIndex = indexes[indexes.length - 1];\n\n var firstSelectedRowCells = getCellsInRow(startIndex)(tr.selection);\n var firstColumnCells = getCellsInColumn(0)(tr.selection);\n var $anchor = tr.doc.resolve(firstSelectedRowCells[firstSelectedRowCells.length - 1].pos);\n\n var headCell = void 0;\n for (var _i4 = endIndex; _i4 >= startIndex; _i4--) {\n var rowCells = getCellsInRow(_i4)(tr.selection);\n if (rowCells && rowCells.length) {\n for (var j = firstColumnCells.length - 1; j >= 0; j--) {\n if (firstColumnCells[j].pos === rowCells[0].pos) {\n headCell = rowCells[0];\n break;\n }\n }\n if (headCell) {\n break;\n }\n }\n }\n\n var $head = tr.doc.resolve(headCell.pos);\n return { $anchor: $anchor, $head: $head, indexes: indexes };\n };\n};\n\nexports.isNodeSelection = isNodeSelection;\nexports.canInsert = canInsert;\nexports.convertTableNodeToArrayOfRows = convertTableNodeToArrayOfRows;\nexports.convertArrayOfRowsToTableNode = convertArrayOfRowsToTableNode;\nexports.findParentNode = findParentNode;\nexports.findParentNodeClosestToPos = findParentNodeClosestToPos;\nexports.findParentDomRef = findParentDomRef;\nexports.hasParentNode = hasParentNode;\nexports.findParentNodeOfType = findParentNodeOfType;\nexports.findParentNodeOfTypeClosestToPos = findParentNodeOfTypeClosestToPos;\nexports.hasParentNodeOfType = hasParentNodeOfType;\nexports.findParentDomRefOfType = findParentDomRefOfType;\nexports.findSelectedNodeOfType = findSelectedNodeOfType;\nexports.findPositionOfNodeBefore = findPositionOfNodeBefore;\nexports.findDomRefAtPos = findDomRefAtPos;\nexports.flatten = flatten;\nexports.findChildren = findChildren;\nexports.findTextNodes = findTextNodes;\nexports.findInlineNodes = findInlineNodes;\nexports.findBlockNodes = findBlockNodes;\nexports.findChildrenByAttr = findChildrenByAttr;\nexports.findChildrenByType = findChildrenByType;\nexports.findChildrenByMark = findChildrenByMark;\nexports.contains = contains;\nexports.findTable = findTable;\nexports.isCellSelection = isCellSelection;\nexports.getSelectionRect = getSelectionRect;\nexports.isColumnSelected = isColumnSelected;\nexports.isRowSelected = isRowSelected;\nexports.isTableSelected = isTableSelected;\nexports.getCellsInColumn = getCellsInColumn;\nexports.getCellsInRow = getCellsInRow;\nexports.getCellsInTable = getCellsInTable;\nexports.selectColumn = selectColumn;\nexports.selectRow = selectRow;\nexports.selectTable = selectTable;\nexports.emptyCell = emptyCell;\nexports.addColumnAt = addColumnAt;\nexports.moveRow = moveRow;\nexports.moveColumn = moveColumn;\nexports.addRowAt = addRowAt;\nexports.cloneRowAt = cloneRowAt;\nexports.removeColumnAt = removeColumnAt;\nexports.removeRowAt = removeRowAt;\nexports.removeTable = removeTable;\nexports.removeSelectedColumns = removeSelectedColumns;\nexports.removeSelectedRows = removeSelectedRows;\nexports.removeColumnClosestToPos = removeColumnClosestToPos;\nexports.removeRowClosestToPos = removeRowClosestToPos;\nexports.forEachCellInColumn = forEachCellInColumn;\nexports.forEachCellInRow = forEachCellInRow;\nexports.setCellAttrs = setCellAttrs;\nexports.createTable = createTable;\nexports.findCellClosestToPos = findCellClosestToPos;\nexports.findCellRectClosestToPos = findCellRectClosestToPos;\nexports.getSelectionRangeInColumn = getSelectionRangeInColumn;\nexports.getSelectionRangeInRow = getSelectionRangeInRow;\nexports.removeParentNodeOfType = removeParentNodeOfType;\nexports.replaceParentNodeOfType = replaceParentNodeOfType;\nexports.removeSelectedNode = removeSelectedNode;\nexports.replaceSelectedNode = replaceSelectedNode;\nexports.setTextSelection = setTextSelection;\nexports.safeInsert = safeInsert;\nexports.setParentNodeMarkup = setParentNodeMarkup;\nexports.selectParentNodeOfType = selectParentNodeOfType;\nexports.removeNodeBefore = removeNodeBefore;\n//# sourceMappingURL=index.js.map\n","import { TextSelection, Selection, NodeSelection } from 'prosemirror-state';\nimport { DOMSerializer, Fragment, Mark, DOMParser, Slice } from 'prosemirror-model';\nimport { dropPoint } from 'prosemirror-transform';\n\nvar result = {};\n\nif (typeof navigator != \"undefined\" && typeof document != \"undefined\") {\n var ie_edge = /Edge\\/(\\d+)/.exec(navigator.userAgent);\n var ie_upto10 = /MSIE \\d/.test(navigator.userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);\n\n result.mac = /Mac/.test(navigator.platform);\n var ie = result.ie = !!(ie_upto10 || ie_11up || ie_edge);\n result.ie_version = ie_upto10 ? document.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : null;\n result.gecko = !ie && /gecko\\/(\\d+)/i.test(navigator.userAgent);\n result.gecko_version = result.gecko && +(/Firefox\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1];\n var chrome = !ie && /Chrome\\/(\\d+)/.exec(navigator.userAgent);\n result.chrome = !!chrome;\n result.chrome_version = chrome && +chrome[1];\n result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\\/\\w+/.test(navigator.userAgent);\n result.android = /Android \\d/.test(navigator.userAgent);\n result.webkit = \"webkitFontSmoothing\" in document.documentElement.style;\n result.safari = /Apple Computer/.test(navigator.vendor);\n result.webkit_version = result.webkit && +(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1];\n}\n\nvar domIndex = function(node) {\n for (var index = 0;; index++) {\n node = node.previousSibling;\n if (!node) { return index }\n }\n};\n\nvar parentNode = function(node) {\n var parent = node.parentNode;\n return parent && parent.nodeType == 11 ? parent.host : parent\n};\n\nvar textRange = function(node, from, to) {\n var range = document.createRange();\n range.setEnd(node, to == null ? node.nodeValue.length : to);\n range.setStart(node, from || 0);\n return range\n};\n\n// Scans forward and backward through DOM positions equivalent to the\n// given one to see if the two are in the same place (i.e. after a\n// text node vs at the end of that text node)\nvar isEquivalentPosition = function(node, off, targetNode, targetOff) {\n return targetNode && (scanFor(node, off, targetNode, targetOff, -1) ||\n scanFor(node, off, targetNode, targetOff, 1))\n};\n\nvar atomElements = /^(img|br|input|textarea|hr)$/i;\n\nfunction scanFor(node, off, targetNode, targetOff, dir) {\n for (;;) {\n if (node == targetNode && off == targetOff) { return true }\n if (off == (dir < 0 ? 0 : nodeSize(node))) {\n var parent = node.parentNode;\n if (parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == \"false\")\n { return false }\n off = domIndex(node) + (dir < 0 ? 0 : 1);\n node = parent;\n } else if (node.nodeType == 1) {\n node = node.childNodes[off + (dir < 0 ? -1 : 0)];\n if (node.contentEditable == \"false\") { return false }\n off = dir < 0 ? nodeSize(node) : 0;\n } else {\n return false\n }\n }\n}\n\nfunction nodeSize(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length\n}\n\nfunction isOnEdge(node, offset, parent) {\n for (var atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {\n if (node == parent) { return true }\n var index = domIndex(node);\n node = node.parentNode;\n if (!node) { return false }\n atStart = atStart && index == 0;\n atEnd = atEnd && index == nodeSize(node);\n }\n}\n\nfunction hasBlockDesc(dom) {\n var desc;\n for (var cur = dom; cur; cur = cur.parentNode) { if (desc = cur.pmViewDesc) { break } }\n return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom)\n}\n\n// Work around Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=447523\n// (isCollapsed inappropriately returns true in shadow dom)\nvar selectionCollapsed = function(domSel) {\n var collapsed = domSel.isCollapsed;\n if (collapsed && result.chrome && domSel.rangeCount && !domSel.getRangeAt(0).collapsed)\n { collapsed = false; }\n return collapsed\n};\n\nfunction keyEvent(keyCode, key) {\n var event = document.createEvent(\"Event\");\n event.initEvent(\"keydown\", true, true);\n event.keyCode = keyCode;\n event.key = event.code = key;\n return event\n}\n\nfunction windowRect(win) {\n return {left: 0, right: win.innerWidth,\n top: 0, bottom: win.innerHeight}\n}\n\nfunction getSide(value, side) {\n return typeof value == \"number\" ? value : value[side]\n}\n\nfunction scrollRectIntoView(view, rect, startDOM) {\n var scrollThreshold = view.someProp(\"scrollThreshold\") || 0, scrollMargin = view.someProp(\"scrollMargin\") || 5;\n var doc = view.dom.ownerDocument, win = doc.defaultView;\n for (var parent = startDOM || view.dom;; parent = parentNode(parent)) {\n if (!parent) { break }\n if (parent.nodeType != 1) { continue }\n var atTop = parent == doc.body || parent.nodeType != 1;\n var bounding = atTop ? windowRect(win) : parent.getBoundingClientRect();\n var moveX = 0, moveY = 0;\n if (rect.top < bounding.top + getSide(scrollThreshold, \"top\"))\n { moveY = -(bounding.top - rect.top + getSide(scrollMargin, \"top\")); }\n else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, \"bottom\"))\n { moveY = rect.bottom - bounding.bottom + getSide(scrollMargin, \"bottom\"); }\n if (rect.left < bounding.left + getSide(scrollThreshold, \"left\"))\n { moveX = -(bounding.left - rect.left + getSide(scrollMargin, \"left\")); }\n else if (rect.right > bounding.right - getSide(scrollThreshold, \"right\"))\n { moveX = rect.right - bounding.right + getSide(scrollMargin, \"right\"); }\n if (moveX || moveY) {\n if (atTop) {\n win.scrollBy(moveX, moveY);\n } else {\n var startX = parent.scrollLeft, startY = parent.scrollTop;\n if (moveY) { parent.scrollTop += moveY; }\n if (moveX) { parent.scrollLeft += moveX; }\n var dX = parent.scrollLeft - startX, dY = parent.scrollTop - startY;\n rect = {left: rect.left - dX, top: rect.top - dY, right: rect.right - dX, bottom: rect.bottom - dY};\n }\n }\n if (atTop) { break }\n }\n}\n\n// Store the scroll position of the editor's parent nodes, along with\n// the top position of an element near the top of the editor, which\n// will be used to make sure the visible viewport remains stable even\n// when the size of the content above changes.\nfunction storeScrollPos(view) {\n var rect = view.dom.getBoundingClientRect(), startY = Math.max(0, rect.top);\n var refDOM, refTop;\n for (var x = (rect.left + rect.right) / 2, y = startY + 1;\n y < Math.min(innerHeight, rect.bottom); y += 5) {\n var dom = view.root.elementFromPoint(x, y);\n if (dom == view.dom || !view.dom.contains(dom)) { continue }\n var localRect = dom.getBoundingClientRect();\n if (localRect.top >= startY - 20) {\n refDOM = dom;\n refTop = localRect.top;\n break\n }\n }\n return {refDOM: refDOM, refTop: refTop, stack: scrollStack(view.dom)}\n}\n\nfunction scrollStack(dom) {\n var stack = [], doc = dom.ownerDocument;\n for (; dom; dom = parentNode(dom)) {\n stack.push({dom: dom, top: dom.scrollTop, left: dom.scrollLeft});\n if (dom == doc) { break }\n }\n return stack\n}\n\n// Reset the scroll position of the editor's parent nodes to that what\n// it was before, when storeScrollPos was called.\nfunction resetScrollPos(ref) {\n var refDOM = ref.refDOM;\n var refTop = ref.refTop;\n var stack = ref.stack;\n\n var newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;\n restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);\n}\n\nfunction restoreScrollStack(stack, dTop) {\n for (var i = 0; i < stack.length; i++) {\n var ref = stack[i];\n var dom = ref.dom;\n var top = ref.top;\n var left = ref.left;\n if (dom.scrollTop != top + dTop) { dom.scrollTop = top + dTop; }\n if (dom.scrollLeft != left) { dom.scrollLeft = left; }\n }\n}\n\nvar preventScrollSupported = null;\n// Feature-detects support for .focus({preventScroll: true}), and uses\n// a fallback kludge when not supported.\nfunction focusPreventScroll(dom) {\n if (dom.setActive) { return dom.setActive() } // in IE\n if (preventScrollSupported) { return dom.focus(preventScrollSupported) }\n\n var stored = scrollStack(dom);\n dom.focus(preventScrollSupported == null ? {\n get preventScroll() {\n preventScrollSupported = {preventScroll: true};\n return true\n }\n } : undefined);\n if (!preventScrollSupported) {\n preventScrollSupported = false;\n restoreScrollStack(stored, 0);\n }\n}\n\nfunction findOffsetInNode(node, coords) {\n var closest, dxClosest = 2e8, coordsClosest, offset = 0;\n var rowBot = coords.top, rowTop = coords.top;\n for (var child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {\n var rects = (void 0);\n if (child.nodeType == 1) { rects = child.getClientRects(); }\n else if (child.nodeType == 3) { rects = textRange(child).getClientRects(); }\n else { continue }\n\n for (var i = 0; i < rects.length; i++) {\n var rect = rects[i];\n if (rect.top <= rowBot && rect.bottom >= rowTop) {\n rowBot = Math.max(rect.bottom, rowBot);\n rowTop = Math.min(rect.top, rowTop);\n var dx = rect.left > coords.left ? rect.left - coords.left\n : rect.right < coords.left ? coords.left - rect.right : 0;\n if (dx < dxClosest) {\n closest = child;\n dxClosest = dx;\n coordsClosest = dx && closest.nodeType == 3 ? {left: rect.right < coords.left ? rect.right : rect.left, top: coords.top} : coords;\n if (child.nodeType == 1 && dx)\n { offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0); }\n continue\n }\n }\n if (!closest && (coords.left >= rect.right && coords.top >= rect.top ||\n coords.left >= rect.left && coords.top >= rect.bottom))\n { offset = childIndex + 1; }\n }\n }\n if (closest && closest.nodeType == 3) { return findOffsetInText(closest, coordsClosest) }\n if (!closest || (dxClosest && closest.nodeType == 1)) { return {node: node, offset: offset} }\n return findOffsetInNode(closest, coordsClosest)\n}\n\nfunction findOffsetInText(node, coords) {\n var len = node.nodeValue.length;\n var range = document.createRange();\n for (var i = 0; i < len; i++) {\n range.setEnd(node, i + 1);\n range.setStart(node, i);\n var rect = singleRect(range, 1);\n if (rect.top == rect.bottom) { continue }\n if (inRect(coords, rect))\n { return {node: node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0)} }\n }\n return {node: node, offset: 0}\n}\n\nfunction inRect(coords, rect) {\n return coords.left >= rect.left - 1 && coords.left <= rect.right + 1&&\n coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1\n}\n\nfunction targetKludge(dom, coords) {\n var parent = dom.parentNode;\n if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left)\n { return parent }\n return dom\n}\n\nfunction posFromElement(view, elt, coords) {\n var ref = findOffsetInNode(elt, coords);\n var node = ref.node;\n var offset = ref.offset;\n var bias = -1;\n if (node.nodeType == 1 && !node.firstChild) {\n var rect = node.getBoundingClientRect();\n bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;\n }\n return view.docView.posFromDOM(node, offset, bias)\n}\n\nfunction posFromCaret(view, node, offset, coords) {\n // Browser (in caretPosition/RangeFromPoint) will agressively\n // normalize towards nearby inline nodes. Since we are interested in\n // positions between block nodes too, we first walk up the hierarchy\n // of nodes to see if there are block nodes that the coordinates\n // fall outside of. If so, we take the position before/after that\n // block. If not, we call `posFromDOM` on the raw node/offset.\n var outside = -1;\n for (var cur = node;;) {\n if (cur == view.dom) { break }\n var desc = view.docView.nearestDesc(cur, true);\n if (!desc) { return null }\n if (desc.node.isBlock && desc.parent) {\n var rect = desc.dom.getBoundingClientRect();\n if (rect.left > coords.left || rect.top > coords.top) { outside = desc.posBefore; }\n else if (rect.right < coords.left || rect.bottom < coords.top) { outside = desc.posAfter; }\n else { break }\n }\n cur = desc.dom.parentNode;\n }\n return outside > -1 ? outside : view.docView.posFromDOM(node, offset)\n}\n\nfunction elementFromPoint(element, coords, box) {\n var len = element.childNodes.length;\n if (len && box.top < box.bottom) {\n for (var startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {\n var child = element.childNodes[i];\n if (child.nodeType == 1) {\n var rects = child.getClientRects();\n for (var j = 0; j < rects.length; j++) {\n var rect = rects[j];\n if (inRect(coords, rect)) { return elementFromPoint(child, coords, rect) }\n }\n }\n if ((i = (i + 1) % len) == startI) { break }\n }\n }\n return element\n}\n\n// Given an x,y position on the editor, get the position in the document.\nfunction posAtCoords(view, coords) {\n var assign, assign$1;\n\n var root = view.root, node, offset;\n if (root.caretPositionFromPoint) {\n try { // Firefox throws for this call in hard-to-predict circumstances (#994)\n var pos$1 = root.caretPositionFromPoint(coords.left, coords.top);\n if (pos$1) { ((assign = pos$1, node = assign.offsetNode, offset = assign.offset)); }\n } catch (_) {}\n }\n if (!node && root.caretRangeFromPoint) {\n var range = root.caretRangeFromPoint(coords.left, coords.top);\n if (range) { ((assign$1 = range, node = assign$1.startContainer, offset = assign$1.startOffset)); }\n }\n\n var elt = root.elementFromPoint(coords.left, coords.top + 1), pos;\n if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {\n var box = view.dom.getBoundingClientRect();\n if (!inRect(coords, box)) { return null }\n elt = elementFromPoint(view.dom, coords, box);\n if (!elt) { return null }\n }\n elt = targetKludge(elt, coords);\n if (node) {\n if (result.gecko && node.nodeType == 1) {\n // Firefox will sometimes return offsets into <input> nodes, which\n // have no actual children, from caretPositionFromPoint (#953)\n offset = Math.min(offset, node.childNodes.length);\n // It'll also move the returned position before image nodes,\n // even if those are behind it.\n if (offset < node.childNodes.length) {\n var next = node.childNodes[offset], box$1;\n if (next.nodeName == \"IMG\" && (box$1 = next.getBoundingClientRect()).right <= coords.left &&\n box$1.bottom > coords.top)\n { offset++; }\n }\n }\n // Suspiciously specific kludge to work around caret*FromPoint\n // never returning a position at the end of the document\n if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 &&\n coords.top > node.lastChild.getBoundingClientRect().bottom)\n { pos = view.state.doc.content.size; }\n // Ignore positions directly after a BR, since caret*FromPoint\n // 'round up' positions that would be more accurately placed\n // before the BR node.\n else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != \"BR\")\n { pos = posFromCaret(view, node, offset, coords); }\n }\n if (pos == null) { pos = posFromElement(view, elt, coords); }\n\n var desc = view.docView.nearestDesc(elt, true);\n return {pos: pos, inside: desc ? desc.posAtStart - desc.border : -1}\n}\n\nfunction singleRect(object, bias) {\n var rects = object.getClientRects();\n return !rects.length ? object.getBoundingClientRect() : rects[bias < 0 ? 0 : rects.length - 1]\n}\n\n// : (EditorView, number) → {left: number, top: number, right: number, bottom: number}\n// Given a position in the document model, get a bounding box of the\n// character at that position, relative to the window.\nfunction coordsAtPos(view, pos) {\n var ref = view.docView.domFromPos(pos);\n var node = ref.node;\n var offset = ref.offset;\n\n // These browsers support querying empty text ranges\n if (node.nodeType == 3 && (result.webkit || result.gecko)) {\n var rect = singleRect(textRange(node, offset, offset), 0);\n // Firefox returns bad results (the position before the space)\n // when querying a position directly after line-broken\n // whitespace. Detect this situation and and kludge around it\n if (result.gecko && offset && /\\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {\n var rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);\n if (rectBefore.top == rect.top) {\n var rectAfter = singleRect(textRange(node, offset, offset + 1), -1);\n if (rectAfter.top != rect.top)\n { return flattenV(rectAfter, rectAfter.left < rectBefore.left) }\n }\n }\n return rect\n }\n\n if (node.nodeType == 1 && !view.state.doc.resolve(pos).parent.inlineContent) {\n // Return a horizontal line in block context\n var top = true, rect$1;\n if (offset < node.childNodes.length) {\n var after = node.childNodes[offset];\n if (after.nodeType == 1) { rect$1 = after.getBoundingClientRect(); }\n }\n if (!rect$1 && offset) {\n var before = node.childNodes[offset - 1];\n if (before.nodeType == 1) { rect$1 = before.getBoundingClientRect(); top = false; }\n }\n return flattenH(rect$1 || node.getBoundingClientRect(), top)\n }\n\n // Not Firefox/Chrome, or not in a text node, so we have to use\n // actual element/character rectangles to get a solution (this part\n // is not very bidi-safe)\n //\n // Try the left side first, fall back to the right one if that\n // doesn't work.\n for (var dir = -1; dir < 2; dir += 2) {\n if (dir < 0 && offset) {\n var prev = (void 0), target = node.nodeType == 3 ? textRange(node, offset - 1, offset)\n : (prev = node.childNodes[offset - 1]).nodeType == 3 ? textRange(prev)\n : prev.nodeType == 1 && prev.nodeName != \"BR\" ? prev : null; // BR nodes tend to only return the rectangle before them\n if (target) {\n var rect$2 = singleRect(target, 1);\n if (rect$2.top < rect$2.bottom) { return flattenV(rect$2, false) }\n }\n } else if (dir > 0 && offset < nodeSize(node)) {\n var next = (void 0), target$1 = node.nodeType == 3 ? textRange(node, offset, offset + 1)\n : (next = node.childNodes[offset]).nodeType == 3 ? textRange(next)\n : next.nodeType == 1 ? next : null;\n if (target$1) {\n var rect$3 = singleRect(target$1, -1);\n if (rect$3.top < rect$3.bottom) { return flattenV(rect$3, true) }\n }\n }\n }\n // All else failed, just try to get a rectangle for the target node\n return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, 0), false)\n}\n\nfunction flattenV(rect, left) {\n if (rect.width == 0) { return rect }\n var x = left ? rect.left : rect.right;\n return {top: rect.top, bottom: rect.bottom, left: x, right: x}\n}\n\nfunction flattenH(rect, top) {\n if (rect.height == 0) { return rect }\n var y = top ? rect.top : rect.bottom;\n return {top: y, bottom: y, left: rect.left, right: rect.right}\n}\n\nfunction withFlushedState(view, state, f) {\n var viewState = view.state, active = view.root.activeElement;\n if (viewState != state) { view.updateState(state); }\n if (active != view.dom) { view.focus(); }\n try {\n return f()\n } finally {\n if (viewState != state) { view.updateState(viewState); }\n if (active != view.dom) { active.focus(); }\n }\n}\n\n// : (EditorView, number, number)\n// Whether vertical position motion in a given direction\n// from a position would leave a text block.\nfunction endOfTextblockVertical(view, state, dir) {\n var sel = state.selection;\n var $pos = dir == \"up\" ? sel.$anchor.min(sel.$head) : sel.$anchor.max(sel.$head);\n return withFlushedState(view, state, function () {\n var ref = view.docView.domFromPos($pos.pos);\n var dom = ref.node;\n for (;;) {\n var nearest = view.docView.nearestDesc(dom, true);\n if (!nearest) { break }\n if (nearest.node.isBlock) { dom = nearest.dom; break }\n dom = nearest.dom.parentNode;\n }\n var coords = coordsAtPos(view, $pos.pos);\n for (var child = dom.firstChild; child; child = child.nextSibling) {\n var boxes = (void 0);\n if (child.nodeType == 1) { boxes = child.getClientRects(); }\n else if (child.nodeType == 3) { boxes = textRange(child, 0, child.nodeValue.length).getClientRects(); }\n else { continue }\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n if (box.bottom > box.top && (dir == \"up\" ? box.bottom < coords.top + 1 : box.top > coords.bottom - 1))\n { return false }\n }\n }\n return true\n })\n}\n\nvar maybeRTL = /[\\u0590-\\u08ac]/;\n\nfunction endOfTextblockHorizontal(view, state, dir) {\n var ref = state.selection;\n var $head = ref.$head;\n if (!$head.parent.isTextblock) { return false }\n var offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size;\n var sel = getSelection();\n // If the textblock is all LTR, or the browser doesn't support\n // Selection.modify (Edge), fall back to a primitive approach\n if (!maybeRTL.test($head.parent.textContent) || !sel.modify)\n { return dir == \"left\" || dir == \"backward\" ? atStart : atEnd }\n\n return withFlushedState(view, state, function () {\n // This is a huge hack, but appears to be the best we can\n // currently do: use `Selection.modify` to move the selection by\n // one character, and see if that moves the cursor out of the\n // textblock (or doesn't move it at all, when at the start/end of\n // the document).\n var oldRange = sel.getRangeAt(0), oldNode = sel.focusNode, oldOff = sel.focusOffset;\n var oldBidiLevel = sel.caretBidiLevel; // Only for Firefox\n sel.modify(\"move\", dir, \"character\");\n var parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;\n var result = !parentDOM.contains(sel.focusNode.nodeType == 1 ? sel.focusNode : sel.focusNode.parentNode) ||\n (oldNode == sel.focusNode && oldOff == sel.focusOffset);\n // Restore the previous selection\n sel.removeAllRanges();\n sel.addRange(oldRange);\n if (oldBidiLevel != null) { sel.caretBidiLevel = oldBidiLevel; }\n return result\n })\n}\n\nvar cachedState = null, cachedDir = null, cachedResult = false;\nfunction endOfTextblock(view, state, dir) {\n if (cachedState == state && cachedDir == dir) { return cachedResult }\n cachedState = state; cachedDir = dir;\n return cachedResult = dir == \"up\" || dir == \"down\"\n ? endOfTextblockVertical(view, state, dir)\n : endOfTextblockHorizontal(view, state, dir)\n}\n\n// NodeView:: interface\n//\n// By default, document nodes are rendered using the result of the\n// [`toDOM`](#model.NodeSpec.toDOM) method of their spec, and managed\n// entirely by the editor. For some use cases, such as embedded\n// node-specific editing interfaces, you want more control over\n// the behavior of a node's in-editor representation, and need to\n// [define](#view.EditorProps.nodeViews) a custom node view.\n//\n// Objects returned as node views must conform to this interface.\n//\n// dom:: ?dom.Node\n// The outer DOM node that represents the document node. When not\n// given, the default strategy is used to create a DOM node.\n//\n// contentDOM:: ?dom.Node\n// The DOM node that should hold the node's content. Only meaningful\n// if the node view also defines a `dom` property and if its node\n// type is not a leaf node type. When this is present, ProseMirror\n// will take care of rendering the node's children into it. When it\n// is not present, the node view itself is responsible for rendering\n// (or deciding not to render) its child nodes.\n//\n// update:: ?(node: Node, decorations: [Decoration]) → bool\n// When given, this will be called when the view is updating itself.\n// It will be given a node (possibly of a different type), and an\n// array of active decorations (which are automatically drawn, and\n// the node view may ignore if it isn't interested in them), and\n// should return true if it was able to update to that node, and\n// false otherwise. If the node view has a `contentDOM` property (or\n// no `dom` property), updating its child nodes will be handled by\n// ProseMirror.\n//\n// selectNode:: ?()\n// Can be used to override the way the node's selected status (as a\n// node selection) is displayed.\n//\n// deselectNode:: ?()\n// When defining a `selectNode` method, you should also provide a\n// `deselectNode` method to remove the effect again.\n//\n// setSelection:: ?(anchor: number, head: number, root: dom.Document)\n// This will be called to handle setting the selection inside the\n// node. The `anchor` and `head` positions are relative to the start\n// of the node. By default, a DOM selection will be created between\n// the DOM positions corresponding to those positions, but if you\n// override it you can do something else.\n//\n// stopEvent:: ?(event: dom.Event) → bool\n// Can be used to prevent the editor view from trying to handle some\n// or all DOM events that bubble up from the node view. Events for\n// which this returns true are not handled by the editor.\n//\n// ignoreMutation:: ?(dom.MutationRecord) → bool\n// Called when a DOM\n// [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)\n// or a selection change happens within the view. When the change is\n// a selection change, the record will have a `type` property of\n// `\"selection\"` (which doesn't occur for native mutation records).\n// Return false if the editor should re-read the selection or\n// re-parse the range around the mutation, true if it can safely be\n// ignored.\n//\n// destroy:: ?()\n// Called when the node view is removed from the editor or the whole\n// editor is destroyed.\n\n// View descriptions are data structures that describe the DOM that is\n// used to represent the editor's content. They are used for:\n//\n// - Incremental redrawing when the document changes\n//\n// - Figuring out what part of the document a given DOM position\n// corresponds to\n//\n// - Wiring in custom implementations of the editing interface for a\n// given node\n//\n// They form a doubly-linked mutable tree, starting at `view.docView`.\n\nvar NOT_DIRTY = 0, CHILD_DIRTY = 1, CONTENT_DIRTY = 2, NODE_DIRTY = 3;\n\n// Superclass for the various kinds of descriptions. Defines their\n// basic structure and shared methods.\nvar ViewDesc = function ViewDesc(parent, children, dom, contentDOM) {\n this.parent = parent;\n this.children = children;\n this.dom = dom;\n // An expando property on the DOM node provides a link back to its\n // description.\n dom.pmViewDesc = this;\n // This is the node that holds the child views. It may be null for\n // descs that don't have children.\n this.contentDOM = contentDOM;\n this.dirty = NOT_DIRTY;\n};\n\nvar prototypeAccessors = { beforePosition: { configurable: true },size: { configurable: true },border: { configurable: true },posBefore: { configurable: true },posAtStart: { configurable: true },posAfter: { configurable: true },posAtEnd: { configurable: true },contentLost: { configurable: true } };\n\n// Used to check whether a given description corresponds to a\n// widget/mark/node.\nViewDesc.prototype.matchesWidget = function matchesWidget () { return false };\nViewDesc.prototype.matchesMark = function matchesMark () { return false };\nViewDesc.prototype.matchesNode = function matchesNode () { return false };\nViewDesc.prototype.matchesHack = function matchesHack () { return false };\n\nprototypeAccessors.beforePosition.get = function () { return false };\n\n// : () → ?ParseRule\n// When parsing in-editor content (in domchange.js), we allow\n// descriptions to determine the parse rules that should be used to\n// parse them.\nViewDesc.prototype.parseRule = function parseRule () { return null };\n\n// : (dom.Event) → bool\n// Used by the editor's event handler to ignore events that come\n// from certain descs.\nViewDesc.prototype.stopEvent = function stopEvent () { return false };\n\n// The size of the content represented by this desc.\nprototypeAccessors.size.get = function () {\n var size = 0;\n for (var i = 0; i < this.children.length; i++) { size += this.children[i].size; }\n return size\n};\n\n// For block nodes, this represents the space taken up by their\n// start/end tokens.\nprototypeAccessors.border.get = function () { return 0 };\n\nViewDesc.prototype.destroy = function destroy () {\n this.parent = null;\n if (this.dom.pmViewDesc == this) { this.dom.pmViewDesc = null; }\n for (var i = 0; i < this.children.length; i++)\n { this.children[i].destroy(); }\n};\n\nViewDesc.prototype.posBeforeChild = function posBeforeChild (child) {\n for (var i = 0, pos = this.posAtStart; i < this.children.length; i++) {\n var cur = this.children[i];\n if (cur == child) { return pos }\n pos += cur.size;\n }\n};\n\nprototypeAccessors.posBefore.get = function () {\n return this.parent.posBeforeChild(this)\n};\n\nprototypeAccessors.posAtStart.get = function () {\n return this.parent ? this.parent.posBeforeChild(this) + this.border : 0\n};\n\nprototypeAccessors.posAfter.get = function () {\n return this.posBefore + this.size\n};\n\nprototypeAccessors.posAtEnd.get = function () {\n return this.posAtStart + this.size - 2 * this.border\n};\n\n// : (dom.Node, number, ?number) → number\nViewDesc.prototype.localPosFromDOM = function localPosFromDOM (dom, offset, bias) {\n // If the DOM position is in the content, use the child desc after\n // it to figure out a position.\n if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) {\n if (bias < 0) {\n var domBefore, desc;\n if (dom == this.contentDOM) {\n domBefore = dom.childNodes[offset - 1];\n } else {\n while (dom.parentNode != this.contentDOM) { dom = dom.parentNode; }\n domBefore = dom.previousSibling;\n }\n while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) { domBefore = domBefore.previousSibling; }\n return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart\n } else {\n var domAfter, desc$1;\n if (dom == this.contentDOM) {\n domAfter = dom.childNodes[offset];\n } else {\n while (dom.parentNode != this.contentDOM) { dom = dom.parentNode; }\n domAfter = dom.nextSibling;\n }\n while (domAfter && !((desc$1 = domAfter.pmViewDesc) && desc$1.parent == this)) { domAfter = domAfter.nextSibling; }\n return domAfter ? this.posBeforeChild(desc$1) : this.posAtEnd\n }\n }\n // Otherwise, use various heuristics, falling back on the bias\n // parameter, to determine whether to return the position at the\n // start or at the end of this view desc.\n var atEnd;\n if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {\n atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;\n } else if (this.dom.firstChild) {\n if (offset == 0) { for (var search = dom;; search = search.parentNode) {\n if (search == this.dom) { atEnd = false; break }\n if (search.parentNode.firstChild != search) { break }\n } }\n if (atEnd == null && offset == dom.childNodes.length) { for (var search$1 = dom;; search$1 = search$1.parentNode) {\n if (search$1 == this.dom) { atEnd = true; break }\n if (search$1.parentNode.lastChild != search$1) { break }\n } }\n }\n return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart\n};\n\n// Scan up the dom finding the first desc that is a descendant of\n// this one.\nViewDesc.prototype.nearestDesc = function nearestDesc (dom, onlyNodes) {\n for (var first = true, cur = dom; cur; cur = cur.parentNode) {\n var desc = this.getDesc(cur);\n if (desc && (!onlyNodes || desc.node)) {\n // If dom is outside of this desc's nodeDOM, don't count it.\n if (first && desc.nodeDOM &&\n !(desc.nodeDOM.nodeType == 1 ? desc.nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : desc.nodeDOM == dom))\n { first = false; }\n else\n { return desc }\n }\n }\n};\n\nViewDesc.prototype.getDesc = function getDesc (dom) {\n var desc = dom.pmViewDesc;\n for (var cur = desc; cur; cur = cur.parent) { if (cur == this) { return desc } }\n};\n\nViewDesc.prototype.posFromDOM = function posFromDOM (dom, offset, bias) {\n for (var scan = dom;; scan = scan.parentNode) {\n var desc = this.getDesc(scan);\n if (desc) { return desc.localPosFromDOM(dom, offset, bias) }\n }\n};\n\n// : (number) → ?NodeViewDesc\n// Find the desc for the node after the given pos, if any. (When a\n// parent node overrode rendering, there might not be one.)\nViewDesc.prototype.descAt = function descAt (pos) {\n for (var i = 0, offset = 0; i < this.children.length; i++) {\n var child = this.children[i], end = offset + child.size;\n if (offset == pos && end != offset) {\n while (!child.border && child.children.length) { child = child.children[0]; }\n return child\n }\n if (pos < end) { return child.descAt(pos - offset - child.border) }\n offset = end;\n }\n};\n\n// : (number) → {node: dom.Node, offset: number}\nViewDesc.prototype.domFromPos = function domFromPos (pos) {\n if (!this.contentDOM) { return {node: this.dom, offset: 0} }\n for (var offset = 0, i = 0;; i++) {\n if (offset == pos) {\n while (i < this.children.length && (this.children[i].beforePosition || this.children[i].dom.parentNode != this.contentDOM)) { i++; }\n return {node: this.contentDOM,\n offset: i == this.children.length ? this.contentDOM.childNodes.length : domIndex(this.children[i].dom)}\n }\n if (i == this.children.length) { throw new Error(\"Invalid position \" + pos) }\n var child = this.children[i], end = offset + child.size;\n if (pos < end) { return child.domFromPos(pos - offset - child.border) }\n offset = end;\n }\n};\n\n// Used to find a DOM range in a single parent for a given changed\n// range.\nViewDesc.prototype.parseRange = function parseRange (from, to, base) {\n if ( base === void 0 ) base = 0;\n\n if (this.children.length == 0)\n { return {node: this.contentDOM, from: from, to: to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length} }\n\n var fromOffset = -1, toOffset = -1;\n for (var offset = base, i = 0;; i++) {\n var child = this.children[i], end = offset + child.size;\n if (fromOffset == -1 && from <= end) {\n var childBase = offset + child.border;\n // FIXME maybe descend mark views to parse a narrower range?\n if (from >= childBase && to <= end - child.border && child.node &&\n child.contentDOM && this.contentDOM.contains(child.contentDOM))\n { return child.parseRange(from, to, childBase) }\n\n from = offset;\n for (var j = i; j > 0; j--) {\n var prev = this.children[j - 1];\n if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {\n fromOffset = domIndex(prev.dom) + 1;\n break\n }\n from -= prev.size;\n }\n if (fromOffset == -1) { fromOffset = 0; }\n }\n if (fromOffset > -1 && to <= end) {\n to = end;\n for (var j$1 = i + 1; j$1 < this.children.length; j$1++) {\n var next = this.children[j$1];\n if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {\n toOffset = domIndex(next.dom);\n break\n }\n to += next.size;\n }\n if (toOffset == -1) { toOffset = this.contentDOM.childNodes.length; }\n break\n }\n offset = end;\n }\n return {node: this.contentDOM, from: from, to: to, fromOffset: fromOffset, toOffset: toOffset}\n};\n\nViewDesc.prototype.emptyChildAt = function emptyChildAt (side) {\n if (this.border || !this.contentDOM || !this.children.length) { return false }\n var child = this.children[side < 0 ? 0 : this.children.length - 1];\n return child.size == 0 || child.emptyChildAt(side)\n};\n\n// : (number) → dom.Node\nViewDesc.prototype.domAfterPos = function domAfterPos (pos) {\n var ref = this.domFromPos(pos);\n var node = ref.node;\n var offset = ref.offset;\n if (node.nodeType != 1 || offset == node.childNodes.length)\n { throw new RangeError(\"No node after pos \" + pos) }\n return node.childNodes[offset]\n};\n\n// : (number, number, dom.Document)\n// View descs are responsible for setting any selection that falls\n// entirely inside of them, so that custom implementations can do\n// custom things with the selection. Note that this falls apart when\n// a selection starts in such a node and ends in another, in which\n// case we just use whatever domFromPos produces as a best effort.\nViewDesc.prototype.setSelection = function setSelection (anchor, head, root, force) {\n // If the selection falls entirely in a child, give it to that child\n var from = Math.min(anchor, head), to = Math.max(anchor, head);\n for (var i = 0, offset = 0; i < this.children.length; i++) {\n var child = this.children[i], end = offset + child.size;\n if (from > offset && to < end)\n { return child.setSelection(anchor - offset - child.border, head - offset - child.border, root, force) }\n offset = end;\n }\n\n var anchorDOM = this.domFromPos(anchor), headDOM = this.domFromPos(head);\n var domSel = root.getSelection();\n\n if (!force &&\n isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset) &&\n isEquivalentPosition(headDOM.node, headDOM.offset, domSel.focusNode, domSel.focusOffset))\n { return }\n\n // Selection.extend can be used to create an 'inverted' selection\n // (one where the focus is before the anchor), but not all\n // browsers support it yet.\n if (domSel.extend || anchor == head) {\n domSel.collapse(anchorDOM.node, anchorDOM.offset);\n if (anchor != head) { domSel.extend(headDOM.node, headDOM.offset); }\n } else {\n if (anchor > head) { var tmp = anchorDOM; anchorDOM = headDOM; headDOM = tmp; }\n var range = document.createRange();\n range.setEnd(headDOM.node, headDOM.offset);\n range.setStart(anchorDOM.node, anchorDOM.offset);\n domSel.removeAllRanges();\n domSel.addRange(range);\n }\n};\n\n// : (dom.MutationRecord) → bool\nViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n return !this.contentDOM && mutation.type != \"selection\"\n};\n\nprototypeAccessors.contentLost.get = function () {\n return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM)\n};\n\n// Remove a subtree of the element tree that has been touched\n// by a DOM change, so that the next update will redraw it.\nViewDesc.prototype.markDirty = function markDirty (from, to) {\n for (var offset = 0, i = 0; i < this.children.length; i++) {\n var child = this.children[i], end = offset + child.size;\n if (offset == end ? from <= end && to >= offset : from < end && to > offset) {\n var startInside = offset + child.border, endInside = end - child.border;\n if (from >= startInside && to <= endInside) {\n this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;\n if (from == startInside && to == endInside &&\n (child.contentLost || child.dom.parentNode != this.contentDOM)) { child.dirty = NODE_DIRTY; }\n else { child.markDirty(from - startInside, to - startInside); }\n return\n } else {\n child.dirty = NODE_DIRTY;\n }\n }\n offset = end;\n }\n this.dirty = CONTENT_DIRTY;\n};\n\nViewDesc.prototype.markParentsDirty = function markParentsDirty () {\n var level = 1;\n for (var node = this.parent; node; node = node.parent, level++) {\n var dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;\n if (node.dirty < dirty) { node.dirty = dirty; }\n }\n};\n\nObject.defineProperties( ViewDesc.prototype, prototypeAccessors );\n\n// Reused array to avoid allocating fresh arrays for things that will\n// stay empty anyway.\nvar nothing = [];\n\n// A widget desc represents a widget decoration, which is a DOM node\n// drawn between the document nodes.\nvar WidgetViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function WidgetViewDesc(parent, widget, view, pos) {\n var self, dom = widget.type.toDOM;\n if (typeof dom == \"function\") { dom = dom(view, function () {\n if (!self) { return pos }\n if (self.parent) { return self.parent.posBeforeChild(self) }\n }); }\n if (!widget.type.spec.raw) {\n if (dom.nodeType != 1) {\n var wrap = document.createElement(\"span\");\n wrap.appendChild(dom);\n dom = wrap;\n }\n dom.contentEditable = false;\n dom.classList.add(\"ProseMirror-widget\");\n }\n ViewDesc.call(this, parent, nothing, dom, null);\n this.widget = widget;\n self = this;\n }\n\n if ( ViewDesc ) WidgetViewDesc.__proto__ = ViewDesc;\n WidgetViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n WidgetViewDesc.prototype.constructor = WidgetViewDesc;\n\n var prototypeAccessors$1 = { beforePosition: { configurable: true } };\n\n prototypeAccessors$1.beforePosition.get = function () {\n return this.widget.type.side < 0\n };\n\n WidgetViewDesc.prototype.matchesWidget = function matchesWidget (widget) {\n return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type)\n };\n\n WidgetViewDesc.prototype.parseRule = function parseRule () { return {ignore: true} };\n\n WidgetViewDesc.prototype.stopEvent = function stopEvent (event) {\n var stop = this.widget.spec.stopEvent;\n return stop ? stop(event) : false\n };\n\n WidgetViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n return mutation.type != \"selection\" || this.widget.spec.ignoreSelection\n };\n\n Object.defineProperties( WidgetViewDesc.prototype, prototypeAccessors$1 );\n\n return WidgetViewDesc;\n}(ViewDesc));\n\nvar CompositionViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function CompositionViewDesc(parent, dom, textDOM, text) {\n ViewDesc.call(this, parent, nothing, dom, null);\n this.textDOM = textDOM;\n this.text = text;\n }\n\n if ( ViewDesc ) CompositionViewDesc.__proto__ = ViewDesc;\n CompositionViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n CompositionViewDesc.prototype.constructor = CompositionViewDesc;\n\n var prototypeAccessors$2 = { size: { configurable: true } };\n\n prototypeAccessors$2.size.get = function () { return this.text.length };\n\n CompositionViewDesc.prototype.localPosFromDOM = function localPosFromDOM (dom, offset) {\n if (dom != this.textDOM) { return this.posAtStart + (offset ? this.size : 0) }\n return this.posAtStart + offset\n };\n\n CompositionViewDesc.prototype.domFromPos = function domFromPos (pos) {\n return {node: this.textDOM, offset: pos}\n };\n\n CompositionViewDesc.prototype.ignoreMutation = function ignoreMutation (mut) {\n return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue\n };\n\n Object.defineProperties( CompositionViewDesc.prototype, prototypeAccessors$2 );\n\n return CompositionViewDesc;\n}(ViewDesc));\n\n// A mark desc represents a mark. May have multiple children,\n// depending on how the mark is split. Note that marks are drawn using\n// a fixed nesting order, for simplicity and predictability, so in\n// some cases they will be split more often than would appear\n// necessary.\nvar MarkViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function MarkViewDesc(parent, mark, dom, contentDOM) {\n ViewDesc.call(this, parent, [], dom, contentDOM);\n this.mark = mark;\n }\n\n if ( ViewDesc ) MarkViewDesc.__proto__ = ViewDesc;\n MarkViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n MarkViewDesc.prototype.constructor = MarkViewDesc;\n\n MarkViewDesc.create = function create (parent, mark, inline, view) {\n var custom = view.nodeViews[mark.type.name];\n var spec = custom && custom(mark, view, inline);\n if (!spec || !spec.dom)\n { spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline)); }\n return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom)\n };\n\n MarkViewDesc.prototype.parseRule = function parseRule () { return {mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM} };\n\n MarkViewDesc.prototype.matchesMark = function matchesMark (mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark) };\n\n MarkViewDesc.prototype.markDirty = function markDirty (from, to) {\n ViewDesc.prototype.markDirty.call(this, from, to);\n // Move dirty info to nearest node view\n if (this.dirty != NOT_DIRTY) {\n var parent = this.parent;\n while (!parent.node) { parent = parent.parent; }\n if (parent.dirty < this.dirty) { parent.dirty = this.dirty; }\n this.dirty = NOT_DIRTY;\n }\n };\n\n MarkViewDesc.prototype.slice = function slice (from, to, view) {\n var copy = MarkViewDesc.create(this.parent, this.mark, true, view);\n var nodes = this.children, size = this.size;\n if (to < size) { nodes = replaceNodes(nodes, to, size, view); }\n if (from > 0) { nodes = replaceNodes(nodes, 0, from, view); }\n for (var i = 0; i < nodes.length; i++) { nodes[i].parent = copy; }\n copy.children = nodes;\n return copy\n };\n\n return MarkViewDesc;\n}(ViewDesc));\n\n// Node view descs are the main, most common type of view desc, and\n// correspond to an actual node in the document. Unlike mark descs,\n// they populate their child array themselves.\nvar NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {\n ViewDesc.call(this, parent, node.isLeaf ? nothing : [], dom, contentDOM);\n this.nodeDOM = nodeDOM;\n this.node = node;\n this.outerDeco = outerDeco;\n this.innerDeco = innerDeco;\n if (contentDOM) { this.updateChildren(view, pos); }\n }\n\n if ( ViewDesc ) NodeViewDesc.__proto__ = ViewDesc;\n NodeViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n NodeViewDesc.prototype.constructor = NodeViewDesc;\n\n var prototypeAccessors$3 = { size: { configurable: true },border: { configurable: true } };\n\n // By default, a node is rendered using the `toDOM` method from the\n // node type spec. But client code can use the `nodeViews` spec to\n // supply a custom node view, which can influence various aspects of\n // the way the node works.\n //\n // (Using subclassing for this was intentionally decided against,\n // since it'd require exposing a whole slew of finnicky\n // implementation details to the user code that they probably will\n // never need.)\n NodeViewDesc.create = function create (parent, node, outerDeco, innerDeco, view, pos) {\n var assign;\n\n var custom = view.nodeViews[node.type.name], descObj;\n var spec = custom && custom(node, view, function () {\n // (This is a function that allows the custom view to find its\n // own position)\n if (!descObj) { return pos }\n if (descObj.parent) { return descObj.parent.posBeforeChild(descObj) }\n }, outerDeco);\n\n var dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;\n if (node.isText) {\n if (!dom) { dom = document.createTextNode(node.text); }\n else if (dom.nodeType != 3) { throw new RangeError(\"Text must be rendered as a DOM text node\") }\n } else if (!dom) {\n((assign = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node)), dom = assign.dom, contentDOM = assign.contentDOM));\n }\n if (!contentDOM && !node.isText && dom.nodeName != \"BR\") { // Chrome gets confused by <br contenteditable=false>\n if (!dom.hasAttribute(\"contenteditable\")) { dom.contentEditable = false; }\n if (node.type.spec.draggable) { dom.draggable = true; }\n }\n\n var nodeDOM = dom;\n dom = applyOuterDeco(dom, outerDeco, node);\n\n if (spec)\n { return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM,\n spec, view, pos + 1) }\n else if (node.isText)\n { return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) }\n else\n { return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos + 1) }\n };\n\n NodeViewDesc.prototype.parseRule = function parseRule () {\n var this$1 = this;\n\n // Experimental kludge to allow opt-in re-parsing of nodes\n if (this.node.type.spec.reparseInView) { return null }\n // FIXME the assumption that this can always return the current\n // attrs means that if the user somehow manages to change the\n // attrs in the dom, that won't be picked up. Not entirely sure\n // whether this is a problem\n var rule = {node: this.node.type.name, attrs: this.node.attrs};\n if (this.node.type.spec.code) { rule.preserveWhitespace = \"full\"; }\n if (this.contentDOM && !this.contentLost) { rule.contentElement = this.contentDOM; }\n else { rule.getContent = function () { return this$1.contentDOM ? Fragment.empty : this$1.node.content; }; }\n return rule\n };\n\n NodeViewDesc.prototype.matchesNode = function matchesNode (node, outerDeco, innerDeco) {\n return this.dirty == NOT_DIRTY && node.eq(this.node) &&\n sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco)\n };\n\n prototypeAccessors$3.size.get = function () { return this.node.nodeSize };\n\n prototypeAccessors$3.border.get = function () { return this.node.isLeaf ? 0 : 1 };\n\n // Syncs `this.children` to match `this.node.content` and the local\n // decorations, possibly introducing nesting for marks. Then, in a\n // separate step, syncs the DOM inside `this.contentDOM` to\n // `this.children`.\n NodeViewDesc.prototype.updateChildren = function updateChildren (view, pos) {\n var this$1 = this;\n\n var inline = this.node.inlineContent, off = pos;\n var composition = inline && view.composing && this.localCompositionNode(view, pos);\n var updater = new ViewTreeUpdater(this, composition && composition.node);\n iterDeco(this.node, this.innerDeco, function (widget, i, insideNode) {\n if (widget.spec.marks)\n { updater.syncToMarks(widget.spec.marks, inline, view); }\n else if (widget.type.side >= 0 && !insideNode)\n { updater.syncToMarks(i == this$1.node.childCount ? Mark.none : this$1.node.child(i).marks, inline, view); }\n // If the next node is a desc matching this widget, reuse it,\n // otherwise insert the widget as a new view desc.\n updater.placeWidget(widget, view, off);\n }, function (child, outerDeco, innerDeco, i) {\n // Make sure the wrapping mark descs match the node's marks.\n updater.syncToMarks(child.marks, inline, view);\n // Either find an existing desc that exactly matches this node,\n // and drop the descs before it.\n updater.findNodeMatch(child, outerDeco, innerDeco, i) ||\n // Or try updating the next desc to reflect this node.\n updater.updateNextNode(child, outerDeco, innerDeco, view, i) ||\n // Or just add it as a new desc.\n updater.addNode(child, outerDeco, innerDeco, view, off);\n off += child.nodeSize;\n });\n // Drop all remaining descs after the current position.\n updater.syncToMarks(nothing, inline, view);\n if (this.node.isTextblock) { updater.addTextblockHacks(); }\n updater.destroyRest();\n\n // Sync the DOM if anything changed\n if (updater.changed || this.dirty == CONTENT_DIRTY) {\n // May have to protect focused DOM from being changed if a composition is active\n if (composition) { this.protectLocalComposition(view, composition); }\n this.renderChildren();\n }\n };\n\n NodeViewDesc.prototype.renderChildren = function renderChildren () {\n renderDescs(this.contentDOM, this.children);\n if (result.ios) { iosHacks(this.dom); }\n };\n\n NodeViewDesc.prototype.localCompositionNode = function localCompositionNode (view, pos) {\n // Only do something if both the selection and a focused text node\n // are inside of this node, and the node isn't already part of a\n // view that's a child of this view\n var ref = view.state.selection;\n var from = ref.from;\n var to = ref.to;\n if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size) { return }\n var sel = view.root.getSelection();\n var textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);\n if (!textNode || !this.dom.contains(textNode.parentNode)) { return }\n\n // Find the text in the focused node in the node, stop if it's not\n // there (may have been modified through other means, in which\n // case it should overwritten)\n var text = textNode.nodeValue;\n var textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);\n\n return textPos < 0 ? null : {node: textNode, pos: textPos, text: text}\n };\n\n NodeViewDesc.prototype.protectLocalComposition = function protectLocalComposition (view, ref) {\n var node = ref.node;\n var pos = ref.pos;\n var text = ref.text;\n\n // The node is already part of a local view desc, leave it there\n if (this.getDesc(node)) { return }\n\n // Create a composition view for the orphaned nodes\n var topNode = node;\n for (;; topNode = topNode.parentNode) {\n if (topNode.parentNode == this.contentDOM) { break }\n while (topNode.previousSibling) { topNode.parentNode.removeChild(topNode.previousSibling); }\n while (topNode.nextSibling) { topNode.parentNode.removeChild(topNode.nextSibling); }\n if (topNode.pmViewDesc) { topNode.pmViewDesc = null; }\n }\n var desc = new CompositionViewDesc(this, topNode, node, text);\n view.compositionNodes.push(desc);\n\n // Patch up this.children to contain the composition view\n this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);\n };\n\n // : (Node, [Decoration], DecorationSet, EditorView) → bool\n // If this desc be updated to match the given node decoration,\n // do so and return true.\n NodeViewDesc.prototype.update = function update (node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY ||\n !node.sameMarkup(this.node)) { return false }\n this.updateInner(node, outerDeco, innerDeco, view);\n return true\n };\n\n NodeViewDesc.prototype.updateInner = function updateInner (node, outerDeco, innerDeco, view) {\n this.updateOuterDeco(outerDeco);\n this.node = node;\n this.innerDeco = innerDeco;\n if (this.contentDOM) { this.updateChildren(view, this.posAtStart); }\n this.dirty = NOT_DIRTY;\n };\n\n NodeViewDesc.prototype.updateOuterDeco = function updateOuterDeco (outerDeco) {\n if (sameOuterDeco(outerDeco, this.outerDeco)) { return }\n var needsWrap = this.nodeDOM.nodeType != 1;\n var oldDOM = this.dom;\n this.dom = patchOuterDeco(this.dom, this.nodeDOM,\n computeOuterDeco(this.outerDeco, this.node, needsWrap),\n computeOuterDeco(outerDeco, this.node, needsWrap));\n if (this.dom != oldDOM) {\n oldDOM.pmViewDesc = null;\n this.dom.pmViewDesc = this;\n }\n this.outerDeco = outerDeco;\n };\n\n // Mark this node as being the selected node.\n NodeViewDesc.prototype.selectNode = function selectNode () {\n this.nodeDOM.classList.add(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable) { this.dom.draggable = true; }\n };\n\n // Remove selected node marking from this node.\n NodeViewDesc.prototype.deselectNode = function deselectNode () {\n this.nodeDOM.classList.remove(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable) { this.dom.removeAttribute(\"draggable\"); }\n };\n\n Object.defineProperties( NodeViewDesc.prototype, prototypeAccessors$3 );\n\n return NodeViewDesc;\n}(ViewDesc));\n\n// Create a view desc for the top-level document node, to be exported\n// and used by the view class.\nfunction docViewDesc(doc, outerDeco, innerDeco, dom, view) {\n applyOuterDeco(dom, outerDeco, doc);\n return new NodeViewDesc(null, doc, outerDeco, innerDeco, dom, dom, dom, view, 0)\n}\n\nvar TextViewDesc = /*@__PURE__*/(function (NodeViewDesc) {\n function TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {\n NodeViewDesc.call(this, parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view);\n }\n\n if ( NodeViewDesc ) TextViewDesc.__proto__ = NodeViewDesc;\n TextViewDesc.prototype = Object.create( NodeViewDesc && NodeViewDesc.prototype );\n TextViewDesc.prototype.constructor = TextViewDesc;\n\n TextViewDesc.prototype.parseRule = function parseRule () {\n return {skip: this.nodeDOM.parentNode || true}\n };\n\n TextViewDesc.prototype.update = function update (node, outerDeco) {\n if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) ||\n !node.sameMarkup(this.node)) { return false }\n this.updateOuterDeco(outerDeco);\n if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue)\n { this.nodeDOM.nodeValue = node.text; }\n this.node = node;\n this.dirty = NOT_DIRTY;\n return true\n };\n\n TextViewDesc.prototype.inParent = function inParent () {\n var parentDOM = this.parent.contentDOM;\n for (var n = this.nodeDOM; n; n = n.parentNode) { if (n == parentDOM) { return true } }\n return false\n };\n\n TextViewDesc.prototype.domFromPos = function domFromPos (pos) {\n return {node: this.nodeDOM, offset: pos}\n };\n\n TextViewDesc.prototype.localPosFromDOM = function localPosFromDOM (dom, offset, bias) {\n if (dom == this.nodeDOM) { return this.posAtStart + Math.min(offset, this.node.text.length) }\n return NodeViewDesc.prototype.localPosFromDOM.call(this, dom, offset, bias)\n };\n\n TextViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n return mutation.type != \"characterData\" && mutation.type != \"selection\"\n };\n\n TextViewDesc.prototype.slice = function slice (from, to, view) {\n var node = this.node.cut(from, to), dom = document.createTextNode(node.text);\n return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view)\n };\n\n return TextViewDesc;\n}(NodeViewDesc));\n\n// A dummy desc used to tag trailing BR or span nodes created to work\n// around contentEditable terribleness.\nvar BRHackViewDesc = /*@__PURE__*/(function (ViewDesc) {\n function BRHackViewDesc () {\n ViewDesc.apply(this, arguments);\n }\n\n if ( ViewDesc ) BRHackViewDesc.__proto__ = ViewDesc;\n BRHackViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n BRHackViewDesc.prototype.constructor = BRHackViewDesc;\n\n BRHackViewDesc.prototype.parseRule = function parseRule () { return {ignore: true} };\n BRHackViewDesc.prototype.matchesHack = function matchesHack () { return this.dirty == NOT_DIRTY };\n\n return BRHackViewDesc;\n}(ViewDesc));\n\n// A separate subclass is used for customized node views, so that the\n// extra checks only have to be made for nodes that are actually\n// customized.\nvar CustomNodeViewDesc = /*@__PURE__*/(function (NodeViewDesc) {\n function CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {\n NodeViewDesc.call(this, parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);\n this.spec = spec;\n }\n\n if ( NodeViewDesc ) CustomNodeViewDesc.__proto__ = NodeViewDesc;\n CustomNodeViewDesc.prototype = Object.create( NodeViewDesc && NodeViewDesc.prototype );\n CustomNodeViewDesc.prototype.constructor = CustomNodeViewDesc;\n\n // A custom `update` method gets to decide whether the update goes\n // through. If it does, and there's a `contentDOM` node, our logic\n // updates the children.\n CustomNodeViewDesc.prototype.update = function update (node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY) { return false }\n if (this.spec.update) {\n var result = this.spec.update(node, outerDeco);\n if (result) { this.updateInner(node, outerDeco, innerDeco, view); }\n return result\n } else if (!this.contentDOM && !node.isLeaf) {\n return false\n } else {\n return NodeViewDesc.prototype.update.call(this, node, outerDeco, innerDeco, view)\n }\n };\n\n CustomNodeViewDesc.prototype.selectNode = function selectNode () {\n this.spec.selectNode ? this.spec.selectNode() : NodeViewDesc.prototype.selectNode.call(this);\n };\n\n CustomNodeViewDesc.prototype.deselectNode = function deselectNode () {\n this.spec.deselectNode ? this.spec.deselectNode() : NodeViewDesc.prototype.deselectNode.call(this);\n };\n\n CustomNodeViewDesc.prototype.setSelection = function setSelection (anchor, head, root, force) {\n this.spec.setSelection ? this.spec.setSelection(anchor, head, root)\n : NodeViewDesc.prototype.setSelection.call(this, anchor, head, root, force);\n };\n\n CustomNodeViewDesc.prototype.destroy = function destroy () {\n if (this.spec.destroy) { this.spec.destroy(); }\n NodeViewDesc.prototype.destroy.call(this);\n };\n\n CustomNodeViewDesc.prototype.stopEvent = function stopEvent (event) {\n return this.spec.stopEvent ? this.spec.stopEvent(event) : false\n };\n\n CustomNodeViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : NodeViewDesc.prototype.ignoreMutation.call(this, mutation)\n };\n\n return CustomNodeViewDesc;\n}(NodeViewDesc));\n\n// : (dom.Node, [ViewDesc])\n// Sync the content of the given DOM node with the nodes associated\n// with the given array of view descs, recursing into mark descs\n// because this should sync the subtree for a whole node at a time.\nfunction renderDescs(parentDOM, descs) {\n var dom = parentDOM.firstChild;\n for (var i = 0; i < descs.length; i++) {\n var desc = descs[i], childDOM = desc.dom;\n if (childDOM.parentNode == parentDOM) {\n while (childDOM != dom) { dom = rm(dom); }\n dom = dom.nextSibling;\n } else {\n parentDOM.insertBefore(childDOM, dom);\n }\n if (desc instanceof MarkViewDesc) {\n var pos = dom ? dom.previousSibling : parentDOM.lastChild;\n renderDescs(desc.contentDOM, desc.children);\n dom = pos ? pos.nextSibling : parentDOM.firstChild;\n }\n }\n while (dom) { dom = rm(dom); }\n}\n\nfunction OuterDecoLevel(nodeName) {\n if (nodeName) { this.nodeName = nodeName; }\n}\nOuterDecoLevel.prototype = Object.create(null);\n\nvar noDeco = [new OuterDecoLevel];\n\nfunction computeOuterDeco(outerDeco, node, needsWrap) {\n if (outerDeco.length == 0) { return noDeco }\n\n var top = needsWrap ? noDeco[0] : new OuterDecoLevel, result = [top];\n\n for (var i = 0; i < outerDeco.length; i++) {\n var attrs = outerDeco[i].type.attrs, cur = top;\n if (!attrs) { continue }\n if (attrs.nodeName)\n { result.push(cur = new OuterDecoLevel(attrs.nodeName)); }\n\n for (var name in attrs) {\n var val = attrs[name];\n if (val == null) { continue }\n if (needsWrap && result.length == 1)\n { result.push(cur = top = new OuterDecoLevel(node.isInline ? \"span\" : \"div\")); }\n if (name == \"class\") { cur.class = (cur.class ? cur.class + \" \" : \"\") + val; }\n else if (name == \"style\") { cur.style = (cur.style ? cur.style + \";\" : \"\") + val; }\n else if (name != \"nodeName\") { cur[name] = val; }\n }\n }\n\n return result\n}\n\nfunction patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {\n // Shortcut for trivial case\n if (prevComputed == noDeco && curComputed == noDeco) { return nodeDOM }\n\n var curDOM = nodeDOM;\n for (var i = 0; i < curComputed.length; i++) {\n var deco = curComputed[i], prev = prevComputed[i];\n if (i) {\n var parent = (void 0);\n if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM &&\n (parent = curDOM.parentNode) && parent.tagName.toLowerCase() == deco.nodeName) {\n curDOM = parent;\n } else {\n parent = document.createElement(deco.nodeName);\n parent.appendChild(curDOM);\n prev = noDeco[0];\n curDOM = parent;\n }\n }\n patchAttributes(curDOM, prev || noDeco[0], deco);\n }\n return curDOM\n}\n\nfunction patchAttributes(dom, prev, cur) {\n for (var name in prev)\n { if (name != \"class\" && name != \"style\" && name != \"nodeName\" && !(name in cur))\n { dom.removeAttribute(name); } }\n for (var name$1 in cur)\n { if (name$1 != \"class\" && name$1 != \"style\" && name$1 != \"nodeName\" && cur[name$1] != prev[name$1])\n { dom.setAttribute(name$1, cur[name$1]); } }\n if (prev.class != cur.class) {\n var prevList = prev.class ? prev.class.split(\" \") : nothing;\n var curList = cur.class ? cur.class.split(\" \") : nothing;\n for (var i = 0; i < prevList.length; i++) { if (curList.indexOf(prevList[i]) == -1)\n { dom.classList.remove(prevList[i]); } }\n for (var i$1 = 0; i$1 < curList.length; i$1++) { if (prevList.indexOf(curList[i$1]) == -1)\n { dom.classList.add(curList[i$1]); } }\n }\n if (prev.style != cur.style) {\n if (prev.style) {\n var prop = /\\s*([\\w\\-\\xa1-\\uffff]+)\\s*:(?:\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|\\(.*?\\)|[^;])*/g, m;\n while (m = prop.exec(prev.style))\n { dom.style.removeProperty(m[1]); }\n }\n if (cur.style)\n { dom.style.cssText += cur.style; }\n }\n}\n\nfunction applyOuterDeco(dom, deco, node) {\n return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1))\n}\n\n// : ([Decoration], [Decoration]) → bool\nfunction sameOuterDeco(a, b) {\n if (a.length != b.length) { return false }\n for (var i = 0; i < a.length; i++) { if (!a[i].type.eq(b[i].type)) { return false } }\n return true\n}\n\n// Remove a DOM node and return its next sibling.\nfunction rm(dom) {\n var next = dom.nextSibling;\n dom.parentNode.removeChild(dom);\n return next\n}\n\n// Helper class for incrementally updating a tree of mark descs and\n// the widget and node descs inside of them.\nvar ViewTreeUpdater = function ViewTreeUpdater(top, lockedNode) {\n this.top = top;\n this.lock = lockedNode;\n // Index into `this.top`'s child array, represents the current\n // update position.\n this.index = 0;\n // When entering a mark, the current top and index are pushed\n // onto this.\n this.stack = [];\n // Tracks whether anything was changed\n this.changed = false;\n\n var pre = preMatch(top.node.content, top.children);\n this.preMatched = pre.nodes;\n this.preMatchOffset = pre.offset;\n};\n\nViewTreeUpdater.prototype.getPreMatch = function getPreMatch (index) {\n return index >= this.preMatchOffset ? this.preMatched[index - this.preMatchOffset] : null\n};\n\n// Destroy and remove the children between the given indices in\n// `this.top`.\nViewTreeUpdater.prototype.destroyBetween = function destroyBetween (start, end) {\n if (start == end) { return }\n for (var i = start; i < end; i++) { this.top.children[i].destroy(); }\n this.top.children.splice(start, end - start);\n this.changed = true;\n};\n\n// Destroy all remaining children in `this.top`.\nViewTreeUpdater.prototype.destroyRest = function destroyRest () {\n this.destroyBetween(this.index, this.top.children.length);\n};\n\n// : ([Mark], EditorView)\n// Sync the current stack of mark descs with the given array of\n// marks, reusing existing mark descs when possible.\nViewTreeUpdater.prototype.syncToMarks = function syncToMarks (marks, inline, view) {\n var keep = 0, depth = this.stack.length >> 1;\n var maxKeep = Math.min(depth, marks.length);\n while (keep < maxKeep &&\n (keep == depth - 1 ? this.top : this.stack[(keep + 1) << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)\n { keep++; }\n\n while (keep < depth) {\n this.destroyRest();\n this.top.dirty = NOT_DIRTY;\n this.index = this.stack.pop();\n this.top = this.stack.pop();\n depth--;\n }\n while (depth < marks.length) {\n this.stack.push(this.top, this.index + 1);\n var found = -1;\n for (var i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {\n if (this.top.children[i].matchesMark(marks[depth])) { found = i; break }\n }\n if (found > -1) {\n if (found > this.index) {\n this.changed = true;\n this.destroyBetween(this.index, found);\n }\n this.top = this.top.children[this.index];\n } else {\n var markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);\n this.top.children.splice(this.index, 0, markDesc);\n this.top = markDesc;\n this.changed = true;\n }\n this.index = 0;\n depth++;\n }\n};\n\n// : (Node, [Decoration], DecorationSet) → bool\n// Try to find a node desc matching the given data. Skip over it and\n// return true when successful.\nViewTreeUpdater.prototype.findNodeMatch = function findNodeMatch (node, outerDeco, innerDeco, index) {\n var found = -1, preMatch = index < 0 ? undefined : this.getPreMatch(index), children = this.top.children;\n if (preMatch && preMatch.matchesNode(node, outerDeco, innerDeco)) {\n found = children.indexOf(preMatch);\n } else {\n for (var i = this.index, e = Math.min(children.length, i + 5); i < e; i++) {\n var child = children[i];\n if (child.matchesNode(node, outerDeco, innerDeco) && this.preMatched.indexOf(child) < 0) {\n found = i;\n break\n }\n }\n }\n if (found < 0) { return false }\n this.destroyBetween(this.index, found);\n this.index++;\n return true\n};\n\n// : (Node, [Decoration], DecorationSet, EditorView, Fragment, number) → bool\n// Try to update the next node, if any, to the given data. Checks\n// pre-matches to avoid overwriting nodes that could still be used.\nViewTreeUpdater.prototype.updateNextNode = function updateNextNode (node, outerDeco, innerDeco, view, index) {\n for (var i = this.index; i < this.top.children.length; i++) {\n var next = this.top.children[i];\n if (next instanceof NodeViewDesc) {\n var preMatch = this.preMatched.indexOf(next);\n if (preMatch > -1 && preMatch + this.preMatchOffset != index) { return false }\n var nextDOM = next.dom;\n\n // Can't update if nextDOM is or contains this.lock, except if\n // it's a text node whose content already matches the new text\n // and whose decorations match the new ones.\n var locked = this.lock && (nextDOM == this.lock || nextDOM.nodeType == 1 && nextDOM.contains(this.lock.parentNode)) &&\n !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text &&\n next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));\n if (!locked && next.update(node, outerDeco, innerDeco, view)) {\n this.destroyBetween(this.index, i);\n if (next.dom != nextDOM) { this.changed = true; }\n this.index++;\n return true\n }\n break\n }\n }\n return false\n};\n\n// : (Node, [Decoration], DecorationSet, EditorView)\n// Insert the node as a newly created node desc.\nViewTreeUpdater.prototype.addNode = function addNode (node, outerDeco, innerDeco, view, pos) {\n this.top.children.splice(this.index++, 0, NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos));\n this.changed = true;\n};\n\nViewTreeUpdater.prototype.placeWidget = function placeWidget (widget, view, pos) {\n if (this.index < this.top.children.length && this.top.children[this.index].matchesWidget(widget)) {\n this.index++;\n } else {\n var desc = new WidgetViewDesc(this.top, widget, view, pos);\n this.top.children.splice(this.index++, 0, desc);\n this.changed = true;\n }\n};\n\n// Make sure a textblock looks and behaves correctly in\n// contentEditable.\nViewTreeUpdater.prototype.addTextblockHacks = function addTextblockHacks () {\n var lastChild = this.top.children[this.index - 1];\n while (lastChild instanceof MarkViewDesc) { lastChild = lastChild.children[lastChild.children.length - 1]; }\n\n if (!lastChild || // Empty textblock\n !(lastChild instanceof TextViewDesc) ||\n /\\n$/.test(lastChild.node.text)) {\n if (this.index < this.top.children.length && this.top.children[this.index].matchesHack()) {\n this.index++;\n } else {\n var dom = document.createElement(\"br\");\n this.top.children.splice(this.index++, 0, new BRHackViewDesc(this.top, nothing, dom, null));\n this.changed = true;\n }\n }\n};\n\n// : (Fragment, [ViewDesc]) → [ViewDesc]\n// Iterate from the end of the fragment and array of descs to find\n// directly matching ones, in order to avoid overeagerly reusing\n// those for other nodes. Returns an array whose positions correspond\n// to node positions in the fragment, and whose elements are either\n// descs matched to the child at that index, or empty.\nfunction preMatch(frag, descs) {\n var result = [], end = frag.childCount;\n for (var i = descs.length - 1; end > 0 && i >= 0; i--) {\n var desc = descs[i], node = desc.node;\n if (!node) { continue }\n if (node != frag.child(end - 1)) { break }\n result.push(desc);\n --end;\n }\n return {nodes: result.reverse(), offset: end}\n}\n\nfunction compareSide(a, b) { return a.type.side - b.type.side }\n\n// : (ViewDesc, DecorationSet, (Decoration, number), (Node, [Decoration], DecorationSet, number))\n// This function abstracts iterating over the nodes and decorations in\n// a fragment. Calls `onNode` for each node, with its local and child\n// decorations. Splits text nodes when there is a decoration starting\n// or ending inside of them. Calls `onWidget` for each widget.\nfunction iterDeco(parent, deco, onWidget, onNode) {\n var locals = deco.locals(parent), offset = 0;\n // Simple, cheap variant for when there are no local decorations\n if (locals.length == 0) {\n for (var i = 0; i < parent.childCount; i++) {\n var child = parent.child(i);\n onNode(child, locals, deco.forChild(offset, child), i);\n offset += child.nodeSize;\n }\n return\n }\n\n var decoIndex = 0, active = [], restNode = null;\n for (var parentIndex = 0;;) {\n if (decoIndex < locals.length && locals[decoIndex].to == offset) {\n var widget = locals[decoIndex++], widgets = (void 0);\n while (decoIndex < locals.length && locals[decoIndex].to == offset)\n { (widgets || (widgets = [widget])).push(locals[decoIndex++]); }\n if (widgets) {\n widgets.sort(compareSide);\n for (var i$1 = 0; i$1 < widgets.length; i$1++) { onWidget(widgets[i$1], parentIndex, !!restNode); }\n } else {\n onWidget(widget, parentIndex, !!restNode);\n }\n }\n\n var child$1 = (void 0), index = (void 0);\n if (restNode) {\n index = -1;\n child$1 = restNode;\n restNode = null;\n } else if (parentIndex < parent.childCount) {\n index = parentIndex;\n child$1 = parent.child(parentIndex++);\n } else {\n break\n }\n\n for (var i$2 = 0; i$2 < active.length; i$2++) { if (active[i$2].to <= offset) { active.splice(i$2--, 1); } }\n while (decoIndex < locals.length && locals[decoIndex].from == offset) { active.push(locals[decoIndex++]); }\n\n var end = offset + child$1.nodeSize;\n if (child$1.isText) {\n var cutAt = end;\n if (decoIndex < locals.length && locals[decoIndex].from < cutAt) { cutAt = locals[decoIndex].from; }\n for (var i$3 = 0; i$3 < active.length; i$3++) { if (active[i$3].to < cutAt) { cutAt = active[i$3].to; } }\n if (cutAt < end) {\n restNode = child$1.cut(cutAt - offset);\n child$1 = child$1.cut(0, cutAt - offset);\n end = cutAt;\n index = -1;\n }\n }\n\n onNode(child$1, active.length ? active.slice() : nothing, deco.forChild(offset, child$1), index);\n offset = end;\n }\n}\n\n// List markers in Mobile Safari will mysteriously disappear\n// sometimes. This works around that.\nfunction iosHacks(dom) {\n if (dom.nodeName == \"UL\" || dom.nodeName == \"OL\") {\n var oldCSS = dom.style.cssText;\n dom.style.cssText = oldCSS + \"; list-style: square !important\";\n window.getComputedStyle(dom).listStyle;\n dom.style.cssText = oldCSS;\n }\n}\n\nfunction nearbyTextNode(node, offset) {\n for (;;) {\n if (node.nodeType == 3) { return node }\n if (node.nodeType == 1 && offset > 0) {\n if (node.childNodes.length > offset && node.childNodes[offset].nodeType == 3)\n { return node.childNodes[offset] }\n node = node.childNodes[offset - 1];\n offset = nodeSize(node);\n } else if (node.nodeType == 1 && offset < node.childNodes.length) {\n node = node.childNodes[offset];\n offset = 0;\n } else {\n return null\n }\n }\n}\n\n// Find a piece of text in an inline fragment, overlapping from-to\nfunction findTextInFragment(frag, text, from, to) {\n for (var i = 0, pos = 0; i < frag.childCount && pos <= to;) {\n var child = frag.child(i++), childStart = pos;\n pos += child.nodeSize;\n if (!child.isText) { continue }\n var str = child.text;\n while (i < frag.childCount) {\n var next = frag.child(i++);\n pos += next.nodeSize;\n if (!next.isText) { break }\n str += next.text;\n }\n if (pos >= from) {\n var found = str.lastIndexOf(text, to - childStart);\n if (found >= 0 && found + text.length + childStart >= from)\n { return childStart + found }\n }\n }\n return -1\n}\n\n// Replace range from-to in an array of view descs with replacement\n// (may be null to just delete). This goes very much against the grain\n// of the rest of this code, which tends to create nodes with the\n// right shape in one go, rather than messing with them after\n// creation, but is necessary in the composition hack.\nfunction replaceNodes(nodes, from, to, view, replacement) {\n var result = [];\n for (var i = 0, off = 0; i < nodes.length; i++) {\n var child = nodes[i], start = off, end = off += child.size;\n if (start >= to || end <= from) {\n result.push(child);\n } else {\n if (start < from) { result.push(child.slice(0, from - start, view)); }\n if (replacement) {\n result.push(replacement);\n replacement = null;\n }\n if (end > to) { result.push(child.slice(to - start, child.size, view)); }\n }\n }\n return result\n}\n\nfunction moveSelectionBlock(state, dir) {\n var ref = state.selection;\n var $anchor = ref.$anchor;\n var $head = ref.$head;\n var $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);\n var $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;\n return $start && Selection.findFrom($start, dir)\n}\n\nfunction apply(view, sel) {\n view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());\n return true\n}\n\nfunction selectHorizontally(view, dir, mods) {\n var sel = view.state.selection;\n if (sel instanceof TextSelection) {\n if (!sel.empty || mods.indexOf(\"s\") > -1) {\n return false\n } else if (view.endOfTextblock(dir > 0 ? \"right\" : \"left\")) {\n var next = moveSelectionBlock(view.state, dir);\n if (next && (next instanceof NodeSelection)) { return apply(view, next) }\n return false\n } else {\n var $head = sel.$head, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc;\n if (!node || node.isText) { return false }\n var nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;\n if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) { return false }\n if (NodeSelection.isSelectable(node)) {\n return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head))\n } else if (result.webkit) {\n // Chrome and Safari will introduce extra pointless cursor\n // positions around inline uneditable nodes, so we have to\n // take over and move the cursor past them (#937)\n return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)))\n } else {\n return false\n }\n }\n } else if (sel instanceof NodeSelection && sel.node.isInline) {\n return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from))\n } else {\n var next$1 = moveSelectionBlock(view.state, dir);\n if (next$1) { return apply(view, next$1) }\n return false\n }\n}\n\nfunction nodeLen(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length\n}\n\nfunction isIgnorable(dom) {\n var desc = dom.pmViewDesc;\n return desc && desc.size == 0 && (dom.nextSibling || dom.nodeName != \"BR\")\n}\n\n// Make sure the cursor isn't directly after one or more ignored\n// nodes, which will confuse the browser's cursor motion logic.\nfunction skipIgnoredNodesLeft(view) {\n var sel = view.root.getSelection();\n var node = sel.focusNode, offset = sel.focusOffset;\n if (!node) { return }\n var moveNode, moveOffset, force = false;\n // Gecko will do odd things when the selection is directly in front\n // of a non-editable node, so in that case, move it into the next\n // node if possible. Issue prosemirror/prosemirror#832.\n if (result.gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset])) { force = true; }\n for (;;) {\n if (offset > 0) {\n if (node.nodeType != 1) {\n break\n } else {\n var before = node.childNodes[offset - 1];\n if (isIgnorable(before)) {\n moveNode = node;\n moveOffset = --offset;\n } else if (before.nodeType == 3) {\n node = before;\n offset = node.nodeValue.length;\n } else { break }\n }\n } else if (isBlockNode(node)) {\n break\n } else {\n var prev = node.previousSibling;\n while (prev && isIgnorable(prev)) {\n moveNode = node.parentNode;\n moveOffset = domIndex(prev);\n prev = prev.previousSibling;\n }\n if (!prev) {\n node = node.parentNode;\n if (node == view.dom) { break }\n offset = 0;\n } else {\n node = prev;\n offset = nodeLen(node);\n }\n }\n }\n if (force) { setSelFocus(view, sel, node, offset); }\n else if (moveNode) { setSelFocus(view, sel, moveNode, moveOffset); }\n}\n\n// Make sure the cursor isn't directly before one or more ignored\n// nodes.\nfunction skipIgnoredNodesRight(view) {\n var sel = view.root.getSelection();\n var node = sel.focusNode, offset = sel.focusOffset;\n if (!node) { return }\n var len = nodeLen(node);\n var moveNode, moveOffset;\n for (;;) {\n if (offset < len) {\n if (node.nodeType != 1) { break }\n var after = node.childNodes[offset];\n if (isIgnorable(after)) {\n moveNode = node;\n moveOffset = ++offset;\n }\n else { break }\n } else if (isBlockNode(node)) {\n break\n } else {\n var next = node.nextSibling;\n while (next && isIgnorable(next)) {\n moveNode = next.parentNode;\n moveOffset = domIndex(next) + 1;\n next = next.nextSibling;\n }\n if (!next) {\n node = node.parentNode;\n if (node == view.dom) { break }\n offset = len = 0;\n } else {\n node = next;\n offset = 0;\n len = nodeLen(node);\n }\n }\n }\n if (moveNode) { setSelFocus(view, sel, moveNode, moveOffset); }\n}\n\nfunction isBlockNode(dom) {\n var desc = dom.pmViewDesc;\n return desc && desc.node && desc.node.isBlock\n}\n\nfunction setSelFocus(view, sel, node, offset) {\n if (selectionCollapsed(sel)) {\n var range = document.createRange();\n range.setEnd(node, offset);\n range.setStart(node, offset);\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (sel.extend) {\n sel.extend(node, offset);\n }\n view.domObserver.setCurSelection();\n}\n\n// : (EditorState, number)\n// Check whether vertical selection motion would involve node\n// selections. If so, apply it (if not, the result is left to the\n// browser)\nfunction selectVertically(view, dir, mods) {\n var sel = view.state.selection;\n if (sel instanceof TextSelection && !sel.empty || mods.indexOf(\"s\") > -1) { return false }\n var $from = sel.$from;\n var $to = sel.$to;\n\n if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? \"up\" : \"down\")) {\n var next = moveSelectionBlock(view.state, dir);\n if (next && (next instanceof NodeSelection))\n { return apply(view, next) }\n }\n if (!$from.parent.inlineContent) {\n var beyond = Selection.findFrom(dir < 0 ? $from : $to, dir);\n return beyond ? apply(view, beyond) : true\n }\n return false\n}\n\nfunction stopNativeHorizontalDelete(view, dir) {\n if (!(view.state.selection instanceof TextSelection)) { return true }\n var ref = view.state.selection;\n var $head = ref.$head;\n var $anchor = ref.$anchor;\n var empty = ref.empty;\n if (!$head.sameParent($anchor)) { return true }\n if (!empty) { return false }\n if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) { return true }\n var nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);\n if (nextNode && !nextNode.isText) {\n var tr = view.state.tr;\n if (dir < 0) { tr.delete($head.pos - nextNode.nodeSize, $head.pos); }\n else { tr.delete($head.pos, $head.pos + nextNode.nodeSize); }\n view.dispatch(tr);\n return true\n }\n return false\n}\n\nfunction switchEditable(view, node, state) {\n view.domObserver.stop();\n node.contentEditable = state;\n view.domObserver.start();\n}\n\n// Issue #867 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821\n// In which Chrome does really wrong things when the down arrow is\n// pressed when the cursor is directly at the start of a textblock and\n// has an uneditable node after it\nfunction chromeDownArrowBug(view) {\n if (!result.chrome || view.state.selection.$head.parentOffset > 0) { return }\n var ref = view.root.getSelection();\n var focusNode = ref.focusNode;\n var focusOffset = ref.focusOffset;\n if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 &&\n focusNode.firstChild && focusNode.firstChild.contentEditable == \"false\") {\n var child = focusNode.firstChild;\n switchEditable(view, child, true);\n setTimeout(function () { return switchEditable(view, child, false); }, 20);\n }\n}\n\n// A backdrop key mapping used to make sure we always suppress keys\n// that have a dangerous default effect, even if the commands they are\n// bound to return false, and to make sure that cursor-motion keys\n// find a cursor (as opposed to a node selection) when pressed. For\n// cursor-motion keys, the code in the handlers also takes care of\n// block selections.\n\nfunction getMods(event) {\n var result = \"\";\n if (event.ctrlKey) { result += \"c\"; }\n if (event.metaKey) { result += \"m\"; }\n if (event.altKey) { result += \"a\"; }\n if (event.shiftKey) { result += \"s\"; }\n return result\n}\n\nfunction captureKeyDown(view, event) {\n var code = event.keyCode, mods = getMods(event);\n if (code == 8 || (result.mac && code == 72 && mods == \"c\")) { // Backspace, Ctrl-h on Mac\n return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodesLeft(view)\n } else if (code == 46 || (result.mac && code == 68 && mods == \"c\")) { // Delete, Ctrl-d on Mac\n return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodesRight(view)\n } else if (code == 13 || code == 27) { // Enter, Esc\n return true\n } else if (code == 37) { // Left arrow\n return selectHorizontally(view, -1, mods) || skipIgnoredNodesLeft(view)\n } else if (code == 39) { // Right arrow\n return selectHorizontally(view, 1, mods) || skipIgnoredNodesRight(view)\n } else if (code == 38) { // Up arrow\n return selectVertically(view, -1, mods) || skipIgnoredNodesLeft(view)\n } else if (code == 40) { // Down arrow\n return chromeDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodesRight(view)\n } else if (mods == (result.mac ? \"m\" : \"c\") &&\n (code == 66 || code == 73 || code == 89 || code == 90)) { // Mod-[biyz]\n return true\n }\n return false\n}\n\nfunction selectionFromDOM(view, origin) {\n var domSel = view.root.getSelection(), doc = view.state.doc;\n var nearestDesc = view.docView.nearestDesc(domSel.focusNode), inWidget = nearestDesc && nearestDesc.size == 0;\n var head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset);\n var $head = doc.resolve(head), $anchor, selection;\n if (selectionCollapsed(domSel)) {\n $anchor = $head;\n while (nearestDesc && !nearestDesc.node) { nearestDesc = nearestDesc.parent; }\n if (nearestDesc && nearestDesc.node.isAtom && NodeSelection.isSelectable(nearestDesc.node) && nearestDesc.parent\n && !(nearestDesc.node.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {\n var pos = nearestDesc.posBefore;\n selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));\n }\n } else {\n $anchor = doc.resolve(view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset));\n }\n\n if (!selection) {\n var bias = origin == \"pointer\" || (view.state.selection.head < $head.pos && !inWidget) ? 1 : -1;\n selection = selectionBetween(view, $anchor, $head, bias);\n }\n return selection\n}\n\nfunction selectionToDOM(view, force) {\n var sel = view.state.selection;\n syncNodeSelection(view, sel);\n\n if (view.editable ? !view.hasFocus() : !(hasSelection(view) && document.activeElement.contains(view.dom))) { return }\n\n view.domObserver.disconnectSelection();\n\n if (view.cursorWrapper) {\n selectCursorWrapper(view);\n } else {\n var anchor = sel.anchor;\n var head = sel.head;\n var resetEditableFrom, resetEditableTo;\n if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {\n if (!sel.$from.parent.inlineContent)\n { resetEditableFrom = temporarilyEditableNear(view, sel.from); }\n if (!sel.empty && !sel.$from.parent.inlineContent)\n { resetEditableTo = temporarilyEditableNear(view, sel.to); }\n }\n view.docView.setSelection(anchor, head, view.root, force);\n if (brokenSelectBetweenUneditable) {\n if (resetEditableFrom) { resetEditable(resetEditableFrom); }\n if (resetEditableTo) { resetEditable(resetEditableTo); }\n }\n if (sel.visible) {\n view.dom.classList.remove(\"ProseMirror-hideselection\");\n } else {\n view.dom.classList.add(\"ProseMirror-hideselection\");\n if (\"onselectionchange\" in document) { removeClassOnSelectionChange(view); }\n }\n }\n\n view.domObserver.setCurSelection();\n view.domObserver.connectSelection();\n}\n\n// Kludge to work around Webkit not allowing a selection to start/end\n// between non-editable block nodes. We briefly make something\n// editable, set the selection, then set it uneditable again.\n\nvar brokenSelectBetweenUneditable = result.safari || result.chrome && result.chrome_version < 63;\n\nfunction temporarilyEditableNear(view, pos) {\n var ref = view.docView.domFromPos(pos);\n var node = ref.node;\n var offset = ref.offset;\n var after = offset < node.childNodes.length ? node.childNodes[offset] : null;\n var before = offset ? node.childNodes[offset - 1] : null;\n if (result.safari && after && after.contentEditable == \"false\") { return setEditable(after) }\n if ((!after || after.contentEditable == \"false\") && (!before || before.contentEditable == \"false\")) {\n if (after) { return setEditable(after) }\n else if (before) { return setEditable(before) }\n }\n}\n\nfunction setEditable(element) {\n element.contentEditable = \"true\";\n if (result.safari && element.draggable) { element.draggable = false; element.wasDraggable = true; }\n return element\n}\n\nfunction resetEditable(element) {\n element.contentEditable = \"false\";\n if (element.wasDraggable) { element.draggable = true; element.wasDraggable = null; }\n}\n\nfunction removeClassOnSelectionChange(view) {\n var doc = view.dom.ownerDocument;\n doc.removeEventListener(\"selectionchange\", view.hideSelectionGuard);\n var domSel = view.root.getSelection();\n var node = domSel.anchorNode, offset = domSel.anchorOffset;\n doc.addEventListener(\"selectionchange\", view.hideSelectionGuard = function () {\n if (domSel.anchorNode != node || domSel.anchorOffset != offset) {\n doc.removeEventListener(\"selectionchange\", view.hideSelectionGuard);\n view.dom.classList.remove(\"ProseMirror-hideselection\");\n }\n });\n}\n\nfunction selectCursorWrapper(view) {\n var domSel = view.root.getSelection(), range = document.createRange();\n var node = view.cursorWrapper.dom, img = node.nodeName == \"IMG\";\n if (img) { range.setEnd(node.parentNode, domIndex(node) + 1); }\n else { range.setEnd(node, 0); }\n range.collapse(false);\n domSel.removeAllRanges();\n domSel.addRange(range);\n // Kludge to kill 'control selection' in IE11 when selecting an\n // invisible cursor wrapper, since that would result in those weird\n // resize handles and a selection that considers the absolutely\n // positioned wrapper, rather than the root editable node, the\n // focused element.\n if (!img && !view.state.selection.visible && result.ie && result.ie_version <= 11) {\n node.disabled = true;\n node.disabled = false;\n }\n}\n\nfunction syncNodeSelection(view, sel) {\n if (sel instanceof NodeSelection) {\n var desc = view.docView.descAt(sel.from);\n if (desc != view.lastSelectedViewDesc) {\n clearNodeSelection(view);\n if (desc) { desc.selectNode(); }\n view.lastSelectedViewDesc = desc;\n }\n } else {\n clearNodeSelection(view);\n }\n}\n\n// Clear all DOM statefulness of the last node selection.\nfunction clearNodeSelection(view) {\n if (view.lastSelectedViewDesc) {\n if (view.lastSelectedViewDesc.parent)\n { view.lastSelectedViewDesc.deselectNode(); }\n view.lastSelectedViewDesc = null;\n }\n}\n\nfunction selectionBetween(view, $anchor, $head, bias) {\n return view.someProp(\"createSelectionBetween\", function (f) { return f(view, $anchor, $head); })\n || TextSelection.between($anchor, $head, bias)\n}\n\nfunction hasFocusAndSelection(view) {\n if (view.editable && view.root.activeElement != view.dom) { return false }\n return hasSelection(view)\n}\n\nfunction hasSelection(view) {\n var sel = view.root.getSelection();\n if (!sel.anchorNode) { return false }\n try {\n // Firefox will raise 'permission denied' errors when accessing\n // properties of `sel.anchorNode` when it's in a generated CSS\n // element.\n return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) &&\n (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode))\n } catch(_) {\n return false\n }\n}\n\nfunction anchorInRightPlace(view) {\n var anchorDOM = view.docView.domFromPos(view.state.selection.anchor);\n var domSel = view.root.getSelection();\n return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset)\n}\n\n// Note that all referencing and parsing is done with the\n// start-of-operation selection and document, since that's the one\n// that the DOM represents. If any changes came in in the meantime,\n// the modification is mapped over those before it is applied, in\n// readDOMChange.\n\nfunction parseBetween(view, from_, to_) {\n var ref = view.docView.parseRange(from_, to_);\n var parent = ref.node;\n var fromOffset = ref.fromOffset;\n var toOffset = ref.toOffset;\n var from = ref.from;\n var to = ref.to;\n\n var domSel = view.root.getSelection(), find = null, anchor = domSel.anchorNode;\n if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {\n find = [{node: anchor, offset: domSel.anchorOffset}];\n if (!selectionCollapsed(domSel))\n { find.push({node: domSel.focusNode, offset: domSel.focusOffset}); }\n }\n // Work around issue in Chrome where backspacing sometimes replaces\n // the deleted content with a random BR node (issues #799, #831)\n if (result.chrome && view.lastKeyCode === 8) {\n for (var off = toOffset; off > fromOffset; off--) {\n var node = parent.childNodes[off - 1], desc = node.pmViewDesc;\n if (node.nodeType == \"BR\" && !desc) { toOffset = off; break }\n if (!desc || desc.size) { break }\n }\n }\n var startDoc = view.state.doc;\n var parser = view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n var $from = startDoc.resolve(from);\n\n var sel = null, doc = parser.parse(parent, {\n topNode: $from.parent,\n topMatch: $from.parent.contentMatchAt($from.index()),\n topOpen: true,\n from: fromOffset,\n to: toOffset,\n preserveWhitespace: $from.parent.type.spec.code ? \"full\" : true,\n editableContent: true,\n findPositions: find,\n ruleFromNode: ruleFromNode,\n context: $from\n });\n if (find && find[0].pos != null) {\n var anchor$1 = find[0].pos, head = find[1] && find[1].pos;\n if (head == null) { head = anchor$1; }\n sel = {anchor: anchor$1 + from, head: head + from};\n }\n return {doc: doc, sel: sel, from: from, to: to}\n}\n\nfunction ruleFromNode(dom) {\n var desc = dom.pmViewDesc;\n if (desc) {\n return desc.parseRule()\n } else if (dom.nodeName == \"BR\" && dom.parentNode) {\n // Safari replaces the list item or table cell with a BR\n // directly in the list node (?!) if you delete the last\n // character in a list item or table cell (#708, #862)\n if (result.safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {\n var skip = document.createElement(\"div\");\n skip.appendChild(document.createElement(\"li\"));\n return {skip: skip}\n } else if (dom.parentNode.lastChild == dom || result.safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) {\n return {ignore: true}\n }\n } else if (dom.nodeName == \"IMG\" && dom.getAttribute(\"mark-placeholder\")) {\n return {ignore: true}\n }\n}\n\nfunction readDOMChange(view, from, to, typeOver, addedNodes) {\n if (from < 0) {\n var origin = view.lastSelectionTime > Date.now() - 50 ? view.lastSelectionOrigin : null;\n var newSel = selectionFromDOM(view, origin);\n if (!view.state.selection.eq(newSel)) {\n var tr$1 = view.state.tr.setSelection(newSel);\n if (origin == \"pointer\") { tr$1.setMeta(\"pointer\", true); }\n else if (origin == \"key\") { tr$1.scrollIntoView(); }\n view.dispatch(tr$1);\n }\n return\n }\n\n var $before = view.state.doc.resolve(from);\n var shared = $before.sharedDepth(to);\n from = $before.before(shared + 1);\n to = view.state.doc.resolve(to).after(shared + 1);\n\n var sel = view.state.selection;\n var parse = parseBetween(view, from, to);\n\n var doc = view.state.doc, compare = doc.slice(parse.from, parse.to);\n var preferredPos, preferredSide;\n // Prefer anchoring to end when Backspace is pressed\n if (view.lastKeyCode === 8 && Date.now() - 100 < view.lastKeyCodeTime) {\n preferredPos = view.state.selection.to;\n preferredSide = \"end\";\n } else {\n preferredPos = view.state.selection.from;\n preferredSide = \"start\";\n }\n view.lastKeyCode = null;\n\n var change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);\n if (!change) {\n if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) &&\n !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) {\n change = {start: sel.from, endA: sel.to, endB: sel.to};\n } else {\n if (parse.sel) {\n var sel$1 = resolveSelection(view, view.state.doc, parse.sel);\n if (sel$1 && !sel$1.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel$1)); }\n }\n return\n }\n }\n view.domChangeCount++;\n // Handle the case where overwriting a selection by typing matches\n // the start or end of the selected content, creating a change\n // that's smaller than what was actually overwritten.\n if (view.state.selection.from < view.state.selection.to &&\n change.start == change.endB &&\n view.state.selection instanceof TextSelection) {\n if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2) {\n change.start = view.state.selection.from;\n } else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2) {\n change.endB += (view.state.selection.to - change.endA);\n change.endA = view.state.selection.to;\n }\n }\n\n // IE11 will insert a non-breaking space _ahead_ of the space after\n // the cursor space when adding a space before another space. When\n // that happened, adjust the change to cover the space instead.\n if (result.ie && result.ie_version <= 11 && change.endB == change.start + 1 &&\n change.endA == change.start && change.start > parse.from &&\n parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == \" \\u00a0\") {\n change.start--;\n change.endA--;\n change.endB--;\n }\n\n var $from = parse.doc.resolveNoCache(change.start - parse.from);\n var $to = parse.doc.resolveNoCache(change.endB - parse.from);\n var nextSel;\n // If this looks like the effect of pressing Enter (or was recorded\n // as being an iOS enter press), just dispatch an Enter key instead.\n if (((result.ios && view.lastIOSEnter > Date.now() - 100 &&\n (!$from.sameParent($to) || addedNodes.some(function (n) { return n.nodeName == \"DIV\"; }))) ||\n (!$from.sameParent($to) && $from.pos < parse.doc.content.size &&\n (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) &&\n nextSel.head == $to.pos)) &&\n view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); })) {\n view.lastIOSEnter = 0;\n return\n }\n // Same for backspace\n if (view.state.selection.anchor > change.start &&\n looksLikeJoin(doc, change.start, change.endA, $from, $to) &&\n view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(8, \"Backspace\")); })) {\n if (result.android && result.chrome) { view.domObserver.suppressSelectionUpdates(); } // #820\n return\n }\n\n var chFrom = change.start, chTo = change.endA;\n\n var tr, storedMarks, markChange, $from1;\n if ($from.sameParent($to) && $from.parent.inlineContent) {\n if ($from.pos == $to.pos) { // Deletion\n // IE11 sometimes weirdly moves the DOM selection around after\n // backspacing out the first element in a textblock\n if (result.ie && result.ie_version <= 11 && $from.parentOffset == 0) {\n view.domObserver.suppressSelectionUpdates();\n setTimeout(function () { return selectionToDOM(view); }, 20);\n }\n tr = view.state.tr.delete(chFrom, chTo);\n storedMarks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));\n } else if ( // Adding or removing a mark\n change.endA == change.endB && ($from1 = doc.resolve(change.start)) &&\n (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset),\n $from1.parent.content.cut($from1.parentOffset, change.endA - $from1.start())))\n ) {\n tr = view.state.tr;\n if (markChange.type == \"add\") { tr.addMark(chFrom, chTo, markChange.mark); }\n else { tr.removeMark(chFrom, chTo, markChange.mark); }\n } else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {\n // Both positions in the same text node -- simply insert text\n var text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);\n if (view.someProp(\"handleTextInput\", function (f) { return f(view, chFrom, chTo, text); })) { return }\n tr = view.state.tr.insertText(text, chFrom, chTo);\n }\n }\n\n if (!tr)\n { tr = view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from)); }\n if (parse.sel) {\n var sel$2 = resolveSelection(view, tr.doc, parse.sel);\n // Chrome Android will sometimes, during composition, report the\n // selection in the wrong place. If it looks like that is\n // happening, don't update the selection.\n // Edge just doesn't move the cursor forward when you start typing\n // in an empty block or between br nodes.\n if (sel$2 && !(result.chrome && result.android && view.composing && sel$2.empty &&\n (sel$2.head == chFrom || sel$2.head == tr.mapping.map(chTo) - 1) ||\n result.ie && sel$2.empty && sel$2.head == chFrom))\n { tr.setSelection(sel$2); }\n }\n if (storedMarks) { tr.ensureMarks(storedMarks); }\n view.dispatch(tr.scrollIntoView());\n}\n\nfunction resolveSelection(view, doc, parsedSel) {\n if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) { return null }\n return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head))\n}\n\n// : (Fragment, Fragment) → ?{mark: Mark, type: string}\n// Given two same-length, non-empty fragments of inline content,\n// determine whether the first could be created from the second by\n// removing or adding a single mark type.\nfunction isMarkChange(cur, prev) {\n var curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks;\n var added = curMarks, removed = prevMarks, type, mark, update;\n for (var i = 0; i < prevMarks.length; i++) { added = prevMarks[i].removeFromSet(added); }\n for (var i$1 = 0; i$1 < curMarks.length; i$1++) { removed = curMarks[i$1].removeFromSet(removed); }\n if (added.length == 1 && removed.length == 0) {\n mark = added[0];\n type = \"add\";\n update = function (node) { return node.mark(mark.addToSet(node.marks)); };\n } else if (added.length == 0 && removed.length == 1) {\n mark = removed[0];\n type = \"remove\";\n update = function (node) { return node.mark(mark.removeFromSet(node.marks)); };\n } else {\n return null\n }\n var updated = [];\n for (var i$2 = 0; i$2 < prev.childCount; i$2++) { updated.push(update(prev.child(i$2))); }\n if (Fragment.from(updated).eq(cur)) { return {mark: mark, type: type} }\n}\n\nfunction looksLikeJoin(old, start, end, $newStart, $newEnd) {\n if (!$newStart.parent.isTextblock ||\n // The content must have shrunk\n end - start <= $newEnd.pos - $newStart.pos ||\n // newEnd must point directly at or after the end of the block that newStart points into\n skipClosingAndOpening($newStart, true, false) < $newEnd.pos)\n { return false }\n\n var $start = old.resolve(start);\n // Start must be at the end of a block\n if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)\n { return false }\n var $next = old.resolve(skipClosingAndOpening($start, true, true));\n // The next textblock must start before end and end near it\n if (!$next.parent.isTextblock || $next.pos > end ||\n skipClosingAndOpening($next, true, false) < end)\n { return false }\n\n // The fragments after the join point must match\n return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content)\n}\n\nfunction skipClosingAndOpening($pos, fromEnd, mayOpen) {\n var depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;\n while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {\n depth--;\n end++;\n fromEnd = false;\n }\n if (mayOpen) {\n var next = $pos.node(depth).maybeChild($pos.indexAfter(depth));\n while (next && !next.isLeaf) {\n next = next.firstChild;\n end++;\n }\n }\n return end\n}\n\nfunction findDiff(a, b, pos, preferredPos, preferredSide) {\n var start = a.findDiffStart(b, pos);\n if (start == null) { return null }\n var ref = a.findDiffEnd(b, pos + a.size, pos + b.size);\n var endA = ref.a;\n var endB = ref.b;\n if (preferredSide == \"end\") {\n var adjust = Math.max(0, start - Math.min(endA, endB));\n preferredPos -= endA + adjust - start;\n }\n if (endA < start && a.size < b.size) {\n var move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;\n start -= move;\n endB = start + (endB - endA);\n endA = start;\n } else if (endB < start) {\n var move$1 = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;\n start -= move$1;\n endA = start + (endA - endB);\n endB = start;\n }\n return {start: start, endA: endA, endB: endB}\n}\n\nfunction serializeForClipboard(view, slice) {\n var context = [];\n var content = slice.content;\n var openStart = slice.openStart;\n var openEnd = slice.openEnd;\n while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {\n openStart--;\n openEnd--;\n var node = content.firstChild;\n context.push(node.type.name, node.type.hasRequiredAttrs() ? node.attrs : null);\n content = node.content;\n }\n\n var serializer = view.someProp(\"clipboardSerializer\") || DOMSerializer.fromSchema(view.state.schema);\n var doc = detachedDoc(), wrap = doc.createElement(\"div\");\n wrap.appendChild(serializer.serializeFragment(content, {document: doc}));\n\n var firstChild = wrap.firstChild, needsWrap;\n while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {\n for (var i = needsWrap.length - 1; i >= 0; i--) {\n var wrapper = doc.createElement(needsWrap[i]);\n while (wrap.firstChild) { wrapper.appendChild(wrap.firstChild); }\n wrap.appendChild(wrapper);\n }\n firstChild = wrap.firstChild;\n }\n\n if (firstChild && firstChild.nodeType == 1)\n { firstChild.setAttribute(\"data-pm-slice\", (openStart + \" \" + openEnd + \" \" + (JSON.stringify(context)))); }\n\n var text = view.someProp(\"clipboardTextSerializer\", function (f) { return f(slice); }) ||\n slice.content.textBetween(0, slice.content.size, \"\\n\\n\");\n\n return {dom: wrap, text: text}\n}\n\n// : (EditorView, string, string, ?bool, ResolvedPos) → ?Slice\n// Read a slice of content from the clipboard (or drop data).\nfunction parseFromClipboard(view, text, html, plainText, $context) {\n var dom, inCode = $context.parent.type.spec.code, slice;\n if (!html && !text) { return null }\n var asText = text && (plainText || inCode || !html);\n if (asText) {\n view.someProp(\"transformPastedText\", function (f) { text = f(text); });\n if (inCode) { return new Slice(Fragment.from(view.state.schema.text(text)), 0, 0) }\n var parsed = view.someProp(\"clipboardTextParser\", function (f) { return f(text, $context); });\n if (parsed) {\n slice = parsed;\n } else {\n dom = document.createElement(\"div\");\n text.trim().split(/(?:\\r\\n?|\\n)+/).forEach(function (block) {\n dom.appendChild(document.createElement(\"p\")).textContent = block;\n });\n }\n } else {\n view.someProp(\"transformPastedHTML\", function (f) { html = f(html); });\n dom = readHTML(html);\n }\n\n var contextNode = dom && dom.querySelector(\"[data-pm-slice]\");\n var sliceData = contextNode && /^(\\d+) (\\d+) (.*)/.exec(contextNode.getAttribute(\"data-pm-slice\"));\n if (!slice) {\n var parser = view.someProp(\"clipboardParser\") || view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n slice = parser.parseSlice(dom, {preserveWhitespace: !!(asText || sliceData), context: $context});\n }\n if (sliceData)\n { slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[3]); }\n else // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent\n { slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), false); }\n\n view.someProp(\"transformPasted\", function (f) { slice = f(slice); });\n return slice\n}\n\n// Takes a slice parsed with parseSlice, which means there hasn't been\n// any content-expression checking done on the top nodes, tries to\n// find a parent node in the current context that might fit the nodes,\n// and if successful, rebuilds the slice so that it fits into that parent.\n//\n// This addresses the problem that Transform.replace expects a\n// coherent slice, and will fail to place a set of siblings that don't\n// fit anywhere in the schema.\nfunction normalizeSiblings(fragment, $context) {\n if (fragment.childCount < 2) { return fragment }\n var loop = function ( d ) {\n var parent = $context.node(d);\n var match = parent.contentMatchAt($context.index(d));\n var lastWrap = (void 0), result = [];\n fragment.forEach(function (node) {\n if (!result) { return }\n var wrap = match.findWrapping(node.type), inLast;\n if (!wrap) { return result = null }\n if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) {\n result[result.length - 1] = inLast;\n } else {\n if (result.length) { result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length); }\n var wrapped = withWrappers(node, wrap);\n result.push(wrapped);\n match = match.matchType(wrapped.type, wrapped.attrs);\n lastWrap = wrap;\n }\n });\n if (result) { return { v: Fragment.from(result) } }\n };\n\n for (var d = $context.depth; d >= 0; d--) {\n var returned = loop( d );\n\n if ( returned ) return returned.v;\n }\n return fragment\n}\n\nfunction withWrappers(node, wrap, from) {\n if ( from === void 0 ) from = 0;\n\n for (var i = wrap.length - 1; i >= from; i--)\n { node = wrap[i].create(null, Fragment.from(node)); }\n return node\n}\n\n// Used to group adjacent nodes wrapped in similar parents by\n// normalizeSiblings into the same parent node\nfunction addToSibling(wrap, lastWrap, node, sibling, depth) {\n if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {\n var inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);\n if (inner) { return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner)) }\n var match = sibling.contentMatchAt(sibling.childCount);\n if (match.matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1]))\n { return sibling.copy(sibling.content.append(Fragment.from(withWrappers(node, wrap, depth + 1)))) }\n }\n}\n\nfunction closeRight(node, depth) {\n if (depth == 0) { return node }\n var fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));\n var fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);\n return node.copy(fragment.append(fill))\n}\n\nfunction closeRange(fragment, side, from, to, depth, openEnd) {\n var node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;\n if (depth < to - 1) { inner = closeRange(inner, side, from, to, depth + 1, openEnd); }\n if (depth >= from)\n { inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, fragment.childCount > 1 || openEnd <= depth).append(inner)\n : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true)); }\n return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner))\n}\n\nfunction closeSlice(slice, openStart, openEnd) {\n if (openStart < slice.openStart)\n { slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd); }\n if (openEnd < slice.openEnd)\n { slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd); }\n return slice\n}\n\n// Trick from jQuery -- some elements must be wrapped in other\n// elements for innerHTML to work. I.e. if you do `div.innerHTML =\n// \"<td>..</td>\"` the table cells are ignored.\nvar wrapMap = {\n thead: [\"table\"],\n tbody: [\"table\"],\n tfoot: [\"table\"],\n caption: [\"table\"],\n colgroup: [\"table\"],\n col: [\"table\", \"colgroup\"],\n tr: [\"table\", \"tbody\"],\n td: [\"table\", \"tbody\", \"tr\"],\n th: [\"table\", \"tbody\", \"tr\"]\n};\n\nvar _detachedDoc = null;\nfunction detachedDoc() {\n return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument(\"title\"))\n}\n\nfunction readHTML(html) {\n var metas = /(\\s*<meta [^>]*>)*/.exec(html);\n if (metas) { html = html.slice(metas[0].length); }\n var elt = detachedDoc().createElement(\"div\");\n var firstTag = /(?:<meta [^>]*>)*<([a-z][^>\\s]+)/i.exec(html), wrap, depth = 0;\n if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()]) {\n html = wrap.map(function (n) { return \"<\" + n + \">\"; }).join(\"\") + html + wrap.map(function (n) { return \"</\" + n + \">\"; }).reverse().join(\"\");\n depth = wrap.length;\n }\n elt.innerHTML = html;\n for (var i = 0; i < depth; i++) { elt = elt.firstChild; }\n return elt\n}\n\nfunction addContext(slice, context) {\n if (!slice.size) { return slice }\n var schema = slice.content.firstChild.type.schema, array;\n try { array = JSON.parse(context); }\n catch(e) { return slice }\n var content = slice.content;\n var openStart = slice.openStart;\n var openEnd = slice.openEnd;\n for (var i = array.length - 2; i >= 0; i -= 2) {\n var type = schema.nodes[array[i]];\n if (!type || type.hasRequiredAttrs()) { break }\n content = Fragment.from(type.create(array[i + 1], content));\n openStart++; openEnd++;\n }\n return new Slice(content, openStart, openEnd)\n}\n\nvar observeOptions = {\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n attributes: true,\n attributeOldValue: true,\n subtree: true\n};\n// IE11 has very broken mutation observers, so we also listen to DOMCharacterDataModified\nvar useCharData = result.ie && result.ie_version <= 11;\n\nvar SelectionState = function SelectionState() {\n this.anchorNode = this.anchorOffset = this.focusNode = this.focusOffset = null;\n};\n\nSelectionState.prototype.set = function set (sel) {\n this.anchorNode = sel.anchorNode; this.anchorOffset = sel.anchorOffset;\n this.focusNode = sel.focusNode; this.focusOffset = sel.focusOffset;\n};\n\nSelectionState.prototype.eq = function eq (sel) {\n return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset &&\n sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset\n};\n\nvar DOMObserver = function DOMObserver(view, handleDOMChange) {\n var this$1 = this;\n\n this.view = view;\n this.handleDOMChange = handleDOMChange;\n this.queue = [];\n this.flushingSoon = -1;\n this.observer = window.MutationObserver &&\n new window.MutationObserver(function (mutations) {\n for (var i = 0; i < mutations.length; i++) { this$1.queue.push(mutations[i]); }\n // IE11 will sometimes (on backspacing out a single character\n // text node after a BR node) call the observer callback\n // before actually updating the DOM, which will cause\n // ProseMirror to miss the change (see #930)\n if (result.ie && result.ie_version <= 11 && mutations.some(\n function (m) { return m.type == \"childList\" && m.removedNodes.length ||\n m.type == \"characterData\" && m.oldValue.length > m.target.nodeValue.length; }))\n { this$1.flushSoon(); }\n else\n { this$1.flush(); }\n });\n this.currentSelection = new SelectionState;\n if (useCharData) {\n this.onCharData = function (e) {\n this$1.queue.push({target: e.target, type: \"characterData\", oldValue: e.prevValue});\n this$1.flushSoon();\n };\n }\n this.onSelectionChange = this.onSelectionChange.bind(this);\n this.suppressingSelectionUpdates = false;\n};\n\nDOMObserver.prototype.flushSoon = function flushSoon () {\n var this$1 = this;\n\n if (this.flushingSoon < 0)\n { this.flushingSoon = window.setTimeout(function () { this$1.flushingSoon = -1; this$1.flush(); }, 20); }\n};\n\nDOMObserver.prototype.forceFlush = function forceFlush () {\n if (this.flushingSoon > -1) {\n window.clearTimeout(this.flushingSoon);\n this.flushingSoon = -1;\n this.flush();\n }\n};\n\nDOMObserver.prototype.start = function start () {\n if (this.observer)\n { this.observer.observe(this.view.dom, observeOptions); }\n if (useCharData)\n { this.view.dom.addEventListener(\"DOMCharacterDataModified\", this.onCharData); }\n this.connectSelection();\n};\n\nDOMObserver.prototype.stop = function stop () {\n var this$1 = this;\n\n if (this.observer) {\n var take = this.observer.takeRecords();\n if (take.length) {\n for (var i = 0; i < take.length; i++) { this.queue.push(take[i]); }\n window.setTimeout(function () { return this$1.flush(); }, 20);\n }\n this.observer.disconnect();\n }\n if (useCharData) { this.view.dom.removeEventListener(\"DOMCharacterDataModified\", this.onCharData); }\n this.disconnectSelection();\n};\n\nDOMObserver.prototype.connectSelection = function connectSelection () {\n this.view.dom.ownerDocument.addEventListener(\"selectionchange\", this.onSelectionChange);\n};\n\nDOMObserver.prototype.disconnectSelection = function disconnectSelection () {\n this.view.dom.ownerDocument.removeEventListener(\"selectionchange\", this.onSelectionChange);\n};\n\nDOMObserver.prototype.suppressSelectionUpdates = function suppressSelectionUpdates () {\n var this$1 = this;\n\n this.suppressingSelectionUpdates = true;\n setTimeout(function () { return this$1.suppressingSelectionUpdates = false; }, 50);\n};\n\nDOMObserver.prototype.onSelectionChange = function onSelectionChange () {\n if (!hasFocusAndSelection(this.view)) { return }\n if (this.suppressingSelectionUpdates) { return selectionToDOM(this.view) }\n // Deletions on IE11 fire their events in the wrong order, giving\n // us a selection change event before the DOM changes are\n // reported.\n if (result.ie && result.ie_version <= 11 && !this.view.state.selection.empty) {\n var sel = this.view.root.getSelection();\n // Selection.isCollapsed isn't reliable on IE\n if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset))\n { return this.flushSoon() }\n }\n this.flush();\n};\n\nDOMObserver.prototype.setCurSelection = function setCurSelection () {\n this.currentSelection.set(this.view.root.getSelection());\n};\n\nDOMObserver.prototype.ignoreSelectionChange = function ignoreSelectionChange (sel) {\n if (sel.rangeCount == 0) { return true }\n var container = sel.getRangeAt(0).commonAncestorContainer;\n var desc = this.view.docView.nearestDesc(container);\n if (desc && desc.ignoreMutation({type: \"selection\", target: container.nodeType == 3 ? container.parentNode : container})) {\n this.setCurSelection();\n return true\n }\n};\n\nDOMObserver.prototype.flush = function flush () {\n if (!this.view.docView || this.flushingSoon > -1) { return }\n var mutations = this.observer ? this.observer.takeRecords() : [];\n if (this.queue.length) {\n mutations = this.queue.concat(mutations);\n this.queue.length = 0;\n }\n\n var sel = this.view.root.getSelection();\n var newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasSelection(this.view) && !this.ignoreSelectionChange(sel);\n\n var from = -1, to = -1, typeOver = false, added = [];\n if (this.view.editable) {\n for (var i = 0; i < mutations.length; i++) {\n var result$1 = this.registerMutation(mutations[i], added);\n if (result$1) {\n from = from < 0 ? result$1.from : Math.min(result$1.from, from);\n to = to < 0 ? result$1.to : Math.max(result$1.to, to);\n if (result$1.typeOver) { typeOver = true; }\n }\n }\n }\n\n if (result.gecko && added.length > 1) {\n var brs = added.filter(function (n) { return n.nodeName == \"BR\"; });\n if (brs.length == 2) {\n var a = brs[0];\n var b = brs[1];\n if (a.parentNode && a.parentNode.parentNode == b.parentNode) { b.remove(); }\n else { a.remove(); }\n }\n }\n\n if (from > -1 || newSel) {\n if (from > -1) {\n this.view.docView.markDirty(from, to);\n checkCSS(this.view);\n }\n this.handleDOMChange(from, to, typeOver, added);\n if (this.view.docView.dirty) { this.view.updateState(this.view.state); }\n else if (!this.currentSelection.eq(sel)) { selectionToDOM(this.view); }\n }\n};\n\nDOMObserver.prototype.registerMutation = function registerMutation (mut, added) {\n // Ignore mutations inside nodes that were already noted as inserted\n if (added.indexOf(mut.target) > -1) { return null }\n var desc = this.view.docView.nearestDesc(mut.target);\n if (mut.type == \"attributes\" &&\n (desc == this.view.docView || mut.attributeName == \"contenteditable\" ||\n // Firefox sometimes fires spurious events for null/empty styles\n (mut.attributeName == \"style\" && !mut.oldValue && !mut.target.getAttribute(\"style\"))))\n { return null }\n if (!desc || desc.ignoreMutation(mut)) { return null }\n\n if (mut.type == \"childList\") {\n var prev = mut.previousSibling, next = mut.nextSibling;\n if (result.ie && result.ie_version <= 11 && mut.addedNodes.length) {\n // IE11 gives us incorrect next/prev siblings for some\n // insertions, so if there are added nodes, recompute those\n for (var i = 0; i < mut.addedNodes.length; i++) {\n var ref = mut.addedNodes[i];\n var previousSibling = ref.previousSibling;\n var nextSibling = ref.nextSibling;\n if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0) { prev = previousSibling; }\n if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0) { next = nextSibling; }\n }\n }\n var fromOffset = prev && prev.parentNode == mut.target\n ? domIndex(prev) + 1 : 0;\n var from = desc.localPosFromDOM(mut.target, fromOffset, -1);\n var toOffset = next && next.parentNode == mut.target\n ? domIndex(next) : mut.target.childNodes.length;\n for (var i$1 = 0; i$1 < mut.addedNodes.length; i$1++) { added.push(mut.addedNodes[i$1]); }\n var to = desc.localPosFromDOM(mut.target, toOffset, 1);\n return {from: from, to: to}\n } else if (mut.type == \"attributes\") {\n return {from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border}\n } else { // \"characterData\"\n return {\n from: desc.posAtStart,\n to: desc.posAtEnd,\n // An event was generated for a text change that didn't change\n // any text. Mark the dom change to fall back to assuming the\n // selection was typed over with an identical value if it can't\n // find another change.\n typeOver: mut.target.nodeValue == mut.oldValue\n }\n }\n};\n\nvar cssChecked = false;\n\nfunction checkCSS(view) {\n if (cssChecked) { return }\n cssChecked = true;\n if (getComputedStyle(view.dom).whiteSpace == \"normal\")\n { console[\"warn\"](\"ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.\"); }\n}\n\n// A collection of DOM events that occur within the editor, and callback functions\n// to invoke when the event fires.\nvar handlers = {}, editHandlers = {};\n\nfunction initInput(view) {\n view.shiftKey = false;\n view.mouseDown = null;\n view.lastKeyCode = null;\n view.lastKeyCodeTime = 0;\n view.lastClick = {time: 0, x: 0, y: 0, type: \"\"};\n view.lastSelectionOrigin = null;\n view.lastSelectionTime = 0;\n\n view.lastIOSEnter = 0;\n\n view.composing = false;\n view.composingTimeout = null;\n view.compositionNodes = [];\n view.compositionEndedAt = -2e8;\n\n view.domObserver = new DOMObserver(view, function (from, to, typeOver, added) { return readDOMChange(view, from, to, typeOver, added); });\n view.domObserver.start();\n // Used by hacks like the beforeinput handler to check whether anything happened in the DOM\n view.domChangeCount = 0;\n\n view.eventHandlers = Object.create(null);\n var loop = function ( event ) {\n var handler = handlers[event];\n view.dom.addEventListener(event, view.eventHandlers[event] = function (event) {\n if (eventBelongsToView(view, event) && !runCustomHandler(view, event) &&\n (view.editable || !(event.type in editHandlers)))\n { handler(view, event); }\n });\n };\n\n for (var event in handlers) loop( event );\n // On Safari, for reasons beyond my understanding, adding an input\n // event handler makes an issue where the composition vanishes when\n // you press enter go away.\n if (result.safari) { view.dom.addEventListener(\"input\", function () { return null; }); }\n\n ensureListeners(view);\n}\n\nfunction setSelectionOrigin(view, origin) {\n view.lastSelectionOrigin = origin;\n view.lastSelectionTime = Date.now();\n}\n\nfunction destroyInput(view) {\n view.domObserver.stop();\n for (var type in view.eventHandlers)\n { view.dom.removeEventListener(type, view.eventHandlers[type]); }\n clearTimeout(view.composingTimeout);\n}\n\nfunction ensureListeners(view) {\n view.someProp(\"handleDOMEvents\", function (currentHandlers) {\n for (var type in currentHandlers) { if (!view.eventHandlers[type])\n { view.dom.addEventListener(type, view.eventHandlers[type] = function (event) { return runCustomHandler(view, event); }); } }\n });\n}\n\nfunction runCustomHandler(view, event) {\n return view.someProp(\"handleDOMEvents\", function (handlers) {\n var handler = handlers[event.type];\n return handler ? handler(view, event) || event.defaultPrevented : false\n })\n}\n\nfunction eventBelongsToView(view, event) {\n if (!event.bubbles) { return true }\n if (event.defaultPrevented) { return false }\n for (var node = event.target; node != view.dom; node = node.parentNode)\n { if (!node || node.nodeType == 11 ||\n (node.pmViewDesc && node.pmViewDesc.stopEvent(event)))\n { return false } }\n return true\n}\n\nfunction dispatchEvent(view, event) {\n if (!runCustomHandler(view, event) && handlers[event.type] &&\n (view.editable || !(event.type in editHandlers)))\n { handlers[event.type](view, event); }\n}\n\neditHandlers.keydown = function (view, event) {\n view.shiftKey = event.keyCode == 16 || event.shiftKey;\n if (inOrNearComposition(view, event)) { return }\n view.domObserver.forceFlush();\n view.lastKeyCode = event.keyCode;\n view.lastKeyCodeTime = Date.now();\n // On iOS, if we preventDefault enter key presses, the virtual\n // keyboard gets confused. So the hack here is to set a flag that\n // makes the DOM change code recognize that what just happens should\n // be replaced by whatever the Enter key handlers do.\n if (result.ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {\n var now = Date.now();\n view.lastIOSEnter = now;\n setTimeout(function () {\n if (view.lastIOSEnter == now) {\n view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); });\n view.lastIOSEnter = 0;\n }\n }, 50);\n } else if (view.someProp(\"handleKeyDown\", function (f) { return f(view, event); }) || captureKeyDown(view, event)) {\n event.preventDefault();\n } else {\n setSelectionOrigin(view, \"key\");\n }\n};\n\neditHandlers.keyup = function (view, e) {\n if (e.keyCode == 16) { view.shiftKey = false; }\n};\n\neditHandlers.keypress = function (view, event) {\n if (inOrNearComposition(view, event) || !event.charCode ||\n event.ctrlKey && !event.altKey || result.mac && event.metaKey) { return }\n\n if (view.someProp(\"handleKeyPress\", function (f) { return f(view, event); })) {\n event.preventDefault();\n return\n }\n\n var sel = view.state.selection;\n if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {\n var text = String.fromCharCode(event.charCode);\n if (!view.someProp(\"handleTextInput\", function (f) { return f(view, sel.$from.pos, sel.$to.pos, text); }))\n { view.dispatch(view.state.tr.insertText(text).scrollIntoView()); }\n event.preventDefault();\n }\n};\n\nfunction eventCoords(event) { return {left: event.clientX, top: event.clientY} }\n\nfunction isNear(event, click) {\n var dx = click.x - event.clientX, dy = click.y - event.clientY;\n return dx * dx + dy * dy < 100\n}\n\nfunction runHandlerOnContext(view, propName, pos, inside, event) {\n if (inside == -1) { return false }\n var $pos = view.state.doc.resolve(inside);\n var loop = function ( i ) {\n if (view.someProp(propName, function (f) { return i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true)\n : f(view, pos, $pos.node(i), $pos.before(i), event, false); }))\n { return { v: true } }\n };\n\n for (var i = $pos.depth + 1; i > 0; i--) {\n var returned = loop( i );\n\n if ( returned ) return returned.v;\n }\n return false\n}\n\nfunction updateSelection(view, selection, origin) {\n if (!view.focused) { view.focus(); }\n var tr = view.state.tr.setSelection(selection);\n if (origin == \"pointer\") { tr.setMeta(\"pointer\", true); }\n view.dispatch(tr);\n}\n\nfunction selectClickedLeaf(view, inside) {\n if (inside == -1) { return false }\n var $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;\n if (node && node.isAtom && NodeSelection.isSelectable(node)) {\n updateSelection(view, new NodeSelection($pos), \"pointer\");\n return true\n }\n return false\n}\n\nfunction selectClickedNode(view, inside) {\n if (inside == -1) { return false }\n var sel = view.state.selection, selectedNode, selectAt;\n if (sel instanceof NodeSelection) { selectedNode = sel.node; }\n\n var $pos = view.state.doc.resolve(inside);\n for (var i = $pos.depth + 1; i > 0; i--) {\n var node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n if (NodeSelection.isSelectable(node)) {\n if (selectedNode && sel.$from.depth > 0 &&\n i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos)\n { selectAt = $pos.before(sel.$from.depth); }\n else\n { selectAt = $pos.before(i); }\n break\n }\n }\n\n if (selectAt != null) {\n updateSelection(view, NodeSelection.create(view.state.doc, selectAt), \"pointer\");\n return true\n } else {\n return false\n }\n}\n\nfunction handleSingleClick(view, pos, inside, event, selectNode) {\n return runHandlerOnContext(view, \"handleClickOn\", pos, inside, event) ||\n view.someProp(\"handleClick\", function (f) { return f(view, pos, event); }) ||\n (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside))\n}\n\nfunction handleDoubleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleDoubleClickOn\", pos, inside, event) ||\n view.someProp(\"handleDoubleClick\", function (f) { return f(view, pos, event); })\n}\n\nfunction handleTripleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleTripleClickOn\", pos, inside, event) ||\n view.someProp(\"handleTripleClick\", function (f) { return f(view, pos, event); }) ||\n defaultTripleClick(view, inside)\n}\n\nfunction defaultTripleClick(view, inside) {\n var doc = view.state.doc;\n if (inside == -1) {\n if (doc.inlineContent) {\n updateSelection(view, TextSelection.create(doc, 0, doc.content.size), \"pointer\");\n return true\n }\n return false\n }\n\n var $pos = doc.resolve(inside);\n for (var i = $pos.depth + 1; i > 0; i--) {\n var node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n var nodePos = $pos.before(i);\n if (node.inlineContent)\n { updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), \"pointer\"); }\n else if (NodeSelection.isSelectable(node))\n { updateSelection(view, NodeSelection.create(doc, nodePos), \"pointer\"); }\n else\n { continue }\n return true\n }\n}\n\nfunction forceDOMFlush(view) {\n return endComposition(view)\n}\n\nvar selectNodeModifier = result.mac ? \"metaKey\" : \"ctrlKey\";\n\nhandlers.mousedown = function (view, event) {\n view.shiftKey = event.shiftKey;\n var flushed = forceDOMFlush(view);\n var now = Date.now(), type = \"singleClick\";\n if (now - view.lastClick.time < 500 && isNear(event, view.lastClick) && !event[selectNodeModifier]) {\n if (view.lastClick.type == \"singleClick\") { type = \"doubleClick\"; }\n else if (view.lastClick.type == \"doubleClick\") { type = \"tripleClick\"; }\n }\n view.lastClick = {time: now, x: event.clientX, y: event.clientY, type: type};\n\n var pos = view.posAtCoords(eventCoords(event));\n if (!pos) { return }\n\n if (type == \"singleClick\")\n { view.mouseDown = new MouseDown(view, pos, event, flushed); }\n else if ((type == \"doubleClick\" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event))\n { event.preventDefault(); }\n else\n { setSelectionOrigin(view, \"pointer\"); }\n};\n\nvar MouseDown = function MouseDown(view, pos, event, flushed) {\n var this$1 = this;\n\n this.view = view;\n this.startDoc = view.state.doc;\n this.pos = pos;\n this.event = event;\n this.flushed = flushed;\n this.selectNode = event[selectNodeModifier];\n this.allowDefault = event.shiftKey;\n\n var targetNode, targetPos;\n if (pos.inside > -1) {\n targetNode = view.state.doc.nodeAt(pos.inside);\n targetPos = pos.inside;\n } else {\n var $pos = view.state.doc.resolve(pos.pos);\n targetNode = $pos.parent;\n targetPos = $pos.depth ? $pos.before() : 0;\n }\n\n this.mightDrag = null;\n\n var target = flushed ? null : event.target;\n var targetDesc = target ? view.docView.nearestDesc(target, true) : null;\n this.target = targetDesc ? targetDesc.dom : null;\n\n if (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||\n view.state.selection instanceof NodeSelection && targetPos == view.state.selection.from)\n { this.mightDrag = {node: targetNode,\n pos: targetPos,\n addAttr: this.target && !this.target.draggable,\n setUneditable: this.target && result.gecko && !this.target.hasAttribute(\"contentEditable\")}; }\n\n if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr) { this.target.draggable = true; }\n if (this.mightDrag.setUneditable)\n { setTimeout(function () { return this$1.target.setAttribute(\"contentEditable\", \"false\"); }, 20); }\n this.view.domObserver.start();\n }\n\n view.root.addEventListener(\"mouseup\", this.up = this.up.bind(this));\n view.root.addEventListener(\"mousemove\", this.move = this.move.bind(this));\n setSelectionOrigin(view, \"pointer\");\n};\n\nMouseDown.prototype.done = function done () {\n this.view.root.removeEventListener(\"mouseup\", this.up);\n this.view.root.removeEventListener(\"mousemove\", this.move);\n if (this.mightDrag && this.target) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr) { this.target.removeAttribute(\"draggable\"); }\n if (this.mightDrag.setUneditable) { this.target.removeAttribute(\"contentEditable\"); }\n this.view.domObserver.start();\n }\n this.view.mouseDown = null;\n};\n\nMouseDown.prototype.up = function up (event) {\n this.done();\n\n if (!this.view.dom.contains(event.target.nodeType == 3 ? event.target.parentNode : event.target))\n { return }\n\n var pos = this.pos;\n if (this.view.state.doc != this.startDoc) { pos = this.view.posAtCoords(eventCoords(event)); }\n\n if (this.allowDefault || !pos) {\n setSelectionOrigin(this.view, \"pointer\");\n } else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) {\n event.preventDefault();\n } else if (this.flushed ||\n // Chrome will sometimes treat a node selection as a\n // cursor, but still report that the node is selected\n // when asked through getSelection. You'll then get a\n // situation where clicking at the point where that\n // (hidden) cursor is doesn't change the selection, and\n // thus doesn't get a reaction from ProseMirror. This\n // works around that.\n (result.chrome && !(this.view.state.selection instanceof TextSelection) &&\n (pos.pos == this.view.state.selection.from || pos.pos == this.view.state.selection.to))) {\n updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), \"pointer\");\n event.preventDefault();\n } else {\n setSelectionOrigin(this.view, \"pointer\");\n }\n};\n\nMouseDown.prototype.move = function move (event) {\n if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 ||\n Math.abs(this.event.y - event.clientY) > 4))\n { this.allowDefault = true; }\n setSelectionOrigin(this.view, \"pointer\");\n};\n\nhandlers.touchdown = function (view) {\n forceDOMFlush(view);\n setSelectionOrigin(view, \"pointer\");\n};\n\nhandlers.contextmenu = function (view) { return forceDOMFlush(view); };\n\nfunction inOrNearComposition(view, event) {\n if (view.composing) { return true }\n // See https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/.\n // On Japanese input method editors (IMEs), the Enter key is used to confirm character\n // selection. On Safari, when Enter is pressed, compositionend and keydown events are\n // emitted. The keydown event triggers newline insertion, which we don't want.\n // This method returns true if the keydown event should be ignored.\n // We only ignore it once, as pressing Enter a second time *should* insert a newline.\n // Furthermore, the keydown event timestamp must be close to the compositionEndedAt timestamp.\n // This guards against the case where compositionend is triggered without the keyboard\n // (e.g. character confirmation may be done with the mouse), and keydown is triggered\n // afterwards- we wouldn't want to ignore the keydown event in this case.\n if (result.safari && Math.abs(event.timeStamp - view.compositionEndedAt) < 500) {\n view.compositionEndedAt = -2e8;\n return true\n }\n return false\n}\n\n// Drop active composition after 5 seconds of inactivity on Android\nvar timeoutComposition = result.android ? 5000 : -1;\n\neditHandlers.compositionstart = editHandlers.compositionupdate = function (view) {\n if (!view.composing) {\n view.domObserver.flush();\n var state = view.state;\n var $pos = state.selection.$from;\n if (state.selection.empty &&\n (state.storedMarks || (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(function (m) { return m.type.spec.inclusive === false; })))) {\n // Need to wrap the cursor in mark nodes different from the ones in the DOM context\n view.markCursor = view.state.storedMarks || $pos.marks();\n endComposition(view, true);\n view.markCursor = null;\n } else {\n endComposition(view);\n // In firefox, if the cursor is after but outside a marked node,\n // the inserted text won't inherit the marks. So this moves it\n // inside if necessary.\n if (result.gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {\n var sel = view.root.getSelection();\n for (var node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {\n var before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];\n if (!before) { break }\n if (before.nodeType == 3) {\n sel.collapse(before, before.nodeValue.length);\n break\n } else {\n node = before;\n offset = -1;\n }\n }\n }\n }\n view.composing = true;\n }\n scheduleComposeEnd(view, timeoutComposition);\n};\n\neditHandlers.compositionend = function (view, event) {\n if (view.composing) {\n view.composing = false;\n view.compositionEndedAt = event.timeStamp;\n scheduleComposeEnd(view, 20);\n }\n};\n\nfunction scheduleComposeEnd(view, delay) {\n clearTimeout(view.composingTimeout);\n if (delay > -1) { view.composingTimeout = setTimeout(function () { return endComposition(view); }, delay); }\n}\n\nfunction endComposition(view, forceUpdate) {\n view.domObserver.forceFlush();\n view.composing = false;\n while (view.compositionNodes.length > 0) { view.compositionNodes.pop().markParentsDirty(); }\n if (forceUpdate || view.docView.dirty) {\n var sel = selectionFromDOM(view);\n if (!sel.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel)); }\n else { view.updateState(view.state); }\n return true\n }\n return false\n}\n\nfunction captureCopy(view, dom) {\n // The extra wrapper is somehow necessary on IE/Edge to prevent the\n // content from being mangled when it is put onto the clipboard\n var doc = view.dom.ownerDocument;\n var wrap = doc.body.appendChild(doc.createElement(\"div\"));\n wrap.appendChild(dom);\n wrap.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n var sel = getSelection(), range = doc.createRange();\n range.selectNodeContents(dom);\n // Done because IE will fire a selectionchange moving the selection\n // to its start when removeAllRanges is called and the editor still\n // has focus (which will mess up the editor's selection state).\n view.dom.blur();\n sel.removeAllRanges();\n sel.addRange(range);\n setTimeout(function () {\n doc.body.removeChild(wrap);\n view.focus();\n }, 50);\n}\n\n// This is very crude, but unfortunately both these browsers _pretend_\n// that they have a clipboard API—all the objects and methods are\n// there, they just don't work, and they are hard to test.\nvar brokenClipboardAPI = (result.ie && result.ie_version < 15) ||\n (result.ios && result.webkit_version < 604);\n\nhandlers.copy = editHandlers.cut = function (view, e) {\n var sel = view.state.selection, cut = e.type == \"cut\";\n if (sel.empty) { return }\n\n // IE and Edge's clipboard interface is completely broken\n var data = brokenClipboardAPI ? null : e.clipboardData;\n var slice = sel.content();\n var ref = serializeForClipboard(view, slice);\n var dom = ref.dom;\n var text = ref.text;\n if (data) {\n e.preventDefault();\n data.clearData();\n data.setData(\"text/html\", dom.innerHTML);\n data.setData(\"text/plain\", text);\n } else {\n captureCopy(view, dom);\n }\n if (cut) { view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta(\"uiEvent\", \"cut\")); }\n};\n\nfunction sliceSingleNode(slice) {\n return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null\n}\n\nfunction capturePaste(view, e) {\n var doc = view.dom.ownerDocument;\n var plainText = view.shiftKey || view.state.selection.$from.parent.type.spec.code;\n var target = doc.body.appendChild(doc.createElement(plainText ? \"textarea\" : \"div\"));\n if (!plainText) { target.contentEditable = \"true\"; }\n target.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n target.focus();\n setTimeout(function () {\n view.focus();\n doc.body.removeChild(target);\n if (plainText) { doPaste(view, target.value, null, e); }\n else { doPaste(view, target.textContent, target.innerHTML, e); }\n }, 50);\n}\n\nfunction doPaste(view, text, html, e) {\n var slice = parseFromClipboard(view, text, html, view.shiftKey, view.state.selection.$from);\n if (view.someProp(\"handlePaste\", function (f) { return f(view, e, slice || Slice.empty); }) || !slice) { return }\n\n var singleNode = sliceSingleNode(slice);\n var tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, view.shiftKey) : view.state.tr.replaceSelection(slice);\n view.dispatch(tr.scrollIntoView().setMeta(\"paste\", true).setMeta(\"uiEvent\", \"paste\"));\n}\n\neditHandlers.paste = function (view, e) {\n var data = brokenClipboardAPI ? null : e.clipboardData;\n var html = data && data.getData(\"text/html\"), text = data && data.getData(\"text/plain\");\n if (data && (html || text || data.files.length)) {\n doPaste(view, text, html, e);\n e.preventDefault();\n } else {\n capturePaste(view, e);\n }\n};\n\nvar Dragging = function Dragging(slice, move) {\n this.slice = slice;\n this.move = move;\n};\n\nvar dragCopyModifier = result.mac ? \"altKey\" : \"ctrlKey\";\n\nhandlers.dragstart = function (view, e) {\n var mouseDown = view.mouseDown;\n if (mouseDown) { mouseDown.done(); }\n if (!e.dataTransfer) { return }\n\n var sel = view.state.selection;\n var pos = sel.empty ? null : view.posAtCoords(eventCoords(e));\n if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1: sel.to)) ; else if (mouseDown && mouseDown.mightDrag) {\n view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos)));\n } else if (e.target && e.target.nodeType == 1) {\n var desc = view.docView.nearestDesc(e.target, true);\n if (!desc || !desc.node.type.spec.draggable || desc == view.docView) { return }\n view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, desc.posBefore)));\n }\n var slice = view.state.selection.content();\n var ref = serializeForClipboard(view, slice);\n var dom = ref.dom;\n var text = ref.text;\n e.dataTransfer.clearData();\n e.dataTransfer.setData(brokenClipboardAPI ? \"Text\" : \"text/html\", dom.innerHTML);\n if (!brokenClipboardAPI) { e.dataTransfer.setData(\"text/plain\", text); }\n view.dragging = new Dragging(slice, !e[dragCopyModifier]);\n};\n\nhandlers.dragend = function (view) {\n window.setTimeout(function () { return view.dragging = null; }, 50);\n};\n\neditHandlers.dragover = editHandlers.dragenter = function (_, e) { return e.preventDefault(); };\n\neditHandlers.drop = function (view, e) {\n var dragging = view.dragging;\n view.dragging = null;\n\n if (!e.dataTransfer) { return }\n\n var eventPos = view.posAtCoords(eventCoords(e));\n if (!eventPos) { return }\n var $mouse = view.state.doc.resolve(eventPos.pos);\n if (!$mouse) { return }\n var slice = dragging && dragging.slice ||\n parseFromClipboard(view, e.dataTransfer.getData(brokenClipboardAPI ? \"Text\" : \"text/plain\"),\n brokenClipboardAPI ? null : e.dataTransfer.getData(\"text/html\"), false, $mouse);\n if (view.someProp(\"handleDrop\", function (f) { return f(view, e, slice || Slice.empty, dragging && dragging.move); })) {\n e.preventDefault();\n return\n }\n if (!slice) { return }\n\n e.preventDefault();\n var insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;\n if (insertPos == null) { insertPos = $mouse.pos; }\n\n var tr = view.state.tr;\n if (dragging && dragging.move) { tr.deleteSelection(); }\n\n var pos = tr.mapping.map(insertPos);\n var isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;\n var beforeInsert = tr.doc;\n if (isNode)\n { tr.replaceRangeWith(pos, pos, slice.content.firstChild); }\n else\n { tr.replaceRange(pos, pos, slice); }\n if (tr.doc.eq(beforeInsert)) { return }\n\n var $pos = tr.doc.resolve(pos);\n if (isNode && NodeSelection.isSelectable(slice.content.firstChild) &&\n $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild))\n { tr.setSelection(new NodeSelection($pos)); }\n else\n { tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(tr.mapping.map(insertPos)))); }\n view.focus();\n view.dispatch(tr.setMeta(\"uiEvent\", \"drop\"));\n};\n\nhandlers.focus = function (view) {\n if (!view.focused) {\n view.domObserver.stop();\n view.dom.classList.add(\"ProseMirror-focused\");\n view.domObserver.start();\n view.focused = true;\n setTimeout(function () {\n if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.root.getSelection()))\n { selectionToDOM(view); }\n }, 20);\n }\n};\n\nhandlers.blur = function (view) {\n if (view.focused) {\n view.domObserver.stop();\n view.dom.classList.remove(\"ProseMirror-focused\");\n view.domObserver.start();\n view.domObserver.currentSelection.set({});\n view.focused = false;\n }\n};\n\nhandlers.beforeinput = function (view, event) {\n // We should probably do more with beforeinput events, but support\n // is so spotty that I'm still waiting to see where they are going.\n\n // Very specific hack to deal with backspace sometimes failing on\n // Chrome Android when after an uneditable node.\n if (result.chrome && result.android && event.inputType == \"deleteContentBackward\") {\n var domChangeCount = view.domChangeCount;\n setTimeout(function () {\n if (view.domChangeCount != domChangeCount) { return } // Event already had some effect\n // This bug tends to close the virtual keyboard, so we refocus\n view.dom.blur();\n view.focus();\n if (view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(8, \"Backspace\")); })) { return }\n var ref = view.state.selection;\n var $cursor = ref.$cursor;\n // Crude approximation of backspace behavior when no command handled it\n if ($cursor && $cursor.pos > 0) { view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView()); }\n }, 50);\n }\n};\n\n// Make sure all handlers get registered\nfor (var prop in editHandlers) { handlers[prop] = editHandlers[prop]; }\n\nfunction compareObjs(a, b) {\n if (a == b) { return true }\n for (var p in a) { if (a[p] !== b[p]) { return false } }\n for (var p$1 in b) { if (!(p$1 in a)) { return false } }\n return true\n}\n\nvar WidgetType = function WidgetType(toDOM, spec) {\n this.spec = spec || noSpec;\n this.side = this.spec.side || 0;\n this.toDOM = toDOM;\n};\n\nWidgetType.prototype.map = function map (mapping, span, offset, oldOffset) {\n var ref = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);\n var pos = ref.pos;\n var deleted = ref.deleted;\n return deleted ? null : new Decoration(pos - offset, pos - offset, this)\n};\n\nWidgetType.prototype.valid = function valid () { return true };\n\nWidgetType.prototype.eq = function eq (other) {\n return this == other ||\n (other instanceof WidgetType &&\n (this.spec.key && this.spec.key == other.spec.key ||\n this.toDOM == other.toDOM && compareObjs(this.spec, other.spec)))\n};\n\nvar InlineType = function InlineType(attrs, spec) {\n this.spec = spec || noSpec;\n this.attrs = attrs;\n};\n\nInlineType.prototype.map = function map (mapping, span, offset, oldOffset) {\n var from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;\n var to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;\n return from >= to ? null : new Decoration(from, to, this)\n};\n\nInlineType.prototype.valid = function valid (_, span) { return span.from < span.to };\n\nInlineType.prototype.eq = function eq (other) {\n return this == other ||\n (other instanceof InlineType && compareObjs(this.attrs, other.attrs) &&\n compareObjs(this.spec, other.spec))\n};\n\nInlineType.is = function is (span) { return span.type instanceof InlineType };\n\nvar NodeType = function NodeType(attrs, spec) {\n this.spec = spec || noSpec;\n this.attrs = attrs;\n};\n\nNodeType.prototype.map = function map (mapping, span, offset, oldOffset) {\n var from = mapping.mapResult(span.from + oldOffset, 1);\n if (from.deleted) { return null }\n var to = mapping.mapResult(span.to + oldOffset, -1);\n if (to.deleted || to.pos <= from.pos) { return null }\n return new Decoration(from.pos - offset, to.pos - offset, this)\n};\n\nNodeType.prototype.valid = function valid (node, span) {\n var ref = node.content.findIndex(span.from);\n var index = ref.index;\n var offset = ref.offset;\n return offset == span.from && offset + node.child(index).nodeSize == span.to\n};\n\nNodeType.prototype.eq = function eq (other) {\n return this == other ||\n (other instanceof NodeType && compareObjs(this.attrs, other.attrs) &&\n compareObjs(this.spec, other.spec))\n};\n\n// ::- Decoration objects can be provided to the view through the\n// [`decorations` prop](#view.EditorProps.decorations). They come in\n// several variants—see the static members of this class for details.\nvar Decoration = function Decoration(from, to, type) {\n // :: number\n // The start position of the decoration.\n this.from = from;\n // :: number\n // The end position. Will be the same as `from` for [widget\n // decorations](#view.Decoration^widget).\n this.to = to;\n this.type = type;\n};\n\nvar prototypeAccessors$1 = { spec: { configurable: true } };\n\nDecoration.prototype.copy = function copy (from, to) {\n return new Decoration(from, to, this.type)\n};\n\nDecoration.prototype.eq = function eq (other, offset) {\n if ( offset === void 0 ) offset = 0;\n\n return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to\n};\n\nDecoration.prototype.map = function map (mapping, offset, oldOffset) {\n return this.type.map(mapping, this, offset, oldOffset)\n};\n\n// :: (number, union<(view: EditorView, getPos: () → number) → dom.Node, dom.Node>, ?Object) → Decoration\n// Creates a widget decoration, which is a DOM node that's shown in\n// the document at the given position. It is recommended that you\n// delay rendering the widget by passing a function that will be\n// called when the widget is actually drawn in a view, but you can\n// also directly pass a DOM node. `getPos` can be used to find the\n// widget's current document position.\n//\n// spec::- These options are supported:\n//\n// side:: ?number\n// Controls which side of the document position this widget is\n// associated with. When negative, it is drawn before a cursor\n// at its position, and content inserted at that position ends\n// up after the widget. When zero (the default) or positive, the\n// widget is drawn after the cursor and content inserted there\n// ends up before the widget.\n//\n// When there are multiple widgets at a given position, their\n// `side` values determine the order in which they appear. Those\n// with lower values appear first. The ordering of widgets with\n// the same `side` value is unspecified.\n//\n// When `marks` is null, `side` also determines the marks that\n// the widget is wrapped in—those of the node before when\n// negative, those of the node after when positive.\n//\n// marks:: ?[Mark]\n// The precise set of marks to draw around the widget.\n//\n// stopEvent:: ?(event: dom.Event) → bool\n// Can be used to control which DOM events, when they bubble out\n// of this widget, the editor view should ignore.\n//\n// ignoreSelection:: ?bool\n// When set (defaults to false), selection changes inside the\n// widget are ignored, and don't cause ProseMirror to try and\n// re-sync the selection with its selection state.\n//\n// key:: ?string\n// When comparing decorations of this type (in order to decide\n// whether it needs to be redrawn), ProseMirror will by default\n// compare the widget DOM node by identity. If you pass a key,\n// that key will be compared instead, which can be useful when\n// you generate decorations on the fly and don't want to store\n// and reuse DOM nodes. Make sure that any widgets with the same\n// key are interchangeable—if widgets differ in, for example,\n// the behavior of some event handler, they should get\n// different keys.\nDecoration.widget = function widget (pos, toDOM, spec) {\n return new Decoration(pos, pos, new WidgetType(toDOM, spec))\n};\n\n// :: (number, number, DecorationAttrs, ?Object) → Decoration\n// Creates an inline decoration, which adds the given attributes to\n// each inline node between `from` and `to`.\n//\n// spec::- These options are recognized:\n//\n// inclusiveStart:: ?bool\n// Determines how the left side of the decoration is\n// [mapped](#transform.Position_Mapping) when content is\n// inserted directly at that position. By default, the decoration\n// won't include the new content, but you can set this to `true`\n// to make it inclusive.\n//\n// inclusiveEnd:: ?bool\n// Determines how the right side of the decoration is mapped.\n// See\n// [`inclusiveStart`](#view.Decoration^inline^spec.inclusiveStart).\nDecoration.inline = function inline (from, to, attrs, spec) {\n return new Decoration(from, to, new InlineType(attrs, spec))\n};\n\n// :: (number, number, DecorationAttrs, ?Object) → Decoration\n// Creates a node decoration. `from` and `to` should point precisely\n// before and after a node in the document. That node, and only that\n// node, will receive the given attributes.\n//\n// spec::-\n//\n// Optional information to store with the decoration. It\n// is also used when comparing decorators for equality.\nDecoration.node = function node (from, to, attrs, spec) {\n return new Decoration(from, to, new NodeType(attrs, spec))\n};\n\n// :: Object\n// The spec provided when creating this decoration. Can be useful\n// if you've stored extra information in that object.\nprototypeAccessors$1.spec.get = function () { return this.type.spec };\n\nObject.defineProperties( Decoration.prototype, prototypeAccessors$1 );\n\n// DecorationAttrs:: interface\n// A set of attributes to add to a decorated node. Most properties\n// simply directly correspond to DOM attributes of the same name,\n// which will be set to the property's value. These are exceptions:\n//\n// class:: ?string\n// A CSS class name or a space-separated set of class names to be\n// _added_ to the classes that the node already had.\n//\n// style:: ?string\n// A string of CSS to be _added_ to the node's existing `style` property.\n//\n// nodeName:: ?string\n// When non-null, the target node is wrapped in a DOM element of\n// this type (and the other attributes are applied to this element).\n\nvar none = [], noSpec = {};\n\n// ::- A collection of [decorations](#view.Decoration), organized in\n// such a way that the drawing algorithm can efficiently use and\n// compare them. This is a persistent data structure—it is not\n// modified, updates create a new value.\nvar DecorationSet = function DecorationSet(local, children) {\n this.local = local && local.length ? local : none;\n this.children = children && children.length ? children : none;\n};\n\n// :: (Node, [Decoration]) → DecorationSet\n// Create a set of decorations, using the structure of the given\n// document.\nDecorationSet.create = function create (doc, decorations) {\n return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty\n};\n\n// :: (?number, ?number, ?(spec: Object) → bool) → [Decoration]\n// Find all decorations in this set which touch the given range\n// (including decorations that start or end directly at the\n// boundaries) and match the given predicate on their spec. When\n// `start` and `end` are omitted, all decorations in the set are\n// considered. When `predicate` isn't given, all decorations are\n// assumed to match.\nDecorationSet.prototype.find = function find (start, end, predicate) {\n var result = [];\n this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);\n return result\n};\n\nDecorationSet.prototype.findInner = function findInner (start, end, result, offset, predicate) {\n for (var i = 0; i < this.local.length; i++) {\n var span = this.local[i];\n if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec)))\n { result.push(span.copy(span.from + offset, span.to + offset)); }\n }\n for (var i$1 = 0; i$1 < this.children.length; i$1 += 3) {\n if (this.children[i$1] < end && this.children[i$1 + 1] > start) {\n var childOff = this.children[i$1] + 1;\n this.children[i$1 + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);\n }\n }\n};\n\n// :: (Mapping, Node, ?Object) → DecorationSet\n// Map the set of decorations in response to a change in the\n// document.\n//\n// options::- An optional set of options.\n//\n// onRemove:: ?(decorationSpec: Object)\n// When given, this function will be called for each decoration\n// that gets dropped as a result of the mapping, passing the\n// spec of that decoration.\nDecorationSet.prototype.map = function map (mapping, doc, options) {\n if (this == empty || mapping.maps.length == 0) { return this }\n return this.mapInner(mapping, doc, 0, 0, options || noSpec)\n};\n\nDecorationSet.prototype.mapInner = function mapInner (mapping, node, offset, oldOffset, options) {\n var newLocal;\n for (var i = 0; i < this.local.length; i++) {\n var mapped = this.local[i].map(mapping, offset, oldOffset);\n if (mapped && mapped.type.valid(node, mapped)) { (newLocal || (newLocal = [])).push(mapped); }\n else if (options.onRemove) { options.onRemove(this.local[i].spec); }\n }\n\n if (this.children.length)\n { return mapChildren(this.children, newLocal, mapping, node, offset, oldOffset, options) }\n else\n { return newLocal ? new DecorationSet(newLocal.sort(byPos)) : empty }\n};\n\n// :: (Node, [Decoration]) → DecorationSet\n// Add the given array of decorations to the ones in the set,\n// producing a new set. Needs access to the current document to\n// create the appropriate tree structure.\nDecorationSet.prototype.add = function add (doc, decorations) {\n if (!decorations.length) { return this }\n if (this == empty) { return DecorationSet.create(doc, decorations) }\n return this.addInner(doc, decorations, 0)\n};\n\nDecorationSet.prototype.addInner = function addInner (doc, decorations, offset) {\n var this$1 = this;\n\n var children, childIndex = 0;\n doc.forEach(function (childNode, childOffset) {\n var baseOffset = childOffset + offset, found;\n if (!(found = takeSpansForNode(decorations, childNode, baseOffset))) { return }\n\n if (!children) { children = this$1.children.slice(); }\n while (childIndex < children.length && children[childIndex] < childOffset) { childIndex += 3; }\n if (children[childIndex] == childOffset)\n { children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1); }\n else\n { children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec)); }\n childIndex += 3;\n });\n\n var local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);\n return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local,\n children || this.children)\n};\n\n// :: ([Decoration]) → DecorationSet\n// Create a new set that contains the decorations in this set, minus\n// the ones in the given array.\nDecorationSet.prototype.remove = function remove (decorations) {\n if (decorations.length == 0 || this == empty) { return this }\n return this.removeInner(decorations, 0)\n};\n\nDecorationSet.prototype.removeInner = function removeInner (decorations, offset) {\n var children = this.children, local = this.local;\n for (var i = 0; i < children.length; i += 3) {\n var found = (void 0), from = children[i] + offset, to = children[i + 1] + offset;\n for (var j = 0, span = (void 0); j < decorations.length; j++) { if (span = decorations[j]) {\n if (span.from > from && span.to < to) {\n decorations[j] = null\n ;(found || (found = [])).push(span);\n }\n } }\n if (!found) { continue }\n if (children == this.children) { children = this.children.slice(); }\n var removed = children[i + 2].removeInner(found, from + 1);\n if (removed != empty) {\n children[i + 2] = removed;\n } else {\n children.splice(i, 3);\n i -= 3;\n }\n }\n if (local.length) { for (var i$1 = 0, span$1 = (void 0); i$1 < decorations.length; i$1++) { if (span$1 = decorations[i$1]) {\n for (var j$1 = 0; j$1 < local.length; j$1++) { if (local[j$1].eq(span$1, offset)) {\n if (local == this.local) { local = this.local.slice(); }\n local.splice(j$1--, 1);\n } }\n } } }\n if (children == this.children && local == this.local) { return this }\n return local.length || children.length ? new DecorationSet(local, children) : empty\n};\n\nDecorationSet.prototype.forChild = function forChild (offset, node) {\n if (this == empty) { return this }\n if (node.isLeaf) { return DecorationSet.empty }\n\n var child, local;\n for (var i = 0; i < this.children.length; i += 3) { if (this.children[i] >= offset) {\n if (this.children[i] == offset) { child = this.children[i + 2]; }\n break\n } }\n var start = offset + 1, end = start + node.content.size;\n for (var i$1 = 0; i$1 < this.local.length; i$1++) {\n var dec = this.local[i$1];\n if (dec.from < end && dec.to > start && (dec.type instanceof InlineType)) {\n var from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;\n if (from < to) { (local || (local = [])).push(dec.copy(from, to)); }\n }\n }\n if (local) {\n var localSet = new DecorationSet(local.sort(byPos));\n return child ? new DecorationGroup([localSet, child]) : localSet\n }\n return child || empty\n};\n\nDecorationSet.prototype.eq = function eq (other) {\n if (this == other) { return true }\n if (!(other instanceof DecorationSet) ||\n this.local.length != other.local.length ||\n this.children.length != other.children.length) { return false }\n for (var i = 0; i < this.local.length; i++)\n { if (!this.local[i].eq(other.local[i])) { return false } }\n for (var i$1 = 0; i$1 < this.children.length; i$1 += 3)\n { if (this.children[i$1] != other.children[i$1] ||\n this.children[i$1 + 1] != other.children[i$1 + 1] ||\n !this.children[i$1 + 2].eq(other.children[i$1 + 2])) { return false } }\n return true\n};\n\nDecorationSet.prototype.locals = function locals (node) {\n return removeOverlap(this.localsInner(node))\n};\n\nDecorationSet.prototype.localsInner = function localsInner (node) {\n if (this == empty) { return none }\n if (node.inlineContent || !this.local.some(InlineType.is)) { return this.local }\n var result = [];\n for (var i = 0; i < this.local.length; i++) {\n if (!(this.local[i].type instanceof InlineType))\n { result.push(this.local[i]); }\n }\n return result\n};\n\nvar empty = new DecorationSet();\n\n// :: DecorationSet\n// The empty set of decorations.\nDecorationSet.empty = empty;\n\nDecorationSet.removeOverlap = removeOverlap;\n\n// :- An abstraction that allows the code dealing with decorations to\n// treat multiple DecorationSet objects as if it were a single object\n// with (a subset of) the same interface.\nvar DecorationGroup = function DecorationGroup(members) {\n this.members = members;\n};\n\nDecorationGroup.prototype.forChild = function forChild (offset, child) {\n if (child.isLeaf) { return DecorationSet.empty }\n var found = [];\n for (var i = 0; i < this.members.length; i++) {\n var result = this.members[i].forChild(offset, child);\n if (result == empty) { continue }\n if (result instanceof DecorationGroup) { found = found.concat(result.members); }\n else { found.push(result); }\n }\n return DecorationGroup.from(found)\n};\n\nDecorationGroup.prototype.eq = function eq (other) {\n if (!(other instanceof DecorationGroup) ||\n other.members.length != this.members.length) { return false }\n for (var i = 0; i < this.members.length; i++)\n { if (!this.members[i].eq(other.members[i])) { return false } }\n return true\n};\n\nDecorationGroup.prototype.locals = function locals (node) {\n var result, sorted = true;\n for (var i = 0; i < this.members.length; i++) {\n var locals = this.members[i].localsInner(node);\n if (!locals.length) { continue }\n if (!result) {\n result = locals;\n } else {\n if (sorted) {\n result = result.slice();\n sorted = false;\n }\n for (var j = 0; j < locals.length; j++) { result.push(locals[j]); }\n }\n }\n return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none\n};\n\n// : ([DecorationSet]) → union<DecorationSet, DecorationGroup>\n// Create a group for the given array of decoration sets, or return\n// a single set when possible.\nDecorationGroup.from = function from (members) {\n switch (members.length) {\n case 0: return empty\n case 1: return members[0]\n default: return new DecorationGroup(members)\n }\n};\n\nfunction mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {\n var children = oldChildren.slice();\n\n // Mark the children that are directly touched by changes, and\n // move those that are after the changes.\n var shift = function (oldStart, oldEnd, newStart, newEnd) {\n for (var i = 0; i < children.length; i += 3) {\n var end = children[i + 1], dSize = (void 0);\n if (end == -1 || oldStart > end + oldOffset) { continue }\n if (oldEnd >= children[i] + oldOffset) {\n children[i + 1] = -1;\n } else if (dSize = (newEnd - newStart) - (oldEnd - oldStart) + (oldOffset - offset)) {\n children[i] += dSize;\n children[i + 1] += dSize;\n }\n }\n };\n for (var i = 0; i < mapping.maps.length; i++) { mapping.maps[i].forEach(shift); }\n\n // Find the child nodes that still correspond to a single node,\n // recursively call mapInner on them and update their positions.\n var mustRebuild = false;\n for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] == -1) { // Touched nodes\n var from = mapping.map(children[i$1] + oldOffset), fromLocal = from - offset;\n if (fromLocal < 0 || fromLocal >= node.content.size) {\n mustRebuild = true;\n continue\n }\n // Must read oldChildren because children was tagged with -1\n var to = mapping.map(oldChildren[i$1 + 1] + oldOffset, -1), toLocal = to - offset;\n var ref = node.content.findIndex(fromLocal);\n var index = ref.index;\n var childOffset = ref.offset;\n var childNode = node.maybeChild(index);\n if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {\n var mapped = children[i$1 + 2].mapInner(mapping, childNode, from + 1, children[i$1] + oldOffset + 1, options);\n if (mapped != empty) {\n children[i$1] = fromLocal;\n children[i$1 + 1] = toLocal;\n children[i$1 + 2] = mapped;\n } else {\n children[i$1 + 1] = -2;\n mustRebuild = true;\n }\n } else {\n mustRebuild = true;\n }\n } }\n\n // Remaining children must be collected and rebuilt into the appropriate structure\n if (mustRebuild) {\n var decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal || [], mapping,\n offset, oldOffset, options);\n var built = buildTree(decorations, node, 0, options);\n newLocal = built.local;\n for (var i$2 = 0; i$2 < children.length; i$2 += 3) { if (children[i$2 + 1] < 0) {\n children.splice(i$2, 3);\n i$2 -= 3;\n } }\n for (var i$3 = 0, j = 0; i$3 < built.children.length; i$3 += 3) {\n var from$1 = built.children[i$3];\n while (j < children.length && children[j] < from$1) { j += 3; }\n children.splice(j, 0, built.children[i$3], built.children[i$3 + 1], built.children[i$3 + 2]);\n }\n }\n\n return new DecorationSet(newLocal && newLocal.sort(byPos), children)\n}\n\nfunction moveSpans(spans, offset) {\n if (!offset || !spans.length) { return spans }\n var result = [];\n for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n result.push(new Decoration(span.from + offset, span.to + offset, span.type));\n }\n return result\n}\n\nfunction mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {\n // Gather all decorations from the remaining marked children\n function gather(set, oldOffset) {\n for (var i = 0; i < set.local.length; i++) {\n var mapped = set.local[i].map(mapping, offset, oldOffset);\n if (mapped) { decorations.push(mapped); }\n else if (options.onRemove) { options.onRemove(set.local[i].spec); }\n }\n for (var i$1 = 0; i$1 < set.children.length; i$1 += 3)\n { gather(set.children[i$1 + 2], set.children[i$1] + oldOffset + 1); }\n }\n for (var i = 0; i < children.length; i += 3) { if (children[i + 1] == -1)\n { gather(children[i + 2], oldChildren[i] + oldOffset + 1); } }\n\n return decorations\n}\n\nfunction takeSpansForNode(spans, node, offset) {\n if (node.isLeaf) { return null }\n var end = offset + node.nodeSize, found = null;\n for (var i = 0, span = (void 0); i < spans.length; i++) {\n if ((span = spans[i]) && span.from > offset && span.to < end) {\n(found || (found = [])).push(span);\n spans[i] = null;\n }\n }\n return found\n}\n\nfunction withoutNulls(array) {\n var result = [];\n for (var i = 0; i < array.length; i++)\n { if (array[i] != null) { result.push(array[i]); } }\n return result\n}\n\n// : ([Decoration], Node, number) → DecorationSet\n// Build up a tree that corresponds to a set of decorations. `offset`\n// is a base offset that should be subtractet from the `from` and `to`\n// positions in the spans (so that we don't have to allocate new spans\n// for recursive calls).\nfunction buildTree(spans, node, offset, options) {\n var children = [], hasNulls = false;\n node.forEach(function (childNode, localStart) {\n var found = takeSpansForNode(spans, childNode, localStart + offset);\n if (found) {\n hasNulls = true;\n var subtree = buildTree(found, childNode, offset + localStart + 1, options);\n if (subtree != empty)\n { children.push(localStart, localStart + childNode.nodeSize, subtree); }\n }\n });\n var locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);\n for (var i = 0; i < locals.length; i++) { if (!locals[i].type.valid(node, locals[i])) {\n if (options.onRemove) { options.onRemove(locals[i].spec); }\n locals.splice(i--, 1);\n } }\n return locals.length || children.length ? new DecorationSet(locals, children) : empty\n}\n\n// : (Decoration, Decoration) → number\n// Used to sort decorations so that ones with a low start position\n// come first, and within a set with the same start position, those\n// with an smaller end position come first.\nfunction byPos(a, b) {\n return a.from - b.from || a.to - b.to\n}\n\n// : ([Decoration]) → [Decoration]\n// Scan a sorted array of decorations for partially overlapping spans,\n// and split those so that only fully overlapping spans are left (to\n// make subsequent rendering easier). Will return the input array if\n// no partially overlapping spans are found (the common case).\nfunction removeOverlap(spans) {\n var working = spans;\n for (var i = 0; i < working.length - 1; i++) {\n var span = working[i];\n if (span.from != span.to) { for (var j = i + 1; j < working.length; j++) {\n var next = working[j];\n if (next.from == span.from) {\n if (next.to != span.to) {\n if (working == spans) { working = spans.slice(); }\n // Followed by a partially overlapping larger span. Split that\n // span.\n working[j] = next.copy(next.from, span.to);\n insertAhead(working, j + 1, next.copy(span.to, next.to));\n }\n continue\n } else {\n if (next.from < span.to) {\n if (working == spans) { working = spans.slice(); }\n // The end of this one overlaps with a subsequent span. Split\n // this one.\n working[i] = span.copy(span.from, next.from);\n insertAhead(working, j, span.copy(next.from, span.to));\n }\n break\n }\n } }\n }\n return working\n}\n\nfunction insertAhead(array, i, deco) {\n while (i < array.length && byPos(deco, array[i]) > 0) { i++; }\n array.splice(i, 0, deco);\n}\n\n// : (EditorView) → union<DecorationSet, DecorationGroup>\n// Get the decorations associated with the current props of a view.\nfunction viewDecorations(view) {\n var found = [];\n view.someProp(\"decorations\", function (f) {\n var result = f(view.state);\n if (result && result != empty) { found.push(result); }\n });\n if (view.cursorWrapper)\n { found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco])); }\n return DecorationGroup.from(found)\n}\n\n// ::- An editor view manages the DOM structure that represents an\n// editable document. Its state and behavior are determined by its\n// [props](#view.DirectEditorProps).\nvar EditorView = function EditorView(place, props) {\n this._props = props;\n // :: EditorState\n // The view's current [state](#state.EditorState).\n this.state = props.state;\n\n this.dispatch = this.dispatch.bind(this);\n\n this._root = null;\n this.focused = false;\n\n // :: dom.Element\n // An editable DOM node containing the document. (You probably\n // should not directly interfere with its content.)\n this.dom = (place && place.mount) || document.createElement(\"div\");\n if (place) {\n if (place.appendChild) { place.appendChild(this.dom); }\n else if (place.apply) { place(this.dom); }\n else if (place.mount) { this.mounted = true; }\n }\n\n // :: bool\n // Indicates whether the editor is currently [editable](#view.EditorProps.editable).\n this.editable = getEditable(this);\n this.markCursor = null;\n this.cursorWrapper = null;\n updateCursorWrapper(this);\n this.nodeViews = buildNodeViews(this);\n this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);\n\n this.lastSelectedViewDesc = null;\n // :: ?{slice: Slice, move: bool}\n // When editor content is being dragged, this object contains\n // information about the dragged slice and whether it is being\n // copied or moved. At any other time, it is null.\n this.dragging = null;\n\n initInput(this);\n\n this.pluginViews = [];\n this.updatePluginViews();\n};\n\nvar prototypeAccessors$2 = { props: { configurable: true },root: { configurable: true } };\n\n// composing:: boolean\n// Holds `true` when a\n// [composition](https://developer.mozilla.org/en-US/docs/Mozilla/IME_handling_guide)\n// is active.\n\n// :: DirectEditorProps\n// The view's current [props](#view.EditorProps).\nprototypeAccessors$2.props.get = function () {\n if (this._props.state != this.state) {\n var prev = this._props;\n this._props = {};\n for (var name in prev) { this._props[name] = prev[name]; }\n this._props.state = this.state;\n }\n return this._props\n};\n\n// :: (DirectEditorProps)\n// Update the view's props. Will immediately cause an update to\n// the DOM.\nEditorView.prototype.update = function update (props) {\n if (props.handleDOMEvents != this._props.handleDOMEvents) { ensureListeners(this); }\n this._props = props;\n this.updateStateInner(props.state, true);\n};\n\n// :: (DirectEditorProps)\n// Update the view by updating existing props object with the object\n// given as argument. Equivalent to `view.update(Object.assign({},\n// view.props, props))`.\nEditorView.prototype.setProps = function setProps (props) {\n var updated = {};\n for (var name in this._props) { updated[name] = this._props[name]; }\n updated.state = this.state;\n for (var name$1 in props) { updated[name$1] = props[name$1]; }\n this.update(updated);\n};\n\n// :: (EditorState)\n// Update the editor's `state` prop, without touching any of the\n// other props.\nEditorView.prototype.updateState = function updateState (state) {\n this.updateStateInner(state, this.state.plugins != state.plugins);\n};\n\nEditorView.prototype.updateStateInner = function updateStateInner (state, reconfigured) {\n var this$1 = this;\n\n var prev = this.state, redraw = false;\n this.state = state;\n if (reconfigured) {\n var nodeViews = buildNodeViews(this);\n if (changedNodeViews(nodeViews, this.nodeViews)) {\n this.nodeViews = nodeViews;\n redraw = true;\n }\n ensureListeners(this);\n }\n\n this.editable = getEditable(this);\n updateCursorWrapper(this);\n var innerDeco = viewDecorations(this), outerDeco = computeDocDeco(this);\n\n var scroll = reconfigured ? \"reset\"\n : state.scrollToSelection > prev.scrollToSelection ? \"to selection\" : \"preserve\";\n var updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);\n var updateSel = updateDoc || !state.selection.eq(prev.selection);\n var oldScrollPos = scroll == \"preserve\" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);\n\n if (updateSel) {\n this.domObserver.stop();\n // Work around an issue in Chrome, IE, and Edge where changing\n // the DOM around an active selection puts it into a broken\n // state where the thing the user sees differs from the\n // selection reported by the Selection object (#710, #973,\n // #1011, #1013, #1035).\n var forceSelUpdate = updateDoc && (result.ie || result.chrome) && !this.composing &&\n !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);\n if (updateDoc) {\n var selContext = result.chrome && selectionContext(this.root);\n if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {\n this.docView.updateOuterDeco([]);\n this.docView.destroy();\n this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);\n }\n if (selContext && needChromeSelectionReset(selContext, this.root)) { forceSelUpdate = true; }\n }\n // Work around for an issue where an update arriving right between\n // a DOM selection change and the \"selectionchange\" event for it\n // can cause a spurious DOM selection update, disrupting mouse\n // drag selection.\n if (forceSelUpdate ||\n !(this.mouseDown && this.domObserver.currentSelection.eq(this.root.getSelection()) && anchorInRightPlace(this))) {\n selectionToDOM(this, forceSelUpdate);\n } else {\n syncNodeSelection(this, state.selection);\n this.domObserver.setCurSelection();\n }\n this.domObserver.start();\n }\n\n this.updatePluginViews(prev);\n\n if (scroll == \"reset\") {\n this.dom.scrollTop = 0;\n } else if (scroll == \"to selection\") {\n var startDOM = this.root.getSelection().focusNode;\n if (this.someProp(\"handleScrollToSelection\", function (f) { return f(this$1); }))\n ; // Handled\n else if (state.selection instanceof NodeSelection)\n { scrollRectIntoView(this, this.docView.domAfterPos(state.selection.from).getBoundingClientRect(), startDOM); }\n else\n { scrollRectIntoView(this, this.coordsAtPos(state.selection.head), startDOM); }\n } else if (oldScrollPos) {\n resetScrollPos(oldScrollPos);\n }\n};\n\nEditorView.prototype.destroyPluginViews = function destroyPluginViews () {\n var view;\n while (view = this.pluginViews.pop()) { if (view.destroy) { view.destroy(); } }\n};\n\nEditorView.prototype.updatePluginViews = function updatePluginViews (prevState) {\n if (!prevState || prevState.plugins != this.state.plugins) {\n this.destroyPluginViews();\n for (var i = 0; i < this.state.plugins.length; i++) {\n var plugin = this.state.plugins[i];\n if (plugin.spec.view) { this.pluginViews.push(plugin.spec.view(this)); }\n }\n } else {\n for (var i$1 = 0; i$1 < this.pluginViews.length; i$1++) {\n var pluginView = this.pluginViews[i$1];\n if (pluginView.update) { pluginView.update(this, prevState); }\n }\n }\n};\n\n// :: (string, ?(prop: *) → *) → *\n// Goes over the values of a prop, first those provided directly,\n// then those from plugins (in order), and calls `f` every time a\n// non-undefined value is found. When `f` returns a truthy value,\n// that is immediately returned. When `f` isn't provided, it is\n// treated as the identity function (the prop value is returned\n// directly).\nEditorView.prototype.someProp = function someProp (propName, f) {\n var prop = this._props && this._props[propName], value;\n if (prop != null && (value = f ? f(prop) : prop)) { return value }\n var plugins = this.state.plugins;\n if (plugins) { for (var i = 0; i < plugins.length; i++) {\n var prop$1 = plugins[i].props[propName];\n if (prop$1 != null && (value = f ? f(prop$1) : prop$1)) { return value }\n } }\n};\n\n// :: () → bool\n// Query whether the view has focus.\nEditorView.prototype.hasFocus = function hasFocus () {\n return this.root.activeElement == this.dom\n};\n\n// :: ()\n// Focus the editor.\nEditorView.prototype.focus = function focus () {\n this.domObserver.stop();\n if (this.editable) { focusPreventScroll(this.dom); }\n selectionToDOM(this);\n this.domObserver.start();\n};\n\n// :: union<dom.Document, dom.DocumentFragment>\n// Get the document root in which the editor exists. This will\n// usually be the top-level `document`, but might be a [shadow\n// DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)\n// root if the editor is inside one.\nprototypeAccessors$2.root.get = function () {\n var cached = this._root;\n if (cached == null) { for (var search = this.dom.parentNode; search; search = search.parentNode) {\n if (search.nodeType == 9 || (search.nodeType == 11 && search.host)) {\n if (!search.getSelection) { Object.getPrototypeOf(search).getSelection = function () { return document.getSelection(); }; }\n return this._root = search\n }\n } }\n return cached || document\n};\n\n// :: ({left: number, top: number}) → ?{pos: number, inside: number}\n// Given a pair of viewport coordinates, return the document\n// position that corresponds to them. May return null if the given\n// coordinates aren't inside of the editor. When an object is\n// returned, its `pos` property is the position nearest to the\n// coordinates, and its `inside` property holds the position of the\n// inner node that the position falls inside of, or -1 if it is at\n// the top level, not in any node.\nEditorView.prototype.posAtCoords = function posAtCoords$1 (coords) {\n return posAtCoords(this, coords)\n};\n\n// :: (number) → {left: number, right: number, top: number, bottom: number}\n// Returns the viewport rectangle at a given document position. `left`\n// and `right` will be the same number, as this returns a flat\n// cursor-ish rectangle.\nEditorView.prototype.coordsAtPos = function coordsAtPos$1 (pos) {\n return coordsAtPos(this, pos)\n};\n\n// :: (number) → {node: dom.Node, offset: number}\n// Find the DOM position that corresponds to the given document\n// position. Note that you should **not** mutate the editor's\n// internal DOM, only inspect it (and even that is usually not\n// necessary).\nEditorView.prototype.domAtPos = function domAtPos (pos) {\n return this.docView.domFromPos(pos)\n};\n\n// :: (number) → ?dom.Node\n// Find the DOM node that represents the document node after the\n// given position. May return `null` when the position doesn't point\n// in front of a node or if the node is inside an opaque node view.\n//\n// This is intended to be able to call things like\n// `getBoundingClientRect` on that DOM node. Do **not** mutate the\n// editor DOM directly, or add styling this way, since that will be\n// immediately overriden by the editor as it redraws the node.\nEditorView.prototype.nodeDOM = function nodeDOM (pos) {\n var desc = this.docView.descAt(pos);\n return desc ? desc.nodeDOM : null\n};\n\n// :: (dom.Node, number, ?number) → number\n// Find the document position that corresponds to a given DOM\n// position. (Whenever possible, it is preferable to inspect the\n// document structure directly, rather than poking around in the\n// DOM, but sometimes—for example when interpreting an event\n// target—you don't have a choice.)\n//\n// The `bias` parameter can be used to influence which side of a DOM\n// node to use when the position is inside a leaf node.\nEditorView.prototype.posAtDOM = function posAtDOM (node, offset, bias) {\n if ( bias === void 0 ) bias = -1;\n\n var pos = this.docView.posFromDOM(node, offset, bias);\n if (pos == null) { throw new RangeError(\"DOM position not inside the editor\") }\n return pos\n};\n\n// :: (union<\"up\", \"down\", \"left\", \"right\", \"forward\", \"backward\">, ?EditorState) → bool\n// Find out whether the selection is at the end of a textblock when\n// moving in a given direction. When, for example, given `\"left\"`,\n// it will return true if moving left from the current cursor\n// position would leave that position's parent textblock. Will apply\n// to the view's current state by default, but it is possible to\n// pass a different state.\nEditorView.prototype.endOfTextblock = function endOfTextblock$1 (dir, state) {\n return endOfTextblock(this, state || this.state, dir)\n};\n\n// :: ()\n// Removes the editor from the DOM and destroys all [node\n// views](#view.NodeView).\nEditorView.prototype.destroy = function destroy () {\n if (!this.docView) { return }\n destroyInput(this);\n this.destroyPluginViews();\n if (this.mounted) {\n this.docView.update(this.state.doc, [], viewDecorations(this), this);\n this.dom.textContent = \"\";\n } else if (this.dom.parentNode) {\n this.dom.parentNode.removeChild(this.dom);\n }\n this.docView.destroy();\n this.docView = null;\n};\n\n// Used for testing.\nEditorView.prototype.dispatchEvent = function dispatchEvent$1 (event) {\n return dispatchEvent(this, event)\n};\n\n// :: (Transaction)\n// Dispatch a transaction. Will call\n// [`dispatchTransaction`](#view.DirectEditorProps.dispatchTransaction)\n// when given, and otherwise defaults to applying the transaction to\n// the current state and calling\n// [`updateState`](#view.EditorView.updateState) with the result.\n// This method is bound to the view instance, so that it can be\n// easily passed around.\nEditorView.prototype.dispatch = function dispatch (tr) {\n var dispatchTransaction = this._props.dispatchTransaction;\n if (dispatchTransaction) { dispatchTransaction.call(this, tr); }\n else { this.updateState(this.state.apply(tr)); }\n};\n\nObject.defineProperties( EditorView.prototype, prototypeAccessors$2 );\n\nfunction computeDocDeco(view) {\n var attrs = Object.create(null);\n attrs.class = \"ProseMirror\";\n attrs.contenteditable = String(view.editable);\n\n view.someProp(\"attributes\", function (value) {\n if (typeof value == \"function\") { value = value(view.state); }\n if (value) { for (var attr in value) {\n if (attr == \"class\")\n { attrs.class += \" \" + value[attr]; }\n else if (!attrs[attr] && attr != \"contenteditable\" && attr != \"nodeName\")\n { attrs[attr] = String(value[attr]); }\n } }\n });\n\n return [Decoration.node(0, view.state.doc.content.size, attrs)]\n}\n\nfunction updateCursorWrapper(view) {\n if (view.markCursor) {\n var dom = document.createElement(\"img\");\n dom.setAttribute(\"mark-placeholder\", \"true\");\n view.cursorWrapper = {dom: dom, deco: Decoration.widget(view.state.selection.head, dom, {raw: true, marks: view.markCursor})};\n } else {\n view.cursorWrapper = null;\n }\n}\n\nfunction getEditable(view) {\n return !view.someProp(\"editable\", function (value) { return value(view.state) === false; })\n}\n\nfunction selectionContextChanged(sel1, sel2) {\n var depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));\n return sel1.$anchor.start(depth) != sel2.$anchor.start(depth)\n}\n\nfunction buildNodeViews(view) {\n var result = {};\n view.someProp(\"nodeViews\", function (obj) {\n for (var prop in obj) { if (!Object.prototype.hasOwnProperty.call(result, prop))\n { result[prop] = obj[prop]; } }\n });\n return result\n}\n\nfunction changedNodeViews(a, b) {\n var nA = 0, nB = 0;\n for (var prop in a) {\n if (a[prop] != b[prop]) { return true }\n nA++;\n }\n for (var _ in b) { nB++; }\n return nA != nB\n}\n\nfunction selectionContext(root) {\n var ref = root.getSelection();\n var offset = ref.focusOffset;\n var node = ref.focusNode;\n return node && node.nodeType == 1 ? [node, offset, node.childNodes[offset - 1], node.childNodes[offset]] : null\n}\n\nfunction needChromeSelectionReset(context, root) {\n var newContext = selectionContext(root);\n if (!newContext || newContext[0].nodeType == 3) { return false }\n for (var i = 0; i < context.length; i++) { if (newContext[i] != context[i]) { return true } }\n return false\n}\n\n// EditorProps:: interface\n//\n// Props are configuration values that can be passed to an editor view\n// or included in a plugin. This interface lists the supported props.\n//\n// The various event-handling functions may all return `true` to\n// indicate that they handled the given event. The view will then take\n// care to call `preventDefault` on the event, except with\n// `handleDOMEvents`, where the handler itself is responsible for that.\n//\n// How a prop is resolved depends on the prop. Handler functions are\n// called one at a time, starting with the base props and then\n// searching through the plugins (in order of appearance) until one of\n// them returns true. For some props, the first plugin that yields a\n// value gets precedence.\n//\n// handleDOMEvents:: ?Object<(view: EditorView, event: dom.Event) → bool>\n// Can be an object mapping DOM event type names to functions that\n// handle them. Such functions will be called before any handling\n// ProseMirror does of events fired on the editable DOM element.\n// Contrary to the other event handling props, when returning true\n// from such a function, you are responsible for calling\n// `preventDefault` yourself (or not, if you want to allow the\n// default behavior).\n//\n// handleKeyDown:: ?(view: EditorView, event: dom.KeyboardEvent) → bool\n// Called when the editor receives a `keydown` event.\n//\n// handleKeyPress:: ?(view: EditorView, event: dom.KeyboardEvent) → bool\n// Handler for `keypress` events.\n//\n// handleTextInput:: ?(view: EditorView, from: number, to: number, text: string) → bool\n// Whenever the user directly input text, this handler is called\n// before the input is applied. If it returns `true`, the default\n// behavior of actually inserting the text is suppressed.\n//\n// handleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n// Called for each node around a click, from the inside out. The\n// `direct` flag will be true for the inner node.\n//\n// handleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n// Called when the editor is clicked, after `handleClickOn` handlers\n// have been called.\n//\n// handleDoubleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n// Called for each node around a double click.\n//\n// handleDoubleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n// Called when the editor is double-clicked, after `handleDoubleClickOn`.\n//\n// handleTripleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n// Called for each node around a triple click.\n//\n// handleTripleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n// Called when the editor is triple-clicked, after `handleTripleClickOn`.\n//\n// handlePaste:: ?(view: EditorView, event: dom.Event, slice: Slice) → bool\n// Can be used to override the behavior of pasting. `slice` is the\n// pasted content parsed by the editor, but you can directly access\n// the event to get at the raw content.\n//\n// handleDrop:: ?(view: EditorView, event: dom.Event, slice: Slice, moved: bool) → bool\n// Called when something is dropped on the editor. `moved` will be\n// true if this drop moves from the current selection (which should\n// thus be deleted).\n//\n// handleScrollToSelection:: ?(view: EditorView) → bool\n// Called when the view, after updating its state, tries to scroll\n// the selection into view. A handler function may return false to\n// indicate that it did not handle the scrolling and further\n// handlers or the default behavior should be tried.\n//\n// createSelectionBetween:: ?(view: EditorView, anchor: ResolvedPos, head: ResolvedPos) → ?Selection\n// Can be used to override the way a selection is created when\n// reading a DOM selection between the given anchor and head.\n//\n// domParser:: ?DOMParser\n// The [parser](#model.DOMParser) to use when reading editor changes\n// from the DOM. Defaults to calling\n// [`DOMParser.fromSchema`](#model.DOMParser^fromSchema) on the\n// editor's schema.\n//\n// transformPastedHTML:: ?(html: string) → string\n// Can be used to transform pasted HTML text, _before_ it is parsed,\n// for example to clean it up.\n//\n// clipboardParser:: ?DOMParser\n// The [parser](#model.DOMParser) to use when reading content from\n// the clipboard. When not given, the value of the\n// [`domParser`](#view.EditorProps.domParser) prop is used.\n//\n// transformPastedText:: ?(text: string) → string\n// Transform pasted plain text.\n//\n// clipboardTextParser:: ?(text: string, $context: ResolvedPos) → Slice\n// A function to parse text from the clipboard into a document\n// slice. Called after\n// [`transformPastedText`](#view.EditorProps.transformPastedText).\n// The default behavior is to split the text into lines, wrap them\n// in `<p>` tags, and call\n// [`clipboardParser`](#view.EditorProps.clipboardParser) on it.\n//\n// transformPasted:: ?(Slice) → Slice\n// Can be used to transform pasted content before it is applied to\n// the document.\n//\n// nodeViews:: ?Object<(node: Node, view: EditorView, getPos: () → number, decorations: [Decoration]) → NodeView>\n// Allows you to pass custom rendering and behavior logic for nodes\n// and marks. Should map node and mark names to constructor\n// functions that produce a [`NodeView`](#view.NodeView) object\n// implementing the node's display behavior. For nodes, the third\n// argument `getPos` is a function that can be called to get the\n// node's current position, which can be useful when creating\n// transactions to update it. For marks, the third argument is a\n// boolean that indicates whether the mark's content is inline.\n//\n// `decorations` is an array of node or inline decorations that are\n// active around the node. They are automatically drawn in the\n// normal way, and you will usually just want to ignore this, but\n// they can also be used as a way to provide context information to\n// the node view without adding it to the document itself.\n//\n// clipboardSerializer:: ?DOMSerializer\n// The DOM serializer to use when putting content onto the\n// clipboard. If not given, the result of\n// [`DOMSerializer.fromSchema`](#model.DOMSerializer^fromSchema)\n// will be used.\n//\n// clipboardTextSerializer:: ?(Slice) → string\n// A function that will be called to get the text for the current\n// selection when copying text to the clipboard. By default, the\n// editor will use [`textBetween`](#model.Node.textBetween) on the\n// selected range.\n//\n// decorations:: ?(state: EditorState) → ?DecorationSet\n// A set of [document decorations](#view.Decoration) to show in the\n// view.\n//\n// editable:: ?(state: EditorState) → bool\n// When this returns false, the content of the view is not directly\n// editable.\n//\n// attributes:: ?union<Object<string>, (EditorState) → ?Object<string>>\n// Control the DOM attributes of the editable element. May be either\n// an object or a function going from an editor state to an object.\n// By default, the element will get a class `\"ProseMirror\"`, and\n// will have its `contentEditable` attribute determined by the\n// [`editable` prop](#view.EditorProps.editable). Additional classes\n// provided here will be added to the class. For other attributes,\n// the value provided first (as in\n// [`someProp`](#view.EditorView.someProp)) will be used.\n//\n// scrollThreshold:: ?union<number, {top: number, right: number, bottom: number, left: number}>\n// Determines the distance (in pixels) between the cursor and the\n// end of the visible viewport at which point, when scrolling the\n// cursor into view, scrolling takes place. Defaults to 0.\n//\n// scrollMargin:: ?union<number, {top: number, right: number, bottom: number, left: number}>\n// Determines the extra space (in pixels) that is left above or\n// below the cursor when it is scrolled into view. Defaults to 5.\n\n// DirectEditorProps:: interface extends EditorProps\n//\n// The props object given directly to the editor view supports two\n// fields that can't be used in plugins:\n//\n// state:: EditorState\n// The current state of the editor.\n//\n// dispatchTransaction:: ?(tr: Transaction)\n// The callback over which to send transactions (state updates)\n// produced by the view. If you specify this, you probably want to\n// make sure this ends up calling the view's\n// [`updateState`](#view.EditorView.updateState) method with a new\n// state that has the transaction\n// [applied](#state.EditorState.apply). The callback will be bound to have\n// the view instance as its `this` binding.\n\nexport { Decoration, DecorationSet, EditorView, endComposition as __endComposition, parseFromClipboard as __parseFromClipboard, serializeForClipboard as __serializeForClipboard };\n//# sourceMappingURL=index.es.js.map\n","/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n","import { PluginKey, Plugin, TextSelection } from 'prosemirror-state';\n\nvar Rebaseable = function Rebaseable(step, inverted, origin) {\n this.step = step;\n this.inverted = inverted;\n this.origin = origin;\n};\n\n// : ([Rebaseable], [Step], Transform) → [Rebaseable]\n// Undo a given set of steps, apply a set of other steps, and then\n// redo them.\nfunction rebaseSteps(steps, over, transform) {\n for (var i = steps.length - 1; i >= 0; i--) { transform.step(steps[i].inverted); }\n for (var i$1 = 0; i$1 < over.length; i$1++) { transform.step(over[i$1]); }\n var result = [];\n for (var i$2 = 0, mapFrom = steps.length; i$2 < steps.length; i$2++) {\n var mapped = steps[i$2].step.map(transform.mapping.slice(mapFrom));\n mapFrom--;\n if (mapped && !transform.maybeStep(mapped).failed) {\n transform.mapping.setMirror(mapFrom, transform.steps.length - 1);\n result.push(new Rebaseable(mapped, mapped.invert(transform.docs[transform.docs.length - 1]), steps[i$2].origin));\n }\n }\n return result\n}\n\n// This state field accumulates changes that have to be sent to the\n// central authority in the collaborating group and makes it possible\n// to integrate changes made by peers into our local document. It is\n// defined by the plugin, and will be available as the `collab` field\n// in the resulting editor state.\nvar CollabState = function CollabState(version, unconfirmed) {\n // : number\n // The version number of the last update received from the central\n // authority. Starts at 0 or the value of the `version` property\n // in the option object, for the editor's value when the option\n // was enabled.\n this.version = version;\n\n // : [Rebaseable]\n // The local steps that havent been successfully sent to the\n // server yet.\n this.unconfirmed = unconfirmed;\n};\n\nfunction unconfirmedFrom(transform) {\n var result = [];\n for (var i = 0; i < transform.steps.length; i++)\n { result.push(new Rebaseable(transform.steps[i],\n transform.steps[i].invert(transform.docs[i]),\n transform)); }\n return result\n}\n\nvar collabKey = new PluginKey(\"collab\");\n\n// :: (?Object) → Plugin\n//\n// Creates a plugin that enables the collaborative editing framework\n// for the editor.\n//\n// config::- An optional set of options\n//\n// version:: ?number\n// The starting version number of the collaborative editing.\n// Defaults to 0.\n//\n// clientID:: ?union<number, string>\n// This client's ID, used to distinguish its changes from those of\n// other clients. Defaults to a random 32-bit number.\nfunction collab(config) {\n if ( config === void 0 ) config = {};\n\n config = {version: config.version || 0,\n clientID: config.clientID == null ? Math.floor(Math.random() * 0xFFFFFFFF) : config.clientID};\n\n return new Plugin({\n key: collabKey,\n\n state: {\n init: function () { return new CollabState(config.version, []); },\n apply: function apply(tr, collab) {\n var newState = tr.getMeta(collabKey);\n if (newState)\n { return newState }\n if (tr.docChanged)\n { return new CollabState(collab.version, collab.unconfirmed.concat(unconfirmedFrom(tr))) }\n return collab\n }\n },\n\n config: config,\n // This is used to notify the history plugin to not merge steps,\n // so that the history can be rebased.\n historyPreserveItems: true\n })\n}\n\n// :: (state: EditorState, steps: [Step], clientIDs: [union<number, string>], options: ?Object) → Transaction\n// Create a transaction that represents a set of new steps received from\n// the authority. Applying this transaction moves the state forward to\n// adjust to the authority's view of the document.\n//\n// options::- Additional options.\n//\n// mapSelectionBackward:: ?boolean\n// When enabled (the default is `false`), if the current selection\n// is a [text selection](#state.TextSelection), its sides are\n// mapped with a negative bias for this transaction, so that\n// content inserted at the cursor ends up after the cursor. Users\n// usually prefer this, but it isn't done by default for reasons\n// of backwards compatibility.\nfunction receiveTransaction(state, steps, clientIDs, options) {\n // Pushes a set of steps (received from the central authority) into\n // the editor state (which should have the collab plugin enabled).\n // Will recognize its own changes, and confirm unconfirmed steps as\n // appropriate. Remaining unconfirmed steps will be rebased over\n // remote steps.\n var collabState = collabKey.getState(state);\n var version = collabState.version + steps.length;\n var ourID = collabKey.get(state).spec.config.clientID;\n\n // Find out which prefix of the steps originated with us\n var ours = 0;\n while (ours < clientIDs.length && clientIDs[ours] == ourID) { ++ours; }\n var unconfirmed = collabState.unconfirmed.slice(ours);\n steps = ours ? steps.slice(ours) : steps;\n\n // If all steps originated with us, we're done.\n if (!steps.length)\n { return state.tr.setMeta(collabKey, new CollabState(version, unconfirmed)) }\n\n var nUnconfirmed = unconfirmed.length;\n var tr = state.tr;\n if (nUnconfirmed) {\n unconfirmed = rebaseSteps(unconfirmed, steps, tr);\n } else {\n for (var i = 0; i < steps.length; i++) { tr.step(steps[i]); }\n unconfirmed = [];\n }\n\n var newCollabState = new CollabState(version, unconfirmed);\n if (options && options.mapSelectionBackward && state.selection instanceof TextSelection) {\n tr.setSelection(TextSelection.between(tr.doc.resolve(tr.mapping.map(state.selection.anchor, -1)),\n tr.doc.resolve(tr.mapping.map(state.selection.head, -1)), -1));\n tr.updated &= ~1;\n }\n return tr.setMeta(\"rebased\", nUnconfirmed).setMeta(\"addToHistory\", false).setMeta(collabKey, newCollabState)\n}\n\n// :: (state: EditorState) → ?{version: number, steps: [Step], clientID: union<number, string>, origins: [Transaction]}\n// Provides data describing the editor's unconfirmed steps, which need\n// to be sent to the central authority. Returns null when there is\n// nothing to send.\n//\n// `origins` holds the _original_ transactions that produced each\n// steps. This can be useful for looking up time stamps and other\n// metadata for the steps, but note that the steps may have been\n// rebased, whereas the origin transactions are still the old,\n// unchanged objects.\nfunction sendableSteps(state) {\n var collabState = collabKey.getState(state);\n if (collabState.unconfirmed.length == 0) { return null }\n return {\n version: collabState.version,\n steps: collabState.unconfirmed.map(function (s) { return s.step; }),\n clientID: collabKey.get(state).spec.config.clientID,\n get origins() { return this._origins || (this._origins = collabState.unconfirmed.map(function (s) { return s.origin; })) }\n }\n}\n\n// :: (EditorState) → number\n// Get the version up to which the collab plugin has synced with the\n// central authority.\nfunction getVersion(state) {\n return collabKey.getState(state).version\n}\n\nexport { collab, getVersion, rebaseSteps, receiveTransaction, sendableSteps };\n//# sourceMappingURL=index.es.js.map\n","\n /*!\n * tiptap-utils v1.8.4\n * (c) 2020 Scrumpy UG (limited liability)\n * @license MIT\n */\n \nimport { findSelectedNodeOfType, findParentNode } from 'prosemirror-utils';\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction getMarkAttrs(state, type) {\n var _state$selection = state.selection,\n from = _state$selection.from,\n to = _state$selection.to;\n var marks = [];\n state.doc.nodesBetween(from, to, function (node) {\n marks = [].concat(_toConsumableArray(marks), _toConsumableArray(node.marks));\n });\n var mark = marks.find(function (markItem) {\n return markItem.type.name === type.name;\n });\n\n if (mark) {\n return mark.attrs;\n }\n\n return {};\n}\n\nfunction getNodeAttrs(state, type) {\n var _state$selection = state.selection,\n from = _state$selection.from,\n to = _state$selection.to;\n var nodes = [];\n state.doc.nodesBetween(from, to, function (node) {\n nodes = [].concat(_toConsumableArray(nodes), [node]);\n });\n var node = nodes.reverse().find(function (nodeItem) {\n return nodeItem.type.name === type.name;\n });\n\n if (node) {\n return node.attrs;\n }\n\n return {};\n}\n\nfunction getMarkRange() {\n var $pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n if (!$pos || !type) {\n return false;\n }\n\n var start = $pos.parent.childAfter($pos.parentOffset);\n\n if (!start.node) {\n return false;\n }\n\n var link = start.node.marks.find(function (mark) {\n return mark.type === type;\n });\n\n if (!link) {\n return false;\n }\n\n var startIndex = $pos.index();\n var startPos = $pos.start() + start.offset;\n var endIndex = startIndex + 1;\n var endPos = startPos + start.node.nodeSize;\n\n while (startIndex > 0 && link.isInSet($pos.parent.child(startIndex - 1).marks)) {\n startIndex -= 1;\n startPos -= $pos.parent.child(startIndex).nodeSize;\n }\n\n while (endIndex < $pos.parent.childCount && link.isInSet($pos.parent.child(endIndex).marks)) {\n endPos += $pos.parent.child(endIndex).nodeSize;\n endIndex += 1;\n }\n\n return {\n from: startPos,\n to: endPos\n };\n}\n\nfunction markIsActive(state, type) {\n var _state$selection = state.selection,\n from = _state$selection.from,\n $from = _state$selection.$from,\n to = _state$selection.to,\n empty = _state$selection.empty;\n\n if (empty) {\n return !!type.isInSet(state.storedMarks || $from.marks());\n }\n\n return !!state.doc.rangeHasMark(from, to, type);\n}\n\nfunction nodeEqualsType(_ref) {\n var types = _ref.types,\n node = _ref.node;\n return Array.isArray(types) && types.includes(node.type) || node.type === types;\n}\n\nfunction nodeIsActive(state, type) {\n var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var predicate = function predicate(node) {\n return node.type === type;\n };\n\n var node = findSelectedNodeOfType(type)(state.selection) || findParentNode(predicate)(state.selection);\n\n if (!Object.keys(attrs).length || !node) {\n return !!node;\n }\n\n return node.node.hasMarkup(type, attrs);\n}\n\nexport { getMarkAttrs, getMarkRange, getNodeAttrs, markIsActive, nodeEqualsType, nodeIsActive };\n","'use strict';\n\n\nmodule.exports = require('./lib/');\n","module.exports=/[!-#%-\\*,-\\/:;\\?@\\[-\\]_\\{\\}\\xA1\\xA7\\xAB\\xB6\\xB7\\xBB\\xBF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u09FD\\u0A76\\u0AF0\\u0C84\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E4E\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]|\\uD800[\\uDD00-\\uDD02\\uDF9F\\uDFD0]|\\uD801\\uDD6F|\\uD802[\\uDC57\\uDD1F\\uDD3F\\uDE50-\\uDE58\\uDE7F\\uDEF0-\\uDEF6\\uDF39-\\uDF3F\\uDF99-\\uDF9C]|\\uD803[\\uDF55-\\uDF59]|\\uD804[\\uDC47-\\uDC4D\\uDCBB\\uDCBC\\uDCBE-\\uDCC1\\uDD40-\\uDD43\\uDD74\\uDD75\\uDDC5-\\uDDC8\\uDDCD\\uDDDB\\uDDDD-\\uDDDF\\uDE38-\\uDE3D\\uDEA9]|\\uD805[\\uDC4B-\\uDC4F\\uDC5B\\uDC5D\\uDCC6\\uDDC1-\\uDDD7\\uDE41-\\uDE43\\uDE60-\\uDE6C\\uDF3C-\\uDF3E]|\\uD806[\\uDC3B\\uDE3F-\\uDE46\\uDE9A-\\uDE9C\\uDE9E-\\uDEA2]|\\uD807[\\uDC41-\\uDC45\\uDC70\\uDC71\\uDEF7\\uDEF8]|\\uD809[\\uDC70-\\uDC74]|\\uD81A[\\uDE6E\\uDE6F\\uDEF5\\uDF37-\\uDF3B\\uDF44]|\\uD81B[\\uDE97-\\uDE9A]|\\uD82F\\uDC9F|\\uD836[\\uDE87-\\uDE8B]|\\uD83A[\\uDD5E\\uDD5F]/","/**\n * class Ruler\n *\n * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and\n * [[MarkdownIt#inline]] to manage sequences of functions (rules):\n *\n * - keep rules in defined order\n * - assign the name to each rule\n * - enable/disable rules\n * - add/replace rules\n * - allow assign rules to additional named chains (in the same)\n * - cacheing lists of active rules\n *\n * You will not need use this class directly until write plugins. For simple\n * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and\n * [[MarkdownIt.use]].\n **/\n'use strict';\n\n\n/**\n * new Ruler()\n **/\nfunction Ruler() {\n // List of added rules. Each element is:\n //\n // {\n // name: XXX,\n // enabled: Boolean,\n // fn: Function(),\n // alt: [ name2, name3 ]\n // }\n //\n this.__rules__ = [];\n\n // Cached rule chains.\n //\n // First level - chain name, '' for default.\n // Second level - diginal anchor for fast filtering by charcodes.\n //\n this.__cache__ = null;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Helper methods, should not be used directly\n\n\n// Find rule index by name\n//\nRuler.prototype.__find__ = function (name) {\n for (var i = 0; i < this.__rules__.length; i++) {\n if (this.__rules__[i].name === name) {\n return i;\n }\n }\n return -1;\n};\n\n\n// Build rules lookup cache\n//\nRuler.prototype.__compile__ = function () {\n var self = this;\n var chains = [ '' ];\n\n // collect unique names\n self.__rules__.forEach(function (rule) {\n if (!rule.enabled) { return; }\n\n rule.alt.forEach(function (altName) {\n if (chains.indexOf(altName) < 0) {\n chains.push(altName);\n }\n });\n });\n\n self.__cache__ = {};\n\n chains.forEach(function (chain) {\n self.__cache__[chain] = [];\n self.__rules__.forEach(function (rule) {\n if (!rule.enabled) { return; }\n\n if (chain && rule.alt.indexOf(chain) < 0) { return; }\n\n self.__cache__[chain].push(rule.fn);\n });\n });\n};\n\n\n/**\n * Ruler.at(name, fn [, options])\n * - name (String): rule name to replace.\n * - fn (Function): new rule function.\n * - options (Object): new rule options (not mandatory).\n *\n * Replace rule by name with new function & options. Throws error if name not\n * found.\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * Replace existing typographer replacement rule with new one:\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.core.ruler.at('replacements', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.at = function (name, fn, options) {\n var index = this.__find__(name);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + name); }\n\n this.__rules__[index].fn = fn;\n this.__rules__[index].alt = opt.alt || [];\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.before(beforeName, ruleName, fn [, options])\n * - beforeName (String): new rule will be added before this one.\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Add new rule to chain before one with given name. See also\n * [[Ruler.after]], [[Ruler.push]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.before = function (beforeName, ruleName, fn, options) {\n var index = this.__find__(beforeName);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }\n\n this.__rules__.splice(index, 0, {\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.after(afterName, ruleName, fn [, options])\n * - afterName (String): new rule will be added after this one.\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Add new rule to chain after one with given name. See also\n * [[Ruler.before]], [[Ruler.push]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.inline.ruler.after('text', 'my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.after = function (afterName, ruleName, fn, options) {\n var index = this.__find__(afterName);\n var opt = options || {};\n\n if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }\n\n this.__rules__.splice(index + 1, 0, {\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n/**\n * Ruler.push(ruleName, fn [, options])\n * - ruleName (String): name of added rule.\n * - fn (Function): rule function.\n * - options (Object): rule options (not mandatory).\n *\n * Push new rule to the end of chain. See also\n * [[Ruler.before]], [[Ruler.after]].\n *\n * ##### Options:\n *\n * - __alt__ - array with names of \"alternate\" chains.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.core.ruler.push('my_rule', function replace(state) {\n * //...\n * });\n * ```\n **/\nRuler.prototype.push = function (ruleName, fn, options) {\n var opt = options || {};\n\n this.__rules__.push({\n name: ruleName,\n enabled: true,\n fn: fn,\n alt: opt.alt || []\n });\n\n this.__cache__ = null;\n};\n\n\n/**\n * Ruler.enable(list [, ignoreInvalid]) -> Array\n * - list (String|Array): list of rule names to enable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * Returns list of found rule names (if no exception happened).\n *\n * See also [[Ruler.disable]], [[Ruler.enableOnly]].\n **/\nRuler.prototype.enable = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n var result = [];\n\n // Search by name and enable\n list.forEach(function (name) {\n var idx = this.__find__(name);\n\n if (idx < 0) {\n if (ignoreInvalid) { return; }\n throw new Error('Rules manager: invalid rule name ' + name);\n }\n this.__rules__[idx].enabled = true;\n result.push(name);\n }, this);\n\n this.__cache__ = null;\n return result;\n};\n\n\n/**\n * Ruler.enableOnly(list [, ignoreInvalid])\n * - list (String|Array): list of rule names to enable (whitelist).\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable rules with given names, and disable everything else. If any rule name\n * not found - throw Error. Errors can be disabled by second param.\n *\n * See also [[Ruler.disable]], [[Ruler.enable]].\n **/\nRuler.prototype.enableOnly = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n this.__rules__.forEach(function (rule) { rule.enabled = false; });\n\n this.enable(list, ignoreInvalid);\n};\n\n\n/**\n * Ruler.disable(list [, ignoreInvalid]) -> Array\n * - list (String|Array): list of rule names to disable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Disable rules with given names. If any rule name not found - throw Error.\n * Errors can be disabled by second param.\n *\n * Returns list of found rule names (if no exception happened).\n *\n * See also [[Ruler.enable]], [[Ruler.enableOnly]].\n **/\nRuler.prototype.disable = function (list, ignoreInvalid) {\n if (!Array.isArray(list)) { list = [ list ]; }\n\n var result = [];\n\n // Search by name and disable\n list.forEach(function (name) {\n var idx = this.__find__(name);\n\n if (idx < 0) {\n if (ignoreInvalid) { return; }\n throw new Error('Rules manager: invalid rule name ' + name);\n }\n this.__rules__[idx].enabled = false;\n result.push(name);\n }, this);\n\n this.__cache__ = null;\n return result;\n};\n\n\n/**\n * Ruler.getRules(chainName) -> Array\n *\n * Return array of active functions (rules) for given chain name. It analyzes\n * rules configuration, compiles caches if not exists and returns result.\n *\n * Default chain name is `''` (empty string). It can't be skipped. That's\n * done intentionally, to keep signature monomorphic for high speed.\n **/\nRuler.prototype.getRules = function (chainName) {\n if (this.__cache__ === null) {\n this.__compile__();\n }\n\n // Chain can be empty, if rules disabled. But we still have to return Array.\n return this.__cache__[chainName] || [];\n};\n\nmodule.exports = Ruler;\n","// Token class\n\n'use strict';\n\n\n/**\n * class Token\n **/\n\n/**\n * new Token(type, tag, nesting)\n *\n * Create new token and fill passed properties.\n **/\nfunction Token(type, tag, nesting) {\n /**\n * Token#type -> String\n *\n * Type of the token (string, e.g. \"paragraph_open\")\n **/\n this.type = type;\n\n /**\n * Token#tag -> String\n *\n * html tag name, e.g. \"p\"\n **/\n this.tag = tag;\n\n /**\n * Token#attrs -> Array\n *\n * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`\n **/\n this.attrs = null;\n\n /**\n * Token#map -> Array\n *\n * Source map info. Format: `[ line_begin, line_end ]`\n **/\n this.map = null;\n\n /**\n * Token#nesting -> Number\n *\n * Level change (number in {-1, 0, 1} set), where:\n *\n * - `1` means the tag is opening\n * - `0` means the tag is self-closing\n * - `-1` means the tag is closing\n **/\n this.nesting = nesting;\n\n /**\n * Token#level -> Number\n *\n * nesting level, the same as `state.level`\n **/\n this.level = 0;\n\n /**\n * Token#children -> Array\n *\n * An array of child nodes (inline and img tokens)\n **/\n this.children = null;\n\n /**\n * Token#content -> String\n *\n * In a case of self-closing tag (code, html, fence, etc.),\n * it has contents of this tag.\n **/\n this.content = '';\n\n /**\n * Token#markup -> String\n *\n * '*' or '_' for emphasis, fence string for fence, etc.\n **/\n this.markup = '';\n\n /**\n * Token#info -> String\n *\n * fence infostring\n **/\n this.info = '';\n\n /**\n * Token#meta -> Object\n *\n * A place for plugins to store an arbitrary data\n **/\n this.meta = null;\n\n /**\n * Token#block -> Boolean\n *\n * True for block-level tokens, false for inline tokens.\n * Used in renderer to calculate line breaks\n **/\n this.block = false;\n\n /**\n * Token#hidden -> Boolean\n *\n * If it's true, ignore this element when rendering. Used for tight lists\n * to hide paragraphs.\n **/\n this.hidden = false;\n}\n\n\n/**\n * Token.attrIndex(name) -> Number\n *\n * Search attribute index by name.\n **/\nToken.prototype.attrIndex = function attrIndex(name) {\n var attrs, i, len;\n\n if (!this.attrs) { return -1; }\n\n attrs = this.attrs;\n\n for (i = 0, len = attrs.length; i < len; i++) {\n if (attrs[i][0] === name) { return i; }\n }\n return -1;\n};\n\n\n/**\n * Token.attrPush(attrData)\n *\n * Add `[ name, value ]` attribute to list. Init attrs if necessary\n **/\nToken.prototype.attrPush = function attrPush(attrData) {\n if (this.attrs) {\n this.attrs.push(attrData);\n } else {\n this.attrs = [ attrData ];\n }\n};\n\n\n/**\n * Token.attrSet(name, value)\n *\n * Set `name` attribute to `value`. Override old value if exists.\n **/\nToken.prototype.attrSet = function attrSet(name, value) {\n var idx = this.attrIndex(name),\n attrData = [ name, value ];\n\n if (idx < 0) {\n this.attrPush(attrData);\n } else {\n this.attrs[idx] = attrData;\n }\n};\n\n\n/**\n * Token.attrGet(name)\n *\n * Get the value of attribute `name`, or null if it does not exist.\n **/\nToken.prototype.attrGet = function attrGet(name) {\n var idx = this.attrIndex(name), value = null;\n if (idx >= 0) {\n value = this.attrs[idx][1];\n }\n return value;\n};\n\n\n/**\n * Token.attrJoin(name, value)\n *\n * Join value to existing attribute via space. Or create new attribute if not\n * exists. Useful to operate with token classes.\n **/\nToken.prototype.attrJoin = function attrJoin(name, value) {\n var idx = this.attrIndex(name);\n\n if (idx < 0) {\n this.attrPush([ name, value ]);\n } else {\n this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;\n }\n};\n\n\nmodule.exports = Token;\n","export var base = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 10: \"Enter\",\n 12: \"NumLock\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 44: \"PrintScreen\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Meta\",\n 92: \"Meta\",\n 106: \"*\",\n 107: \"+\",\n 108: \",\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 160: \"Shift\",\n 161: \"Shift\",\n 162: \"Control\",\n 163: \"Control\",\n 164: \"Alt\",\n 165: \"Alt\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\",\n 229: \"q\"\n}\n\nexport var shift = {\n 48: \")\",\n 49: \"!\",\n 50: \"@\",\n 51: \"#\",\n 52: \"$\",\n 53: \"%\",\n 54: \"^\",\n 55: \"&\",\n 56: \"*\",\n 57: \"(\",\n 59: \":\",\n 61: \"+\",\n 173: \"_\",\n 186: \":\",\n 187: \"+\",\n 188: \"<\",\n 189: \"_\",\n 190: \">\",\n 191: \"?\",\n 192: \"~\",\n 219: \"{\",\n 220: \"|\",\n 221: \"}\",\n 222: \"\\\"\",\n 229: \"Q\"\n}\n\nvar chrome = typeof navigator != \"undefined\" && /Chrome\\/(\\d+)/.exec(navigator.userAgent)\nvar safari = typeof navigator != \"undefined\" && /Apple Computer/.test(navigator.vendor)\nvar gecko = typeof navigator != \"undefined\" && /Gecko\\/\\d+/.test(navigator.userAgent)\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform)\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent)\nvar brokenModifierNames = chrome && (mac || +chrome[1] < 57) || gecko && mac\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i)\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n base[i] = String.fromCharCode(i + 32)\n shift[i] = String.fromCharCode(i)\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code]\n\nexport function keyName(event) {\n // Don't trust event.key in Chrome when there are modifiers until\n // they fix https://bugs.chromium.org/p/chromium/issues/detail?id=633838\n var ignoreKey = brokenModifierNames && (event.ctrlKey || event.altKey || event.metaKey) ||\n (safari || ie) && event.shiftKey && event.key && event.key.length == 1\n var name = (!ignoreKey && event.key) ||\n (event.shiftKey ? shift : base)[event.keyCode] ||\n event.key || \"Unidentified\"\n // Edge sometimes produces wrong names (Issue #3)\n if (name == \"Esc\") name = \"Escape\"\n if (name == \"Del\") name = \"Delete\"\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n if (name == \"Left\") name = \"ArrowLeft\"\n if (name == \"Up\") name = \"ArrowUp\"\n if (name == \"Right\") name = \"ArrowRight\"\n if (name == \"Down\") name = \"ArrowDown\"\n return name\n}\n","import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\n\n// declare global: navigator\n\nvar mac = typeof navigator != \"undefined\" ? /Mac/.test(navigator.platform) : false;\n\nfunction normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/), result = parts[parts.length - 1];\n if (result == \"Space\") { result = \" \"; }\n var alt, ctrl, shift, meta;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) { meta = true; }\n else if (/^a(lt)?$/i.test(mod)) { alt = true; }\n else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }\n else if (/^s(hift)?$/i.test(mod)) { shift = true; }\n else if (/^mod$/i.test(mod)) { if (mac) { meta = true; } else { ctrl = true; } }\n else { throw new Error(\"Unrecognized modifier name: \" + mod) }\n }\n if (alt) { result = \"Alt-\" + result; }\n if (ctrl) { result = \"Ctrl-\" + result; }\n if (meta) { result = \"Meta-\" + result; }\n if (shift) { result = \"Shift-\" + result; }\n return result\n}\n\nfunction normalize(map) {\n var copy = Object.create(null);\n for (var prop in map) { copy[normalizeKeyName(prop)] = map[prop]; }\n return copy\n}\n\nfunction modifiers(name, event, shift) {\n if (event.altKey) { name = \"Alt-\" + name; }\n if (event.ctrlKey) { name = \"Ctrl-\" + name; }\n if (event.metaKey) { name = \"Meta-\" + name; }\n if (shift !== false && event.shiftKey) { name = \"Shift-\" + name; }\n return name\n}\n\n// :: (Object) → Plugin\n// Create a keymap plugin for the given set of bindings.\n//\n// Bindings should map key names to [command](#commands)-style\n// functions, which will be called with `(EditorState, dispatch,\n// EditorView)` arguments, and should return true when they've handled\n// the key. Note that the view argument isn't part of the command\n// protocol, but can be used as an escape hatch if a binding needs to\n// directly interact with the UI.\n//\n// Key names may be strings like `\"Shift-Ctrl-Enter\"`—a key\n// identifier prefixed with zero or more modifiers. Key identifiers\n// are based on the strings that can appear in\n// [`KeyEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\n// Use lowercase letters to refer to letter keys (or uppercase letters\n// if you want shift to be held). You may use `\"Space\"` as an alias\n// for the `\" \"` name.\n//\n// Modifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n// `a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n// `Meta-`) are recognized. For characters that are created by holding\n// shift, the `Shift-` prefix is implied, and should not be added\n// explicitly.\n//\n// You can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\n// other platforms.\n//\n// You can add multiple keymap plugins to an editor. The order in\n// which they appear determines their precedence (the ones early in\n// the array get to dispatch first).\nfunction keymap(bindings) {\n return new Plugin({props: {handleKeyDown: keydownHandler(bindings)}})\n}\n\n// :: (Object) → (view: EditorView, event: dom.Event) → bool\n// Given a set of bindings (using the same format as\n// [`keymap`](#keymap.keymap), return a [keydown\n// handler](#view.EditorProps.handleKeyDown) that handles them.\nfunction keydownHandler(bindings) {\n var map = normalize(bindings);\n return function(view, event) {\n var name = keyName(event), isChar = name.length == 1 && name != \" \", baseName;\n var direct = map[modifiers(name, event, !isChar)];\n if (direct && direct(view.state, view.dispatch, view)) { return true }\n if (isChar && (event.shiftKey || event.altKey || event.metaKey) &&\n (baseName = base[event.keyCode]) && baseName != name) {\n var fromCode = map[modifiers(baseName, event, true)];\n if (fromCode && fromCode(view.state, view.dispatch, view)) { return true }\n } else if (isChar && event.shiftKey) {\n var withShift = map[modifiers(name, event, true)];\n if (withShift && withShift(view.state, view.dispatch, view)) { return true }\n }\n return false\n }\n}\n\nexport { keydownHandler, keymap };\n//# sourceMappingURL=index.es.js.map\n","import { PluginKey, TextSelection, Selection, SelectionRange, NodeSelection, Plugin } from 'prosemirror-state';\nimport { Fragment, Slice } from 'prosemirror-model';\nimport { keydownHandler } from 'prosemirror-keymap';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { Transform } from 'prosemirror-transform';\n\n// Because working with row and column-spanning cells is not quite\n// trivial, this code builds up a descriptive structure for a given\n// table node. The structures are cached with the (persistent) table\n// nodes as key, so that they only have to be recomputed when the\n// content of the table changes.\n//\n// This does mean that they have to store table-relative, not\n// document-relative positions. So code that uses them will typically\n// compute the start position of the table and offset positions passed\n// to or gotten from this structure by that amount.\n\nvar readFromCache, addToCache;\n// Prefer using a weak map to cache table maps. Fall back on a\n// fixed-size cache if that's not supported.\nif (typeof WeakMap != \"undefined\") {\n var cache = new WeakMap;\n readFromCache = function (key) { return cache.get(key); };\n addToCache = function (key, value) {\n cache.set(key, value);\n return value\n };\n} else {\n var cache$1 = [], cacheSize = 10, cachePos = 0;\n readFromCache = function (key) {\n for (var i = 0; i < cache$1.length; i += 2)\n { if (cache$1[i] == key) { return cache$1[i + 1] } }\n };\n addToCache = function (key, value) {\n if (cachePos == cacheSize) { cachePos = 0; }\n cache$1[cachePos++] = key;\n return cache$1[cachePos++] = value\n };\n}\n\nvar Rect = function Rect(left, top, right, bottom) {\n this.left = left; this.top = top; this.right = right; this.bottom = bottom;\n};\n\n// ::- A table map describes the structore of a given table. To avoid\n// recomputing them all the time, they are cached per table node. To\n// be able to do that, positions saved in the map are relative to the\n// start of the table, rather than the start of the document.\nvar TableMap = function TableMap(width, height, map, problems) {\n // :: number The width of the table\n this.width = width;\n // :: number The table's height\n this.height = height;\n // :: [number] A width * height array with the start position of\n // the cell covering that part of the table in each slot\n this.map = map;\n // An optional array of problems (cell overlap or non-rectangular\n // shape) for the table, used by the table normalizer.\n this.problems = problems;\n};\n\n// :: (number) → Rect\n// Find the dimensions of the cell at the given position.\nTableMap.prototype.findCell = function findCell (pos) {\n for (var i = 0; i < this.map.length; i++) {\n var curPos = this.map[i];\n if (curPos != pos) { continue }\n var left = i % this.width, top = (i / this.width) | 0;\n var right = left + 1, bottom = top + 1;\n for (var j = 1; right < this.width && this.map[i + j] == curPos; j++) { right++; }\n for (var j$1 = 1; bottom < this.height && this.map[i + (this.width * j$1)] == curPos; j$1++) { bottom++; }\n return new Rect(left, top, right, bottom)\n }\n throw new RangeError(\"No cell with offset \" + pos + \" found\")\n};\n\n// :: (number) → number\n// Find the left side of the cell at the given position.\nTableMap.prototype.colCount = function colCount (pos) {\n for (var i = 0; i < this.map.length; i++)\n { if (this.map[i] == pos) { return i % this.width } }\n throw new RangeError(\"No cell with offset \" + pos + \" found\")\n};\n\n// :: (number, string, number) → ?number\n// Find the next cell in the given direction, starting from the cell\n// at `pos`, if any.\nTableMap.prototype.nextCell = function nextCell (pos, axis, dir) {\n var ref = this.findCell(pos);\n var left = ref.left;\n var right = ref.right;\n var top = ref.top;\n var bottom = ref.bottom;\n if (axis == \"horiz\") {\n if (dir < 0 ? left == 0 : right == this.width) { return null }\n return this.map[top * this.width + (dir < 0 ? left - 1 : right)]\n } else {\n if (dir < 0 ? top == 0 : bottom == this.height) { return null }\n return this.map[left + this.width * (dir < 0 ? top - 1 : bottom)]\n }\n};\n\n// :: (number, number) → Rect\n// Get the rectangle spanning the two given cells.\nTableMap.prototype.rectBetween = function rectBetween (a, b) {\n var ref = this.findCell(a);\n var leftA = ref.left;\n var rightA = ref.right;\n var topA = ref.top;\n var bottomA = ref.bottom;\n var ref$1 = this.findCell(b);\n var leftB = ref$1.left;\n var rightB = ref$1.right;\n var topB = ref$1.top;\n var bottomB = ref$1.bottom;\n return new Rect(Math.min(leftA, leftB), Math.min(topA, topB),\n Math.max(rightA, rightB), Math.max(bottomA, bottomB))\n};\n\n// :: (Rect) → [number]\n// Return the position of all cells that have the top left corner in\n// the given rectangle.\nTableMap.prototype.cellsInRect = function cellsInRect (rect) {\n var result = [], seen = {};\n for (var row = rect.top; row < rect.bottom; row++) {\n for (var col = rect.left; col < rect.right; col++) {\n var index = row * this.width + col, pos = this.map[index];\n if (seen[pos]) { continue }\n seen[pos] = true;\n if ((col != rect.left || !col || this.map[index - 1] != pos) &&\n (row != rect.top || !row || this.map[index - this.width] != pos))\n { result.push(pos); }\n }\n }\n return result\n};\n\n// :: (number, number, Node) → number\n// Return the position at which the cell at the given row and column\n// starts, or would start, if a cell started there.\nTableMap.prototype.positionAt = function positionAt (row, col, table) {\n for (var i = 0, rowStart = 0;; i++) {\n var rowEnd = rowStart + table.child(i).nodeSize;\n if (i == row) {\n var index = col + row * this.width, rowEndIndex = (row + 1) * this.width;\n // Skip past cells from previous rows (via rowspan)\n while (index < rowEndIndex && this.map[index] < rowStart) { index++; }\n return index == rowEndIndex ? rowEnd - 1 : this.map[index]\n }\n rowStart = rowEnd;\n }\n};\n\n// :: (Node) → TableMap\n// Find the table map for the given table node.\nTableMap.get = function get (table) {\n return readFromCache(table) || addToCache(table, computeMap(table))\n};\n\n// Compute a table map.\nfunction computeMap(table) {\n if (table.type.spec.tableRole != \"table\") { throw new RangeError(\"Not a table node: \" + table.type.name) }\n var width = findWidth(table), height = table.childCount;\n var map = [], mapPos = 0, problems = null, colWidths = [];\n for (var i = 0, e = width * height; i < e; i++) { map[i] = 0; }\n\n for (var row = 0, pos = 0; row < height; row++) {\n var rowNode = table.child(row);\n pos++;\n for (var i$1 = 0;; i$1++) {\n while (mapPos < map.length && map[mapPos] != 0) { mapPos++; }\n if (i$1 == rowNode.childCount) { break }\n var cellNode = rowNode.child(i$1);\n var ref = cellNode.attrs;\n var colspan = ref.colspan;\n var rowspan = ref.rowspan;\n var colwidth = ref.colwidth;\n for (var h = 0; h < rowspan; h++) {\n if (h + row >= height) {\n (problems || (problems = [])).push({type: \"overlong_rowspan\", pos: pos, n: rowspan - h});\n break\n }\n var start = mapPos + (h * width);\n for (var w = 0; w < colspan; w++) {\n if (map[start + w] == 0)\n { map[start + w] = pos; }\n else\n { (problems || (problems = [])).push({type: \"collision\", row: row, pos: pos, n: colspan - w}); }\n var colW = colwidth && colwidth[w];\n if (colW) {\n var widthIndex = ((start + w) % width) * 2, prev = colWidths[widthIndex];\n if (prev == null || (prev != colW && colWidths[widthIndex + 1] == 1)) {\n colWidths[widthIndex] = colW;\n colWidths[widthIndex + 1] = 1;\n } else if (prev == colW) {\n colWidths[widthIndex + 1]++;\n }\n }\n }\n }\n mapPos += colspan;\n pos += cellNode.nodeSize;\n }\n var expectedPos = (row + 1) * width, missing = 0;\n while (mapPos < expectedPos) { if (map[mapPos++] == 0) { missing++; } }\n if (missing) { (problems || (problems = [])).push({type: \"missing\", row: row, n: missing}); }\n pos++;\n }\n\n var tableMap = new TableMap(width, height, map, problems), badWidths = false;\n\n // For columns that have defined widths, but whose widths disagree\n // between rows, fix up the cells whose width doesn't match the\n // computed one.\n for (var i$2 = 0; !badWidths && i$2 < colWidths.length; i$2 += 2)\n { if (colWidths[i$2] != null && colWidths[i$2 + 1] < height) { badWidths = true; } }\n if (badWidths) { findBadColWidths(tableMap, colWidths, table); }\n\n return tableMap\n}\n\nfunction findWidth(table) {\n var width = -1, hasRowSpan = false;\n for (var row = 0; row < table.childCount; row++) {\n var rowNode = table.child(row), rowWidth = 0;\n if (hasRowSpan) { for (var j = 0; j < row; j++) {\n var prevRow = table.child(j);\n for (var i = 0; i < prevRow.childCount; i++) {\n var cell = prevRow.child(i);\n if (j + cell.attrs.rowspan > row) { rowWidth += cell.attrs.colspan; }\n }\n } }\n for (var i$1 = 0; i$1 < rowNode.childCount; i$1++) {\n var cell$1 = rowNode.child(i$1);\n rowWidth += cell$1.attrs.colspan;\n if (cell$1.attrs.rowspan > 1) { hasRowSpan = true; }\n }\n if (width == -1)\n { width = rowWidth; }\n else if (width != rowWidth)\n { width = Math.max(width, rowWidth); }\n }\n return width\n}\n\nfunction findBadColWidths(map, colWidths, table) {\n if (!map.problems) { map.problems = []; }\n for (var i = 0, seen = {}; i < map.map.length; i++) {\n var pos = map.map[i];\n if (seen[pos]) { continue }\n seen[pos] = true;\n var node = table.nodeAt(pos), updated = null;\n for (var j = 0; j < node.attrs.colspan; j++) {\n var col = (i + j) % map.width, colWidth = colWidths[col * 2];\n if (colWidth != null && (!node.attrs.colwidth || node.attrs.colwidth[j] != colWidth))\n { (updated || (updated = freshColWidth(node.attrs)))[j] = colWidth; }\n }\n if (updated) { map.problems.unshift({type: \"colwidth mismatch\", pos: pos, colwidth: updated}); }\n }\n}\n\nfunction freshColWidth(attrs) {\n if (attrs.colwidth) { return attrs.colwidth.slice() }\n var result = [];\n for (var i = 0; i < attrs.colspan; i++) { result.push(0); }\n return result\n}\n\n// Various helper function for working with tables\n\nvar key = new PluginKey(\"selectingCells\");\n\nfunction cellAround($pos) {\n for (var d = $pos.depth - 1; d > 0; d--)\n { if ($pos.node(d).type.spec.tableRole == \"row\") { return $pos.node(0).resolve($pos.before(d + 1)) } }\n return null\n}\n\nfunction cellWrapping($pos) {\n for (var d = $pos.depth; d > 0; d--) { // Sometimes the cell can be in the same depth.\n var role = $pos.node(d).type.spec.tableRole;\n if (role === \"cell\" || role === 'header_cell') { return $pos.node(d) }\n }\n return null\n}\n\nfunction isInTable(state) {\n var $head = state.selection.$head;\n for (var d = $head.depth; d > 0; d--) { if ($head.node(d).type.spec.tableRole == \"row\") { return true } }\n return false\n}\n\nfunction selectionCell(state) {\n var sel = state.selection;\n if (sel.$anchorCell) {\n return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;\n } else if (sel.node && sel.node.type.spec.tableRole == \"cell\") {\n return sel.$anchor\n }\n return cellAround(sel.$head) || cellNear(sel.$head)\n}\n\nfunction cellNear($pos) {\n for (var after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {\n var role = after.type.spec.tableRole;\n if (role == \"cell\" || role == \"header_cell\") { return $pos.doc.resolve(pos) }\n }\n for (var before = $pos.nodeBefore, pos$1 = $pos.pos; before; before = before.lastChild, pos$1--) {\n var role$1 = before.type.spec.tableRole;\n if (role$1 == \"cell\" || role$1 == \"header_cell\") { return $pos.doc.resolve(pos$1 - before.nodeSize) }\n }\n}\n\nfunction pointsAtCell($pos) {\n return $pos.parent.type.spec.tableRole == \"row\" && $pos.nodeAfter\n}\n\nfunction moveCellForward($pos) {\n return $pos.node(0).resolve($pos.pos + $pos.nodeAfter.nodeSize)\n}\n\nfunction inSameTable($a, $b) {\n return $a.depth == $b.depth && $a.pos >= $b.start(-1) && $a.pos <= $b.end(-1)\n}\n\nfunction findCell($pos) {\n return TableMap.get($pos.node(-1)).findCell($pos.pos - $pos.start(-1))\n}\n\nfunction colCount($pos) {\n return TableMap.get($pos.node(-1)).colCount($pos.pos - $pos.start(-1))\n}\n\nfunction nextCell($pos, axis, dir) {\n var start = $pos.start(-1), map = TableMap.get($pos.node(-1));\n var moved = map.nextCell($pos.pos - start, axis, dir);\n return moved == null ? null : $pos.node(0).resolve(start + moved)\n}\n\nfunction setAttr(attrs, name, value) {\n var result = {};\n for (var prop in attrs) { result[prop] = attrs[prop]; }\n result[name] = value;\n return result\n}\n\nfunction rmColSpan(attrs, pos, n) {\n if ( n === void 0 ) n=1;\n\n var result = setAttr(attrs, \"colspan\", attrs.colspan - n);\n if (result.colwidth) {\n result.colwidth = result.colwidth.slice();\n result.colwidth.splice(pos, n);\n if (!result.colwidth.some(function (w) { return w > 0; })) { result.colwidth = null; }\n }\n return result\n}\n\nfunction addColSpan(attrs, pos, n) {\n if ( n === void 0 ) n=1;\n\n var result = setAttr(attrs, \"colspan\", attrs.colspan + n);\n if (result.colwidth) {\n result.colwidth = result.colwidth.slice();\n for (var i = 0; i < n; i++) { result.colwidth.splice(pos, 0, 0); }\n }\n return result\n}\n\n// This file defines a ProseMirror selection subclass that models\n\n// ::- A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)\n// subclass that represents a cell selection spanning part of a table.\n// With the plugin enabled, these will be created when the user\n// selects across cells, and will be drawn by giving selected cells a\n// `selectedCell` CSS class.\nvar CellSelection = /*@__PURE__*/(function (Selection) {\n function CellSelection($anchorCell, $headCell) {\n if ( $headCell === void 0 ) $headCell = $anchorCell;\n\n var table = $anchorCell.node(-1), map = TableMap.get(table), start = $anchorCell.start(-1);\n var rect = map.rectBetween($anchorCell.pos - start, $headCell.pos - start);\n var doc = $anchorCell.node(0);\n var cells = map.cellsInRect(rect).filter(function (p) { return p != $headCell.pos - start; });\n // Make the head cell the first range, so that it counts as the\n // primary part of the selection\n cells.unshift($headCell.pos - start);\n var ranges = cells.map(function (pos) {\n var cell = table.nodeAt(pos), from = pos + start + 1;\n return new SelectionRange(doc.resolve(from), doc.resolve(from + cell.content.size))\n });\n Selection.call(this, ranges[0].$from, ranges[0].$to, ranges);\n // :: ResolvedPos\n // A resolved position pointing _in front of_ the anchor cell (the one\n // that doesn't move when extending the selection).\n this.$anchorCell = $anchorCell;\n // :: ResolvedPos\n // A resolved position pointing in front of the head cell (the one\n // moves when extending the selection).\n this.$headCell = $headCell;\n }\n\n if ( Selection ) CellSelection.__proto__ = Selection;\n CellSelection.prototype = Object.create( Selection && Selection.prototype );\n CellSelection.prototype.constructor = CellSelection;\n\n CellSelection.prototype.map = function map (doc, mapping) {\n var $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos));\n var $headCell = doc.resolve(mapping.map(this.$headCell.pos));\n if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {\n var tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);\n if (tableChanged && this.isRowSelection())\n { return CellSelection.rowSelection($anchorCell, $headCell) }\n else if (tableChanged && this.isColSelection())\n { return CellSelection.colSelection($anchorCell, $headCell) }\n else\n { return new CellSelection($anchorCell, $headCell) }\n }\n return TextSelection.between($anchorCell, $headCell)\n };\n\n // :: () → Slice\n // Returns a rectangular slice of table rows containing the selected\n // cells.\n CellSelection.prototype.content = function content () {\n var table = this.$anchorCell.node(-1), map = TableMap.get(table), start = this.$anchorCell.start(-1);\n var rect = map.rectBetween(this.$anchorCell.pos - start, this.$headCell.pos - start);\n var seen = {}, rows = [];\n for (var row = rect.top; row < rect.bottom; row++) {\n var rowContent = [];\n for (var index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {\n var pos = map.map[index];\n if (!seen[pos]) {\n seen[pos] = true;\n var cellRect = map.findCell(pos), cell = table.nodeAt(pos);\n var extraLeft = rect.left - cellRect.left, extraRight = cellRect.right - rect.right;\n if (extraLeft > 0 || extraRight > 0) {\n var attrs = cell.attrs;\n if (extraLeft > 0) { attrs = rmColSpan(attrs, 0, extraLeft); }\n if (extraRight > 0) { attrs = rmColSpan(attrs, attrs.colspan - extraRight, extraRight); }\n if (cellRect.left < rect.left) { cell = cell.type.createAndFill(attrs); }\n else { cell = cell.type.create(attrs, cell.content); }\n }\n if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {\n var attrs$1 = setAttr(cell.attrs, \"rowspan\", Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top));\n if (cellRect.top < rect.top) { cell = cell.type.createAndFill(attrs$1); }\n else { cell = cell.type.create(attrs$1, cell.content); }\n }\n rowContent.push(cell);\n }\n }\n rows.push(table.child(row).copy(Fragment.from(rowContent)));\n }\n\n var fragment = this.isColSelection() && this.isRowSelection() ? table : rows;\n return new Slice(Fragment.from(fragment), 1, 1)\n };\n\n CellSelection.prototype.replace = function replace (tr, content) {\n if ( content === void 0 ) content = Slice.empty;\n\n var mapFrom = tr.steps.length, ranges = this.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var ref = ranges[i];\n var $from = ref.$from;\n var $to = ref.$to;\n var mapping = tr.mapping.slice(mapFrom);\n tr.replace(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n }\n var sel = Selection.findFrom(tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)), -1);\n if (sel) { tr.setSelection(sel); }\n };\n\n CellSelection.prototype.replaceWith = function replaceWith (tr, node) {\n this.replace(tr, new Slice(Fragment.from(node), 0, 0));\n };\n\n CellSelection.prototype.forEachCell = function forEachCell (f) {\n var table = this.$anchorCell.node(-1), map = TableMap.get(table), start = this.$anchorCell.start(-1);\n var cells = map.cellsInRect(map.rectBetween(this.$anchorCell.pos - start, this.$headCell.pos - start));\n for (var i = 0; i < cells.length; i++)\n { f(table.nodeAt(cells[i]), start + cells[i]); }\n };\n\n // :: () → bool\n // True if this selection goes all the way from the top to the\n // bottom of the table.\n CellSelection.prototype.isColSelection = function isColSelection () {\n var anchorTop = this.$anchorCell.index(-1), headTop = this.$headCell.index(-1);\n if (Math.min(anchorTop, headTop) > 0) { return false }\n var anchorBot = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan,\n headBot = headTop + this.$headCell.nodeAfter.attrs.rowspan;\n return Math.max(anchorBot, headBot) == this.$headCell.node(-1).childCount\n };\n\n // :: (ResolvedPos, ?ResolvedPos) → CellSelection\n // Returns the smallest column selection that covers the given anchor\n // and head cell.\n CellSelection.colSelection = function colSelection ($anchorCell, $headCell) {\n if ( $headCell === void 0 ) $headCell = $anchorCell;\n\n var map = TableMap.get($anchorCell.node(-1)), start = $anchorCell.start(-1);\n var anchorRect = map.findCell($anchorCell.pos - start), headRect = map.findCell($headCell.pos - start);\n var doc = $anchorCell.node(0);\n if (anchorRect.top <= headRect.top) {\n if (anchorRect.top > 0)\n { $anchorCell = doc.resolve(start + map.map[anchorRect.left]); }\n if (headRect.bottom < map.height)\n { $headCell = doc.resolve(start + map.map[map.width * (map.height - 1) + headRect.right - 1]); }\n } else {\n if (headRect.top > 0)\n { $headCell = doc.resolve(start + map.map[headRect.left]); }\n if (anchorRect.bottom < map.height)\n { $anchorCell = doc.resolve(start + map.map[map.width * (map.height - 1) + anchorRect.right - 1]); }\n }\n return new CellSelection($anchorCell, $headCell)\n };\n\n // :: () → bool\n // True if this selection goes all the way from the left to the\n // right of the table.\n CellSelection.prototype.isRowSelection = function isRowSelection () {\n var map = TableMap.get(this.$anchorCell.node(-1)), start = this.$anchorCell.start(-1);\n var anchorLeft = map.colCount(this.$anchorCell.pos - start),\n headLeft = map.colCount(this.$headCell.pos - start);\n if (Math.min(anchorLeft, headLeft) > 0) { return false }\n var anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan,\n headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;\n return Math.max(anchorRight, headRight) == map.width\n };\n\n CellSelection.prototype.eq = function eq (other) {\n return other instanceof CellSelection && other.$anchorCell.pos == this.$anchorCell.pos &&\n other.$headCell.pos == this.$headCell.pos\n };\n\n // :: (ResolvedPos, ?ResolvedPos) → CellSelection\n // Returns the smallest row selection that covers the given anchor\n // and head cell.\n CellSelection.rowSelection = function rowSelection ($anchorCell, $headCell) {\n if ( $headCell === void 0 ) $headCell = $anchorCell;\n\n var map = TableMap.get($anchorCell.node(-1)), start = $anchorCell.start(-1);\n var anchorRect = map.findCell($anchorCell.pos - start), headRect = map.findCell($headCell.pos - start);\n var doc = $anchorCell.node(0);\n if (anchorRect.left <= headRect.left) {\n if (anchorRect.left > 0)\n { $anchorCell = doc.resolve(start + map.map[anchorRect.top * map.width]); }\n if (headRect.right < map.width)\n { $headCell = doc.resolve(start + map.map[map.width * (headRect.top + 1) - 1]); }\n } else {\n if (headRect.left > 0)\n { $headCell = doc.resolve(start + map.map[headRect.top * map.width]); }\n if (anchorRect.right < map.width)\n { $anchorCell = doc.resolve(start + map.map[map.width * (anchorRect.top + 1) - 1]); }\n }\n return new CellSelection($anchorCell, $headCell)\n };\n\n CellSelection.prototype.toJSON = function toJSON () {\n return {type: \"cell\", anchor: this.$anchorCell.pos, head: this.$headCell.pos}\n };\n\n CellSelection.fromJSON = function fromJSON (doc, json) {\n return new CellSelection(doc.resolve(json.anchor), doc.resolve(json.head))\n };\n\n // :: (Node, number, ?number) → CellSelection\n CellSelection.create = function create (doc, anchorCell, headCell) {\n if ( headCell === void 0 ) headCell = anchorCell;\n\n return new CellSelection(doc.resolve(anchorCell), doc.resolve(headCell))\n };\n\n CellSelection.prototype.getBookmark = function getBookmark () { return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos) };\n\n return CellSelection;\n}(Selection));\n\nCellSelection.prototype.visible = false;\n\nSelection.jsonID(\"cell\", CellSelection);\n\nvar CellBookmark = function CellBookmark(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n};\nCellBookmark.prototype.map = function map (mapping) {\n return new CellBookmark(mapping.map(this.anchor), mapping.map(this.head))\n};\nCellBookmark.prototype.resolve = function resolve (doc) {\n var $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);\n if ($anchorCell.parent.type.spec.tableRole == \"row\" &&\n $headCell.parent.type.spec.tableRole == \"row\" &&\n $anchorCell.index() < $anchorCell.parent.childCount &&\n $headCell.index() < $headCell.parent.childCount &&\n inSameTable($anchorCell, $headCell))\n { return new CellSelection($anchorCell, $headCell) }\n else\n { return Selection.near($headCell, 1) }\n};\n\nfunction drawCellSelection(state) {\n if (!(state.selection instanceof CellSelection)) { return null }\n var cells = [];\n state.selection.forEachCell(function (node, pos) {\n cells.push(Decoration.node(pos, pos + node.nodeSize, {class: \"selectedCell\"}));\n });\n return DecorationSet.create(state.doc, cells)\n}\n\nfunction isCellBoundarySelection(ref) {\n var $from = ref.$from;\n var $to = ref.$to;\n\n if ($from.pos == $to.pos || $from.pos < $from.pos - 6) { return false } // Cheap elimination\n var afterFrom = $from.pos, beforeTo = $to.pos, depth = $from.depth;\n for (; depth >= 0; depth--, afterFrom++)\n { if ($from.after(depth + 1) < $from.end(depth)) { break } }\n for (var d = $to.depth; d >= 0; d--, beforeTo--)\n { if ($to.before(d + 1) > $to.start(d)) { break } }\n return afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole)\n}\n\nfunction isTextSelectionAcrossCells(ref) {\n var $from = ref.$from;\n var $to = ref.$to;\n\n var fromCellBoundaryNode;\n var toCellBoundaryNode;\n\n for (var i = $from.depth; i > 0; i--) {\n var node = $from.node(i);\n if (node.type.spec.tableRole === 'cell' || node.type.spec.tableRole === 'header_cell') {\n fromCellBoundaryNode = node;\n break;\n }\n }\n\n for (var i$1 = $to.depth; i$1 > 0; i$1--) {\n var node$1 = $to.node(i$1);\n if (node$1.type.spec.tableRole === 'cell' || node$1.type.spec.tableRole === 'header_cell') {\n toCellBoundaryNode = node$1;\n break;\n }\n }\n\n return fromCellBoundaryNode !== toCellBoundaryNode && $to.parentOffset === 0\n}\n\nfunction normalizeSelection(state, tr, allowTableNodeSelection) {\n var sel = (tr || state).selection, doc = (tr || state).doc, normalize, role;\n if (sel instanceof NodeSelection && (role = sel.node.type.spec.tableRole)) {\n if (role == \"cell\" || role == \"header_cell\") {\n normalize = CellSelection.create(doc, sel.from);\n } else if (role == \"row\") {\n var $cell = doc.resolve(sel.from + 1);\n normalize = CellSelection.rowSelection($cell, $cell);\n } else if (!allowTableNodeSelection) {\n var map = TableMap.get(sel.node), start = sel.from + 1;\n var lastCell = start + map.map[map.width * map.height - 1];\n normalize = CellSelection.create(doc, start + 1, lastCell);\n }\n } else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) {\n normalize = TextSelection.create(doc, sel.from);\n } else if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) {\n normalize = TextSelection.create(doc, sel.$from.start(), sel.$from.end());\n }\n if (normalize)\n { (tr || (tr = state.tr)).setSelection(normalize); }\n return tr\n}\n\n// Helper for creating a schema that supports tables.\n\nfunction getCellAttrs(dom, extraAttrs) {\n var widthAttr = dom.getAttribute(\"data-colwidth\");\n var widths = widthAttr && /^\\d+(,\\d+)*$/.test(widthAttr) ? widthAttr.split(\",\").map(function (s) { return Number(s); }) : null;\n var colspan = Number(dom.getAttribute(\"colspan\") || 1);\n var result = {\n colspan: colspan,\n rowspan: Number(dom.getAttribute(\"rowspan\") || 1),\n colwidth: widths && widths.length == colspan ? widths : null\n };\n for (var prop in extraAttrs) {\n var getter = extraAttrs[prop].getFromDOM;\n var value = getter && getter(dom);\n if (value != null) { result[prop] = value; }\n }\n return result\n}\n\nfunction setCellAttrs(node, extraAttrs) {\n var attrs = {};\n if (node.attrs.colspan != 1) { attrs.colspan = node.attrs.colspan; }\n if (node.attrs.rowspan != 1) { attrs.rowspan = node.attrs.rowspan; }\n if (node.attrs.colwidth)\n { attrs[\"data-colwidth\"] = node.attrs.colwidth.join(\",\"); }\n for (var prop in extraAttrs) {\n var setter = extraAttrs[prop].setDOMAttr;\n if (setter) { setter(node.attrs[prop], attrs); }\n }\n return attrs\n}\n\n// :: (Object) → Object\n//\n// This function creates a set of [node\n// specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for\n// `table`, `table_row`, and `table_cell` nodes types as used by this\n// module. The result can then be added to the set of nodes when\n// creating a a schema.\n//\n// options::- The following options are understood:\n//\n// tableGroup:: ?string\n// A group name (something like `\"block\"`) to add to the table\n// node type.\n//\n// cellContent:: string\n// The content expression for table cells.\n//\n// cellAttributes:: ?Object\n// Additional attributes to add to cells. Maps attribute names to\n// objects with the following properties:\n//\n// default:: any\n// The attribute's default value.\n//\n// getFromDOM:: ?(dom.Node) → any\n// A function to read the attribute's value from a DOM node.\n//\n// setDOMAttr:: ?(value: any, attrs: Object)\n// A function to add the attribute's value to an attribute\n// object that's used to render the cell's DOM.\nfunction tableNodes(options) {\n var extraAttrs = options.cellAttributes || {};\n var cellAttrs = {\n colspan: {default: 1},\n rowspan: {default: 1},\n colwidth: {default: null}\n };\n for (var prop in extraAttrs)\n { cellAttrs[prop] = {default: extraAttrs[prop].default}; }\n\n return {\n table: {\n content: \"table_row+\",\n tableRole: \"table\",\n isolating: true,\n group: options.tableGroup,\n parseDOM: [{tag: \"table\"}],\n toDOM: function toDOM() { return [\"table\", [\"tbody\", 0]] }\n },\n table_row: {\n content: \"(table_cell | table_header)*\",\n tableRole: \"row\",\n parseDOM: [{tag: \"tr\"}],\n toDOM: function toDOM() { return [\"tr\", 0] }\n },\n table_cell: {\n content: options.cellContent,\n attrs: cellAttrs,\n tableRole: \"cell\",\n isolating: true,\n parseDOM: [{tag: \"td\", getAttrs: function (dom) { return getCellAttrs(dom, extraAttrs); }}],\n toDOM: function toDOM(node) { return [\"td\", setCellAttrs(node, extraAttrs), 0] }\n },\n table_header: {\n content: options.cellContent,\n attrs: cellAttrs,\n tableRole: \"header_cell\",\n isolating: true,\n parseDOM: [{tag: \"th\", getAttrs: function (dom) { return getCellAttrs(dom, extraAttrs); }}],\n toDOM: function toDOM(node) { return [\"th\", setCellAttrs(node, extraAttrs), 0] }\n }\n }\n}\n\nfunction tableNodeTypes(schema) {\n var result = schema.cached.tableNodeTypes;\n if (!result) {\n result = schema.cached.tableNodeTypes = {};\n for (var name in schema.nodes) {\n var type = schema.nodes[name], role = type.spec.tableRole;\n if (role) { result[role] = type; }\n }\n }\n return result\n}\n\n// Utilities used for copy/paste handling.\n\n// Utilities to help with copying and pasting table cells\n\n// : (Slice) → ?{width: number, height: number, rows: [Fragment]}\n// Get a rectangular area of cells from a slice, or null if the outer\n// nodes of the slice aren't table cells or rows.\nfunction pastedCells(slice) {\n if (!slice.size) { return null }\n var content = slice.content;\n var openStart = slice.openStart;\n var openEnd = slice.openEnd;\n while (content.childCount == 1 && (openStart > 0 && openEnd > 0 || content.firstChild.type.spec.tableRole == \"table\")) {\n openStart--;\n openEnd--;\n content = content.firstChild.content;\n }\n var first = content.firstChild, role = first.type.spec.tableRole;\n var schema = first.type.schema, rows = [];\n if (role == \"row\") {\n for (var i = 0; i < content.childCount; i++) {\n var cells = content.child(i).content;\n var left = i ? 0 : Math.max(0, openStart - 1);\n var right = i < content.childCount - 1 ? 0 : Math.max(0, openEnd - 1);\n if (left || right) { cells = fitSlice(tableNodeTypes(schema).row, new Slice(cells, left, right)).content; }\n rows.push(cells);\n }\n } else if (role == \"cell\" || role == \"header_cell\") {\n rows.push(openStart || openEnd ? fitSlice(tableNodeTypes(schema).row, new Slice(content, openStart, openEnd)).content : content);\n } else {\n return null\n }\n return ensureRectangular(schema, rows)\n}\n\n// : (Schema, [Fragment]) → {width: number, height: number, rows: [Fragment]}\n// Compute the width and height of a set of cells, and make sure each\n// row has the same number of cells.\nfunction ensureRectangular(schema, rows) {\n var widths = [];\n for (var i = 0; i < rows.length; i++) {\n var row = rows[i];\n for (var j = row.childCount - 1; j >= 0; j--) {\n var ref = row.child(j).attrs;\n var rowspan = ref.rowspan;\n var colspan = ref.colspan;\n for (var r = i; r < i + rowspan; r++)\n { widths[r] = (widths[r] || 0) + colspan; }\n }\n }\n var width = 0;\n for (var r$1 = 0; r$1 < widths.length; r$1++) { width = Math.max(width, widths[r$1]); }\n for (var r$2 = 0; r$2 < widths.length; r$2++) {\n if (r$2 >= rows.length) { rows.push(Fragment.empty); }\n if (widths[r$2] < width) {\n var empty = tableNodeTypes(schema).cell.createAndFill(), cells = [];\n for (var i$1 = widths[r$2]; i$1 < width; i$1++) { cells.push(empty); }\n rows[r$2] = rows[r$2].append(Fragment.from(cells));\n }\n }\n return {height: rows.length, width: width, rows: rows}\n}\n\nfunction fitSlice(nodeType, slice) {\n var node = nodeType.createAndFill();\n var tr = new Transform(node).replace(0, node.content.size, slice);\n return tr.doc\n}\n\n// : ({width: number, height: number, rows: [Fragment]}, number, number) → {width: number, height: number, rows: [Fragment]}\n// Clip or extend (repeat) the given set of cells to cover the given\n// width and height. Will clip rowspan/colspan cells at the edges when\n// they stick out.\nfunction clipCells(ref, newWidth, newHeight) {\n var width = ref.width;\n var height = ref.height;\n var rows = ref.rows;\n\n if (width != newWidth) {\n var added = [], newRows = [];\n for (var row = 0; row < rows.length; row++) {\n var frag = rows[row], cells = [];\n for (var col = added[row] || 0, i = 0; col < newWidth; i++) {\n var cell = frag.child(i % frag.childCount);\n if (col + cell.attrs.colspan > newWidth)\n { cell = cell.type.create(rmColSpan(cell.attrs, cell.attrs.colspan, col + cell.attrs.colspan - newWidth), cell.content); }\n cells.push(cell);\n col += cell.attrs.colspan;\n for (var j = 1; j < cell.attrs.rowspan; j++)\n { added[row + j] = (added[row + j] || 0) + cell.attrs.colspan; }\n }\n newRows.push(Fragment.from(cells));\n }\n rows = newRows;\n width = newWidth;\n }\n\n if (height != newHeight) {\n var newRows$1 = [];\n for (var row$1 = 0, i$1 = 0; row$1 < newHeight; row$1++, i$1++) {\n var cells$1 = [], source = rows[i$1 % height];\n for (var j$1 = 0; j$1 < source.childCount; j$1++) {\n var cell$1 = source.child(j$1);\n if (row$1 + cell$1.attrs.rowspan > newHeight)\n { cell$1 = cell$1.type.create(setAttr(cell$1.attrs, \"rowspan\", newHeight - cell$1.attrs.rowspan), cell$1.content); }\n cells$1.push(cell$1);\n }\n newRows$1.push(Fragment.from(cells$1));\n }\n rows = newRows$1;\n height = newHeight;\n }\n\n return {width: width, height: height, rows: rows}\n}\n\n// Make sure a table has at least the given width and height. Return\n// true if something was changed.\nfunction growTable(tr, map, table, start, width, height, mapFrom) {\n var schema = tr.doc.type.schema, types = tableNodeTypes(schema), empty, emptyHead;\n if (width > map.width) {\n for (var row = 0, rowEnd = 0; row < map.height; row++) {\n var rowNode = table.child(row);\n rowEnd += rowNode.nodeSize;\n var cells = [], add = (void 0);\n if (rowNode.lastChild == null || rowNode.lastChild.type == types.cell)\n { add = empty || (empty = types.cell.createAndFill()); }\n else\n { add = emptyHead || (emptyHead = types.header_cell.createAndFill()); }\n for (var i = map.width; i < width; i++) { cells.push(add); }\n tr.insert(tr.mapping.slice(mapFrom).map(rowEnd - 1 + start), cells);\n }\n }\n if (height > map.height) {\n var cells$1 = [];\n for (var i$1 = 0, start$1 = (map.height - 1) * map.width; i$1 < Math.max(map.width, width); i$1++) {\n var header = i$1 >= map.width ? false :\n table.nodeAt(map.map[start$1 + i$1]).type == types.header_cell;\n cells$1.push(header\n ? (emptyHead || (emptyHead = types.header_cell.createAndFill()))\n : (empty || (empty = types.cell.createAndFill())));\n }\n\n var emptyRow = types.row.create(null, Fragment.from(cells$1)), rows = [];\n for (var i$2 = map.height; i$2 < height; i$2++) { rows.push(emptyRow); }\n tr.insert(tr.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows);\n }\n return !!(empty || emptyHead)\n}\n\n// Make sure the given line (left, top) to (right, top) doesn't cross\n// any rowspan cells by splitting cells that cross it. Return true if\n// something changed.\nfunction isolateHorizontal(tr, map, table, start, left, right, top, mapFrom) {\n if (top == 0 || top == map.height) { return false }\n var found = false;\n for (var col = left; col < right; col++) {\n var index = top * map.width + col, pos = map.map[index];\n if (map.map[index - map.width] == pos) {\n found = true;\n var cell = table.nodeAt(pos);\n var ref = map.findCell(pos);\n var cellTop = ref.top;\n var cellLeft = ref.left;\n tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, setAttr(cell.attrs, \"rowspan\", top - cellTop));\n tr.insert(tr.mapping.slice(mapFrom).map(map.positionAt(top, cellLeft, table)),\n cell.type.createAndFill(setAttr(cell.attrs, \"rowspan\", (cellTop + cell.attrs.rowspan) - top)));\n col += cell.attrs.colspan - 1;\n }\n }\n return found\n}\n\n// Make sure the given line (left, top) to (left, bottom) doesn't\n// cross any colspan cells by splitting cells that cross it. Return\n// true if something changed.\nfunction isolateVertical(tr, map, table, start, top, bottom, left, mapFrom) {\n if (left == 0 || left == map.width) { return false }\n var found = false;\n for (var row = top; row < bottom; row++) {\n var index = row * map.width + left, pos = map.map[index];\n if (map.map[index - 1] == pos) {\n found = true;\n var cell = table.nodeAt(pos), cellLeft = map.colCount(pos);\n var updatePos = tr.mapping.slice(mapFrom).map(pos + start);\n tr.setNodeMarkup(updatePos, null, rmColSpan(cell.attrs, left - cellLeft, cell.attrs.colspan - (left - cellLeft)));\n tr.insert(updatePos + cell.nodeSize, cell.type.createAndFill(rmColSpan(cell.attrs, 0, left - cellLeft)));\n row += cell.attrs.rowspan - 1;\n }\n }\n return found\n}\n\n// Insert the given set of cells (as returned by `pastedCells`) into a\n// table, at the position pointed at by rect.\nfunction insertCells(state, dispatch, tableStart, rect, cells) {\n var table = tableStart ? state.doc.nodeAt(tableStart - 1) : state.doc, map = TableMap.get(table);\n var top = rect.top;\n var left = rect.left;\n var right = left + cells.width, bottom = top + cells.height;\n var tr = state.tr, mapFrom = 0;\n function recomp() {\n table = tableStart ? tr.doc.nodeAt(tableStart - 1) : tr.doc;\n map = TableMap.get(table);\n mapFrom = tr.mapping.maps.length;\n }\n // Prepare the table to be large enough and not have any cells\n // crossing the boundaries of the rectangle that we want to\n // insert into. If anything about it changes, recompute the table\n // map so that subsequent operations can see the current shape.\n if (growTable(tr, map, table, tableStart, right, bottom, mapFrom)) { recomp(); }\n if (isolateHorizontal(tr, map, table, tableStart, left, right, top, mapFrom)) { recomp(); }\n if (isolateHorizontal(tr, map, table, tableStart, left, right, bottom, mapFrom)) { recomp(); }\n if (isolateVertical(tr, map, table, tableStart, top, bottom, left, mapFrom)) { recomp(); }\n if (isolateVertical(tr, map, table, tableStart, top, bottom, right, mapFrom)) { recomp(); }\n\n for (var row = top; row < bottom; row++) {\n var from = map.positionAt(row, left, table), to = map.positionAt(row, right, table);\n tr.replace(tr.mapping.slice(mapFrom).map(from + tableStart), tr.mapping.slice(mapFrom).map(to + tableStart),\n new Slice(cells.rows[row - top], 0, 0));\n }\n recomp();\n tr.setSelection(new CellSelection(tr.doc.resolve(tableStart + map.positionAt(top, left, table)),\n tr.doc.resolve(tableStart + map.positionAt(bottom - 1, right - 1, table))));\n dispatch(tr);\n}\n\n// This file defines a number of helpers for wiring up user input to\n\nvar handleKeyDown = keydownHandler({\n \"ArrowLeft\": arrow(\"horiz\", -1),\n \"ArrowRight\": arrow(\"horiz\", 1),\n \"ArrowUp\": arrow(\"vert\", -1),\n \"ArrowDown\": arrow(\"vert\", 1),\n\n \"Shift-ArrowLeft\": shiftArrow(\"horiz\", -1),\n \"Shift-ArrowRight\": shiftArrow(\"horiz\", 1),\n \"Shift-ArrowUp\": shiftArrow(\"vert\", -1),\n \"Shift-ArrowDown\": shiftArrow(\"vert\", 1),\n\n \"Backspace\": deleteCellSelection,\n \"Mod-Backspace\": deleteCellSelection,\n \"Delete\": deleteCellSelection,\n \"Mod-Delete\": deleteCellSelection\n});\n\nfunction maybeSetSelection(state, dispatch, selection) {\n if (selection.eq(state.selection)) { return false }\n if (dispatch) { dispatch(state.tr.setSelection(selection).scrollIntoView()); }\n return true\n}\n\nfunction arrow(axis, dir) {\n return function (state, dispatch, view) {\n var sel = state.selection;\n if (sel instanceof CellSelection) {\n return maybeSetSelection(state, dispatch, Selection.near(sel.$headCell, dir))\n }\n if (axis != \"horiz\" && !sel.empty) { return false }\n var end = atEndOfCell(view, axis, dir);\n if (end == null) { return false }\n if (axis == \"horiz\") {\n return maybeSetSelection(state, dispatch, Selection.near(state.doc.resolve(sel.head + dir), dir))\n } else {\n var $cell = state.doc.resolve(end), $next = nextCell($cell, axis, dir), newSel;\n if ($next) { newSel = Selection.near($next, 1); }\n else if (dir < 0) { newSel = Selection.near(state.doc.resolve($cell.before(-1)), -1); }\n else { newSel = Selection.near(state.doc.resolve($cell.after(-1)), 1); }\n return maybeSetSelection(state, dispatch, newSel)\n }\n }\n}\n\nfunction shiftArrow(axis, dir) {\n return function (state, dispatch, view) {\n var sel = state.selection;\n if (!(sel instanceof CellSelection)) {\n var end = atEndOfCell(view, axis, dir);\n if (end == null) { return false }\n sel = new CellSelection(state.doc.resolve(end));\n }\n var $head = nextCell(sel.$headCell, axis, dir);\n if (!$head) { return false }\n return maybeSetSelection(state, dispatch, new CellSelection(sel.$anchorCell, $head))\n }\n}\n\nfunction deleteCellSelection(state, dispatch) {\n var sel = state.selection;\n if (!(sel instanceof CellSelection)) { return false }\n if (dispatch) {\n var tr = state.tr, baseContent = tableNodeTypes(state.schema).cell.createAndFill().content;\n sel.forEachCell(function (cell, pos) {\n if (!cell.content.eq(baseContent))\n { tr.replace(tr.mapping.map(pos + 1), tr.mapping.map(pos + cell.nodeSize - 1),\n new Slice(baseContent, 0, 0)); }\n });\n if (tr.docChanged) { dispatch(tr); }\n }\n return true\n}\n\nfunction handleTripleClick(view, pos) {\n var doc = view.state.doc, $cell = cellAround(doc.resolve(pos));\n if (!$cell) { return false }\n view.dispatch(view.state.tr.setSelection(new CellSelection($cell)));\n return true\n}\n\nfunction handlePaste(view, _, slice) {\n if (!isInTable(view.state)) { return false }\n var cells = pastedCells(slice), sel = view.state.selection;\n if (sel instanceof CellSelection) {\n if (!cells) { cells = {width: 1, height: 1, rows: [Fragment.from(fitSlice(tableNodeTypes(view.state.schema).cell, slice))]}; }\n var table = sel.$anchorCell.node(-1), start = sel.$anchorCell.start(-1);\n var rect = TableMap.get(table).rectBetween(sel.$anchorCell.pos - start, sel.$headCell.pos - start);\n cells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);\n insertCells(view.state, view.dispatch, start, rect, cells);\n return true\n } else if (cells) {\n var $cell = selectionCell(view.state), start$1 = $cell.start(-1);\n insertCells(view.state, view.dispatch, start$1, TableMap.get($cell.node(-1)).findCell($cell.pos - start$1), cells);\n return true\n } else {\n return false\n }\n}\n\nfunction handleMouseDown(view, startEvent) {\n if (startEvent.ctrlKey || startEvent.metaKey) { return }\n\n var startDOMCell = domInCell(view, startEvent.target), $anchor;\n if (startEvent.shiftKey && (view.state.selection instanceof CellSelection)) {\n // Adding to an existing cell selection\n setCellSelection(view.state.selection.$anchorCell, startEvent);\n startEvent.preventDefault();\n } else if (startEvent.shiftKey && startDOMCell &&\n ($anchor = cellAround(view.state.selection.$anchor)) != null &&\n cellUnderMouse(view, startEvent).pos != $anchor.pos) {\n // Adding to a selection that starts in another cell (causing a\n // cell selection to be created).\n setCellSelection($anchor, startEvent);\n startEvent.preventDefault();\n } else if (!startDOMCell) {\n // Not in a cell, let the default behavior happen.\n return\n }\n\n // Create and dispatch a cell selection between the given anchor and\n // the position under the mouse.\n function setCellSelection($anchor, event) {\n var $head = cellUnderMouse(view, event);\n var starting = key.getState(view.state) == null;\n if (!$head || !inSameTable($anchor, $head)) {\n if (starting) { $head = $anchor; }\n else { return }\n }\n var selection = new CellSelection($anchor, $head);\n if (starting || !view.state.selection.eq(selection)) {\n var tr = view.state.tr.setSelection(selection);\n if (starting) { tr.setMeta(key, $anchor.pos); }\n view.dispatch(tr);\n }\n }\n\n // Stop listening to mouse motion events.\n function stop() {\n view.root.removeEventListener(\"mouseup\", stop);\n view.root.removeEventListener(\"dragstart\", stop);\n view.root.removeEventListener(\"mousemove\", move);\n if (key.getState(view.state) != null) { view.dispatch(view.state.tr.setMeta(key, -1)); }\n }\n\n function move(event) {\n var anchor = key.getState(view.state), $anchor;\n if (anchor != null) {\n // Continuing an existing cross-cell selection\n $anchor = view.state.doc.resolve(anchor);\n } else if (domInCell(view, event.target) != startDOMCell) {\n // Moving out of the initial cell -- start a new cell selection\n $anchor = cellUnderMouse(view, startEvent);\n if (!$anchor) { return stop() }\n }\n if ($anchor) { setCellSelection($anchor, event); }\n }\n view.root.addEventListener(\"mouseup\", stop);\n view.root.addEventListener(\"dragstart\", stop);\n view.root.addEventListener(\"mousemove\", move);\n}\n\n// Check whether the cursor is at the end of a cell (so that further\n// motion would move out of the cell)\nfunction atEndOfCell(view, axis, dir) {\n if (!(view.state.selection instanceof TextSelection)) { return null }\n var ref = view.state.selection;\n var $head = ref.$head;\n for (var d = $head.depth - 1; d >= 0; d--) {\n var parent = $head.node(d), index = dir < 0 ? $head.index(d) : $head.indexAfter(d);\n if (index != (dir < 0 ? 0 : parent.childCount)) { return null }\n if (parent.type.spec.tableRole == \"cell\" || parent.type.spec.tableRole == \"header_cell\") {\n var cellPos = $head.before(d);\n var dirStr = axis == \"vert\" ? (dir > 0 ? \"down\" : \"up\") : (dir > 0 ? \"right\" : \"left\");\n return view.endOfTextblock(dirStr) ? cellPos : null\n }\n }\n return null\n}\n\nfunction domInCell(view, dom) {\n for (; dom && dom != view.dom; dom = dom.parentNode)\n { if (dom.nodeName == \"TD\" || dom.nodeName == \"TH\") { return dom } }\n}\n\nfunction cellUnderMouse(view, event) {\n var mousePos = view.posAtCoords({left: event.clientX, top: event.clientY});\n if (!mousePos) { return null }\n return mousePos ? cellAround(view.state.doc.resolve(mousePos.pos)) : null\n}\n\n// This file defines helpers for normalizing tables, making sure no\n\nvar fixTablesKey = new PluginKey(\"fix-tables\");\n\n// Helper for iterating through the nodes in a document that changed\n// compared to the given previous document. Useful for avoiding\n// duplicate work on each transaction.\nfunction changedDescendants(old, cur, offset, f) {\n var oldSize = old.childCount, curSize = cur.childCount;\n outer: for (var i = 0, j = 0; i < curSize; i++) {\n var child = cur.child(i);\n for (var scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {\n if (old.child(scan) == child) {\n j = scan + 1;\n offset += child.nodeSize;\n continue outer\n }\n }\n f(child, offset);\n if (j < oldSize && old.child(j).sameMarkup(child))\n { changedDescendants(old.child(j), child, offset + 1, f); }\n else\n { child.nodesBetween(0, child.content.size, f, offset + 1); }\n offset += child.nodeSize;\n }\n}\n\n// :: (EditorState, ?EditorState) → ?Transaction\n// Inspect all tables in the given state's document and return a\n// transaction that fixes them, if necessary. If `oldState` was\n// provided, that is assumed to hold a previous, known-good state,\n// which will be used to avoid re-scanning unchanged parts of the\n// document.\nfunction fixTables(state, oldState) {\n var tr, check = function (node, pos) {\n if (node.type.spec.tableRole == \"table\") { tr = fixTable(state, node, pos, tr); }\n };\n if (!oldState) { state.doc.descendants(check); }\n else if (oldState.doc != state.doc) { changedDescendants(oldState.doc, state.doc, 0, check); }\n return tr\n}\n\n// : (EditorState, Node, number, ?Transaction) → ?Transaction\n// Fix the given table, if necessary. Will append to the transaction\n// it was given, if non-null, or create a new one if necessary.\nfunction fixTable(state, table, tablePos, tr) {\n var map = TableMap.get(table);\n if (!map.problems) { return tr }\n if (!tr) { tr = state.tr; }\n\n // Track which rows we must add cells to, so that we can adjust that\n // when fixing collisions.\n var mustAdd = [];\n for (var i = 0; i < map.height; i++) { mustAdd.push(0); }\n for (var i$1 = 0; i$1 < map.problems.length; i$1++) {\n var prob = map.problems[i$1];\n if (prob.type == \"collision\") {\n var cell = table.nodeAt(prob.pos);\n for (var j = 0; j < cell.attrs.rowspan; j++) { mustAdd[prob.row + j] += prob.n; }\n tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, rmColSpan(cell.attrs, cell.attrs.colspan - prob.n, prob.n));\n } else if (prob.type == \"missing\") {\n mustAdd[prob.row] += prob.n;\n } else if (prob.type == \"overlong_rowspan\") {\n var cell$1 = table.nodeAt(prob.pos);\n tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, setAttr(cell$1.attrs, \"rowspan\", cell$1.attrs.rowspan - prob.n));\n } else if (prob.type == \"colwidth mismatch\") {\n var cell$2 = table.nodeAt(prob.pos);\n tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, setAttr(cell$2.attrs, \"colwidth\", prob.colwidth));\n }\n }\n var first, last;\n for (var i$2 = 0; i$2 < mustAdd.length; i$2++) { if (mustAdd[i$2]) {\n if (first == null) { first = i$2; }\n last = i$2;\n } }\n // Add the necessary cells, using a heuristic for whether to add the\n // cells at the start or end of the rows (if it looks like a 'bite'\n // was taken out of the table, add cells at the start of the row\n // after the bite. Otherwise add them at the end).\n for (var i$3 = 0, pos = tablePos + 1; i$3 < map.height; i$3++) {\n var row = table.child(i$3);\n var end = pos + row.nodeSize;\n var add = mustAdd[i$3];\n if (add > 0) {\n var tableNodeType = 'cell';\n if (row.firstChild) {\n tableNodeType = row.firstChild.type.spec.tableRole;\n }\n var nodes = [];\n for (var j$1 = 0; j$1 < add; j$1++)\n { nodes.push(tableNodeTypes(state.schema)[tableNodeType].createAndFill()); }\n var side = (i$3 == 0 || first == i$3 - 1) && last == i$3 ? pos + 1 : end - 1;\n tr.insert(tr.mapping.map(side), nodes);\n }\n pos = end;\n }\n return tr.setMeta(fixTablesKey, { fixTables: true })\n}\n\n// This file defines a number of table-related commands.\n\n// Helper to get the selected rectangle in a table, if any. Adds table\n// map, table node, and table start offset to the object for\n// convenience.\nfunction selectedRect(state) {\n var sel = state.selection, $pos = selectionCell(state);\n var table = $pos.node(-1), tableStart = $pos.start(-1), map = TableMap.get(table);\n var rect;\n if (sel instanceof CellSelection)\n { rect = map.rectBetween(sel.$anchorCell.pos - tableStart, sel.$headCell.pos - tableStart); }\n else\n { rect = map.findCell($pos.pos - tableStart); }\n rect.tableStart = tableStart;\n rect.map = map;\n rect.table = table;\n return rect\n}\n\nfunction columnIsHeader(map, table, col) {\n var headerCell = tableNodeTypes(table.type.schema).header_cell;\n for (var row = 0; row < map.height; row++)\n { if (table.nodeAt(map.map[col + row * map.width]).type != headerCell)\n { return false } }\n return true\n}\n\n// Add a column at the given position in a table.\nfunction addColumn(tr, ref, col) {\n var map = ref.map;\n var tableStart = ref.tableStart;\n var table = ref.table;\n\n var refColumn = col > 0 ? -1 : 0;\n if (columnIsHeader(map, table, col + refColumn))\n { refColumn = col == 0 || col == map.width ? null : 0; }\n\n for (var row = 0; row < map.height; row++) {\n var index = row * map.width + col;\n // If this position falls inside a col-spanning cell\n if (col > 0 && col < map.width && map.map[index - 1] == map.map[index]) {\n var pos = map.map[index], cell = table.nodeAt(pos);\n tr.setNodeMarkup(tr.mapping.map(tableStart + pos), null,\n addColSpan(cell.attrs, col - map.colCount(pos)));\n // Skip ahead if rowspan > 1\n row += cell.attrs.rowspan - 1;\n } else {\n var type = refColumn == null ? tableNodeTypes(table.type.schema).cell\n : table.nodeAt(map.map[index + refColumn]).type;\n var pos$1 = map.positionAt(row, col, table);\n tr.insert(tr.mapping.map(tableStart + pos$1), type.createAndFill());\n }\n }\n return tr\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Command to add a column before the column with the selection.\nfunction addColumnBefore(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state);\n dispatch(addColumn(state.tr, rect, rect.left));\n }\n return true\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Command to add a column after the column with the selection.\nfunction addColumnAfter(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state);\n dispatch(addColumn(state.tr, rect, rect.right));\n }\n return true\n}\n\nfunction removeColumn(tr, ref, col) {\n var map = ref.map;\n var table = ref.table;\n var tableStart = ref.tableStart;\n\n var mapStart = tr.mapping.maps.length;\n for (var row = 0; row < map.height;) {\n var index = row * map.width + col, pos = map.map[index], cell = table.nodeAt(pos);\n // If this is part of a col-spanning cell\n if ((col > 0 && map.map[index - 1] == pos) || (col < map.width - 1 && map.map[index + 1] == pos)) {\n tr.setNodeMarkup(tr.mapping.slice(mapStart).map(tableStart + pos), null,\n rmColSpan(cell.attrs, col - map.colCount(pos)));\n } else {\n var start = tr.mapping.slice(mapStart).map(tableStart + pos);\n tr.delete(start, start + cell.nodeSize);\n }\n row += cell.attrs.rowspan;\n }\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Command function that removes the selected columns from a table.\nfunction deleteColumn(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state), tr = state.tr;\n if (rect.left == 0 && rect.right == rect.map.width) { return false }\n for (var i = rect.right - 1;; i--) {\n removeColumn(tr, rect, i);\n if (i == rect.left) { break }\n rect.table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n rect.map = TableMap.get(rect.table);\n }\n dispatch(tr);\n }\n return true\n}\n\nfunction rowIsHeader(map, table, row) {\n var headerCell = tableNodeTypes(table.type.schema).header_cell;\n for (var col = 0; col < map.width; col++)\n { if (table.nodeAt(map.map[col + row * map.width]).type != headerCell)\n { return false } }\n return true\n}\n\nfunction addRow(tr, ref, row) {\n var map = ref.map;\n var tableStart = ref.tableStart;\n var table = ref.table;\n\n var rowPos = tableStart;\n for (var i = 0; i < row; i++) { rowPos += table.child(i).nodeSize; }\n var cells = [], refRow = row > 0 ? -1 : 0;\n if (rowIsHeader(map, table, row + refRow))\n { refRow = row == 0 || row == map.height ? null : 0; }\n for (var col = 0, index = map.width * row; col < map.width; col++, index++) {\n // Covered by a rowspan cell\n if (row > 0 && row < map.height && map.map[index] == map.map[index - map.width]) {\n var pos = map.map[index], attrs = table.nodeAt(pos).attrs;\n tr.setNodeMarkup(tableStart + pos, null, setAttr(attrs, \"rowspan\", attrs.rowspan + 1));\n col += attrs.colspan - 1;\n } else {\n var type = refRow == null ? tableNodeTypes(table.type.schema).cell\n : table.nodeAt(map.map[index + refRow * map.width]).type;\n cells.push(type.createAndFill());\n }\n }\n tr.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));\n return tr\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Add a table row before the selection.\nfunction addRowBefore(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state);\n dispatch(addRow(state.tr, rect, rect.top));\n }\n return true\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Add a table row after the selection.\nfunction addRowAfter(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state);\n dispatch(addRow(state.tr, rect, rect.bottom));\n }\n return true\n}\n\nfunction removeRow(tr, ref, row) {\n var map = ref.map;\n var table = ref.table;\n var tableStart = ref.tableStart;\n\n var rowPos = 0;\n for (var i = 0; i < row; i++) { rowPos += table.child(i).nodeSize; }\n var nextRow = rowPos + table.child(row).nodeSize;\n\n var mapFrom = tr.mapping.maps.length;\n tr.delete(rowPos + tableStart, nextRow + tableStart);\n\n for (var col = 0, index = row * map.width; col < map.width; col++, index++) {\n var pos = map.map[index];\n if (row > 0 && pos == map.map[index - map.width]) {\n // If this cell starts in the row above, simply reduce its rowspan\n var attrs = table.nodeAt(pos).attrs;\n tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, setAttr(attrs, \"rowspan\", attrs.rowspan - 1));\n col += attrs.colspan - 1;\n } else if (row < map.width && pos == map.map[index + map.width]) {\n // Else, if it continues in the row below, it has to be moved down\n var cell = table.nodeAt(pos);\n var copy = cell.type.create(setAttr(cell.attrs, \"rowspan\", cell.attrs.rowspan - 1), cell.content);\n var newPos = map.positionAt(row + 1, col, table);\n tr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);\n col += cell.attrs.colspan - 1;\n }\n }\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Remove the selected rows from a table.\nfunction deleteRow(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var rect = selectedRect(state), tr = state.tr;\n if (rect.top == 0 && rect.bottom == rect.map.height) { return false }\n for (var i = rect.bottom - 1;; i--) {\n removeRow(tr, rect, i);\n if (i == rect.top) { break }\n rect.table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n rect.map = TableMap.get(rect.table);\n }\n dispatch(tr);\n }\n return true\n}\n\nfunction isEmpty(cell) {\n var c = cell.content;\n return c.childCount == 1 && c.firstChild.isTextblock && c.firstChild.childCount == 0\n}\n\nfunction cellsOverlapRectangle(ref, rect) {\n var width = ref.width;\n var height = ref.height;\n var map = ref.map;\n\n var indexTop = rect.top * width + rect.left, indexLeft = indexTop;\n var indexBottom = (rect.bottom - 1) * width + rect.left, indexRight = indexTop + (rect.right - rect.left - 1);\n for (var i = rect.top; i < rect.bottom; i++) {\n if (rect.left > 0 && map[indexLeft] == map[indexLeft - 1] ||\n rect.right < width && map[indexRight] == map[indexRight + 1]) { return true }\n indexLeft += width; indexRight += width;\n }\n for (var i$1 = rect.left; i$1 < rect.right; i$1++) {\n if (rect.top > 0 && map[indexTop] == map[indexTop - width] ||\n rect.bottom < height && map[indexBottom] == map[indexBottom + width]) { return true }\n indexTop++; indexBottom++;\n }\n return false\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Merge the selected cells into a single cell. Only available when\n// the selected cells' outline forms a rectangle.\nfunction mergeCells(state, dispatch) {\n var sel = state.selection;\n if (!(sel instanceof CellSelection) || sel.$anchorCell.pos == sel.$headCell.pos) { return false }\n var rect = selectedRect(state);\n var map = rect.map;\n if (cellsOverlapRectangle(map, rect)) { return false }\n if (dispatch) {\n var tr = state.tr, seen = {}, content = Fragment.empty, mergedPos, mergedCell;\n for (var row = rect.top; row < rect.bottom; row++) {\n for (var col = rect.left; col < rect.right; col++) {\n var cellPos = map.map[row * map.width + col], cell = rect.table.nodeAt(cellPos);\n if (seen[cellPos]) { continue }\n seen[cellPos] = true;\n if (mergedPos == null) {\n mergedPos = cellPos;\n mergedCell = cell;\n } else {\n if (!isEmpty(cell)) { content = content.append(cell.content); }\n var mapped = tr.mapping.map(cellPos + rect.tableStart);\n tr.delete(mapped, mapped + cell.nodeSize);\n }\n }\n }\n tr.setNodeMarkup(mergedPos + rect.tableStart, null,\n setAttr(addColSpan(mergedCell.attrs, mergedCell.attrs.colspan, (rect.right - rect.left) - mergedCell.attrs.colspan),\n \"rowspan\", rect.bottom - rect.top));\n if (content.size) {\n var end = mergedPos + 1 + mergedCell.content.size;\n var start = isEmpty(mergedCell) ? mergedPos + 1 : end;\n tr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);\n }\n tr.setSelection(new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart)));\n dispatch(tr);\n }\n return true\n}\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Split a selected cell, whose rowpan or colspan is greater than one,\n// into smaller cells. Use the first cell type for the new cells.\nfunction splitCell(state, dispatch) {\n var nodeTypes = tableNodeTypes(state.schema);\n return splitCellWithType(function (ref) {\n var node = ref.node;\n\n return nodeTypes[node.type.spec.tableRole]\n })(state, dispatch)\n}\n\n// :: (getCellType: ({ row: number, col: number, node: Node}) → NodeType) → (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Split a selected cell, whose rowpan or colspan is greater than one,\n// into smaller cells with the cell type (th, td) returned by getType function.\nfunction splitCellWithType(getCellType) {\n return function (state, dispatch) {\n var sel = state.selection;\n var cellNode, cellPos;\n if (!(sel instanceof CellSelection)) {\n cellNode = cellWrapping(sel.$from);\n if (!cellNode) { return false }\n cellPos = cellAround(sel.$from).pos;\n } else {\n if (sel.$anchorCell.pos != sel.$headCell.pos) { return false }\n cellNode = sel.$anchorCell.nodeAfter;\n cellPos = sel.$anchorCell.pos;\n }\n if (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) {return false}\n if (dispatch) {\n var baseAttrs = cellNode.attrs, attrs = [], colwidth = baseAttrs.colwidth;\n if (baseAttrs.rowspan > 1) { baseAttrs = setAttr(baseAttrs, \"rowspan\", 1); }\n if (baseAttrs.colspan > 1) { baseAttrs = setAttr(baseAttrs, \"colspan\", 1); }\n var rect = selectedRect(state), tr = state.tr;\n for (var i = 0; i < rect.right - rect.left; i++)\n { attrs.push(colwidth ? setAttr(baseAttrs, \"colwidth\", colwidth && colwidth[i] ? [colwidth[i]] : null) : baseAttrs); }\n var lastCell;\n for (var row = rect.top; row < rect.bottom; row++) {\n var pos = rect.map.positionAt(row, rect.left, rect.table);\n if (row == rect.top) { pos += cellNode.nodeSize; }\n for (var col = rect.left, i$1 = 0; col < rect.right; col++, i$1++) {\n if (col == rect.left && row == rect.top) { continue }\n tr.insert(lastCell = tr.mapping.map(pos + rect.tableStart, 1), getCellType({ node: cellNode, row: row, col: col}).createAndFill(attrs[i$1]));\n }\n }\n tr.setNodeMarkup(cellPos, getCellType({ node: cellNode, row: rect.top, col: rect.left}), attrs[0]);\n if (sel instanceof CellSelection)\n { tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos),\n lastCell && tr.doc.resolve(lastCell))); }\n dispatch(tr);\n }\n return true\n }\n}\n\n// :: (string, any) → (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Returns a command that sets the given attribute to the given value,\n// and is only available when the currently selected cell doesn't\n// already have that attribute set to that value.\nfunction setCellAttr(name, value) {\n return function(state, dispatch) {\n if (!isInTable(state)) { return false }\n var $cell = selectionCell(state);\n if ($cell.nodeAfter.attrs[name] === value) { return false }\n if (dispatch) {\n var tr = state.tr;\n if (state.selection instanceof CellSelection)\n { state.selection.forEachCell(function (node, pos) {\n if (node.attrs[name] !== value)\n { tr.setNodeMarkup(pos, null, setAttr(node.attrs, name, value)); }\n }); }\n else\n { tr.setNodeMarkup($cell.pos, null, setAttr($cell.nodeAfter.attrs, name, value)); }\n dispatch(tr);\n }\n return true\n }\n}\n\nfunction deprecated_toggleHeader(type) {\n return function(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var types = tableNodeTypes(state.schema);\n var rect = selectedRect(state), tr = state.tr;\n var cells = rect.map.cellsInRect(type == \"column\" ? new Rect(rect.left, 0, rect.right, rect.map.height) :\n type == \"row\" ? new Rect(0, rect.top, rect.map.width, rect.bottom) : rect);\n var nodes = cells.map(function (pos) { return rect.table.nodeAt(pos); });\n for (var i = 0; i < cells.length; i++) // Remove headers, if any\n { if (nodes[i].type == types.header_cell)\n { tr.setNodeMarkup(rect.tableStart + cells[i], types.cell, nodes[i].attrs); } }\n if (tr.steps.length == 0) { for (var i$1 = 0; i$1 < cells.length; i$1++) // No headers removed, add instead\n { tr.setNodeMarkup(rect.tableStart + cells[i$1], types.header_cell, nodes[i$1].attrs); } }\n dispatch(tr);\n }\n return true\n }\n}\n\nfunction isHeaderEnabledByType(type, rect, types) {\n // Get cell positions for first row or first column\n var cellPositions = rect.map.cellsInRect({\n left: 0,\n top: 0,\n right: type == \"row\" ? rect.map.width : 1,\n bottom: type == \"column\" ? rect.map.height : 1,\n });\n\n for (var i = 0; i < cellPositions.length; i++) {\n var cell = rect.table.nodeAt(cellPositions[i]);\n if (cell && cell.type !== types.header_cell) {\n return false\n }\n }\n\n return true\n}\n\n// :: (string, ?{ useDeprecatedLogic: bool }) → (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Toggles between row/column header and normal cells (Only applies to first row/column).\n// For deprecated behavior pass `useDeprecatedLogic` in options with true.\nfunction toggleHeader(type, options) {\n options = options || { useDeprecatedLogic: false };\n\n if (options.useDeprecatedLogic)\n { return deprecated_toggleHeader(type) }\n\n return function(state, dispatch) {\n if (!isInTable(state)) { return false }\n if (dispatch) {\n var types = tableNodeTypes(state.schema);\n var rect = selectedRect(state), tr = state.tr;\n\n var isHeaderRowEnabled = isHeaderEnabledByType(\"row\", rect, types);\n var isHeaderColumnEnabled = isHeaderEnabledByType(\"column\", rect, types);\n\n var isHeaderEnabled = type === \"column\" ? isHeaderRowEnabled :\n type === \"row\" ? isHeaderColumnEnabled : false;\n\n var selectionStartsAt = isHeaderEnabled ? 1 : 0;\n\n var cellsRect = type == \"column\" ? new Rect(0, selectionStartsAt, 1, rect.map.height) :\n type == \"row\" ? new Rect(selectionStartsAt, 0, rect.map.width, 1) : rect;\n\n var newType = type == \"column\" ? isHeaderColumnEnabled ? types.cell : types.header_cell :\n type == \"row\" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell;\n\n rect.map.cellsInRect(cellsRect).forEach(function (relativeCellPos) {\n var cellPos = relativeCellPos + rect.tableStart;\n var cell = tr.doc.nodeAt(cellPos);\n\n if (cell) {\n tr.setNodeMarkup(cellPos, newType, cell.attrs);\n }\n });\n\n dispatch(tr);\n }\n return true\n }\n}\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Toggles whether the selected row contains header cells.\nvar toggleHeaderRow = toggleHeader(\"row\", { useDeprecatedLogic: true });\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Toggles whether the selected column contains header cells.\nvar toggleHeaderColumn = toggleHeader(\"column\", { useDeprecatedLogic: true });\n\n// :: (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Toggles whether the selected cells are header cells.\nvar toggleHeaderCell = toggleHeader(\"cell\", { useDeprecatedLogic: true });\n\nfunction findNextCell($cell, dir) {\n if (dir < 0) {\n var before = $cell.nodeBefore;\n if (before) { return $cell.pos - before.nodeSize }\n for (var row = $cell.index(-1) - 1, rowEnd = $cell.before(); row >= 0; row--) {\n var rowNode = $cell.node(-1).child(row);\n if (rowNode.childCount) { return rowEnd - 1 - rowNode.lastChild.nodeSize }\n rowEnd -= rowNode.nodeSize;\n }\n } else {\n if ($cell.index() < $cell.parent.childCount - 1) { return $cell.pos + $cell.nodeAfter.nodeSize }\n var table = $cell.node(-1);\n for (var row$1 = $cell.indexAfter(-1), rowStart = $cell.after(); row$1 < table.childCount; row$1++) {\n var rowNode$1 = table.child(row$1);\n if (rowNode$1.childCount) { return rowStart + 1 }\n rowStart += rowNode$1.nodeSize;\n }\n }\n}\n\n// :: (number) → (EditorState, dispatch: ?(tr: Transaction)) → bool\n// Returns a command for selecting the next (direction=1) or previous\n// (direction=-1) cell in a table.\nfunction goToNextCell(direction) {\n return function(state, dispatch) {\n if (!isInTable(state)) { return false }\n var cell = findNextCell(selectionCell(state), direction);\n if (cell == null) { return }\n if (dispatch) {\n var $cell = state.doc.resolve(cell);\n dispatch(state.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView());\n }\n return true\n }\n}\n\n// :: (EditorState, ?(tr: Transaction)) → bool\n// Deletes the table around the selection, if any.\nfunction deleteTable(state, dispatch) {\n var $pos = state.selection.$anchor;\n for (var d = $pos.depth; d > 0; d--) {\n var node = $pos.node(d);\n if (node.type.spec.tableRole == \"table\") {\n if (dispatch) { dispatch(state.tr.delete($pos.before(d), $pos.after(d)).scrollIntoView()); }\n return true\n }\n }\n return false\n}\n\nvar TableView = function TableView(node, cellMinWidth) {\n this.node = node;\n this.cellMinWidth = cellMinWidth;\n this.dom = document.createElement(\"div\");\n this.dom.className = \"tableWrapper\";\n this.table = this.dom.appendChild(document.createElement(\"table\"));\n this.colgroup = this.table.appendChild(document.createElement(\"colgroup\"));\n updateColumns(node, this.colgroup, this.table, cellMinWidth);\n this.contentDOM = this.table.appendChild(document.createElement(\"tbody\"));\n};\n\nTableView.prototype.update = function update (node) {\n if (node.type != this.node.type) { return false }\n this.node = node;\n updateColumns(node, this.colgroup, this.table, this.cellMinWidth);\n return true\n};\n\nTableView.prototype.ignoreMutation = function ignoreMutation (record) {\n return record.type == \"attributes\" && (record.target == this.table || this.colgroup.contains(record.target))\n};\n\nfunction updateColumns(node, colgroup, table, cellMinWidth, overrideCol, overrideValue) {\n var totalWidth = 0, fixedWidth = true;\n var nextDOM = colgroup.firstChild, row = node.firstChild;\n for (var i = 0, col = 0; i < row.childCount; i++) {\n var ref = row.child(i).attrs;\n var colspan = ref.colspan;\n var colwidth = ref.colwidth;\n for (var j = 0; j < colspan; j++, col++) {\n var hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j];\n var cssWidth = hasWidth ? hasWidth + \"px\" : \"\";\n totalWidth += hasWidth || cellMinWidth;\n if (!hasWidth) { fixedWidth = false; }\n if (!nextDOM) {\n colgroup.appendChild(document.createElement(\"col\")).style.width = cssWidth;\n } else {\n if (nextDOM.style.width != cssWidth) { nextDOM.style.width = cssWidth; }\n nextDOM = nextDOM.nextSibling;\n }\n }\n }\n\n while (nextDOM) {\n var after = nextDOM.nextSibling;\n nextDOM.parentNode.removeChild(nextDOM);\n nextDOM = after;\n }\n\n if (fixedWidth) {\n table.style.width = totalWidth + \"px\";\n table.style.minWidth = \"\";\n } else {\n table.style.width = \"\";\n table.style.minWidth = totalWidth + \"px\";\n }\n}\n\nvar key$1 = new PluginKey(\"tableColumnResizing\");\n\nfunction columnResizing(ref) {\n if ( ref === void 0 ) ref = {};\n var handleWidth = ref.handleWidth; if ( handleWidth === void 0 ) handleWidth = 5;\n var cellMinWidth = ref.cellMinWidth; if ( cellMinWidth === void 0 ) cellMinWidth = 25;\n var View = ref.View; if ( View === void 0 ) View = TableView;\n var lastColumnResizable = ref.lastColumnResizable; if ( lastColumnResizable === void 0 ) lastColumnResizable = true;\n\n var plugin = new Plugin({\n key: key$1,\n state: {\n init: function init(_, state) {\n this.spec.props.nodeViews[tableNodeTypes(state.schema).table.name] =\n function (node, view) { return new View(node, cellMinWidth, view); };\n return new ResizeState(-1, false)\n },\n apply: function apply(tr, prev) {\n return prev.apply(tr)\n }\n },\n props: {\n attributes: function attributes(state) {\n var pluginState = key$1.getState(state);\n return pluginState.activeHandle > -1 ? {class: \"resize-cursor\"} : null\n },\n\n handleDOMEvents: {\n mousemove: function mousemove(view, event) { handleMouseMove(view, event, handleWidth, cellMinWidth, lastColumnResizable); },\n mouseleave: function mouseleave(view) { handleMouseLeave(view); },\n mousedown: function mousedown(view, event) { handleMouseDown$1(view, event, cellMinWidth); }\n },\n\n decorations: function decorations(state) {\n var pluginState = key$1.getState(state);\n if (pluginState.activeHandle > -1) { return handleDecorations(state, pluginState.activeHandle) }\n },\n\n nodeViews: {}\n }\n });\n return plugin\n}\n\nvar ResizeState = function ResizeState(activeHandle, dragging) {\n this.activeHandle = activeHandle;\n this.dragging = dragging;\n};\n\nResizeState.prototype.apply = function apply (tr) {\n var state = this, action = tr.getMeta(key$1);\n if (action && action.setHandle != null)\n { return new ResizeState(action.setHandle, null) }\n if (action && action.setDragging !== undefined)\n { return new ResizeState(state.activeHandle, action.setDragging) }\n if (state.activeHandle > -1 && tr.docChanged) {\n var handle = tr.mapping.map(state.activeHandle, -1);\n if (!pointsAtCell(tr.doc.resolve(handle))) { handle = null; }\n state = new ResizeState(handle, state.dragging);\n }\n return state\n};\n\nfunction handleMouseMove(view, event, handleWidth, cellMinWidth, lastColumnResizable) {\n var pluginState = key$1.getState(view.state);\n\n if (!pluginState.dragging) {\n var target = domCellAround(event.target), cell = -1;\n if (target) {\n var ref = target.getBoundingClientRect();\n var left = ref.left;\n var right = ref.right;\n if (event.clientX - left <= handleWidth)\n { cell = edgeCell(view, event, \"left\"); }\n else if (right - event.clientX <= handleWidth)\n { cell = edgeCell(view, event, \"right\"); }\n }\n\n if (cell != pluginState.activeHandle) {\n if (!lastColumnResizable && cell !== -1) {\n var $cell = view.state.doc.resolve(cell);\n var table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n var col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n\n if (col == map.width - 1) {\n return\n }\n }\n\n updateHandle(view, cell);\n }\n }\n}\n\nfunction handleMouseLeave(view) {\n var pluginState = key$1.getState(view.state);\n if (pluginState.activeHandle > -1 && !pluginState.dragging) { updateHandle(view, -1); }\n}\n\nfunction handleMouseDown$1(view, event, cellMinWidth) {\n var pluginState = key$1.getState(view.state);\n if (pluginState.activeHandle == -1 || pluginState.dragging) { return false }\n\n var cell = view.state.doc.nodeAt(pluginState.activeHandle);\n var width = currentColWidth(view, pluginState.activeHandle, cell.attrs);\n view.dispatch(view.state.tr.setMeta(key$1, {setDragging: {startX: event.clientX, startWidth: width}}));\n\n function finish(event) {\n window.removeEventListener(\"mouseup\", finish);\n window.removeEventListener(\"mousemove\", move);\n var pluginState = key$1.getState(view.state);\n if (pluginState.dragging) {\n updateColumnWidth(view, pluginState.activeHandle, draggedWidth(pluginState.dragging, event, cellMinWidth));\n view.dispatch(view.state.tr.setMeta(key$1, {setDragging: null}));\n }\n }\n function move(event) {\n if (!event.which) { return finish(event) }\n var pluginState = key$1.getState(view.state);\n var dragged = draggedWidth(pluginState.dragging, event, cellMinWidth);\n displayColumnWidth(view, pluginState.activeHandle, dragged, cellMinWidth);\n }\n\n window.addEventListener(\"mouseup\", finish);\n window.addEventListener(\"mousemove\", move);\n event.preventDefault();\n return true\n}\n\nfunction currentColWidth(view, cellPos, ref) {\n var colspan = ref.colspan;\n var colwidth = ref.colwidth;\n\n var width = colwidth && colwidth[colwidth.length - 1];\n if (width) { return width }\n var dom = view.domAtPos(cellPos);\n var node = dom.node.childNodes[dom.offset];\n var domWidth = node.offsetWidth, parts = colspan;\n if (colwidth) { for (var i = 0; i < colspan; i++) { if (colwidth[i]) {\n domWidth -= colwidth[i];\n parts--;\n } } }\n return domWidth / parts\n}\n\nfunction domCellAround(target) {\n while (target && target.nodeName != \"TD\" && target.nodeName != \"TH\")\n { target = target.classList.contains(\"ProseMirror\") ? null : target.parentNode; }\n return target\n}\n\nfunction edgeCell(view, event, side) {\n var ref = view.posAtCoords({left: event.clientX, top: event.clientY});\n var pos = ref.pos;\n var $cell = cellAround(view.state.doc.resolve(pos));\n if (!$cell) { return -1 }\n if (side == \"right\") { return $cell.pos }\n var map = TableMap.get($cell.node(-1)), start = $cell.start(-1);\n var index = map.map.indexOf($cell.pos - start);\n return index % map.width == 0 ? -1 : start + map.map[index - 1]\n}\n\nfunction draggedWidth(dragging, event, cellMinWidth) {\n var offset = event.clientX - dragging.startX;\n return Math.max(cellMinWidth, dragging.startWidth + offset)\n}\n\nfunction updateHandle(view, value) {\n view.dispatch(view.state.tr.setMeta(key$1, {setHandle: value}));\n}\n\nfunction updateColumnWidth(view, cell, width) {\n var $cell = view.state.doc.resolve(cell);\n var table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n var col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n var tr = view.state.tr;\n for (var row = 0; row < map.height; row++) {\n var mapIndex = row * map.width + col;\n // Rowspanning cell that has already been handled\n if (row && map.map[mapIndex] == map.map[mapIndex - map.width]) { continue }\n var pos = map.map[mapIndex];\n var ref = table.nodeAt(pos);\n var attrs = ref.attrs;\n var index = attrs.colspan == 1 ? 0 : col - map.colCount(pos);\n if (attrs.colwidth && attrs.colwidth[index] == width) { continue }\n var colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);\n colwidth[index] = width;\n tr.setNodeMarkup(start + pos, null, setAttr(attrs, \"colwidth\", colwidth));\n }\n if (tr.docChanged) { view.dispatch(tr); }\n}\n\nfunction displayColumnWidth(view, cell, width, cellMinWidth) {\n var $cell = view.state.doc.resolve(cell);\n var table = $cell.node(-1), start = $cell.start(-1);\n var col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n var dom = view.domAtPos($cell.start(-1)).node;\n while (dom.nodeName != \"TABLE\") { dom = dom.parentNode; }\n updateColumns(table, dom.firstChild, dom, cellMinWidth, col, width);\n}\n\nfunction zeroes(n) {\n var result = [];\n for (var i = 0; i < n; i++) { result.push(0); }\n return result\n}\n\nfunction handleDecorations(state, cell) {\n var decorations = [];\n var $cell = state.doc.resolve(cell);\n var table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n var col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan;\n for (var row = 0; row < map.height; row++) {\n var index = col + row * map.width - 1;\n // For positions that are have either a different cell or the end\n // of the table to their right, and either the top of the table or\n // a different cell above them, add a decoration\n if ((col == map.width || map.map[index] != map.map[index + 1]) &&\n (row == 0 || map.map[index - 1] != map.map[index - 1 - map.width])) {\n var cellPos = map.map[index];\n var pos = start + cellPos + table.nodeAt(cellPos).nodeSize - 1;\n var dom = document.createElement(\"div\");\n dom.className = \"column-resize-handle\";\n decorations.push(Decoration.widget(pos, dom));\n }\n }\n return DecorationSet.create(state.doc, decorations)\n}\n\n// This file defines a plugin that handles the drawing of cell\n\n// :: () → Plugin\n//\n// Creates a [plugin](http://prosemirror.net/docs/ref/#state.Plugin)\n// that, when added to an editor, enables cell-selection, handles\n// cell-based copy/paste, and makes sure tables stay well-formed (each\n// row has the same width, and cells don't overlap).\n//\n// You should probably put this plugin near the end of your array of\n// plugins, since it handles mouse and arrow key events in tables\n// rather broadly, and other plugins, like the gap cursor or the\n// column-width dragging plugin, might want to get a turn first to\n// perform more specific behavior.\nfunction tableEditing(ref) {\n if ( ref === void 0 ) ref = {};\n var allowTableNodeSelection = ref.allowTableNodeSelection; if ( allowTableNodeSelection === void 0 ) allowTableNodeSelection = false;\n\n return new Plugin({\n key: key,\n\n // This piece of state is used to remember when a mouse-drag\n // cell-selection is happening, so that it can continue even as\n // transactions (which might move its anchor cell) come in.\n state: {\n init: function init() { return null },\n apply: function apply(tr, cur) {\n var set = tr.getMeta(key);\n if (set != null) { return set == -1 ? null : set }\n if (cur == null || !tr.docChanged) { return cur }\n var ref = tr.mapping.mapResult(cur);\n var deleted = ref.deleted;\n var pos = ref.pos;\n return deleted ? null : pos\n }\n },\n\n props: {\n decorations: drawCellSelection,\n\n handleDOMEvents: {\n mousedown: handleMouseDown\n },\n\n createSelectionBetween: function createSelectionBetween(view) {\n if (key.getState(view.state) != null) { return view.state.selection }\n },\n\n handleTripleClick: handleTripleClick,\n\n handleKeyDown: handleKeyDown,\n\n handlePaste: handlePaste\n },\n\n appendTransaction: function appendTransaction(_, oldState, state) {\n return normalizeSelection(state, fixTables(state, oldState), allowTableNodeSelection)\n }\n })\n}\n\nexport { CellSelection, TableMap, clipCells as __clipCells, insertCells as __insertCells, pastedCells as __pastedCells, addColumn, addColumnAfter, addColumnBefore, addRow, addRowAfter, addRowBefore, cellAround, colCount, columnResizing, key$1 as columnResizingPluginKey, deleteColumn, deleteRow, deleteTable, findCell, fixTables, fixTablesKey, goToNextCell, handlePaste, inSameTable, isInTable, mergeCells, moveCellForward, nextCell, removeColumn, removeRow, rowIsHeader, selectedRect, selectionCell, setCellAttr, splitCell, splitCellWithType, tableEditing, key as tableEditingKey, tableNodes, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, updateColumns as updateColumnsOnResize };\n//# sourceMappingURL=index.es.js.map\n","// HTML5 entities map: { name -> utf16string }\n//\n'use strict';\n\n/*eslint quotes:0*/\nmodule.exports = require('entities/maps/entities.json');\n","'use strict';\n\n\nmodule.exports.encode = require('./encode');\nmodule.exports.decode = require('./decode');\nmodule.exports.format = require('./format');\nmodule.exports.parse = require('./parse');\n","module.exports=/[\\0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/","module.exports=/[\\0-\\x1F\\x7F-\\x9F]/","module.exports=/[ \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]/","// Regexps to match html elements\n\n'use strict';\n\nvar attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';\n\nvar unquoted = '[^\"\\'=<>`\\\\x00-\\\\x20]+';\nvar single_quoted = \"'[^']*'\";\nvar double_quoted = '\"[^\"]*\"';\n\nvar attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';\n\nvar attribute = '(?:\\\\s+' + attr_name + '(?:\\\\s*=\\\\s*' + attr_value + ')?)';\n\nvar open_tag = '<[A-Za-z][A-Za-z0-9\\\\-]*' + attribute + '*\\\\s*\\\\/?>';\n\nvar close_tag = '<\\\\/[A-Za-z][A-Za-z0-9\\\\-]*\\\\s*>';\nvar comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';\nvar processing = '<[?].*?[?]>';\nvar declaration = '<![A-Z]+\\\\s+[^>]*>';\nvar cdata = '<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>';\n\nvar HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +\n '|' + processing + '|' + declaration + '|' + cdata + ')');\nvar HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');\n\nmodule.exports.HTML_TAG_RE = HTML_TAG_RE;\nmodule.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;\n","// ~~strike through~~\n//\n'use strict';\n\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nmodule.exports.tokenize = function strikethrough(state, silent) {\n var i, scanned, token, len, ch,\n start = state.pos,\n marker = state.src.charCodeAt(start);\n\n if (silent) { return false; }\n\n if (marker !== 0x7E/* ~ */) { return false; }\n\n scanned = state.scanDelims(state.pos, true);\n len = scanned.length;\n ch = String.fromCharCode(marker);\n\n if (len < 2) { return false; }\n\n if (len % 2) {\n token = state.push('text', '', 0);\n token.content = ch;\n len--;\n }\n\n for (i = 0; i < len; i += 2) {\n token = state.push('text', '', 0);\n token.content = ch + ch;\n\n state.delimiters.push({\n marker: marker,\n jump: i,\n token: state.tokens.length - 1,\n level: state.level,\n end: -1,\n open: scanned.can_open,\n close: scanned.can_close\n });\n }\n\n state.pos += scanned.length;\n\n return true;\n};\n\n\n// Walk through delimiter list and replace text tokens with tags\n//\nmodule.exports.postProcess = function strikethrough(state) {\n var i, j,\n startDelim,\n endDelim,\n token,\n loneMarkers = [],\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = 0; i < max; i++) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x7E/* ~ */) {\n continue;\n }\n\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n token = state.tokens[startDelim.token];\n token.type = 's_open';\n token.tag = 's';\n token.nesting = 1;\n token.markup = '~~';\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = 's_close';\n token.tag = 's';\n token.nesting = -1;\n token.markup = '~~';\n token.content = '';\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === '~') {\n\n loneMarkers.push(endDelim.token - 1);\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n //\n while (loneMarkers.length) {\n i = loneMarkers.pop();\n j = i + 1;\n\n while (j < state.tokens.length && state.tokens[j].type === 's_close') {\n j++;\n }\n\n j--;\n\n if (i !== j) {\n token = state.tokens[j];\n state.tokens[j] = state.tokens[i];\n state.tokens[i] = token;\n }\n }\n};\n","// Process *this* and _that_\n//\n'use strict';\n\n\n// Insert each marker as a separate text token, and add it to delimiter list\n//\nmodule.exports.tokenize = function emphasis(state, silent) {\n var i, scanned, token,\n start = state.pos,\n marker = state.src.charCodeAt(start);\n\n if (silent) { return false; }\n\n if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }\n\n scanned = state.scanDelims(state.pos, marker === 0x2A);\n\n for (i = 0; i < scanned.length; i++) {\n token = state.push('text', '', 0);\n token.content = String.fromCharCode(marker);\n\n state.delimiters.push({\n // Char code of the starting marker (number).\n //\n marker: marker,\n\n // Total length of these series of delimiters.\n //\n length: scanned.length,\n\n // An amount of characters before this one that's equivalent to\n // current one. In plain English: if this delimiter does not open\n // an emphasis, neither do previous `jump` characters.\n //\n // Used to skip sequences like \"*****\" in one step, for 1st asterisk\n // value will be 0, for 2nd it's 1 and so on.\n //\n jump: i,\n\n // A position of the token this delimiter corresponds to.\n //\n token: state.tokens.length - 1,\n\n // Token level.\n //\n level: state.level,\n\n // If this delimiter is matched as a valid opener, `end` will be\n // equal to its position, otherwise it's `-1`.\n //\n end: -1,\n\n // Boolean flags that determine if this delimiter could open or close\n // an emphasis.\n //\n open: scanned.can_open,\n close: scanned.can_close\n });\n }\n\n state.pos += scanned.length;\n\n return true;\n};\n\n\n// Walk through delimiter list and replace text tokens with tags\n//\nmodule.exports.postProcess = function emphasis(state) {\n var i,\n startDelim,\n endDelim,\n token,\n ch,\n isStrong,\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = max - 1; i >= 0; i--) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {\n continue;\n }\n\n // Process only opening markers\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n // If the previous delimiter has the same marker and is adjacent to this one,\n // merge those into one strong delimiter.\n //\n // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`\n //\n isStrong = i > 0 &&\n delimiters[i - 1].end === startDelim.end + 1 &&\n delimiters[i - 1].token === startDelim.token - 1 &&\n delimiters[startDelim.end + 1].token === endDelim.token + 1 &&\n delimiters[i - 1].marker === startDelim.marker;\n\n ch = String.fromCharCode(startDelim.marker);\n\n token = state.tokens[startDelim.token];\n token.type = isStrong ? 'strong_open' : 'em_open';\n token.tag = isStrong ? 'strong' : 'em';\n token.nesting = 1;\n token.markup = isStrong ? ch + ch : ch;\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = isStrong ? 'strong_close' : 'em_close';\n token.tag = isStrong ? 'strong' : 'em';\n token.nesting = -1;\n token.markup = isStrong ? ch + ch : ch;\n token.content = '';\n\n if (isStrong) {\n state.tokens[delimiters[i - 1].token].content = '';\n state.tokens[delimiters[startDelim.end + 1].token].content = '';\n i--;\n }\n }\n};\n","// Markdown-it plugin to render GitHub-style task lists; see\n//\n// https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments\n// https://github.com/blog/1825-task-lists-in-all-markdown-documents\n\nvar disableCheckboxes = true;\nvar useLabelWrapper = false;\nvar useLabelAfter = false;\n\nmodule.exports = function(md, options) {\n\tif (options) {\n\t\tdisableCheckboxes = !options.enabled;\n\t\tuseLabelWrapper = !!options.label;\n\t\tuseLabelAfter = !!options.labelAfter;\n\t}\n\n\tmd.core.ruler.after('inline', 'github-task-lists', function(state) {\n\t\tvar tokens = state.tokens;\n\t\tfor (var i = 2; i < tokens.length; i++) {\n\t\t\tif (isTodoItem(tokens, i)) {\n\t\t\t\ttodoify(tokens[i], state.Token);\n\t\t\t\tattrSet(tokens[i-2], 'class', 'task-list-item' + (!disableCheckboxes ? ' enabled' : ''));\n\t\t\t\tattrSet(tokens[parentToken(tokens, i-2)], 'class', 'contains-task-list');\n\t\t\t}\n\t\t}\n\t});\n};\n\nfunction attrSet(token, name, value) {\n\tvar index = token.attrIndex(name);\n\tvar attr = [name, value];\n\n\tif (index < 0) {\n\t\ttoken.attrPush(attr);\n\t} else {\n\t\ttoken.attrs[index] = attr;\n\t}\n}\n\nfunction parentToken(tokens, index) {\n\tvar targetLevel = tokens[index].level - 1;\n\tfor (var i = index - 1; i >= 0; i--) {\n\t\tif (tokens[i].level === targetLevel) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\nfunction isTodoItem(tokens, index) {\n\treturn isInline(tokens[index]) &&\n\t isParagraph(tokens[index - 1]) &&\n\t isListItem(tokens[index - 2]) &&\n\t startsWithTodoMarkdown(tokens[index]);\n}\n\nfunction todoify(token, TokenConstructor) {\n\ttoken.children.unshift(makeCheckbox(token, TokenConstructor));\n\ttoken.children[1].content = token.children[1].content.slice(3);\n\ttoken.content = token.content.slice(3);\n\n\tif (useLabelWrapper) {\n\t\tif (useLabelAfter) {\n\t\t\ttoken.children.pop();\n\n\t\t\t// Use large random number as id property of the checkbox.\n\t\t\tvar id = 'task-item-' + Math.ceil(Math.random() * (10000 * 1000) - 1000);\n\t\t\ttoken.children[0].content = token.children[0].content.slice(0, -1) + ' id=\"' + id + '\">';\n\t\t\ttoken.children.push(afterLabel(token.content, id, TokenConstructor));\n\t\t} else {\n\t\t\ttoken.children.unshift(beginLabel(TokenConstructor));\n\t\t\ttoken.children.push(endLabel(TokenConstructor));\n\t\t}\n\t}\n}\n\nfunction makeCheckbox(token, TokenConstructor) {\n\tvar checkbox = new TokenConstructor('html_inline', '', 0);\n\tvar disabledAttr = disableCheckboxes ? ' disabled=\"\" ' : '';\n\tif (token.content.indexOf('[ ] ') === 0) {\n\t\tcheckbox.content = '<input class=\"task-list-item-checkbox\"' + disabledAttr + 'type=\"checkbox\">';\n\t} else if (token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0) {\n\t\tcheckbox.content = '<input class=\"task-list-item-checkbox\" checked=\"\"' + disabledAttr + 'type=\"checkbox\">';\n\t}\n\treturn checkbox;\n}\n\n// these next two functions are kind of hacky; probably should really be a\n// true block-level token with .tag=='label'\nfunction beginLabel(TokenConstructor) {\n\tvar token = new TokenConstructor('html_inline', '', 0);\n\ttoken.content = '<label>';\n\treturn token;\n}\n\nfunction endLabel(TokenConstructor) {\n\tvar token = new TokenConstructor('html_inline', '', 0);\n\ttoken.content = '</label>';\n\treturn token;\n}\n\nfunction afterLabel(content, id, TokenConstructor) {\n\tvar token = new TokenConstructor('html_inline', '', 0);\n\ttoken.content = '<label class=\"task-list-item-label\" for=\"' + id + '\">' + content + '</label>';\n\ttoken.attrs = [{for: id}];\n\treturn token;\n}\n\nfunction isInline(token) { return token.type === 'inline'; }\nfunction isParagraph(token) { return token.type === 'paragraph_open'; }\nfunction isListItem(token) { return token.type === 'list_item_open'; }\n\nfunction startsWithTodoMarkdown(token) {\n\t// leading whitespace in a list item is already trimmed off by markdown-it\n\treturn token.content.indexOf('[ ] ') === 0 || token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0;\n}\n","import { Schema, Mark } from 'prosemirror-model';\nimport markdownit from 'markdown-it';\n\n// ::Schema Document schema for the data model used by CommonMark.\nvar schema = new Schema({\n nodes: {\n doc: {\n content: \"block+\"\n },\n\n paragraph: {\n content: \"inline*\",\n group: \"block\",\n parseDOM: [{tag: \"p\"}],\n toDOM: function toDOM() { return [\"p\", 0] }\n },\n\n blockquote: {\n content: \"block+\",\n group: \"block\",\n parseDOM: [{tag: \"blockquote\"}],\n toDOM: function toDOM() { return [\"blockquote\", 0] }\n },\n\n horizontal_rule: {\n group: \"block\",\n parseDOM: [{tag: \"hr\"}],\n toDOM: function toDOM() { return [\"div\", [\"hr\"]] }\n },\n\n heading: {\n attrs: {level: {default: 1}},\n content: \"inline*\",\n group: \"block\",\n defining: true,\n parseDOM: [{tag: \"h1\", attrs: {level: 1}},\n {tag: \"h2\", attrs: {level: 2}},\n {tag: \"h3\", attrs: {level: 3}},\n {tag: \"h4\", attrs: {level: 4}},\n {tag: \"h5\", attrs: {level: 5}},\n {tag: \"h6\", attrs: {level: 6}}],\n toDOM: function toDOM(node) { return [\"h\" + node.attrs.level, 0] }\n },\n\n code_block: {\n content: \"text*\",\n group: \"block\",\n code: true,\n defining: true,\n marks: \"\",\n attrs: {params: {default: \"\"}},\n parseDOM: [{tag: \"pre\", preserveWhitespace: \"full\", getAttrs: function (node) { return (\n {params: node.getAttribute(\"data-params\") || \"\"}\n ); }}],\n toDOM: function toDOM(node) { return [\"pre\", node.attrs.params ? {\"data-params\": node.attrs.params} : {}, [\"code\", 0]] }\n },\n\n ordered_list: {\n content: \"list_item+\",\n group: \"block\",\n attrs: {order: {default: 1}, tight: {default: false}},\n parseDOM: [{tag: \"ol\", getAttrs: function getAttrs(dom) {\n return {order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1,\n tight: dom.hasAttribute(\"data-tight\")}\n }}],\n toDOM: function toDOM(node) {\n return [\"ol\", {start: node.attrs.order == 1 ? null : node.attrs.order,\n \"data-tight\": node.attrs.tight ? \"true\" : null}, 0]\n }\n },\n\n bullet_list: {\n content: \"list_item+\",\n group: \"block\",\n attrs: {tight: {default: false}},\n parseDOM: [{tag: \"ul\", getAttrs: function (dom) { return ({tight: dom.hasAttribute(\"data-tight\")}); }}],\n toDOM: function toDOM(node) { return [\"ul\", {\"data-tight\": node.attrs.tight ? \"true\" : null}, 0] }\n },\n\n list_item: {\n content: \"paragraph block*\",\n defining: true,\n parseDOM: [{tag: \"li\"}],\n toDOM: function toDOM() { return [\"li\", 0] }\n },\n\n text: {\n group: \"inline\"\n },\n\n image: {\n inline: true,\n attrs: {\n src: {},\n alt: {default: null},\n title: {default: null}\n },\n group: \"inline\",\n draggable: true,\n parseDOM: [{tag: \"img[src]\", getAttrs: function getAttrs(dom) {\n return {\n src: dom.getAttribute(\"src\"),\n title: dom.getAttribute(\"title\"),\n alt: dom.getAttribute(\"alt\")\n }\n }}],\n toDOM: function toDOM(node) { return [\"img\", node.attrs] }\n },\n\n hard_break: {\n inline: true,\n group: \"inline\",\n selectable: false,\n parseDOM: [{tag: \"br\"}],\n toDOM: function toDOM() { return [\"br\"] }\n }\n },\n\n marks: {\n em: {\n parseDOM: [{tag: \"i\"}, {tag: \"em\"},\n {style: \"font-style\", getAttrs: function (value) { return value == \"italic\" && null; }}],\n toDOM: function toDOM() { return [\"em\"] }\n },\n\n strong: {\n parseDOM: [{tag: \"b\"}, {tag: \"strong\"},\n {style: \"font-weight\", getAttrs: function (value) { return /^(bold(er)?|[5-9]\\d{2,})$/.test(value) && null; }}],\n toDOM: function toDOM() { return [\"strong\"] }\n },\n\n link: {\n attrs: {\n href: {},\n title: {default: null}\n },\n inclusive: false,\n parseDOM: [{tag: \"a[href]\", getAttrs: function getAttrs(dom) {\n return {href: dom.getAttribute(\"href\"), title: dom.getAttribute(\"title\")}\n }}],\n toDOM: function toDOM(node) { return [\"a\", node.attrs] }\n },\n\n code: {\n parseDOM: [{tag: \"code\"}],\n toDOM: function toDOM() { return [\"code\"] }\n }\n }\n});\n\nfunction maybeMerge(a, b) {\n if (a.isText && b.isText && Mark.sameSet(a.marks, b.marks))\n { return a.withText(a.text + b.text) }\n}\n\n// Object used to track the context of a running parse.\nvar MarkdownParseState = function MarkdownParseState(schema, tokenHandlers) {\n this.schema = schema;\n this.stack = [{type: schema.topNodeType, content: []}];\n this.marks = Mark.none;\n this.tokenHandlers = tokenHandlers;\n};\n\nMarkdownParseState.prototype.top = function top () {\n return this.stack[this.stack.length - 1]\n};\n\nMarkdownParseState.prototype.push = function push (elt) {\n if (this.stack.length) { this.top().content.push(elt); }\n};\n\n// : (string)\n// Adds the given text to the current position in the document,\n// using the current marks as styling.\nMarkdownParseState.prototype.addText = function addText (text) {\n if (!text) { return }\n var nodes = this.top().content, last = nodes[nodes.length - 1];\n var node = this.schema.text(text, this.marks), merged;\n if (last && (merged = maybeMerge(last, node))) { nodes[nodes.length - 1] = merged; }\n else { nodes.push(node); }\n};\n\n// : (Mark)\n// Adds the given mark to the set of active marks.\nMarkdownParseState.prototype.openMark = function openMark (mark) {\n this.marks = mark.addToSet(this.marks);\n};\n\n// : (Mark)\n// Removes the given mark from the set of active marks.\nMarkdownParseState.prototype.closeMark = function closeMark (mark) {\n this.marks = mark.removeFromSet(this.marks);\n};\n\nMarkdownParseState.prototype.parseTokens = function parseTokens (toks) {\n for (var i = 0; i < toks.length; i++) {\n var tok = toks[i];\n var handler = this.tokenHandlers[tok.type];\n if (!handler)\n { throw new Error(\"Token type `\" + tok.type + \"` not supported by Markdown parser\") }\n handler(this, tok);\n }\n};\n\n// : (NodeType, ?Object, ?[Node]) → ?Node\n// Add a node at the current position.\nMarkdownParseState.prototype.addNode = function addNode (type, attrs, content) {\n var node = type.createAndFill(attrs, content, this.marks);\n if (!node) { return null }\n this.push(node);\n return node\n};\n\n// : (NodeType, ?Object)\n// Wrap subsequent content in a node of the given type.\nMarkdownParseState.prototype.openNode = function openNode (type, attrs) {\n this.stack.push({type: type, attrs: attrs, content: []});\n};\n\n// : () → ?Node\n// Close and return the node that is currently on top of the stack.\nMarkdownParseState.prototype.closeNode = function closeNode () {\n if (this.marks.length) { this.marks = Mark.none; }\n var info = this.stack.pop();\n return this.addNode(info.type, info.attrs, info.content)\n};\n\nfunction attrs(spec, token) {\n if (spec.getAttrs) { return spec.getAttrs(token) }\n // For backwards compatibility when `attrs` is a Function\n else if (spec.attrs instanceof Function) { return spec.attrs(token) }\n else { return spec.attrs }\n}\n\n// Code content is represented as a single token with a `content`\n// property in Markdown-it.\nfunction noOpenClose(type) {\n return type == \"code_inline\" || type == \"code_block\" || type == \"fence\"\n}\n\nfunction withoutTrailingNewline(str) {\n return str[str.length - 1] == \"\\n\" ? str.slice(0, str.length - 1) : str\n}\n\nfunction noOp() {}\n\nfunction tokenHandlers(schema, tokens) {\n var handlers = Object.create(null);\n var loop = function ( type ) {\n var spec = tokens[type];\n if (spec.block) {\n var nodeType = schema.nodeType(spec.block);\n if (noOpenClose(type)) {\n handlers[type] = function (state, tok) {\n state.openNode(nodeType, attrs(spec, tok));\n state.addText(withoutTrailingNewline(tok.content));\n state.closeNode();\n };\n } else {\n handlers[type + \"_open\"] = function (state, tok) { return state.openNode(nodeType, attrs(spec, tok)); };\n handlers[type + \"_close\"] = function (state) { return state.closeNode(); };\n }\n } else if (spec.node) {\n var nodeType$1 = schema.nodeType(spec.node);\n handlers[type] = function (state, tok) { return state.addNode(nodeType$1, attrs(spec, tok)); };\n } else if (spec.mark) {\n var markType = schema.marks[spec.mark];\n if (noOpenClose(type)) {\n handlers[type] = function (state, tok) {\n state.openMark(markType.create(attrs(spec, tok)));\n state.addText(withoutTrailingNewline(tok.content));\n state.closeMark(markType);\n };\n } else {\n handlers[type + \"_open\"] = function (state, tok) { return state.openMark(markType.create(attrs(spec, tok))); };\n handlers[type + \"_close\"] = function (state) { return state.closeMark(markType); };\n }\n } else if (spec.ignore) {\n if (noOpenClose(type)) {\n handlers[type] = noOp;\n } else {\n handlers[type + '_open'] = noOp;\n handlers[type + '_close'] = noOp;\n }\n } else {\n throw new RangeError(\"Unrecognized parsing spec \" + JSON.stringify(spec))\n }\n };\n\n for (var type in tokens) loop( type );\n\n handlers.text = function (state, tok) { return state.addText(tok.content); };\n handlers.inline = function (state, tok) { return state.parseTokens(tok.children); };\n handlers.softbreak = handlers.softbreak || (function (state) { return state.addText(\"\\n\"); });\n\n return handlers\n}\n\n// ::- A configuration of a Markdown parser. Such a parser uses\n// [markdown-it](https://github.com/markdown-it/markdown-it) to\n// tokenize a file, and then runs the custom rules it is given over\n// the tokens to create a ProseMirror document tree.\nvar MarkdownParser = function MarkdownParser(schema, tokenizer, tokens) {\n // :: Object The value of the `tokens` object used to construct\n // this parser. Can be useful to copy and modify to base other\n // parsers on.\n this.tokens = tokens;\n this.schema = schema;\n this.tokenizer = tokenizer;\n this.tokenHandlers = tokenHandlers(schema, tokens);\n};\n\n// :: (string) → Node\n// Parse a string as [CommonMark](http://commonmark.org/) markup,\n// and create a ProseMirror document as prescribed by this parser's\n// rules.\nMarkdownParser.prototype.parse = function parse (text) {\n var state = new MarkdownParseState(this.schema, this.tokenHandlers), doc;\n state.parseTokens(this.tokenizer.parse(text, {}));\n do { doc = state.closeNode(); } while (state.stack.length)\n return doc\n};\n\n// :: MarkdownParser\n// A parser parsing unextended [CommonMark](http://commonmark.org/),\n// without inline HTML, and producing a document in the basic schema.\nvar defaultMarkdownParser = new MarkdownParser(schema, markdownit(\"commonmark\", {html: false}), {\n blockquote: {block: \"blockquote\"},\n paragraph: {block: \"paragraph\"},\n list_item: {block: \"list_item\"},\n bullet_list: {block: \"bullet_list\"},\n ordered_list: {block: \"ordered_list\", getAttrs: function (tok) { return ({order: +tok.attrGet(\"start\") || 1}); }},\n heading: {block: \"heading\", getAttrs: function (tok) { return ({level: +tok.tag.slice(1)}); }},\n code_block: {block: \"code_block\"},\n fence: {block: \"code_block\", getAttrs: function (tok) { return ({params: tok.info || \"\"}); }},\n hr: {node: \"horizontal_rule\"},\n image: {node: \"image\", getAttrs: function (tok) { return ({\n src: tok.attrGet(\"src\"),\n title: tok.attrGet(\"title\") || null,\n alt: tok.children[0] && tok.children[0].content || null\n }); }},\n hardbreak: {node: \"hard_break\"},\n\n em: {mark: \"em\"},\n strong: {mark: \"strong\"},\n link: {mark: \"link\", getAttrs: function (tok) { return ({\n href: tok.attrGet(\"href\"),\n title: tok.attrGet(\"title\") || null\n }); }},\n code_inline: {mark: \"code\"}\n});\n\n// ::- A specification for serializing a ProseMirror document as\n// Markdown/CommonMark text.\nvar MarkdownSerializer = function MarkdownSerializer(nodes, marks) {\n // :: Object<(MarkdownSerializerState, Node)> The node serializer\n // functions for this serializer.\n this.nodes = nodes;\n // :: Object The mark serializer info.\n this.marks = marks;\n};\n\n// :: (Node, ?Object) → string\n// Serialize the content of the given node to\n// [CommonMark](http://commonmark.org/).\nMarkdownSerializer.prototype.serialize = function serialize (content, options) {\n var state = new MarkdownSerializerState(this.nodes, this.marks, options);\n state.renderContent(content);\n return state.out\n};\n\n// :: MarkdownSerializer\n// A serializer for the [basic schema](#schema).\nvar defaultMarkdownSerializer = new MarkdownSerializer({\n blockquote: function blockquote(state, node) {\n state.wrapBlock(\"> \", null, node, function () { return state.renderContent(node); });\n },\n code_block: function code_block(state, node) {\n state.write(\"```\" + (node.attrs.params || \"\") + \"\\n\");\n state.text(node.textContent, false);\n state.ensureNewLine();\n state.write(\"```\");\n state.closeBlock(node);\n },\n heading: function heading(state, node) {\n state.write(state.repeat(\"#\", node.attrs.level) + \" \");\n state.renderInline(node);\n state.closeBlock(node);\n },\n horizontal_rule: function horizontal_rule(state, node) {\n state.write(node.attrs.markup || \"---\");\n state.closeBlock(node);\n },\n bullet_list: function bullet_list(state, node) {\n state.renderList(node, \" \", function () { return (node.attrs.bullet || \"*\") + \" \"; });\n },\n ordered_list: function ordered_list(state, node) {\n var start = node.attrs.order || 1;\n var maxW = String(start + node.childCount - 1).length;\n var space = state.repeat(\" \", maxW + 2);\n state.renderList(node, space, function (i) {\n var nStr = String(start + i);\n return state.repeat(\" \", maxW - nStr.length) + nStr + \". \"\n });\n },\n list_item: function list_item(state, node) {\n state.renderContent(node);\n },\n paragraph: function paragraph(state, node) {\n state.renderInline(node);\n state.closeBlock(node);\n },\n\n image: function image(state, node) {\n state.write(\"![\" + state.esc(node.attrs.alt || \"\") + \"](\" + state.esc(node.attrs.src) +\n (node.attrs.title ? \" \" + state.quote(node.attrs.title) : \"\") + \")\");\n },\n hard_break: function hard_break(state, node, parent, index) {\n for (var i = index + 1; i < parent.childCount; i++)\n { if (parent.child(i).type != node.type) {\n state.write(\"\\\\\\n\");\n return\n } }\n },\n text: function text(state, node) {\n state.text(node.text);\n }\n}, {\n em: {open: \"*\", close: \"*\", mixable: true, expelEnclosingWhitespace: true},\n strong: {open: \"**\", close: \"**\", mixable: true, expelEnclosingWhitespace: true},\n link: {\n open: function open(_state, mark, parent, index) {\n return isPlainURL(mark, parent, index, 1) ? \"<\" : \"[\"\n },\n close: function close(state, mark, parent, index) {\n return isPlainURL(mark, parent, index, -1) ? \">\"\n : \"](\" + state.esc(mark.attrs.href) + (mark.attrs.title ? \" \" + state.quote(mark.attrs.title) : \"\") + \")\"\n }\n },\n code: {open: function open(_state, _mark, parent, index) { return backticksFor(parent.child(index), -1) },\n close: function close(_state, _mark, parent, index) { return backticksFor(parent.child(index - 1), 1) },\n escape: false}\n});\n\nfunction backticksFor(node, side) {\n var ticks = /`+/g, m, len = 0;\n if (node.isText) { while (m = ticks.exec(node.text)) { len = Math.max(len, m[0].length); } }\n var result = len > 0 && side > 0 ? \" `\" : \"`\";\n for (var i = 0; i < len; i++) { result += \"`\"; }\n if (len > 0 && side < 0) { result += \" \"; }\n return result\n}\n\nfunction isPlainURL(link, parent, index, side) {\n if (link.attrs.title || !/^\\w+:/.test(link.attrs.href)) { return false }\n var content = parent.child(index + (side < 0 ? -1 : 0));\n if (!content.isText || content.text != link.attrs.href || content.marks[content.marks.length - 1] != link) { return false }\n if (index == (side < 0 ? 1 : parent.childCount - 1)) { return true }\n var next = parent.child(index + (side < 0 ? -2 : 1));\n return !link.isInSet(next.marks)\n}\n\n// ::- This is an object used to track state and expose\n// methods related to markdown serialization. Instances are passed to\n// node and mark serialization methods (see `toMarkdown`).\nvar MarkdownSerializerState = function MarkdownSerializerState(nodes, marks, options) {\n this.nodes = nodes;\n this.marks = marks;\n this.delim = this.out = \"\";\n this.closed = false;\n this.inTightList = false;\n // :: Object\n // The options passed to the serializer.\n // tightLists:: ?bool\n // Whether to render lists in a tight style. This can be overridden\n // on a node level by specifying a tight attribute on the node.\n // Defaults to false.\n this.options = options || {};\n if (typeof this.options.tightLists == \"undefined\")\n { this.options.tightLists = false; }\n};\n\nMarkdownSerializerState.prototype.flushClose = function flushClose (size) {\n if (this.closed) {\n if (!this.atBlank()) { this.out += \"\\n\"; }\n if (size == null) { size = 2; }\n if (size > 1) {\n var delimMin = this.delim;\n var trim = /\\s+$/.exec(delimMin);\n if (trim) { delimMin = delimMin.slice(0, delimMin.length - trim[0].length); }\n for (var i = 1; i < size; i++)\n { this.out += delimMin + \"\\n\"; }\n }\n this.closed = false;\n }\n};\n\n// :: (string, ?string, Node, ())\n// Render a block, prefixing each line with `delim`, and the first\n// line in `firstDelim`. `node` should be the node that is closed at\n// the end of the block, and `f` is a function that renders the\n// content of the block.\nMarkdownSerializerState.prototype.wrapBlock = function wrapBlock (delim, firstDelim, node, f) {\n var old = this.delim;\n this.write(firstDelim || delim);\n this.delim += delim;\n f();\n this.delim = old;\n this.closeBlock(node);\n};\n\nMarkdownSerializerState.prototype.atBlank = function atBlank () {\n return /(^|\\n)$/.test(this.out)\n};\n\n// :: ()\n// Ensure the current content ends with a newline.\nMarkdownSerializerState.prototype.ensureNewLine = function ensureNewLine () {\n if (!this.atBlank()) { this.out += \"\\n\"; }\n};\n\n// :: (?string)\n// Prepare the state for writing output (closing closed paragraphs,\n// adding delimiters, and so on), and then optionally add content\n// (unescaped) to the output.\nMarkdownSerializerState.prototype.write = function write (content) {\n this.flushClose();\n if (this.delim && this.atBlank())\n { this.out += this.delim; }\n if (content) { this.out += content; }\n};\n\n// :: (Node)\n// Close the block for the given node.\nMarkdownSerializerState.prototype.closeBlock = function closeBlock (node) {\n this.closed = node;\n};\n\n// :: (string, ?bool)\n// Add the given text to the document. When escape is not `false`,\n// it will be escaped.\nMarkdownSerializerState.prototype.text = function text (text$1, escape) {\n var lines = text$1.split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n var startOfLine = this.atBlank() || this.closed;\n this.write();\n this.out += escape !== false ? this.esc(lines[i], startOfLine) : lines[i];\n if (i != lines.length - 1) { this.out += \"\\n\"; }\n }\n};\n\n// :: (Node)\n// Render the given node as a block.\nMarkdownSerializerState.prototype.render = function render (node, parent, index) {\n if (typeof parent == \"number\") { throw new Error(\"!\") }\n this.nodes[node.type.name](this, node, parent, index);\n};\n\n// :: (Node)\n// Render the contents of `parent` as block nodes.\nMarkdownSerializerState.prototype.renderContent = function renderContent (parent) {\n var this$1 = this;\n\n parent.forEach(function (node, _, i) { return this$1.render(node, parent, i); });\n};\n\n// :: (Node)\n// Render the contents of `parent` as inline content.\nMarkdownSerializerState.prototype.renderInline = function renderInline (parent) {\n var this$1 = this;\n\n var active = [], trailing = \"\";\n var progress = function (node, _, index) {\n var marks = node ? node.marks : [];\n\n // Remove marks from `hard_break` that are the last node inside\n // that mark to prevent parser edge cases with new lines just\n // before closing marks.\n // (FIXME it'd be nice if we had a schema-agnostic way to\n // identify nodes that serialize as hard breaks)\n if (node && node.type.name === \"hard_break\")\n { marks = marks.filter(function (m) {\n if (index + 1 == parent.childCount) { return false }\n var next = parent.child(index + 1);\n return m.isInSet(next.marks) && (!next.isText || /\\S/.test(next.text))\n }); }\n\n var leading = trailing;\n trailing = \"\";\n // If whitespace has to be expelled from the node, adjust\n // leading and trailing accordingly.\n if (node && node.isText && marks.some(function (mark) {\n var info = this$1.marks[mark.type.name];\n return info && info.expelEnclosingWhitespace\n })) {\n var ref = /^(\\s*)(.*?)(\\s*)$/m.exec(node.text);\n var _$1 = ref[0];\n var lead = ref[1];\n var inner$1 = ref[2];\n var trail = ref[3];\n leading += lead;\n trailing = trail;\n if (lead || trail) {\n node = inner$1 ? node.withText(inner$1) : null;\n if (!node) { marks = active; }\n }\n }\n\n var inner = marks.length && marks[marks.length - 1], noEsc = inner && this$1.marks[inner.type.name].escape === false;\n var len = marks.length - (noEsc ? 1 : 0);\n\n // Try to reorder 'mixable' marks, such as em and strong, which\n // in Markdown may be opened and closed in different order, so\n // that order of the marks for the token matches the order in\n // active.\n outer: for (var i = 0; i < len; i++) {\n var mark = marks[i];\n if (!this$1.marks[mark.type.name].mixable) { break }\n for (var j = 0; j < active.length; j++) {\n var other = active[j];\n if (!this$1.marks[other.type.name].mixable) { break }\n if (mark.eq(other)) {\n if (i > j)\n { marks = marks.slice(0, j).concat(mark).concat(marks.slice(j, i)).concat(marks.slice(i + 1, len)); }\n else if (j > i)\n { marks = marks.slice(0, i).concat(marks.slice(i + 1, j)).concat(mark).concat(marks.slice(j, len)); }\n continue outer\n }\n }\n }\n\n // Find the prefix of the mark set that didn't change\n var keep = 0;\n while (keep < Math.min(active.length, len) && marks[keep].eq(active[keep])) { ++keep; }\n\n // Close the marks that need to be closed\n while (keep < active.length)\n { this$1.text(this$1.markString(active.pop(), false, parent, index), false); }\n\n // Output any previously expelled trailing whitespace outside the marks\n if (leading) { this$1.text(leading); }\n\n // Open the marks that need to be opened\n if (node) {\n while (active.length < len) {\n var add = marks[active.length];\n active.push(add);\n this$1.text(this$1.markString(add, true, parent, index), false);\n }\n\n // Render the node. Special case code marks, since their content\n // may not be escaped.\n if (noEsc && node.isText)\n { this$1.text(this$1.markString(inner, true, parent, index) + node.text +\n this$1.markString(inner, false, parent, index + 1), false); }\n else\n { this$1.render(node, parent, index); }\n }\n };\n parent.forEach(progress);\n progress(null, null, parent.childCount);\n};\n\n// :: (Node, string, (number) → string)\n// Render a node's content as a list. `delim` should be the extra\n// indentation added to all lines except the first in an item,\n// `firstDelim` is a function going from an item index to a\n// delimiter for the first line of the item.\nMarkdownSerializerState.prototype.renderList = function renderList (node, delim, firstDelim) {\n var this$1 = this;\n\n if (this.closed && this.closed.type == node.type)\n { this.flushClose(3); }\n else if (this.inTightList)\n { this.flushClose(1); }\n\n var isTight = typeof node.attrs.tight != \"undefined\" ? node.attrs.tight : this.options.tightLists;\n var prevTight = this.inTightList;\n this.inTightList = isTight;\n node.forEach(function (child, _, i) {\n if (i && isTight) { this$1.flushClose(1); }\n this$1.wrapBlock(delim, firstDelim(i), node, function () { return this$1.render(child, node, i); });\n });\n this.inTightList = prevTight;\n};\n\n// :: (string, ?bool) → string\n// Escape the given string so that it can safely appear in Markdown\n// content. If `startOfLine` is true, also escape characters that\n// has special meaning only at the start of the line.\nMarkdownSerializerState.prototype.esc = function esc (str, startOfLine) {\n str = str.replace(/[`*\\\\~\\[\\]]/g, \"\\\\$&\");\n if (startOfLine) { str = str.replace(/^[:#\\-*+]/, \"\\\\$&\").replace(/^(\\d+)\\./, \"$1\\\\.\"); }\n return str\n};\n\nMarkdownSerializerState.prototype.quote = function quote (str) {\n var wrap = str.indexOf('\"') == -1 ? '\"\"' : str.indexOf(\"'\") == -1 ? \"''\" : \"()\";\n return wrap[0] + str + wrap[1]\n};\n\n// :: (string, number) → string\n// Repeat the given string `n` times.\nMarkdownSerializerState.prototype.repeat = function repeat (str, n) {\n var out = \"\";\n for (var i = 0; i < n; i++) { out += str; }\n return out\n};\n\n// : (Mark, bool, string?) → string\n// Get the markdown string for a given opening or closing mark.\nMarkdownSerializerState.prototype.markString = function markString (mark, open, parent, index) {\n var info = this.marks[mark.type.name];\n var value = open ? info.open : info.close;\n return typeof value == \"string\" ? value : value(this, mark, parent, index)\n};\n\n// :: (string) → { leading: ?string, trailing: ?string }\n// Get leading and trailing whitespace from a string. Values of\n// leading or trailing property of the return object will be undefined\n// if there is no match.\nMarkdownSerializerState.prototype.getEnclosingWhitespace = function getEnclosingWhitespace (text) {\n return {\n leading: (text.match(/^(\\s+)/) || [])[0],\n trailing: (text.match(/(\\s+)$/) || [])[0]\n }\n};\n\nexport { MarkdownParser, MarkdownSerializer, MarkdownSerializerState, defaultMarkdownParser, defaultMarkdownSerializer, schema };\n//# sourceMappingURL=index.es.js.map\n","'use strict'\n\nvar high = require('highlight.js/lib/highlight.js')\nvar fault = require('fault')\n\n// The lowlight interface, which has to be compatible with highlight.js, as\n// this object is passed to highlight.js syntaxes.\n\nfunction High() {}\n\nHigh.prototype = high\n\n// Expose.\nvar low = new High() // Ha!\n\nmodule.exports = low\n\nlow.highlight = highlight\nlow.highlightAuto = autoHighlight\nlow.registerLanguage = registerLanguage\nlow.listLanguages = listLanguages\nlow.registerAlias = registerAlias\nlow.getLanguage = getLanguage\n\nvar inherit = high.inherit\nvar own = {}.hasOwnProperty\n\nvar defaultPrefix = 'hljs-'\nvar keyInsensitive = 'case_insensitive'\nvar keyCachedVariants = 'cached_variants'\nvar keyTerminatorEnd = 'terminator_end'\nvar space = ' '\nvar verticalBar = '|'\nvar parenOpen = '('\nvar parenClose = ')'\nvar backslash = '\\\\'\nvar commonKeywords = ['of', 'and', 'for', 'in', 'not', 'or', 'if', 'then']\n\n// Maps of syntaxes.\nvar languageNames = []\nvar languages = {}\nvar aliases = {}\n\n// Highlighting with language detection.\n// Accepts a string with the code to highlight.\n// Returns an object with the following properties:\n//\n// * `language` — Detected language\n// * `relevance` — Integer\n// * `value` — HAST tree with highlighting markup\n// * `secondBest` — Object with the same structure for second-best\n// heuristically detected language, may be absent.\nfunction autoHighlight(value, options) {\n var settings = options || {}\n var subset = settings.subset || languageNames\n var prefix = settings.prefix\n var length = subset.length\n var index = -1\n var result\n var secondBest\n var current\n var name\n\n if (prefix === null || prefix === undefined) {\n prefix = defaultPrefix\n }\n\n if (typeof value !== 'string') {\n throw fault('Expected `string` for value, got `%s`', value)\n }\n\n secondBest = normalize({})\n result = normalize({})\n\n while (++index < length) {\n name = subset[index]\n\n if (!getLanguage(name)) {\n continue\n }\n\n current = normalize(coreHighlight(name, value, false, prefix))\n\n current.language = name\n\n if (current.relevance > secondBest.relevance) {\n secondBest = current\n }\n\n if (current.relevance > result.relevance) {\n secondBest = result\n result = current\n }\n }\n\n if (secondBest.language) {\n result.secondBest = secondBest\n }\n\n return result\n}\n\n// Highlighting `value` in the language `language`.\nfunction highlight(language, value, options) {\n var settings = options || {}\n var prefix = settings.prefix\n\n if (prefix === null || prefix === undefined) {\n prefix = defaultPrefix\n }\n\n return normalize(coreHighlight(language, value, true, prefix))\n}\n\n// Register a language.\nfunction registerLanguage(name, syntax) {\n var lang = syntax(low)\n\n lang.rawDefinition = syntax.bind(null, low)\n\n languages[name] = lang\n\n languageNames.push(name)\n\n if (lang.aliases) {\n registerAlias(name, lang.aliases)\n }\n}\n\n// Get a list of all registered languages.\nfunction listLanguages() {\n return languageNames.concat()\n}\n\n// Register more aliases for an already registered language.\nfunction registerAlias(name, alias) {\n var map = name\n var key\n var list\n var length\n var index\n\n if (alias) {\n map = {}\n map[name] = alias\n }\n\n for (key in map) {\n list = map[key]\n list = typeof list === 'string' ? [list] : list\n length = list.length\n index = -1\n\n while (++index < length) {\n aliases[list[index]] = key\n }\n }\n}\n\n// Core highlighting function.\n// Accepts a language name, or an alias, and a string with the code to\n// highlight.\n// eslint-disable-next-line max-params\nfunction coreHighlight(name, value, ignore, prefix, continuation) {\n var lastMatch = {}\n var continuations = {}\n var stack = []\n var modeBuffer = ''\n var relevance = 0\n var language\n var top\n var current\n var currentChildren\n var offset\n var count\n var match\n var children\n\n if (typeof name !== 'string') {\n throw fault('Expected `string` for name, got `%s`', name)\n }\n\n if (typeof value !== 'string') {\n throw fault('Expected `string` for value, got `%s`', value)\n }\n\n language = getLanguage(name)\n top = continuation || language\n children = []\n\n current = top\n currentChildren = children\n\n if (!language) {\n throw fault('Unknown language: `%s` is not registered', name)\n }\n\n compileLanguage(language)\n\n try {\n top.terminators.lastIndex = 0\n offset = 0\n match = top.terminators.exec(value)\n\n while (match) {\n count = processLexeme(value.slice(offset, match.index), match)\n offset = match.index + count\n top.terminators.lastIndex = offset\n match = top.terminators.exec(value)\n }\n\n processLexeme(value.slice(offset))\n current = top\n\n while (current.parent) {\n if (current.className) {\n pop()\n }\n\n current = current.parent\n }\n\n return {\n relevance: relevance,\n value: currentChildren,\n illegal: false,\n language: name,\n top: top\n }\n } catch (error) {\n /* istanbul ignore if - Catch-all */\n if (error.message.indexOf('Illegal') === -1) {\n throw error\n }\n\n return {relevance: 0, illegal: true, value: addText(value, [])}\n }\n\n function escapeRe(value) {\n return new RegExp(value.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'm')\n }\n\n function doBeginMatch(match) {\n var lexeme = match[0]\n var newMode = match.rule\n\n if (newMode && newMode.endSameAsBegin) {\n newMode.endRe = escapeRe(lexeme)\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme\n }\n\n addSiblings(processBuffer(), currentChildren)\n\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme\n }\n }\n\n startNewMode(newMode)\n\n return newMode.returnBegin ? 0 : lexeme.length\n }\n\n function doEndMatch(match) {\n var lexeme = match[0]\n var matchPlusRemainder = value.slice(match.index)\n var endMode = endOfMode(top, matchPlusRemainder)\n\n if (!endMode) {\n return\n }\n\n var origin = top\n\n if (origin.skip) {\n modeBuffer += lexeme\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme\n }\n\n addSiblings(processBuffer(), currentChildren)\n\n if (origin.excludeEnd) {\n modeBuffer = lexeme\n }\n }\n\n do {\n if (top.className) {\n pop()\n }\n\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance\n }\n\n top = top.parent\n } while (top !== endMode.parent)\n\n if (endMode.starts) {\n /* istanbul ignore if - hljs 9.16 added support for this but didn’t use it yet. */\n if (endMode.endSameAsBegin) {\n endMode.starts.endRe = endMode.endRe\n }\n\n startNewMode(endMode.starts)\n }\n\n return origin.returnEnd ? 0 : lexeme.length\n }\n\n function processLexeme(textBeforeMatch, match) {\n var lexeme = match && match[0]\n var processed\n\n // Add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch\n\n if (lexeme === undefined) {\n addSiblings(processBuffer(), currentChildren)\n return 0\n }\n\n // We've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n /* istanbul ignore if - Unknown what this fixes or which case fixes it */\n if (\n lastMatch.type === 'begin' &&\n match.type === 'end' &&\n lastMatch.index === match.index &&\n lexeme === ''\n ) {\n // Spit the “skipped” character that our regex choked on back into the output sequence\n modeBuffer += value.slice(match.index, match.index + 1)\n return 1\n }\n\n lastMatch = match\n\n if (match.type === 'begin') {\n return doBeginMatch(match)\n }\n\n if (match.type === 'end') {\n processed = doEndMatch(match)\n\n if (processed !== undefined) {\n return processed\n }\n }\n\n if (match.type === 'illegal' && !ignore) {\n // Illegal match, we do not continue processing\n throw fault(\n 'Illegal lexeme \"%s\" for mode \"%s\"',\n lexeme,\n top.className || '<unnamed>'\n )\n }\n\n // Why might be find ourselves here?\n // Only one occasion now.\n // An end match that was triggered but could not be completed.\n // When might this happen?\n // When an `endSameasBegin` rule sets the end rule to a specific match.\n // Since the overall mode termination rule that’s being used to scan the\n // text isn’t recompiled that means that any match that LOOKS like the end\n // (but is not, because it is not an exact match to the beginning) will end\n // up here.\n // A definite end match, but when `doEndMatch` tries to “reapply” the end\n // rule and fails to match, we wind up here, and just silently ignore the\n // end.\n // This causes no real harm other than stopping a few times too many.\n modeBuffer += lexeme\n\n return lexeme.length\n }\n\n // Start a new mode with a `lexeme` to process.\n function startNewMode(mode) {\n var node\n\n if (mode.className) {\n node = build(mode.className, [])\n }\n\n // Enter a new mode.\n if (node) {\n currentChildren.push(node)\n stack.push(currentChildren)\n currentChildren = node.children\n }\n\n top = Object.create(mode, {parent: {value: top}})\n }\n\n // Process the buffer.\n function processBuffer() {\n var result = top.subLanguage ? processSubLanguage() : processKeywords()\n modeBuffer = ''\n return result\n }\n\n // Process a sublanguage (returns a list of nodes).\n function processSubLanguage() {\n var explicit = typeof top.subLanguage === 'string'\n var subvalue\n\n /* istanbul ignore if - support non-loaded sublanguages */\n if (explicit && !languages[top.subLanguage]) {\n return addText(modeBuffer, [])\n }\n\n if (explicit) {\n subvalue = coreHighlight(\n top.subLanguage,\n modeBuffer,\n true,\n prefix,\n continuations[top.subLanguage]\n )\n } else {\n subvalue = autoHighlight(modeBuffer, {\n subset: top.subLanguage.length === 0 ? undefined : top.subLanguage,\n prefix: prefix\n })\n }\n\n // If we couldn’t highlight, for example because the requests subset isn’t\n // loaded, return a text node.\n if (!subvalue.language) {\n return [buildText(modeBuffer)]\n }\n\n // Counting embedded language score towards the host language may be\n // disabled with zeroing the containing mode relevance.\n // Usecase in point is Markdown that allows XML everywhere and makes every\n // XML snippet to have a much larger Markdown score.\n if (top.relevance > 0) {\n relevance += subvalue.relevance\n }\n\n if (explicit) {\n continuations[top.subLanguage] = subvalue.top\n }\n\n return [build(subvalue.language, subvalue.value, true)]\n }\n\n // Process keywords. Returns nodes.\n function processKeywords() {\n var nodes = []\n var lastIndex\n var keyword\n var node\n var submatch\n\n if (!top.keywords) {\n return addText(modeBuffer, nodes)\n }\n\n lastIndex = 0\n\n top.lexemesRe.lastIndex = 0\n\n keyword = top.lexemesRe.exec(modeBuffer)\n\n while (keyword) {\n addText(modeBuffer.slice(lastIndex, keyword.index), nodes)\n\n submatch = keywordMatch(top, keyword)\n\n if (submatch) {\n relevance += submatch[1]\n\n node = build(submatch[0], [])\n\n nodes.push(node)\n\n addText(keyword[0], node.children)\n } else {\n addText(keyword[0], nodes)\n }\n\n lastIndex = top.lexemesRe.lastIndex\n keyword = top.lexemesRe.exec(modeBuffer)\n }\n\n addText(modeBuffer.slice(lastIndex), nodes)\n\n return nodes\n }\n\n // Add siblings.\n function addSiblings(siblings, nodes) {\n var length = siblings.length\n var index = -1\n var sibling\n\n while (++index < length) {\n sibling = siblings[index]\n\n if (sibling.type === 'text') {\n addText(sibling.value, nodes)\n } else {\n nodes.push(sibling)\n }\n }\n }\n\n // Add a text.\n function addText(value, nodes) {\n var tail\n\n if (value) {\n tail = nodes[nodes.length - 1]\n\n if (tail && tail.type === 'text') {\n tail.value += value\n } else {\n nodes.push(buildText(value))\n }\n }\n\n return nodes\n }\n\n // Build a text.\n function buildText(value) {\n return {type: 'text', value: value}\n }\n\n // Build a span.\n function build(name, contents, noPrefix) {\n return {\n type: 'element',\n tagName: 'span',\n properties: {\n className: [(noPrefix ? '' : prefix) + name]\n },\n children: contents\n }\n }\n\n // Check if the first word in `keywords` is a keyword.\n function keywordMatch(mode, keywords) {\n var keyword = keywords[0]\n\n if (language[keyInsensitive]) {\n keyword = keyword.toLowerCase()\n }\n\n return own.call(mode.keywords, keyword) && mode.keywords[keyword]\n }\n\n // Check if `lexeme` ends `mode`.\n function endOfMode(mode, lexeme) {\n if (test(mode.endRe, lexeme)) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent\n }\n\n return mode\n }\n\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, lexeme)\n }\n }\n\n // Exit the current context.\n function pop() {\n /* istanbul ignore next - removed in hljs 9.3 */\n currentChildren = stack.pop() || children\n }\n}\n\n// Compile a language.\nfunction compileLanguage(language) {\n compileMode(language)\n\n // Compile a language mode, optionally with a parent.\n function compileMode(mode, parent) {\n if (mode.compiled) {\n return\n }\n\n mode.compiled = true\n\n mode.keywords = mode.keywords || mode.beginKeywords\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language[keyInsensitive])\n }\n\n mode.lexemesRe = langRe(mode.lexemes || /\\w+/, true)\n\n if (parent) {\n if (mode.beginKeywords) {\n mode.begin =\n '\\\\b(' + mode.beginKeywords.split(space).join(verticalBar) + ')\\\\b'\n }\n\n if (!mode.begin) {\n mode.begin = /\\B|\\b/\n }\n\n mode.beginRe = langRe(mode.begin)\n\n if (mode.endSameAsBegin) {\n mode.end = mode.begin\n }\n\n if (!mode.end && !mode.endsWithParent) {\n mode.end = /\\B|\\b/\n }\n\n if (mode.end) {\n mode.endRe = langRe(mode.end)\n }\n\n mode[keyTerminatorEnd] = source(mode.end) || ''\n\n if (mode.endsWithParent && parent[keyTerminatorEnd]) {\n mode[keyTerminatorEnd] +=\n (mode.end ? verticalBar : '') + parent[keyTerminatorEnd]\n }\n }\n\n if (mode.illegal) {\n mode.illegalRe = langRe(mode.illegal)\n }\n\n if (mode.relevance === undefined) {\n mode.relevance = 1\n }\n\n mode.contains = compileContains(mode.contains || [], mode)\n\n if (mode.starts) {\n compileMode(mode.starts, parent)\n }\n\n mode.terminators = buildModeRegex(mode)\n }\n\n function compileContains(contains, mode) {\n var result = []\n var length = contains.length\n var index = -1\n var contained\n\n while (++index < length) {\n contained = contains[index]\n result = result.concat(\n expandOrCloneMode(contained === 'self' ? mode : contained)\n )\n }\n\n length = result.length\n index = -1\n\n while (++index < length) {\n compileMode(result[index], mode)\n }\n\n return result\n }\n\n function buildModeRegex(mode) {\n var indices = {}\n var expression\n var regexes = []\n var matcher = {}\n var matchAt = 1\n var term\n var values = mode.contains\n var length = values.length\n var index = -1\n var terminators = []\n\n while (++index < length) {\n term = values[index]\n\n addRule(\n term,\n term.beginKeywords ? '\\\\.?(?:' + term.begin + ')\\\\.?' : term.begin\n )\n }\n\n if (mode[keyTerminatorEnd]) {\n addRule('end', mode[keyTerminatorEnd])\n }\n\n if (mode.illegal) {\n addRule('illegal', mode.illegal)\n }\n\n length = regexes.length\n index = -1\n\n while (++index < length) {\n terminators[index] = regexes[index][1]\n }\n\n expression = langRe(joinRe(terminators, verticalBar), true)\n\n matcher = {lastIndex: 0, exec: exec}\n\n return matcher\n\n function exec(value) {\n var length\n var index\n var rule\n var match\n var submatch\n\n if (regexes.length === 0) return null\n\n expression.lastIndex = matcher.lastIndex\n match = expression.exec(value)\n\n if (!match) {\n return null\n }\n\n length = match.length\n index = -1\n\n while (++index < length) {\n submatch = match[index]\n\n if (submatch !== undefined && indices[index] !== undefined) {\n rule = indices[index]\n break\n }\n }\n\n // Illegal or end match\n if (typeof rule === 'string') {\n match.type = rule\n match.extra = [mode.illegal, mode.terminator_end]\n } else {\n match.type = 'begin'\n match.rule = rule\n }\n\n return match\n }\n\n function addRule(rule, regex) {\n indices[matchAt] = rule\n regexes.push([rule, regex])\n matchAt += new RegExp(regex.toString() + verticalBar).exec('').length\n }\n }\n\n function joinRe(regexes, separator) {\n var backreferenceRe = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9]\\d*)|\\\\./\n var captures = 0\n var result = ''\n var length = regexes.length\n var index = -1\n var regex\n var offset\n var expression\n var match\n\n while (++index < length) {\n regex = regexes[index]\n expression = source(regex)\n captures += 1\n offset = captures\n\n if (index !== 0) {\n result += separator\n }\n\n result += parenOpen\n\n while (expression.length > 0) {\n match = backreferenceRe.exec(expression)\n\n if (match === null) {\n result += expression\n break\n }\n\n result += expression.slice(0, match.index)\n expression = expression.slice(match.index + match[0].length)\n\n if (match[0][0] === backslash && match[1]) {\n // Adjust the backreference.\n result += backslash + String(Number(match[1]) + offset)\n } else {\n result += match[0]\n\n if (match[0] === parenOpen) {\n captures++\n }\n }\n }\n\n result += parenClose\n }\n\n return result\n }\n\n // Create a regex for `value`.\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm' + (language[keyInsensitive] ? 'i' : '') + (global ? 'g' : '')\n )\n }\n\n // Get the source of an expression or string.\n function source(re) {\n return (re && re.source) || re\n }\n}\n\nfunction compileKeywords(values, caseInsensitive) {\n var compiled = {}\n var key\n\n if (typeof values === 'string') {\n flatten('keyword', values)\n } else {\n for (key in values) {\n flatten(key, values[key])\n }\n }\n\n return compiled\n\n function flatten(key, value) {\n var val = caseInsensitive ? value.toLowerCase() : value\n all(key, val.split(space))\n }\n\n function all(key, values) {\n var length = values.length\n var index = -1\n var pair\n\n while (++index < length) {\n pair = values[index].split(verticalBar)\n compiled[pair[0]] = [key, Number(pair[1]) || common(pair[0]) ? 0 : 1]\n }\n }\n}\n\nfunction common(value) {\n return commonKeywords.indexOf(value.toLowerCase()) !== -1\n}\n\nfunction expandOrCloneMode(mode) {\n var length\n var index\n var variants\n var result\n\n if (mode.variants && !mode[keyCachedVariants]) {\n variants = mode.variants\n length = variants.length\n index = -1\n result = []\n\n while (++index < length) {\n result[index] = inherit(mode, {variants: null}, variants[index])\n }\n\n mode[keyCachedVariants] = result\n }\n\n // Expand.\n if (mode.cached_variants) return mode.cached_variants\n\n // Clone.\n if (dependencyOnParent(mode))\n return [inherit(mode, {starts: mode.starts ? inherit(mode.starts) : null})]\n\n return [mode]\n}\n\nfunction dependencyOnParent(mode) {\n return mode ? mode.endsWithParent || dependencyOnParent(mode.starts) : false\n}\n\n// Normalize a syntax result.\nfunction normalize(result) {\n return {\n relevance: result.relevance || 0,\n language: result.language || null,\n value: result.value || []\n }\n}\n\n// Check if `expression` matches `lexeme`.\nfunction test(expression, lexeme) {\n var match = expression && expression.exec(lexeme)\n return match && match.index === 0\n}\n\n// Get a language by `name`.\nfunction getLanguage(name) {\n name = name.toLowerCase()\n\n return languages[name] || languages[aliases[name]]\n}\n","/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n(function(factory) {\n\n // Find the global object for export to both the browser and web workers.\n var globalObject = typeof window === 'object' && window ||\n typeof self === 'object' && self;\n\n // Setup highlight.js for different environments. First is Node.js or\n // CommonJS.\n // `nodeType` is checked to ensure that `exports` is not a HTML element.\n if(typeof exports !== 'undefined' && !exports.nodeType) {\n factory(exports);\n } else if(globalObject) {\n // Export hljs globally even when using AMD for cases when this script\n // is loaded with others that may still expect a global hljs.\n globalObject.hljs = factory({});\n\n // Finally register the global hljs with AMD.\n if(typeof define === 'function' && define.amd) {\n define([], function() {\n return globalObject.hljs;\n });\n }\n }\n\n}(function(hljs) {\n // Convenience variables for build-in objects\n var ArrayProto = [],\n objectKeys = Object.keys;\n\n // Global internal variables used within the highlight.js library.\n var languages = {},\n aliases = {};\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n var SAFE_MODE = true;\n\n // Regular expressions used throughout the highlight.js library.\n var noHighlightRe = /^(no-?highlight|plain|text)$/i,\n languagePrefixRe = /\\blang(?:uage)?-([\\w-]+)\\b/i,\n fixMarkupRe = /((^(<[^>]+>|\\t|)+|(?:\\n)))/gm;\n\n // The object will be assigned by the build tool. It used to synchronize API\n // of external language files with minified version of the highlight.js library.\n var API_REPLACES;\n\n var spanEndTag = '</span>';\n var LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n var options = {\n classPrefix: 'hljs-',\n tabReplace: null,\n useBR: false,\n languages: undefined\n };\n\n // keywords that should have no default relevance value\n var COMMON_KEYWORDS = 'of and for in not or if then'.split(' ');\n\n\n /* Utility functions */\n\n function escape(value) {\n return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\n }\n\n function tag(node) {\n return node.nodeName.toLowerCase();\n }\n\n function testRe(re, lexeme) {\n var match = re && re.exec(lexeme);\n return match && match.index === 0;\n }\n\n function isNotHighlighted(language) {\n return noHighlightRe.test(language);\n }\n\n function blockLanguage(block) {\n var i, match, length, _class;\n var classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n match = languagePrefixRe.exec(classes);\n if (match) {\n var language = getLanguage(match[1]);\n if (!language) {\n console.warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n console.warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n classes = classes.split(/\\s+/);\n\n for (i = 0, length = classes.length; i < length; i++) {\n _class = classes[i];\n\n if (isNotHighlighted(_class) || getLanguage(_class)) {\n return _class;\n }\n }\n }\n\n /**\n * performs a shallow merge of multiple objects into one\n *\n * @arguments list of objects with properties to merge\n * @returns a single new object\n */\n function inherit(parent) { // inherit(parent, override_obj, override_obj, ...)\n var key;\n var result = {};\n var objects = Array.prototype.slice.call(arguments, 1);\n\n for (key in parent)\n result[key] = parent[key];\n objects.forEach(function(obj) {\n for (key in obj)\n result[key] = obj[key];\n });\n return result;\n }\n\n /* Stream merging */\n\n function nodeStream(node) {\n var result = [];\n (function _nodeStream(node, offset) {\n for (var child = node.firstChild; child; child = child.nextSibling) {\n if (child.nodeType === 3)\n offset += child.nodeValue.length;\n else if (child.nodeType === 1) {\n result.push({\n event: 'start',\n offset: offset,\n node: child\n });\n offset = _nodeStream(child, offset);\n // Prevent void elements from having an end tag that would actually\n // double them in the output. There are more void elements in HTML\n // but we list only those realistically expected in code display.\n if (!tag(child).match(/br|hr|img|input/)) {\n result.push({\n event: 'stop',\n offset: offset,\n node: child\n });\n }\n }\n }\n return offset;\n })(node, 0);\n return result;\n }\n\n function mergeStreams(original, highlighted, value) {\n var processed = 0;\n var result = '';\n var nodeStack = [];\n\n function selectStream() {\n if (!original.length || !highlighted.length) {\n return original.length ? original : highlighted;\n }\n if (original[0].offset !== highlighted[0].offset) {\n return (original[0].offset < highlighted[0].offset) ? original : highlighted;\n }\n\n /*\n To avoid starting the stream just before it should stop the order is\n ensured that original always starts first and closes last:\n\n if (event1 == 'start' && event2 == 'start')\n return original;\n if (event1 == 'start' && event2 == 'stop')\n return highlighted;\n if (event1 == 'stop' && event2 == 'start')\n return original;\n if (event1 == 'stop' && event2 == 'stop')\n return highlighted;\n\n ... which is collapsed to:\n */\n return highlighted[0].event === 'start' ? original : highlighted;\n }\n\n function open(node) {\n function attr_str(a) {\n return ' ' + a.nodeName + '=\"' + escape(a.value).replace(/\"/g, '"') + '\"';\n }\n result += '<' + tag(node) + ArrayProto.map.call(node.attributes, attr_str).join('') + '>';\n }\n\n function close(node) {\n result += '</' + tag(node) + '>';\n }\n\n function render(event) {\n (event.event === 'start' ? open : close)(event.node);\n }\n\n while (original.length || highlighted.length) {\n var stream = selectStream();\n result += escape(value.substring(processed, stream[0].offset));\n processed = stream[0].offset;\n if (stream === original) {\n /*\n On any opening or closing tag of the original markup we first close\n the entire highlighted node stack, then render the original tag along\n with all the following original tags at the same offset and then\n reopen all the tags on the highlighted stack.\n */\n nodeStack.reverse().forEach(close);\n do {\n render(stream.splice(0, 1)[0]);\n stream = selectStream();\n } while (stream === original && stream.length && stream[0].offset === processed);\n nodeStack.reverse().forEach(open);\n } else {\n if (stream[0].event === 'start') {\n nodeStack.push(stream[0].node);\n } else {\n nodeStack.pop();\n }\n render(stream.splice(0, 1)[0]);\n }\n }\n return result + escape(value.substr(processed));\n }\n\n /* Initialization */\n\n function dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n }\n\n function expand_or_clone_mode(mode) {\n if (mode.variants && !mode.cached_variants) {\n mode.cached_variants = mode.variants.map(function(variant) {\n return inherit(mode, {variants: null}, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cached_variants)\n return mode.cached_variants;\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode))\n return [inherit(mode, { starts: mode.starts ? inherit(mode.starts) : null })];\n\n if (Object.isFrozen(mode))\n return [inherit(mode)];\n\n // no special dependency issues, just return ourselves\n return [mode];\n }\n\n function restoreLanguageApi(obj) {\n if(API_REPLACES && !obj.langApiRestored) {\n obj.langApiRestored = true;\n for(var key in API_REPLACES) {\n if (obj[key]) {\n obj[API_REPLACES[key]] = obj[key];\n }\n }\n (obj.contains || []).concat(obj.variants || []).forEach(restoreLanguageApi);\n }\n }\n\n function compileKeywords(rawKeywords, case_insensitive) {\n var compiled_keywords = {};\n\n if (typeof rawKeywords === 'string') { // string\n splitAndCompile('keyword', rawKeywords);\n } else {\n objectKeys(rawKeywords).forEach(function (className) {\n splitAndCompile(className, rawKeywords[className]);\n });\n }\n return compiled_keywords;\n\n // ---\n\n function splitAndCompile(className, str) {\n if (case_insensitive) {\n str = str.toLowerCase();\n }\n str.split(' ').forEach(function(keyword) {\n var pair = keyword.split('|');\n compiled_keywords[pair[0]] = [className, scoreForKeyword(pair[0], pair[1])];\n });\n }\n }\n\n function scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore)\n return Number(providedScore);\n\n return commonKeyword(keyword) ? 0 : 1;\n }\n\n function commonKeyword(word) {\n return COMMON_KEYWORDS.indexOf(word.toLowerCase()) != -1;\n }\n\n function compileLanguage(language) {\n\n function reStr(re) {\n return (re && re.source) || re;\n }\n\n function langRe(value, global) {\n return new RegExp(\n reStr(value),\n 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')\n );\n }\n\n function reCountMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n }\n\n // joinRe logically computes regexps.join(separator), but fixes the\n // backreferences so they continue to match.\n // it also places each individual regular expression into it's own\n // match group, keeping track of the sequencing of those match groups\n // is currently an exercise for the caller. :-)\n function joinRe(regexps, separator) {\n // backreferenceRe matches an open parenthesis or backreference. To avoid\n // an incorrect parse, it additionally matches the following:\n // - [...] elements, where the meaning of parentheses and escapes change\n // - other escape sequences, so we do not misparse escape sequences as\n // interesting elements\n // - non-matching or lookahead parentheses, which do not capture. These\n // follow the '(' with a '?'.\n var backreferenceRe = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n var numCaptures = 0;\n var ret = '';\n for (var i = 0; i < regexps.length; i++) {\n numCaptures += 1;\n var offset = numCaptures;\n var re = reStr(regexps[i]);\n if (i > 0) {\n ret += separator;\n }\n ret += \"(\";\n while (re.length > 0) {\n var match = backreferenceRe.exec(re);\n if (match == null) {\n ret += re;\n break;\n }\n ret += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] == '\\\\' && match[1]) {\n // Adjust the backreference.\n ret += '\\\\' + String(Number(match[1]) + offset);\n } else {\n ret += match[0];\n if (match[0] == '(') {\n numCaptures++;\n }\n }\n }\n ret += \")\";\n }\n return ret;\n }\n\n function buildModeRegex(mode) {\n\n var matchIndexes = {};\n var matcherRe;\n var regexes = [];\n var matcher = {};\n var matchAt = 1;\n\n function addRule(rule, regex) {\n matchIndexes[matchAt] = rule;\n regexes.push([rule, regex]);\n matchAt += reCountMatchGroups(regex) + 1;\n }\n\n var term;\n for (var i=0; i < mode.contains.length; i++) {\n var re;\n term = mode.contains[i];\n if (term.beginKeywords) {\n re = '\\\\.?(?:' + term.begin + ')\\\\.?';\n } else {\n re = term.begin;\n }\n addRule(term, re);\n }\n if (mode.terminator_end)\n addRule(\"end\", mode.terminator_end);\n if (mode.illegal)\n addRule(\"illegal\", mode.illegal);\n\n var terminators = regexes.map(function(el) { return el[1]; });\n matcherRe = langRe(joinRe(terminators, '|'), true);\n\n matcher.lastIndex = 0;\n matcher.exec = function(s) {\n var rule;\n\n if( regexes.length === 0) return null;\n\n matcherRe.lastIndex = matcher.lastIndex;\n var match = matcherRe.exec(s);\n if (!match) { return null; }\n\n for(var i = 0; i<match.length; i++) {\n if (match[i] != undefined && matchIndexes[\"\" +i] != undefined ) {\n rule = matchIndexes[\"\"+i];\n break;\n }\n }\n\n // illegal or end match\n if (typeof rule === \"string\") {\n match.type = rule;\n match.extra = [mode.illegal, mode.terminator_end];\n } else {\n match.type = \"begin\";\n match.rule = rule;\n }\n return match;\n };\n\n return matcher;\n }\n\n function compileMode(mode, parent) {\n if (mode.compiled)\n return;\n mode.compiled = true;\n\n mode.keywords = mode.keywords || mode.beginKeywords;\n if (mode.keywords)\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n\n mode.lexemesRe = langRe(mode.lexemes || /\\w+/, true);\n\n if (parent) {\n if (mode.beginKeywords) {\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\\\b';\n }\n if (!mode.begin)\n mode.begin = /\\B|\\b/;\n mode.beginRe = langRe(mode.begin);\n if (mode.endSameAsBegin)\n mode.end = mode.begin;\n if (!mode.end && !mode.endsWithParent)\n mode.end = /\\B|\\b/;\n if (mode.end)\n mode.endRe = langRe(mode.end);\n mode.terminator_end = reStr(mode.end) || '';\n if (mode.endsWithParent && parent.terminator_end)\n mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end;\n }\n if (mode.illegal)\n mode.illegalRe = langRe(mode.illegal);\n if (mode.relevance == null)\n mode.relevance = 1;\n if (!mode.contains) {\n mode.contains = [];\n }\n mode.contains = Array.prototype.concat.apply([], mode.contains.map(function(c) {\n return expand_or_clone_mode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) {compileMode(c, mode);});\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n mode.terminators = buildModeRegex(mode);\n }\n\n // self is not valid at the top-level\n if (language.contains && language.contains.indexOf('self') != -1) {\n if (!SAFE_MODE) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\")\n } else {\n // silently remove the broken rule (effectively ignoring it), this has historically\n // been the behavior in the past, so this removal preserves compatibility with broken\n // grammars when running in Safe Mode\n language.contains = language.contains.filter(function(mode) { return mode != 'self'; });\n }\n }\n compileMode(language);\n }\n\n\n /**\n * Core highlighting function.\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} code - the code to highlight\n * @param {boolean} ignore_illegals - whether to ignore illegal matches, default is to bail\n * @param {array<mode>} continuation - array of continuation modes\n *\n * @returns an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {mode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(languageName, code, ignore_illegals, continuation) {\n var codeToHighlight = code;\n\n function escapeRe(value) {\n return new RegExp(value.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'm');\n }\n\n function endOfMode(mode, lexeme) {\n if (testRe(mode.endRe, lexeme)) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, lexeme);\n }\n }\n\n function keywordMatch(mode, match) {\n var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0];\n return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str];\n }\n\n function buildSpan(className, insideSpan, leaveOpen, noPrefix) {\n if (!leaveOpen && insideSpan === '') return '';\n if (!className) return insideSpan;\n\n var classPrefix = noPrefix ? '' : options.classPrefix,\n openSpan = '<span class=\"' + classPrefix,\n closeSpan = leaveOpen ? '' : spanEndTag;\n\n openSpan += className + '\">';\n\n return openSpan + insideSpan + closeSpan;\n }\n\n function processKeywords() {\n var keyword_match, last_index, match, result;\n\n if (!top.keywords)\n return escape(mode_buffer);\n\n result = '';\n last_index = 0;\n top.lexemesRe.lastIndex = 0;\n match = top.lexemesRe.exec(mode_buffer);\n\n while (match) {\n result += escape(mode_buffer.substring(last_index, match.index));\n keyword_match = keywordMatch(top, match);\n if (keyword_match) {\n relevance += keyword_match[1];\n result += buildSpan(keyword_match[0], escape(match[0]));\n } else {\n result += escape(match[0]);\n }\n last_index = top.lexemesRe.lastIndex;\n match = top.lexemesRe.exec(mode_buffer);\n }\n return result + escape(mode_buffer.substr(last_index));\n }\n\n function processSubLanguage() {\n var explicit = typeof top.subLanguage === 'string';\n if (explicit && !languages[top.subLanguage]) {\n return escape(mode_buffer);\n }\n\n var result = explicit ?\n highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]) :\n highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : undefined);\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n if (explicit) {\n continuations[top.subLanguage] = result.top;\n }\n return buildSpan(result.language, result.value, false, true);\n }\n\n function processBuffer() {\n result += (top.subLanguage != null ? processSubLanguage() : processKeywords());\n mode_buffer = '';\n }\n\n function startNewMode(mode) {\n result += mode.className? buildSpan(mode.className, '', true): '';\n top = Object.create(mode, {parent: {value: top}});\n }\n\n\n function doBeginMatch(match) {\n var lexeme = match[0];\n var new_mode = match.rule;\n\n if (new_mode && new_mode.endSameAsBegin) {\n new_mode.endRe = escapeRe( lexeme );\n }\n\n if (new_mode.skip) {\n mode_buffer += lexeme;\n } else {\n if (new_mode.excludeBegin) {\n mode_buffer += lexeme;\n }\n processBuffer();\n if (!new_mode.returnBegin && !new_mode.excludeBegin) {\n mode_buffer = lexeme;\n }\n }\n startNewMode(new_mode);\n return new_mode.returnBegin ? 0 : lexeme.length;\n }\n\n function doEndMatch(match) {\n var lexeme = match[0];\n var matchPlusRemainder = codeToHighlight.substr(match.index);\n var end_mode = endOfMode(top, matchPlusRemainder);\n if (!end_mode) { return; }\n\n var origin = top;\n if (origin.skip) {\n mode_buffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n mode_buffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n mode_buffer = lexeme;\n }\n }\n do {\n if (top.className) {\n result += spanEndTag;\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== end_mode.parent);\n if (end_mode.starts) {\n if (end_mode.endSameAsBegin) {\n end_mode.starts.endRe = end_mode.endRe;\n }\n startNewMode(end_mode.starts);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n var lastMatch = {};\n function processLexeme(text_before_match, match) {\n\n var lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n mode_buffer += text_before_match;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type==\"begin\" && match.type==\"end\" && lastMatch.index == match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n mode_buffer += codeToHighlight.slice(match.index, match.index + 1);\n return 1;\n }\n lastMatch = match;\n\n if (match.type===\"begin\") {\n return doBeginMatch(match);\n } else if (match.type===\"illegal\" && !ignore_illegals) {\n // illegal match, we do not continue processing\n throw new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.className || '<unnamed>') + '\"');\n } else if (match.type===\"end\") {\n var processed = doEndMatch(match);\n if (processed != undefined)\n return processed;\n }\n\n /*\n Why might be find ourselves here? Only one occasion now. An end match that was\n triggered but could not be completed. When might this happen? When an `endSameasBegin`\n rule sets the end rule to a specific match. Since the overall mode termination rule that's\n being used to scan the text isn't recompiled that means that any match that LOOKS like\n the end (but is not, because it is not an exact match to the beginning) will\n end up here. A definite end match, but when `doEndMatch` tries to \"reapply\"\n the end rule and fails to match, we wind up here, and just silently ignore the end.\n\n This causes no real harm other than stopping a few times too many.\n */\n\n mode_buffer += lexeme;\n return lexeme.length;\n }\n\n var language = getLanguage(languageName);\n if (!language) {\n console.error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n compileLanguage(language);\n var top = continuation || language;\n var continuations = {}; // keep continuations for sub-languages\n var result = '', current;\n for(current = top; current !== language; current = current.parent) {\n if (current.className) {\n result = buildSpan(current.className, '', true) + result;\n }\n }\n var mode_buffer = '';\n var relevance = 0;\n try {\n var match, count, index = 0;\n while (true) {\n top.terminators.lastIndex = index;\n match = top.terminators.exec(codeToHighlight);\n if (!match)\n break;\n count = processLexeme(codeToHighlight.substring(index, match.index), match);\n index = match.index + count;\n }\n processLexeme(codeToHighlight.substr(index));\n for(current = top; current.parent; current = current.parent) { // close dangling modes\n if (current.className) {\n result += spanEndTag;\n }\n }\n return {\n relevance: relevance,\n value: result,\n illegal:false,\n language: languageName,\n top: top\n };\n } catch (err) {\n if (err.message && err.message.indexOf('Illegal') !== -1) {\n return {\n illegal: true,\n relevance: 0,\n value: escape(codeToHighlight)\n };\n } else if (SAFE_MODE) {\n return {\n relevance: 0,\n value: escape(codeToHighlight),\n language: languageName,\n top: top,\n errorRaised: err\n };\n } else {\n throw err;\n }\n }\n }\n\n /*\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - second_best (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || objectKeys(languages);\n var result = {\n relevance: 0,\n value: escape(code)\n };\n var second_best = result;\n languageSubset.filter(getLanguage).filter(autoDetection).forEach(function(name) {\n var current = highlight(name, code, false);\n current.language = name;\n if (current.relevance > second_best.relevance) {\n second_best = current;\n }\n if (current.relevance > result.relevance) {\n second_best = result;\n result = current;\n }\n });\n if (second_best.language) {\n result.second_best = second_best;\n }\n return result;\n }\n\n /*\n Post-processing of the highlighted markup:\n\n - replace TABs with something more useful\n - replace real line-breaks with '<br>' for non-pre containers\n\n */\n function fixMarkup(value) {\n if (!(options.tabReplace || options.useBR)) {\n return value;\n }\n\n return value.replace(fixMarkupRe, function(match, p1) {\n if (options.useBR && match === '\\n') {\n return '<br>';\n } else if (options.tabReplace) {\n return p1.replace(/\\t/g, options.tabReplace);\n }\n return '';\n });\n }\n\n function buildClassName(prevClassName, currentLang, resultLang) {\n var language = currentLang ? aliases[currentLang] : resultLang,\n result = [prevClassName.trim()];\n\n if (!prevClassName.match(/\\bhljs\\b/)) {\n result.push('hljs');\n }\n\n if (prevClassName.indexOf(language) === -1) {\n result.push(language);\n }\n\n return result.join(' ').trim();\n }\n\n /*\n Applies highlighting to a DOM node containing code. Accepts a DOM node and\n two optional parameters for fixMarkup.\n */\n function highlightBlock(block) {\n var node, originalStream, result, resultNode, text;\n var language = blockLanguage(block);\n\n if (isNotHighlighted(language))\n return;\n\n if (options.useBR) {\n node = document.createElement('div');\n node.innerHTML = block.innerHTML.replace(/\\n/g, '').replace(/<br[ \\/]*>/g, '\\n');\n } else {\n node = block;\n }\n text = node.textContent;\n result = language ? highlight(language, text, true) : highlightAuto(text);\n\n originalStream = nodeStream(node);\n if (originalStream.length) {\n resultNode = document.createElement('div');\n resultNode.innerHTML = result.value;\n result.value = mergeStreams(originalStream, nodeStream(resultNode), text);\n }\n result.value = fixMarkup(result.value);\n\n block.innerHTML = result.value;\n block.className = buildClassName(block.className, language, result.language);\n block.result = {\n language: result.language,\n re: result.relevance\n };\n if (result.second_best) {\n block.second_best = {\n language: result.second_best.language,\n re: result.second_best.relevance\n };\n }\n }\n\n /*\n Updates highlight.js global options with values passed in the form of an object.\n */\n function configure(user_options) {\n options = inherit(options, user_options);\n }\n\n /*\n Applies highlighting to all <pre><code>..</code></pre> blocks on a page.\n */\n function initHighlighting() {\n if (initHighlighting.called)\n return;\n initHighlighting.called = true;\n\n var blocks = document.querySelectorAll('pre code');\n ArrayProto.forEach.call(blocks, highlightBlock);\n }\n\n /*\n Attaches highlighting to the page load event.\n */\n function initHighlightingOnLoad() {\n window.addEventListener('DOMContentLoaded', initHighlighting, false);\n window.addEventListener('load', initHighlighting, false);\n }\n\n var PLAINTEXT_LANGUAGE = { disableAutodetect: true };\n\n function registerLanguage(name, language) {\n var lang;\n try { lang = language(hljs); }\n catch (error) {\n console.error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", name));\n // hard or soft error\n if (!SAFE_MODE) { throw error; } else { console.error(error); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n languages[name] = lang;\n restoreLanguageApi(lang);\n lang.rawDefinition = language.bind(null,hljs);\n\n if (lang.aliases) {\n lang.aliases.forEach(function(alias) {aliases[alias] = name;});\n }\n }\n\n function listLanguages() {\n return objectKeys(languages);\n }\n\n /*\n intended usage: When one language truly requires another\n\n Unlike `getLanguage`, this will throw when the requested language\n is not available.\n */\n function requireLanguage(name) {\n var lang = getLanguage(name);\n if (lang) { return lang; }\n\n var err = new Error('The \\'{}\\' language is required, but not loaded.'.replace('{}',name));\n throw err;\n }\n\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n function autoDetection(name) {\n var lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /* Interface definition */\n\n hljs.highlight = highlight;\n hljs.highlightAuto = highlightAuto;\n hljs.fixMarkup = fixMarkup;\n hljs.highlightBlock = highlightBlock;\n hljs.configure = configure;\n hljs.initHighlighting = initHighlighting;\n hljs.initHighlightingOnLoad = initHighlightingOnLoad;\n hljs.registerLanguage = registerLanguage;\n hljs.listLanguages = listLanguages;\n hljs.getLanguage = getLanguage;\n hljs.requireLanguage = requireLanguage;\n hljs.autoDetection = autoDetection;\n hljs.inherit = inherit;\n hljs.debugMode = function() { SAFE_MODE = false; }\n\n // Common regexps\n hljs.IDENT_RE = '[a-zA-Z]\\\\w*';\n hljs.UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\n hljs.NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\n hljs.C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\n hljs.BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\n hljs.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n // Common modes\n hljs.BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n };\n hljs.APOS_STRING_MODE = {\n className: 'string',\n begin: '\\'', end: '\\'',\n illegal: '\\\\n',\n contains: [hljs.BACKSLASH_ESCAPE]\n };\n hljs.QUOTE_STRING_MODE = {\n className: 'string',\n begin: '\"', end: '\"',\n illegal: '\\\\n',\n contains: [hljs.BACKSLASH_ESCAPE]\n };\n hljs.PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n };\n hljs.COMMENT = function (begin, end, inherits) {\n var mode = hljs.inherit(\n {\n className: 'comment',\n begin: begin, end: end,\n contains: []\n },\n inherits || {}\n );\n mode.contains.push(hljs.PHRASAL_WORDS_MODE);\n mode.contains.push({\n className: 'doctag',\n begin: '(?:TODO|FIXME|NOTE|BUG|XXX):',\n relevance: 0\n });\n return mode;\n };\n hljs.C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$');\n hljs.C_BLOCK_COMMENT_MODE = hljs.COMMENT('/\\\\*', '\\\\*/');\n hljs.HASH_COMMENT_MODE = hljs.COMMENT('#', '$');\n hljs.NUMBER_MODE = {\n className: 'number',\n begin: hljs.NUMBER_RE,\n relevance: 0\n };\n hljs.C_NUMBER_MODE = {\n className: 'number',\n begin: hljs.C_NUMBER_RE,\n relevance: 0\n };\n hljs.BINARY_NUMBER_MODE = {\n className: 'number',\n begin: hljs.BINARY_NUMBER_RE,\n relevance: 0\n };\n hljs.CSS_NUMBER_MODE = {\n className: 'number',\n begin: hljs.NUMBER_RE + '(' +\n '%|em|ex|ch|rem' +\n '|vw|vh|vmin|vmax' +\n '|cm|mm|in|pt|pc|px' +\n '|deg|grad|rad|turn' +\n '|s|ms' +\n '|Hz|kHz' +\n '|dpi|dpcm|dppx' +\n ')?',\n relevance: 0\n };\n hljs.REGEXP_MODE = {\n className: 'regexp',\n begin: /\\//, end: /\\/[gimuy]*/,\n illegal: /\\n/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n {\n begin: /\\[/, end: /\\]/,\n relevance: 0,\n contains: [hljs.BACKSLASH_ESCAPE]\n }\n ]\n };\n hljs.TITLE_MODE = {\n className: 'title',\n begin: hljs.IDENT_RE,\n relevance: 0\n };\n hljs.UNDERSCORE_TITLE_MODE = {\n className: 'title',\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n };\n hljs.METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n };\n\n var constants = [\n hljs.BACKSLASH_ESCAPE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.PHRASAL_WORDS_MODE,\n hljs.COMMENT,\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.HASH_COMMENT_MODE,\n hljs.NUMBER_MODE,\n hljs.C_NUMBER_MODE,\n hljs.BINARY_NUMBER_MODE,\n hljs.CSS_NUMBER_MODE,\n hljs.REGEXP_MODE,\n hljs.TITLE_MODE,\n hljs.UNDERSCORE_TITLE_MODE,\n hljs.METHOD_GUARD\n ]\n constants.forEach(function(obj) { deepFreeze(obj); });\n\n // https://github.com/substack/deep-freeze/blob/master/index.js\n function deepFreeze (o) {\n Object.freeze(o);\n\n var objIsFunction = typeof o === 'function';\n\n Object.getOwnPropertyNames(o).forEach(function (prop) {\n if (o.hasOwnProperty(prop)\n && o[prop] !== null\n && (typeof o[prop] === \"object\" || typeof o[prop] === \"function\")\n // IE11 fix: https://github.com/highlightjs/highlight.js/issues/2318\n // TODO: remove in the future\n && (objIsFunction ? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments' : true)\n && !Object.isFrozen(o[prop])) {\n deepFreeze(o[prop]);\n }\n });\n\n return o;\n };\n\n\n return hljs;\n}));\n","'use strict'\n\nvar formatter = require('format')\n\nvar fault = create(Error)\n\nmodule.exports = fault\n\nfault.eval = create(EvalError)\nfault.range = create(RangeError)\nfault.reference = create(ReferenceError)\nfault.syntax = create(SyntaxError)\nfault.type = create(TypeError)\nfault.uri = create(URIError)\n\nfault.create = create\n\n// Create a new `EConstructor`, with the formatted `format` as a first argument.\nfunction create(EConstructor) {\n FormattedError.displayName = EConstructor.displayName || EConstructor.name\n\n return FormattedError\n\n function FormattedError(format) {\n if (format) {\n format = formatter.apply(null, arguments)\n }\n\n return new EConstructor(format)\n }\n}\n","//\n// format - printf-like string formatting for JavaScript\n// github.com/samsonjs/format\n// @_sjs\n//\n// Copyright 2010 - 2013 Sami Samhuri <sami@samhuri.net>\n//\n// MIT License\n// http://sjs.mit-license.org\n//\n\n;(function() {\n\n //// Export the API\n var namespace;\n\n // CommonJS / Node module\n if (typeof module !== 'undefined') {\n namespace = module.exports = format;\n }\n\n // Browsers and other environments\n else {\n // Get the global object. Works in ES3, ES5, and ES5 strict mode.\n namespace = (function(){ return this || (1,eval)('this') }());\n }\n\n namespace.format = format;\n namespace.vsprintf = vsprintf;\n\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n namespace.printf = printf;\n }\n\n function printf(/* ... */) {\n console.log(format.apply(null, arguments));\n }\n\n function vsprintf(fmt, replacements) {\n return format.apply(null, [fmt].concat(replacements));\n }\n\n function format(fmt) {\n var argIndex = 1 // skip initial format argument\n , args = [].slice.call(arguments)\n , i = 0\n , n = fmt.length\n , result = ''\n , c\n , escaped = false\n , arg\n , tmp\n , leadingZero = false\n , precision\n , nextArg = function() { return args[argIndex++]; }\n , slurpNumber = function() {\n var digits = '';\n while (/\\d/.test(fmt[i])) {\n digits += fmt[i++];\n c = fmt[i];\n }\n return digits.length > 0 ? parseInt(digits) : null;\n }\n ;\n for (; i < n; ++i) {\n c = fmt[i];\n if (escaped) {\n escaped = false;\n if (c == '.') {\n leadingZero = false;\n c = fmt[++i];\n }\n else if (c == '0' && fmt[i + 1] == '.') {\n leadingZero = true;\n i += 2;\n c = fmt[i];\n }\n else {\n leadingZero = true;\n }\n precision = slurpNumber();\n switch (c) {\n case 'b': // number in binary\n result += parseInt(nextArg(), 10).toString(2);\n break;\n case 'c': // character\n arg = nextArg();\n if (typeof arg === 'string' || arg instanceof String)\n result += arg;\n else\n result += String.fromCharCode(parseInt(arg, 10));\n break;\n case 'd': // number in decimal\n result += parseInt(nextArg(), 10);\n break;\n case 'f': // floating point number\n tmp = String(parseFloat(nextArg()).toFixed(precision || 6));\n result += leadingZero ? tmp : tmp.replace(/^0/, '');\n break;\n case 'j': // JSON\n result += JSON.stringify(nextArg());\n break;\n case 'o': // number in octal\n result += '0' + parseInt(nextArg(), 10).toString(8);\n break;\n case 's': // string\n result += nextArg();\n break;\n case 'x': // lowercase hexadecimal\n result += '0x' + parseInt(nextArg(), 10).toString(16);\n break;\n case 'X': // uppercase hexadecimal\n result += '0x' + parseInt(nextArg(), 10).toString(16).toUpperCase();\n break;\n default:\n result += c;\n break;\n }\n } else if (c === '%') {\n escaped = true;\n } else {\n result += c;\n }\n }\n return result;\n }\n\n}());\n","// Main parser class\n\n'use strict';\n\n\nvar utils = require('./common/utils');\nvar helpers = require('./helpers');\nvar Renderer = require('./renderer');\nvar ParserCore = require('./parser_core');\nvar ParserBlock = require('./parser_block');\nvar ParserInline = require('./parser_inline');\nvar LinkifyIt = require('linkify-it');\nvar mdurl = require('mdurl');\nvar punycode = require('punycode');\n\n\nvar config = {\n 'default': require('./presets/default'),\n zero: require('./presets/zero'),\n commonmark: require('./presets/commonmark')\n};\n\n////////////////////////////////////////////////////////////////////////////////\n//\n// This validator can prohibit more than really needed to prevent XSS. It's a\n// tradeoff to keep code simple and to be secure by default.\n//\n// If you need different setup - override validator method as you wish. Or\n// replace it with dummy function and use external sanitizer.\n//\n\nvar BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;\nvar GOOD_DATA_RE = /^data:image\\/(gif|png|jpeg|webp);/;\n\nfunction validateLink(url) {\n // url should be normalized at this point, and existing entities are decoded\n var str = url.trim().toLowerCase();\n\n return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\n\nvar RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ];\n\nfunction normalizeLink(url) {\n var parsed = mdurl.parse(url, true);\n\n if (parsed.hostname) {\n // Encode hostnames in urls like:\n // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`\n //\n // We don't encode unknown schemas, because it's likely that we encode\n // something we shouldn't (e.g. `skype:name` treated as `skype:host`)\n //\n if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {\n try {\n parsed.hostname = punycode.toASCII(parsed.hostname);\n } catch (er) { /**/ }\n }\n }\n\n return mdurl.encode(mdurl.format(parsed));\n}\n\nfunction normalizeLinkText(url) {\n var parsed = mdurl.parse(url, true);\n\n if (parsed.hostname) {\n // Encode hostnames in urls like:\n // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`\n //\n // We don't encode unknown schemas, because it's likely that we encode\n // something we shouldn't (e.g. `skype:name` treated as `skype:host`)\n //\n if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {\n try {\n parsed.hostname = punycode.toUnicode(parsed.hostname);\n } catch (er) { /**/ }\n }\n }\n\n return mdurl.decode(mdurl.format(parsed));\n}\n\n\n/**\n * class MarkdownIt\n *\n * Main parser/renderer class.\n *\n * ##### Usage\n *\n * ```javascript\n * // node.js, \"classic\" way:\n * var MarkdownIt = require('markdown-it'),\n * md = new MarkdownIt();\n * var result = md.render('# markdown-it rulezz!');\n *\n * // node.js, the same, but with sugar:\n * var md = require('markdown-it')();\n * var result = md.render('# markdown-it rulezz!');\n *\n * // browser without AMD, added to \"window\" on script load\n * // Note, there are no dash.\n * var md = window.markdownit();\n * var result = md.render('# markdown-it rulezz!');\n * ```\n *\n * Single line rendering, without paragraph wrap:\n *\n * ```javascript\n * var md = require('markdown-it')();\n * var result = md.renderInline('__markdown-it__ rulezz!');\n * ```\n **/\n\n/**\n * new MarkdownIt([presetName, options])\n * - presetName (String): optional, `commonmark` / `zero`\n * - options (Object)\n *\n * Creates parser instanse with given config. Can be called without `new`.\n *\n * ##### presetName\n *\n * MarkdownIt provides named presets as a convenience to quickly\n * enable/disable active syntax rules and options for common use cases.\n *\n * - [\"commonmark\"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -\n * configures parser to strict [CommonMark](http://commonmark.org/) mode.\n * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -\n * similar to GFM, used when no preset name given. Enables all available rules,\n * but still without html, typographer & autolinker.\n * - [\"zero\"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -\n * all rules disabled. Useful to quickly setup your config via `.enable()`.\n * For example, when you need only `bold` and `italic` markup and nothing else.\n *\n * ##### options:\n *\n * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!\n * That's not safe! You may need external sanitizer to protect output from XSS.\n * It's better to extend features via plugins, instead of enabling HTML.\n * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags\n * (`<br />`). This is needed only for full CommonMark compatibility. In real\n * world you will need HTML output.\n * - __breaks__ - `false`. Set `true` to convert `\\n` in paragraphs into `<br>`.\n * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.\n * Can be useful for external highlighters.\n * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.\n * - __typographer__ - `false`. Set `true` to enable [some language-neutral\n * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +\n * quotes beautification (smartquotes).\n * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement\n * pairs, when typographer enabled and smartquotes on. For example, you can\n * use `'«»„“'` for Russian, `'„“‚‘'` for German, and\n * `['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›']` for French (including nbsp).\n * - __highlight__ - `null`. Highlighter function for fenced code blocks.\n * Highlighter `function (str, lang)` should return escaped HTML. It can also\n * return empty string if the source was not changed and should be escaped\n * externaly. If result starts with <pre... internal wrapper is skipped.\n *\n * ##### Example\n *\n * ```javascript\n * // commonmark mode\n * var md = require('markdown-it')('commonmark');\n *\n * // default mode\n * var md = require('markdown-it')();\n *\n * // enable everything\n * var md = require('markdown-it')({\n * html: true,\n * linkify: true,\n * typographer: true\n * });\n * ```\n *\n * ##### Syntax highlighting\n *\n * ```js\n * var hljs = require('highlight.js') // https://highlightjs.org/\n *\n * var md = require('markdown-it')({\n * highlight: function (str, lang) {\n * if (lang && hljs.getLanguage(lang)) {\n * try {\n * return hljs.highlight(lang, str, true).value;\n * } catch (__) {}\n * }\n *\n * return ''; // use external default escaping\n * }\n * });\n * ```\n *\n * Or with full wrapper override (if you need assign class to `<pre>`):\n *\n * ```javascript\n * var hljs = require('highlight.js') // https://highlightjs.org/\n *\n * // Actual default values\n * var md = require('markdown-it')({\n * highlight: function (str, lang) {\n * if (lang && hljs.getLanguage(lang)) {\n * try {\n * return '<pre class=\"hljs\"><code>' +\n * hljs.highlight(lang, str, true).value +\n * '</code></pre>';\n * } catch (__) {}\n * }\n *\n * return '<pre class=\"hljs\"><code>' + md.utils.escapeHtml(str) + '</code></pre>';\n * }\n * });\n * ```\n *\n **/\nfunction MarkdownIt(presetName, options) {\n if (!(this instanceof MarkdownIt)) {\n return new MarkdownIt(presetName, options);\n }\n\n if (!options) {\n if (!utils.isString(presetName)) {\n options = presetName || {};\n presetName = 'default';\n }\n }\n\n /**\n * MarkdownIt#inline -> ParserInline\n *\n * Instance of [[ParserInline]]. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.inline = new ParserInline();\n\n /**\n * MarkdownIt#block -> ParserBlock\n *\n * Instance of [[ParserBlock]]. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.block = new ParserBlock();\n\n /**\n * MarkdownIt#core -> Core\n *\n * Instance of [[Core]] chain executor. You may need it to add new rules when\n * writing plugins. For simple rules control use [[MarkdownIt.disable]] and\n * [[MarkdownIt.enable]].\n **/\n this.core = new ParserCore();\n\n /**\n * MarkdownIt#renderer -> Renderer\n *\n * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering\n * rules for new token types, generated by plugins.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * function myToken(tokens, idx, options, env, self) {\n * //...\n * return result;\n * };\n *\n * md.renderer.rules['my_token'] = myToken\n * ```\n *\n * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).\n **/\n this.renderer = new Renderer();\n\n /**\n * MarkdownIt#linkify -> LinkifyIt\n *\n * [linkify-it](https://github.com/markdown-it/linkify-it) instance.\n * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)\n * rule.\n **/\n this.linkify = new LinkifyIt();\n\n /**\n * MarkdownIt#validateLink(url) -> Boolean\n *\n * Link validation function. CommonMark allows too much in links. By default\n * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas\n * except some embedded image types.\n *\n * You can change this behaviour:\n *\n * ```javascript\n * var md = require('markdown-it')();\n * // enable everything\n * md.validateLink = function () { return true; }\n * ```\n **/\n this.validateLink = validateLink;\n\n /**\n * MarkdownIt#normalizeLink(url) -> String\n *\n * Function used to encode link url to a machine-readable format,\n * which includes url-encoding, punycode, etc.\n **/\n this.normalizeLink = normalizeLink;\n\n /**\n * MarkdownIt#normalizeLinkText(url) -> String\n *\n * Function used to decode link url to a human-readable format`\n **/\n this.normalizeLinkText = normalizeLinkText;\n\n\n // Expose utils & helpers for easy acces from plugins\n\n /**\n * MarkdownIt#utils -> utils\n *\n * Assorted utility functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).\n **/\n this.utils = utils;\n\n /**\n * MarkdownIt#helpers -> helpers\n *\n * Link components parser functions, useful to write plugins. See details\n * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).\n **/\n this.helpers = utils.assign({}, helpers);\n\n\n this.options = {};\n this.configure(presetName);\n\n if (options) { this.set(options); }\n}\n\n\n/** chainable\n * MarkdownIt.set(options)\n *\n * Set parser options (in the same format as in constructor). Probably, you\n * will never need it, but you can change options after constructor call.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')()\n * .set({ html: true, breaks: true })\n * .set({ typographer, true });\n * ```\n *\n * __Note:__ To achieve the best possible performance, don't modify a\n * `markdown-it` instance options on the fly. If you need multiple configurations\n * it's best to create multiple instances and initialize each with separate\n * config.\n **/\nMarkdownIt.prototype.set = function (options) {\n utils.assign(this.options, options);\n return this;\n};\n\n\n/** chainable, internal\n * MarkdownIt.configure(presets)\n *\n * Batch load of all options and compenent settings. This is internal method,\n * and you probably will not need it. But if you with - see available presets\n * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)\n *\n * We strongly recommend to use presets instead of direct config loads. That\n * will give better compatibility with next versions.\n **/\nMarkdownIt.prototype.configure = function (presets) {\n var self = this, presetName;\n\n if (utils.isString(presets)) {\n presetName = presets;\n presets = config[presetName];\n if (!presets) { throw new Error('Wrong `markdown-it` preset \"' + presetName + '\", check name'); }\n }\n\n if (!presets) { throw new Error('Wrong `markdown-it` preset, can\\'t be empty'); }\n\n if (presets.options) { self.set(presets.options); }\n\n if (presets.components) {\n Object.keys(presets.components).forEach(function (name) {\n if (presets.components[name].rules) {\n self[name].ruler.enableOnly(presets.components[name].rules);\n }\n if (presets.components[name].rules2) {\n self[name].ruler2.enableOnly(presets.components[name].rules2);\n }\n });\n }\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.enable(list, ignoreInvalid)\n * - list (String|Array): rule name or list of rule names to enable\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * Enable list or rules. It will automatically find appropriate components,\n * containing rules with given names. If rule not found, and `ignoreInvalid`\n * not set - throws exception.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')()\n * .enable(['sub', 'sup'])\n * .disable('smartquotes');\n * ```\n **/\nMarkdownIt.prototype.enable = function (list, ignoreInvalid) {\n var result = [];\n\n if (!Array.isArray(list)) { list = [ list ]; }\n\n [ 'core', 'block', 'inline' ].forEach(function (chain) {\n result = result.concat(this[chain].ruler.enable(list, true));\n }, this);\n\n result = result.concat(this.inline.ruler2.enable(list, true));\n\n var missed = list.filter(function (name) { return result.indexOf(name) < 0; });\n\n if (missed.length && !ignoreInvalid) {\n throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);\n }\n\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.disable(list, ignoreInvalid)\n * - list (String|Array): rule name or list of rule names to disable.\n * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.\n *\n * The same as [[MarkdownIt.enable]], but turn specified rules off.\n **/\nMarkdownIt.prototype.disable = function (list, ignoreInvalid) {\n var result = [];\n\n if (!Array.isArray(list)) { list = [ list ]; }\n\n [ 'core', 'block', 'inline' ].forEach(function (chain) {\n result = result.concat(this[chain].ruler.disable(list, true));\n }, this);\n\n result = result.concat(this.inline.ruler2.disable(list, true));\n\n var missed = list.filter(function (name) { return result.indexOf(name) < 0; });\n\n if (missed.length && !ignoreInvalid) {\n throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);\n }\n return this;\n};\n\n\n/** chainable\n * MarkdownIt.use(plugin, params)\n *\n * Load specified plugin with given params into current parser instance.\n * It's just a sugar to call `plugin(md, params)` with curring.\n *\n * ##### Example\n *\n * ```javascript\n * var iterator = require('markdown-it-for-inline');\n * var md = require('markdown-it')()\n * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {\n * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');\n * });\n * ```\n **/\nMarkdownIt.prototype.use = function (plugin /*, params, ... */) {\n var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));\n plugin.apply(plugin, args);\n return this;\n};\n\n\n/** internal\n * MarkdownIt.parse(src, env) -> Array\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Parse input string and returns list of block tokens (special token type\n * \"inline\" will contain list of inline tokens). You should not call this\n * method directly, until you write custom renderer (for example, to produce\n * AST).\n *\n * `env` is used to pass data between \"distributed\" rules and return additional\n * metadata like reference info, needed for the renderer. It also can be used to\n * inject data in specific cases. Usually, you will be ok to pass `{}`,\n * and then pass updated object to renderer.\n **/\nMarkdownIt.prototype.parse = function (src, env) {\n if (typeof src !== 'string') {\n throw new Error('Input data should be a String');\n }\n\n var state = new this.core.State(src, this, env);\n\n this.core.process(state);\n\n return state.tokens;\n};\n\n\n/**\n * MarkdownIt.render(src [, env]) -> String\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Render markdown string into html. It does all magic for you :).\n *\n * `env` can be used to inject additional metadata (`{}` by default).\n * But you will not need it with high probability. See also comment\n * in [[MarkdownIt.parse]].\n **/\nMarkdownIt.prototype.render = function (src, env) {\n env = env || {};\n\n return this.renderer.render(this.parse(src, env), this.options, env);\n};\n\n\n/** internal\n * MarkdownIt.parseInline(src, env) -> Array\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the\n * block tokens list with the single `inline` element, containing parsed inline\n * tokens in `children` property. Also updates `env` object.\n **/\nMarkdownIt.prototype.parseInline = function (src, env) {\n var state = new this.core.State(src, this, env);\n\n state.inlineMode = true;\n this.core.process(state);\n\n return state.tokens;\n};\n\n\n/**\n * MarkdownIt.renderInline(src [, env]) -> String\n * - src (String): source string\n * - env (Object): environment sandbox\n *\n * Similar to [[MarkdownIt.render]] but for single paragraph content. Result\n * will NOT be wrapped into `<p>` tags.\n **/\nMarkdownIt.prototype.renderInline = function (src, env) {\n env = env || {};\n\n return this.renderer.render(this.parseInline(src, env), this.options, env);\n};\n\n\nmodule.exports = MarkdownIt;\n","\n'use strict';\n\n\nvar encodeCache = {};\n\n\n// Create a lookup array where anything but characters in `chars` string\n// and alphanumeric chars is percent-encoded.\n//\nfunction getEncodeCache(exclude) {\n var i, ch, cache = encodeCache[exclude];\n if (cache) { return cache; }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n}\n\n\n// Encode unsafe characters with percent-encoding, skipping already\n// encoded sequences.\n//\n// - string - string to encode\n// - exclude - list of characters to ignore (in addition to a-zA-Z0-9)\n// - keepEscaped - don't encode '%' in a correct escape sequence (default: true)\n//\nfunction encode(string, exclude, keepEscaped) {\n var i, l, code, nextCode, cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode.defaultChars;\n }\n\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n\n cache = getEncodeCache(exclude);\n\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n\n if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n\n if (code < 128) {\n result += cache[code];\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n result += '%EF%BF%BD';\n continue;\n }\n\n result += encodeURIComponent(string[i]);\n }\n\n return result;\n}\n\nencode.defaultChars = \";/?:@&=+$,-_.!~*'()#\";\nencode.componentChars = \"-_.!~*'()\";\n\n\nmodule.exports = encode;\n","\n'use strict';\n\n\n/* eslint-disable no-bitwise */\n\nvar decodeCache = {};\n\nfunction getDecodeCache(exclude) {\n var i, ch, cache = decodeCache[exclude];\n if (cache) { return cache; }\n\n cache = decodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n cache.push(ch);\n }\n\n for (i = 0; i < exclude.length; i++) {\n ch = exclude.charCodeAt(i);\n cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);\n }\n\n return cache;\n}\n\n\n// Decode percent-encoded string.\n//\nfunction decode(string, exclude) {\n var cache;\n\n if (typeof exclude !== 'string') {\n exclude = decode.defaultChars;\n }\n\n cache = getDecodeCache(exclude);\n\n return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {\n var i, l, b1, b2, b3, b4, chr,\n result = '';\n\n for (i = 0, l = seq.length; i < l; i += 3) {\n b1 = parseInt(seq.slice(i + 1, i + 3), 16);\n\n if (b1 < 0x80) {\n result += cache[b1];\n continue;\n }\n\n if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {\n // 110xxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n\n if ((b2 & 0xC0) === 0x80) {\n chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);\n\n if (chr < 0x80) {\n result += '\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 3;\n continue;\n }\n }\n\n if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {\n // 1110xxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);\n\n if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {\n result += '\\ufffd\\ufffd\\ufffd';\n } else {\n result += String.fromCharCode(chr);\n }\n\n i += 6;\n continue;\n }\n }\n\n if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {\n // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx\n b2 = parseInt(seq.slice(i + 4, i + 6), 16);\n b3 = parseInt(seq.slice(i + 7, i + 9), 16);\n b4 = parseInt(seq.slice(i + 10, i + 12), 16);\n\n if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {\n chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);\n\n if (chr < 0x10000 || chr > 0x10FFFF) {\n result += '\\ufffd\\ufffd\\ufffd\\ufffd';\n } else {\n chr -= 0x10000;\n result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));\n }\n\n i += 9;\n continue;\n }\n }\n\n result += '\\ufffd';\n }\n\n return result;\n });\n}\n\n\ndecode.defaultChars = ';/?:@&=+$,#';\ndecode.componentChars = '';\n\n\nmodule.exports = decode;\n","\n'use strict';\n\n\nmodule.exports = function format(url) {\n var result = '';\n\n result += url.protocol || '';\n result += url.slashes ? '//' : '';\n result += url.auth ? url.auth + '@' : '';\n\n if (url.hostname && url.hostname.indexOf(':') !== -1) {\n // ipv6 address\n result += '[' + url.hostname + ']';\n } else {\n result += url.hostname || '';\n }\n\n result += url.port ? ':' + url.port : '';\n result += url.pathname || '';\n result += url.search || '';\n result += url.hash || '';\n\n return result;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n//\n// Changes from joyent/node:\n//\n// 1. No leading slash in paths,\n// e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`\n//\n// 2. Backslashes are not replaced with slashes,\n// so `http:\\\\example.org\\` is treated like a relative path\n//\n// 3. Trailing colon is treated like a part of the path,\n// i.e. in `http://example.org:foo` pathname is `:foo`\n//\n// 4. Nothing is URL-encoded in the resulting object,\n// (in joyent/node some chars in auth and paths are encoded)\n//\n// 5. `url.parse()` does not have `parseQueryString` argument\n//\n// 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,\n// which can be constructed using other parts of the url.\n//\n\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = [ '<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t' ],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = [ '{', '}', '|', '\\\\', '^', '`' ].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = [ '\\'' ].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),\n hostEndingChars = [ '/', '?', '#' ],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n /* eslint-disable no-script-url */\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n };\n /* eslint-enable no-script-url */\n\nfunction urlParse(url, slashesDenoteHost) {\n if (url && url instanceof Url) { return url; }\n\n var u = new Url();\n u.parse(url, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, slashesDenoteHost) {\n var i, l, lowerProto, hec, slashes,\n rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n lowerProto = proto.toLowerCase();\n this.protocol = proto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (i = 0; i < hostEndingChars.length; i++) {\n hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {\n hostEnd = hec;\n }\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = auth;\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (i = 0; i < nonHostChars.length; i++) {\n hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {\n hostEnd = hec;\n }\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1) {\n hostEnd = rest.length;\n }\n\n if (rest[hostEnd - 1] === ':') { hostEnd--; }\n var host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost(host);\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) { continue; }\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n }\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n }\n }\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n rest = rest.slice(0, qm);\n }\n if (rest) { this.pathname = rest; }\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '';\n }\n\n return this;\n};\n\nUrl.prototype.parseHost = function(host) {\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) { this.hostname = host; }\n};\n\nmodule.exports = urlParse;\n","'use strict';\n\nexports.Any = require('./properties/Any/regex');\nexports.Cc = require('./categories/Cc/regex');\nexports.Cf = require('./categories/Cf/regex');\nexports.P = require('./categories/P/regex');\nexports.Z = require('./categories/Z/regex');\n","module.exports=/[\\xAD\\u0600-\\u0605\\u061C\\u06DD\\u070F\\u08E2\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u2064\\u2066-\\u206F\\uFEFF\\uFFF9-\\uFFFB]|\\uD804[\\uDCBD\\uDCCD]|\\uD82F[\\uDCA0-\\uDCA3]|\\uD834[\\uDD73-\\uDD7A]|\\uDB40[\\uDC01\\uDC20-\\uDC7F]/","// Just a shortcut for bulk export\n'use strict';\n\n\nexports.parseLinkLabel = require('./parse_link_label');\nexports.parseLinkDestination = require('./parse_link_destination');\nexports.parseLinkTitle = require('./parse_link_title');\n","// Parse link label\n//\n// this function assumes that first character (\"[\") already matches;\n// returns the end of the label\n//\n'use strict';\n\nmodule.exports = function parseLinkLabel(state, start, disableNested) {\n var level, found, marker, prevPos,\n labelEnd = -1,\n max = state.posMax,\n oldPos = state.pos;\n\n state.pos = start + 1;\n level = 1;\n\n while (state.pos < max) {\n marker = state.src.charCodeAt(state.pos);\n if (marker === 0x5D /* ] */) {\n level--;\n if (level === 0) {\n found = true;\n break;\n }\n }\n\n prevPos = state.pos;\n state.md.inline.skipToken(state);\n if (marker === 0x5B /* [ */) {\n if (prevPos === state.pos - 1) {\n // increase level if we find text `[`, which is not a part of any token\n level++;\n } else if (disableNested) {\n state.pos = oldPos;\n return -1;\n }\n }\n }\n\n if (found) {\n labelEnd = state.pos;\n }\n\n // restore old state\n state.pos = oldPos;\n\n return labelEnd;\n};\n","// Parse link destination\n//\n'use strict';\n\n\nvar isSpace = require('../common/utils').isSpace;\nvar unescapeAll = require('../common/utils').unescapeAll;\n\n\nmodule.exports = function parseLinkDestination(str, pos, max) {\n var code, level,\n lines = 0,\n start = pos,\n result = {\n ok: false,\n pos: 0,\n lines: 0,\n str: ''\n };\n\n if (str.charCodeAt(pos) === 0x3C /* < */) {\n pos++;\n while (pos < max) {\n code = str.charCodeAt(pos);\n if (code === 0x0A /* \\n */ || isSpace(code)) { return result; }\n if (code === 0x3E /* > */) {\n result.pos = pos + 1;\n result.str = unescapeAll(str.slice(start + 1, pos));\n result.ok = true;\n return result;\n }\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos += 2;\n continue;\n }\n\n pos++;\n }\n\n // no closing '>'\n return result;\n }\n\n // this should be ... } else { ... branch\n\n level = 0;\n while (pos < max) {\n code = str.charCodeAt(pos);\n\n if (code === 0x20) { break; }\n\n // ascii control characters\n if (code < 0x20 || code === 0x7F) { break; }\n\n if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos += 2;\n continue;\n }\n\n if (code === 0x28 /* ( */) {\n level++;\n }\n\n if (code === 0x29 /* ) */) {\n if (level === 0) { break; }\n level--;\n }\n\n pos++;\n }\n\n if (start === pos) { return result; }\n if (level !== 0) { return result; }\n\n result.str = unescapeAll(str.slice(start, pos));\n result.lines = lines;\n result.pos = pos;\n result.ok = true;\n return result;\n};\n","// Parse link title\n//\n'use strict';\n\n\nvar unescapeAll = require('../common/utils').unescapeAll;\n\n\nmodule.exports = function parseLinkTitle(str, pos, max) {\n var code,\n marker,\n lines = 0,\n start = pos,\n result = {\n ok: false,\n pos: 0,\n lines: 0,\n str: ''\n };\n\n if (pos >= max) { return result; }\n\n marker = str.charCodeAt(pos);\n\n if (marker !== 0x22 /* \" */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }\n\n pos++;\n\n // if opening marker is \"(\", switch it to closing marker \")\"\n if (marker === 0x28) { marker = 0x29; }\n\n while (pos < max) {\n code = str.charCodeAt(pos);\n if (code === marker) {\n result.pos = pos + 1;\n result.lines = lines;\n result.str = unescapeAll(str.slice(start + 1, pos));\n result.ok = true;\n return result;\n } else if (code === 0x0A) {\n lines++;\n } else if (code === 0x5C /* \\ */ && pos + 1 < max) {\n pos++;\n if (str.charCodeAt(pos) === 0x0A) {\n lines++;\n }\n }\n\n pos++;\n }\n\n return result;\n};\n","/**\n * class Renderer\n *\n * Generates HTML from parsed token stream. Each instance has independent\n * copy of rules. Those can be rewritten with ease. Also, you can add new\n * rules if you create plugin and adds new token types.\n **/\n'use strict';\n\n\nvar assign = require('./common/utils').assign;\nvar unescapeAll = require('./common/utils').unescapeAll;\nvar escapeHtml = require('./common/utils').escapeHtml;\n\n\n////////////////////////////////////////////////////////////////////////////////\n\nvar default_rules = {};\n\n\ndefault_rules.code_inline = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n return '<code' + slf.renderAttrs(token) + '>' +\n escapeHtml(tokens[idx].content) +\n '</code>';\n};\n\n\ndefault_rules.code_block = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n return '<pre' + slf.renderAttrs(token) + '><code>' +\n escapeHtml(tokens[idx].content) +\n '</code></pre>\\n';\n};\n\n\ndefault_rules.fence = function (tokens, idx, options, env, slf) {\n var token = tokens[idx],\n info = token.info ? unescapeAll(token.info).trim() : '',\n langName = '',\n highlighted, i, tmpAttrs, tmpToken;\n\n if (info) {\n langName = info.split(/\\s+/g)[0];\n }\n\n if (options.highlight) {\n highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);\n } else {\n highlighted = escapeHtml(token.content);\n }\n\n if (highlighted.indexOf('<pre') === 0) {\n return highlighted + '\\n';\n }\n\n // If language exists, inject class gently, without modifying original token.\n // May be, one day we will add .clone() for token and simplify this part, but\n // now we prefer to keep things local.\n if (info) {\n i = token.attrIndex('class');\n tmpAttrs = token.attrs ? token.attrs.slice() : [];\n\n if (i < 0) {\n tmpAttrs.push([ 'class', options.langPrefix + langName ]);\n } else {\n tmpAttrs[i][1] += ' ' + options.langPrefix + langName;\n }\n\n // Fake token just to render attributes\n tmpToken = {\n attrs: tmpAttrs\n };\n\n return '<pre><code' + slf.renderAttrs(tmpToken) + '>'\n + highlighted\n + '</code></pre>\\n';\n }\n\n\n return '<pre><code' + slf.renderAttrs(token) + '>'\n + highlighted\n + '</code></pre>\\n';\n};\n\n\ndefault_rules.image = function (tokens, idx, options, env, slf) {\n var token = tokens[idx];\n\n // \"alt\" attr MUST be set, even if empty. Because it's mandatory and\n // should be placed on proper position for tests.\n //\n // Replace content with actual value\n\n token.attrs[token.attrIndex('alt')][1] =\n slf.renderInlineAsText(token.children, options, env);\n\n return slf.renderToken(tokens, idx, options);\n};\n\n\ndefault_rules.hardbreak = function (tokens, idx, options /*, env */) {\n return options.xhtmlOut ? '<br />\\n' : '<br>\\n';\n};\ndefault_rules.softbreak = function (tokens, idx, options /*, env */) {\n return options.breaks ? (options.xhtmlOut ? '<br />\\n' : '<br>\\n') : '\\n';\n};\n\n\ndefault_rules.text = function (tokens, idx /*, options, env */) {\n return escapeHtml(tokens[idx].content);\n};\n\n\ndefault_rules.html_block = function (tokens, idx /*, options, env */) {\n return tokens[idx].content;\n};\ndefault_rules.html_inline = function (tokens, idx /*, options, env */) {\n return tokens[idx].content;\n};\n\n\n/**\n * new Renderer()\n *\n * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.\n **/\nfunction Renderer() {\n\n /**\n * Renderer#rules -> Object\n *\n * Contains render rules for tokens. Can be updated and extended.\n *\n * ##### Example\n *\n * ```javascript\n * var md = require('markdown-it')();\n *\n * md.renderer.rules.strong_open = function () { return '<b>'; };\n * md.renderer.rules.strong_close = function () { return '</b>'; };\n *\n * var result = md.renderInline(...);\n * ```\n *\n * Each rule is called as independent static function with fixed signature:\n *\n * ```javascript\n * function my_token_render(tokens, idx, options, env, renderer) {\n * // ...\n * return renderedHTML;\n * }\n * ```\n *\n * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)\n * for more details and examples.\n **/\n this.rules = assign({}, default_rules);\n}\n\n\n/**\n * Renderer.renderAttrs(token) -> String\n *\n * Render token attributes to string.\n **/\nRenderer.prototype.renderAttrs = function renderAttrs(token) {\n var i, l, result;\n\n if (!token.attrs) { return ''; }\n\n result = '';\n\n for (i = 0, l = token.attrs.length; i < l; i++) {\n result += ' ' + escapeHtml(token.attrs[i][0]) + '=\"' + escapeHtml(token.attrs[i][1]) + '\"';\n }\n\n return result;\n};\n\n\n/**\n * Renderer.renderToken(tokens, idx, options) -> String\n * - tokens (Array): list of tokens\n * - idx (Numbed): token index to render\n * - options (Object): params of parser instance\n *\n * Default token renderer. Can be overriden by custom function\n * in [[Renderer#rules]].\n **/\nRenderer.prototype.renderToken = function renderToken(tokens, idx, options) {\n var nextToken,\n result = '',\n needLf = false,\n token = tokens[idx];\n\n // Tight list paragraphs\n if (token.hidden) {\n return '';\n }\n\n // Insert a newline between hidden paragraph and subsequent opening\n // block-level tag.\n //\n // For example, here we should insert a newline before blockquote:\n // - a\n // >\n //\n if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {\n result += '\\n';\n }\n\n // Add token name, e.g. `<img`\n result += (token.nesting === -1 ? '</' : '<') + token.tag;\n\n // Encode attributes, e.g. `<img src=\"foo\"`\n result += this.renderAttrs(token);\n\n // Add a slash for self-closing tags, e.g. `<img src=\"foo\" /`\n if (token.nesting === 0 && options.xhtmlOut) {\n result += ' /';\n }\n\n // Check if we need to add a newline after this tag\n if (token.block) {\n needLf = true;\n\n if (token.nesting === 1) {\n if (idx + 1 < tokens.length) {\n nextToken = tokens[idx + 1];\n\n if (nextToken.type === 'inline' || nextToken.hidden) {\n // Block-level tag containing an inline tag.\n //\n needLf = false;\n\n } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {\n // Opening tag + closing tag of the same type. E.g. `<li></li>`.\n //\n needLf = false;\n }\n }\n }\n }\n\n result += needLf ? '>\\n' : '>';\n\n return result;\n};\n\n\n/**\n * Renderer.renderInline(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to renter\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * The same as [[Renderer.render]], but for single token of `inline` type.\n **/\nRenderer.prototype.renderInline = function (tokens, options, env) {\n var type,\n result = '',\n rules = this.rules;\n\n for (var i = 0, len = tokens.length; i < len; i++) {\n type = tokens[i].type;\n\n if (typeof rules[type] !== 'undefined') {\n result += rules[type](tokens, i, options, env, this);\n } else {\n result += this.renderToken(tokens, i, options);\n }\n }\n\n return result;\n};\n\n\n/** internal\n * Renderer.renderInlineAsText(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to renter\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * Special kludge for image `alt` attributes to conform CommonMark spec.\n * Don't try to use it! Spec requires to show `alt` content with stripped markup,\n * instead of simple escaping.\n **/\nRenderer.prototype.renderInlineAsText = function (tokens, options, env) {\n var result = '';\n\n for (var i = 0, len = tokens.length; i < len; i++) {\n if (tokens[i].type === 'text') {\n result += tokens[i].content;\n } else if (tokens[i].type === 'image') {\n result += this.renderInlineAsText(tokens[i].children, options, env);\n }\n }\n\n return result;\n};\n\n\n/**\n * Renderer.render(tokens, options, env) -> String\n * - tokens (Array): list on block tokens to renter\n * - options (Object): params of parser instance\n * - env (Object): additional data from parsed input (references, for example)\n *\n * Takes token stream and generates HTML. Probably, you will never need to call\n * this method directly.\n **/\nRenderer.prototype.render = function (tokens, options, env) {\n var i, len, type,\n result = '',\n rules = this.rules;\n\n for (i = 0, len = tokens.length; i < len; i++) {\n type = tokens[i].type;\n\n if (type === 'inline') {\n result += this.renderInline(tokens[i].children, options, env);\n } else if (typeof rules[type] !== 'undefined') {\n result += rules[tokens[i].type](tokens, i, options, env, this);\n } else {\n result += this.renderToken(tokens, i, options, env);\n }\n }\n\n return result;\n};\n\nmodule.exports = Renderer;\n","/** internal\n * class Core\n *\n * Top-level rules executor. Glues block/inline parsers and does intermediate\n * transformations.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\nvar _rules = [\n [ 'normalize', require('./rules_core/normalize') ],\n [ 'block', require('./rules_core/block') ],\n [ 'inline', require('./rules_core/inline') ],\n [ 'linkify', require('./rules_core/linkify') ],\n [ 'replacements', require('./rules_core/replacements') ],\n [ 'smartquotes', require('./rules_core/smartquotes') ]\n];\n\n\n/**\n * new Core()\n **/\nfunction Core() {\n /**\n * Core#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of core rules.\n **/\n this.ruler = new Ruler();\n\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n}\n\n\n/**\n * Core.process(state)\n *\n * Executes core chain rules.\n **/\nCore.prototype.process = function (state) {\n var i, l, rules;\n\n rules = this.ruler.getRules('');\n\n for (i = 0, l = rules.length; i < l; i++) {\n rules[i](state);\n }\n};\n\nCore.prototype.State = require('./rules_core/state_core');\n\n\nmodule.exports = Core;\n","// Normalize input string\n\n'use strict';\n\n\nvar NEWLINES_RE = /\\r[\\n\\u0085]?|[\\u2424\\u2028\\u0085]/g;\nvar NULL_RE = /\\u0000/g;\n\n\nmodule.exports = function inline(state) {\n var str;\n\n // Normalize newlines\n str = state.src.replace(NEWLINES_RE, '\\n');\n\n // Replace NULL characters\n str = str.replace(NULL_RE, '\\uFFFD');\n\n state.src = str;\n};\n","'use strict';\n\n\nmodule.exports = function block(state) {\n var token;\n\n if (state.inlineMode) {\n token = new state.Token('inline', '', 0);\n token.content = state.src;\n token.map = [ 0, 1 ];\n token.children = [];\n state.tokens.push(token);\n } else {\n state.md.block.parse(state.src, state.md, state.env, state.tokens);\n }\n};\n","'use strict';\n\nmodule.exports = function inline(state) {\n var tokens = state.tokens, tok, i, l;\n\n // Parse inlines\n for (i = 0, l = tokens.length; i < l; i++) {\n tok = tokens[i];\n if (tok.type === 'inline') {\n state.md.inline.parse(tok.content, state.md, state.env, tok.children);\n }\n }\n};\n","// Replace link-like texts with link nodes.\n//\n// Currently restricted by `md.validateLink()` to http/https/ftp\n//\n'use strict';\n\n\nvar arrayReplaceAt = require('../common/utils').arrayReplaceAt;\n\n\nfunction isLinkOpen(str) {\n return /^<a[>\\s]/i.test(str);\n}\nfunction isLinkClose(str) {\n return /^<\\/a\\s*>/i.test(str);\n}\n\n\nmodule.exports = function linkify(state) {\n var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,\n level, htmlLinkLevel, url, fullUrl, urlText,\n blockTokens = state.tokens,\n links;\n\n if (!state.md.options.linkify) { return; }\n\n for (j = 0, l = blockTokens.length; j < l; j++) {\n if (blockTokens[j].type !== 'inline' ||\n !state.md.linkify.pretest(blockTokens[j].content)) {\n continue;\n }\n\n tokens = blockTokens[j].children;\n\n htmlLinkLevel = 0;\n\n // We scan from the end, to keep position when new tags added.\n // Use reversed logic in links start/end match\n for (i = tokens.length - 1; i >= 0; i--) {\n currentToken = tokens[i];\n\n // Skip content of markdown links\n if (currentToken.type === 'link_close') {\n i--;\n while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {\n i--;\n }\n continue;\n }\n\n // Skip content of html tag links\n if (currentToken.type === 'html_inline') {\n if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {\n htmlLinkLevel--;\n }\n if (isLinkClose(currentToken.content)) {\n htmlLinkLevel++;\n }\n }\n if (htmlLinkLevel > 0) { continue; }\n\n if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {\n\n text = currentToken.content;\n links = state.md.linkify.match(text);\n\n // Now split string to nodes\n nodes = [];\n level = currentToken.level;\n lastPos = 0;\n\n for (ln = 0; ln < links.length; ln++) {\n\n url = links[ln].url;\n fullUrl = state.md.normalizeLink(url);\n if (!state.md.validateLink(fullUrl)) { continue; }\n\n urlText = links[ln].text;\n\n // Linkifier might send raw hostnames like \"example.com\", where url\n // starts with domain name. So we prepend http:// in those cases,\n // and remove it afterwards.\n //\n if (!links[ln].schema) {\n urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\\/\\//, '');\n } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {\n urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');\n } else {\n urlText = state.md.normalizeLinkText(urlText);\n }\n\n pos = links[ln].index;\n\n if (pos > lastPos) {\n token = new state.Token('text', '', 0);\n token.content = text.slice(lastPos, pos);\n token.level = level;\n nodes.push(token);\n }\n\n token = new state.Token('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.level = level++;\n token.markup = 'linkify';\n token.info = 'auto';\n nodes.push(token);\n\n token = new state.Token('text', '', 0);\n token.content = urlText;\n token.level = level;\n nodes.push(token);\n\n token = new state.Token('link_close', 'a', -1);\n token.level = --level;\n token.markup = 'linkify';\n token.info = 'auto';\n nodes.push(token);\n\n lastPos = links[ln].lastIndex;\n }\n if (lastPos < text.length) {\n token = new state.Token('text', '', 0);\n token.content = text.slice(lastPos);\n token.level = level;\n nodes.push(token);\n }\n\n // replace current node\n blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);\n }\n }\n }\n};\n","// Simple typographyc replacements\n//\n// (c) (C) → ©\n// (tm) (TM) → ™\n// (r) (R) → ®\n// +- → ±\n// (p) (P) -> §\n// ... → … (also ?.... → ?.., !.... → !..)\n// ???????? → ???, !!!!! → !!!, `,,` → `,`\n// -- → –, --- → —\n//\n'use strict';\n\n// TODO:\n// - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾\n// - miltiplication 2 x 4 -> 2 × 4\n\nvar RARE_RE = /\\+-|\\.\\.|\\?\\?\\?\\?|!!!!|,,|--/;\n\n// Workaround for phantomjs - need regex without /g flag,\n// or root check will fail every second time\nvar SCOPED_ABBR_TEST_RE = /\\((c|tm|r|p)\\)/i;\n\nvar SCOPED_ABBR_RE = /\\((c|tm|r|p)\\)/ig;\nvar SCOPED_ABBR = {\n c: '©',\n r: '®',\n p: '§',\n tm: '™'\n};\n\nfunction replaceFn(match, name) {\n return SCOPED_ABBR[name.toLowerCase()];\n}\n\nfunction replace_scoped(inlineTokens) {\n var i, token, inside_autolink = 0;\n\n for (i = inlineTokens.length - 1; i >= 0; i--) {\n token = inlineTokens[i];\n\n if (token.type === 'text' && !inside_autolink) {\n token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--;\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++;\n }\n }\n}\n\nfunction replace_rare(inlineTokens) {\n var i, token, inside_autolink = 0;\n\n for (i = inlineTokens.length - 1; i >= 0; i--) {\n token = inlineTokens[i];\n\n if (token.type === 'text' && !inside_autolink) {\n if (RARE_RE.test(token.content)) {\n token.content = token.content\n .replace(/\\+-/g, '±')\n // .., ..., ....... -> …\n // but ?..... & !..... -> ?.. & !..\n .replace(/\\.{2,}/g, '…').replace(/([?!])…/g, '$1..')\n .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')\n // em-dash\n .replace(/(^|[^-])---([^-]|$)/mg, '$1\\u2014$2')\n // en-dash\n .replace(/(^|\\s)--(\\s|$)/mg, '$1\\u2013$2')\n .replace(/(^|[^-\\s])--([^-\\s]|$)/mg, '$1\\u2013$2');\n }\n }\n\n if (token.type === 'link_open' && token.info === 'auto') {\n inside_autolink--;\n }\n\n if (token.type === 'link_close' && token.info === 'auto') {\n inside_autolink++;\n }\n }\n}\n\n\nmodule.exports = function replace(state) {\n var blkIdx;\n\n if (!state.md.options.typographer) { return; }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n\n if (state.tokens[blkIdx].type !== 'inline') { continue; }\n\n if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {\n replace_scoped(state.tokens[blkIdx].children);\n }\n\n if (RARE_RE.test(state.tokens[blkIdx].content)) {\n replace_rare(state.tokens[blkIdx].children);\n }\n\n }\n};\n","// Convert straight quotation marks to typographic ones\n//\n'use strict';\n\n\nvar isWhiteSpace = require('../common/utils').isWhiteSpace;\nvar isPunctChar = require('../common/utils').isPunctChar;\nvar isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;\n\nvar QUOTE_TEST_RE = /['\"]/;\nvar QUOTE_RE = /['\"]/g;\nvar APOSTROPHE = '\\u2019'; /* ’ */\n\n\nfunction replaceAt(str, index, ch) {\n return str.substr(0, index) + ch + str.substr(index + 1);\n}\n\nfunction process_inlines(tokens, state) {\n var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,\n isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,\n canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;\n\n stack = [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n\n thisLevel = tokens[i].level;\n\n for (j = stack.length - 1; j >= 0; j--) {\n if (stack[j].level <= thisLevel) { break; }\n }\n stack.length = j + 1;\n\n if (token.type !== 'text') { continue; }\n\n text = token.content;\n pos = 0;\n max = text.length;\n\n /*eslint no-labels:0,block-scoped-var:0*/\n OUTER:\n while (pos < max) {\n QUOTE_RE.lastIndex = pos;\n t = QUOTE_RE.exec(text);\n if (!t) { break; }\n\n canOpen = canClose = true;\n pos = t.index + 1;\n isSingle = (t[0] === \"'\");\n\n // Find previous character,\n // default to space if it's the beginning of the line\n //\n lastChar = 0x20;\n\n if (t.index - 1 >= 0) {\n lastChar = text.charCodeAt(t.index - 1);\n } else {\n for (j = i - 1; j >= 0; j--) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // lastChar defaults to 0x20\n if (tokens[j].type !== 'text') continue;\n\n lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);\n break;\n }\n }\n\n // Find next character,\n // default to space if it's the end of the line\n //\n nextChar = 0x20;\n\n if (pos < max) {\n nextChar = text.charCodeAt(pos);\n } else {\n for (j = i + 1; j < tokens.length; j++) {\n if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // nextChar defaults to 0x20\n if (tokens[j].type !== 'text') continue;\n\n nextChar = tokens[j].content.charCodeAt(0);\n break;\n }\n }\n\n isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));\n isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));\n\n isLastWhiteSpace = isWhiteSpace(lastChar);\n isNextWhiteSpace = isWhiteSpace(nextChar);\n\n if (isNextWhiteSpace) {\n canOpen = false;\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n canOpen = false;\n }\n }\n\n if (isLastWhiteSpace) {\n canClose = false;\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n canClose = false;\n }\n }\n\n if (nextChar === 0x22 /* \" */ && t[0] === '\"') {\n if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {\n // special case: 1\"\" - count first quote as an inch\n canClose = canOpen = false;\n }\n }\n\n if (canOpen && canClose) {\n // treat this as the middle of the word\n canOpen = false;\n canClose = isNextPunctChar;\n }\n\n if (!canOpen && !canClose) {\n // middle of word\n if (isSingle) {\n token.content = replaceAt(token.content, t.index, APOSTROPHE);\n }\n continue;\n }\n\n if (canClose) {\n // this could be a closing quote, rewind the stack to get a match\n for (j = stack.length - 1; j >= 0; j--) {\n item = stack[j];\n if (stack[j].level < thisLevel) { break; }\n if (item.single === isSingle && stack[j].level === thisLevel) {\n item = stack[j];\n\n if (isSingle) {\n openQuote = state.md.options.quotes[2];\n closeQuote = state.md.options.quotes[3];\n } else {\n openQuote = state.md.options.quotes[0];\n closeQuote = state.md.options.quotes[1];\n }\n\n // replace token.content *before* tokens[item.token].content,\n // because, if they are pointing at the same token, replaceAt\n // could mess up indices when quote length != 1\n token.content = replaceAt(token.content, t.index, closeQuote);\n tokens[item.token].content = replaceAt(\n tokens[item.token].content, item.pos, openQuote);\n\n pos += closeQuote.length - 1;\n if (item.token === i) { pos += openQuote.length - 1; }\n\n text = token.content;\n max = text.length;\n\n stack.length = j;\n continue OUTER;\n }\n }\n }\n\n if (canOpen) {\n stack.push({\n token: i,\n pos: t.index,\n single: isSingle,\n level: thisLevel\n });\n } else if (canClose && isSingle) {\n token.content = replaceAt(token.content, t.index, APOSTROPHE);\n }\n }\n }\n}\n\n\nmodule.exports = function smartquotes(state) {\n /*eslint max-depth:0*/\n var blkIdx;\n\n if (!state.md.options.typographer) { return; }\n\n for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {\n\n if (state.tokens[blkIdx].type !== 'inline' ||\n !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {\n continue;\n }\n\n process_inlines(state.tokens[blkIdx].children, state);\n }\n};\n","// Core state object\n//\n'use strict';\n\nvar Token = require('../token');\n\n\nfunction StateCore(src, md, env) {\n this.src = src;\n this.env = env;\n this.tokens = [];\n this.inlineMode = false;\n this.md = md; // link to parser instance\n}\n\n// re-export Token class to use in core rules\nStateCore.prototype.Token = Token;\n\n\nmodule.exports = StateCore;\n","/** internal\n * class ParserBlock\n *\n * Block-level tokenizer.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\nvar _rules = [\n // First 2 params - rule name & source. Secondary array - list of rules,\n // which can be terminated by this one.\n [ 'table', require('./rules_block/table'), [ 'paragraph', 'reference' ] ],\n [ 'code', require('./rules_block/code') ],\n [ 'fence', require('./rules_block/fence'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'blockquote', require('./rules_block/blockquote'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'hr', require('./rules_block/hr'), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],\n [ 'list', require('./rules_block/list'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'reference', require('./rules_block/reference') ],\n [ 'heading', require('./rules_block/heading'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'lheading', require('./rules_block/lheading') ],\n [ 'html_block', require('./rules_block/html_block'), [ 'paragraph', 'reference', 'blockquote' ] ],\n [ 'paragraph', require('./rules_block/paragraph') ]\n];\n\n\n/**\n * new ParserBlock()\n **/\nfunction ParserBlock() {\n /**\n * ParserBlock#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of block rules.\n **/\n this.ruler = new Ruler();\n\n for (var i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });\n }\n}\n\n\n// Generate tokens for input range\n//\nParserBlock.prototype.tokenize = function (state, startLine, endLine) {\n var ok, i,\n rules = this.ruler.getRules(''),\n len = rules.length,\n line = startLine,\n hasEmptyLines = false,\n maxNesting = state.md.options.maxNesting;\n\n while (line < endLine) {\n state.line = line = state.skipEmptyLines(line);\n if (line >= endLine) { break; }\n\n // Termination condition for nested calls.\n // Nested calls currently used for blockquotes & lists\n if (state.sCount[line] < state.blkIndent) { break; }\n\n // If nesting level exceeded - skip tail to the end. That's not ordinary\n // situation and we should not care about content.\n if (state.level >= maxNesting) {\n state.line = endLine;\n break;\n }\n\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.line`\n // - update `state.tokens`\n // - return true\n\n for (i = 0; i < len; i++) {\n ok = rules[i](state, line, endLine, false);\n if (ok) { break; }\n }\n\n // set state.tight if we had an empty line before current tag\n // i.e. latest empty line should not count\n state.tight = !hasEmptyLines;\n\n // paragraph might \"eat\" one newline after it in nested lists\n if (state.isEmpty(state.line - 1)) {\n hasEmptyLines = true;\n }\n\n line = state.line;\n\n if (line < endLine && state.isEmpty(line)) {\n hasEmptyLines = true;\n line++;\n state.line = line;\n }\n }\n};\n\n\n/**\n * ParserBlock.parse(str, md, env, outTokens)\n *\n * Process input string and push block tokens into `outTokens`\n **/\nParserBlock.prototype.parse = function (src, md, env, outTokens) {\n var state;\n\n if (!src) { return; }\n\n state = new this.State(src, md, env, outTokens);\n\n this.tokenize(state, state.line, state.lineMax);\n};\n\n\nParserBlock.prototype.State = require('./rules_block/state_block');\n\n\nmodule.exports = ParserBlock;\n","// GFM table, non-standard\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nfunction getLine(state, line) {\n var pos = state.bMarks[line] + state.blkIndent,\n max = state.eMarks[line];\n\n return state.src.substr(pos, max - pos);\n}\n\nfunction escapedSplit(str) {\n var result = [],\n pos = 0,\n max = str.length,\n ch,\n escapes = 0,\n lastPos = 0,\n backTicked = false,\n lastBackTick = 0;\n\n ch = str.charCodeAt(pos);\n\n while (pos < max) {\n if (ch === 0x60/* ` */) {\n if (backTicked) {\n // make \\` close code sequence, but not open it;\n // the reason is: `\\` is correct code block\n backTicked = false;\n lastBackTick = pos;\n } else if (escapes % 2 === 0) {\n backTicked = true;\n lastBackTick = pos;\n }\n } else if (ch === 0x7c/* | */ && (escapes % 2 === 0) && !backTicked) {\n result.push(str.substring(lastPos, pos));\n lastPos = pos + 1;\n }\n\n if (ch === 0x5c/* \\ */) {\n escapes++;\n } else {\n escapes = 0;\n }\n\n pos++;\n\n // If there was an un-closed backtick, go back to just after\n // the last backtick, but as if it was a normal character\n if (pos === max && backTicked) {\n backTicked = false;\n pos = lastBackTick + 1;\n }\n\n ch = str.charCodeAt(pos);\n }\n\n result.push(str.substring(lastPos));\n\n return result;\n}\n\n\nmodule.exports = function table(state, startLine, endLine, silent) {\n var ch, lineText, pos, i, nextLine, columns, columnCount, token,\n aligns, t, tableLines, tbodyLines;\n\n // should have at least two lines\n if (startLine + 2 > endLine) { return false; }\n\n nextLine = startLine + 1;\n\n if (state.sCount[nextLine] < state.blkIndent) { return false; }\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }\n\n // first character of the second line should be '|', '-', ':',\n // and no other characters are allowed but spaces;\n // basically, this is the equivalent of /^[-:|][-:|\\s]*$/ regexp\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n if (pos >= state.eMarks[nextLine]) { return false; }\n\n ch = state.src.charCodeAt(pos++);\n if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; }\n\n while (pos < state.eMarks[nextLine]) {\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false; }\n\n pos++;\n }\n\n lineText = getLine(state, startLine + 1);\n\n columns = lineText.split('|');\n aligns = [];\n for (i = 0; i < columns.length; i++) {\n t = columns[i].trim();\n if (!t) {\n // allow empty columns before and after table, but not in between columns;\n // e.g. allow ` |---| `, disallow ` ---||--- `\n if (i === 0 || i === columns.length - 1) {\n continue;\n } else {\n return false;\n }\n }\n\n if (!/^:?-+:?$/.test(t)) { return false; }\n if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {\n aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');\n } else if (t.charCodeAt(0) === 0x3A/* : */) {\n aligns.push('left');\n } else {\n aligns.push('');\n }\n }\n\n lineText = getLine(state, startLine).trim();\n if (lineText.indexOf('|') === -1) { return false; }\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n columns = escapedSplit(lineText.replace(/^\\||\\|$/g, ''));\n\n // header row will define an amount of columns in the entire table,\n // and align row shouldn't be smaller than that (the rest of the rows can)\n columnCount = columns.length;\n if (columnCount > aligns.length) { return false; }\n\n if (silent) { return true; }\n\n token = state.push('table_open', 'table', 1);\n token.map = tableLines = [ startLine, 0 ];\n\n token = state.push('thead_open', 'thead', 1);\n token.map = [ startLine, startLine + 1 ];\n\n token = state.push('tr_open', 'tr', 1);\n token.map = [ startLine, startLine + 1 ];\n\n for (i = 0; i < columns.length; i++) {\n token = state.push('th_open', 'th', 1);\n token.map = [ startLine, startLine + 1 ];\n if (aligns[i]) {\n token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];\n }\n\n token = state.push('inline', '', 0);\n token.content = columns[i].trim();\n token.map = [ startLine, startLine + 1 ];\n token.children = [];\n\n token = state.push('th_close', 'th', -1);\n }\n\n token = state.push('tr_close', 'tr', -1);\n token = state.push('thead_close', 'thead', -1);\n\n token = state.push('tbody_open', 'tbody', 1);\n token.map = tbodyLines = [ startLine + 2, 0 ];\n\n for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n lineText = getLine(state, nextLine).trim();\n if (lineText.indexOf('|') === -1) { break; }\n if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }\n columns = escapedSplit(lineText.replace(/^\\||\\|$/g, ''));\n\n token = state.push('tr_open', 'tr', 1);\n for (i = 0; i < columnCount; i++) {\n token = state.push('td_open', 'td', 1);\n if (aligns[i]) {\n token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];\n }\n\n token = state.push('inline', '', 0);\n token.content = columns[i] ? columns[i].trim() : '';\n token.children = [];\n\n token = state.push('td_close', 'td', -1);\n }\n token = state.push('tr_close', 'tr', -1);\n }\n token = state.push('tbody_close', 'tbody', -1);\n token = state.push('table_close', 'table', -1);\n\n tableLines[1] = tbodyLines[1] = nextLine;\n state.line = nextLine;\n return true;\n};\n","// Code block (4 spaces padded)\n\n'use strict';\n\n\nmodule.exports = function code(state, startLine, endLine/*, silent*/) {\n var nextLine, last, token;\n\n if (state.sCount[startLine] - state.blkIndent < 4) { return false; }\n\n last = nextLine = startLine + 1;\n\n while (nextLine < endLine) {\n if (state.isEmpty(nextLine)) {\n nextLine++;\n continue;\n }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n nextLine++;\n last = nextLine;\n continue;\n }\n break;\n }\n\n state.line = last;\n\n token = state.push('code_block', 'code', 0);\n token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);\n token.map = [ startLine, state.line ];\n\n return true;\n};\n","// fences (``` lang, ~~~ lang)\n\n'use strict';\n\n\nmodule.exports = function fence(state, startLine, endLine, silent) {\n var marker, len, params, nextLine, mem, token, markup,\n haveEndMarker = false,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (pos + 3 > max) { return false; }\n\n marker = state.src.charCodeAt(pos);\n\n if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {\n return false;\n }\n\n // scan marker length\n mem = pos;\n pos = state.skipChars(pos, marker);\n\n len = pos - mem;\n\n if (len < 3) { return false; }\n\n markup = state.src.slice(mem, pos);\n params = state.src.slice(pos, max);\n\n if (params.indexOf(String.fromCharCode(marker)) >= 0) { return false; }\n\n // Since start is found, we can report success here in validation mode\n if (silent) { return true; }\n\n // search end of block\n nextLine = startLine;\n\n for (;;) {\n nextLine++;\n if (nextLine >= endLine) {\n // unclosed block should be autoclosed by end of document.\n // also block seems to be autoclosed by end of parent\n break;\n }\n\n pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos < max && state.sCount[nextLine] < state.blkIndent) {\n // non-empty line with negative indent should stop the list:\n // - ```\n // test\n break;\n }\n\n if (state.src.charCodeAt(pos) !== marker) { continue; }\n\n if (state.sCount[nextLine] - state.blkIndent >= 4) {\n // closing fence should be indented less than 4 spaces\n continue;\n }\n\n pos = state.skipChars(pos, marker);\n\n // closing code fence must be at least as long as the opening one\n if (pos - mem < len) { continue; }\n\n // make sure tail has spaces only\n pos = state.skipSpaces(pos);\n\n if (pos < max) { continue; }\n\n haveEndMarker = true;\n // found!\n break;\n }\n\n // If a fence has heading spaces, they should be removed from its inner block\n len = state.sCount[startLine];\n\n state.line = nextLine + (haveEndMarker ? 1 : 0);\n\n token = state.push('fence', 'code', 0);\n token.info = params;\n token.content = state.getLines(startLine + 1, nextLine, len, true);\n token.markup = markup;\n token.map = [ startLine, state.line ];\n\n return true;\n};\n","// Block quotes\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function blockquote(state, startLine, endLine, silent) {\n var adjustTab,\n ch,\n i,\n initial,\n l,\n lastLineEmpty,\n lines,\n nextLine,\n offset,\n oldBMarks,\n oldBSCount,\n oldIndent,\n oldParentType,\n oldSCount,\n oldTShift,\n spaceAfterMarker,\n terminate,\n terminatorRules,\n token,\n wasOutdented,\n oldLineMax = state.lineMax,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n // check the block quote marker\n if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }\n\n // we know that it's going to be a valid blockquote,\n // so no point trying to find the end of it in silent mode\n if (silent) { return true; }\n\n // skip spaces after \">\" and re-calculate offset\n initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n spaceAfterMarker = true;\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true;\n\n if ((state.bsCount[startLine] + offset) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true;\n }\n } else {\n spaceAfterMarker = false;\n }\n\n oldBMarks = [ state.bMarks[startLine] ];\n state.bMarks[startLine] = pos;\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;\n } else {\n offset++;\n }\n } else {\n break;\n }\n\n pos++;\n }\n\n oldBSCount = [ state.bsCount[startLine] ];\n state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);\n\n lastLineEmpty = pos >= max;\n\n oldSCount = [ state.sCount[startLine] ];\n state.sCount[startLine] = offset - initial;\n\n oldTShift = [ state.tShift[startLine] ];\n state.tShift[startLine] = pos - state.bMarks[startLine];\n\n terminatorRules = state.md.block.ruler.getRules('blockquote');\n\n oldParentType = state.parentType;\n state.parentType = 'blockquote';\n wasOutdented = false;\n\n // Search the end of the block\n //\n // Block ends with either:\n // 1. an empty line outside:\n // ```\n // > test\n //\n // ```\n // 2. an empty line inside:\n // ```\n // >\n // test\n // ```\n // 3. another tag:\n // ```\n // > test\n // - - -\n // ```\n for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {\n // check if it's outdented, i.e. it's inside list item and indented\n // less than said list item:\n //\n // ```\n // 1. anything\n // > current blockquote\n // 2. checking this line\n // ```\n if (state.sCount[nextLine] < state.blkIndent) wasOutdented = true;\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos >= max) {\n // Case 1: line is not inside the blockquote, and this line is empty.\n break;\n }\n\n if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !wasOutdented) {\n // This line is inside the blockquote.\n\n // skip spaces after \">\" and re-calculate offset\n initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]);\n\n // skip one optional space after '>'\n if (state.src.charCodeAt(pos) === 0x20 /* space */) {\n // ' > test '\n // ^ -- position start of line here:\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n spaceAfterMarker = true;\n } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {\n spaceAfterMarker = true;\n\n if ((state.bsCount[nextLine] + offset) % 4 === 3) {\n // ' >\\t test '\n // ^ -- position start of line here (tab has width===1)\n pos++;\n initial++;\n offset++;\n adjustTab = false;\n } else {\n // ' >\\t test '\n // ^ -- position start of line here + shift bsCount slightly\n // to make extra space appear\n adjustTab = true;\n }\n } else {\n spaceAfterMarker = false;\n }\n\n oldBMarks.push(state.bMarks[nextLine]);\n state.bMarks[nextLine] = pos;\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;\n } else {\n offset++;\n }\n } else {\n break;\n }\n\n pos++;\n }\n\n lastLineEmpty = pos >= max;\n\n oldBSCount.push(state.bsCount[nextLine]);\n state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);\n\n oldSCount.push(state.sCount[nextLine]);\n state.sCount[nextLine] = offset - initial;\n\n oldTShift.push(state.tShift[nextLine]);\n state.tShift[nextLine] = pos - state.bMarks[nextLine];\n continue;\n }\n\n // Case 2: line is not inside the blockquote, and the last line was empty.\n if (lastLineEmpty) { break; }\n\n // Case 3: another tag found.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n\n if (terminate) {\n // Quirk to enforce \"hard termination mode\" for paragraphs;\n // normally if you call `tokenize(state, startLine, nextLine)`,\n // paragraphs will look below nextLine for paragraph continuation,\n // but if blockquote is terminated by another tag, they shouldn't\n state.lineMax = nextLine;\n\n if (state.blkIndent !== 0) {\n // state.blkIndent was non-zero, we now set it to zero,\n // so we need to re-calculate all offsets to appear as\n // if indent wasn't changed\n oldBMarks.push(state.bMarks[nextLine]);\n oldBSCount.push(state.bsCount[nextLine]);\n oldTShift.push(state.tShift[nextLine]);\n oldSCount.push(state.sCount[nextLine]);\n state.sCount[nextLine] -= state.blkIndent;\n }\n\n break;\n }\n\n oldBMarks.push(state.bMarks[nextLine]);\n oldBSCount.push(state.bsCount[nextLine]);\n oldTShift.push(state.tShift[nextLine]);\n oldSCount.push(state.sCount[nextLine]);\n\n // A negative indentation means that this is a paragraph continuation\n //\n state.sCount[nextLine] = -1;\n }\n\n oldIndent = state.blkIndent;\n state.blkIndent = 0;\n\n token = state.push('blockquote_open', 'blockquote', 1);\n token.markup = '>';\n token.map = lines = [ startLine, 0 ];\n\n state.md.block.tokenize(state, startLine, nextLine);\n\n token = state.push('blockquote_close', 'blockquote', -1);\n token.markup = '>';\n\n state.lineMax = oldLineMax;\n state.parentType = oldParentType;\n lines[1] = state.line;\n\n // Restore original tShift; this might not be necessary since the parser\n // has already been here, but just to make sure we can do that.\n for (i = 0; i < oldTShift.length; i++) {\n state.bMarks[i + startLine] = oldBMarks[i];\n state.tShift[i + startLine] = oldTShift[i];\n state.sCount[i + startLine] = oldSCount[i];\n state.bsCount[i + startLine] = oldBSCount[i];\n }\n state.blkIndent = oldIndent;\n\n return true;\n};\n","// Horizontal rule\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function hr(state, startLine, endLine, silent) {\n var marker, cnt, ch, token,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n marker = state.src.charCodeAt(pos++);\n\n // Check hr marker\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x5F/* _ */) {\n return false;\n }\n\n // markers can be mixed with spaces, but there should be at least 3 of them\n\n cnt = 1;\n while (pos < max) {\n ch = state.src.charCodeAt(pos++);\n if (ch !== marker && !isSpace(ch)) { return false; }\n if (ch === marker) { cnt++; }\n }\n\n if (cnt < 3) { return false; }\n\n if (silent) { return true; }\n\n state.line = startLine + 1;\n\n token = state.push('hr', 'hr', 0);\n token.map = [ startLine, state.line ];\n token.markup = Array(cnt + 1).join(String.fromCharCode(marker));\n\n return true;\n};\n","// Lists\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\n// Search `[-+*][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}\n\n// Search `\\d+[.)][\\n ]`, returns next pos after marker on success\n// or -1 on fail.\nfunction skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}\n\nfunction markTightParagraphs(state, idx) {\n var i, l,\n level = state.level + 2;\n\n for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {\n if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {\n state.tokens[i + 2].hidden = true;\n state.tokens[i].hidden = true;\n i += 2;\n }\n }\n}\n\n\nmodule.exports = function list(state, startLine, endLine, silent) {\n var ch,\n contentStart,\n i,\n indent,\n indentAfterMarker,\n initial,\n isOrdered,\n itemLines,\n l,\n listLines,\n listTokIdx,\n markerCharCode,\n markerValue,\n max,\n nextLine,\n offset,\n oldIndent,\n oldLIndent,\n oldParentType,\n oldTShift,\n oldTight,\n pos,\n posAfterMarker,\n prevEmptyEnd,\n start,\n terminate,\n terminatorRules,\n token,\n isTerminatingParagraph = false,\n tight = true;\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n // limit conditions when list can interrupt\n // a paragraph (validation mode only)\n if (silent && state.parentType === 'paragraph') {\n // Next list item should still terminate previous list item;\n //\n // This code can fail if plugins use blkIndent as well as lists,\n // but I hope the spec gets fixed long before that happens.\n //\n if (state.tShift[startLine] >= state.blkIndent) {\n isTerminatingParagraph = true;\n }\n }\n\n // Detect list type and position after marker\n if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {\n isOrdered = true;\n start = state.bMarks[startLine] + state.tShift[startLine];\n markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));\n\n // If we're starting a new ordered list right after\n // a paragraph, it should start with 1.\n if (isTerminatingParagraph && markerValue !== 1) return false;\n\n } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {\n isOrdered = false;\n\n } else {\n return false;\n }\n\n // If we're starting a new unordered list right after\n // a paragraph, first line should not be empty.\n if (isTerminatingParagraph) {\n if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;\n }\n\n // We should terminate list on style change. Remember first one to compare.\n markerCharCode = state.src.charCodeAt(posAfterMarker - 1);\n\n // For validation mode we can terminate immediately\n if (silent) { return true; }\n\n // Start list\n listTokIdx = state.tokens.length;\n\n if (isOrdered) {\n token = state.push('ordered_list_open', 'ol', 1);\n if (markerValue !== 1) {\n token.attrs = [ [ 'start', markerValue ] ];\n }\n\n } else {\n token = state.push('bullet_list_open', 'ul', 1);\n }\n\n token.map = listLines = [ startLine, 0 ];\n token.markup = String.fromCharCode(markerCharCode);\n\n //\n // Iterate list items\n //\n\n nextLine = startLine;\n prevEmptyEnd = false;\n terminatorRules = state.md.block.ruler.getRules('list');\n\n oldParentType = state.parentType;\n state.parentType = 'list';\n\n while (nextLine < endLine) {\n pos = posAfterMarker;\n max = state.eMarks[nextLine];\n\n initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);\n\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (ch === 0x09) {\n offset += 4 - (offset + state.bsCount[nextLine]) % 4;\n } else if (ch === 0x20) {\n offset++;\n } else {\n break;\n }\n\n pos++;\n }\n\n contentStart = pos;\n\n if (contentStart >= max) {\n // trimming space in \"- \\n 3\" case, indent is 1 here\n indentAfterMarker = 1;\n } else {\n indentAfterMarker = offset - initial;\n }\n\n // If we have more than 4 spaces, the indent is 1\n // (the rest is just indented code block)\n if (indentAfterMarker > 4) { indentAfterMarker = 1; }\n\n // \" - test\"\n // ^^^^^ - calculating total length of this thing\n indent = initial + indentAfterMarker;\n\n // Run subparser & write tokens\n token = state.push('list_item_open', 'li', 1);\n token.markup = String.fromCharCode(markerCharCode);\n token.map = itemLines = [ startLine, 0 ];\n\n oldIndent = state.blkIndent;\n oldTight = state.tight;\n oldTShift = state.tShift[startLine];\n oldLIndent = state.sCount[startLine];\n state.blkIndent = indent;\n state.tight = true;\n state.tShift[startLine] = contentStart - state.bMarks[startLine];\n state.sCount[startLine] = offset;\n\n if (contentStart >= max && state.isEmpty(startLine + 1)) {\n // workaround for this case\n // (list item is empty, list terminates before \"foo\"):\n // ~~~~~~~~\n // -\n //\n // foo\n // ~~~~~~~~\n state.line = Math.min(state.line + 2, endLine);\n } else {\n state.md.block.tokenize(state, startLine, endLine, true);\n }\n\n // If any of list item is tight, mark list as tight\n if (!state.tight || prevEmptyEnd) {\n tight = false;\n }\n // Item become loose if finish with empty line,\n // but we should filter last element, because it means list finish\n prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);\n\n state.blkIndent = oldIndent;\n state.tShift[startLine] = oldTShift;\n state.sCount[startLine] = oldLIndent;\n state.tight = oldTight;\n\n token = state.push('list_item_close', 'li', -1);\n token.markup = String.fromCharCode(markerCharCode);\n\n nextLine = startLine = state.line;\n itemLines[1] = nextLine;\n contentStart = state.bMarks[startLine];\n\n if (nextLine >= endLine) { break; }\n\n //\n // Try to check if list is terminated or continued.\n //\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n // fail if terminating block found\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n\n // fail if list has another type\n if (isOrdered) {\n posAfterMarker = skipOrderedListMarker(state, nextLine);\n if (posAfterMarker < 0) { break; }\n } else {\n posAfterMarker = skipBulletListMarker(state, nextLine);\n if (posAfterMarker < 0) { break; }\n }\n\n if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }\n }\n\n // Finalize list\n if (isOrdered) {\n token = state.push('ordered_list_close', 'ol', -1);\n } else {\n token = state.push('bullet_list_close', 'ul', -1);\n }\n token.markup = String.fromCharCode(markerCharCode);\n\n listLines[1] = nextLine;\n state.line = nextLine;\n\n state.parentType = oldParentType;\n\n // mark paragraphs tight if needed\n if (tight) {\n markTightParagraphs(state, listTokIdx);\n }\n\n return true;\n};\n","'use strict';\n\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function reference(state, startLine, _endLine, silent) {\n var ch,\n destEndPos,\n destEndLineNo,\n endLine,\n href,\n i,\n l,\n label,\n labelEnd,\n oldParentType,\n res,\n start,\n str,\n terminate,\n terminatorRules,\n title,\n lines = 0,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine],\n nextLine = startLine + 1;\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }\n\n // Simple check to quickly interrupt scan on [link](url) at the start of line.\n // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54\n while (++pos < max) {\n if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&\n state.src.charCodeAt(pos - 1) !== 0x5C/* \\ */) {\n if (pos + 1 === max) { return false; }\n if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }\n break;\n }\n }\n\n endLine = state.lineMax;\n\n // jump line-by-line until empty one or EOF\n terminatorRules = state.md.block.ruler.getRules('reference');\n\n oldParentType = state.parentType;\n state.parentType = 'reference';\n\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n max = str.length;\n\n for (pos = 1; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x5B /* [ */) {\n return false;\n } else if (ch === 0x5D /* ] */) {\n labelEnd = pos;\n break;\n } else if (ch === 0x0A /* \\n */) {\n lines++;\n } else if (ch === 0x5C /* \\ */) {\n pos++;\n if (pos < max && str.charCodeAt(pos) === 0x0A) {\n lines++;\n }\n }\n }\n\n if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }\n\n // [label]: destination 'title'\n // ^^^ skip optional whitespace here\n for (pos = labelEnd + 2; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x0A) {\n lines++;\n } else if (isSpace(ch)) {\n /*eslint no-empty:0*/\n } else {\n break;\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^^^^^ parse this\n res = state.md.helpers.parseLinkDestination(str, pos, max);\n if (!res.ok) { return false; }\n\n href = state.md.normalizeLink(res.str);\n if (!state.md.validateLink(href)) { return false; }\n\n pos = res.pos;\n lines += res.lines;\n\n // save cursor state, we could require to rollback later\n destEndPos = pos;\n destEndLineNo = lines;\n\n // [label]: destination 'title'\n // ^^^ skipping those spaces\n start = pos;\n for (; pos < max; pos++) {\n ch = str.charCodeAt(pos);\n if (ch === 0x0A) {\n lines++;\n } else if (isSpace(ch)) {\n /*eslint no-empty:0*/\n } else {\n break;\n }\n }\n\n // [label]: destination 'title'\n // ^^^^^^^ parse this\n res = state.md.helpers.parseLinkTitle(str, pos, max);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n lines += res.lines;\n } else {\n title = '';\n pos = destEndPos;\n lines = destEndLineNo;\n }\n\n // skip trailing spaces until the rest of the line\n while (pos < max) {\n ch = str.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n if (title) {\n // garbage at the end of the line after title,\n // but it could still be a valid reference if we roll back\n title = '';\n pos = destEndPos;\n lines = destEndLineNo;\n while (pos < max) {\n ch = str.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n }\n }\n\n if (pos < max && str.charCodeAt(pos) !== 0x0A) {\n // garbage at the end of the line\n return false;\n }\n\n label = normalizeReference(str.slice(1, labelEnd));\n if (!label) {\n // CommonMark 0.20 disallows empty labels\n return false;\n }\n\n // Reference can not terminate anything. This check is for safety only.\n /*istanbul ignore if*/\n if (silent) { return true; }\n\n if (typeof state.env.references === 'undefined') {\n state.env.references = {};\n }\n if (typeof state.env.references[label] === 'undefined') {\n state.env.references[label] = { title: title, href: href };\n }\n\n state.parentType = oldParentType;\n\n state.line = startLine + lines + 1;\n return true;\n};\n","// heading (#, ##, ...)\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function heading(state, startLine, endLine, silent) {\n var ch, level, tmp, token,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x23/* # */ || pos >= max) { return false; }\n\n // count heading level\n level = 1;\n ch = state.src.charCodeAt(++pos);\n while (ch === 0x23/* # */ && pos < max && level <= 6) {\n level++;\n ch = state.src.charCodeAt(++pos);\n }\n\n if (level > 6 || (pos < max && !isSpace(ch))) { return false; }\n\n if (silent) { return true; }\n\n // Let's cut tails like ' ### ' from the end of string\n\n max = state.skipSpacesBack(max, pos);\n tmp = state.skipCharsBack(max, 0x23, pos); // #\n if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {\n max = tmp;\n }\n\n state.line = startLine + 1;\n\n token = state.push('heading_open', 'h' + String(level), 1);\n token.markup = '########'.slice(0, level);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = state.src.slice(pos, max).trim();\n token.map = [ startLine, state.line ];\n token.children = [];\n\n token = state.push('heading_close', 'h' + String(level), -1);\n token.markup = '########'.slice(0, level);\n\n return true;\n};\n","// lheading (---, ===)\n\n'use strict';\n\n\nmodule.exports = function lheading(state, startLine, endLine/*, silent*/) {\n var content, terminate, i, l, token, pos, max, level, marker,\n nextLine = startLine + 1, oldParentType,\n terminatorRules = state.md.block.ruler.getRules('paragraph');\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n oldParentType = state.parentType;\n state.parentType = 'paragraph'; // use paragraph to match terminatorRules\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n //\n // Check for underline in setext header\n //\n if (state.sCount[nextLine] >= state.blkIndent) {\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n\n if (pos < max) {\n marker = state.src.charCodeAt(pos);\n\n if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {\n pos = state.skipChars(pos, marker);\n pos = state.skipSpaces(pos);\n\n if (pos >= max) {\n level = (marker === 0x3D/* = */ ? 1 : 2);\n break;\n }\n }\n }\n }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n if (!level) {\n // Didn't find valid underline\n return false;\n }\n\n content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n\n state.line = nextLine + 1;\n\n token = state.push('heading_open', 'h' + String(level), 1);\n token.markup = String.fromCharCode(marker);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = content;\n token.map = [ startLine, state.line - 1 ];\n token.children = [];\n\n token = state.push('heading_close', 'h' + String(level), -1);\n token.markup = String.fromCharCode(marker);\n\n state.parentType = oldParentType;\n\n return true;\n};\n","// HTML block\n\n'use strict';\n\n\nvar block_names = require('../common/html_blocks');\nvar HTML_OPEN_CLOSE_TAG_RE = require('../common/html_re').HTML_OPEN_CLOSE_TAG_RE;\n\n// An array of opening and corresponding closing sequences for html tags,\n// last argument defines whether it can terminate a paragraph or not\n//\nvar HTML_SEQUENCES = [\n [ /^<(script|pre|style)(?=(\\s|>|$))/i, /<\\/(script|pre|style)>/i, true ],\n [ /^<!--/, /-->/, true ],\n [ /^<\\?/, /\\?>/, true ],\n [ /^<![A-Z]/, />/, true ],\n [ /^<!\\[CDATA\\[/, /\\]\\]>/, true ],\n [ new RegExp('^</?(' + block_names.join('|') + ')(?=(\\\\s|/?>|$))', 'i'), /^$/, true ],\n [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\\\s*$'), /^$/, false ]\n];\n\n\nmodule.exports = function html_block(state, startLine, endLine, silent) {\n var i, nextLine, token, lineText,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n // if it's indented more than 3 spaces, it should be a code block\n if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }\n\n if (!state.md.options.html) { return false; }\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }\n\n lineText = state.src.slice(pos, max);\n\n for (i = 0; i < HTML_SEQUENCES.length; i++) {\n if (HTML_SEQUENCES[i][0].test(lineText)) { break; }\n }\n\n if (i === HTML_SEQUENCES.length) { return false; }\n\n if (silent) {\n // true if this sequence can be a terminator, false otherwise\n return HTML_SEQUENCES[i][2];\n }\n\n nextLine = startLine + 1;\n\n // If we are here - we detected HTML block.\n // Let's roll down till block end.\n if (!HTML_SEQUENCES[i][1].test(lineText)) {\n for (; nextLine < endLine; nextLine++) {\n if (state.sCount[nextLine] < state.blkIndent) { break; }\n\n pos = state.bMarks[nextLine] + state.tShift[nextLine];\n max = state.eMarks[nextLine];\n lineText = state.src.slice(pos, max);\n\n if (HTML_SEQUENCES[i][1].test(lineText)) {\n if (lineText.length !== 0) { nextLine++; }\n break;\n }\n }\n }\n\n state.line = nextLine;\n\n token = state.push('html_block', '', 0);\n token.map = [ startLine, nextLine ];\n token.content = state.getLines(startLine, nextLine, state.blkIndent, true);\n\n return true;\n};\n","// List of valid html blocks names, accorting to commonmark spec\n// http://jgm.github.io/CommonMark/spec.html#html-blocks\n\n'use strict';\n\n\nmodule.exports = [\n 'address',\n 'article',\n 'aside',\n 'base',\n 'basefont',\n 'blockquote',\n 'body',\n 'caption',\n 'center',\n 'col',\n 'colgroup',\n 'dd',\n 'details',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'frame',\n 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hr',\n 'html',\n 'iframe',\n 'legend',\n 'li',\n 'link',\n 'main',\n 'menu',\n 'menuitem',\n 'meta',\n 'nav',\n 'noframes',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'param',\n 'section',\n 'source',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'track',\n 'ul'\n];\n","// Paragraph\n\n'use strict';\n\n\nmodule.exports = function paragraph(state, startLine/*, endLine*/) {\n var content, terminate, i, l, token, oldParentType,\n nextLine = startLine + 1,\n terminatorRules = state.md.block.ruler.getRules('paragraph'),\n endLine = state.lineMax;\n\n oldParentType = state.parentType;\n state.parentType = 'paragraph';\n\n // jump line-by-line until empty one or EOF\n for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {\n // this would be a code block normally, but after paragraph\n // it's considered a lazy continuation regardless of what's there\n if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }\n\n // quirk for blockquotes, this line should already be checked by that rule\n if (state.sCount[nextLine] < 0) { continue; }\n\n // Some tags can terminate paragraph without empty line.\n terminate = false;\n for (i = 0, l = terminatorRules.length; i < l; i++) {\n if (terminatorRules[i](state, nextLine, endLine, true)) {\n terminate = true;\n break;\n }\n }\n if (terminate) { break; }\n }\n\n content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();\n\n state.line = nextLine;\n\n token = state.push('paragraph_open', 'p', 1);\n token.map = [ startLine, state.line ];\n\n token = state.push('inline', '', 0);\n token.content = content;\n token.map = [ startLine, state.line ];\n token.children = [];\n\n token = state.push('paragraph_close', 'p', -1);\n\n state.parentType = oldParentType;\n\n return true;\n};\n","// Parser state class\n\n'use strict';\n\nvar Token = require('../token');\nvar isSpace = require('../common/utils').isSpace;\n\n\nfunction StateBlock(src, md, env, tokens) {\n var ch, s, start, pos, len, indent, offset, indent_found;\n\n this.src = src;\n\n // link to parser instance\n this.md = md;\n\n this.env = env;\n\n //\n // Internal state vartiables\n //\n\n this.tokens = tokens;\n\n this.bMarks = []; // line begin offsets for fast jumps\n this.eMarks = []; // line end offsets for fast jumps\n this.tShift = []; // offsets of the first non-space characters (tabs not expanded)\n this.sCount = []; // indents for each line (tabs expanded)\n\n // An amount of virtual spaces (tabs expanded) between beginning\n // of each line (bMarks) and real beginning of that line.\n //\n // It exists only as a hack because blockquotes override bMarks\n // losing information in the process.\n //\n // It's used only when expanding tabs, you can think about it as\n // an initial tab length, e.g. bsCount=21 applied to string `\\t123`\n // means first tab should be expanded to 4-21%4 === 3 spaces.\n //\n this.bsCount = [];\n\n // block parser variables\n this.blkIndent = 0; // required block content indent\n // (for example, if we are in list)\n this.line = 0; // line index in src\n this.lineMax = 0; // lines count\n this.tight = false; // loose/tight mode for lists\n this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)\n\n // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'\n // used in lists to determine if they interrupt a paragraph\n this.parentType = 'root';\n\n this.level = 0;\n\n // renderer\n this.result = '';\n\n // Create caches\n // Generate markers.\n s = this.src;\n indent_found = false;\n\n for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {\n ch = s.charCodeAt(pos);\n\n if (!indent_found) {\n if (isSpace(ch)) {\n indent++;\n\n if (ch === 0x09) {\n offset += 4 - offset % 4;\n } else {\n offset++;\n }\n continue;\n } else {\n indent_found = true;\n }\n }\n\n if (ch === 0x0A || pos === len - 1) {\n if (ch !== 0x0A) { pos++; }\n this.bMarks.push(start);\n this.eMarks.push(pos);\n this.tShift.push(indent);\n this.sCount.push(offset);\n this.bsCount.push(0);\n\n indent_found = false;\n indent = 0;\n offset = 0;\n start = pos + 1;\n }\n }\n\n // Push fake entry to simplify cache bounds checks\n this.bMarks.push(s.length);\n this.eMarks.push(s.length);\n this.tShift.push(0);\n this.sCount.push(0);\n this.bsCount.push(0);\n\n this.lineMax = this.bMarks.length - 1; // don't count last fake line\n}\n\n// Push new token to \"stream\".\n//\nStateBlock.prototype.push = function (type, tag, nesting) {\n var token = new Token(type, tag, nesting);\n token.block = true;\n\n if (nesting < 0) { this.level--; }\n token.level = this.level;\n if (nesting > 0) { this.level++; }\n\n this.tokens.push(token);\n return token;\n};\n\nStateBlock.prototype.isEmpty = function isEmpty(line) {\n return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];\n};\n\nStateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {\n for (var max = this.lineMax; from < max; from++) {\n if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {\n break;\n }\n }\n return from;\n};\n\n// Skip spaces from given position.\nStateBlock.prototype.skipSpaces = function skipSpaces(pos) {\n var ch;\n\n for (var max = this.src.length; pos < max; pos++) {\n ch = this.src.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n }\n return pos;\n};\n\n// Skip spaces from given position in reverse.\nStateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {\n if (pos <= min) { return pos; }\n\n while (pos > min) {\n if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }\n }\n return pos;\n};\n\n// Skip char codes from given position\nStateBlock.prototype.skipChars = function skipChars(pos, code) {\n for (var max = this.src.length; pos < max; pos++) {\n if (this.src.charCodeAt(pos) !== code) { break; }\n }\n return pos;\n};\n\n// Skip char codes reverse from given position - 1\nStateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {\n if (pos <= min) { return pos; }\n\n while (pos > min) {\n if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }\n }\n return pos;\n};\n\n// cut lines range from source.\nStateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {\n var i, lineIndent, ch, first, last, queue, lineStart,\n line = begin;\n\n if (begin >= end) {\n return '';\n }\n\n queue = new Array(end - begin);\n\n for (i = 0; line < end; line++, i++) {\n lineIndent = 0;\n lineStart = first = this.bMarks[line];\n\n if (line + 1 < end || keepLastLF) {\n // No need for bounds check because we have fake entry on tail.\n last = this.eMarks[line] + 1;\n } else {\n last = this.eMarks[line];\n }\n\n while (first < last && lineIndent < indent) {\n ch = this.src.charCodeAt(first);\n\n if (isSpace(ch)) {\n if (ch === 0x09) {\n lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;\n } else {\n lineIndent++;\n }\n } else if (first - lineStart < this.tShift[line]) {\n // patched tShift masked characters to look like spaces (blockquotes, list markers)\n lineIndent++;\n } else {\n break;\n }\n\n first++;\n }\n\n if (lineIndent > indent) {\n // partially expanding tabs in code blocks, e.g '\\t\\tfoobar'\n // with indent=2 becomes ' \\tfoobar'\n queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);\n } else {\n queue[i] = this.src.slice(first, last);\n }\n }\n\n return queue.join('');\n};\n\n// re-export Token class to use in block rules\nStateBlock.prototype.Token = Token;\n\n\nmodule.exports = StateBlock;\n","/** internal\n * class ParserInline\n *\n * Tokenizes paragraph content.\n **/\n'use strict';\n\n\nvar Ruler = require('./ruler');\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Parser rules\n\nvar _rules = [\n [ 'text', require('./rules_inline/text') ],\n [ 'newline', require('./rules_inline/newline') ],\n [ 'escape', require('./rules_inline/escape') ],\n [ 'backticks', require('./rules_inline/backticks') ],\n [ 'strikethrough', require('./rules_inline/strikethrough').tokenize ],\n [ 'emphasis', require('./rules_inline/emphasis').tokenize ],\n [ 'link', require('./rules_inline/link') ],\n [ 'image', require('./rules_inline/image') ],\n [ 'autolink', require('./rules_inline/autolink') ],\n [ 'html_inline', require('./rules_inline/html_inline') ],\n [ 'entity', require('./rules_inline/entity') ]\n];\n\nvar _rules2 = [\n [ 'balance_pairs', require('./rules_inline/balance_pairs') ],\n [ 'strikethrough', require('./rules_inline/strikethrough').postProcess ],\n [ 'emphasis', require('./rules_inline/emphasis').postProcess ],\n [ 'text_collapse', require('./rules_inline/text_collapse') ]\n];\n\n\n/**\n * new ParserInline()\n **/\nfunction ParserInline() {\n var i;\n\n /**\n * ParserInline#ruler -> Ruler\n *\n * [[Ruler]] instance. Keep configuration of inline rules.\n **/\n this.ruler = new Ruler();\n\n for (i = 0; i < _rules.length; i++) {\n this.ruler.push(_rules[i][0], _rules[i][1]);\n }\n\n /**\n * ParserInline#ruler2 -> Ruler\n *\n * [[Ruler]] instance. Second ruler used for post-processing\n * (e.g. in emphasis-like rules).\n **/\n this.ruler2 = new Ruler();\n\n for (i = 0; i < _rules2.length; i++) {\n this.ruler2.push(_rules2[i][0], _rules2[i][1]);\n }\n}\n\n\n// Skip single token by running all rules in validation mode;\n// returns `true` if any rule reported success\n//\nParserInline.prototype.skipToken = function (state) {\n var ok, i, pos = state.pos,\n rules = this.ruler.getRules(''),\n len = rules.length,\n maxNesting = state.md.options.maxNesting,\n cache = state.cache;\n\n\n if (typeof cache[pos] !== 'undefined') {\n state.pos = cache[pos];\n return;\n }\n\n if (state.level < maxNesting) {\n for (i = 0; i < len; i++) {\n // Increment state.level and decrement it later to limit recursion.\n // It's harmless to do here, because no tokens are created. But ideally,\n // we'd need a separate private state variable for this purpose.\n //\n state.level++;\n ok = rules[i](state, true);\n state.level--;\n\n if (ok) { break; }\n }\n } else {\n // Too much nesting, just skip until the end of the paragraph.\n //\n // NOTE: this will cause links to behave incorrectly in the following case,\n // when an amount of `[` is exactly equal to `maxNesting + 1`:\n //\n // [[[[[[[[[[[[[[[[[[[[[foo]()\n //\n // TODO: remove this workaround when CM standard will allow nested links\n // (we can replace it by preventing links from being parsed in\n // validation mode)\n //\n state.pos = state.posMax;\n }\n\n if (!ok) { state.pos++; }\n cache[pos] = state.pos;\n};\n\n\n// Generate tokens for input range\n//\nParserInline.prototype.tokenize = function (state) {\n var ok, i,\n rules = this.ruler.getRules(''),\n len = rules.length,\n end = state.posMax,\n maxNesting = state.md.options.maxNesting;\n\n while (state.pos < end) {\n // Try all possible rules.\n // On success, rule should:\n //\n // - update `state.pos`\n // - update `state.tokens`\n // - return true\n\n if (state.level < maxNesting) {\n for (i = 0; i < len; i++) {\n ok = rules[i](state, false);\n if (ok) { break; }\n }\n }\n\n if (ok) {\n if (state.pos >= end) { break; }\n continue;\n }\n\n state.pending += state.src[state.pos++];\n }\n\n if (state.pending) {\n state.pushPending();\n }\n};\n\n\n/**\n * ParserInline.parse(str, md, env, outTokens)\n *\n * Process input string and push inline tokens into `outTokens`\n **/\nParserInline.prototype.parse = function (str, md, env, outTokens) {\n var i, rules, len;\n var state = new this.State(str, md, env, outTokens);\n\n this.tokenize(state);\n\n rules = this.ruler2.getRules('');\n len = rules.length;\n\n for (i = 0; i < len; i++) {\n rules[i](state);\n }\n};\n\n\nParserInline.prototype.State = require('./rules_inline/state_inline');\n\n\nmodule.exports = ParserInline;\n","// Skip text characters for text token, place those to pending buffer\n// and increment current pos\n\n'use strict';\n\n\n// Rule to skip pure text\n// '{}$%@~+=:' reserved for extentions\n\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \\, ], ^, _, `, {, |, }, or ~\n\n// !!!! Don't confuse with \"Markdown ASCII Punctuation\" chars\n// http://spec.commonmark.org/0.15/#ascii-punctuation-character\nfunction isTerminatorChar(ch) {\n switch (ch) {\n case 0x0A/* \\n */:\n case 0x21/* ! */:\n case 0x23/* # */:\n case 0x24/* $ */:\n case 0x25/* % */:\n case 0x26/* & */:\n case 0x2A/* * */:\n case 0x2B/* + */:\n case 0x2D/* - */:\n case 0x3A/* : */:\n case 0x3C/* < */:\n case 0x3D/* = */:\n case 0x3E/* > */:\n case 0x40/* @ */:\n case 0x5B/* [ */:\n case 0x5C/* \\ */:\n case 0x5D/* ] */:\n case 0x5E/* ^ */:\n case 0x5F/* _ */:\n case 0x60/* ` */:\n case 0x7B/* { */:\n case 0x7D/* } */:\n case 0x7E/* ~ */:\n return true;\n default:\n return false;\n }\n}\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos;\n\n while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {\n pos++;\n }\n\n if (pos === state.pos) { return false; }\n\n if (!silent) { state.pending += state.src.slice(state.pos, pos); }\n\n state.pos = pos;\n\n return true;\n};\n\n// Alternative implementation, for memory.\n//\n// It costs 10% of performance, but allows extend terminators list, if place it\n// to `ParcerInline` property. Probably, will switch to it sometime, such\n// flexibility required.\n\n/*\nvar TERMINATOR_RE = /[\\n!#$%&*+\\-:<=>@[\\\\\\]^_`{}~]/;\n\nmodule.exports = function text(state, silent) {\n var pos = state.pos,\n idx = state.src.slice(pos).search(TERMINATOR_RE);\n\n // first char is terminator -> empty text\n if (idx === 0) { return false; }\n\n // no terminator -> text till end of string\n if (idx < 0) {\n if (!silent) { state.pending += state.src.slice(pos); }\n state.pos = state.src.length;\n return true;\n }\n\n if (!silent) { state.pending += state.src.slice(pos, pos + idx); }\n\n state.pos += idx;\n\n return true;\n};*/\n","// Proceess '\\n'\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function newline(state, silent) {\n var pmax, max, pos = state.pos;\n\n if (state.src.charCodeAt(pos) !== 0x0A/* \\n */) { return false; }\n\n pmax = state.pending.length - 1;\n max = state.posMax;\n\n // ' \\n' -> hardbreak\n // Lookup in pending chars is bad practice! Don't copy to other rules!\n // Pending string is stored in concat mode, indexed lookups will cause\n // convertion to flat mode.\n if (!silent) {\n if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {\n if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {\n state.pending = state.pending.replace(/ +$/, '');\n state.push('hardbreak', 'br', 0);\n } else {\n state.pending = state.pending.slice(0, -1);\n state.push('softbreak', 'br', 0);\n }\n\n } else {\n state.push('softbreak', 'br', 0);\n }\n }\n\n pos++;\n\n // skip heading spaces for next line\n while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }\n\n state.pos = pos;\n return true;\n};\n","// Process escaped chars and hardbreaks\n\n'use strict';\n\nvar isSpace = require('../common/utils').isSpace;\n\nvar ESCAPED = [];\n\nfor (var i = 0; i < 256; i++) { ESCAPED.push(0); }\n\n'\\\\!\"#$%&\\'()*+,./:;<=>?@[]^_`{|}~-'\n .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });\n\n\nmodule.exports = function escape(state, silent) {\n var ch, pos = state.pos, max = state.posMax;\n\n if (state.src.charCodeAt(pos) !== 0x5C/* \\ */) { return false; }\n\n pos++;\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (ch < 256 && ESCAPED[ch] !== 0) {\n if (!silent) { state.pending += state.src[pos]; }\n state.pos += 2;\n return true;\n }\n\n if (ch === 0x0A) {\n if (!silent) {\n state.push('hardbreak', 'br', 0);\n }\n\n pos++;\n // skip leading whitespaces from next line\n while (pos < max) {\n ch = state.src.charCodeAt(pos);\n if (!isSpace(ch)) { break; }\n pos++;\n }\n\n state.pos = pos;\n return true;\n }\n }\n\n if (!silent) { state.pending += '\\\\'; }\n state.pos++;\n return true;\n};\n","// Parse backticks\n\n'use strict';\n\nmodule.exports = function backtick(state, silent) {\n var start, max, marker, matchStart, matchEnd, token,\n pos = state.pos,\n ch = state.src.charCodeAt(pos);\n\n if (ch !== 0x60/* ` */) { return false; }\n\n start = pos;\n pos++;\n max = state.posMax;\n\n while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }\n\n marker = state.src.slice(start, pos);\n\n matchStart = matchEnd = pos;\n\n while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {\n matchEnd = matchStart + 1;\n\n while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }\n\n if (matchEnd - matchStart === marker.length) {\n if (!silent) {\n token = state.push('code_inline', 'code', 0);\n token.markup = marker;\n token.content = state.src.slice(pos, matchStart)\n .replace(/[ \\n]+/g, ' ')\n .trim();\n }\n state.pos = matchEnd;\n return true;\n }\n }\n\n if (!silent) { state.pending += marker; }\n state.pos += marker.length;\n return true;\n};\n","// Process [link](<to> \"stuff\")\n\n'use strict';\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function link(state, silent) {\n var attrs,\n code,\n label,\n labelEnd,\n labelStart,\n pos,\n res,\n ref,\n title,\n token,\n href = '',\n oldPos = state.pos,\n max = state.posMax,\n start = state.pos,\n parseReference = true;\n\n if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }\n\n labelStart = state.pos + 1;\n labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false; }\n\n pos = labelEnd + 1;\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // might have found a valid shortcut link, disable reference parsing\n parseReference = false;\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n pos++;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n if (pos >= max) { return false; }\n\n // [link]( <href> \"title\" )\n // ^^^^^^ parsing link destination\n start = pos;\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n if (res.ok) {\n href = state.md.normalizeLink(res.str);\n if (state.md.validateLink(href)) {\n pos = res.pos;\n } else {\n href = '';\n }\n }\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n start = pos;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n\n // [link]( <href> \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n } else {\n title = '';\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n // parsing a valid shortcut link failed, fallback to reference\n parseReference = true;\n }\n pos++;\n }\n\n if (parseReference) {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false; }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1;\n pos = state.md.helpers.parseLinkLabel(state, pos);\n if (pos >= 0) {\n label = state.src.slice(start, pos++);\n } else {\n pos = labelEnd + 1;\n }\n } else {\n pos = labelEnd + 1;\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd); }\n\n ref = state.env.references[normalizeReference(label)];\n if (!ref) {\n state.pos = oldPos;\n return false;\n }\n href = ref.href;\n title = ref.title;\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n state.pos = labelStart;\n state.posMax = labelEnd;\n\n token = state.push('link_open', 'a', 1);\n token.attrs = attrs = [ [ 'href', href ] ];\n if (title) {\n attrs.push([ 'title', title ]);\n }\n\n state.md.inline.tokenize(state);\n\n token = state.push('link_close', 'a', -1);\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n};\n","// Process ![image](<src> \"title\")\n\n'use strict';\n\nvar normalizeReference = require('../common/utils').normalizeReference;\nvar isSpace = require('../common/utils').isSpace;\n\n\nmodule.exports = function image(state, silent) {\n var attrs,\n code,\n content,\n label,\n labelEnd,\n labelStart,\n pos,\n ref,\n res,\n title,\n token,\n tokens,\n start,\n href = '',\n oldPos = state.pos,\n max = state.posMax;\n\n if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }\n if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }\n\n labelStart = state.pos + 2;\n labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);\n\n // parser failed to find ']', so it's not a valid link\n if (labelEnd < 0) { return false; }\n\n pos = labelEnd + 1;\n if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {\n //\n // Inline link\n //\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n pos++;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n if (pos >= max) { return false; }\n\n // [link]( <href> \"title\" )\n // ^^^^^^ parsing link destination\n start = pos;\n res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);\n if (res.ok) {\n href = state.md.normalizeLink(res.str);\n if (state.md.validateLink(href)) {\n pos = res.pos;\n } else {\n href = '';\n }\n }\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n start = pos;\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n\n // [link]( <href> \"title\" )\n // ^^^^^^^ parsing link title\n res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);\n if (pos < max && start !== pos && res.ok) {\n title = res.str;\n pos = res.pos;\n\n // [link]( <href> \"title\" )\n // ^^ skipping these spaces\n for (; pos < max; pos++) {\n code = state.src.charCodeAt(pos);\n if (!isSpace(code) && code !== 0x0A) { break; }\n }\n } else {\n title = '';\n }\n\n if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {\n state.pos = oldPos;\n return false;\n }\n pos++;\n } else {\n //\n // Link reference\n //\n if (typeof state.env.references === 'undefined') { return false; }\n\n if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {\n start = pos + 1;\n pos = state.md.helpers.parseLinkLabel(state, pos);\n if (pos >= 0) {\n label = state.src.slice(start, pos++);\n } else {\n pos = labelEnd + 1;\n }\n } else {\n pos = labelEnd + 1;\n }\n\n // covers label === '' and label === undefined\n // (collapsed reference link and shortcut reference link respectively)\n if (!label) { label = state.src.slice(labelStart, labelEnd); }\n\n ref = state.env.references[normalizeReference(label)];\n if (!ref) {\n state.pos = oldPos;\n return false;\n }\n href = ref.href;\n title = ref.title;\n }\n\n //\n // We found the end of the link, and know for a fact it's a valid link;\n // so all that's left to do is to call tokenizer.\n //\n if (!silent) {\n content = state.src.slice(labelStart, labelEnd);\n\n state.md.inline.parse(\n content,\n state.md,\n state.env,\n tokens = []\n );\n\n token = state.push('image', 'img', 0);\n token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];\n token.children = tokens;\n token.content = content;\n\n if (title) {\n attrs.push([ 'title', title ]);\n }\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n};\n","// Process autolinks '<protocol:...>'\n\n'use strict';\n\n\n/*eslint max-len:0*/\nvar EMAIL_RE = /^<([a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/;\nvar AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\\-]{1,31}):([^<>\\x00-\\x20]*)>/;\n\n\nmodule.exports = function autolink(state, silent) {\n var tail, linkMatch, emailMatch, url, fullUrl, token,\n pos = state.pos;\n\n if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }\n\n tail = state.src.slice(pos);\n\n if (tail.indexOf('>') < 0) { return false; }\n\n if (AUTOLINK_RE.test(tail)) {\n linkMatch = tail.match(AUTOLINK_RE);\n\n url = linkMatch[0].slice(1, -1);\n fullUrl = state.md.normalizeLink(url);\n if (!state.md.validateLink(fullUrl)) { return false; }\n\n if (!silent) {\n token = state.push('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.markup = 'autolink';\n token.info = 'auto';\n\n token = state.push('text', '', 0);\n token.content = state.md.normalizeLinkText(url);\n\n token = state.push('link_close', 'a', -1);\n token.markup = 'autolink';\n token.info = 'auto';\n }\n\n state.pos += linkMatch[0].length;\n return true;\n }\n\n if (EMAIL_RE.test(tail)) {\n emailMatch = tail.match(EMAIL_RE);\n\n url = emailMatch[0].slice(1, -1);\n fullUrl = state.md.normalizeLink('mailto:' + url);\n if (!state.md.validateLink(fullUrl)) { return false; }\n\n if (!silent) {\n token = state.push('link_open', 'a', 1);\n token.attrs = [ [ 'href', fullUrl ] ];\n token.markup = 'autolink';\n token.info = 'auto';\n\n token = state.push('text', '', 0);\n token.content = state.md.normalizeLinkText(url);\n\n token = state.push('link_close', 'a', -1);\n token.markup = 'autolink';\n token.info = 'auto';\n }\n\n state.pos += emailMatch[0].length;\n return true;\n }\n\n return false;\n};\n","// Process html tags\n\n'use strict';\n\n\nvar HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE;\n\n\nfunction isLetter(ch) {\n /*eslint no-bitwise:0*/\n var lc = ch | 0x20; // to lower case\n return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);\n}\n\n\nmodule.exports = function html_inline(state, silent) {\n var ch, match, max, token,\n pos = state.pos;\n\n if (!state.md.options.html) { return false; }\n\n // Check start\n max = state.posMax;\n if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||\n pos + 2 >= max) {\n return false;\n }\n\n // Quick fail on second char\n ch = state.src.charCodeAt(pos + 1);\n if (ch !== 0x21/* ! */ &&\n ch !== 0x3F/* ? */ &&\n ch !== 0x2F/* / */ &&\n !isLetter(ch)) {\n return false;\n }\n\n match = state.src.slice(pos).match(HTML_TAG_RE);\n if (!match) { return false; }\n\n if (!silent) {\n token = state.push('html_inline', '', 0);\n token.content = state.src.slice(pos, pos + match[0].length);\n }\n state.pos += match[0].length;\n return true;\n};\n","// Process html entity - {, ¯, ", ...\n\n'use strict';\n\nvar entities = require('../common/entities');\nvar has = require('../common/utils').has;\nvar isValidEntityCode = require('../common/utils').isValidEntityCode;\nvar fromCodePoint = require('../common/utils').fromCodePoint;\n\n\nvar DIGITAL_RE = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i;\nvar NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;\n\n\nmodule.exports = function entity(state, silent) {\n var ch, code, match, pos = state.pos, max = state.posMax;\n\n if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }\n\n if (pos + 1 < max) {\n ch = state.src.charCodeAt(pos + 1);\n\n if (ch === 0x23 /* # */) {\n match = state.src.slice(pos).match(DIGITAL_RE);\n if (match) {\n if (!silent) {\n code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);\n state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);\n }\n state.pos += match[0].length;\n return true;\n }\n } else {\n match = state.src.slice(pos).match(NAMED_RE);\n if (match) {\n if (has(entities, match[1])) {\n if (!silent) { state.pending += entities[match[1]]; }\n state.pos += match[0].length;\n return true;\n }\n }\n }\n }\n\n if (!silent) { state.pending += '&'; }\n state.pos++;\n return true;\n};\n","// For each opening emphasis-like marker find a matching closing one\n//\n'use strict';\n\n\nmodule.exports = function link_pairs(state) {\n var i, j, lastDelim, currDelim,\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = 0; i < max; i++) {\n lastDelim = delimiters[i];\n\n if (!lastDelim.close) { continue; }\n\n j = i - lastDelim.jump - 1;\n\n while (j >= 0) {\n currDelim = delimiters[j];\n\n if (currDelim.open &&\n currDelim.marker === lastDelim.marker &&\n currDelim.end < 0 &&\n currDelim.level === lastDelim.level) {\n\n // typeofs are for backward compatibility with plugins\n var odd_match = (currDelim.close || lastDelim.open) &&\n typeof currDelim.length !== 'undefined' &&\n typeof lastDelim.length !== 'undefined' &&\n (currDelim.length + lastDelim.length) % 3 === 0;\n\n if (!odd_match) {\n lastDelim.jump = i - j;\n lastDelim.open = false;\n currDelim.end = i;\n currDelim.jump = 0;\n break;\n }\n }\n\n j -= currDelim.jump + 1;\n }\n }\n};\n","// Merge adjacent text nodes into one, and re-calculate all token levels\n//\n'use strict';\n\n\nmodule.exports = function text_collapse(state) {\n var curr, last,\n level = 0,\n tokens = state.tokens,\n max = state.tokens.length;\n\n for (curr = last = 0; curr < max; curr++) {\n // re-calculate levels\n level += tokens[curr].nesting;\n tokens[curr].level = level;\n\n if (tokens[curr].type === 'text' &&\n curr + 1 < max &&\n tokens[curr + 1].type === 'text') {\n\n // collapse two adjacent text nodes\n tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;\n } else {\n if (curr !== last) { tokens[last] = tokens[curr]; }\n\n last++;\n }\n }\n\n if (curr !== last) {\n tokens.length = last;\n }\n};\n","// Inline parser state\n\n'use strict';\n\n\nvar Token = require('../token');\nvar isWhiteSpace = require('../common/utils').isWhiteSpace;\nvar isPunctChar = require('../common/utils').isPunctChar;\nvar isMdAsciiPunct = require('../common/utils').isMdAsciiPunct;\n\n\nfunction StateInline(src, md, env, outTokens) {\n this.src = src;\n this.env = env;\n this.md = md;\n this.tokens = outTokens;\n\n this.pos = 0;\n this.posMax = this.src.length;\n this.level = 0;\n this.pending = '';\n this.pendingLevel = 0;\n\n this.cache = {}; // Stores { start: end } pairs. Useful for backtrack\n // optimization of pairs parse (emphasis, strikes).\n\n this.delimiters = []; // Emphasis-like delimiters\n}\n\n\n// Flush pending text\n//\nStateInline.prototype.pushPending = function () {\n var token = new Token('text', '', 0);\n token.content = this.pending;\n token.level = this.pendingLevel;\n this.tokens.push(token);\n this.pending = '';\n return token;\n};\n\n\n// Push new token to \"stream\".\n// If pending text exists - flush it as text token\n//\nStateInline.prototype.push = function (type, tag, nesting) {\n if (this.pending) {\n this.pushPending();\n }\n\n var token = new Token(type, tag, nesting);\n\n if (nesting < 0) { this.level--; }\n token.level = this.level;\n if (nesting > 0) { this.level++; }\n\n this.pendingLevel = this.level;\n this.tokens.push(token);\n return token;\n};\n\n\n// Scan a sequence of emphasis-like markers, and determine whether\n// it can start an emphasis sequence or end an emphasis sequence.\n//\n// - start - position to scan from (it should point at a valid marker);\n// - canSplitWord - determine if these markers can be found inside a word\n//\nStateInline.prototype.scanDelims = function (start, canSplitWord) {\n var pos = start, lastChar, nextChar, count, can_open, can_close,\n isLastWhiteSpace, isLastPunctChar,\n isNextWhiteSpace, isNextPunctChar,\n left_flanking = true,\n right_flanking = true,\n max = this.posMax,\n marker = this.src.charCodeAt(start);\n\n // treat beginning of the line as a whitespace\n lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;\n\n while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }\n\n count = pos - start;\n\n // treat end of the line as a whitespace\n nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;\n\n isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));\n isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));\n\n isLastWhiteSpace = isWhiteSpace(lastChar);\n isNextWhiteSpace = isWhiteSpace(nextChar);\n\n if (isNextWhiteSpace) {\n left_flanking = false;\n } else if (isNextPunctChar) {\n if (!(isLastWhiteSpace || isLastPunctChar)) {\n left_flanking = false;\n }\n }\n\n if (isLastWhiteSpace) {\n right_flanking = false;\n } else if (isLastPunctChar) {\n if (!(isNextWhiteSpace || isNextPunctChar)) {\n right_flanking = false;\n }\n }\n\n if (!canSplitWord) {\n can_open = left_flanking && (!right_flanking || isLastPunctChar);\n can_close = right_flanking && (!left_flanking || isNextPunctChar);\n } else {\n can_open = left_flanking;\n can_close = right_flanking;\n }\n\n return {\n can_open: can_open,\n can_close: can_close,\n length: count\n };\n};\n\n\n// re-export Token class to use in block rules\nStateInline.prototype.Token = Token;\n\n\nmodule.exports = StateInline;\n","'use strict';\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Helpers\n\n// Merge objects\n//\nfunction assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n sources.forEach(function (source) {\n if (!source) { return; }\n\n Object.keys(source).forEach(function (key) {\n obj[key] = source[key];\n });\n });\n\n return obj;\n}\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\nfunction isString(obj) { return _class(obj) === '[object String]'; }\nfunction isObject(obj) { return _class(obj) === '[object Object]'; }\nfunction isRegExp(obj) { return _class(obj) === '[object RegExp]'; }\nfunction isFunction(obj) { return _class(obj) === '[object Function]'; }\n\n\nfunction escapeRE(str) { return str.replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&'); }\n\n////////////////////////////////////////////////////////////////////////////////\n\n\nvar defaultOptions = {\n fuzzyLink: true,\n fuzzyEmail: true,\n fuzzyIP: false\n};\n\n\nfunction isOptionsObj(obj) {\n return Object.keys(obj || {}).reduce(function (acc, k) {\n return acc || defaultOptions.hasOwnProperty(k);\n }, false);\n}\n\n\nvar defaultSchemas = {\n 'http:': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.http) {\n // compile lazily, because \"host\"-containing variables can change on tlds update.\n self.re.http = new RegExp(\n '^\\\\/\\\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'\n );\n }\n if (self.re.http.test(tail)) {\n return tail.match(self.re.http)[0].length;\n }\n return 0;\n }\n },\n 'https:': 'http:',\n 'ftp:': 'http:',\n '//': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.no_http) {\n // compile lazily, because \"host\"-containing variables can change on tlds update.\n self.re.no_http = new RegExp(\n '^' +\n self.re.src_auth +\n // Don't allow single-level domains, because of false positives like '//test'\n // with code comments\n '(?:localhost|(?:(?:' + self.re.src_domain + ')\\\\.)+' + self.re.src_domain_root + ')' +\n self.re.src_port +\n self.re.src_host_terminator +\n self.re.src_path,\n\n 'i'\n );\n }\n\n if (self.re.no_http.test(tail)) {\n // should not be `://` & `///`, that protects from errors in protocol name\n if (pos >= 3 && text[pos - 3] === ':') { return 0; }\n if (pos >= 3 && text[pos - 3] === '/') { return 0; }\n return tail.match(self.re.no_http)[0].length;\n }\n return 0;\n }\n },\n 'mailto:': {\n validate: function (text, pos, self) {\n var tail = text.slice(pos);\n\n if (!self.re.mailto) {\n self.re.mailto = new RegExp(\n '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'\n );\n }\n if (self.re.mailto.test(tail)) {\n return tail.match(self.re.mailto)[0].length;\n }\n return 0;\n }\n }\n};\n\n/*eslint-disable max-len*/\n\n// RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)\nvar tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';\n\n// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead\nvar tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');\n\n/*eslint-enable max-len*/\n\n////////////////////////////////////////////////////////////////////////////////\n\nfunction resetScanCache(self) {\n self.__index__ = -1;\n self.__text_cache__ = '';\n}\n\nfunction createValidator(re) {\n return function (text, pos) {\n var tail = text.slice(pos);\n\n if (re.test(tail)) {\n return tail.match(re)[0].length;\n }\n return 0;\n };\n}\n\nfunction createNormalizer() {\n return function (match, self) {\n self.normalize(match);\n };\n}\n\n// Schemas compiler. Build regexps.\n//\nfunction compile(self) {\n\n // Load & clone RE patterns.\n var re = self.re = require('./lib/re')(self.__opts__);\n\n // Define dynamic patterns\n var tlds = self.__tlds__.slice();\n\n self.onCompile();\n\n if (!self.__tlds_replaced__) {\n tlds.push(tlds_2ch_src_re);\n }\n tlds.push(re.src_xn);\n\n re.src_tlds = tlds.join('|');\n\n function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }\n\n re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');\n re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');\n re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');\n re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');\n\n //\n // Compile each schema\n //\n\n var aliases = [];\n\n self.__compiled__ = {}; // Reset compiled data\n\n function schemaError(name, val) {\n throw new Error('(LinkifyIt) Invalid schema \"' + name + '\": ' + val);\n }\n\n Object.keys(self.__schemas__).forEach(function (name) {\n var val = self.__schemas__[name];\n\n // skip disabled methods\n if (val === null) { return; }\n\n var compiled = { validate: null, link: null };\n\n self.__compiled__[name] = compiled;\n\n if (isObject(val)) {\n if (isRegExp(val.validate)) {\n compiled.validate = createValidator(val.validate);\n } else if (isFunction(val.validate)) {\n compiled.validate = val.validate;\n } else {\n schemaError(name, val);\n }\n\n if (isFunction(val.normalize)) {\n compiled.normalize = val.normalize;\n } else if (!val.normalize) {\n compiled.normalize = createNormalizer();\n } else {\n schemaError(name, val);\n }\n\n return;\n }\n\n if (isString(val)) {\n aliases.push(name);\n return;\n }\n\n schemaError(name, val);\n });\n\n //\n // Compile postponed aliases\n //\n\n aliases.forEach(function (alias) {\n if (!self.__compiled__[self.__schemas__[alias]]) {\n // Silently fail on missed schemas to avoid errons on disable.\n // schemaError(alias, self.__schemas__[alias]);\n return;\n }\n\n self.__compiled__[alias].validate =\n self.__compiled__[self.__schemas__[alias]].validate;\n self.__compiled__[alias].normalize =\n self.__compiled__[self.__schemas__[alias]].normalize;\n });\n\n //\n // Fake record for guessed links\n //\n self.__compiled__[''] = { validate: null, normalize: createNormalizer() };\n\n //\n // Build schema condition\n //\n var slist = Object.keys(self.__compiled__)\n .filter(function (name) {\n // Filter disabled & fake schemas\n return name.length > 0 && self.__compiled__[name];\n })\n .map(escapeRE)\n .join('|');\n // (?!_) cause 1.5x slowdown\n self.re.schema_test = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');\n self.re.schema_search = RegExp('(^|(?!_)(?:[><\\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');\n\n self.re.pretest = RegExp(\n '(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',\n 'i'\n );\n\n //\n // Cleanup\n //\n\n resetScanCache(self);\n}\n\n/**\n * class Match\n *\n * Match result. Single element of array, returned by [[LinkifyIt#match]]\n **/\nfunction Match(self, shift) {\n var start = self.__index__,\n end = self.__last_index__,\n text = self.__text_cache__.slice(start, end);\n\n /**\n * Match#schema -> String\n *\n * Prefix (protocol) for matched string.\n **/\n this.schema = self.__schema__.toLowerCase();\n /**\n * Match#index -> Number\n *\n * First position of matched string.\n **/\n this.index = start + shift;\n /**\n * Match#lastIndex -> Number\n *\n * Next position after matched string.\n **/\n this.lastIndex = end + shift;\n /**\n * Match#raw -> String\n *\n * Matched string.\n **/\n this.raw = text;\n /**\n * Match#text -> String\n *\n * Notmalized text of matched string.\n **/\n this.text = text;\n /**\n * Match#url -> String\n *\n * Normalized url of matched string.\n **/\n this.url = text;\n}\n\nfunction createMatch(self, shift) {\n var match = new Match(self, shift);\n\n self.__compiled__[match.schema].normalize(match, self);\n\n return match;\n}\n\n\n/**\n * class LinkifyIt\n **/\n\n/**\n * new LinkifyIt(schemas, options)\n * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)\n * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }\n *\n * Creates new linkifier instance with optional additional schemas.\n * Can be called without `new` keyword for convenience.\n *\n * By default understands:\n *\n * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links\n * - \"fuzzy\" links and emails (example.com, foo@bar.com).\n *\n * `schemas` is an object, where each key/value describes protocol/rule:\n *\n * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`\n * for example). `linkify-it` makes shure that prefix is not preceeded with\n * alphanumeric char and symbols. Only whitespaces and punctuation allowed.\n * - __value__ - rule to check tail after link prefix\n * - _String_ - just alias to existing rule\n * - _Object_\n * - _validate_ - validator function (should return matched length on success),\n * or `RegExp`.\n * - _normalize_ - optional function to normalize text & url of matched result\n * (for example, for @twitter mentions).\n *\n * `options`:\n *\n * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.\n * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts\n * like version numbers. Default `false`.\n * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.\n *\n **/\nfunction LinkifyIt(schemas, options) {\n if (!(this instanceof LinkifyIt)) {\n return new LinkifyIt(schemas, options);\n }\n\n if (!options) {\n if (isOptionsObj(schemas)) {\n options = schemas;\n schemas = {};\n }\n }\n\n this.__opts__ = assign({}, defaultOptions, options);\n\n // Cache last tested result. Used to skip repeating steps on next `match` call.\n this.__index__ = -1;\n this.__last_index__ = -1; // Next scan position\n this.__schema__ = '';\n this.__text_cache__ = '';\n\n this.__schemas__ = assign({}, defaultSchemas, schemas);\n this.__compiled__ = {};\n\n this.__tlds__ = tlds_default;\n this.__tlds_replaced__ = false;\n\n this.re = {};\n\n compile(this);\n}\n\n\n/** chainable\n * LinkifyIt#add(schema, definition)\n * - schema (String): rule name (fixed pattern prefix)\n * - definition (String|RegExp|Object): schema definition\n *\n * Add new rule definition. See constructor description for details.\n **/\nLinkifyIt.prototype.add = function add(schema, definition) {\n this.__schemas__[schema] = definition;\n compile(this);\n return this;\n};\n\n\n/** chainable\n * LinkifyIt#set(options)\n * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }\n *\n * Set recognition options for links without schema.\n **/\nLinkifyIt.prototype.set = function set(options) {\n this.__opts__ = assign(this.__opts__, options);\n return this;\n};\n\n\n/**\n * LinkifyIt#test(text) -> Boolean\n *\n * Searches linkifiable pattern and returns `true` on success or `false` on fail.\n **/\nLinkifyIt.prototype.test = function test(text) {\n // Reset scan cache\n this.__text_cache__ = text;\n this.__index__ = -1;\n\n if (!text.length) { return false; }\n\n var m, ml, me, len, shift, next, re, tld_pos, at_pos;\n\n // try to scan for link with schema - that's the most simple rule\n if (this.re.schema_test.test(text)) {\n re = this.re.schema_search;\n re.lastIndex = 0;\n while ((m = re.exec(text)) !== null) {\n len = this.testSchemaAt(text, m[2], re.lastIndex);\n if (len) {\n this.__schema__ = m[2];\n this.__index__ = m.index + m[1].length;\n this.__last_index__ = m.index + m[0].length + len;\n break;\n }\n }\n }\n\n if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {\n // guess schemaless links\n tld_pos = text.search(this.re.host_fuzzy_test);\n if (tld_pos >= 0) {\n // if tld is located after found link - no need to check fuzzy pattern\n if (this.__index__ < 0 || tld_pos < this.__index__) {\n if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {\n\n shift = ml.index + ml[1].length;\n\n if (this.__index__ < 0 || shift < this.__index__) {\n this.__schema__ = '';\n this.__index__ = shift;\n this.__last_index__ = ml.index + ml[0].length;\n }\n }\n }\n }\n }\n\n if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {\n // guess schemaless emails\n at_pos = text.indexOf('@');\n if (at_pos >= 0) {\n // We can't skip this check, because this cases are possible:\n // 192.168.1.1@gmail.com, my.in@example.com\n if ((me = text.match(this.re.email_fuzzy)) !== null) {\n\n shift = me.index + me[1].length;\n next = me.index + me[0].length;\n\n if (this.__index__ < 0 || shift < this.__index__ ||\n (shift === this.__index__ && next > this.__last_index__)) {\n this.__schema__ = 'mailto:';\n this.__index__ = shift;\n this.__last_index__ = next;\n }\n }\n }\n }\n\n return this.__index__ >= 0;\n};\n\n\n/**\n * LinkifyIt#pretest(text) -> Boolean\n *\n * Very quick check, that can give false positives. Returns true if link MAY BE\n * can exists. Can be used for speed optimization, when you need to check that\n * link NOT exists.\n **/\nLinkifyIt.prototype.pretest = function pretest(text) {\n return this.re.pretest.test(text);\n};\n\n\n/**\n * LinkifyIt#testSchemaAt(text, name, position) -> Number\n * - text (String): text to scan\n * - name (String): rule (schema) name\n * - position (Number): text offset to check from\n *\n * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly\n * at given position. Returns length of found pattern (0 on fail).\n **/\nLinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {\n // If not supported schema check requested - terminate\n if (!this.__compiled__[schema.toLowerCase()]) {\n return 0;\n }\n return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);\n};\n\n\n/**\n * LinkifyIt#match(text) -> Array|null\n *\n * Returns array of found link descriptions or `null` on fail. We strongly\n * recommend to use [[LinkifyIt#test]] first, for best speed.\n *\n * ##### Result match description\n *\n * - __schema__ - link schema, can be empty for fuzzy links, or `//` for\n * protocol-neutral links.\n * - __index__ - offset of matched text\n * - __lastIndex__ - index of next char after mathch end\n * - __raw__ - matched text\n * - __text__ - normalized text\n * - __url__ - link, generated from matched text\n **/\nLinkifyIt.prototype.match = function match(text) {\n var shift = 0, result = [];\n\n // Try to take previous element from cache, if .test() called before\n if (this.__index__ >= 0 && this.__text_cache__ === text) {\n result.push(createMatch(this, shift));\n shift = this.__last_index__;\n }\n\n // Cut head if cache was used\n var tail = shift ? text.slice(shift) : text;\n\n // Scan string until end reached\n while (this.test(tail)) {\n result.push(createMatch(this, shift));\n\n tail = tail.slice(this.__last_index__);\n shift += this.__last_index__;\n }\n\n if (result.length) {\n return result;\n }\n\n return null;\n};\n\n\n/** chainable\n * LinkifyIt#tlds(list [, keepOld]) -> this\n * - list (Array): list of tlds\n * - keepOld (Boolean): merge with current list if `true` (`false` by default)\n *\n * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)\n * to avoid false positives. By default this algorythm used:\n *\n * - hostname with any 2-letter root zones are ok.\n * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф\n * are ok.\n * - encoded (`xn--...`) root zones are ok.\n *\n * If list is replaced, then exact match for 2-chars root zones will be checked.\n **/\nLinkifyIt.prototype.tlds = function tlds(list, keepOld) {\n list = Array.isArray(list) ? list : [ list ];\n\n if (!keepOld) {\n this.__tlds__ = list.slice();\n this.__tlds_replaced__ = true;\n compile(this);\n return this;\n }\n\n this.__tlds__ = this.__tlds__.concat(list)\n .sort()\n .filter(function (el, idx, arr) {\n return el !== arr[idx - 1];\n })\n .reverse();\n\n compile(this);\n return this;\n};\n\n/**\n * LinkifyIt#normalize(match)\n *\n * Default normalizer (if schema does not define it's own).\n **/\nLinkifyIt.prototype.normalize = function normalize(match) {\n\n // Do minimal possible changes by default. Need to collect feedback prior\n // to move forward https://github.com/markdown-it/linkify-it/issues/1\n\n if (!match.schema) { match.url = 'http://' + match.url; }\n\n if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {\n match.url = 'mailto:' + match.url;\n }\n};\n\n\n/**\n * LinkifyIt#onCompile()\n *\n * Override to modify basic RegExp-s.\n **/\nLinkifyIt.prototype.onCompile = function onCompile() {\n};\n\n\nmodule.exports = LinkifyIt;\n","'use strict';\n\n\nmodule.exports = function (opts) {\n var re = {};\n\n // Use direct extract instead of `regenerate` to reduse browserified size\n re.src_Any = require('uc.micro/properties/Any/regex').source;\n re.src_Cc = require('uc.micro/categories/Cc/regex').source;\n re.src_Z = require('uc.micro/categories/Z/regex').source;\n re.src_P = require('uc.micro/categories/P/regex').source;\n\n // \\p{\\Z\\P\\Cc\\CF} (white spaces + control + format + punctuation)\n re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');\n\n // \\p{\\Z\\Cc} (white spaces + control)\n re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');\n\n // Experimental. List of chars, completely prohibited in links\n // because can separate it from other part of text\n var text_separators = '[><\\uff5c]';\n\n // All possible word characters (everything without punctuation, spaces & controls)\n // Defined via punctuation & spaces to save space\n // Should be something like \\p{\\L\\N\\S\\M} (\\w but without `_`)\n re.src_pseudo_letter = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';\n // The same as abothe but without [0-9]\n // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';\n\n ////////////////////////////////////////////////////////////////////////////////\n\n re.src_ip4 =\n\n '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';\n\n // Prohibit any of \"@/[]()\" in user/pass to avoid wrong domain fetch.\n re.src_auth = '(?:(?:(?!' + re.src_ZCc + '|[@/\\\\[\\\\]()]).)+@)?';\n\n re.src_port =\n\n '(?::(?:6(?:[0-4]\\\\d{3}|5(?:[0-4]\\\\d{2}|5(?:[0-2]\\\\d|3[0-5])))|[1-5]?\\\\d{1,4}))?';\n\n re.src_host_terminator =\n\n '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\\\d|\\\\.-|\\\\.(?!$|' + re.src_ZPCc + '))';\n\n re.src_path =\n\n '(?:' +\n '[/?#]' +\n '(?:' +\n '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\\\]{}.,\"\\'?!\\\\-]).|' +\n '\\\\[(?:(?!' + re.src_ZCc + '|\\\\]).)*\\\\]|' +\n '\\\\((?:(?!' + re.src_ZCc + '|[)]).)*\\\\)|' +\n '\\\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\\\}|' +\n '\\\\\"(?:(?!' + re.src_ZCc + '|[\"]).)+\\\\\"|' +\n \"\\\\'(?:(?!\" + re.src_ZCc + \"|[']).)+\\\\'|\" +\n \"\\\\'(?=\" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found\n '\\\\.{2,4}[a-zA-Z0-9%/]|' + // github has ... in commit range links,\n // google has .... in links (issue #66)\n // Restrict to\n // - english\n // - percent-encoded\n // - parts of file path\n // until more examples found.\n '\\\\.(?!' + re.src_ZCc + '|[.]).|' +\n (opts && opts['---'] ?\n '\\\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate\n :\n '\\\\-+|'\n ) +\n '\\\\,(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths\n '\\\\!(?!' + re.src_ZCc + '|[!]).|' +\n '\\\\?(?!' + re.src_ZCc + '|[?]).' +\n ')+' +\n '|\\\\/' +\n ')?';\n\n // Allow anything in markdown spec, forbid quote (\") at the first position\n // because emails enclosed in quotes are far more common\n re.src_email_name =\n\n '[\\\\-;:&=\\\\+\\\\$,\\\\.a-zA-Z0-9_][\\\\-;:&=\\\\+\\\\$,\\\\\"\\\\.a-zA-Z0-9_]*';\n\n re.src_xn =\n\n 'xn--[a-z0-9\\\\-]{1,59}';\n\n // More to read about domain names\n // http://serverfault.com/questions/638260/\n\n re.src_domain_root =\n\n // Allow letters & digits (http://test1)\n '(?:' +\n re.src_xn +\n '|' +\n re.src_pseudo_letter + '{1,63}' +\n ')';\n\n re.src_domain =\n\n '(?:' +\n re.src_xn +\n '|' +\n '(?:' + re.src_pseudo_letter + ')' +\n '|' +\n '(?:' + re.src_pseudo_letter + '(?:-|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +\n ')';\n\n re.src_host =\n\n '(?:' +\n // Don't need IP check, because digits are already allowed in normal domain names\n // src_ip4 +\n // '|' +\n '(?:(?:(?:' + re.src_domain + ')\\\\.)*' + re.src_domain/*_root*/ + ')' +\n ')';\n\n re.tpl_host_fuzzy =\n\n '(?:' +\n re.src_ip4 +\n '|' +\n '(?:(?:(?:' + re.src_domain + ')\\\\.)+(?:%TLDS%))' +\n ')';\n\n re.tpl_host_no_ip_fuzzy =\n\n '(?:(?:(?:' + re.src_domain + ')\\\\.)+(?:%TLDS%))';\n\n re.src_host_strict =\n\n re.src_host + re.src_host_terminator;\n\n re.tpl_host_fuzzy_strict =\n\n re.tpl_host_fuzzy + re.src_host_terminator;\n\n re.src_host_port_strict =\n\n re.src_host + re.src_port + re.src_host_terminator;\n\n re.tpl_host_port_fuzzy_strict =\n\n re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;\n\n re.tpl_host_port_no_ip_fuzzy_strict =\n\n re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;\n\n\n ////////////////////////////////////////////////////////////////////////////////\n // Main rules\n\n // Rude test fuzzy links by host, for quick deny\n re.tpl_host_fuzzy_test =\n\n 'localhost|www\\\\.|\\\\.\\\\d{1,3}\\\\.|(?:\\\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';\n\n re.tpl_email_fuzzy =\n\n '(^|' + text_separators + '|\"|\\\\(|' + re.src_ZCc + ')' +\n '(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';\n\n re.tpl_link_fuzzy =\n // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n // but can start with > (markdown blockquote)\n '(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|' + re.src_ZPCc + '))' +\n '((?![$+<=>^`|\\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';\n\n re.tpl_link_no_ip_fuzzy =\n // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n // but can start with > (markdown blockquote)\n '(^|(?![.:/\\\\-_@])(?:[$+<=>^`|\\uff5c]|' + re.src_ZPCc + '))' +\n '((?![$+<=>^`|\\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';\n\n return re;\n};\n","/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","// markdown-it default options\n\n'use strict';\n\n\nmodule.exports = {\n options: {\n html: false, // Enable HTML tags in source\n xhtmlOut: false, // Use '/' to close single tags (<br />)\n breaks: false, // Convert '\\n' in paragraphs into <br>\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n maxNesting: 100 // Internal protection, recursion limit\n },\n\n components: {\n\n core: {},\n block: {},\n inline: {}\n }\n};\n","// \"Zero\" preset, with nothing enabled. Useful for manual configuring of simple\n// modes. For example, to parse bold/italic only.\n\n'use strict';\n\n\nmodule.exports = {\n options: {\n html: false, // Enable HTML tags in source\n xhtmlOut: false, // Use '/' to close single tags (<br />)\n breaks: false, // Convert '\\n' in paragraphs into <br>\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n maxNesting: 20 // Internal protection, recursion limit\n },\n\n components: {\n\n core: {\n rules: [\n 'normalize',\n 'block',\n 'inline'\n ]\n },\n\n block: {\n rules: [\n 'paragraph'\n ]\n },\n\n inline: {\n rules: [\n 'text'\n ],\n rules2: [\n 'balance_pairs',\n 'text_collapse'\n ]\n }\n }\n};\n","// Commonmark default options\n\n'use strict';\n\n\nmodule.exports = {\n options: {\n html: true, // Enable HTML tags in source\n xhtmlOut: true, // Use '/' to close single tags (<br />)\n breaks: false, // Convert '\\n' in paragraphs into <br>\n langPrefix: 'language-', // CSS language prefix for fenced blocks\n linkify: false, // autoconvert URL-like texts to links\n\n // Enable some language-neutral replacements + quotes beautification\n typographer: false,\n\n // Double + single quotes replacement pairs, when typographer enabled,\n // and smartquotes on. Could be either a String or an Array.\n //\n // For example, you can use '«»„“' for Russian, '„“‚‘' for German,\n // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp).\n quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */\n\n // Highlighter function. Should return escaped HTML,\n // or '' if the source string is not changed and should be escaped externaly.\n // If result starts with <pre... internal wrapper is skipped.\n //\n // function (/*str, lang*/) { return ''; }\n //\n highlight: null,\n\n maxNesting: 20 // Internal protection, recursion limit\n },\n\n components: {\n\n core: {\n rules: [\n 'normalize',\n 'block',\n 'inline'\n ]\n },\n\n block: {\n rules: [\n 'blockquote',\n 'code',\n 'fence',\n 'heading',\n 'hr',\n 'html_block',\n 'lheading',\n 'list',\n 'reference',\n 'paragraph'\n ]\n },\n\n inline: {\n rules: [\n 'autolink',\n 'backticks',\n 'emphasis',\n 'entity',\n 'escape',\n 'html_inline',\n 'image',\n 'link',\n 'newline',\n 'text'\n ],\n rules2: [\n 'balance_pairs',\n 'emphasis',\n 'text_collapse'\n ]\n }\n }\n};\n"],"sourceRoot":""}
\ No newline at end of file |