"use strict"; /* * ATTENTION: An "eval-source-map" devtool has been used. * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ exports.id = "vendor-chunks/@lexical+list@0.41.0"; exports.ids = ["vendor-chunks/@lexical+list@0.41.0"]; exports.modules = { /***/ "(rsc)/./node_modules/.pnpm/@lexical+list@0.41.0/node_modules/@lexical/list/LexicalList.dev.mjs": /*!************************************************************************************************!*\ !*** ./node_modules/.pnpm/@lexical+list@0.41.0/node_modules/@lexical/list/LexicalList.dev.mjs ***! \************************************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ $createListItemNode: () => (/* binding */ $createListItemNode),\n/* harmony export */ $createListNode: () => (/* binding */ $createListNode),\n/* harmony export */ $getListDepth: () => (/* binding */ $getListDepth),\n/* harmony export */ $handleListInsertParagraph: () => (/* binding */ $handleListInsertParagraph),\n/* harmony export */ $insertList: () => (/* binding */ $insertList),\n/* harmony export */ $isListItemNode: () => (/* binding */ $isListItemNode),\n/* harmony export */ $isListNode: () => (/* binding */ $isListNode),\n/* harmony export */ $removeList: () => (/* binding */ $removeList),\n/* harmony export */ CheckListExtension: () => (/* binding */ CheckListExtension),\n/* harmony export */ INSERT_CHECK_LIST_COMMAND: () => (/* binding */ INSERT_CHECK_LIST_COMMAND),\n/* harmony export */ INSERT_ORDERED_LIST_COMMAND: () => (/* binding */ INSERT_ORDERED_LIST_COMMAND),\n/* harmony export */ INSERT_UNORDERED_LIST_COMMAND: () => (/* binding */ INSERT_UNORDERED_LIST_COMMAND),\n/* harmony export */ ListExtension: () => (/* binding */ ListExtension),\n/* harmony export */ ListItemNode: () => (/* binding */ ListItemNode),\n/* harmony export */ ListNode: () => (/* binding */ ListNode),\n/* harmony export */ REMOVE_LIST_COMMAND: () => (/* binding */ REMOVE_LIST_COMMAND),\n/* harmony export */ UPDATE_LIST_START_COMMAND: () => (/* binding */ UPDATE_LIST_START_COMMAND),\n/* harmony export */ insertList: () => (/* binding */ insertList),\n/* harmony export */ registerCheckList: () => (/* binding */ registerCheckList),\n/* harmony export */ registerList: () => (/* binding */ registerList),\n/* harmony export */ registerListStrictIndentTransform: () => (/* binding */ registerListStrictIndentTransform),\n/* harmony export */ removeList: () => (/* binding */ removeList)\n/* harmony export */ });\n/* harmony import */ var _lexical_extension__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lexical/extension */ \"(rsc)/./node_modules/.pnpm/@lexical+extension@0.41.0/node_modules/@lexical/extension/LexicalExtension.dev.mjs\");\n/* harmony import */ var _lexical_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lexical/utils */ \"(rsc)/./node_modules/.pnpm/@lexical+utils@0.41.0/node_modules/@lexical/utils/LexicalUtils.dev.mjs\");\n/* harmony import */ var lexical__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lexical */ \"(rsc)/./node_modules/.pnpm/lexical@0.41.0/node_modules/lexical/Lexical.dev.mjs\");\n/* harmony import */ var _lexical_selection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lexical/selection */ \"(rsc)/./node_modules/.pnpm/@lexical+selection@0.41.0/node_modules/@lexical/selection/LexicalSelection.dev.mjs\");\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n\n\n\n\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// Do not require this module directly! Use normal `invariant` calls.\n\nfunction formatDevErrorMessage(message) {\n throw new Error(message);\n}\n\n/**\n * Checks the depth of listNode from the root node.\n * @param listNode - The ListNode to be checked.\n * @returns The depth of the ListNode.\n */\nfunction $getListDepth(listNode) {\n let depth = 1;\n let parent = listNode.getParent();\n while (parent != null) {\n if ($isListItemNode(parent)) {\n const parentList = parent.getParent();\n if ($isListNode(parentList)) {\n depth++;\n parent = parentList.getParent();\n continue;\n }\n {\n formatDevErrorMessage(`A ListItemNode must have a ListNode for a parent.`);\n }\n }\n return depth;\n }\n return depth;\n}\n\n/**\n * Finds the nearest ancestral ListNode and returns it, throws an invariant if listItem is not a ListItemNode.\n * @param listItem - The node to be checked.\n * @returns The ListNode found.\n */\nfunction $getTopListNode(listItem) {\n let list = listItem.getParent();\n if (!$isListNode(list)) {\n {\n formatDevErrorMessage(`A ListItemNode must have a ListNode for a parent.`);\n }\n }\n let parent = list;\n while (parent !== null) {\n parent = parent.getParent();\n if ($isListNode(parent)) {\n list = parent;\n }\n }\n return list;\n}\n\n/**\n * A recursive Depth-First Search (Postorder Traversal) that finds all of a node's children\n * that are of type ListItemNode and returns them in an array.\n * @param node - The ListNode to start the search.\n * @returns An array containing all nodes of type ListItemNode found.\n */\n// This should probably be $getAllChildrenOfType\nfunction $getAllListItems(node) {\n let listItemNodes = [];\n const listChildren = node.getChildren().filter($isListItemNode);\n for (let i = 0; i < listChildren.length; i++) {\n const listItemNode = listChildren[i];\n const firstChild = listItemNode.getFirstChild();\n if ($isListNode(firstChild)) {\n listItemNodes = listItemNodes.concat($getAllListItems(firstChild));\n } else {\n listItemNodes.push(listItemNode);\n }\n }\n return listItemNodes;\n}\n\n/**\n * Checks to see if the passed node is a ListItemNode and has a ListNode as a child.\n * @param node - The node to be checked.\n * @returns true if the node is a ListItemNode and has a ListNode child, false otherwise.\n */\nfunction isNestedListNode(node) {\n return $isListItemNode(node) && $isListNode(node.getFirstChild());\n}\n\n/**\n * Takes a deeply nested ListNode or ListItemNode and traverses up the branch to delete the first\n * ancestral ListNode (which could be the root ListNode) or ListItemNode with siblings, essentially\n * bringing the deeply nested node up the branch once. Would remove sublist if it has siblings.\n * Should not break ListItem -> List -> ListItem chain as empty List/ItemNodes should be removed on .remove().\n * @param sublist - The nested ListNode or ListItemNode to be brought up the branch.\n */\nfunction $removeHighestEmptyListParent(sublist) {\n // Nodes may be repeatedly indented, to create deeply nested lists that each\n // contain just one bullet.\n // Our goal is to remove these (empty) deeply nested lists. The easiest\n // way to do that is crawl back up the tree until we find a node that has siblings\n // (e.g. is actually part of the list contents) and delete that, or delete\n // the root of the list (if no list nodes have siblings.)\n let emptyListPtr = sublist;\n while (emptyListPtr.getNextSibling() == null && emptyListPtr.getPreviousSibling() == null) {\n const parent = emptyListPtr.getParent();\n if (parent == null || !($isListItemNode(parent) || $isListNode(parent))) {\n break;\n }\n emptyListPtr = parent;\n }\n emptyListPtr.remove();\n}\n\n/**\n * Wraps a node into a ListItemNode.\n * @param node - The node to be wrapped into a ListItemNode\n * @returns The ListItemNode which the passed node is wrapped in.\n */\nfunction $wrapInListItem(node) {\n const listItemWrapper = $createListItemNode();\n return listItemWrapper.append(node);\n}\n\n/**\n * Calculates the start value for a new list created by splitting an existing list.\n */\nfunction $getNewListStart(list, listItem) {\n return list.getStart() + listItem.getIndexWithinParent();\n}\n\nfunction $isSelectingEmptyListItem(anchorNode, nodes) {\n return $isListItemNode(anchorNode) && (nodes.length === 0 || nodes.length === 1 && anchorNode.is(nodes[0]) && anchorNode.getChildrenSize() === 0);\n}\n\n/**\n * Inserts a new ListNode. If the selection's anchor node is an empty ListItemNode and is a child of\n * the root/shadow root, it will replace the ListItemNode with a ListNode and the old ListItemNode.\n * Otherwise it will replace its parent with a new ListNode and re-insert the ListItemNode and any previous children.\n * If the selection's anchor node is not an empty ListItemNode, it will add a new ListNode or merge an existing ListNode,\n * unless the the node is a leaf node, in which case it will attempt to find a ListNode up the branch and replace it with\n * a new ListNode, or create a new ListNode at the nearest root/shadow root.\n * @param listType - The type of list, \"number\" | \"bullet\" | \"check\".\n */\nfunction $insertList(listType) {\n const selection = (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$getSelection)();\n if (selection !== null) {\n let nodes = selection.getNodes();\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isRangeSelection)(selection)) {\n const anchorAndFocus = selection.getStartEndPoints();\n if (!(anchorAndFocus !== null)) {\n formatDevErrorMessage(`insertList: anchor should be defined`);\n }\n const [anchor] = anchorAndFocus;\n const anchorNode = anchor.getNode();\n const anchorNodeParent = anchorNode.getParent();\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isRootOrShadowRoot)(anchorNode)) {\n const firstChild = anchorNode.getFirstChild();\n if (firstChild) {\n nodes = firstChild.selectStart().getNodes();\n } else {\n const paragraph = (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$createParagraphNode)();\n anchorNode.append(paragraph);\n nodes = paragraph.select().getNodes();\n }\n } else if ($isSelectingEmptyListItem(anchorNode, nodes)) {\n const list = $createListNode(listType);\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isRootOrShadowRoot)(anchorNodeParent)) {\n anchorNode.replace(list);\n const listItem = $createListItemNode();\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isElementNode)(anchorNode)) {\n listItem.setFormat(anchorNode.getFormatType());\n listItem.setIndent(anchorNode.getIndent());\n }\n list.append(listItem);\n } else if ($isListItemNode(anchorNode)) {\n const parent = anchorNode.getParentOrThrow();\n append(list, parent.getChildren());\n parent.replace(list);\n }\n return;\n }\n }\n const handled = new Set();\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isElementNode)(node) && node.isEmpty() && !$isListItemNode(node) && !handled.has(node.getKey())) {\n $createListOrMerge(node, listType);\n continue;\n }\n let parent = (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isLeafNode)(node) ? node.getParent() : $isListItemNode(node) && node.isEmpty() ? node : null;\n while (parent != null) {\n const parentKey = parent.getKey();\n if ($isListNode(parent)) {\n if (!handled.has(parentKey)) {\n const newListNode = $createListNode(listType);\n append(newListNode, parent.getChildren());\n parent.replace(newListNode);\n handled.add(parentKey);\n }\n break;\n } else {\n const nextParent = parent.getParent();\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isRootOrShadowRoot)(nextParent) && !handled.has(parentKey)) {\n handled.add(parentKey);\n $createListOrMerge(parent, listType);\n break;\n }\n parent = nextParent;\n }\n }\n }\n }\n}\nfunction append(node, nodesToAppend) {\n node.splice(node.getChildrenSize(), 0, nodesToAppend);\n}\nfunction $createListOrMerge(node, listType) {\n if ($isListNode(node)) {\n return node;\n }\n const previousSibling = node.getPreviousSibling();\n const nextSibling = node.getNextSibling();\n const listItem = $createListItemNode();\n append(listItem, node.getChildren());\n let targetList;\n if ($isListNode(previousSibling) && listType === previousSibling.getListType()) {\n previousSibling.append(listItem);\n // if the same type of list is on both sides, merge them.\n if ($isListNode(nextSibling) && listType === nextSibling.getListType()) {\n append(previousSibling, nextSibling.getChildren());\n nextSibling.remove();\n }\n targetList = previousSibling;\n } else if ($isListNode(nextSibling) && listType === nextSibling.getListType()) {\n nextSibling.getFirstChildOrThrow().insertBefore(listItem);\n targetList = nextSibling;\n } else {\n const list = $createListNode(listType);\n list.append(listItem);\n node.replace(list);\n targetList = list;\n }\n // listItem needs to be attached to root prior to setting indent\n listItem.setFormat(node.getFormatType());\n listItem.setIndent(node.getIndent());\n\n // Preserve element-anchored selections by updating them to anchor to the listItem instead of the listNode.\n const selection = (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$getSelection)();\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isRangeSelection)(selection)) {\n if (targetList.getKey() === selection.anchor.key) {\n selection.anchor.set(listItem.getKey(), selection.anchor.offset, 'element');\n }\n if (targetList.getKey() === selection.focus.key) {\n selection.focus.set(listItem.getKey(), selection.focus.offset, 'element');\n }\n }\n node.remove();\n return targetList;\n}\n\n/**\n * A recursive function that goes through each list and their children, including nested lists,\n * appending list2 children after list1 children and updating ListItemNode values.\n * @param list1 - The first list to be merged.\n * @param list2 - The second list to be merged.\n */\nfunction mergeLists(list1, list2) {\n const listItem1 = list1.getLastChild();\n const listItem2 = list2.getFirstChild();\n if (listItem1 && listItem2 && isNestedListNode(listItem1) && isNestedListNode(listItem2)) {\n mergeLists(listItem1.getFirstChild(), listItem2.getFirstChild());\n listItem2.remove();\n }\n const toMerge = list2.getChildren();\n if (toMerge.length > 0) {\n list1.append(...toMerge);\n }\n list2.remove();\n}\n\n/**\n * Searches for the nearest ancestral ListNode and removes it. If selection is an empty ListItemNode\n * it will remove the whole list, including the ListItemNode. For each ListItemNode in the ListNode,\n * removeList will also generate new ParagraphNodes in the removed ListNode's place. Any child node\n * inside a ListItemNode will be appended to the new ParagraphNodes.\n */\nfunction $removeList() {\n const selection = (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$getSelection)();\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isRangeSelection)(selection)) {\n const listNodes = new Set();\n const nodes = selection.getNodes();\n const anchorNode = selection.anchor.getNode();\n if ($isSelectingEmptyListItem(anchorNode, nodes)) {\n listNodes.add($getTopListNode(anchorNode));\n } else {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if ((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$isLeafNode)(node)) {\n const listItemNode = (0,_lexical_utils__WEBPACK_IMPORTED_MODULE_1__.$getNearestNodeOfType)(node, ListItemNode);\n if (listItemNode != null) {\n listNodes.add($getTopListNode(listItemNode));\n }\n }\n }\n }\n for (const listNode of listNodes) {\n let insertionPoint = listNode;\n const listItems = $getAllListItems(listNode);\n for (const listItemNode of listItems) {\n const paragraph = (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$createParagraphNode)().setTextStyle(selection.style).setTextFormat(selection.format);\n append(paragraph, listItemNode.getChildren());\n insertionPoint.insertAfter(paragraph);\n insertionPoint = paragraph;\n\n // When the anchor and focus fall on the textNode\n // we don't have to change the selection because the textNode will be appended to\n // the newly generated paragraph.\n // When selection is in empty nested list item, selection is actually on the listItemNode.\n // When the corresponding listItemNode is deleted and replaced by the newly generated paragraph\n // we should manually set the selection's focus and anchor to the newly generated paragraph.\n if (listItemNode.__key === selection.anchor.key) {\n (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$setPointFromCaret)(selection.anchor, (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$normalizeCaret)((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$getChildCaret)(paragraph, 'next')));\n }\n if (listItemNode.__key === selection.focus.key) {\n (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$setPointFromCaret)(selection.focus, (0,lexical__WEBPACK_IMPORTED_MODULE_0__.$normalizeCaret)((0,lexical__WEBPACK_IMPORTED_MODULE_0__.$getChildCaret)(paragraph, 'next')));\n }\n listItemNode.remove();\n }\n listNode.remove();\n }\n }\n}\n\n/**\n * Takes the value of a child ListItemNode and makes it the value the ListItemNode\n * should be if it isn't already. Also ensures that checked is undefined if the\n * parent does not have a list type of 'check'.\n * @param list - The list whose children are updated.\n */\nfunction updateChildrenListItemValue(list) {\n const isNotChecklist = list.getListType() !== 'check';\n let value = list.getStart();\n for (const child of list.getChildren()) {\n if ($isListItemNode(child)) {\n if (child.getValue() !== value) {\n child.setValue(value);\n }\n if (isNotChecklist && child.getLatest().__checked != null) {\n child.setChecked(undefined);\n }\n if (!$isListNode(child.getFirstChild())) {\n value++;\n }\n }\n }\n}\n\n/**\n * Merge the next sibling list if same type.\n *