@ones-editor/editor 3.1.4-beta.h1447.2 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9298,7 +9298,7 @@ var __publicField = (obj, key, value) => {
9298
9298
  imageExportFailed: "Bild konnte nicht geladen werden"
9299
9299
  }
9300
9300
  };
9301
- const logger$4V = getLogger("i18n");
9301
+ const logger$4W = getLogger("i18n");
9302
9302
  const langs$3 = {
9303
9303
  "en-US": enUS$y,
9304
9304
  "zh-CN": zhCN$y,
@@ -9320,7 +9320,7 @@ var __publicField = (obj, key, value) => {
9320
9320
  function t$8(key, args) {
9321
9321
  const ret = i18n.get(key, args);
9322
9322
  if (ret === key) {
9323
- logger$4V.warn(`no locale value for key ${key}`);
9323
+ logger$4W.warn(`no locale value for key ${key}`);
9324
9324
  }
9325
9325
  return ret;
9326
9326
  }
@@ -9938,7 +9938,7 @@ var __publicField = (obj, key, value) => {
9938
9938
  this._callbacks.clear();
9939
9939
  }
9940
9940
  }
9941
- const logger$4U = getLogger("await-locker");
9941
+ const logger$4V = getLogger("await-locker");
9942
9942
  class AwaitLock {
9943
9943
  constructor() {
9944
9944
  __publicField(this, "_acquired", false);
@@ -9980,7 +9980,7 @@ var __publicField = (obj, key, value) => {
9980
9980
  }
9981
9981
  if (this._waitingResolvers.length > 0) {
9982
9982
  const resolve = this._waitingResolvers.shift();
9983
- assert(logger$4U, resolve, "Resolver missing");
9983
+ assert(logger$4V, resolve, "Resolver missing");
9984
9984
  resolve(void 0);
9985
9985
  } else {
9986
9986
  this._acquired = false;
@@ -10063,7 +10063,7 @@ var __publicField = (obj, key, value) => {
10063
10063
  isMobileSafari: false
10064
10064
  };
10065
10065
  clientType.isMobileSafari = clientType.isMobile && clientType.isSafari;
10066
- const logger$4T = getLogger("dom-utils");
10066
+ const logger$4U = getLogger("dom-utils");
10067
10067
  function addClass(dom, ...className) {
10068
10068
  if (dom && dom.nodeType === Node.ELEMENT_NODE) {
10069
10069
  dom.classList.add(...className);
@@ -10120,7 +10120,7 @@ var __publicField = (obj, key, value) => {
10120
10120
  range.setStart(node, offset);
10121
10121
  return range;
10122
10122
  } catch (err) {
10123
- assert(logger$4T, false, `failed to create range: ${node.childNodes.length}, ${offset}, ${err.message}`);
10123
+ assert(logger$4U, false, `failed to create range: ${node.childNodes.length}, ${offset}, ${err.message}`);
10124
10124
  }
10125
10125
  }
10126
10126
  function createExpandedRange(startNode, startOffset, endNode, endOffset) {
@@ -10130,17 +10130,17 @@ var __publicField = (obj, key, value) => {
10130
10130
  range.setEnd(endNode, endOffset);
10131
10131
  return range;
10132
10132
  } catch (err) {
10133
- assert(logger$4T, false, `failed to create expanded range: ${startNode.childNodes.length}, ${startOffset}, ${endNode.childNodes.length}, ${endOffset}, ${err.message}`);
10133
+ assert(logger$4U, false, `failed to create expanded range: ${startNode.childNodes.length}, ${startOffset}, ${endNode.childNodes.length}, ${endOffset}, ${err.message}`);
10134
10134
  }
10135
10135
  }
10136
10136
  function getFirstClientRect(elem) {
10137
10137
  const rects = elem.getClientRects();
10138
- assert(logger$4T, rects.length >= 1, "getFirstClientRect: no rects");
10138
+ assert(logger$4U, rects.length >= 1, "getFirstClientRect: no rects");
10139
10139
  return rects[0];
10140
10140
  }
10141
10141
  function getLastClientRect(elem) {
10142
10142
  const rects = elem.getClientRects();
10143
- assert(logger$4T, rects.length >= 1, "getLastClientRect: no rects");
10143
+ assert(logger$4U, rects.length >= 1, "getLastClientRect: no rects");
10144
10144
  return rects[rects.length - 1];
10145
10145
  }
10146
10146
  function getDistanceSquare(rect, x, y) {
@@ -10187,7 +10187,7 @@ var __publicField = (obj, key, value) => {
10187
10187
  return 0;
10188
10188
  }
10189
10189
  if (!elem1.parentElement || !elem2.parentElement) {
10190
- assert(logger$4T, false, "invalid dom node to compare");
10190
+ assert(logger$4U, false, "invalid dom node to compare");
10191
10191
  }
10192
10192
  if (elem1.parentElement === elem2.parentElement) {
10193
10193
  const children = Array.from(elem1.parentElement.children);
@@ -10204,7 +10204,7 @@ var __publicField = (obj, key, value) => {
10204
10204
  const parents1 = getParents(elem1);
10205
10205
  const parents2 = getParents(elem2);
10206
10206
  if (parents1[0] !== parents2[0]) {
10207
- assert(logger$4T, false, "invalid dom node to compare, different tree");
10207
+ assert(logger$4U, false, "invalid dom node to compare, different tree");
10208
10208
  }
10209
10209
  for (let i = 1; ; i++) {
10210
10210
  const parent1 = parents1[i];
@@ -10804,7 +10804,7 @@ var __publicField = (obj, key, value) => {
10804
10804
  }
10805
10805
  }
10806
10806
  const MIN_DISTANCE_THRESHOLD$3 = 3;
10807
- const logger$4S = getLogger("drag-drop");
10807
+ const logger$4T = getLogger("drag-drop");
10808
10808
  class DragDrop {
10809
10809
  constructor(options) {
10810
10810
  __publicField(this, "dragStarted", false);
@@ -10825,7 +10825,7 @@ var __publicField = (obj, key, value) => {
10825
10825
  var _a;
10826
10826
  event.preventDefault();
10827
10827
  event.stopPropagation();
10828
- assert(logger$4S, this.mouseDownEvent, "no mouse down event");
10828
+ assert(logger$4T, this.mouseDownEvent, "no mouse down event");
10829
10829
  const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
10830
10830
  const newPos = DragDrop.getEventPosition(event);
10831
10831
  const deltaX = newPos.x - oldPos.x;
@@ -10841,7 +10841,7 @@ var __publicField = (obj, key, value) => {
10841
10841
  });
10842
10842
  __publicField(this, "handleMouseUp", (event) => {
10843
10843
  if (event instanceof MouseEvent && event.button === 0 || event instanceof TouchEvent) {
10844
- assert(logger$4S, this.mouseDownEvent, "no mouse down event");
10844
+ assert(logger$4T, this.mouseDownEvent, "no mouse down event");
10845
10845
  const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
10846
10846
  const newPos = DragDrop.getEventPosition(event);
10847
10847
  const deltaX = newPos.x - oldPos.x;
@@ -10950,7 +10950,7 @@ var __publicField = (obj, key, value) => {
10950
10950
  const dragDrop = new DragDrop(options);
10951
10951
  return dragDrop;
10952
10952
  }
10953
- const logger$4R = getLogger("character");
10953
+ const logger$4S = getLogger("character");
10954
10954
  function checkChar(charCode, rangeList) {
10955
10955
  for (let i = 0; i < rangeList.length; i++) {
10956
10956
  const start = rangeList[i][0];
@@ -11001,7 +11001,7 @@ var __publicField = (obj, key, value) => {
11001
11001
  }
11002
11002
  function trimChar(s, char) {
11003
11003
  let c = char;
11004
- assert(logger$4R, c.length === 1, "invalid char length");
11004
+ assert(logger$4S, c.length === 1, "invalid char length");
11005
11005
  if (c === "]")
11006
11006
  c = "\\]";
11007
11007
  if (c === "\\")
@@ -11359,7 +11359,7 @@ var __publicField = (obj, key, value) => {
11359
11359
  return 200;
11360
11360
  }
11361
11361
  }
11362
- const logger$4Q = getLogger("editor-clipboard");
11362
+ const logger$4R = getLogger("editor-clipboard");
11363
11363
  async function setClipboardDataByEvent(items, event) {
11364
11364
  if (event.clipboardData) {
11365
11365
  const data2 = event.clipboardData;
@@ -11417,7 +11417,7 @@ var __publicField = (obj, key, value) => {
11417
11417
  document.body.removeChild(textarea2);
11418
11418
  return true;
11419
11419
  } catch (ex) {
11420
- logger$4Q.error(ex);
11420
+ logger$4R.error(ex);
11421
11421
  document.body.removeChild(textarea2);
11422
11422
  return false;
11423
11423
  }
@@ -11438,7 +11438,7 @@ var __publicField = (obj, key, value) => {
11438
11438
  document.body.removeChild(div);
11439
11439
  return true;
11440
11440
  } catch (ex) {
11441
- logger$4Q.error(ex);
11441
+ logger$4R.error(ex);
11442
11442
  document.body.removeChild(div);
11443
11443
  return false;
11444
11444
  }
@@ -11465,7 +11465,7 @@ var __publicField = (obj, key, value) => {
11465
11465
  await navigator.clipboard.write([clipboardItems]);
11466
11466
  return true;
11467
11467
  } catch (err) {
11468
- logger$4Q.error(err);
11468
+ logger$4R.error(err);
11469
11469
  return await execCommandCopy(items);
11470
11470
  }
11471
11471
  }
@@ -11521,7 +11521,7 @@ var __publicField = (obj, key, value) => {
11521
11521
  a.click();
11522
11522
  a.remove();
11523
11523
  }
11524
- const logger$4P = getLogger("auto-scroll");
11524
+ const logger$4Q = getLogger("auto-scroll");
11525
11525
  function scrollable(scrollElement, direction) {
11526
11526
  if (scrollElement.scrollHeight === scrollElement.clientHeight) {
11527
11527
  return false;
@@ -11545,7 +11545,7 @@ var __publicField = (obj, key, value) => {
11545
11545
  const isHorizontal = direction === "left" || direction === "right";
11546
11546
  const scroll = () => {
11547
11547
  if (!scrollable(scrollElement, direction)) {
11548
- logger$4P.debug("No need for scroll");
11548
+ logger$4Q.debug("No need for scroll");
11549
11549
  return null;
11550
11550
  }
11551
11551
  if (isHorizontal) {
@@ -11602,7 +11602,7 @@ var __publicField = (obj, key, value) => {
11602
11602
  if (this.scrolling) {
11603
11603
  return;
11604
11604
  }
11605
- logger$4P.debug(`scroll direction: ${direction}`);
11605
+ logger$4Q.debug(`scroll direction: ${direction}`);
11606
11606
  this.cancelScroll = continuousScroll(scrollElement, {
11607
11607
  direction,
11608
11608
  step
@@ -11852,7 +11852,7 @@ var __publicField = (obj, key, value) => {
11852
11852
  const colorIndex = Math.abs(typeof content === "string" && content.trim() ? hashCode(content.trim()) : 0) % ColorNames.length;
11853
11853
  return ColorNames[colorIndex];
11854
11854
  }
11855
- const logger$4O = getLogger("container");
11855
+ const logger$4P = getLogger("container");
11856
11856
  function isContainer(elem) {
11857
11857
  return elem.getAttribute("data-type") === "editor-container";
11858
11858
  }
@@ -11864,9 +11864,9 @@ var __publicField = (obj, key, value) => {
11864
11864
  }
11865
11865
  function getContainerId(container) {
11866
11866
  const id = container.getAttribute("data-container-id");
11867
- assert(logger$4O, id, "no id for container");
11867
+ assert(logger$4P, id, "no id for container");
11868
11868
  if (isRootContainer(container)) {
11869
- assert(logger$4O, id === "root", `invalid root container id, : ${id}`);
11869
+ assert(logger$4P, id === "root", `invalid root container id, : ${id}`);
11870
11870
  }
11871
11871
  return id;
11872
11872
  }
@@ -11877,7 +11877,7 @@ var __publicField = (obj, key, value) => {
11877
11877
  function generateEditorContainerId(containerId) {
11878
11878
  return `ones-editor-container-${containerId}`;
11879
11879
  }
11880
- const logger$4N = getLogger("element");
11880
+ const logger$4O = getLogger("element");
11881
11881
  function createContainerElement(parent, type, containerId) {
11882
11882
  const container = createElement("div", [type], parent);
11883
11883
  container.setAttribute("data-type", "editor-container");
@@ -11888,7 +11888,7 @@ var __publicField = (obj, key, value) => {
11888
11888
  }
11889
11889
  function getContainerById(editor, containerId) {
11890
11890
  const container = editor.rootElement.querySelector(`[data-container-id=${containerId}]`);
11891
- assert(logger$4N, container, `no container: ${containerId}`);
11891
+ assert(logger$4O, container, `no container: ${containerId}`);
11892
11892
  return container;
11893
11893
  }
11894
11894
  function getExistsContainerById(editor, containerId) {
@@ -11897,7 +11897,7 @@ var __publicField = (obj, key, value) => {
11897
11897
  }
11898
11898
  function getContainerBlocksElement(container) {
11899
11899
  const blocks = container.querySelector(":scope > .container-blocks");
11900
- assert(logger$4N, blocks, "no container blocks element");
11900
+ assert(logger$4O, blocks, "no container blocks element");
11901
11901
  return blocks;
11902
11902
  }
11903
11903
  function getContainerToolsElement(container) {
@@ -11910,11 +11910,11 @@ var __publicField = (obj, key, value) => {
11910
11910
  function isContainerBlocksElement(element) {
11911
11911
  return element.classList.contains("container-blocks");
11912
11912
  }
11913
- const logger$4M = getLogger("container-children");
11913
+ const logger$4N = getLogger("container-children");
11914
11914
  function getChildBlocks(container, traverseChild) {
11915
11915
  const content = getContainerBlocksElement(container);
11916
11916
  const blocks = Array.from(content.children);
11917
- assert(logger$4M, blocks.length > 0, "container have not any child block");
11917
+ assert(logger$4N, blocks.length > 0, "container have not any child block");
11918
11918
  if (traverseChild) {
11919
11919
  const { condition, editor } = traverseChild;
11920
11920
  return blocks.reduce((result, block) => {
@@ -11937,7 +11937,7 @@ var __publicField = (obj, key, value) => {
11937
11937
  }
11938
11938
  function getFirstChildBlock(container) {
11939
11939
  const block = container.querySelector(":scope > .container-blocks > div[data-type=editor-block]");
11940
- assert(logger$4M, block, "container have not any child block");
11940
+ assert(logger$4N, block, "container have not any child block");
11941
11941
  return block;
11942
11942
  }
11943
11943
  function getLastChildBlock(container) {
@@ -11949,14 +11949,14 @@ var __publicField = (obj, key, value) => {
11949
11949
  }
11950
11950
  function getBlockByIndex(container, blockIndex) {
11951
11951
  const block = getChildBlocks(container)[blockIndex];
11952
- assert(logger$4M, block, `container have not block at index ${blockIndex}`);
11952
+ assert(logger$4N, block, `container have not block at index ${blockIndex}`);
11953
11953
  return block;
11954
11954
  }
11955
11955
  function findBlockByIndex(container, blockIndex) {
11956
11956
  var _a;
11957
11957
  return (_a = getChildBlocks(container)[blockIndex]) != null ? _a : null;
11958
11958
  }
11959
- const logger$4L = getLogger("block-dom");
11959
+ const logger$4M = getLogger("block-dom");
11960
11960
  function isBlock$1(node) {
11961
11961
  if (!(node instanceof HTMLDivElement)) {
11962
11962
  return false;
@@ -11977,12 +11977,12 @@ var __publicField = (obj, key, value) => {
11977
11977
  }
11978
11978
  function getBlockId(block) {
11979
11979
  const { id } = block;
11980
- assert(logger$4L, id, "no block id");
11980
+ assert(logger$4M, id, "no block id");
11981
11981
  return id;
11982
11982
  }
11983
11983
  function getBlockType(block) {
11984
11984
  const type = block.getAttribute("data-block-type");
11985
- assert(logger$4L, type, "invalid block dom, no data-type");
11985
+ assert(logger$4M, type, "invalid block dom, no data-type");
11986
11986
  return type;
11987
11987
  }
11988
11988
  function getParentBlock(node) {
@@ -12005,12 +12005,12 @@ var __publicField = (obj, key, value) => {
12005
12005
  }
12006
12006
  function getParentContainer(block) {
12007
12007
  const container = block.closest("div[data-type=editor-container]");
12008
- assert(logger$4L, container, "failed to get block container");
12008
+ assert(logger$4M, container, "failed to get block container");
12009
12009
  return container;
12010
12010
  }
12011
12011
  function getBlockContent(block) {
12012
12012
  const content = block.querySelector(":scope >div[data-type=block-content]");
12013
- assert(logger$4L, content, "no block content");
12013
+ assert(logger$4M, content, "no block content");
12014
12014
  return content;
12015
12015
  }
12016
12016
  function getBlockTools(block) {
@@ -12019,7 +12019,7 @@ var __publicField = (obj, key, value) => {
12019
12019
  tools = createElement("div", [], block);
12020
12020
  tools.setAttribute("data-type", "block-tools");
12021
12021
  }
12022
- assert(logger$4L, tools, "no block tools");
12022
+ assert(logger$4M, tools, "no block tools");
12023
12023
  return tools;
12024
12024
  }
12025
12025
  function getExistsBlockTools(block) {
@@ -12040,7 +12040,7 @@ var __publicField = (obj, key, value) => {
12040
12040
  function createBlockElement(editor, path, data2) {
12041
12041
  const blockData = editor.editorDecorators.decorateBlock(path, data2);
12042
12042
  const { id, type } = blockData;
12043
- assert(logger$4L, id, "no block id");
12043
+ assert(logger$4M, id, "no block id");
12044
12044
  const elem = createElement("div", [`${type}-block`], null);
12045
12045
  elem.id = id;
12046
12046
  elem.setAttribute("data-type", "editor-block");
@@ -12078,7 +12078,7 @@ var __publicField = (obj, key, value) => {
12078
12078
  }
12079
12079
  function getBoxTypeFromElement(box) {
12080
12080
  const type = box.getAttribute("data-box-type");
12081
- assert(logger$4L, type, "not a valid box element, no type");
12081
+ assert(logger$4M, type, "not a valid box element, no type");
12082
12082
  return type;
12083
12083
  }
12084
12084
  function isBox(node) {
@@ -12089,7 +12089,7 @@ var __publicField = (obj, key, value) => {
12089
12089
  }
12090
12090
  function getBoxId(box) {
12091
12091
  const { id } = box;
12092
- assert(logger$4L, id, "no box id");
12092
+ assert(logger$4M, id, "no box id");
12093
12093
  return id;
12094
12094
  }
12095
12095
  function getParentBox(node) {
@@ -12111,7 +12111,7 @@ var __publicField = (obj, key, value) => {
12111
12111
  }
12112
12112
  function getBoxContent(box) {
12113
12113
  const content = box.querySelector("span[data-type=box-content]");
12114
- assert(logger$4L, content, "invalid box dom, no content");
12114
+ assert(logger$4M, content, "invalid box dom, no content");
12115
12115
  return content;
12116
12116
  }
12117
12117
  function createInsertionElement(type, id, attributes) {
@@ -12133,7 +12133,7 @@ var __publicField = (obj, key, value) => {
12133
12133
  }
12134
12134
  function getInsertionContent(insertion) {
12135
12135
  const content = insertion.querySelector("span[data-type=insertion-content]");
12136
- assert(logger$4L, content, "invalid insertion-child dom, no content");
12136
+ assert(logger$4M, content, "invalid insertion-child dom, no content");
12137
12137
  return content;
12138
12138
  }
12139
12139
  function getPrevBlock(block) {
@@ -12193,7 +12193,7 @@ var __publicField = (obj, key, value) => {
12193
12193
  const container = getParentContainer(block);
12194
12194
  const children = getChildBlocks(container);
12195
12195
  const index2 = children.indexOf(block);
12196
- assert(logger$4L, index2 !== -1, "invalid block & container dom, failed to get block index");
12196
+ assert(logger$4M, index2 !== -1, "invalid block & container dom, failed to get block index");
12197
12197
  return index2;
12198
12198
  }
12199
12199
  function isInBlock(target) {
@@ -12218,18 +12218,18 @@ var __publicField = (obj, key, value) => {
12218
12218
  function isTitleBlock$2(block) {
12219
12219
  return block.hasAttribute("data-document-title");
12220
12220
  }
12221
- const logger$4K = getLogger("block-class");
12221
+ const logger$4L = getLogger("block-class");
12222
12222
  function getBlockClass(editor, block) {
12223
12223
  return editor.editorBlocks.getBlockClass(getBlockType(block));
12224
12224
  }
12225
12225
  function getTextBlockClass(editor, block) {
12226
12226
  const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
12227
- assert(logger$4K, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
12227
+ assert(logger$4L, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
12228
12228
  return text2;
12229
12229
  }
12230
12230
  function getComplexBlockClass(editor, block) {
12231
12231
  const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
12232
- assert(logger$4K, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
12232
+ assert(logger$4L, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
12233
12233
  return complex;
12234
12234
  }
12235
12235
  function getBlockClassByType(editor, type) {
@@ -12250,7 +12250,7 @@ var __publicField = (obj, key, value) => {
12250
12250
  function getBlockKind(editor, block) {
12251
12251
  return getBlockClass(editor, block).blockKind;
12252
12252
  }
12253
- const logger$4J = getLogger("text-block-child");
12253
+ const logger$4K = getLogger("text-block-child");
12254
12254
  function isTextBlockContentChild(elem) {
12255
12255
  if (elem.tagName !== "SPAN") {
12256
12256
  return false;
@@ -12258,14 +12258,14 @@ var __publicField = (obj, key, value) => {
12258
12258
  return true;
12259
12259
  }
12260
12260
  function isTextBlockContentBoxChild(elem) {
12261
- assert(logger$4J, isTextBlockContentChild(elem), "not a valid text child");
12261
+ assert(logger$4K, isTextBlockContentChild(elem), "not a valid text child");
12262
12262
  if (elem.getAttribute("data-type") === "editor-box") {
12263
12263
  return true;
12264
12264
  }
12265
12265
  return false;
12266
12266
  }
12267
12267
  function isTextBlockContentInsertionChild(elem) {
12268
- assert(logger$4J, isTextBlockContentChild(elem), "not a valid text child");
12268
+ assert(logger$4K, isTextBlockContentChild(elem), "not a valid text child");
12269
12269
  if (elem.getAttribute("data-type") === "editor-insertion") {
12270
12270
  return true;
12271
12271
  }
@@ -12275,7 +12275,7 @@ var __publicField = (obj, key, value) => {
12275
12275
  return !isTextBlockContentBoxChild(elem) && !isTextBlockContentInsertionChild(elem);
12276
12276
  }
12277
12277
  function getTextBlockContentChildType(child) {
12278
- assert(logger$4J, isTextBlockContentChild(child), "not a valid text child");
12278
+ assert(logger$4K, isTextBlockContentChild(child), "not a valid text child");
12279
12279
  if (isTextBlockContentBoxChild(child)) {
12280
12280
  return "box";
12281
12281
  }
@@ -12290,15 +12290,15 @@ var __publicField = (obj, key, value) => {
12290
12290
  return 0;
12291
12291
  if (type === "box")
12292
12292
  return 1;
12293
- assert(logger$4J, child.textContent !== null, "text block content is undefined");
12294
- assert(logger$4J, child.textContent.length >= 0, "text block content length is negative");
12293
+ assert(logger$4K, child.textContent !== null, "text block content is undefined");
12294
+ assert(logger$4K, child.textContent.length >= 0, "text block content length is negative");
12295
12295
  return child.textContent.length;
12296
12296
  }
12297
12297
  function getTextBlockContentChildren(block) {
12298
12298
  const content = getBlockContent(block);
12299
12299
  const children = Array.from(content.children);
12300
12300
  children.forEach((child) => {
12301
- assert(logger$4J, isTextBlockContentChild(child), "not a valid text child");
12301
+ assert(logger$4K, isTextBlockContentChild(child), "not a valid text child");
12302
12302
  });
12303
12303
  return children;
12304
12304
  }
@@ -12327,17 +12327,17 @@ var __publicField = (obj, key, value) => {
12327
12327
  };
12328
12328
  }
12329
12329
  const offset = blockOffset - start;
12330
- assert(logger$4J, offset > 0, "invalid offset value");
12331
- assert(logger$4J, !isTextBlockContentBoxChild(child), "invalid box child");
12330
+ assert(logger$4K, offset > 0, "invalid offset value");
12331
+ assert(logger$4K, !isTextBlockContentBoxChild(child), "invalid box child");
12332
12332
  return {
12333
12333
  prev: child,
12334
12334
  next: child,
12335
12335
  offset
12336
12336
  };
12337
12337
  }
12338
- assert(logger$4J, false, `invalid block child at position: ${blockOffset}`);
12338
+ assert(logger$4K, false, `invalid block child at position: ${blockOffset}`);
12339
12339
  }
12340
- const logger$4I = getLogger("block-path");
12340
+ const logger$4J = getLogger("block-path");
12341
12341
  function getBlockPath(block) {
12342
12342
  const ret = [];
12343
12343
  let current = block;
@@ -12351,26 +12351,26 @@ var __publicField = (obj, key, value) => {
12351
12351
  return ret;
12352
12352
  }
12353
12353
  const parentBlock = getParentBlock(container);
12354
- assert(logger$4I, parentBlock, "no parent block");
12354
+ assert(logger$4J, parentBlock, "no parent block");
12355
12355
  current = parentBlock;
12356
12356
  }
12357
- assert(logger$4I, false, "no parent block");
12357
+ assert(logger$4J, false, "no parent block");
12358
12358
  return [];
12359
12359
  }
12360
- const logger$4H = getLogger("child-container-path");
12360
+ const logger$4I = getLogger("child-container-path");
12361
12361
  function getContainerBlockPath(container) {
12362
12362
  if (isRootContainer(container)) {
12363
12363
  return [];
12364
12364
  }
12365
12365
  const parentBlock = getParentBlock(container);
12366
- assert(logger$4H, parentBlock, "no parent block");
12366
+ assert(logger$4I, parentBlock, "no parent block");
12367
12367
  return getBlockPath(parentBlock);
12368
12368
  }
12369
- const logger$4G = getLogger("load-blocks");
12369
+ const logger$4H = getLogger("load-blocks");
12370
12370
  function loadBlocks(editor, container, path) {
12371
12371
  const containerId = getContainerId(container);
12372
12372
  const blocks = getContainerBlocks$1(container, editor.doc);
12373
- assert(logger$4G, blocks.length > 0, "no blocks in container");
12373
+ assert(logger$4H, blocks.length > 0, "no blocks in container");
12374
12374
  const fragment = document.createDocumentFragment();
12375
12375
  blocks.forEach((b, index2) => {
12376
12376
  const block = editor.editorBlocks.createBlock([...path, { containerId, blockIndex: index2 }], container, b);
@@ -12386,7 +12386,7 @@ var __publicField = (obj, key, value) => {
12386
12386
  return block;
12387
12387
  }
12388
12388
  const blocks = getChildBlocks(container);
12389
- assert(logger$4G, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
12389
+ assert(logger$4H, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
12390
12390
  if (blockIndex === blocks.length) {
12391
12391
  containerBlocksElement.appendChild(block);
12392
12392
  } else {
@@ -12404,7 +12404,7 @@ var __publicField = (obj, key, value) => {
12404
12404
  insertBlockAt(container, blockIndex, block);
12405
12405
  return block;
12406
12406
  }
12407
- const logger$4F = getLogger("root-container");
12407
+ const logger$4G = getLogger("root-container");
12408
12408
  const MIN_DISTANCE_THRESHOLD$2 = 3;
12409
12409
  class RootContainer {
12410
12410
  constructor(editor, rootContainer) {
@@ -12432,7 +12432,7 @@ var __publicField = (obj, key, value) => {
12432
12432
  this.editor.selection.updateSelection(null);
12433
12433
  this.editor.emit("resize", this.editor);
12434
12434
  } catch (err) {
12435
- logger$4F.warn(`failed to update selection while container resizing: ${err.message}`);
12435
+ logger$4G.warn(`failed to update selection while container resizing: ${err.message}`);
12436
12436
  }
12437
12437
  });
12438
12438
  __publicField(this, "handleClick", (event) => {
@@ -12466,7 +12466,7 @@ var __publicField = (obj, key, value) => {
12466
12466
  const box = getParentBox(elem);
12467
12467
  if (box && isChildNode(box, eTarget)) {
12468
12468
  const block2 = getParentBlock(box);
12469
- assert(logger$4F, block2, "no parent block");
12469
+ assert(logger$4G, block2, "no parent block");
12470
12470
  (_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, event);
12471
12471
  return;
12472
12472
  }
@@ -12522,7 +12522,7 @@ var __publicField = (obj, key, value) => {
12522
12522
  this.editor.input.focus({ preventScroll: true });
12523
12523
  });
12524
12524
  __publicField(this, "handleMouseMove", (event) => {
12525
- assert(logger$4F, this.mouseDownEvent, "no mouse down event");
12525
+ assert(logger$4G, this.mouseDownEvent, "no mouse down event");
12526
12526
  if (ensureIsMobileEvent(this.mouseDownEvent))
12527
12527
  return;
12528
12528
  const deltaX = event.x - this.mouseDownEvent.x;
@@ -12638,7 +12638,7 @@ var __publicField = (obj, key, value) => {
12638
12638
  loadBlocks(editor, container, path);
12639
12639
  return container;
12640
12640
  }
12641
- const logger$4E = getLogger("block");
12641
+ const logger$4F = getLogger("block");
12642
12642
  function getBlockTextLength$6(editor, block) {
12643
12643
  return getBlockClass(editor, block).getBlockTextLength(block);
12644
12644
  }
@@ -12657,7 +12657,7 @@ var __publicField = (obj, key, value) => {
12657
12657
  return block;
12658
12658
  }
12659
12659
  const parent = getParentBlock(container);
12660
- assert(logger$4E, parent, "no parent block exists for child container");
12660
+ assert(logger$4F, parent, "no parent block exists for child container");
12661
12661
  block = parent;
12662
12662
  }
12663
12663
  }
@@ -12693,7 +12693,7 @@ var __publicField = (obj, key, value) => {
12693
12693
  }
12694
12694
  return fun(editor, block, options);
12695
12695
  } catch (err) {
12696
- logger$4E.debug(`unsupported block type: ${type}`);
12696
+ logger$4F.debug(`unsupported block type: ${type}`);
12697
12697
  return null;
12698
12698
  }
12699
12699
  }
@@ -12713,7 +12713,7 @@ var __publicField = (obj, key, value) => {
12713
12713
  const styles2 = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
12714
12714
  Object.entries(styles2).forEach(([, value]) => {
12715
12715
  const type = typeof value;
12716
- assert(logger$4E, type === "string" || type === "number" || type === "boolean", "invalid style value");
12716
+ assert(logger$4F, type === "string" || type === "number" || type === "boolean", "invalid style value");
12717
12717
  });
12718
12718
  return styles2;
12719
12719
  }
@@ -12838,7 +12838,7 @@ var __publicField = (obj, key, value) => {
12838
12838
  }
12839
12839
  return { element: null, blockCommands: [], boxCommands: [] };
12840
12840
  }
12841
- const logger$4D = getLogger("embed-block-common");
12841
+ const logger$4E = getLogger("embed-block-common");
12842
12842
  function isColumnsBlock(block) {
12843
12843
  return getBlockType(block) === "layout";
12844
12844
  }
@@ -12846,9 +12846,9 @@ var __publicField = (obj, key, value) => {
12846
12846
  return getBlockType(block) === "embed";
12847
12847
  }
12848
12848
  function getEmbedType(block) {
12849
- assert(logger$4D, isEmbedBlock(block), "not an embed block");
12849
+ assert(logger$4E, isEmbedBlock(block), "not an embed block");
12850
12850
  const type = block.getAttribute("data-embed-type");
12851
- assert(logger$4D, type, "no embed data type");
12851
+ assert(logger$4E, type, "no embed data type");
12852
12852
  return type;
12853
12853
  }
12854
12854
  function getEmbedClassFromBlock(editor, block) {
@@ -12914,10 +12914,10 @@ var __publicField = (obj, key, value) => {
12914
12914
  data: (_c = overrideOptions == null ? void 0 : overrideOptions.data) != null ? _c : data2
12915
12915
  });
12916
12916
  }
12917
- const logger$4C = getLogger("execute-block-command");
12917
+ const logger$4D = getLogger("execute-block-command");
12918
12918
  function executeEmbedBlockCommand(editor, block, commandGroup, item) {
12919
12919
  var _a;
12920
- assert(logger$4C, isEmbedBlock(block), "not a embed block");
12920
+ assert(logger$4D, isEmbedBlock(block), "not a embed block");
12921
12921
  const embedType = getEmbedType(block);
12922
12922
  const embed = getEmbedClassByType(editor, embedType);
12923
12923
  if (!embed.getOptions) {
@@ -12950,14 +12950,14 @@ var __publicField = (obj, key, value) => {
12950
12950
  }
12951
12951
  return void 0;
12952
12952
  }
12953
- const logger$4B = getLogger("block-class");
12953
+ const logger$4C = getLogger("block-class");
12954
12954
  function isHeadingBlock$1(block) {
12955
12955
  return !!block.getAttribute("data-style-heading");
12956
12956
  }
12957
12957
  function getBlockHeading(block) {
12958
12958
  var _a;
12959
12959
  const heading = Number.parseInt((_a = block.getAttribute("data-style-heading")) != null ? _a : "", 10);
12960
- assert(logger$4B, heading, "not a heading block");
12960
+ assert(logger$4C, heading, "not a heading block");
12961
12961
  return heading;
12962
12962
  }
12963
12963
  function isExpandedHeadingBlock(block) {
@@ -12968,7 +12968,7 @@ var __publicField = (obj, key, value) => {
12968
12968
  }
12969
12969
  function getHeadingBlockChildren(block, oldHeading) {
12970
12970
  if (!oldHeading) {
12971
- assert(logger$4B, isHeadingBlock$1(block), "not a heading block");
12971
+ assert(logger$4C, isHeadingBlock$1(block), "not a heading block");
12972
12972
  }
12973
12973
  const children = [];
12974
12974
  const heading = oldHeading != null ? oldHeading : getBlockHeading(block);
@@ -12998,7 +12998,7 @@ var __publicField = (obj, key, value) => {
12998
12998
  }
12999
12999
  return children;
13000
13000
  }
13001
- const logger$4A = getLogger("complex-block-position");
13001
+ const logger$4B = getLogger("complex-block-position");
13002
13002
  class EditorComplexBlockPosition {
13003
13003
  constructor(block, childContainerId, custom) {
13004
13004
  __publicField(this, "blockId");
@@ -13007,7 +13007,7 @@ var __publicField = (obj, key, value) => {
13007
13007
  if (block instanceof HTMLElement) {
13008
13008
  this.blockId = getBlockId(block);
13009
13009
  } else {
13010
- assert(logger$4A, typeof block === "string", `not a valid block id: ${block}`);
13010
+ assert(logger$4B, typeof block === "string", `not a valid block id: ${block}`);
13011
13011
  this.blockId = block;
13012
13012
  }
13013
13013
  this.childContainerId = childContainerId;
@@ -13019,7 +13019,7 @@ var __publicField = (obj, key, value) => {
13019
13019
  return false;
13020
13020
  }
13021
13021
  }
13022
- const logger$4z = getLogger("simple-block-position");
13022
+ const logger$4A = getLogger("simple-block-position");
13023
13023
  class EditorSimpleBlockPosition {
13024
13024
  constructor(block, offset, type) {
13025
13025
  __publicField(this, "blockId");
@@ -13028,7 +13028,7 @@ var __publicField = (obj, key, value) => {
13028
13028
  if (block instanceof HTMLElement) {
13029
13029
  this.blockId = getBlockId(block);
13030
13030
  } else {
13031
- assert(logger$4z, typeof block === "string", `not a valid block id: ${block}`);
13031
+ assert(logger$4A, typeof block === "string", `not a valid block id: ${block}`);
13032
13032
  this.blockId = block;
13033
13033
  }
13034
13034
  this.offset = offset;
@@ -13038,7 +13038,7 @@ var __publicField = (obj, key, value) => {
13038
13038
  return true;
13039
13039
  }
13040
13040
  }
13041
- const logger$4y = getLogger("editor-position");
13041
+ const logger$4z = getLogger("editor-position");
13042
13042
  function createSimpleBlockPosition(block, offset, type) {
13043
13043
  return new EditorSimpleBlockPosition(block, offset, type);
13044
13044
  }
@@ -13060,7 +13060,7 @@ var __publicField = (obj, key, value) => {
13060
13060
  }
13061
13061
  const block1 = editor.getBlockById(pos1.blockId);
13062
13062
  const block2 = editor.getBlockById(pos2.blockId);
13063
- assert(logger$4y, block1 !== block2, "comparePosition: blocks are the same");
13063
+ assert(logger$4z, block1 !== block2, "comparePosition: blocks are the same");
13064
13064
  return compareElement(block1, block2);
13065
13065
  }
13066
13066
  if (isComplexBlockPosition(pos1) && isComplexBlockPosition(pos2)) {
@@ -13071,13 +13071,13 @@ var __publicField = (obj, key, value) => {
13071
13071
  }
13072
13072
  const container1 = editor.getContainerById(p1.childContainerId);
13073
13073
  const container2 = editor.getContainerById(p2.childContainerId);
13074
- assert(logger$4y, container1 !== container2, "comparePosition: containers are the same");
13074
+ assert(logger$4z, container1 !== container2, "comparePosition: containers are the same");
13075
13075
  return compareElement(container1, container2);
13076
13076
  }
13077
- assert(logger$4y, false, "invalid ");
13077
+ assert(logger$4z, false, "invalid ");
13078
13078
  return 0;
13079
13079
  }
13080
- const logger$4x = getLogger("simple-range");
13080
+ const logger$4y = getLogger("simple-range");
13081
13081
  class EditorSimpleSelectionRange {
13082
13082
  constructor(editor, options) {
13083
13083
  __publicField(this, "editor");
@@ -13126,11 +13126,11 @@ var __publicField = (obj, key, value) => {
13126
13126
  const { editor } = this;
13127
13127
  const startBlock = editor.getBlockById(this.start.blockId);
13128
13128
  const endBlock = editor.getBlockById(this.end.blockId);
13129
- assert(logger$4x, startBlock, "no start block");
13130
- assert(logger$4x, endBlock, "no end block");
13129
+ assert(logger$4y, startBlock, "no start block");
13130
+ assert(logger$4y, endBlock, "no end block");
13131
13131
  const startContainer = getParentContainer(startBlock);
13132
13132
  const endContainer = getParentContainer(endBlock);
13133
- assert(logger$4x, startContainer === endContainer, "invalid range");
13133
+ assert(logger$4y, startContainer === endContainer, "invalid range");
13134
13134
  const ret = [];
13135
13135
  if (startBlock === endBlock) {
13136
13136
  ret.push({
@@ -13141,7 +13141,7 @@ var __publicField = (obj, key, value) => {
13141
13141
  } else {
13142
13142
  const startIndex = getBlockIndex(startBlock);
13143
13143
  const endIndex = getBlockIndex(endBlock);
13144
- assert(logger$4x, startIndex < endIndex, "invalid range, start > index");
13144
+ assert(logger$4y, startIndex < endIndex, "invalid range, start > index");
13145
13145
  ret.push({
13146
13146
  block: startBlock,
13147
13147
  start: this.start,
@@ -13241,7 +13241,7 @@ var __publicField = (obj, key, value) => {
13241
13241
  clearSelection: clearSelection$6,
13242
13242
  convertTo: convertTo$m
13243
13243
  };
13244
- const logger$4w = getLogger("editor-blocks");
13244
+ const logger$4x = getLogger("editor-blocks");
13245
13245
  class EditorBlocks {
13246
13246
  constructor(editor) {
13247
13247
  __publicField(this, "blocks", /* @__PURE__ */ new Map());
@@ -13250,12 +13250,12 @@ var __publicField = (obj, key, value) => {
13250
13250
  registerBlockClass(blockClass) {
13251
13251
  const type = blockClass.blockType;
13252
13252
  const exists = this.blocks.get(type);
13253
- assert(logger$4w, !exists, `duplicated block type: ${type}`);
13253
+ assert(logger$4x, !exists, `duplicated block type: ${type}`);
13254
13254
  this.blocks.set(type, blockClass);
13255
13255
  }
13256
13256
  getBlockClass(type) {
13257
13257
  const exists = this.blocks.get(type);
13258
- assert(logger$4w, exists, `unknown block type: ${type}`);
13258
+ assert(logger$4x, exists, `unknown block type: ${type}`);
13259
13259
  return exists;
13260
13260
  }
13261
13261
  hasBlock(type) {
@@ -13271,7 +13271,7 @@ var __publicField = (obj, key, value) => {
13271
13271
  }
13272
13272
  const content = blockClass.createBlockContent(this.editor, path, container, blockElement, block);
13273
13273
  if (content.parentElement !== blockElement) {
13274
- logger$4w.warn("content parent is not block");
13274
+ logger$4x.warn("content parent is not block");
13275
13275
  blockElement.appendChild(content);
13276
13276
  }
13277
13277
  this.editor.blockHooks.forEach((hook) => {
@@ -13292,7 +13292,7 @@ var __publicField = (obj, key, value) => {
13292
13292
  return newBlock;
13293
13293
  }
13294
13294
  }
13295
- const logger$4v = getLogger("editor-embeds");
13295
+ const logger$4w = getLogger("editor-embeds");
13296
13296
  class EditorEmbeds {
13297
13297
  constructor(editor) {
13298
13298
  __publicField(this, "objects", /* @__PURE__ */ new Map());
@@ -13301,12 +13301,12 @@ var __publicField = (obj, key, value) => {
13301
13301
  registerEmbedClass(embedClass) {
13302
13302
  const type = embedClass.embedType;
13303
13303
  const exists = this.objects.get(type);
13304
- assert(logger$4v, !exists, `duplicated embed object type: ${type}`);
13304
+ assert(logger$4w, !exists, `duplicated embed object type: ${type}`);
13305
13305
  this.objects.set(type, embedClass);
13306
13306
  }
13307
13307
  getEmbedClass(type) {
13308
13308
  const exists = this.objects.get(type);
13309
- assert(logger$4v, exists, `unknown embed type: ${type}`);
13309
+ assert(logger$4w, exists, `unknown embed type: ${type}`);
13310
13310
  return exists;
13311
13311
  }
13312
13312
  getEmbedClassFromBlock(block) {
@@ -13316,12 +13316,12 @@ var __publicField = (obj, key, value) => {
13316
13316
  this.objects.forEach(callback);
13317
13317
  }
13318
13318
  }
13319
- const logger$4u = getLogger("embed-block");
13319
+ const logger$4v = getLogger("embed-block");
13320
13320
  function createBlockContent$6(editor, path, container, blockElement, blockData) {
13321
13321
  const content = createBlockContentElement(blockElement, "div");
13322
- assert(logger$4u, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
13322
+ assert(logger$4v, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
13323
13323
  const embedBlockData = blockData;
13324
- assert(logger$4u, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
13324
+ assert(logger$4v, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
13325
13325
  const embedClass = editor.editorEmbeds.getEmbedClass(embedBlockData.embedType);
13326
13326
  embedClass.createEmbedContent(editor, content, embedBlockData, path, container, blockElement);
13327
13327
  blockElement.setAttribute("data-embed-type", embedBlockData.embedType);
@@ -13349,7 +13349,7 @@ var __publicField = (obj, key, value) => {
13349
13349
  function getCaretRect$4(block, pos) {
13350
13350
  const content = getBlockContent(block);
13351
13351
  const rect = content.getBoundingClientRect();
13352
- assert(logger$4u, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
13352
+ assert(logger$4v, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
13353
13353
  if (pos.offset === 1) {
13354
13354
  return new DOMRect(rect.right, rect.top, 0, rect.height);
13355
13355
  }
@@ -13489,18 +13489,18 @@ var __publicField = (obj, key, value) => {
13489
13489
  toStandardDoc: toStandardDoc$2,
13490
13490
  getResources: getResources$2
13491
13491
  };
13492
- const logger$4t = getLogger("complex-block-helper");
13492
+ const logger$4u = getLogger("complex-block-helper");
13493
13493
  function complexBlockGetAllChildContainers(editor, block, options) {
13494
13494
  const blockClass = getComplexBlockClass(editor, block);
13495
13495
  return blockClass.getChildContainers(editor, block, options);
13496
13496
  }
13497
13497
  function complexBlockGetSelectedContainers(editor, block, start, end) {
13498
13498
  if (start.isSimple()) {
13499
- assert(logger$4t, end.isSimple(), "invalid start and end position");
13499
+ assert(logger$4u, end.isSimple(), "invalid start and end position");
13500
13500
  return complexBlockGetAllChildContainers(editor, block);
13501
13501
  }
13502
- assert(logger$4t, !start.isSimple(), "invalid start pos");
13503
- assert(logger$4t, !end.isSimple(), "invalid end pos");
13502
+ assert(logger$4u, !start.isSimple(), "invalid start pos");
13503
+ assert(logger$4u, !end.isSimple(), "invalid end pos");
13504
13504
  const blockClass = getComplexBlockClass(editor, block);
13505
13505
  return blockClass.getSelectedContainers(editor, block, start, end);
13506
13506
  }
@@ -13511,11 +13511,11 @@ var __publicField = (obj, key, value) => {
13511
13511
  const parentComplexBlock = getParentBlock(getParentContainer(childBlock));
13512
13512
  if (!parentComplexBlock)
13513
13513
  return false;
13514
- assert(logger$4t, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
13514
+ assert(logger$4u, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
13515
13515
  const childContainer = getParentContainer(childBlock);
13516
13516
  const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock);
13517
13517
  const index2 = childContainers.indexOf(childContainer);
13518
- assert(logger$4t, index2 >= 0, "not valid child container");
13518
+ assert(logger$4u, index2 >= 0, "not valid child container");
13519
13519
  return index2 === 0;
13520
13520
  }
13521
13521
  function complexBlockGetFirstSimpleChild(editor, complexBlock, options) {
@@ -13568,13 +13568,13 @@ var __publicField = (obj, key, value) => {
13568
13568
  return block;
13569
13569
  }
13570
13570
  function findPrevSimpleBlockBeforeChildContainer(editor, childContainer, options) {
13571
- assert(logger$4t, isChildContainer(childContainer), "not a child container");
13571
+ assert(logger$4u, isChildContainer(childContainer), "not a child container");
13572
13572
  const parentComplexBlock = getParentBlock(childContainer);
13573
- assert(logger$4t, parentComplexBlock, "no parent block");
13574
- assert(logger$4t, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
13573
+ assert(logger$4u, parentComplexBlock, "no parent block");
13574
+ assert(logger$4u, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
13575
13575
  const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock, options);
13576
13576
  const containerIndex = childContainers.indexOf(childContainer);
13577
- assert(logger$4t, containerIndex !== -1, "child container not found");
13577
+ assert(logger$4u, containerIndex !== -1, "child container not found");
13578
13578
  if (containerIndex === 0) {
13579
13579
  const prevBlock = getPrevBlock(parentComplexBlock);
13580
13580
  if (!prevBlock)
@@ -13592,9 +13592,9 @@ var __publicField = (obj, key, value) => {
13592
13592
  return lastBlock2;
13593
13593
  }
13594
13594
  function complexBlockGetTopChildContainers(editor, complexBlock) {
13595
- assert(logger$4t, isComplexKindBlock(editor, complexBlock), "not a complex block");
13595
+ assert(logger$4u, isComplexKindBlock(editor, complexBlock), "not a complex block");
13596
13596
  const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
13597
- assert(logger$4t, childContainers.length > 0, "no child container");
13597
+ assert(logger$4u, childContainers.length > 0, "no child container");
13598
13598
  if (childContainers.length === 1) {
13599
13599
  return childContainers;
13600
13600
  }
@@ -13619,9 +13619,9 @@ var __publicField = (obj, key, value) => {
13619
13619
  return ret;
13620
13620
  }
13621
13621
  function complexBlockGetBottomChildContainers(editor, complexBlock) {
13622
- assert(logger$4t, isComplexKindBlock(editor, complexBlock), "not a complex block");
13622
+ assert(logger$4u, isComplexKindBlock(editor, complexBlock), "not a complex block");
13623
13623
  const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
13624
- assert(logger$4t, childContainers.length > 0, "no child container");
13624
+ assert(logger$4u, childContainers.length > 0, "no child container");
13625
13625
  if (childContainers.length === 1) {
13626
13626
  return childContainers;
13627
13627
  }
@@ -13726,11 +13726,11 @@ var __publicField = (obj, key, value) => {
13726
13726
  return result;
13727
13727
  }
13728
13728
  const anchor = "";
13729
- const logger$4s = getLogger("text-range");
13729
+ const logger$4t = getLogger("text-range");
13730
13730
  function getBlockRangeInfo(block, blockOffset) {
13731
13731
  const getChildRange = (child, offset) => {
13732
13732
  if (isTextBlockContentInsertionChild(child)) {
13733
- assert(logger$4s, offset === 0, `invalid offset for insertion child: ${offset}`);
13733
+ assert(logger$4t, offset === 0, `invalid offset for insertion child: ${offset}`);
13734
13734
  const childOffset = 2;
13735
13735
  return {
13736
13736
  child,
@@ -13739,7 +13739,7 @@ var __publicField = (obj, key, value) => {
13739
13739
  };
13740
13740
  }
13741
13741
  if (isTextBlockContentBoxChild(child)) {
13742
- assert(logger$4s, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
13742
+ assert(logger$4t, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
13743
13743
  const childOffset = offset === 0 ? 1 : 2;
13744
13744
  return {
13745
13745
  child,
@@ -13748,17 +13748,17 @@ var __publicField = (obj, key, value) => {
13748
13748
  };
13749
13749
  }
13750
13750
  const textNode = child.firstChild;
13751
- assert(logger$4s, textNode, "no child node for text child");
13752
- assert(logger$4s, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
13751
+ assert(logger$4t, textNode, "no child node for text child");
13752
+ assert(logger$4t, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
13753
13753
  if (textNode instanceof HTMLBRElement) {
13754
- assert(logger$4s, offset >= 0 && offset <= 0, "invalid offset for text child");
13754
+ assert(logger$4t, offset >= 0 && offset <= 0, "invalid offset for text child");
13755
13755
  return {
13756
13756
  child,
13757
13757
  container: textNode,
13758
13758
  offset
13759
13759
  };
13760
13760
  }
13761
- assert(logger$4s, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
13761
+ assert(logger$4t, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
13762
13762
  return {
13763
13763
  child,
13764
13764
  container: textNode,
@@ -13787,38 +13787,38 @@ var __publicField = (obj, key, value) => {
13787
13787
  }
13788
13788
  start += childLength;
13789
13789
  }
13790
- assert(logger$4s, false, "failed to get range info");
13790
+ assert(logger$4t, false, "failed to get range info");
13791
13791
  }
13792
13792
  function createChildRange(child, start, end) {
13793
13793
  if (start === end) {
13794
- assert(logger$4s, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
13794
+ assert(logger$4t, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
13795
13795
  } else {
13796
- assert(logger$4s, start < end, `invalid start & end: ${start}, ${end}`);
13796
+ assert(logger$4t, start < end, `invalid start & end: ${start}, ${end}`);
13797
13797
  }
13798
13798
  if (isTextBlockContentInsertionChild(child)) {
13799
- assert(logger$4s, start === end, `invalid insertion child range offset: ${start}, ${end}`);
13800
- assert(logger$4s, start === 0, `invalid insertion child range start: ${start}`);
13799
+ assert(logger$4t, start === end, `invalid insertion child range offset: ${start}, ${end}`);
13800
+ assert(logger$4t, start === 0, `invalid insertion child range start: ${start}`);
13801
13801
  const insertionElem = child;
13802
- assert(logger$4s, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
13802
+ assert(logger$4t, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
13803
13803
  const range = createExpandedRange(insertionElem, 1, insertionElem, 2);
13804
13804
  return range;
13805
13805
  }
13806
13806
  if (isTextBlockContentBoxChild(child)) {
13807
- assert(logger$4s, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
13808
- assert(logger$4s, start === 0, `invalid box child range start: ${start}`);
13807
+ assert(logger$4t, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
13808
+ assert(logger$4t, start === 0, `invalid box child range start: ${start}`);
13809
13809
  const box = child;
13810
- assert(logger$4s, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
13810
+ assert(logger$4t, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
13811
13811
  const range = createExpandedRange(box, 1, box, 2);
13812
13812
  return range;
13813
13813
  }
13814
13814
  const length = getTextBlockContentChildTextLength(child);
13815
- assert(logger$4s, end <= length, `invalid child end: ${end}, ${length}`);
13815
+ assert(logger$4t, end <= length, `invalid child end: ${end}, ${length}`);
13816
13816
  const textNode = child.firstChild;
13817
- assert(logger$4s, textNode instanceof Text, "invalid block text child");
13818
- assert(logger$4s, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
13817
+ assert(logger$4t, textNode instanceof Text, "invalid block text child");
13818
+ assert(logger$4t, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
13819
13819
  return createExpandedRange(textNode, start, textNode, end);
13820
13820
  }
13821
- const logger$4r = getLogger("caret-rect");
13821
+ const logger$4s = getLogger("caret-rect");
13822
13822
  function getChildClientRects(block, child) {
13823
13823
  if (isBox(child)) {
13824
13824
  const box = child;
@@ -13827,7 +13827,7 @@ var __publicField = (obj, key, value) => {
13827
13827
  const blockContent = getBlockContent(block);
13828
13828
  const lineHeight = Number.parseFloat(window.getComputedStyle(blockContent).lineHeight) || boxContent.getBoundingClientRect().height;
13829
13829
  const rects = Array.from(boxContent.getClientRects());
13830
- assert(logger$4r, rects.length > 0, "no box client rects");
13830
+ assert(logger$4s, rects.length > 0, "no box client rects");
13831
13831
  const blockRect = blockContent.getBoundingClientRect();
13832
13832
  const firstRect = rects[0];
13833
13833
  const lastRect = new DOMRect(blockRect.left, firstRect.bottom, 1, lineHeight);
@@ -13847,22 +13847,22 @@ var __publicField = (obj, key, value) => {
13847
13847
  const rect2 = getLastClientRect(ranges[0].child);
13848
13848
  return new DOMRect(rect2.right, rect2.top, 1, rect2.height);
13849
13849
  }
13850
- assert(logger$4r, ranges[1], "invalid ranges");
13850
+ assert(logger$4s, ranges[1], "invalid ranges");
13851
13851
  const rect = getFirstClientRect(ranges[1].child);
13852
13852
  return new DOMRect(rect.left, rect.top, 1, rect.height);
13853
13853
  }
13854
13854
  let rangeInfo = ranges[0];
13855
- assert(logger$4r, ranges.length >= 1, "failed to get block range");
13855
+ assert(logger$4s, ranges.length >= 1, "failed to get block range");
13856
13856
  if (ranges.length === 1) {
13857
13857
  rangeInfo = ranges[0];
13858
13858
  } else {
13859
- assert(logger$4r, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
13859
+ assert(logger$4s, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
13860
13860
  if (isTextBlockContentInsertionChild(ranges[ranges.length - 1].child)) {
13861
13861
  rangeInfo = ranges[ranges.length - 1];
13862
13862
  const child = rangeInfo.child;
13863
13863
  const content = getInsertionContent(child);
13864
13864
  const rects2 = content.getClientRects();
13865
- assert(logger$4r, rects2.length >= 1, "no client rects for box content");
13865
+ assert(logger$4s, rects2.length >= 1, "no client rects for box content");
13866
13866
  const rect = rects2[rects2.length - 1];
13867
13867
  return new DOMRect(rect.right, rect.y, 1, rect.height);
13868
13868
  }
@@ -13879,9 +13879,9 @@ var __publicField = (obj, key, value) => {
13879
13879
  }
13880
13880
  }
13881
13881
  if (rangeInfo.container instanceof HTMLBRElement) {
13882
- assert(logger$4r, pos.offset === 0, "invalid offset for empty block text");
13882
+ assert(logger$4s, pos.offset === 0, "invalid offset for empty block text");
13883
13883
  const parent = rangeInfo.container.parentElement;
13884
- assert(logger$4r, parent, "invalid br parent");
13884
+ assert(logger$4s, parent, "invalid br parent");
13885
13885
  const rect = parent.getBoundingClientRect();
13886
13886
  const ret = new DOMRect(rect.left, rect.top, 1, rect.height);
13887
13887
  return ret;
@@ -13889,11 +13889,11 @@ var __publicField = (obj, key, value) => {
13889
13889
  const range = createRange(rangeInfo.container, rangeInfo.offset);
13890
13890
  const rects = Array.from(range.getClientRects());
13891
13891
  if (rects.length === 0) {
13892
- assert(logger$4r, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
13893
- assert(logger$4r, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
13892
+ assert(logger$4s, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
13893
+ assert(logger$4s, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
13894
13894
  const child = rangeInfo.child;
13895
13895
  const rects2 = getChildClientRects(block, child);
13896
- assert(logger$4r, rects2.length >= 1, "no client rects for box content");
13896
+ assert(logger$4s, rects2.length >= 1, "no client rects for box content");
13897
13897
  if (rangeInfo.offset === 1) {
13898
13898
  const rect2 = rects2[0];
13899
13899
  return new DOMRect(rect2.x, rect2.y, 1, rect2.height);
@@ -13939,7 +13939,7 @@ var __publicField = (obj, key, value) => {
13939
13939
  });
13940
13940
  }
13941
13941
  }
13942
- assert(logger$4r, rects.length > 0, "no client rects for range");
13942
+ assert(logger$4s, rects.length > 0, "no client rects for range");
13943
13943
  if (pos.type === "home") {
13944
13944
  return rects[rects.length - 1];
13945
13945
  }
@@ -14019,13 +14019,13 @@ var __publicField = (obj, key, value) => {
14019
14019
  };
14020
14020
  }
14021
14021
  }
14022
- const logger$4q = getLogger("selection-range");
14022
+ const logger$4r = getLogger("selection-range");
14023
14023
  function createEditorSelectionRange(editor, options) {
14024
14024
  const { anchor: anchor2, focus } = options;
14025
14025
  if (anchor2 instanceof EditorSimpleBlockPosition && focus instanceof EditorSimpleBlockPosition) {
14026
14026
  return new EditorSimpleSelectionRange(editor, { anchor: anchor2, focus });
14027
14027
  }
14028
- assert(logger$4q, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
14028
+ assert(logger$4r, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
14029
14029
  return new EditorComplexSelectionRange(editor, { anchor: anchor2, focus });
14030
14030
  }
14031
14031
  function createBlockSimpleRange(editor, block, anchor2, focus) {
@@ -14047,7 +14047,7 @@ var __publicField = (obj, key, value) => {
14047
14047
  const focus = createSimpleBlockPosition(range.focus.blockId, range.focus.offset, "normal");
14048
14048
  return createEditorSelectionRange(editor, { anchor: anchor2, focus });
14049
14049
  }
14050
- const logger$4p = getLogger("range-from-point");
14050
+ const logger$4q = getLogger("range-from-point");
14051
14051
  function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
14052
14052
  const yOffsets = [0, -12, 12];
14053
14053
  let x = pointX;
@@ -14079,7 +14079,7 @@ var __publicField = (obj, key, value) => {
14079
14079
  const rect = elem.getBoundingClientRect();
14080
14080
  if (rect.width && rect.top && i === 0) {
14081
14081
  if (rect.left + rect.width < x || rect.top + rect.height < y) {
14082
- logger$4p.debug("click on scrollbar, out of element rect");
14082
+ logger$4q.debug("click on scrollbar, out of element rect");
14083
14083
  return null;
14084
14084
  }
14085
14085
  }
@@ -14117,7 +14117,7 @@ var __publicField = (obj, key, value) => {
14117
14117
  let block = getLastChildBlock(container);
14118
14118
  if (!isVisibleBlock(block)) {
14119
14119
  const preBlock = getPrevVisibleBlock(block);
14120
- assert(logger$4p, preBlock, "container must have visible block");
14120
+ assert(logger$4q, preBlock, "container must have visible block");
14121
14121
  block = preBlock;
14122
14122
  }
14123
14123
  const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, block.getBoundingClientRect().bottom - 4);
@@ -14136,7 +14136,7 @@ var __publicField = (obj, key, value) => {
14136
14136
  if (range instanceof EditorSimpleSelectionRange) {
14137
14137
  return range;
14138
14138
  }
14139
- assert(logger$4p, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
14139
+ assert(logger$4q, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
14140
14140
  const complexRange = range;
14141
14141
  const container2 = editor.getContainerById(complexRange.start.childContainerId);
14142
14142
  return getRangeInContainer(editor, container2, x, y);
@@ -14159,7 +14159,7 @@ var __publicField = (obj, key, value) => {
14159
14159
  });
14160
14160
  return getRangeInContainer(editor, container, x, y);
14161
14161
  }
14162
- const logger$4o = getLogger("adjust-selection-pos");
14162
+ const logger$4p = getLogger("adjust-selection-pos");
14163
14163
  function getParentContainers(block) {
14164
14164
  const containers = [];
14165
14165
  while (block) {
@@ -14169,10 +14169,10 @@ var __publicField = (obj, key, value) => {
14169
14169
  return containers;
14170
14170
  }
14171
14171
  const newBlock = getParentBlock(container);
14172
- assert(logger$4o, newBlock, "child container has not parent container");
14172
+ assert(logger$4p, newBlock, "child container has not parent container");
14173
14173
  block = newBlock;
14174
14174
  }
14175
- assert(logger$4o, false, "should not come here: getParentContainers");
14175
+ assert(logger$4p, false, "should not come here: getParentContainers");
14176
14176
  }
14177
14177
  function getParentBlockInContainer(container, block) {
14178
14178
  while (block) {
@@ -14181,16 +14181,16 @@ var __publicField = (obj, key, value) => {
14181
14181
  return block;
14182
14182
  }
14183
14183
  const newBlock = getParentBlock(parent);
14184
- assert(logger$4o, newBlock, "could not find parent block for a child container");
14184
+ assert(logger$4p, newBlock, "could not find parent block for a child container");
14185
14185
  block = newBlock;
14186
14186
  }
14187
- assert(logger$4o, false, "no parent block in specified container");
14187
+ assert(logger$4p, false, "no parent block in specified container");
14188
14188
  }
14189
14189
  function getClosestParentBlock(block1, block2) {
14190
14190
  const containers1 = getParentContainers(block1);
14191
14191
  const containers2 = getParentContainers(block2);
14192
- assert(logger$4o, containers1.length > 0 && containers2.length > 0, "block has not parent container");
14193
- assert(logger$4o, containers1[0] === containers2[0], "root container does not equal");
14192
+ assert(logger$4p, containers1.length > 0 && containers2.length > 0, "block has not parent container");
14193
+ assert(logger$4p, containers1[0] === containers2[0], "root container does not equal");
14194
14194
  let parentContainer = containers1[0];
14195
14195
  for (let i = 1; i < containers1.length || containers2.length; i++) {
14196
14196
  if (containers1[i] === containers2[i]) {
@@ -14209,23 +14209,23 @@ var __publicField = (obj, key, value) => {
14209
14209
  }
14210
14210
  function getParentContainerInComplexBlock(parentComplexBlock, element) {
14211
14211
  let block = getParentBlock(element);
14212
- assert(logger$4o, block, "element is not in a block");
14212
+ assert(logger$4p, block, "element is not in a block");
14213
14213
  while (block) {
14214
14214
  const container = getParentContainer(block);
14215
- assert(logger$4o, isChildContainer(container), "not a child container");
14215
+ assert(logger$4p, isChildContainer(container), "not a child container");
14216
14216
  const parentBlock = getParentBlock(container);
14217
- assert(logger$4o, parentBlock, "child container has not parent block");
14217
+ assert(logger$4p, parentBlock, "child container has not parent block");
14218
14218
  if (parentBlock === parentComplexBlock) {
14219
14219
  return container;
14220
14220
  }
14221
14221
  block = parentBlock;
14222
14222
  }
14223
- assert(logger$4o, false, "failed to find parent container in complex block");
14223
+ assert(logger$4p, false, "failed to find parent container in complex block");
14224
14224
  }
14225
14225
  function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
14226
14226
  const blockId = getBlockId(complexBlock);
14227
- assert(logger$4o, blockId === anchor2.blockId, "invalid start pos");
14228
- assert(logger$4o, blockId === focus.blockId, "invalid end pos");
14227
+ assert(logger$4p, blockId === anchor2.blockId, "invalid start pos");
14228
+ assert(logger$4p, blockId === focus.blockId, "invalid end pos");
14229
14229
  const blockClass = getComplexBlockClass(editor, complexBlock);
14230
14230
  if (blockClass.adjustSelectionPos) {
14231
14231
  return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
@@ -14259,8 +14259,8 @@ var __publicField = (obj, key, value) => {
14259
14259
  if (focus instanceof EditorComplexBlockPosition) {
14260
14260
  focus = createSimpleBlockPosition(focusBlock, getBlockTextLength$6(editor, focusBlock), "end");
14261
14261
  }
14262
- assert(logger$4o, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
14263
- assert(logger$4o, focus instanceof EditorSimpleBlockPosition, "not valid position type");
14262
+ assert(logger$4p, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
14263
+ assert(logger$4p, focus instanceof EditorSimpleBlockPosition, "not valid position type");
14264
14264
  return {
14265
14265
  anchor: anchor2,
14266
14266
  focus
@@ -14314,7 +14314,7 @@ var __publicField = (obj, key, value) => {
14314
14314
  focus
14315
14315
  };
14316
14316
  }
14317
- const logger$4n = getLogger("core");
14317
+ const logger$4o = getLogger("core");
14318
14318
  function createBlockAnchor(editor, block, id, refClientRect) {
14319
14319
  const tools = getBlockTools(block);
14320
14320
  let elem = tools.querySelector(`.block-anchor[data-id=${id}]`);
@@ -14332,7 +14332,7 @@ var __publicField = (obj, key, value) => {
14332
14332
  return elem;
14333
14333
  }
14334
14334
  function createBlockCaretAnchor(editor, block, offset, id) {
14335
- assert(logger$4n, isTextKindBlock(editor, block), "not a text kind block");
14335
+ assert(logger$4o, isTextKindBlock(editor, block), "not a text kind block");
14336
14336
  const caretRect = getTextCaretRect(block, createSimpleBlockPosition(block, offset, "normal"));
14337
14337
  const blockRect = block.getBoundingClientRect();
14338
14338
  const tools = getBlockTools(block);
@@ -14691,19 +14691,19 @@ var __publicField = (obj, key, value) => {
14691
14691
  return result + (index2 ? "-" : "") + word.toLowerCase();
14692
14692
  });
14693
14693
  const kebabCase$1 = kebabCase;
14694
- const logger$4m = getLogger("box");
14694
+ const logger$4n = getLogger("box");
14695
14695
  function isBoxOp(op) {
14696
14696
  if (!op.attributes)
14697
14697
  return false;
14698
14698
  if (!op.attributes.box)
14699
14699
  return false;
14700
- assert(logger$4m, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
14701
- assert(logger$4m, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
14700
+ assert(logger$4n, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
14701
+ assert(logger$4n, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
14702
14702
  return true;
14703
14703
  }
14704
- const logger$4l = getLogger("text-op");
14704
+ const logger$4m = getLogger("text-op");
14705
14705
  function getOpLength(op) {
14706
- assert(logger$4l, typeof op.insert === "string", "invalid op, no insert");
14706
+ assert(logger$4m, typeof op.insert === "string", "invalid op, no insert");
14707
14707
  return op.insert.length;
14708
14708
  }
14709
14709
  function getOpAt(text2, offset) {
@@ -14711,7 +14711,7 @@ var __publicField = (obj, key, value) => {
14711
14711
  let pos = 0;
14712
14712
  for (let i = 0; i < ops.length; i++) {
14713
14713
  const op = ops[i];
14714
- assert(logger$4l, typeof op.insert === "string", "invalid text op, no insert");
14714
+ assert(logger$4m, typeof op.insert === "string", "invalid text op, no insert");
14715
14715
  const end = pos + getOpLength(op);
14716
14716
  if (end > offset) {
14717
14717
  return [op];
@@ -14727,22 +14727,22 @@ var __publicField = (obj, key, value) => {
14727
14727
  }
14728
14728
  return [];
14729
14729
  }
14730
- const logger$4k = getLogger("rich-text-length");
14730
+ const logger$4l = getLogger("rich-text-length");
14731
14731
  function getTextOpLength(op) {
14732
- assert(logger$4k, typeof op.insert === "string", "op.insert is not string");
14732
+ assert(logger$4l, typeof op.insert === "string", "op.insert is not string");
14733
14733
  return op.insert.length;
14734
14734
  }
14735
14735
  function getTextLength(ops) {
14736
14736
  let count = 0;
14737
14737
  ops.forEach((op) => {
14738
14738
  if (op.insert) {
14739
- assert(logger$4k, typeof op.insert === "string", "op.insert is not string");
14739
+ assert(logger$4l, typeof op.insert === "string", "op.insert is not string");
14740
14740
  count += getTextOpLength(op);
14741
14741
  }
14742
14742
  });
14743
14743
  return count;
14744
14744
  }
14745
- const logger$4j = getLogger("split-text");
14745
+ const logger$4k = getLogger("split-text");
14746
14746
  function splitText(ops, offset, splitResult) {
14747
14747
  ops = cloneDeep__default.default(ops);
14748
14748
  if (offset === 0) {
@@ -14760,8 +14760,8 @@ var __publicField = (obj, key, value) => {
14760
14760
  let counted = 0;
14761
14761
  for (let i = 0; i < ops.length; i++) {
14762
14762
  const op = ops[i];
14763
- assert(logger$4j, typeof op === "object", `invalid op type, ${typeof op}`);
14764
- assert(logger$4j, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
14763
+ assert(logger$4k, typeof op === "object", `invalid op type, ${typeof op}`);
14764
+ assert(logger$4k, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
14765
14765
  const subLen = getTextOpLength(op);
14766
14766
  if (counted + subLen < offset) {
14767
14767
  counted += subLen;
@@ -14771,18 +14771,18 @@ var __publicField = (obj, key, value) => {
14771
14771
  right: ops.slice(i + 1)
14772
14772
  };
14773
14773
  } else {
14774
- assert(logger$4j, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
14774
+ assert(logger$4k, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
14775
14775
  const splitIndex = offset - counted;
14776
14776
  const copied = cloneDeep__default.default(op);
14777
- assert(logger$4j, copied.insert, "no copied.insert");
14778
- assert(logger$4j, typeof copied.insert === "string", "invalid copied.insert type");
14777
+ assert(logger$4k, copied.insert, "no copied.insert");
14778
+ assert(logger$4k, typeof copied.insert === "string", "invalid copied.insert type");
14779
14779
  copied.insert = copied.insert.substr(0, splitIndex);
14780
14780
  op.insert = op.insert.substr(splitIndex);
14781
14781
  if (copied.insert === "") {
14782
- assert(logger$4j, false, "invalid copied.insert, is empty string");
14782
+ assert(logger$4k, false, "invalid copied.insert, is empty string");
14783
14783
  }
14784
14784
  if (op.insert === "") {
14785
- assert(logger$4j, false, "invalid op.insert, is empty string");
14785
+ assert(logger$4k, false, "invalid op.insert, is empty string");
14786
14786
  }
14787
14787
  const right = [
14788
14788
  op,
@@ -14801,9 +14801,9 @@ var __publicField = (obj, key, value) => {
14801
14801
  throw new Error(`invalid split offset: ${offset}, ${JSON.stringify(ops)}`);
14802
14802
  }
14803
14803
  function splitToThree(text2, offset, length) {
14804
- assert(logger$4j, offset >= 0, "invalid offset, < 0");
14805
- assert(logger$4j, length > 0, "invalid length, <= 0");
14806
- assert(logger$4j, offset + length <= getTextLength(text2), "invalid offset + length < text length");
14804
+ assert(logger$4k, offset >= 0, "invalid offset, < 0");
14805
+ assert(logger$4k, length > 0, "invalid length, <= 0");
14806
+ assert(logger$4k, offset + length <= getTextLength(text2), "invalid offset + length < text length");
14807
14807
  const { left: temp, right } = splitText(text2, offset + length);
14808
14808
  const { left, right: middle } = splitText(temp, offset);
14809
14809
  return { left, middle, right };
@@ -15026,9 +15026,9 @@ var __publicField = (obj, key, value) => {
15026
15026
  }
15027
15027
  return [color, backgroundColor];
15028
15028
  }
15029
- const logger$4i = getLogger("text-block-content");
15029
+ const logger$4j = getLogger("text-block-content");
15030
15030
  function updateBlockContentCore(editor, blockPath, content, blockText, insertions) {
15031
- assert(logger$4i, blockText, "no text for block");
15031
+ assert(logger$4j, blockText, "no text for block");
15032
15032
  if (blockText.length === 0 && (!insertions || insertions.size === 0)) {
15033
15033
  content.innerHTML = "<span><br></span>";
15034
15034
  return;
@@ -15060,9 +15060,9 @@ var __publicField = (obj, key, value) => {
15060
15060
  for (let i2 = 0; i2 < text2.length; i2++) {
15061
15061
  const op = text2[i2];
15062
15062
  if (isBoxOp(op)) {
15063
- assert(logger$4i, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
15063
+ assert(logger$4j, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
15064
15064
  const span2 = editor.editorBoxes.createBox(content, op.attributes);
15065
- assert(logger$4i, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
15065
+ assert(logger$4j, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
15066
15066
  const ret = editor.editorBlockRenders.renderBox(blockPath, op.attributes);
15067
15067
  if (ret.classes) {
15068
15068
  addClass(span2, ...ret.classes);
@@ -15080,7 +15080,7 @@ var __publicField = (obj, key, value) => {
15080
15080
  fragment.appendChild(span2);
15081
15081
  continue;
15082
15082
  }
15083
- assert(logger$4i, op.insert, `no insert in op: ${JSON.stringify(op)}`);
15083
+ assert(logger$4j, op.insert, `no insert in op: ${JSON.stringify(op)}`);
15084
15084
  const span = createElement("span", ["text"], fragment, op.insert);
15085
15085
  if (op.attributes) {
15086
15086
  const ret = editor.editorBlockRenders.renderText(blockPath, op.attributes);
@@ -15111,7 +15111,7 @@ var __publicField = (obj, key, value) => {
15111
15111
  const compositionText = editor.compositingText;
15112
15112
  if (compositionText) {
15113
15113
  const pos = editor.selection.range.start;
15114
- assert(logger$4i, pos.isSimple(), "not an simple position while compositing");
15114
+ assert(logger$4j, pos.isSimple(), "not an simple position while compositing");
15115
15115
  if (pos.blockId === blockId) {
15116
15116
  const attributes = getAttributesAt(text2, 0);
15117
15117
  insertions.set(pos.offset, [{
@@ -15127,11 +15127,11 @@ var __publicField = (obj, key, value) => {
15127
15127
  function clearAllTempCompositionText(editor) {
15128
15128
  const children = editor.rootContainer.querySelectorAll('span[data-type="editor-insertion"].inputting-insertion');
15129
15129
  if (children.length) {
15130
- logger$4i.debug(`remove ${children.length} temp composition span`);
15130
+ logger$4j.debug(`remove ${children.length} temp composition span`);
15131
15131
  }
15132
15132
  Array.from(children).forEach((c) => c.remove());
15133
15133
  }
15134
- const logger$4h = getLogger("client-rects");
15134
+ const logger$4i = getLogger("client-rects");
15135
15135
  function getChildrenOffsets(block) {
15136
15136
  const children = getTextBlockContentChildren(block);
15137
15137
  let start = 0;
@@ -15149,15 +15149,15 @@ var __publicField = (obj, key, value) => {
15149
15149
  return ret;
15150
15150
  }
15151
15151
  function getChildrenInRange(editor, block, from, to) {
15152
- assert(logger$4h, from < to, `invalid from & to: ${from}, ${to}`);
15152
+ assert(logger$4i, from < to, `invalid from & to: ${from}, ${to}`);
15153
15153
  const blockLength = getBlockTextLength$6(editor, block);
15154
- assert(logger$4h, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
15154
+ assert(logger$4i, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
15155
15155
  const offsets = getChildrenOffsets(block);
15156
15156
  const startIndex = offsets.findIndex((c) => c.startBlockOffset <= from && from < c.endBlockOffset);
15157
15157
  const endIndex = offsets.findIndex((c) => c.startBlockOffset < to && to <= c.endBlockOffset);
15158
- assert(logger$4h, startIndex !== -1, "failed to find start child");
15159
- assert(logger$4h, endIndex !== -1, "failed to find end child");
15160
- assert(logger$4h, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
15158
+ assert(logger$4i, startIndex !== -1, "failed to find start child");
15159
+ assert(logger$4i, endIndex !== -1, "failed to find end child");
15160
+ assert(logger$4i, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
15161
15161
  if (startIndex === endIndex) {
15162
15162
  const child = offsets[startIndex];
15163
15163
  return [{
@@ -15239,16 +15239,16 @@ var __publicField = (obj, key, value) => {
15239
15239
  return rects;
15240
15240
  }
15241
15241
  function getRangeClientRects(editor, block, range) {
15242
- assert(logger$4h, range instanceof EditorSimpleSelectionRange, "invalid range");
15242
+ assert(logger$4i, range instanceof EditorSimpleSelectionRange, "invalid range");
15243
15243
  const start = range.start;
15244
15244
  const end = range.end;
15245
- assert(logger$4h, start.isSimple(), "text block only allow simple position");
15246
- assert(logger$4h, end.isSimple(), "text block only allow simple position");
15247
- assert(logger$4h, start.blockId === end.blockId, "only allow update one text block selection");
15248
- assert(logger$4h, start.blockId === getBlockId(block), "only allow update one text block selection");
15245
+ assert(logger$4i, start.isSimple(), "text block only allow simple position");
15246
+ assert(logger$4i, end.isSimple(), "text block only allow simple position");
15247
+ assert(logger$4i, start.blockId === end.blockId, "only allow update one text block selection");
15248
+ assert(logger$4i, start.blockId === getBlockId(block), "only allow update one text block selection");
15249
15249
  return getClientRects$2(editor, block, start, end);
15250
15250
  }
15251
- const logger$4g = getLogger("selection-background");
15251
+ const logger$4h = getLogger("selection-background");
15252
15252
  function getLineHeight(elem) {
15253
15253
  const style2 = window.getComputedStyle(elem);
15254
15254
  const lineHeightStyle = style2.getPropertyValue("line-height");
@@ -15268,9 +15268,9 @@ var __publicField = (obj, key, value) => {
15268
15268
  return lineHeight;
15269
15269
  }
15270
15270
  function updateSelection$4(editor, block, start, end) {
15271
- assert(logger$4g, start.isSimple(), "text block only allow simple position");
15272
- assert(logger$4g, end.isSimple(), "text block only allow simple position");
15273
- assert(logger$4g, start.blockId === end.blockId, "only allow update one text block selection");
15271
+ assert(logger$4h, start.isSimple(), "text block only allow simple position");
15272
+ assert(logger$4h, end.isSimple(), "text block only allow simple position");
15273
+ assert(logger$4h, start.blockId === end.blockId, "only allow update one text block selection");
15274
15274
  const from = start.offset;
15275
15275
  const to = end.offset;
15276
15276
  if (from === to) {
@@ -15329,7 +15329,7 @@ var __publicField = (obj, key, value) => {
15329
15329
  }
15330
15330
  });
15331
15331
  }
15332
- const logger$4f = getLogger("line-breaker");
15332
+ const logger$4g = getLogger("line-breaker");
15333
15333
  function mergeTextRects(rects) {
15334
15334
  const result = [];
15335
15335
  let lastRect = null;
@@ -15456,7 +15456,7 @@ var __publicField = (obj, key, value) => {
15456
15456
  }
15457
15457
  const textChild = child;
15458
15458
  const rects = mergeTextRects(textChild.getClientRects());
15459
- assert(logger$4f, rects.length > 0, "invalid text child dom");
15459
+ assert(logger$4g, rects.length > 0, "invalid text child dom");
15460
15460
  if (rects.length === 1) {
15461
15461
  const nextChild = children[i + 1];
15462
15462
  if (!nextChild) {
@@ -15481,10 +15481,10 @@ var __publicField = (obj, key, value) => {
15481
15481
  continue;
15482
15482
  }
15483
15483
  const textNode = textChild.firstChild;
15484
- assert(logger$4f, textNode, "invalid text child, no text node");
15485
- assert(logger$4f, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
15484
+ assert(logger$4g, textNode, "invalid text child, no text node");
15485
+ assert(logger$4g, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
15486
15486
  const textChildLength = getTextBlockContentChildTextLength(textChild);
15487
- assert(logger$4f, textNode.data.length === textChildLength, "text node data length not equal child text length");
15487
+ assert(logger$4g, textNode.data.length === textChildLength, "text node data length not equal child text length");
15488
15488
  const textRects = getTextRects(textNode);
15489
15489
  for (let rIndex = 0; rIndex < textRects.length - 1; rIndex++) {
15490
15490
  const rect = textRects[rIndex];
@@ -15526,7 +15526,7 @@ var __publicField = (obj, key, value) => {
15526
15526
  }
15527
15527
  }
15528
15528
  }
15529
- assert(logger$4f, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
15529
+ assert(logger$4g, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
15530
15530
  return {
15531
15531
  lineIndex: lineBreaks.length,
15532
15532
  lineBreaks
@@ -24299,7 +24299,7 @@ var __publicField = (obj, key, value) => {
24299
24299
  const Graphemer_1 = __importDefault(Graphemer$1);
24300
24300
  var _default = lib$1.default = Graphemer_1.default;
24301
24301
  const splitter = new _default();
24302
- const logger$4e = getLogger("text-offset");
24302
+ const logger$4f = getLogger("text-offset");
24303
24303
  function getChildOffset(block, child) {
24304
24304
  const children = getTextBlockContentChildren(block);
24305
24305
  let start = 0;
@@ -24315,26 +24315,26 @@ var __publicField = (obj, key, value) => {
24315
24315
  }
24316
24316
  start += testLength;
24317
24317
  }
24318
- assert(logger$4e, false, "can not find child in children");
24318
+ assert(logger$4f, false, "can not find child in children");
24319
24319
  }
24320
24320
  function isValidOffset(block, blockOffset) {
24321
- assert(logger$4e, blockOffset >= 0, `invalid offset: ${blockOffset}`);
24321
+ assert(logger$4f, blockOffset >= 0, `invalid offset: ${blockOffset}`);
24322
24322
  const childInfo = getTextBlockChild(block, blockOffset);
24323
24323
  const { prev, next: next2, offset } = childInfo;
24324
24324
  if (!prev && !next2) {
24325
- assert(logger$4e, false, "invalid offset, no prev & next child at offset");
24325
+ assert(logger$4f, false, "invalid offset, no prev & next child at offset");
24326
24326
  }
24327
24327
  if (prev !== next2) {
24328
24328
  return true;
24329
24329
  }
24330
24330
  const child = prev;
24331
- assert(logger$4e, child, "no child");
24331
+ assert(logger$4f, child, "no child");
24332
24332
  if (isTextBlockContentBoxChild(child)) {
24333
- assert(logger$4e, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
24333
+ assert(logger$4f, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
24334
24334
  return true;
24335
24335
  }
24336
24336
  const text2 = child.textContent;
24337
- assert(logger$4e, text2, "no content for text child");
24337
+ assert(logger$4f, text2, "no content for text child");
24338
24338
  const chars = splitter.splitGraphemes(text2);
24339
24339
  const validOffsets = /* @__PURE__ */ new Set();
24340
24340
  let start = 0;
@@ -24364,7 +24364,7 @@ var __publicField = (obj, key, value) => {
24364
24364
  }
24365
24365
  function getNextValidOffset(block, blockOffset) {
24366
24366
  const length = getTextBlockLength(block);
24367
- assert(logger$4e, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
24367
+ assert(logger$4f, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
24368
24368
  if (blockOffset === length) {
24369
24369
  return length;
24370
24370
  }
@@ -24378,7 +24378,7 @@ var __publicField = (obj, key, value) => {
24378
24378
  }
24379
24379
  return ret;
24380
24380
  }
24381
- const logger$4d = getLogger("line-offset");
24381
+ const logger$4e = getLogger("line-offset");
24382
24382
  function getLineOffsets(block) {
24383
24383
  const lineBreaks = getLineBreaks(block);
24384
24384
  const ret = [];
@@ -24399,7 +24399,7 @@ var __publicField = (obj, key, value) => {
24399
24399
  }
24400
24400
  function getLineOffset(block, lineIndex) {
24401
24401
  const lines = getLineOffsets(block);
24402
- assert(logger$4d, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
24402
+ assert(logger$4e, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
24403
24403
  return lines[lineIndex];
24404
24404
  }
24405
24405
  function getLineOffsetByPos(block, pos) {
@@ -24456,7 +24456,7 @@ var __publicField = (obj, key, value) => {
24456
24456
  function getLineCount(block) {
24457
24457
  return getLineOffsets(block).length;
24458
24458
  }
24459
- const logger$4c = getLogger("find-text-position");
24459
+ const logger$4d = getLogger("find-text-position");
24460
24460
  function isWrappedLine(block, lineIndex) {
24461
24461
  const { start, end } = getLineOffset(block, lineIndex);
24462
24462
  const blockId = getBlockId(block);
@@ -24467,13 +24467,13 @@ var __publicField = (obj, key, value) => {
24467
24467
  return false;
24468
24468
  }
24469
24469
  const childInfo = getTextBlockChild(block, start);
24470
- assert(logger$4c, childInfo.next, "no next child at offset");
24471
- assert(logger$4c, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
24470
+ assert(logger$4d, childInfo.next, "no next child at offset");
24471
+ assert(logger$4d, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
24472
24472
  return true;
24473
24473
  }
24474
24474
  function getWrappedLineOffsets(block, lineIndex) {
24475
24475
  const blockId = getBlockId(block);
24476
- assert(logger$4c, isWrappedLine(block, lineIndex), "line is not wrapped");
24476
+ assert(logger$4d, isWrappedLine(block, lineIndex), "line is not wrapped");
24477
24477
  const { start, end } = getLineOffset(block, lineIndex);
24478
24478
  const homePos = createSimpleBlockPosition(blockId, start, "home");
24479
24479
  for (let offset = start + 1; offset <= end; offset += 1) {
@@ -24488,11 +24488,11 @@ var __publicField = (obj, key, value) => {
24488
24488
  return offset - 1;
24489
24489
  }
24490
24490
  }
24491
- assert(logger$4c, false, "failed to find wrapped offset");
24491
+ assert(logger$4d, false, "failed to find wrapped offset");
24492
24492
  return 0;
24493
24493
  }
24494
24494
  function findTextPositionInLine(editor, block, lineIndex, sourceBlock, pos, findDirection, suggestedX) {
24495
- assert(logger$4c, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
24495
+ assert(logger$4d, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
24496
24496
  const { start, end } = getLineOffset(block, lineIndex);
24497
24497
  let from = start;
24498
24498
  const blockId = getBlockId(block);
@@ -24534,11 +24534,11 @@ var __publicField = (obj, key, value) => {
24534
24534
  return retPos;
24535
24535
  }
24536
24536
  function findPrevTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
24537
- assert(logger$4c, isTextKindBlock(editor, block), "not a text block");
24537
+ assert(logger$4d, isTextKindBlock(editor, block), "not a text block");
24538
24538
  return findTextPositionInLine(editor, block, getLineCount(block) - 1, sourceBlock, pos, "up", suggestedX);
24539
24539
  }
24540
24540
  function findNextTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
24541
- assert(logger$4c, isTextKindBlock(editor, block), "not a text block");
24541
+ assert(logger$4d, isTextKindBlock(editor, block), "not a text block");
24542
24542
  return findTextPositionInLine(editor, block, 0, sourceBlock, pos, "down", suggestedX);
24543
24543
  }
24544
24544
  function moveDown(editor, block, position, suggestedX) {
@@ -24646,7 +24646,7 @@ var __publicField = (obj, key, value) => {
24646
24646
  }
24647
24647
  return pos;
24648
24648
  }
24649
- const logger$4b = getLogger("move-caret");
24649
+ const logger$4c = getLogger("move-caret");
24650
24650
  function moveTextCaret(editor, block, position, direction) {
24651
24651
  if (direction === "ArrowLeft") {
24652
24652
  const ret = moveLeft(block, position);
@@ -24676,9 +24676,9 @@ var __publicField = (obj, key, value) => {
24676
24676
  }
24677
24677
  return createSimpleBlockPosition(getBlockId(block), ret.offset, ret.type);
24678
24678
  }
24679
- assert(logger$4b, false, `invalid navigation direction: ${direction}`);
24679
+ assert(logger$4c, false, `invalid navigation direction: ${direction}`);
24680
24680
  }
24681
- const logger$4a = getLogger("text-range");
24681
+ const logger$4b = getLogger("text-range");
24682
24682
  function getBlockRects(block) {
24683
24683
  const ret = [];
24684
24684
  const children = getTextBlockContentChildren(block);
@@ -24736,9 +24736,9 @@ var __publicField = (obj, key, value) => {
24736
24736
  return null;
24737
24737
  }
24738
24738
  const children = getTextBlockContentChildren(block);
24739
- assert(logger$4a, children.indexOf(child) !== -1, "failed to find child in children");
24739
+ assert(logger$4b, children.indexOf(child) !== -1, "failed to find child in children");
24740
24740
  const offsetInfo = getChildOffset(block, child);
24741
- assert(logger$4a, offsetInfo, "failed to get child offset");
24741
+ assert(logger$4b, offsetInfo, "failed to get child offset");
24742
24742
  const { start } = offsetInfo;
24743
24743
  let offset;
24744
24744
  let length;
@@ -24754,7 +24754,7 @@ var __publicField = (obj, key, value) => {
24754
24754
  }
24755
24755
  length = 0;
24756
24756
  } else {
24757
- assert(logger$4a, child.firstChild instanceof Text, "child is not text");
24757
+ assert(logger$4b, child.firstChild instanceof Text, "child is not text");
24758
24758
  offset = start + textNodeOffsetFromPoint(child.firstChild, x, y);
24759
24759
  length = 0;
24760
24760
  }
@@ -24787,9 +24787,9 @@ var __publicField = (obj, key, value) => {
24787
24787
  }
24788
24788
  return versions;
24789
24789
  }
24790
- const logger$49 = getLogger("create-text-op");
24790
+ const logger$4a = getLogger("create-text-op");
24791
24791
  function createTextOp(text2, attributes) {
24792
- assert(logger$49, text2, "text is empty");
24792
+ assert(logger$4a, text2, "text is empty");
24793
24793
  const ret = {
24794
24794
  insert: text2
24795
24795
  };
@@ -24812,7 +24812,7 @@ var __publicField = (obj, key, value) => {
24812
24812
  }
24813
24813
  return result;
24814
24814
  }
24815
- const logger$48 = getLogger("merge-ops");
24815
+ const logger$49 = getLogger("merge-ops");
24816
24816
  function mergeOps(text2) {
24817
24817
  if (text2.length <= 1) {
24818
24818
  return text2;
@@ -24834,10 +24834,10 @@ var __publicField = (obj, key, value) => {
24834
24834
  return false;
24835
24835
  }
24836
24836
  if (op1.attributes === void 0) {
24837
- assert(logger$48, op2.attributes === void 0, "op2.attributes is not undefined");
24837
+ assert(logger$49, op2.attributes === void 0, "op2.attributes is not undefined");
24838
24838
  return true;
24839
24839
  }
24840
- assert(logger$48, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
24840
+ assert(logger$49, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
24841
24841
  return isEqual__default.default(op1.attributes, op2.attributes);
24842
24842
  };
24843
24843
  const newOps = [];
@@ -24846,8 +24846,8 @@ var __publicField = (obj, key, value) => {
24846
24846
  for (let i = 1; i < text2.length; i += 1) {
24847
24847
  const op = text2[i];
24848
24848
  if (isSameTypeOp(before, op)) {
24849
- assert(logger$48, typeof before.insert === "string", "before.insert is not string");
24850
- assert(logger$48, typeof op.insert === "string", "op.insert is not string");
24849
+ assert(logger$49, typeof before.insert === "string", "before.insert is not string");
24850
+ assert(logger$49, typeof op.insert === "string", "op.insert is not string");
24851
24851
  before.insert += op.insert;
24852
24852
  } else {
24853
24853
  newOps.push(op);
@@ -24875,15 +24875,15 @@ var __publicField = (obj, key, value) => {
24875
24875
  }
24876
24876
  return text2.slice(0, i + 1);
24877
24877
  }
24878
- const logger$47 = getLogger("delete-text");
24878
+ const logger$48 = getLogger("delete-text");
24879
24879
  function deleteText(richText2, offset, count) {
24880
24880
  const { left, right } = splitToThree(richText2, offset, count);
24881
24881
  const result = [...left, ...right];
24882
24882
  return mergeOps(result);
24883
24883
  }
24884
24884
  function createDeleteOps(offset, count) {
24885
- assert(logger$47, offset >= 0, `invalid offset: ${offset}`);
24886
- assert(logger$47, count >= 1, `invalid delete count: ${count}`);
24885
+ assert(logger$48, offset >= 0, `invalid offset: ${offset}`);
24886
+ assert(logger$48, count >= 1, `invalid delete count: ${count}`);
24887
24887
  const ops = [];
24888
24888
  if (offset !== 0) {
24889
24889
  ops.push({
@@ -24895,7 +24895,7 @@ var __publicField = (obj, key, value) => {
24895
24895
  });
24896
24896
  return ops;
24897
24897
  }
24898
- const logger$46 = getLogger("delta");
24898
+ const logger$47 = getLogger("delta");
24899
24899
  function diffRichText(oldText, newText) {
24900
24900
  const delta1D = new Delta__default.default(oldText);
24901
24901
  const delta2D = new Delta__default.default(newText);
@@ -24905,7 +24905,7 @@ var __publicField = (obj, key, value) => {
24905
24905
  return new Delta__default.default(ops).transformPosition(cursor, !isLocalOp);
24906
24906
  }
24907
24907
  function isValidDocText(text2) {
24908
- assert(logger$46, text2, "ops is null or undefined");
24908
+ assert(logger$47, text2, "ops is null or undefined");
24909
24909
  for (let i = 0; i < text2.length; i++) {
24910
24910
  const op = text2[i];
24911
24911
  if (op.insert === null || op.insert === void 0) {
@@ -24925,7 +24925,7 @@ var __publicField = (obj, key, value) => {
24925
24925
  }
24926
24926
  class RichText {
24927
24927
  static ensureValidText(text2) {
24928
- assert(logger$46, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
24928
+ assert(logger$47, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
24929
24929
  }
24930
24930
  static diff(oldText, newText) {
24931
24931
  this.ensureValidText(oldText);
@@ -24947,9 +24947,9 @@ var __publicField = (obj, key, value) => {
24947
24947
  return resultText;
24948
24948
  }
24949
24949
  }
24950
- const logger$45 = getLogger("insert-text");
24950
+ const logger$46 = getLogger("insert-text");
24951
24951
  function insertText(richText2, offset, text2, attributes) {
24952
- assert(logger$45, text2, `invalid text to insert: ${text2}`);
24952
+ assert(logger$46, text2, `invalid text to insert: ${text2}`);
24953
24953
  const { left, right } = splitText(richText2, offset);
24954
24954
  const insertedText = typeof text2 === "string" ? [createTextOp(text2, attributes)] : text2;
24955
24955
  const result = [...left, ...insertedText, ...right];
@@ -24962,7 +24962,7 @@ var __publicField = (obj, key, value) => {
24962
24962
  };
24963
24963
  }
24964
24964
  function createInsertOps(offset, text2, attributes) {
24965
- assert(logger$45, offset >= 0, `invalid offset: ${offset}`);
24965
+ assert(logger$46, offset >= 0, `invalid offset: ${offset}`);
24966
24966
  if (text2.length === 0) {
24967
24967
  return [];
24968
24968
  }
@@ -24992,7 +24992,7 @@ var __publicField = (obj, key, value) => {
24992
24992
  function cloneText(text2) {
24993
24993
  return cloneDeep__default.default(text2);
24994
24994
  }
24995
- const logger$44 = getLogger("update-op-attribute");
24995
+ const logger$45 = getLogger("update-op-attribute");
24996
24996
  function updateOpAttributes(orgOps, key, value, newAttributes) {
24997
24997
  const ops = cloneText(orgOps);
24998
24998
  const index2 = ops.findIndex((op2) => {
@@ -25000,7 +25000,7 @@ var __publicField = (obj, key, value) => {
25000
25000
  return false;
25001
25001
  return op2.attributes[key] === value;
25002
25002
  });
25003
- assert(logger$44, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
25003
+ assert(logger$45, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
25004
25004
  const op = ops[index2];
25005
25005
  op.attributes = {
25006
25006
  ...op.attributes,
@@ -25075,11 +25075,11 @@ var __publicField = (obj, key, value) => {
25075
25075
  ]);
25076
25076
  }
25077
25077
  const FILL_CHAR = "\u200B";
25078
- const logger$43 = getLogger("to-plain-text");
25078
+ const logger$44 = getLogger("to-plain-text");
25079
25079
  function toPlainText(ops, options) {
25080
25080
  let text2 = "";
25081
25081
  ops.forEach((op) => {
25082
- assert(logger$43, typeof op.insert === "string", "invalid op");
25082
+ assert(logger$44, typeof op.insert === "string", "invalid op");
25083
25083
  if (op.attributes && op.attributes.box === true) {
25084
25084
  if (options == null ? void 0 : options.boxReplacement) {
25085
25085
  text2 += options.boxReplacement;
@@ -25134,6 +25134,91 @@ var __publicField = (obj, key, value) => {
25134
25134
  focus: pos
25135
25135
  };
25136
25136
  }
25137
+ const logger$43 = getLogger("repair-duplicated-block-ids");
25138
+ const ROOT_CONTAINER_ID = "root";
25139
+ function buildChildContainersDelta(doc2, block) {
25140
+ const children = block.children;
25141
+ if (!Array.isArray(children) || children.length === 0) {
25142
+ return null;
25143
+ }
25144
+ const idMap = /* @__PURE__ */ new Map();
25145
+ const newContainers = [];
25146
+ children.forEach((oldChildId) => {
25147
+ const newChildId = genId();
25148
+ idMap.set(oldChildId, newChildId);
25149
+ const childBlocks = doc2.findContainerBlocks(oldChildId);
25150
+ newContainers.push({
25151
+ containerId: newChildId,
25152
+ blocks: childBlocks ? cloneDeep__default.default(childBlocks) : []
25153
+ });
25154
+ });
25155
+ doc2.localInsertChildContainers(newContainers);
25156
+ const insert = {
25157
+ children: children.map((oldChildId) => idMap.get(oldChildId))
25158
+ };
25159
+ const remove2 = ["children"];
25160
+ Object.keys(block).forEach((key) => {
25161
+ const oldChildId = children.find((childId) => key.startsWith(`${childId}_`));
25162
+ if (!oldChildId)
25163
+ return;
25164
+ const newChildId = idMap.get(oldChildId);
25165
+ insert[newChildId + key.substr(oldChildId.length)] = block[key];
25166
+ remove2.push(key);
25167
+ });
25168
+ return { insert, delete: remove2 };
25169
+ }
25170
+ function repairDuplicatedBlockIds(doc2, readonly) {
25171
+ const seenBlockIds = /* @__PURE__ */ new Set();
25172
+ const visitedContainers = /* @__PURE__ */ new Set();
25173
+ const duplicatedIds = [];
25174
+ let repaired = 0;
25175
+ const visitContainer = (containerId) => {
25176
+ var _a, _b;
25177
+ if (visitedContainers.has(containerId))
25178
+ return;
25179
+ visitedContainers.add(containerId);
25180
+ const blocks = doc2.findContainerBlocks(containerId);
25181
+ if (!blocks)
25182
+ return;
25183
+ const blockCount = blocks.length;
25184
+ for (let blockIndex = 0; blockIndex < blockCount; blockIndex += 1) {
25185
+ let block = doc2.getBlockData(containerId, blockIndex);
25186
+ if (seenBlockIds.has(block.id)) {
25187
+ duplicatedIds.push(block.id);
25188
+ if (readonly) {
25189
+ logger$43.warn(`duplicated block id ${block.id} at ${containerId}[${blockIndex}], readonly, skip repairing`);
25190
+ } else {
25191
+ const newId = genId();
25192
+ logger$43.warn(`repair duplicated block id ${block.id} -> ${newId} at ${containerId}[${blockIndex}]`);
25193
+ const childDelta = buildChildContainersDelta(doc2, block);
25194
+ doc2.localUpdateBlockData(
25195
+ containerId,
25196
+ blockIndex,
25197
+ {
25198
+ insert: { id: newId, ...(_a = childDelta == null ? void 0 : childDelta.insert) != null ? _a : {} },
25199
+ delete: ["id", ...(_b = childDelta == null ? void 0 : childDelta.delete) != null ? _b : []]
25200
+ },
25201
+ createBlockSimpleDocRange(newId, 0)
25202
+ );
25203
+ repaired += 1;
25204
+ block = doc2.getBlockData(containerId, blockIndex);
25205
+ }
25206
+ }
25207
+ seenBlockIds.add(block.id);
25208
+ const children = block.children;
25209
+ if (Array.isArray(children)) {
25210
+ children.forEach(visitContainer);
25211
+ }
25212
+ }
25213
+ };
25214
+ visitContainer(ROOT_CONTAINER_ID);
25215
+ if (duplicatedIds.length > 0) {
25216
+ logger$43.error(
25217
+ `found ${duplicatedIds.length} duplicated block id(s): ${duplicatedIds.join(", ")}, repaired ${repaired}`
25218
+ );
25219
+ }
25220
+ return { repaired, duplicatedIds };
25221
+ }
25137
25222
  const logger$42 = getLogger("block-to-text");
25138
25223
  function textBlockToText$1(editor, ops, doc2) {
25139
25224
  let text2 = "";
@@ -32202,6 +32287,7 @@ ${codeText}
32202
32287
  this.id = (_l = optionalOptions == null ? void 0 : optionalOptions.id) != null ? _l : genId();
32203
32288
  this.clientId = genId();
32204
32289
  this.undoManager = new UndoManager(this);
32290
+ repairDuplicatedBlockIds(doc2, this._readonly);
32205
32291
  this.doc = new EditorDoc(this, doc2, this.undoManager);
32206
32292
  this.parent = parent;
32207
32293
  this.rootElement = createElement("div", ["editor-root"], this.parent);
@@ -97111,7 +97197,7 @@ ${JSON.stringify(error2, null, 2)}`);
97111
97197
  }
97112
97198
  }
97113
97199
  });
97114
- editor.version = "3.1.4-beta.h1447.2";
97200
+ editor.version = "3.1.4";
97115
97201
  return editor;
97116
97202
  }
97117
97203
  function isDoc(doc2) {
@@ -97252,7 +97338,7 @@ ${JSON.stringify(error2, null, 2)}`);
97252
97338
  OnesEditorDropTarget.register(editor);
97253
97339
  OnesEditorTocProvider.register(editor);
97254
97340
  OnesEditorExclusiveBlock.register(editor);
97255
- editor.version = "3.1.4-beta.h1447.2";
97341
+ editor.version = "3.1.4";
97256
97342
  return editor;
97257
97343
  } catch (error2) {
97258
97344
  if (editorForCleanup) {
@@ -143800,7 +143886,7 @@ ${JSON.stringify(error2, null, 2)}`);
143800
143886
  exports2.loadJs = loadJs;
143801
143887
  exports2.loadJsPromise = loadJsPromise;
143802
143888
  exports2.lockers = lockers;
143803
- exports2.logger = logger$4t;
143889
+ exports2.logger = logger$4u;
143804
143890
  exports2.markdownToDoc = markdownToDoc;
143805
143891
  exports2.mergeCommands = mergeCommands;
143806
143892
  exports2.mergeDocs = mergeDocs;
@@ -143822,6 +143908,7 @@ ${JSON.stringify(error2, null, 2)}`);
143822
143908
  exports2.removeLastBr = removeLastBr;
143823
143909
  exports2.removePlaceholderFromBlock = removePlaceholderFromBlock;
143824
143910
  exports2.removeStyle = removeStyle;
143911
+ exports2.repairDuplicatedBlockIds = repairDuplicatedBlockIds;
143825
143912
  exports2.replaceAll = replaceAll$1;
143826
143913
  exports2.replaceAllCaseInsensitive = replaceAllCaseInsensitive;
143827
143914
  exports2.replaceAllText = replaceAllText;