@harbour-enterprises/superdoc 0.12.36 → 0.12.37-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/chunks/{eventemitter3-Dq2TEegt.es.js → eventemitter3-BrspJk8q.es.js} +1 -1
  2. package/dist/chunks/{eventemitter3-DuScojUH.cjs → eventemitter3-DfVviFzP.cjs} +1 -1
  3. package/dist/chunks/{index-CMBtuT02.cjs → index-B4J7wgs6.cjs} +2 -2
  4. package/dist/chunks/{index-B1MhwjTC.cjs → index-Cdsq63Xq.cjs} +4 -4
  5. package/dist/chunks/{index-SKpROzLW.es.js → index-Diu6UKHt.es.js} +4 -4
  6. package/dist/chunks/{index-BrSjd1Id.es.js → index-Hr3Um-Bg.es.js} +2 -2
  7. package/dist/chunks/{jszip-Bwu_om3F.cjs → jszip-BTAcmbVg.cjs} +1 -1
  8. package/dist/chunks/{jszip-BmWWPxfF.es.js → jszip-DckFs3A7.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-BtKVLpiq.es.js → super-editor.es-DYzhjqc5.es.js} +1767 -278
  10. package/dist/chunks/{super-editor.es-akFFn4Ld.cjs → super-editor.es-DmBtUqwe.cjs} +1767 -278
  11. package/dist/chunks/{url-DuggQ5JR.cjs → url-BIzg4y2i.cjs} +2 -2
  12. package/dist/chunks/{url-CAZQTNP3.es.js → url-CHayXMZH.es.js} +2 -2
  13. package/dist/chunks/{vue-IIIZMHTg.es.js → vue-Bi1uWinj.es.js} +17 -11
  14. package/dist/chunks/{vue-DPZkajuO.cjs → vue-HIY1g7dm.cjs} +17 -11
  15. package/dist/chunks/{xml-js-B7Vccv2s.cjs → xml-js-BjqmFOSP.cjs} +2 -2
  16. package/dist/chunks/{xml-js-BV-kCPOA.es.js → xml-js-CfClL-1b.es.js} +2 -2
  17. package/dist/core/SuperDoc.d.ts +0 -6
  18. package/dist/core/SuperDoc.d.ts.map +1 -1
  19. package/dist/core/collaboration/collaboration.d.ts +0 -9
  20. package/dist/core/collaboration/collaboration.d.ts.map +1 -1
  21. package/dist/core/collaboration/helpers.d.ts.map +1 -1
  22. package/dist/style.css +36 -7
  23. package/dist/super-editor/ai-writer.es.js +2 -2
  24. package/dist/super-editor/chunks/{converter-BSl_E2ED.js → converter-ffnCghzo.js} +109 -10
  25. package/dist/super-editor/chunks/{docx-zipper-USmuqzmo.js → docx-zipper-BvIz98Bh.js} +1 -1
  26. package/dist/super-editor/chunks/{editor-C0hNf44Q.js → editor-BCC23g3q.js} +1687 -297
  27. package/dist/super-editor/chunks/{toolbar-IN0IJC2L.js → toolbar-BZxPbO0T.js} +2 -2
  28. package/dist/super-editor/components/pagination-helpers.d.ts.map +1 -1
  29. package/dist/super-editor/converter.es.js +1 -1
  30. package/dist/super-editor/core/Attribute.d.ts +2 -2
  31. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  32. package/dist/super-editor/core/InputRule.d.ts +7 -0
  33. package/dist/super-editor/core/InputRule.d.ts.map +1 -1
  34. package/dist/super-editor/core/Schema.d.ts +2 -2
  35. package/dist/super-editor/core/helpers/findWordBounds.d.ts +5 -0
  36. package/dist/super-editor/core/helpers/findWordBounds.d.ts.map +1 -0
  37. package/dist/super-editor/core/helpers/setWordSelection.d.ts +2 -0
  38. package/dist/super-editor/core/helpers/setWordSelection.d.ts.map +1 -0
  39. package/dist/super-editor/core/inputRules/docx-paste/docx-paste.d.ts.map +1 -1
  40. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  41. package/dist/super-editor/core/super-converter/v2/importer/autoPageNumberImporter.d.ts.map +1 -1
  42. package/dist/super-editor/core/super-converter/v2/importer/listImporter.d.ts.map +1 -1
  43. package/dist/super-editor/docx-zipper.es.js +2 -2
  44. package/dist/super-editor/editor.es.js +3 -3
  45. package/dist/super-editor/extensions/field-annotation/FieldAnnotationView.d.ts.map +1 -1
  46. package/dist/super-editor/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  47. package/dist/super-editor/extensions/page-number/page-number.d.ts +10 -0
  48. package/dist/super-editor/extensions/page-number/page-number.d.ts.map +1 -1
  49. package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts +2 -1
  50. package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts.map +1 -1
  51. package/dist/super-editor/extensions/pagination/pagination.d.ts.map +1 -1
  52. package/dist/super-editor/file-zipper.es.js +1 -1
  53. package/dist/super-editor/style.css +36 -7
  54. package/dist/super-editor/super-editor.es.js +7 -7
  55. package/dist/super-editor/toolbar.es.js +2 -2
  56. package/dist/super-editor.cjs +2 -2
  57. package/dist/super-editor.es.js +2 -2
  58. package/dist/superdoc.cjs +1587 -366
  59. package/dist/superdoc.es.js +1572 -367
  60. package/dist/superdoc.umd.js +3325 -630
  61. package/dist/superdoc.umd.js.map +1 -1
  62. package/package.json +3 -2
@@ -1,6 +1,6 @@
1
1
  import * as Y from "yjs";
2
2
  import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
3
- import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted } from "./vue-IIIZMHTg.es.js";
3
+ import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted } from "./vue-Bi1uWinj.es.js";
4
4
  var __defProp$2 = Object.defineProperty;
5
5
  var __typeError$2 = (msg2) => {
6
6
  throw TypeError(msg2);
@@ -2556,29 +2556,29 @@ function requireAbs() {
2556
2556
  abs$1 = Math.abs;
2557
2557
  return abs$1;
2558
2558
  }
2559
- var floor$1;
2559
+ var floor$2;
2560
2560
  var hasRequiredFloor;
2561
2561
  function requireFloor() {
2562
- if (hasRequiredFloor) return floor$1;
2562
+ if (hasRequiredFloor) return floor$2;
2563
2563
  hasRequiredFloor = 1;
2564
- floor$1 = Math.floor;
2565
- return floor$1;
2564
+ floor$2 = Math.floor;
2565
+ return floor$2;
2566
2566
  }
2567
- var max$2;
2567
+ var max$3;
2568
2568
  var hasRequiredMax;
2569
2569
  function requireMax() {
2570
- if (hasRequiredMax) return max$2;
2570
+ if (hasRequiredMax) return max$3;
2571
2571
  hasRequiredMax = 1;
2572
- max$2 = Math.max;
2573
- return max$2;
2572
+ max$3 = Math.max;
2573
+ return max$3;
2574
2574
  }
2575
- var min$2;
2575
+ var min$3;
2576
2576
  var hasRequiredMin;
2577
2577
  function requireMin() {
2578
- if (hasRequiredMin) return min$2;
2578
+ if (hasRequiredMin) return min$3;
2579
2579
  hasRequiredMin = 1;
2580
- min$2 = Math.min;
2581
- return min$2;
2580
+ min$3 = Math.min;
2581
+ return min$3;
2582
2582
  }
2583
2583
  var pow;
2584
2584
  var hasRequiredPow;
@@ -2588,13 +2588,13 @@ function requirePow() {
2588
2588
  pow = Math.pow;
2589
2589
  return pow;
2590
2590
  }
2591
- var round$1;
2591
+ var round$2;
2592
2592
  var hasRequiredRound;
2593
2593
  function requireRound() {
2594
- if (hasRequiredRound) return round$1;
2594
+ if (hasRequiredRound) return round$2;
2595
2595
  hasRequiredRound = 1;
2596
- round$1 = Math.round;
2597
- return round$1;
2596
+ round$2 = Math.round;
2597
+ return round$2;
2598
2598
  }
2599
2599
  var _isNaN;
2600
2600
  var hasRequired_isNaN;
@@ -12419,7 +12419,7 @@ const OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;
12419
12419
  function wsOptionsFor(type2, preserveWhitespace, base2) {
12420
12420
  if (preserveWhitespace != null)
12421
12421
  return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0);
12422
- return type2 && type2.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & -5;
12422
+ return type2 && type2.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & ~OPT_OPEN_LEFT;
12423
12423
  }
12424
12424
  class NodeContext {
12425
12425
  constructor(type2, attrs, marks, solid, match, options2) {
@@ -15390,7 +15390,7 @@ class Transaction extends Transform {
15390
15390
  throw new RangeError("Selection passed to setSelection must point at the current document");
15391
15391
  this.curSelection = selection;
15392
15392
  this.curSelectionFor = this.steps.length;
15393
- this.updated = (this.updated | UPDATED_SEL) & -3;
15393
+ this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;
15394
15394
  this.storedMarks = null;
15395
15395
  return this;
15396
15396
  }
@@ -15441,7 +15441,7 @@ class Transaction extends Transform {
15441
15441
  */
15442
15442
  addStep(step, doc2) {
15443
15443
  super.addStep(step, doc2);
15444
- this.updated = this.updated & -3;
15444
+ this.updated = this.updated & ~UPDATED_MARKS;
15445
15445
  this.storedMarks = null;
15446
15446
  }
15447
15447
  /**
@@ -18845,7 +18845,9 @@ function exportSchemaToJson(params2) {
18845
18845
  shapeContainer: translateShapeContainer,
18846
18846
  shapeTextbox: translateShapeTextbox,
18847
18847
  contentBlock: translateContentBlock,
18848
- structuredContent: translateStructuredContent
18848
+ structuredContent: translateStructuredContent,
18849
+ "page-number": translatePageNumberNode,
18850
+ "total-page-number": translateTotalPageNumberNode
18849
18851
  };
18850
18852
  if (!router[type2]) {
18851
18853
  console.error("No translation function found for node type:", type2);
@@ -20542,6 +20544,81 @@ function translateStructuredContent(params2) {
20542
20544
  elements: nodeElements
20543
20545
  };
20544
20546
  }
20547
+ const translatePageNumberNode = (params2) => {
20548
+ const outputMarks = processOutputMarks(params2.node.attrs?.marksAsAttrs || []);
20549
+ return getAutoPageJson("PAGE", outputMarks);
20550
+ };
20551
+ const translateTotalPageNumberNode = (params2) => {
20552
+ const outputMarks = processOutputMarks(params2.node.attrs?.marksAsAttrs || []);
20553
+ return getAutoPageJson("NUMPAGES", outputMarks);
20554
+ };
20555
+ const getAutoPageJson = (type2, outputMarks = []) => {
20556
+ return [
20557
+ {
20558
+ "name": "w:r",
20559
+ "elements": [
20560
+ {
20561
+ "name": "w:rPr",
20562
+ "elements": outputMarks
20563
+ },
20564
+ {
20565
+ "name": "w:fldChar",
20566
+ "attributes": {
20567
+ "w:fldCharType": "begin"
20568
+ }
20569
+ }
20570
+ ]
20571
+ },
20572
+ {
20573
+ "name": "w:r",
20574
+ "elements": [
20575
+ {
20576
+ "name": "w:rPr",
20577
+ "elements": outputMarks
20578
+ },
20579
+ {
20580
+ "name": "w:instrText",
20581
+ "elements": [
20582
+ {
20583
+ "type": "text",
20584
+ "text": ` ${type2}`
20585
+ }
20586
+ ]
20587
+ }
20588
+ ]
20589
+ },
20590
+ {
20591
+ "name": "w:r",
20592
+ "elements": [
20593
+ {
20594
+ "name": "w:rPr",
20595
+ "elements": outputMarks
20596
+ },
20597
+ {
20598
+ "name": "w:fldChar",
20599
+ "attributes": {
20600
+ "w:fldCharType": "separate"
20601
+ }
20602
+ }
20603
+ ]
20604
+ },
20605
+ {
20606
+ "name": "w:r",
20607
+ "elements": [
20608
+ {
20609
+ "name": "w:rPr",
20610
+ "elements": outputMarks
20611
+ },
20612
+ {
20613
+ "name": "w:fldChar",
20614
+ "attributes": {
20615
+ "w:fldCharType": "end"
20616
+ }
20617
+ }
20618
+ ]
20619
+ }
20620
+ ];
20621
+ };
20545
20622
  const defaultInitialXml = `<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>`;
20546
20623
  const parseXmlToJson = (xml) => {
20547
20624
  return JSON.parse(xmljs.xml2json(xml, null, 2));
@@ -21440,6 +21517,8 @@ const handleListNode = (params2) => {
21440
21517
  listItems.push(possibleList);
21441
21518
  possibleList = siblings.shift();
21442
21519
  if (possibleList?.elements && !hasTextNode(possibleList.elements)) {
21520
+ const { name } = possibleList;
21521
+ if (name === "w:tbl") continue;
21443
21522
  listItems.push(possibleList);
21444
21523
  possibleList = siblings.shift();
21445
21524
  }
@@ -22250,15 +22329,25 @@ const processCombinedNodesForFldChar = (nodesToCombine = []) => {
22250
22329
  if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
22251
22330
  const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
22252
22331
  if (hasPageMarker) {
22253
- processedNodes.push({
22332
+ const pageNumNode = {
22254
22333
  name: "sd:autoPageNumber",
22255
22334
  type: "element"
22335
+ };
22336
+ nodesToCombine.forEach((n) => {
22337
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
22338
+ if (rPrNode) pageNumNode.elements = [rPrNode];
22256
22339
  });
22340
+ processedNodes.push(pageNumNode);
22257
22341
  } else if (isNumPages) {
22258
- processedNodes.push({
22342
+ const totalPageNumNode = {
22259
22343
  name: "sd:totalPageNumber",
22260
22344
  type: "element"
22345
+ };
22346
+ nodesToCombine.forEach((n) => {
22347
+ const rPrNode = n.elements.find((el) => el.name === "w:rPr");
22348
+ if (rPrNode) totalPageNumNode.elements = [rPrNode];
22261
22349
  });
22350
+ processedNodes.push(totalPageNumNode);
22262
22351
  } else if (urlMatch && urlMatch?.length >= 2) {
22263
22352
  const url = urlMatch[1];
22264
22353
  const textMarks = [];
@@ -22594,8 +22683,13 @@ const handleAutoPageNumber = (params2) => {
22594
22683
  if (nodes.length === 0 || nodes[0].name !== "sd:autoPageNumber") {
22595
22684
  return { nodes: [], consumed: 0 };
22596
22685
  }
22686
+ const rPr = nodes[0].elements?.find((el) => el.name === "w:rPr");
22687
+ const marks = parseMarks(rPr || { elements: [] });
22597
22688
  const processedNode = {
22598
- type: "page-number"
22689
+ type: "page-number",
22690
+ attrs: {
22691
+ marksAsAttrs: marks
22692
+ }
22599
22693
  };
22600
22694
  return { nodes: [processedNode], consumed: 1 };
22601
22695
  };
@@ -22608,8 +22702,13 @@ const handleAutoTotalPageNumber = (params2) => {
22608
22702
  if (nodes.length === 0 || nodes[0].name !== "sd:totalPageNumber") {
22609
22703
  return { nodes: [], consumed: 0 };
22610
22704
  }
22705
+ const rPr = nodes[0].elements?.find((el) => el.name === "w:rPr");
22706
+ const marks = parseMarks(rPr || { elements: [] });
22611
22707
  const processedNode = {
22612
- type: "total-page-number"
22708
+ type: "total-page-number",
22709
+ attrs: {
22710
+ marksAsAttrs: marks
22711
+ }
22613
22712
  };
22614
22713
  return { nodes: [processedNode], consumed: 1 };
22615
22714
  };
@@ -23294,7 +23393,7 @@ const _SuperConverter = class _SuperConverter2 {
23294
23393
  return;
23295
23394
  }
23296
23395
  }
23297
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36") {
23396
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.37-next.1") {
23298
23397
  const customLocation = "docProps/custom.xml";
23299
23398
  if (!docx[customLocation]) {
23300
23399
  docx[customLocation] = generateCustomXml();
@@ -23761,7 +23860,7 @@ function storeSuperdocVersion(docx) {
23761
23860
  function generateCustomXml() {
23762
23861
  return DEFAULT_CUSTOM_XML;
23763
23862
  }
23764
- function generateSuperdocVersion(pid = 2, version2 = "0.12.36") {
23863
+ function generateSuperdocVersion(pid = 2, version2 = "0.12.37-next.1") {
23765
23864
  return {
23766
23865
  type: "element",
23767
23866
  name: "property",
@@ -26294,7 +26393,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
26294
26393
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
26295
26394
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
26296
26395
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
26297
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn;
26396
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
26298
26397
  function getMarksFromSelection(state2) {
26299
26398
  const { from: from2, to, empty: empty2 } = state2.selection;
26300
26399
  const marks = [];
@@ -30561,6 +30660,7 @@ const isEquivalentPosition = function(node2, off2, targetNode, targetOff) {
30561
30660
  };
30562
30661
  const atomElements = /^(img|br|input|textarea|hr)$/i;
30563
30662
  function scanFor(node2, off2, targetNode, targetOff, dir) {
30663
+ var _a;
30564
30664
  for (; ; ) {
30565
30665
  if (node2 == targetNode && off2 == targetOff)
30566
30666
  return true;
@@ -30571,10 +30671,16 @@ function scanFor(node2, off2, targetNode, targetOff, dir) {
30571
30671
  off2 = domIndex(node2) + (dir < 0 ? 0 : 1);
30572
30672
  node2 = parent;
30573
30673
  } else if (node2.nodeType == 1) {
30574
- node2 = node2.childNodes[off2 + (dir < 0 ? -1 : 0)];
30575
- if (node2.contentEditable == "false")
30576
- return false;
30577
- off2 = dir < 0 ? nodeSize(node2) : 0;
30674
+ let child = node2.childNodes[off2 + (dir < 0 ? -1 : 0)];
30675
+ if (child.nodeType == 1 && child.contentEditable == "false") {
30676
+ if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection)
30677
+ off2 += dir;
30678
+ else
30679
+ return false;
30680
+ } else {
30681
+ node2 = child;
30682
+ off2 = dir < 0 ? nodeSize(node2) : 0;
30683
+ }
30578
30684
  } else {
30579
30685
  return false;
30580
30686
  }
@@ -30703,7 +30809,7 @@ function windowRect(doc2) {
30703
30809
  bottom: doc2.documentElement.clientHeight
30704
30810
  };
30705
30811
  }
30706
- function getSide(value, side) {
30812
+ function getSide$1(value, side) {
30707
30813
  return typeof value == "number" ? value : value[side];
30708
30814
  }
30709
30815
  function clientRect(node2) {
@@ -30731,14 +30837,14 @@ function scrollRectIntoView(view, rect, startDOM) {
30731
30837
  let atTop = elt == doc2.body;
30732
30838
  let bounding = atTop ? windowRect(doc2) : clientRect(elt);
30733
30839
  let moveX = 0, moveY = 0;
30734
- if (rect.top < bounding.top + getSide(scrollThreshold, "top"))
30735
- moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
30736
- else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom"))
30737
- moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
30738
- if (rect.left < bounding.left + getSide(scrollThreshold, "left"))
30739
- moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
30740
- else if (rect.right > bounding.right - getSide(scrollThreshold, "right"))
30741
- moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
30840
+ if (rect.top < bounding.top + getSide$1(scrollThreshold, "top"))
30841
+ moveY = -(bounding.top - rect.top + getSide$1(scrollMargin, "top"));
30842
+ else if (rect.bottom > bounding.bottom - getSide$1(scrollThreshold, "bottom"))
30843
+ moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide$1(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide$1(scrollMargin, "bottom");
30844
+ if (rect.left < bounding.left + getSide$1(scrollThreshold, "left"))
30845
+ moveX = -(bounding.left - rect.left + getSide$1(scrollMargin, "left"));
30846
+ else if (rect.right > bounding.right - getSide$1(scrollThreshold, "right"))
30847
+ moveX = rect.right - bounding.right + getSide$1(scrollMargin, "right");
30742
30848
  if (moveX || moveY) {
30743
30849
  if (atTop) {
30744
30850
  doc2.defaultView.scrollBy(moveX, moveY);
@@ -31533,6 +31639,9 @@ class ViewDesc {
31533
31639
  get ignoreForCoords() {
31534
31640
  return false;
31535
31641
  }
31642
+ get ignoreForSelection() {
31643
+ return false;
31644
+ }
31536
31645
  isText(text) {
31537
31646
  return false;
31538
31647
  }
@@ -31581,6 +31690,9 @@ class WidgetViewDesc extends ViewDesc {
31581
31690
  get domAtom() {
31582
31691
  return true;
31583
31692
  }
31693
+ get ignoreForSelection() {
31694
+ return !!this.widget.type.spec.relaxedSide;
31695
+ }
31584
31696
  get side() {
31585
31697
  return this.widget.type.side;
31586
31698
  }
@@ -33361,8 +33473,9 @@ editHandlers.keypress = (view, _event) => {
33361
33473
  let sel = view.state.selection;
33362
33474
  if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {
33363
33475
  let text = String.fromCharCode(event.charCode);
33364
- if (!/[\r\n]/.test(text) && !view.someProp("handleTextInput", (f) => f(view, sel.$from.pos, sel.$to.pos, text)))
33365
- view.dispatch(view.state.tr.insertText(text).scrollIntoView());
33476
+ let deflt = () => view.state.tr.insertText(text).scrollIntoView();
33477
+ if (!/[\r\n]/.test(text) && !view.someProp("handleTextInput", (f) => f(view, sel.$from.pos, sel.$to.pos, text, deflt)))
33478
+ view.dispatch(deflt());
33366
33479
  event.preventDefault();
33367
33480
  }
33368
33481
  };
@@ -34934,14 +35047,14 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
34934
35047
  if (newSel && !view.state.selection.eq(newSel)) {
34935
35048
  if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter"))))
34936
35049
  return;
34937
- let tr2 = view.state.tr.setSelection(newSel);
35050
+ let tr = view.state.tr.setSelection(newSel);
34938
35051
  if (origin == "pointer")
34939
- tr2.setMeta("pointer", true);
35052
+ tr.setMeta("pointer", true);
34940
35053
  else if (origin == "key")
34941
- tr2.scrollIntoView();
35054
+ tr.scrollIntoView();
34942
35055
  if (compositionID)
34943
- tr2.setMeta("composition", compositionID);
34944
- view.dispatch(tr2);
35056
+ tr.setMeta("composition", compositionID);
35057
+ view.dispatch(tr);
34945
35058
  }
34946
35059
  return;
34947
35060
  }
@@ -34975,10 +35088,10 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
34975
35088
  if (parse.sel) {
34976
35089
  let sel2 = resolveSelection(view, view.state.doc, parse.sel);
34977
35090
  if (sel2 && !sel2.eq(view.state.selection)) {
34978
- let tr2 = view.state.tr.setSelection(sel2);
35091
+ let tr = view.state.tr.setSelection(sel2);
34979
35092
  if (compositionID)
34980
- tr2.setMeta("composition", compositionID);
34981
- view.dispatch(tr2);
35093
+ tr.setMeta("composition", compositionID);
35094
+ view.dispatch(tr);
34982
35095
  }
34983
35096
  }
34984
35097
  return;
@@ -35023,43 +35136,48 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
35023
35136
  }, 20);
35024
35137
  }
35025
35138
  let chFrom = change.start, chTo = change.endA;
35026
- let tr, storedMarks, markChange;
35139
+ let mkTr = (base2) => {
35140
+ let tr = base2 || view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));
35141
+ if (parse.sel) {
35142
+ let sel2 = resolveSelection(view, tr.doc, parse.sel);
35143
+ if (sel2 && !(chrome && view.composing && sel2.empty && (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) && (sel2.head == chFrom || sel2.head == tr.mapping.map(chTo) - 1) || ie$1 && sel2.empty && sel2.head == chFrom))
35144
+ tr.setSelection(sel2);
35145
+ }
35146
+ if (compositionID)
35147
+ tr.setMeta("composition", compositionID);
35148
+ return tr.scrollIntoView();
35149
+ };
35150
+ let markChange;
35027
35151
  if (inlineChange) {
35028
35152
  if ($from.pos == $to.pos) {
35029
35153
  if (ie$1 && ie_version <= 11 && $from.parentOffset == 0) {
35030
35154
  view.domObserver.suppressSelectionUpdates();
35031
35155
  setTimeout(() => selectionToDOM(view), 20);
35032
35156
  }
35033
- tr = view.state.tr.delete(chFrom, chTo);
35034
- storedMarks = doc2.resolve(change.start).marksAcross(doc2.resolve(change.endA));
35157
+ let tr = mkTr(view.state.tr.delete(chFrom, chTo));
35158
+ let marks = doc2.resolve(change.start).marksAcross(doc2.resolve(change.endA));
35159
+ if (marks)
35160
+ tr.ensureMarks(marks);
35161
+ view.dispatch(tr);
35035
35162
  } else if (
35036
35163
  // Adding or removing a mark
35037
35164
  change.endA == change.endB && (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))
35038
35165
  ) {
35039
- tr = view.state.tr;
35166
+ let tr = mkTr(view.state.tr);
35040
35167
  if (markChange.type == "add")
35041
35168
  tr.addMark(chFrom, chTo, markChange.mark);
35042
35169
  else
35043
35170
  tr.removeMark(chFrom, chTo, markChange.mark);
35171
+ view.dispatch(tr);
35044
35172
  } else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {
35045
35173
  let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);
35046
- if (view.someProp("handleTextInput", (f) => f(view, chFrom, chTo, text)))
35047
- return;
35048
- tr = view.state.tr.insertText(text, chFrom, chTo);
35174
+ let deflt = () => mkTr(view.state.tr.insertText(text, chFrom, chTo));
35175
+ if (!view.someProp("handleTextInput", (f) => f(view, chFrom, chTo, text, deflt)))
35176
+ view.dispatch(deflt());
35049
35177
  }
35178
+ } else {
35179
+ view.dispatch(mkTr());
35050
35180
  }
35051
- if (!tr)
35052
- tr = view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));
35053
- if (parse.sel) {
35054
- let sel2 = resolveSelection(view, tr.doc, parse.sel);
35055
- if (sel2 && !(chrome && view.composing && sel2.empty && (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) && (sel2.head == chFrom || sel2.head == tr.mapping.map(chTo) - 1) || ie$1 && sel2.empty && sel2.head == chFrom))
35056
- tr.setSelection(sel2);
35057
- }
35058
- if (storedMarks)
35059
- tr.ensureMarks(storedMarks);
35060
- if (compositionID)
35061
- tr.setMeta("composition", compositionID);
35062
- view.dispatch(tr.scrollIntoView());
35063
35181
  }
35064
35182
  function resolveSelection(view, doc2, parsedSel) {
35065
35183
  if (Math.max(parsedSel.anchor, parsedSel.head) > doc2.content.size)
@@ -35581,22 +35699,6 @@ class EditorView {
35581
35699
  return dispatchEvent(this, event);
35582
35700
  }
35583
35701
  /**
35584
- Dispatch a transaction. Will call
35585
- [`dispatchTransaction`](https://prosemirror.net/docs/ref/#view.DirectEditorProps.dispatchTransaction)
35586
- when given, and otherwise defaults to applying the transaction to
35587
- the current state and calling
35588
- [`updateState`](https://prosemirror.net/docs/ref/#view.EditorView.updateState) with the result.
35589
- This method is bound to the view instance, so that it can be
35590
- easily passed around.
35591
- */
35592
- dispatch(tr) {
35593
- let dispatchTransaction = this._props.dispatchTransaction;
35594
- if (dispatchTransaction)
35595
- dispatchTransaction.call(this, tr);
35596
- else
35597
- this.updateState(this.state.apply(tr));
35598
- }
35599
- /**
35600
35702
  @internal
35601
35703
  */
35602
35704
  domSelectionRange() {
@@ -35612,6 +35714,13 @@ class EditorView {
35612
35714
  return this.root.getSelection();
35613
35715
  }
35614
35716
  }
35717
+ EditorView.prototype.dispatch = function(tr) {
35718
+ let dispatchTransaction = this._props.dispatchTransaction;
35719
+ if (dispatchTransaction)
35720
+ dispatchTransaction.call(this, tr);
35721
+ else
35722
+ this.updateState(this.state.apply(tr));
35723
+ };
35615
35724
  function computeDocDeco(view) {
35616
35725
  let attrs = /* @__PURE__ */ Object.create(null);
35617
35726
  attrs.class = "ProseMirror";
@@ -35677,10 +35786,10 @@ function checkStateComponent(plugin2) {
35677
35786
  if (plugin2.spec.state || plugin2.spec.filterTransaction || plugin2.spec.appendTransaction)
35678
35787
  throw new RangeError("Plugins passed directly to the view must not have a state component");
35679
35788
  }
35680
- const floor = Math.floor;
35789
+ const floor$1 = Math.floor;
35681
35790
  const abs = Math.abs;
35682
- const min$1 = (a, b) => a < b ? a : b;
35683
- const max$1 = (a, b) => a > b ? a : b;
35791
+ const min$2 = (a, b) => a < b ? a : b;
35792
+ const max$2 = (a, b) => a > b ? a : b;
35684
35793
  const isNegativeZero = (n) => n !== 0 ? n < 0 : 1 / n < 0;
35685
35794
  const BIT7 = 64;
35686
35795
  const BIT8 = 128;
@@ -35688,7 +35797,7 @@ const BIT30 = 1 << 29;
35688
35797
  const BITS6 = 63;
35689
35798
  const BITS7 = 127;
35690
35799
  const BITS31 = 2147483647;
35691
- const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor(num) === num);
35800
+ const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor$1(num) === num);
35692
35801
  const create$2 = () => /* @__PURE__ */ new Set();
35693
35802
  const isArray$1 = Array.isArray;
35694
35803
  const fromCharCode = String.fromCharCode;
@@ -35752,7 +35861,7 @@ const verifyLen = (encoder, len) => {
35752
35861
  const bufferLen = encoder.cbuf.length;
35753
35862
  if (bufferLen - encoder.cpos < len) {
35754
35863
  encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos));
35755
- encoder.cbuf = new Uint8Array(max$1(bufferLen, len) * 2);
35864
+ encoder.cbuf = new Uint8Array(max$2(bufferLen, len) * 2);
35756
35865
  encoder.cpos = 0;
35757
35866
  }
35758
35867
  };
@@ -35768,7 +35877,7 @@ const write$1 = (encoder, num) => {
35768
35877
  const writeVarUint = (encoder, num) => {
35769
35878
  while (num > BITS7) {
35770
35879
  write$1(encoder, BIT8 | BITS7 & num);
35771
- num = floor(num / 128);
35880
+ num = floor$1(num / 128);
35772
35881
  }
35773
35882
  write$1(encoder, BITS7 & num);
35774
35883
  };
@@ -35778,10 +35887,10 @@ const writeVarInt = (encoder, num) => {
35778
35887
  num = -num;
35779
35888
  }
35780
35889
  write$1(encoder, (num > BITS6 ? BIT8 : 0) | (isNegative ? BIT7 : 0) | BITS6 & num);
35781
- num = floor(num / 64);
35890
+ num = floor$1(num / 64);
35782
35891
  while (num > 0) {
35783
35892
  write$1(encoder, (num > BITS7 ? BIT8 : 0) | BITS7 & num);
35784
- num = floor(num / 128);
35893
+ num = floor$1(num / 128);
35785
35894
  }
35786
35895
  };
35787
35896
  const _strBuffer = new Uint8Array(3e4);
@@ -35814,13 +35923,13 @@ utf8TextEncoder.encodeInto ? _writeVarStringNative : _writeVarStringPolyfill;
35814
35923
  const writeUint8Array = (encoder, uint8Array) => {
35815
35924
  const bufferLen = encoder.cbuf.length;
35816
35925
  const cpos = encoder.cpos;
35817
- const leftCopyLen = min$1(bufferLen - cpos, uint8Array.length);
35926
+ const leftCopyLen = min$2(bufferLen - cpos, uint8Array.length);
35818
35927
  const rightCopyLen = uint8Array.length - leftCopyLen;
35819
35928
  encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos);
35820
35929
  encoder.cpos += leftCopyLen;
35821
35930
  if (rightCopyLen > 0) {
35822
35931
  encoder.bufs.push(encoder.cbuf);
35823
- encoder.cbuf = new Uint8Array(max$1(bufferLen * 2, rightCopyLen));
35932
+ encoder.cbuf = new Uint8Array(max$2(bufferLen * 2, rightCopyLen));
35824
35933
  encoder.cbuf.set(uint8Array.subarray(leftCopyLen));
35825
35934
  encoder.cpos = rightCopyLen;
35826
35935
  }
@@ -35962,7 +36071,7 @@ const ySyncPluginKey = new PluginKey("y-sync");
35962
36071
  const yUndoPluginKey = new PluginKey("y-undo");
35963
36072
  const yCursorPluginKey = new PluginKey("yjs-cursor");
35964
36073
  const rand = Math.random;
35965
- const oneOf = (arr) => arr[floor(rand() * arr.length)];
36074
+ const oneOf = (arr) => arr[floor$1(rand() * arr.length)];
35966
36075
  const undefinedToNull = (v) => v === void 0 ? null : v;
35967
36076
  class VarStoragePolyfill {
35968
36077
  constructor() {
@@ -35992,12 +36101,12 @@ try {
35992
36101
  } catch (e) {
35993
36102
  }
35994
36103
  const varStorage = _localStorage;
35995
- const isNode = typeof process$1$1 !== "undefined" && process$1$1.release && /node|io\.js/.test(process$1$1.release.name) && Object.prototype.toString.call(typeof process$1$1 !== "undefined" ? process$1$1 : 0) === "[object process]";
35996
- const isBrowser$1$1 = typeof window !== "undefined" && typeof document !== "undefined" && !isNode;
36104
+ const isNode$1 = typeof process$1$1 !== "undefined" && process$1$1.release && /node|io\.js/.test(process$1$1.release.name) && Object.prototype.toString.call(typeof process$1$1 !== "undefined" ? process$1$1 : 0) === "[object process]";
36105
+ const isBrowser$1$1 = typeof window !== "undefined" && typeof document !== "undefined" && !isNode$1;
35997
36106
  let params;
35998
36107
  const computeParams = () => {
35999
36108
  if (params === void 0) {
36000
- if (isNode) {
36109
+ if (isNode$1) {
36001
36110
  params = create();
36002
36111
  const pargs = process$1$1.argv;
36003
36112
  let currParamName = null;
@@ -36034,12 +36143,12 @@ const computeParams = () => {
36034
36143
  return params;
36035
36144
  };
36036
36145
  const hasParam = (name) => computeParams().has(name);
36037
- const getVariable = (name) => isNode ? undefinedToNull(process$1$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
36146
+ const getVariable = (name) => isNode$1 ? undefinedToNull(process$1$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
36038
36147
  const hasConf = (name) => hasParam("--" + name) || getVariable(name) !== null;
36039
36148
  hasConf("production");
36040
- const forceColor = isNode && isOneOf(process$1$1.env.FORCE_COLOR, ["true", "1", "2"]);
36149
+ const forceColor = isNode$1 && isOneOf(process$1$1.env.FORCE_COLOR, ["true", "1", "2"]);
36041
36150
  forceColor || !hasParam("--no-colors") && // @todo deprecate --no-colors
36042
- !hasConf("no-color") && (!isNode || process$1$1.stdout.isTTY) && (!isNode || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
36151
+ !hasConf("no-color") && (!isNode$1 || process$1$1.stdout.isTTY) && (!isNode$1 || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
36043
36152
  const doc = (
36044
36153
  /** @type {Document} */
36045
36154
  typeof document !== "undefined" ? document : {}
@@ -36548,8 +36657,8 @@ class ProsemirrorBinding {
36548
36657
  new Slice(Fragment.from(fragmentContent), 0, 0)
36549
36658
  );
36550
36659
  if (sel) {
36551
- const clampedAnchor = min$1(max$1(sel.anchor, 0), tr.doc.content.size);
36552
- const clampedHead = min$1(max$1(sel.head, 0), tr.doc.content.size);
36660
+ const clampedAnchor = min$2(max$2(sel.anchor, 0), tr.doc.content.size);
36661
+ const clampedHead = min$2(max$2(sel.head, 0), tr.doc.content.size);
36553
36662
  tr.setSelection(TextSelection.create(tr.doc, clampedAnchor, clampedHead));
36554
36663
  }
36555
36664
  this.prosemirrorView.dispatch(
@@ -36946,7 +37055,7 @@ const computeChildEqualityFactor = (ytype, pnode, meta) => {
36946
37055
  const pChildren = normalizePNodeContent(pnode);
36947
37056
  const pChildCnt = pChildren.length;
36948
37057
  const yChildCnt = yChildren.length;
36949
- const minCnt = min$1(yChildCnt, pChildCnt);
37058
+ const minCnt = min$2(yChildCnt, pChildCnt);
36950
37059
  let left2 = 0;
36951
37060
  let right2 = 0;
36952
37061
  let foundMappedChild = false;
@@ -37058,7 +37167,7 @@ const updateYFragment = (y, yDomFragment, pNode, meta) => {
37058
37167
  const pChildCnt = pChildren.length;
37059
37168
  const yChildren = yDomFragment.toArray();
37060
37169
  const yChildCnt = yChildren.length;
37061
- const minCnt = min$1(pChildCnt, yChildCnt);
37170
+ const minCnt = min$2(pChildCnt, yChildCnt);
37062
37171
  let left2 = 0;
37063
37172
  let right2 = 0;
37064
37173
  for (; left2 < minCnt; left2++) {
@@ -37431,17 +37540,17 @@ const createDecorations = (state2, awareness, awarenessFilter, createCursor, cre
37431
37540
  ystate.binding.mapping
37432
37541
  );
37433
37542
  if (anchor !== null && head !== null) {
37434
- const maxsize = max$1(state2.doc.content.size - 1, 0);
37435
- anchor = min$1(anchor, maxsize);
37436
- head = min$1(head, maxsize);
37543
+ const maxsize = max$2(state2.doc.content.size - 1, 0);
37544
+ anchor = min$2(anchor, maxsize);
37545
+ head = min$2(head, maxsize);
37437
37546
  decorations.push(
37438
37547
  Decoration.widget(head, () => createCursor(user, clientId), {
37439
37548
  key: clientId + "",
37440
37549
  side: 10
37441
37550
  })
37442
37551
  );
37443
- const from2 = min$1(anchor, head);
37444
- const to = max$1(anchor, head);
37552
+ const from2 = min$2(anchor, head);
37553
+ const to = max$2(anchor, head);
37445
37554
  decorations.push(
37446
37555
  Decoration.inline(from2, to, createSelection(user, clientId), {
37447
37556
  inclusiveEnd: true,
@@ -37895,7 +38004,8 @@ const getTextContentFromNodes = ($from, maxMatch = 500) => {
37895
38004
  const handleDocxPaste = (html, editor, view, plugin2) => {
37896
38005
  const { converter } = editor;
37897
38006
  if (!converter || !converter.convertedXml) return handleHtmlPaste(html, editor, view, plugin2);
37898
- const cleanedHtml = convertEmToPt(html);
38007
+ let cleanedHtml = convertEmToPt(html);
38008
+ cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
37899
38009
  const tempDiv = document.createElement("div");
37900
38010
  tempDiv.innerHTML = cleanedHtml;
37901
38011
  const paragraphs = tempDiv.querySelectorAll("p");
@@ -38266,6 +38376,9 @@ const convertEmToPt = (html) => {
38266
38376
  }
38267
38377
  );
38268
38378
  };
38379
+ function cleanHtmlUnnecessaryTags(html) {
38380
+ return html.replace(/<o:p>.*?<\/o:p>/gi, "").replace(/&nbsp;/gi, " ").replace(/<span[^>]*>\s*<\/span>/gi, "").replace(/<p[^>]*>\s*<\/p>/gi, "").trim();
38381
+ }
38269
38382
  const _ExtensionService = class _ExtensionService2 {
38270
38383
  constructor(extensions, userExtensions, editor) {
38271
38384
  __privateAdd$1(this, _ExtensionService_instances);
@@ -39063,7 +39176,8 @@ const createHeaderFooterEditor = ({
39063
39176
  appendToBody = true,
39064
39177
  sectionId,
39065
39178
  type: type2,
39066
- availableHeight
39179
+ availableHeight,
39180
+ currentPageNumber
39067
39181
  }) => {
39068
39182
  const parentStyles = editor.converter.getDocumentDefaultStyles();
39069
39183
  const { fontSizePt, typeface } = parentStyles;
@@ -39104,6 +39218,8 @@ const createHeaderFooterEditor = ({
39104
39218
  fonts: editor.options.fonts,
39105
39219
  isHeaderOrFooter: true,
39106
39220
  annotations: true,
39221
+ currentPageNumber,
39222
+ parentEditor: editor,
39107
39223
  onCreate: (evt) => setEditorToolbar(evt, editor),
39108
39224
  onBlur: (evt) => onHeaderFooterDataUpdate(evt, editor, sectionId, type2)
39109
39225
  });
@@ -40247,9 +40363,9 @@ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
40247
40363
  if (type2.name !== "paragraph" && type2.name !== "fieldAnnotation") return;
40248
40364
  child.children.forEach((inline) => {
40249
40365
  const isFieldToDelete = fieldsToDelete.includes(inline.attrs.fieldId);
40250
- const isMatchingField = inline.type.name === "fieldAnnotation" && isFieldToDelete;
40251
- const isEmpty2 = inline.childCount === 0;
40252
- if (!isEmpty2 && !isMatchingField) hasOtherNodes = true;
40366
+ const isFieldType = inline.type.name === "fieldAnnotation";
40367
+ const isMatchingField = isFieldType && isFieldToDelete;
40368
+ if (!isFieldType && !isMatchingField) hasOtherNodes = true;
40253
40369
  if (isMatchingField) matchingNodesFound += 1;
40254
40370
  });
40255
40371
  });
@@ -40451,6 +40567,25 @@ function useHighContrastMode() {
40451
40567
  setHighContrastMode
40452
40568
  };
40453
40569
  }
40570
+ const findWordBounds = (doc2, pos) => {
40571
+ const $pos = doc2.resolve(pos);
40572
+ const parent = $pos.parent;
40573
+ const offset2 = $pos.parentOffset;
40574
+ const text = parent.textContent;
40575
+ if (!text) return { from: pos, to: pos };
40576
+ let start2 = offset2, end2 = offset2;
40577
+ while (start2 > 0 && /\w/.test(text[start2 - 1])) start2--;
40578
+ while (end2 < text.length && /\w/.test(text[end2])) end2++;
40579
+ const from2 = $pos.start() + start2;
40580
+ const to = $pos.start() + end2;
40581
+ return { from: from2, to };
40582
+ };
40583
+ const setWordSelection = (view, pos) => {
40584
+ const { state: state2, dispatch } = view;
40585
+ const word = findWordBounds(state2.doc, pos);
40586
+ const tr = state2.tr.setSelection(TextSelection.create(state2.doc, word.from, word.to));
40587
+ dispatch(tr);
40588
+ };
40454
40589
  const _Editor = class _Editor2 extends EventEmitter$1 {
40455
40590
  /**
40456
40591
  * Create a new Editor instance
@@ -40694,6 +40829,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
40694
40829
  __privateMethod$1(this, _Editor_instances, initMedia_fn).call(this);
40695
40830
  const doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
40696
40831
  const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc2);
40832
+ tr.setMeta("replaceContent", true);
40697
40833
  this.view.dispatch(tr);
40698
40834
  }
40699
40835
  /**
@@ -41101,7 +41237,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41101
41237
  * @returns {Object | void} Migration results
41102
41238
  */
41103
41239
  processCollaborationMigrations() {
41104
- console.debug("[checkVersionMigrations] Current editor version", "0.12.36");
41240
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.37-next.1");
41105
41241
  if (!this.options.ydoc) return;
41106
41242
  const metaMap = this.options.ydoc.getMap("meta");
41107
41243
  let docVersion = metaMap.get("version");
@@ -41456,6 +41592,7 @@ createView_fn = function() {
41456
41592
  if (isHeader || isFooter) {
41457
41593
  const eventClone = new event.constructor(event.type);
41458
41594
  event.target.dispatchEvent(eventClone);
41595
+ if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
41459
41596
  return;
41460
41597
  }
41461
41598
  event.stopPropagation();
@@ -41466,6 +41603,7 @@ createView_fn = function() {
41466
41603
  pm.classList.remove("header-footer-edit");
41467
41604
  pm.setAttribute("aria-readonly", false);
41468
41605
  }
41606
+ setWordSelection(view, pos);
41469
41607
  }
41470
41608
  });
41471
41609
  const newState = this.state.reconfigure({
@@ -46637,7 +46775,7 @@ const Table = Node$1.create({
46637
46775
  if (!borders) return {};
46638
46776
  const style2 = Object.entries(borders).reduce(
46639
46777
  (acc, [key, { size: size2, color }]) => {
46640
- return `${acc}border-${key}: ${size2}px solid ${color || "black"};`;
46778
+ return `${acc}border-${key}: ${Math.ceil(size2)}px solid ${color || "black"};`;
46641
46779
  },
46642
46780
  ""
46643
46781
  );
@@ -46977,8 +47115,8 @@ const TableCell = Node$1.create({
46977
47115
  cellMargins: {
46978
47116
  renderDOM({ cellMargins }) {
46979
47117
  if (!cellMargins) return {};
46980
- const sides = ["top", "right", "bottom", "left"];
46981
- const style2 = sides.map((side) => {
47118
+ const sides2 = ["top", "right", "bottom", "left"];
47119
+ const style2 = sides2.map((side) => {
46982
47120
  const margin = cellMargins?.[side];
46983
47121
  if (margin) return `padding-${side}: ${margin}px;`;
46984
47122
  return "";
@@ -46990,11 +47128,11 @@ const TableCell = Node$1.create({
46990
47128
  default: () => createCellBorders(),
46991
47129
  renderDOM({ borders }) {
46992
47130
  if (!borders) return {};
46993
- const sides = ["top", "right", "bottom", "left"];
46994
- const style2 = sides.map((side) => {
47131
+ const sides2 = ["top", "right", "bottom", "left"];
47132
+ const style2 = sides2.map((side) => {
46995
47133
  const border = borders?.[side];
46996
47134
  if (border && border.val === "none") return `border-${side}: ${border.val};`;
46997
- if (border) return `border-${side}: ${border.size}px solid ${border.color || "black"};`;
47135
+ if (border) return `border-${side}: ${Math.ceil(border.size)}px solid ${border.color || "black"};`;
46998
47136
  return "";
46999
47137
  }).join(" ");
47000
47138
  return { style: style2 };
@@ -47220,7 +47358,7 @@ class FieldAnnotationView {
47220
47358
  }
47221
47359
  _FieldAnnotationView_instances = /* @__PURE__ */ new WeakSet();
47222
47360
  createAnnotation_fn = function({ displayLabel } = {}) {
47223
- let { highlighted } = this.node.attrs;
47361
+ let { highlighted, rawHtml } = this.node.attrs;
47224
47362
  let annotation = document.createElement("span");
47225
47363
  annotation.classList.add(this.annotationClass);
47226
47364
  let content = document.createElement("span");
@@ -47232,7 +47370,11 @@ createAnnotation_fn = function({ displayLabel } = {}) {
47232
47370
  }
47233
47371
  annotation.append(content);
47234
47372
  let omitHighlight = highlighted === false;
47235
- let annotationStyle = [`border: 2px solid ${this.borderColor}`, `border-radius: 2px`, `padding: 1px 2px`, `box-sizing: border-box`].join(
47373
+ let styles = [`border: 2px solid ${this.borderColor}`, `border-radius: 2px`, `padding: 1px 2px`, `box-sizing: border-box`];
47374
+ if (rawHtml) {
47375
+ styles.push("font-weight: normal");
47376
+ }
47377
+ let annotationStyle = styles.join(
47236
47378
  "; "
47237
47379
  );
47238
47380
  let mergedAttrs = Attribute2.mergeAttributes(this.htmlAttributes, {
@@ -47787,6 +47929,12 @@ const FieldAnnotation = Node$1.create({
47787
47929
  parseDOM: (elem) => elem.getAttribute("data-bold") === "true",
47788
47930
  renderDOM: (attrs) => {
47789
47931
  if (!attrs.bold) return {};
47932
+ if (attrs.rawHtml) {
47933
+ return {
47934
+ "data-bold": "false",
47935
+ style: "font-weight: normal"
47936
+ };
47937
+ }
47790
47938
  return {
47791
47939
  "data-bold": "true",
47792
47940
  style: "font-weight: bold"
@@ -47797,7 +47945,7 @@ const FieldAnnotation = Node$1.create({
47797
47945
  default: false,
47798
47946
  parseDOM: (elem) => elem.getAttribute("data-italic") === "true",
47799
47947
  renderDOM: (attrs) => {
47800
- if (!attrs.italic) return {};
47948
+ if (!attrs.italic || attrs.rawHtml) return {};
47801
47949
  return {
47802
47950
  "data-italic": "true",
47803
47951
  style: "font-style: italic"
@@ -47808,7 +47956,7 @@ const FieldAnnotation = Node$1.create({
47808
47956
  default: false,
47809
47957
  parseDOM: (elem) => elem.getAttribute("data-underline") === "true",
47810
47958
  renderDOM: (attrs) => {
47811
- if (!attrs.underline) return {};
47959
+ if (!attrs.underline || attrs.rawHtml) return {};
47812
47960
  return {
47813
47961
  "data-underline": "true",
47814
47962
  style: "text-decoration: underline"
@@ -47830,7 +47978,7 @@ const FieldAnnotation = Node$1.create({
47830
47978
  default: null,
47831
47979
  parseDOM: (elem) => elem.getAttribute("data-font-size") || elem.style.fontSize || null,
47832
47980
  renderDOM: (attrs) => {
47833
- if (!attrs.fontSize) return {};
47981
+ if (!attrs.fontSize || attrs.rawHtml) return {};
47834
47982
  let [value, unit] = parseSizeUnit(attrs.fontSize);
47835
47983
  if (Number.isNaN(value)) return {};
47836
47984
  unit = unit ? unit : "pt";
@@ -48749,32 +48897,89 @@ const PageNumber = Node$1.create({
48749
48897
  name: "page-number",
48750
48898
  group: "inline",
48751
48899
  inline: true,
48752
- content: "text*",
48900
+ atom: true,
48901
+ selectable: false,
48902
+ draggable: false,
48903
+ selectable: false,
48904
+ defining: true,
48905
+ content: "",
48753
48906
  addOptions() {
48754
48907
  return {
48755
48908
  htmlAttributes: {
48909
+ contenteditable: false,
48756
48910
  "data-id": "auto-page-number",
48757
48911
  "aria-label": "Page number node"
48758
48912
  }
48759
48913
  };
48760
48914
  },
48915
+ addAttributes() {
48916
+ return {
48917
+ marksAsAttrs: {
48918
+ default: null,
48919
+ rendered: false
48920
+ }
48921
+ };
48922
+ },
48923
+ addNodeView() {
48924
+ return ({ node: node2, editor, getPos, decorations }) => {
48925
+ const htmlAttributes = this.options.htmlAttributes;
48926
+ return new AutoPageNumberNodeView(node2, getPos, decorations, editor, htmlAttributes);
48927
+ };
48928
+ },
48761
48929
  parseDOM() {
48762
48930
  return [{ tag: 'span[data-id="auto-page-number"' }];
48763
48931
  },
48764
48932
  renderDOM({ htmlAttributes }) {
48765
- return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
48933
+ return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
48934
+ },
48935
+ addCommands() {
48936
+ return {
48937
+ addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
48938
+ const { options: options2 } = editor;
48939
+ if (!options2.isHeaderOrFooter) return false;
48940
+ const { schema } = state2;
48941
+ const pageNumberType = schema?.nodes?.["page-number"];
48942
+ if (!pageNumberType) return false;
48943
+ const pageNumberNodeJSON = { type: "page-number" };
48944
+ const pageNumberNode = schema.nodeFromJSON(pageNumberNodeJSON);
48945
+ if (dispatch) {
48946
+ tr.replaceSelectionWith(pageNumberNode, false);
48947
+ tr.setMeta("forceUpdatePagination", true);
48948
+ }
48949
+ return true;
48950
+ }
48951
+ };
48952
+ },
48953
+ addShortcuts() {
48954
+ return {
48955
+ "Mod-Shift-alt-p": () => this.editor.commands.addAutoPageNumber()
48956
+ };
48766
48957
  }
48767
48958
  });
48768
48959
  const TotalPageCount = Node$1.create({
48769
48960
  name: "total-page-number",
48770
48961
  group: "inline",
48771
48962
  inline: true,
48963
+ atom: true,
48964
+ selectable: false,
48965
+ draggable: false,
48966
+ selectable: false,
48772
48967
  content: "text*",
48773
48968
  addOptions() {
48774
48969
  return {
48775
48970
  htmlAttributes: {
48971
+ contenteditable: false,
48776
48972
  "data-id": "auto-total-pages",
48777
- "aria-label": "Total page count node"
48973
+ "aria-label": "Total page count node",
48974
+ "class": "sd-editor-auto-total-pages"
48975
+ }
48976
+ };
48977
+ },
48978
+ addAttributes() {
48979
+ return {
48980
+ marksAsAttrs: {
48981
+ default: null,
48982
+ rendered: false
48778
48983
  }
48779
48984
  };
48780
48985
  },
@@ -48783,8 +48988,139 @@ const TotalPageCount = Node$1.create({
48783
48988
  },
48784
48989
  renderDOM({ htmlAttributes }) {
48785
48990
  return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
48991
+ },
48992
+ addCommands() {
48993
+ return {
48994
+ addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
48995
+ const { options: options2 } = editor;
48996
+ if (!options2.isHeaderOrFooter) return false;
48997
+ const { schema } = state2;
48998
+ const pageNumberType = schema.nodes?.["total-page-number"];
48999
+ if (!pageNumberType) return false;
49000
+ const currentPages = editor?.options?.parentEditor?.currentTotalPages || 1;
49001
+ const pageNumberNode = {
49002
+ type: "total-page-number",
49003
+ content: [{ type: "text", text: String(currentPages) }]
49004
+ };
49005
+ const pageNode = schema.nodeFromJSON(pageNumberNode);
49006
+ if (dispatch) {
49007
+ tr.replaceSelectionWith(pageNode, false);
49008
+ }
49009
+ return true;
49010
+ }
49011
+ };
49012
+ },
49013
+ addShortcuts() {
49014
+ return {
49015
+ "Mod-Shift-alt-c": () => this.editor.commands.addTotalPageCount()
49016
+ };
48786
49017
  }
48787
49018
  });
49019
+ class AutoPageNumberNodeView {
49020
+ constructor(node2, getPos, decorations, editor, htmlAttributes = {}) {
49021
+ __privateAdd$1(this, _AutoPageNumberNodeView_instances);
49022
+ this.node = node2;
49023
+ this.editor = editor;
49024
+ this.view = editor.view;
49025
+ this.getPos = getPos;
49026
+ this.editor = editor;
49027
+ this.dom = __privateMethod$1(this, _AutoPageNumberNodeView_instances, renderDom_fn).call(this, node2, htmlAttributes);
49028
+ }
49029
+ update(node2) {
49030
+ if (node2.type !== this.node.type) return false;
49031
+ this.node = node2;
49032
+ return true;
49033
+ }
49034
+ }
49035
+ _AutoPageNumberNodeView_instances = /* @__PURE__ */ new WeakSet();
49036
+ renderDom_fn = function(node2, htmlAttributes) {
49037
+ const pageText = this.editor.options.currentPageNumber || "1";
49038
+ const content = document.createTextNode(String(pageText));
49039
+ const nodeContent = document.createElement("span");
49040
+ nodeContent.className = "sd-editor-auto-page-number";
49041
+ nodeContent.setAttribute("data-id", "auto-page-number");
49042
+ nodeContent.setAttribute("aria-label", "Page number node");
49043
+ const currentPos = this.getPos();
49044
+ const { styles, marks } = getMarksFromNeighbors(currentPos, this.view);
49045
+ __privateMethod$1(this, _AutoPageNumberNodeView_instances, scheduleUpdateNodeStyle_fn).call(this, currentPos, marks);
49046
+ Object.assign(nodeContent.style, styles);
49047
+ nodeContent.appendChild(content);
49048
+ Object.entries(htmlAttributes).forEach(([key, value]) => {
49049
+ if (value) nodeContent.setAttribute(key, value);
49050
+ });
49051
+ return nodeContent;
49052
+ };
49053
+ scheduleUpdateNodeStyle_fn = function(pos, marks) {
49054
+ setTimeout(() => {
49055
+ const { state: state2 } = this.editor;
49056
+ const { dispatch } = this.view;
49057
+ const node2 = state2.doc.nodeAt(pos);
49058
+ if (!node2) return;
49059
+ const currentMarks = node2.attrs.marksAsAttrs || [];
49060
+ const newMarks = marks.map((m) => ({ type: m.type.name, attrs: m.attrs }));
49061
+ const isEqual = JSON.stringify(currentMarks) === JSON.stringify(newMarks);
49062
+ if (isEqual) return;
49063
+ const newAttrs = {
49064
+ ...node2.attrs,
49065
+ marksAsAttrs: newMarks
49066
+ };
49067
+ const tr = state2.tr.setNodeMarkup(pos, void 0, newAttrs);
49068
+ dispatch(tr);
49069
+ }, 0);
49070
+ };
49071
+ const getMarksFromNeighbors = (currentPos, view) => {
49072
+ const $pos = view.state.doc.resolve(currentPos);
49073
+ const styles = {};
49074
+ const marks = [];
49075
+ const before = $pos.nodeBefore;
49076
+ if (before) {
49077
+ Object.assign(styles, processMarks(before.marks));
49078
+ marks.push(...before.marks);
49079
+ }
49080
+ const after = $pos.nodeAfter;
49081
+ if (after) {
49082
+ Object.assign(styles, { ...styles, ...processMarks(after.marks) });
49083
+ marks.push(...after.marks);
49084
+ }
49085
+ return {
49086
+ styles,
49087
+ marks
49088
+ };
49089
+ };
49090
+ const processMarks = (marks) => {
49091
+ const styles = {};
49092
+ marks.forEach((mark) => {
49093
+ const { type: type2, attrs } = mark;
49094
+ switch (type2.name) {
49095
+ case "textStyle":
49096
+ if (attrs.fontFamily) styles["font-family"] = attrs.fontFamily;
49097
+ if (attrs.fontSize) styles["font-size"] = attrs.fontSize;
49098
+ if (attrs.color) styles["color"] = attrs.color;
49099
+ if (attrs.backgroundColor) styles["background-color"] = attrs.backgroundColor;
49100
+ break;
49101
+ case "bold":
49102
+ styles["font-weight"] = "bold";
49103
+ break;
49104
+ case "italic":
49105
+ styles["font-style"] = "italic";
49106
+ break;
49107
+ case "underline":
49108
+ styles["text-decoration"] = (styles["text-decoration"] || "") + " underline";
49109
+ break;
49110
+ case "strike":
49111
+ styles["text-decoration"] = (styles["text-decoration"] || "") + " line-through";
49112
+ break;
49113
+ default:
49114
+ if (attrs?.style) {
49115
+ Object.entries(attrs.style).forEach(([key, value]) => {
49116
+ styles[key] = value;
49117
+ });
49118
+ }
49119
+ break;
49120
+ }
49121
+ });
49122
+ return styles;
49123
+ };
48788
49124
  const ShapeContainer = Node$1.create({
48789
49125
  name: "shapeContainer",
48790
49126
  group: "block",
@@ -49797,10 +50133,10 @@ var beforeWrite = "beforeWrite";
49797
50133
  var write = "write";
49798
50134
  var afterWrite = "afterWrite";
49799
50135
  var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
49800
- function getNodeName(element) {
50136
+ function getNodeName$1(element) {
49801
50137
  return element ? (element.nodeName || "").toLowerCase() : null;
49802
50138
  }
49803
- function getWindow(node2) {
50139
+ function getWindow$1(node2) {
49804
50140
  if (node2 == null) {
49805
50141
  return window;
49806
50142
  }
@@ -49810,19 +50146,19 @@ function getWindow(node2) {
49810
50146
  }
49811
50147
  return node2;
49812
50148
  }
49813
- function isElement$1(node2) {
49814
- var OwnElement = getWindow(node2).Element;
50149
+ function isElement$2(node2) {
50150
+ var OwnElement = getWindow$1(node2).Element;
49815
50151
  return node2 instanceof OwnElement || node2 instanceof Element;
49816
50152
  }
49817
50153
  function isHTMLElement$1(node2) {
49818
- var OwnElement = getWindow(node2).HTMLElement;
50154
+ var OwnElement = getWindow$1(node2).HTMLElement;
49819
50155
  return node2 instanceof OwnElement || node2 instanceof HTMLElement;
49820
50156
  }
49821
- function isShadowRoot(node2) {
50157
+ function isShadowRoot$1(node2) {
49822
50158
  if (typeof ShadowRoot === "undefined") {
49823
50159
  return false;
49824
50160
  }
49825
- var OwnElement = getWindow(node2).ShadowRoot;
50161
+ var OwnElement = getWindow$1(node2).ShadowRoot;
49826
50162
  return node2 instanceof OwnElement || node2 instanceof ShadowRoot;
49827
50163
  }
49828
50164
  function applyStyles(_ref) {
@@ -49831,7 +50167,7 @@ function applyStyles(_ref) {
49831
50167
  var style2 = state2.styles[name] || {};
49832
50168
  var attributes = state2.attributes[name] || {};
49833
50169
  var element = state2.elements[name];
49834
- if (!isHTMLElement$1(element) || !getNodeName(element)) {
50170
+ if (!isHTMLElement$1(element) || !getNodeName$1(element)) {
49835
50171
  return;
49836
50172
  }
49837
50173
  Object.assign(element.style, style2);
@@ -49873,7 +50209,7 @@ function effect$2(_ref2) {
49873
50209
  style22[property2] = "";
49874
50210
  return style22;
49875
50211
  }, {});
49876
- if (!isHTMLElement$1(element) || !getNodeName(element)) {
50212
+ if (!isHTMLElement$1(element) || !getNodeName$1(element)) {
49877
50213
  return;
49878
50214
  }
49879
50215
  Object.assign(element.style, style2);
@@ -49894,9 +50230,9 @@ const applyStyles$1 = {
49894
50230
  function getBasePlacement$1(placement) {
49895
50231
  return placement.split("-")[0];
49896
50232
  }
49897
- var max = Math.max;
49898
- var min = Math.min;
49899
- var round = Math.round;
50233
+ var max$1 = Math.max;
50234
+ var min$1 = Math.min;
50235
+ var round$1 = Math.round;
49900
50236
  function getUAString() {
49901
50237
  var uaData = navigator.userAgentData;
49902
50238
  if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
@@ -49909,7 +50245,7 @@ function getUAString() {
49909
50245
  function isLayoutViewport() {
49910
50246
  return !/^((?!chrome|android).)*safari/i.test(getUAString());
49911
50247
  }
49912
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
50248
+ function getBoundingClientRect$1(element, includeScale, isFixedStrategy) {
49913
50249
  if (includeScale === void 0) {
49914
50250
  includeScale = false;
49915
50251
  }
@@ -49920,10 +50256,10 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
49920
50256
  var scaleX = 1;
49921
50257
  var scaleY = 1;
49922
50258
  if (includeScale && isHTMLElement$1(element)) {
49923
- scaleX = element.offsetWidth > 0 ? round(clientRect2.width) / element.offsetWidth || 1 : 1;
49924
- scaleY = element.offsetHeight > 0 ? round(clientRect2.height) / element.offsetHeight || 1 : 1;
50259
+ scaleX = element.offsetWidth > 0 ? round$1(clientRect2.width) / element.offsetWidth || 1 : 1;
50260
+ scaleY = element.offsetHeight > 0 ? round$1(clientRect2.height) / element.offsetHeight || 1 : 1;
49925
50261
  }
49926
- var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
50262
+ var _ref = isElement$2(element) ? getWindow$1(element) : window, visualViewport = _ref.visualViewport;
49927
50263
  var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
49928
50264
  var x = (clientRect2.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
49929
50265
  var y = (clientRect2.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
@@ -49941,7 +50277,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
49941
50277
  };
49942
50278
  }
49943
50279
  function getLayoutRect(element) {
49944
- var clientRect2 = getBoundingClientRect(element);
50280
+ var clientRect2 = getBoundingClientRect$1(element);
49945
50281
  var width = element.offsetWidth;
49946
50282
  var height = element.offsetHeight;
49947
50283
  if (Math.abs(clientRect2.width - width) <= 1) {
@@ -49961,7 +50297,7 @@ function contains$1(parent, child) {
49961
50297
  var rootNode = child.getRootNode && child.getRootNode();
49962
50298
  if (parent.contains(child)) {
49963
50299
  return true;
49964
- } else if (rootNode && isShadowRoot(rootNode)) {
50300
+ } else if (rootNode && isShadowRoot$1(rootNode)) {
49965
50301
  var next = child;
49966
50302
  do {
49967
50303
  if (next && parent.isSameNode(next)) {
@@ -49972,20 +50308,20 @@ function contains$1(parent, child) {
49972
50308
  }
49973
50309
  return false;
49974
50310
  }
49975
- function getComputedStyle$1(element) {
49976
- return getWindow(element).getComputedStyle(element);
50311
+ function getComputedStyle$2(element) {
50312
+ return getWindow$1(element).getComputedStyle(element);
49977
50313
  }
49978
- function isTableElement(element) {
49979
- return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
50314
+ function isTableElement$1(element) {
50315
+ return ["table", "td", "th"].indexOf(getNodeName$1(element)) >= 0;
49980
50316
  }
49981
- function getDocumentElement(element) {
49982
- return ((isElement$1(element) ? element.ownerDocument : (
50317
+ function getDocumentElement$1(element) {
50318
+ return ((isElement$2(element) ? element.ownerDocument : (
49983
50319
  // $FlowFixMe[prop-missing]
49984
50320
  element.document
49985
50321
  )) || window.document).documentElement;
49986
50322
  }
49987
50323
  function getParentNode$1(element) {
49988
- if (getNodeName(element) === "html") {
50324
+ if (getNodeName$1(element) === "html") {
49989
50325
  return element;
49990
50326
  }
49991
50327
  return (
@@ -49994,33 +50330,33 @@ function getParentNode$1(element) {
49994
50330
  // $FlowFixMe[prop-missing]
49995
50331
  element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
49996
50332
  element.parentNode || // DOM Element detected
49997
- (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
50333
+ (isShadowRoot$1(element) ? element.host : null) || // ShadowRoot detected
49998
50334
  // $FlowFixMe[incompatible-call]: HTMLElement is a Node
49999
- getDocumentElement(element)
50335
+ getDocumentElement$1(element)
50000
50336
  );
50001
50337
  }
50002
- function getTrueOffsetParent(element) {
50338
+ function getTrueOffsetParent$1(element) {
50003
50339
  if (!isHTMLElement$1(element) || // https://github.com/popperjs/popper-core/issues/837
50004
- getComputedStyle$1(element).position === "fixed") {
50340
+ getComputedStyle$2(element).position === "fixed") {
50005
50341
  return null;
50006
50342
  }
50007
50343
  return element.offsetParent;
50008
50344
  }
50009
- function getContainingBlock(element) {
50345
+ function getContainingBlock$1(element) {
50010
50346
  var isFirefox = /firefox/i.test(getUAString());
50011
50347
  var isIE = /Trident/i.test(getUAString());
50012
50348
  if (isIE && isHTMLElement$1(element)) {
50013
- var elementCss = getComputedStyle$1(element);
50349
+ var elementCss = getComputedStyle$2(element);
50014
50350
  if (elementCss.position === "fixed") {
50015
50351
  return null;
50016
50352
  }
50017
50353
  }
50018
50354
  var currentNode = getParentNode$1(element);
50019
- if (isShadowRoot(currentNode)) {
50355
+ if (isShadowRoot$1(currentNode)) {
50020
50356
  currentNode = currentNode.host;
50021
50357
  }
50022
- while (isHTMLElement$1(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
50023
- var css = getComputedStyle$1(currentNode);
50358
+ while (isHTMLElement$1(currentNode) && ["html", "body"].indexOf(getNodeName$1(currentNode)) < 0) {
50359
+ var css = getComputedStyle$2(currentNode);
50024
50360
  if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
50025
50361
  return currentNode;
50026
50362
  } else {
@@ -50029,22 +50365,22 @@ function getContainingBlock(element) {
50029
50365
  }
50030
50366
  return null;
50031
50367
  }
50032
- function getOffsetParent(element) {
50033
- var window2 = getWindow(element);
50034
- var offsetParent = getTrueOffsetParent(element);
50035
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
50036
- offsetParent = getTrueOffsetParent(offsetParent);
50368
+ function getOffsetParent$1(element) {
50369
+ var window2 = getWindow$1(element);
50370
+ var offsetParent = getTrueOffsetParent$1(element);
50371
+ while (offsetParent && isTableElement$1(offsetParent) && getComputedStyle$2(offsetParent).position === "static") {
50372
+ offsetParent = getTrueOffsetParent$1(offsetParent);
50037
50373
  }
50038
- if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
50374
+ if (offsetParent && (getNodeName$1(offsetParent) === "html" || getNodeName$1(offsetParent) === "body" && getComputedStyle$2(offsetParent).position === "static")) {
50039
50375
  return window2;
50040
50376
  }
50041
- return offsetParent || getContainingBlock(element) || window2;
50377
+ return offsetParent || getContainingBlock$1(element) || window2;
50042
50378
  }
50043
50379
  function getMainAxisFromPlacement(placement) {
50044
50380
  return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
50045
50381
  }
50046
- function within(min$12, value, max$12) {
50047
- return max(min$12, min(value, max$12));
50382
+ function within(min2, value, max2) {
50383
+ return max$1(min2, min$1(value, max2));
50048
50384
  }
50049
50385
  function withinMaxClamp(min2, value, max2) {
50050
50386
  var v = within(min2, value, max2);
@@ -50091,7 +50427,7 @@ function arrow(_ref) {
50091
50427
  var maxProp = axis === "y" ? bottom : right;
50092
50428
  var endDiff = state2.rects.reference[len] + state2.rects.reference[axis] - popperOffsets2[axis] - state2.rects.popper[len];
50093
50429
  var startDiff = popperOffsets2[axis] - state2.rects.reference[axis];
50094
- var arrowOffsetParent = getOffsetParent(arrowElement);
50430
+ var arrowOffsetParent = getOffsetParent$1(arrowElement);
50095
50431
  var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
50096
50432
  var centerToReference = endDiff / 2 - startDiff / 2;
50097
50433
  var min2 = paddingObject[minProp];
@@ -50140,8 +50476,8 @@ function roundOffsetsByDPR(_ref, win) {
50140
50476
  var x = _ref.x, y = _ref.y;
50141
50477
  var dpr = win.devicePixelRatio || 1;
50142
50478
  return {
50143
- x: round(x * dpr) / dpr || 0,
50144
- y: round(y * dpr) / dpr || 0
50479
+ x: round$1(x * dpr) / dpr || 0,
50480
+ y: round$1(y * dpr) / dpr || 0
50145
50481
  };
50146
50482
  }
50147
50483
  function mapToStyles(_ref2) {
@@ -50163,12 +50499,12 @@ function mapToStyles(_ref2) {
50163
50499
  var sideY = top;
50164
50500
  var win = window;
50165
50501
  if (adaptive) {
50166
- var offsetParent = getOffsetParent(popper2);
50502
+ var offsetParent = getOffsetParent$1(popper2);
50167
50503
  var heightProp = "clientHeight";
50168
50504
  var widthProp = "clientWidth";
50169
- if (offsetParent === getWindow(popper2)) {
50170
- offsetParent = getDocumentElement(popper2);
50171
- if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
50505
+ if (offsetParent === getWindow$1(popper2)) {
50506
+ offsetParent = getDocumentElement$1(popper2);
50507
+ if (getComputedStyle$2(offsetParent).position !== "static" && position === "absolute") {
50172
50508
  heightProp = "scrollHeight";
50173
50509
  widthProp = "scrollWidth";
50174
50510
  }
@@ -50199,7 +50535,7 @@ function mapToStyles(_ref2) {
50199
50535
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
50200
50536
  x,
50201
50537
  y
50202
- }, getWindow(popper2)) : {
50538
+ }, getWindow$1(popper2)) : {
50203
50539
  x,
50204
50540
  y
50205
50541
  };
@@ -50255,7 +50591,7 @@ var passive = {
50255
50591
  function effect(_ref) {
50256
50592
  var state2 = _ref.state, instance = _ref.instance, options2 = _ref.options;
50257
50593
  var _options$scroll = options2.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options2.resize, resize = _options$resize === void 0 ? true : _options$resize;
50258
- var window2 = getWindow(state2.elements.popper);
50594
+ var window2 = getWindow$1(state2.elements.popper);
50259
50595
  var scrollParents = [].concat(state2.scrollParents.reference, state2.scrollParents.popper);
50260
50596
  if (scroll) {
50261
50597
  scrollParents.forEach(function(scrollParent) {
@@ -50306,7 +50642,7 @@ function getOppositeVariationPlacement(placement) {
50306
50642
  });
50307
50643
  }
50308
50644
  function getWindowScroll(node2) {
50309
- var win = getWindow(node2);
50645
+ var win = getWindow$1(node2);
50310
50646
  var scrollLeft = win.pageXOffset;
50311
50647
  var scrollTop = win.pageYOffset;
50312
50648
  return {
@@ -50314,12 +50650,12 @@ function getWindowScroll(node2) {
50314
50650
  scrollTop
50315
50651
  };
50316
50652
  }
50317
- function getWindowScrollBarX(element) {
50318
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
50653
+ function getWindowScrollBarX$1(element) {
50654
+ return getBoundingClientRect$1(getDocumentElement$1(element)).left + getWindowScroll(element).scrollLeft;
50319
50655
  }
50320
- function getViewportRect(element, strategy) {
50321
- var win = getWindow(element);
50322
- var html = getDocumentElement(element);
50656
+ function getViewportRect$1(element, strategy) {
50657
+ var win = getWindow$1(element);
50658
+ var html = getDocumentElement$1(element);
50323
50659
  var visualViewport = win.visualViewport;
50324
50660
  var width = html.clientWidth;
50325
50661
  var height = html.clientHeight;
@@ -50337,21 +50673,21 @@ function getViewportRect(element, strategy) {
50337
50673
  return {
50338
50674
  width,
50339
50675
  height,
50340
- x: x + getWindowScrollBarX(element),
50676
+ x: x + getWindowScrollBarX$1(element),
50341
50677
  y
50342
50678
  };
50343
50679
  }
50344
- function getDocumentRect(element) {
50680
+ function getDocumentRect$1(element) {
50345
50681
  var _element$ownerDocumen;
50346
- var html = getDocumentElement(element);
50682
+ var html = getDocumentElement$1(element);
50347
50683
  var winScroll = getWindowScroll(element);
50348
50684
  var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
50349
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
50350
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
50351
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
50685
+ var width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
50686
+ var height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
50687
+ var x = -winScroll.scrollLeft + getWindowScrollBarX$1(element);
50352
50688
  var y = -winScroll.scrollTop;
50353
- if (getComputedStyle$1(body || html).direction === "rtl") {
50354
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
50689
+ if (getComputedStyle$2(body || html).direction === "rtl") {
50690
+ x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
50355
50691
  }
50356
50692
  return {
50357
50693
  width,
@@ -50361,11 +50697,11 @@ function getDocumentRect(element) {
50361
50697
  };
50362
50698
  }
50363
50699
  function isScrollParent(element) {
50364
- var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
50700
+ var _getComputedStyle = getComputedStyle$2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
50365
50701
  return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
50366
50702
  }
50367
50703
  function getScrollParent$1(node2) {
50368
- if (["html", "body", "#document"].indexOf(getNodeName(node2)) >= 0) {
50704
+ if (["html", "body", "#document"].indexOf(getNodeName$1(node2)) >= 0) {
50369
50705
  return node2.ownerDocument.body;
50370
50706
  }
50371
50707
  if (isHTMLElement$1(node2) && isScrollParent(node2)) {
@@ -50380,7 +50716,7 @@ function listScrollParents(element, list) {
50380
50716
  }
50381
50717
  var scrollParent = getScrollParent$1(element);
50382
50718
  var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
50383
- var win = getWindow(scrollParent);
50719
+ var win = getWindow$1(scrollParent);
50384
50720
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
50385
50721
  var updatedList = list.concat(target);
50386
50722
  return isBody ? updatedList : (
@@ -50388,7 +50724,7 @@ function listScrollParents(element, list) {
50388
50724
  updatedList.concat(listScrollParents(getParentNode$1(target)))
50389
50725
  );
50390
50726
  }
50391
- function rectToClientRect(rect) {
50727
+ function rectToClientRect$1(rect) {
50392
50728
  return Object.assign({}, rect, {
50393
50729
  left: rect.x,
50394
50730
  top: rect.y,
@@ -50396,8 +50732,8 @@ function rectToClientRect(rect) {
50396
50732
  bottom: rect.y + rect.height
50397
50733
  });
50398
50734
  }
50399
- function getInnerBoundingClientRect(element, strategy) {
50400
- var rect = getBoundingClientRect(element, false, strategy === "fixed");
50735
+ function getInnerBoundingClientRect$1(element, strategy) {
50736
+ var rect = getBoundingClientRect$1(element, false, strategy === "fixed");
50401
50737
  rect.top = rect.top + element.clientTop;
50402
50738
  rect.left = rect.left + element.clientLeft;
50403
50739
  rect.bottom = rect.top + element.clientHeight;
@@ -50409,29 +50745,29 @@ function getInnerBoundingClientRect(element, strategy) {
50409
50745
  return rect;
50410
50746
  }
50411
50747
  function getClientRectFromMixedType(element, clippingParent, strategy) {
50412
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
50748
+ return clippingParent === viewport ? rectToClientRect$1(getViewportRect$1(element, strategy)) : isElement$2(clippingParent) ? getInnerBoundingClientRect$1(clippingParent, strategy) : rectToClientRect$1(getDocumentRect$1(getDocumentElement$1(element)));
50413
50749
  }
50414
50750
  function getClippingParents(element) {
50415
50751
  var clippingParents2 = listScrollParents(getParentNode$1(element));
50416
- var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
50417
- var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent(element) : element;
50418
- if (!isElement$1(clipperElement)) {
50752
+ var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$2(element).position) >= 0;
50753
+ var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent$1(element) : element;
50754
+ if (!isElement$2(clipperElement)) {
50419
50755
  return [];
50420
50756
  }
50421
50757
  return clippingParents2.filter(function(clippingParent) {
50422
- return isElement$1(clippingParent) && contains$1(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
50758
+ return isElement$2(clippingParent) && contains$1(clippingParent, clipperElement) && getNodeName$1(clippingParent) !== "body";
50423
50759
  });
50424
50760
  }
50425
- function getClippingRect(element, boundary, rootBoundary, strategy) {
50761
+ function getClippingRect$1(element, boundary, rootBoundary, strategy) {
50426
50762
  var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
50427
50763
  var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
50428
50764
  var firstClippingParent = clippingParents2[0];
50429
50765
  var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
50430
50766
  var rect = getClientRectFromMixedType(element, clippingParent, strategy);
50431
- accRect.top = max(rect.top, accRect.top);
50432
- accRect.right = min(rect.right, accRect.right);
50433
- accRect.bottom = min(rect.bottom, accRect.bottom);
50434
- accRect.left = max(rect.left, accRect.left);
50767
+ accRect.top = max$1(rect.top, accRect.top);
50768
+ accRect.right = min$1(rect.right, accRect.right);
50769
+ accRect.bottom = min$1(rect.bottom, accRect.bottom);
50770
+ accRect.left = max$1(rect.left, accRect.left);
50435
50771
  return accRect;
50436
50772
  }, getClientRectFromMixedType(element, firstClippingParent, strategy));
50437
50773
  clippingRect.width = clippingRect.right - clippingRect.left;
@@ -50492,7 +50828,7 @@ function computeOffsets(_ref) {
50492
50828
  }
50493
50829
  return offsets;
50494
50830
  }
50495
- function detectOverflow(state2, options2) {
50831
+ function detectOverflow$1(state2, options2) {
50496
50832
  if (options2 === void 0) {
50497
50833
  options2 = {};
50498
50834
  }
@@ -50501,14 +50837,14 @@ function detectOverflow(state2, options2) {
50501
50837
  var altContext = elementContext === popper ? reference : popper;
50502
50838
  var popperRect = state2.rects.popper;
50503
50839
  var element = state2.elements[altBoundary ? altContext : elementContext];
50504
- var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state2.elements.popper), boundary, rootBoundary, strategy);
50505
- var referenceClientRect = getBoundingClientRect(state2.elements.reference);
50840
+ var clippingClientRect = getClippingRect$1(isElement$2(element) ? element : element.contextElement || getDocumentElement$1(state2.elements.popper), boundary, rootBoundary, strategy);
50841
+ var referenceClientRect = getBoundingClientRect$1(state2.elements.reference);
50506
50842
  var popperOffsets2 = computeOffsets({
50507
50843
  reference: referenceClientRect,
50508
50844
  element: popperRect,
50509
50845
  placement
50510
50846
  });
50511
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
50847
+ var popperClientRect = rectToClientRect$1(Object.assign({}, popperRect, popperOffsets2));
50512
50848
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
50513
50849
  var overflowOffsets = {
50514
50850
  top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
@@ -50543,7 +50879,7 @@ function computeAutoPlacement(state2, options2) {
50543
50879
  allowedPlacements = placements$1;
50544
50880
  }
50545
50881
  var overflows = allowedPlacements.reduce(function(acc, placement2) {
50546
- acc[placement2] = detectOverflow(state2, {
50882
+ acc[placement2] = detectOverflow$1(state2, {
50547
50883
  placement: placement2,
50548
50884
  boundary,
50549
50885
  rootBoundary,
@@ -50593,7 +50929,7 @@ function flip(_ref) {
50593
50929
  var isStartVariation = getVariation(placement) === start;
50594
50930
  var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
50595
50931
  var len = isVertical ? "width" : "height";
50596
- var overflow = detectOverflow(state2, {
50932
+ var overflow = detectOverflow$1(state2, {
50597
50933
  placement,
50598
50934
  boundary,
50599
50935
  rootBoundary,
@@ -50658,7 +50994,7 @@ const flip$1 = {
50658
50994
  _skip: false
50659
50995
  }
50660
50996
  };
50661
- function getSideOffsets(overflow, rect, preventedOffsets) {
50997
+ function getSideOffsets$1(overflow, rect, preventedOffsets) {
50662
50998
  if (preventedOffsets === void 0) {
50663
50999
  preventedOffsets = {
50664
51000
  x: 0,
@@ -50672,26 +51008,26 @@ function getSideOffsets(overflow, rect, preventedOffsets) {
50672
51008
  left: overflow.left - rect.width - preventedOffsets.x
50673
51009
  };
50674
51010
  }
50675
- function isAnySideFullyClipped(overflow) {
51011
+ function isAnySideFullyClipped$1(overflow) {
50676
51012
  return [top, right, bottom, left].some(function(side) {
50677
51013
  return overflow[side] >= 0;
50678
51014
  });
50679
51015
  }
50680
- function hide(_ref) {
51016
+ function hide$2(_ref) {
50681
51017
  var state2 = _ref.state, name = _ref.name;
50682
51018
  var referenceRect = state2.rects.reference;
50683
51019
  var popperRect = state2.rects.popper;
50684
51020
  var preventedOffsets = state2.modifiersData.preventOverflow;
50685
- var referenceOverflow = detectOverflow(state2, {
51021
+ var referenceOverflow = detectOverflow$1(state2, {
50686
51022
  elementContext: "reference"
50687
51023
  });
50688
- var popperAltOverflow = detectOverflow(state2, {
51024
+ var popperAltOverflow = detectOverflow$1(state2, {
50689
51025
  altBoundary: true
50690
51026
  });
50691
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
50692
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
50693
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
50694
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
51027
+ var referenceClippingOffsets = getSideOffsets$1(referenceOverflow, referenceRect);
51028
+ var popperEscapeOffsets = getSideOffsets$1(popperAltOverflow, popperRect, preventedOffsets);
51029
+ var isReferenceHidden = isAnySideFullyClipped$1(referenceClippingOffsets);
51030
+ var hasPopperEscaped = isAnySideFullyClipped$1(popperEscapeOffsets);
50695
51031
  state2.modifiersData[name] = {
50696
51032
  referenceClippingOffsets,
50697
51033
  popperEscapeOffsets,
@@ -50703,12 +51039,12 @@ function hide(_ref) {
50703
51039
  "data-popper-escaped": hasPopperEscaped
50704
51040
  });
50705
51041
  }
50706
- const hide$1 = {
51042
+ const hide$3 = {
50707
51043
  name: "hide",
50708
51044
  enabled: true,
50709
51045
  phase: "main",
50710
51046
  requiresIfExists: ["preventOverflow"],
50711
- fn: hide
51047
+ fn: hide$2
50712
51048
  };
50713
51049
  function distanceAndSkiddingToXY(placement, rects, offset2) {
50714
51050
  var basePlacement = getBasePlacement$1(placement);
@@ -50768,7 +51104,7 @@ function getAltAxis(axis) {
50768
51104
  function preventOverflow(_ref) {
50769
51105
  var state2 = _ref.state, options2 = _ref.options, name = _ref.name;
50770
51106
  var _options$mainAxis = options2.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options2.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options2.boundary, rootBoundary = options2.rootBoundary, altBoundary = options2.altBoundary, padding = options2.padding, _options$tether = options2.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options2.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
50771
- var overflow = detectOverflow(state2, {
51107
+ var overflow = detectOverflow$1(state2, {
50772
51108
  boundary,
50773
51109
  rootBoundary,
50774
51110
  padding,
@@ -50806,8 +51142,8 @@ function preventOverflow(_ref) {
50806
51142
  var altSide = mainAxis === "y" ? bottom : right;
50807
51143
  var len = mainAxis === "y" ? "height" : "width";
50808
51144
  var offset2 = popperOffsets2[mainAxis];
50809
- var min$12 = offset2 + overflow[mainSide];
50810
- var max$12 = offset2 - overflow[altSide];
51145
+ var min2 = offset2 + overflow[mainSide];
51146
+ var max2 = offset2 - overflow[altSide];
50811
51147
  var additive = tether ? -popperRect[len] / 2 : 0;
50812
51148
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
50813
51149
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
@@ -50822,12 +51158,12 @@ function preventOverflow(_ref) {
50822
51158
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
50823
51159
  var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
50824
51160
  var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
50825
- var arrowOffsetParent = state2.elements.arrow && getOffsetParent(state2.elements.arrow);
51161
+ var arrowOffsetParent = state2.elements.arrow && getOffsetParent$1(state2.elements.arrow);
50826
51162
  var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
50827
51163
  var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
50828
51164
  var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
50829
51165
  var tetherMax = offset2 + maxOffset - offsetModifierValue;
50830
- var preventedOffset = within(tether ? min(min$12, tetherMin) : min$12, offset2, tether ? max(max$12, tetherMax) : max$12);
51166
+ var preventedOffset = within(tether ? min$1(min2, tetherMin) : min2, offset2, tether ? max$1(max2, tetherMax) : max2);
50831
51167
  popperOffsets2[mainAxis] = preventedOffset;
50832
51168
  data[mainAxis] = preventedOffset - offset2;
50833
51169
  }
@@ -50862,8 +51198,8 @@ function getHTMLElementScroll(element) {
50862
51198
  scrollTop: element.scrollTop
50863
51199
  };
50864
51200
  }
50865
- function getNodeScroll(node2) {
50866
- if (node2 === getWindow(node2) || !isHTMLElement$1(node2)) {
51201
+ function getNodeScroll$1(node2) {
51202
+ if (node2 === getWindow$1(node2) || !isHTMLElement$1(node2)) {
50867
51203
  return getWindowScroll(node2);
50868
51204
  } else {
50869
51205
  return getHTMLElementScroll(node2);
@@ -50871,8 +51207,8 @@ function getNodeScroll(node2) {
50871
51207
  }
50872
51208
  function isElementScaled(element) {
50873
51209
  var rect = element.getBoundingClientRect();
50874
- var scaleX = round(rect.width) / element.offsetWidth || 1;
50875
- var scaleY = round(rect.height) / element.offsetHeight || 1;
51210
+ var scaleX = round$1(rect.width) / element.offsetWidth || 1;
51211
+ var scaleY = round$1(rect.height) / element.offsetHeight || 1;
50876
51212
  return scaleX !== 1 || scaleY !== 1;
50877
51213
  }
50878
51214
  function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
@@ -50881,8 +51217,8 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
50881
51217
  }
50882
51218
  var isOffsetParentAnElement = isHTMLElement$1(offsetParent);
50883
51219
  var offsetParentIsScaled = isHTMLElement$1(offsetParent) && isElementScaled(offsetParent);
50884
- var documentElement = getDocumentElement(offsetParent);
50885
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
51220
+ var documentElement = getDocumentElement$1(offsetParent);
51221
+ var rect = getBoundingClientRect$1(elementOrVirtualElement, offsetParentIsScaled, isFixed);
50886
51222
  var scroll = {
50887
51223
  scrollLeft: 0,
50888
51224
  scrollTop: 0
@@ -50892,16 +51228,16 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
50892
51228
  y: 0
50893
51229
  };
50894
51230
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
50895
- if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
51231
+ if (getNodeName$1(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
50896
51232
  isScrollParent(documentElement)) {
50897
- scroll = getNodeScroll(offsetParent);
51233
+ scroll = getNodeScroll$1(offsetParent);
50898
51234
  }
50899
51235
  if (isHTMLElement$1(offsetParent)) {
50900
- offsets = getBoundingClientRect(offsetParent, true);
51236
+ offsets = getBoundingClientRect$1(offsetParent, true);
50901
51237
  offsets.x += offsetParent.clientLeft;
50902
51238
  offsets.y += offsetParent.clientTop;
50903
51239
  } else if (documentElement) {
50904
- offsets.x = getWindowScrollBarX(documentElement);
51240
+ offsets.x = getWindowScrollBarX$1(documentElement);
50905
51241
  }
50906
51242
  }
50907
51243
  return {
@@ -51016,7 +51352,7 @@ function popperGenerator(generatorOptions) {
51016
51352
  cleanupModifierEffects();
51017
51353
  state2.options = Object.assign({}, defaultOptions, state2.options, options22);
51018
51354
  state2.scrollParents = {
51019
- reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
51355
+ reference: isElement$2(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
51020
51356
  popper: listScrollParents(popper2)
51021
51357
  };
51022
51358
  var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state2.options.modifiers)));
@@ -51040,7 +51376,7 @@ function popperGenerator(generatorOptions) {
51040
51376
  return;
51041
51377
  }
51042
51378
  state2.rects = {
51043
- reference: getCompositeRect(reference3, getOffsetParent(popper3), state2.options.strategy === "fixed"),
51379
+ reference: getCompositeRect(reference3, getOffsetParent$1(popper3), state2.options.strategy === "fixed"),
51044
51380
  popper: getLayoutRect(popper3)
51045
51381
  };
51046
51382
  state2.reset = false;
@@ -51111,7 +51447,7 @@ function popperGenerator(generatorOptions) {
51111
51447
  return instance;
51112
51448
  };
51113
51449
  }
51114
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
51450
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$3];
51115
51451
  var createPopper = /* @__PURE__ */ popperGenerator({
51116
51452
  defaultModifiers
51117
51453
  });
@@ -51196,7 +51532,7 @@ function removeUndefinedProps(obj) {
51196
51532
  function div() {
51197
51533
  return document.createElement("div");
51198
51534
  }
51199
- function isElement$2(value) {
51535
+ function isElement$1(value) {
51200
51536
  return ["Element", "Fragment"].some(function(type2) {
51201
51537
  return isType(value, type2);
51202
51538
  });
@@ -51211,7 +51547,7 @@ function isReferenceElement(value) {
51211
51547
  return !!(value && value._tippy && value._tippy.reference === value);
51212
51548
  }
51213
51549
  function getArrayOfElements(value) {
51214
- if (isElement$2(value)) {
51550
+ if (isElement$1(value)) {
51215
51551
  return [value];
51216
51552
  }
51217
51553
  if (isNodeList(value)) {
@@ -51520,7 +51856,7 @@ function createArrowElement(value) {
51520
51856
  arrow2.className = ARROW_CLASS;
51521
51857
  } else {
51522
51858
  arrow2.className = SVG_ARROW_CLASS;
51523
- if (isElement$2(value)) {
51859
+ if (isElement$1(value)) {
51524
51860
  arrow2.appendChild(value);
51525
51861
  } else {
51526
51862
  dangerouslySetInnerHTML(arrow2, value);
@@ -51529,7 +51865,7 @@ function createArrowElement(value) {
51529
51865
  return arrow2;
51530
51866
  }
51531
51867
  function setContent(content, props) {
51532
- if (isElement$2(props.content)) {
51868
+ if (isElement$1(props.content)) {
51533
51869
  dangerouslySetInnerHTML(content, "");
51534
51870
  content.appendChild(props.content);
51535
51871
  } else if (typeof props.content !== "function") {
@@ -52352,7 +52688,7 @@ function tippy(targets, optionalProps) {
52352
52688
  });
52353
52689
  var elements = getArrayOfElements(targets);
52354
52690
  if (process$1$1.env.NODE_ENV !== "production") {
52355
- var isSingleContentElement = isElement$2(passedProps.content);
52691
+ var isSingleContentElement = isElement$1(passedProps.content);
52356
52692
  var isMoreThanOneReferenceElement = elements.length > 1;
52357
52693
  warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ["tippy() was passed an Element as the `content` prop, but more than", "one tippy instance was created by this invocation. This means the", "content element will only be appended to the last tippy instance.", "\n\n", "Instead, pass the .innerHTML of the element, or use a function that", "returns a cloned version of the element instead.", "\n\n", "1) content: element.innerHTML\n", "2) content: () => element.cloneNode(true)"].join(" "));
52358
52694
  }
@@ -52363,7 +52699,7 @@ function tippy(targets, optionalProps) {
52363
52699
  }
52364
52700
  return acc;
52365
52701
  }, []);
52366
- return isElement$2(targets) ? instances[0] : instances;
52702
+ return isElement$1(targets) ? instances[0] : instances;
52367
52703
  }
52368
52704
  tippy.defaultProps = defaultProps;
52369
52705
  tippy.setDefaultProps = setDefaultProps;
@@ -52632,7 +52968,1067 @@ class Popover {
52632
52968
  this.popover.remove();
52633
52969
  }
52634
52970
  }
52971
+ const sides = ["top", "right", "bottom", "left"];
52972
+ const min = Math.min;
52973
+ const max = Math.max;
52974
+ const round = Math.round;
52975
+ const floor = Math.floor;
52976
+ const createCoords = (v) => ({
52977
+ x: v,
52978
+ y: v
52979
+ });
52980
+ function evaluate(value, param) {
52981
+ return typeof value === "function" ? value(param) : value;
52982
+ }
52983
+ function getSide(placement) {
52984
+ return placement.split("-")[0];
52985
+ }
52986
+ function getAlignment(placement) {
52987
+ return placement.split("-")[1];
52988
+ }
52989
+ function getOppositeAxis(axis) {
52990
+ return axis === "x" ? "y" : "x";
52991
+ }
52992
+ function getAxisLength(axis) {
52993
+ return axis === "y" ? "height" : "width";
52994
+ }
52995
+ function getSideAxis(placement) {
52996
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
52997
+ }
52998
+ function getAlignmentAxis(placement) {
52999
+ return getOppositeAxis(getSideAxis(placement));
53000
+ }
53001
+ function expandPaddingObject(padding) {
53002
+ return {
53003
+ top: 0,
53004
+ right: 0,
53005
+ bottom: 0,
53006
+ left: 0,
53007
+ ...padding
53008
+ };
53009
+ }
53010
+ function getPaddingObject(padding) {
53011
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
53012
+ top: padding,
53013
+ right: padding,
53014
+ bottom: padding,
53015
+ left: padding
53016
+ };
53017
+ }
53018
+ function rectToClientRect(rect) {
53019
+ const {
53020
+ x,
53021
+ y,
53022
+ width,
53023
+ height
53024
+ } = rect;
53025
+ return {
53026
+ width,
53027
+ height,
53028
+ top: y,
53029
+ left: x,
53030
+ right: x + width,
53031
+ bottom: y + height,
53032
+ x,
53033
+ y
53034
+ };
53035
+ }
53036
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
53037
+ let {
53038
+ reference: reference2,
53039
+ floating
53040
+ } = _ref;
53041
+ const sideAxis = getSideAxis(placement);
53042
+ const alignmentAxis = getAlignmentAxis(placement);
53043
+ const alignLength = getAxisLength(alignmentAxis);
53044
+ const side = getSide(placement);
53045
+ const isVertical = sideAxis === "y";
53046
+ const commonX = reference2.x + reference2.width / 2 - floating.width / 2;
53047
+ const commonY = reference2.y + reference2.height / 2 - floating.height / 2;
53048
+ const commonAlign = reference2[alignLength] / 2 - floating[alignLength] / 2;
53049
+ let coords;
53050
+ switch (side) {
53051
+ case "top":
53052
+ coords = {
53053
+ x: commonX,
53054
+ y: reference2.y - floating.height
53055
+ };
53056
+ break;
53057
+ case "bottom":
53058
+ coords = {
53059
+ x: commonX,
53060
+ y: reference2.y + reference2.height
53061
+ };
53062
+ break;
53063
+ case "right":
53064
+ coords = {
53065
+ x: reference2.x + reference2.width,
53066
+ y: commonY
53067
+ };
53068
+ break;
53069
+ case "left":
53070
+ coords = {
53071
+ x: reference2.x - floating.width,
53072
+ y: commonY
53073
+ };
53074
+ break;
53075
+ default:
53076
+ coords = {
53077
+ x: reference2.x,
53078
+ y: reference2.y
53079
+ };
53080
+ }
53081
+ switch (getAlignment(placement)) {
53082
+ case "start":
53083
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
53084
+ break;
53085
+ case "end":
53086
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
53087
+ break;
53088
+ }
53089
+ return coords;
53090
+ }
53091
+ const computePosition$1 = async (reference2, floating, config) => {
53092
+ const {
53093
+ placement = "bottom",
53094
+ strategy = "absolute",
53095
+ middleware = [],
53096
+ platform: platform2
53097
+ } = config;
53098
+ const validMiddleware = middleware.filter(Boolean);
53099
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
53100
+ let rects = await platform2.getElementRects({
53101
+ reference: reference2,
53102
+ floating,
53103
+ strategy
53104
+ });
53105
+ let {
53106
+ x,
53107
+ y
53108
+ } = computeCoordsFromPlacement(rects, placement, rtl);
53109
+ let statefulPlacement = placement;
53110
+ let middlewareData = {};
53111
+ let resetCount = 0;
53112
+ for (let i = 0; i < validMiddleware.length; i++) {
53113
+ const {
53114
+ name,
53115
+ fn: fn2
53116
+ } = validMiddleware[i];
53117
+ const {
53118
+ x: nextX,
53119
+ y: nextY,
53120
+ data,
53121
+ reset
53122
+ } = await fn2({
53123
+ x,
53124
+ y,
53125
+ initialPlacement: placement,
53126
+ placement: statefulPlacement,
53127
+ strategy,
53128
+ middlewareData,
53129
+ rects,
53130
+ platform: platform2,
53131
+ elements: {
53132
+ reference: reference2,
53133
+ floating
53134
+ }
53135
+ });
53136
+ x = nextX != null ? nextX : x;
53137
+ y = nextY != null ? nextY : y;
53138
+ middlewareData = {
53139
+ ...middlewareData,
53140
+ [name]: {
53141
+ ...middlewareData[name],
53142
+ ...data
53143
+ }
53144
+ };
53145
+ if (reset && resetCount <= 50) {
53146
+ resetCount++;
53147
+ if (typeof reset === "object") {
53148
+ if (reset.placement) {
53149
+ statefulPlacement = reset.placement;
53150
+ }
53151
+ if (reset.rects) {
53152
+ rects = reset.rects === true ? await platform2.getElementRects({
53153
+ reference: reference2,
53154
+ floating,
53155
+ strategy
53156
+ }) : reset.rects;
53157
+ }
53158
+ ({
53159
+ x,
53160
+ y
53161
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
53162
+ }
53163
+ i = -1;
53164
+ }
53165
+ }
53166
+ return {
53167
+ x,
53168
+ y,
53169
+ placement: statefulPlacement,
53170
+ strategy,
53171
+ middlewareData
53172
+ };
53173
+ };
53174
+ async function detectOverflow(state2, options2) {
53175
+ var _await$platform$isEle;
53176
+ if (options2 === void 0) {
53177
+ options2 = {};
53178
+ }
53179
+ const {
53180
+ x,
53181
+ y,
53182
+ platform: platform2,
53183
+ rects,
53184
+ elements,
53185
+ strategy
53186
+ } = state2;
53187
+ const {
53188
+ boundary = "clippingAncestors",
53189
+ rootBoundary = "viewport",
53190
+ elementContext = "floating",
53191
+ altBoundary = false,
53192
+ padding = 0
53193
+ } = evaluate(options2, state2);
53194
+ const paddingObject = getPaddingObject(padding);
53195
+ const altContext = elementContext === "floating" ? "reference" : "floating";
53196
+ const element = elements[altBoundary ? altContext : elementContext];
53197
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
53198
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
53199
+ boundary,
53200
+ rootBoundary,
53201
+ strategy
53202
+ }));
53203
+ const rect = elementContext === "floating" ? {
53204
+ x,
53205
+ y,
53206
+ width: rects.floating.width,
53207
+ height: rects.floating.height
53208
+ } : rects.reference;
53209
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
53210
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
53211
+ x: 1,
53212
+ y: 1
53213
+ } : {
53214
+ x: 1,
53215
+ y: 1
53216
+ };
53217
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
53218
+ elements,
53219
+ rect,
53220
+ offsetParent,
53221
+ strategy
53222
+ }) : rect);
53223
+ return {
53224
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
53225
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
53226
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
53227
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
53228
+ };
53229
+ }
53230
+ function getSideOffsets(overflow, rect) {
53231
+ return {
53232
+ top: overflow.top - rect.height,
53233
+ right: overflow.right - rect.width,
53234
+ bottom: overflow.bottom - rect.height,
53235
+ left: overflow.left - rect.width
53236
+ };
53237
+ }
53238
+ function isAnySideFullyClipped(overflow) {
53239
+ return sides.some((side) => overflow[side] >= 0);
53240
+ }
53241
+ const hide$1 = function(options2) {
53242
+ if (options2 === void 0) {
53243
+ options2 = {};
53244
+ }
53245
+ return {
53246
+ name: "hide",
53247
+ options: options2,
53248
+ async fn(state2) {
53249
+ const {
53250
+ rects
53251
+ } = state2;
53252
+ const {
53253
+ strategy = "referenceHidden",
53254
+ ...detectOverflowOptions
53255
+ } = evaluate(options2, state2);
53256
+ switch (strategy) {
53257
+ case "referenceHidden": {
53258
+ const overflow = await detectOverflow(state2, {
53259
+ ...detectOverflowOptions,
53260
+ elementContext: "reference"
53261
+ });
53262
+ const offsets = getSideOffsets(overflow, rects.reference);
53263
+ return {
53264
+ data: {
53265
+ referenceHiddenOffsets: offsets,
53266
+ referenceHidden: isAnySideFullyClipped(offsets)
53267
+ }
53268
+ };
53269
+ }
53270
+ case "escaped": {
53271
+ const overflow = await detectOverflow(state2, {
53272
+ ...detectOverflowOptions,
53273
+ altBoundary: true
53274
+ });
53275
+ const offsets = getSideOffsets(overflow, rects.floating);
53276
+ return {
53277
+ data: {
53278
+ escapedOffsets: offsets,
53279
+ escaped: isAnySideFullyClipped(offsets)
53280
+ }
53281
+ };
53282
+ }
53283
+ default: {
53284
+ return {};
53285
+ }
53286
+ }
53287
+ }
53288
+ };
53289
+ };
53290
+ function hasWindow() {
53291
+ return typeof window !== "undefined";
53292
+ }
53293
+ function getNodeName(node2) {
53294
+ if (isNode(node2)) {
53295
+ return (node2.nodeName || "").toLowerCase();
53296
+ }
53297
+ return "#document";
53298
+ }
53299
+ function getWindow(node2) {
53300
+ var _node$ownerDocument;
53301
+ return (node2 == null || (_node$ownerDocument = node2.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
53302
+ }
53303
+ function getDocumentElement(node2) {
53304
+ var _ref;
53305
+ return (_ref = (isNode(node2) ? node2.ownerDocument : node2.document) || window.document) == null ? void 0 : _ref.documentElement;
53306
+ }
53307
+ function isNode(value) {
53308
+ if (!hasWindow()) {
53309
+ return false;
53310
+ }
53311
+ return value instanceof Node || value instanceof getWindow(value).Node;
53312
+ }
53313
+ function isElement$3(value) {
53314
+ if (!hasWindow()) {
53315
+ return false;
53316
+ }
53317
+ return value instanceof Element || value instanceof getWindow(value).Element;
53318
+ }
53319
+ function isHTMLElement$2(value) {
53320
+ if (!hasWindow()) {
53321
+ return false;
53322
+ }
53323
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
53324
+ }
53325
+ function isShadowRoot(value) {
53326
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
53327
+ return false;
53328
+ }
53329
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
53330
+ }
53331
+ function isOverflowElement(element) {
53332
+ const {
53333
+ overflow,
53334
+ overflowX,
53335
+ overflowY,
53336
+ display
53337
+ } = getComputedStyle$1(element);
53338
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
53339
+ }
53340
+ function isTableElement(element) {
53341
+ return ["table", "td", "th"].includes(getNodeName(element));
53342
+ }
53343
+ function isTopLayer(element) {
53344
+ return [":popover-open", ":modal"].some((selector) => {
53345
+ try {
53346
+ return element.matches(selector);
53347
+ } catch (e) {
53348
+ return false;
53349
+ }
53350
+ });
53351
+ }
53352
+ function isContainingBlock(elementOrCss) {
53353
+ const webkit2 = isWebKit();
53354
+ const css = isElement$3(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
53355
+ return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit2 && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit2 && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
53356
+ }
53357
+ function getContainingBlock(element) {
53358
+ let currentNode = getParentNode$2(element);
53359
+ while (isHTMLElement$2(currentNode) && !isLastTraversableNode(currentNode)) {
53360
+ if (isContainingBlock(currentNode)) {
53361
+ return currentNode;
53362
+ } else if (isTopLayer(currentNode)) {
53363
+ return null;
53364
+ }
53365
+ currentNode = getParentNode$2(currentNode);
53366
+ }
53367
+ return null;
53368
+ }
53369
+ function isWebKit() {
53370
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
53371
+ return CSS.supports("-webkit-backdrop-filter", "none");
53372
+ }
53373
+ function isLastTraversableNode(node2) {
53374
+ return ["html", "body", "#document"].includes(getNodeName(node2));
53375
+ }
53376
+ function getComputedStyle$1(element) {
53377
+ return getWindow(element).getComputedStyle(element);
53378
+ }
53379
+ function getNodeScroll(element) {
53380
+ if (isElement$3(element)) {
53381
+ return {
53382
+ scrollLeft: element.scrollLeft,
53383
+ scrollTop: element.scrollTop
53384
+ };
53385
+ }
53386
+ return {
53387
+ scrollLeft: element.scrollX,
53388
+ scrollTop: element.scrollY
53389
+ };
53390
+ }
53391
+ function getParentNode$2(node2) {
53392
+ if (getNodeName(node2) === "html") {
53393
+ return node2;
53394
+ }
53395
+ const result = (
53396
+ // Step into the shadow DOM of the parent of a slotted node.
53397
+ node2.assignedSlot || // DOM Element detected.
53398
+ node2.parentNode || // ShadowRoot detected.
53399
+ isShadowRoot(node2) && node2.host || // Fallback.
53400
+ getDocumentElement(node2)
53401
+ );
53402
+ return isShadowRoot(result) ? result.host : result;
53403
+ }
53404
+ function getNearestOverflowAncestor(node2) {
53405
+ const parentNode2 = getParentNode$2(node2);
53406
+ if (isLastTraversableNode(parentNode2)) {
53407
+ return node2.ownerDocument ? node2.ownerDocument.body : node2.body;
53408
+ }
53409
+ if (isHTMLElement$2(parentNode2) && isOverflowElement(parentNode2)) {
53410
+ return parentNode2;
53411
+ }
53412
+ return getNearestOverflowAncestor(parentNode2);
53413
+ }
53414
+ function getOverflowAncestors(node2, list, traverseIframes) {
53415
+ var _node$ownerDocument2;
53416
+ if (list === void 0) {
53417
+ list = [];
53418
+ }
53419
+ if (traverseIframes === void 0) {
53420
+ traverseIframes = true;
53421
+ }
53422
+ const scrollableAncestor = getNearestOverflowAncestor(node2);
53423
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node2.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
53424
+ const win = getWindow(scrollableAncestor);
53425
+ if (isBody) {
53426
+ const frameElement = getFrameElement(win);
53427
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
53428
+ }
53429
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
53430
+ }
53431
+ function getFrameElement(win) {
53432
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
53433
+ }
53434
+ function getCssDimensions(element) {
53435
+ const css = getComputedStyle$1(element);
53436
+ let width = parseFloat(css.width) || 0;
53437
+ let height = parseFloat(css.height) || 0;
53438
+ const hasOffset = isHTMLElement$2(element);
53439
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
53440
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
53441
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
53442
+ if (shouldFallback) {
53443
+ width = offsetWidth;
53444
+ height = offsetHeight;
53445
+ }
53446
+ return {
53447
+ width,
53448
+ height,
53449
+ $: shouldFallback
53450
+ };
53451
+ }
53452
+ function unwrapElement(element) {
53453
+ return !isElement$3(element) ? element.contextElement : element;
53454
+ }
53455
+ function getScale(element) {
53456
+ const domElement = unwrapElement(element);
53457
+ if (!isHTMLElement$2(domElement)) {
53458
+ return createCoords(1);
53459
+ }
53460
+ const rect = domElement.getBoundingClientRect();
53461
+ const {
53462
+ width,
53463
+ height,
53464
+ $
53465
+ } = getCssDimensions(domElement);
53466
+ let x = ($ ? round(rect.width) : rect.width) / width;
53467
+ let y = ($ ? round(rect.height) : rect.height) / height;
53468
+ if (!x || !Number.isFinite(x)) {
53469
+ x = 1;
53470
+ }
53471
+ if (!y || !Number.isFinite(y)) {
53472
+ y = 1;
53473
+ }
53474
+ return {
53475
+ x,
53476
+ y
53477
+ };
53478
+ }
53479
+ const noOffsets = /* @__PURE__ */ createCoords(0);
53480
+ function getVisualOffsets(element) {
53481
+ const win = getWindow(element);
53482
+ if (!isWebKit() || !win.visualViewport) {
53483
+ return noOffsets;
53484
+ }
53485
+ return {
53486
+ x: win.visualViewport.offsetLeft,
53487
+ y: win.visualViewport.offsetTop
53488
+ };
53489
+ }
53490
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
53491
+ if (isFixed === void 0) {
53492
+ isFixed = false;
53493
+ }
53494
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
53495
+ return false;
53496
+ }
53497
+ return isFixed;
53498
+ }
53499
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
53500
+ if (includeScale === void 0) {
53501
+ includeScale = false;
53502
+ }
53503
+ if (isFixedStrategy === void 0) {
53504
+ isFixedStrategy = false;
53505
+ }
53506
+ const clientRect2 = element.getBoundingClientRect();
53507
+ const domElement = unwrapElement(element);
53508
+ let scale = createCoords(1);
53509
+ if (includeScale) {
53510
+ if (offsetParent) {
53511
+ if (isElement$3(offsetParent)) {
53512
+ scale = getScale(offsetParent);
53513
+ }
53514
+ } else {
53515
+ scale = getScale(element);
53516
+ }
53517
+ }
53518
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
53519
+ let x = (clientRect2.left + visualOffsets.x) / scale.x;
53520
+ let y = (clientRect2.top + visualOffsets.y) / scale.y;
53521
+ let width = clientRect2.width / scale.x;
53522
+ let height = clientRect2.height / scale.y;
53523
+ if (domElement) {
53524
+ const win = getWindow(domElement);
53525
+ const offsetWin = offsetParent && isElement$3(offsetParent) ? getWindow(offsetParent) : offsetParent;
53526
+ let currentWin = win;
53527
+ let currentIFrame = getFrameElement(currentWin);
53528
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
53529
+ const iframeScale = getScale(currentIFrame);
53530
+ const iframeRect = currentIFrame.getBoundingClientRect();
53531
+ const css = getComputedStyle$1(currentIFrame);
53532
+ const left2 = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
53533
+ const top2 = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
53534
+ x *= iframeScale.x;
53535
+ y *= iframeScale.y;
53536
+ width *= iframeScale.x;
53537
+ height *= iframeScale.y;
53538
+ x += left2;
53539
+ y += top2;
53540
+ currentWin = getWindow(currentIFrame);
53541
+ currentIFrame = getFrameElement(currentWin);
53542
+ }
53543
+ }
53544
+ return rectToClientRect({
53545
+ width,
53546
+ height,
53547
+ x,
53548
+ y
53549
+ });
53550
+ }
53551
+ function getWindowScrollBarX(element, rect) {
53552
+ const leftScroll = getNodeScroll(element).scrollLeft;
53553
+ if (!rect) {
53554
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
53555
+ }
53556
+ return rect.left + leftScroll;
53557
+ }
53558
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
53559
+ if (ignoreScrollbarX === void 0) {
53560
+ ignoreScrollbarX = false;
53561
+ }
53562
+ const htmlRect = documentElement.getBoundingClientRect();
53563
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
53564
+ // RTL <body> scrollbar.
53565
+ getWindowScrollBarX(documentElement, htmlRect)
53566
+ ));
53567
+ const y = htmlRect.top + scroll.scrollTop;
53568
+ return {
53569
+ x,
53570
+ y
53571
+ };
53572
+ }
53573
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
53574
+ let {
53575
+ elements,
53576
+ rect,
53577
+ offsetParent,
53578
+ strategy
53579
+ } = _ref;
53580
+ const isFixed = strategy === "fixed";
53581
+ const documentElement = getDocumentElement(offsetParent);
53582
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
53583
+ if (offsetParent === documentElement || topLayer && isFixed) {
53584
+ return rect;
53585
+ }
53586
+ let scroll = {
53587
+ scrollLeft: 0,
53588
+ scrollTop: 0
53589
+ };
53590
+ let scale = createCoords(1);
53591
+ const offsets = createCoords(0);
53592
+ const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
53593
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
53594
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
53595
+ scroll = getNodeScroll(offsetParent);
53596
+ }
53597
+ if (isHTMLElement$2(offsetParent)) {
53598
+ const offsetRect = getBoundingClientRect(offsetParent);
53599
+ scale = getScale(offsetParent);
53600
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
53601
+ offsets.y = offsetRect.y + offsetParent.clientTop;
53602
+ }
53603
+ }
53604
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
53605
+ return {
53606
+ width: rect.width * scale.x,
53607
+ height: rect.height * scale.y,
53608
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
53609
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
53610
+ };
53611
+ }
53612
+ function getClientRects(element) {
53613
+ return Array.from(element.getClientRects());
53614
+ }
53615
+ function getDocumentRect(element) {
53616
+ const html = getDocumentElement(element);
53617
+ const scroll = getNodeScroll(element);
53618
+ const body = element.ownerDocument.body;
53619
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
53620
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
53621
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
53622
+ const y = -scroll.scrollTop;
53623
+ if (getComputedStyle$1(body).direction === "rtl") {
53624
+ x += max(html.clientWidth, body.clientWidth) - width;
53625
+ }
53626
+ return {
53627
+ width,
53628
+ height,
53629
+ x,
53630
+ y
53631
+ };
53632
+ }
53633
+ function getViewportRect(element, strategy) {
53634
+ const win = getWindow(element);
53635
+ const html = getDocumentElement(element);
53636
+ const visualViewport = win.visualViewport;
53637
+ let width = html.clientWidth;
53638
+ let height = html.clientHeight;
53639
+ let x = 0;
53640
+ let y = 0;
53641
+ if (visualViewport) {
53642
+ width = visualViewport.width;
53643
+ height = visualViewport.height;
53644
+ const visualViewportBased = isWebKit();
53645
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
53646
+ x = visualViewport.offsetLeft;
53647
+ y = visualViewport.offsetTop;
53648
+ }
53649
+ }
53650
+ return {
53651
+ width,
53652
+ height,
53653
+ x,
53654
+ y
53655
+ };
53656
+ }
53657
+ function getInnerBoundingClientRect(element, strategy) {
53658
+ const clientRect2 = getBoundingClientRect(element, true, strategy === "fixed");
53659
+ const top2 = clientRect2.top + element.clientTop;
53660
+ const left2 = clientRect2.left + element.clientLeft;
53661
+ const scale = isHTMLElement$2(element) ? getScale(element) : createCoords(1);
53662
+ const width = element.clientWidth * scale.x;
53663
+ const height = element.clientHeight * scale.y;
53664
+ const x = left2 * scale.x;
53665
+ const y = top2 * scale.y;
53666
+ return {
53667
+ width,
53668
+ height,
53669
+ x,
53670
+ y
53671
+ };
53672
+ }
53673
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
53674
+ let rect;
53675
+ if (clippingAncestor === "viewport") {
53676
+ rect = getViewportRect(element, strategy);
53677
+ } else if (clippingAncestor === "document") {
53678
+ rect = getDocumentRect(getDocumentElement(element));
53679
+ } else if (isElement$3(clippingAncestor)) {
53680
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
53681
+ } else {
53682
+ const visualOffsets = getVisualOffsets(element);
53683
+ rect = {
53684
+ x: clippingAncestor.x - visualOffsets.x,
53685
+ y: clippingAncestor.y - visualOffsets.y,
53686
+ width: clippingAncestor.width,
53687
+ height: clippingAncestor.height
53688
+ };
53689
+ }
53690
+ return rectToClientRect(rect);
53691
+ }
53692
+ function hasFixedPositionAncestor(element, stopNode) {
53693
+ const parentNode2 = getParentNode$2(element);
53694
+ if (parentNode2 === stopNode || !isElement$3(parentNode2) || isLastTraversableNode(parentNode2)) {
53695
+ return false;
53696
+ }
53697
+ return getComputedStyle$1(parentNode2).position === "fixed" || hasFixedPositionAncestor(parentNode2, stopNode);
53698
+ }
53699
+ function getClippingElementAncestors(element, cache2) {
53700
+ const cachedResult2 = cache2.get(element);
53701
+ if (cachedResult2) {
53702
+ return cachedResult2;
53703
+ }
53704
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement$3(el) && getNodeName(el) !== "body");
53705
+ let currentContainingBlockComputedStyle = null;
53706
+ const elementIsFixed = getComputedStyle$1(element).position === "fixed";
53707
+ let currentNode = elementIsFixed ? getParentNode$2(element) : element;
53708
+ while (isElement$3(currentNode) && !isLastTraversableNode(currentNode)) {
53709
+ const computedStyle = getComputedStyle$1(currentNode);
53710
+ const currentNodeIsContaining = isContainingBlock(currentNode);
53711
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
53712
+ currentContainingBlockComputedStyle = null;
53713
+ }
53714
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
53715
+ if (shouldDropCurrentNode) {
53716
+ result = result.filter((ancestor) => ancestor !== currentNode);
53717
+ } else {
53718
+ currentContainingBlockComputedStyle = computedStyle;
53719
+ }
53720
+ currentNode = getParentNode$2(currentNode);
53721
+ }
53722
+ cache2.set(element, result);
53723
+ return result;
53724
+ }
53725
+ function getClippingRect(_ref) {
53726
+ let {
53727
+ element,
53728
+ boundary,
53729
+ rootBoundary,
53730
+ strategy
53731
+ } = _ref;
53732
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
53733
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
53734
+ const firstClippingAncestor = clippingAncestors[0];
53735
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
53736
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
53737
+ accRect.top = max(rect.top, accRect.top);
53738
+ accRect.right = min(rect.right, accRect.right);
53739
+ accRect.bottom = min(rect.bottom, accRect.bottom);
53740
+ accRect.left = max(rect.left, accRect.left);
53741
+ return accRect;
53742
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
53743
+ return {
53744
+ width: clippingRect.right - clippingRect.left,
53745
+ height: clippingRect.bottom - clippingRect.top,
53746
+ x: clippingRect.left,
53747
+ y: clippingRect.top
53748
+ };
53749
+ }
53750
+ function getDimensions(element) {
53751
+ const {
53752
+ width,
53753
+ height
53754
+ } = getCssDimensions(element);
53755
+ return {
53756
+ width,
53757
+ height
53758
+ };
53759
+ }
53760
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
53761
+ const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
53762
+ const documentElement = getDocumentElement(offsetParent);
53763
+ const isFixed = strategy === "fixed";
53764
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
53765
+ let scroll = {
53766
+ scrollLeft: 0,
53767
+ scrollTop: 0
53768
+ };
53769
+ const offsets = createCoords(0);
53770
+ function setLeftRTLScrollbarOffset() {
53771
+ offsets.x = getWindowScrollBarX(documentElement);
53772
+ }
53773
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
53774
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
53775
+ scroll = getNodeScroll(offsetParent);
53776
+ }
53777
+ if (isOffsetParentAnElement) {
53778
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
53779
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
53780
+ offsets.y = offsetRect.y + offsetParent.clientTop;
53781
+ } else if (documentElement) {
53782
+ setLeftRTLScrollbarOffset();
53783
+ }
53784
+ }
53785
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
53786
+ setLeftRTLScrollbarOffset();
53787
+ }
53788
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
53789
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
53790
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
53791
+ return {
53792
+ x,
53793
+ y,
53794
+ width: rect.width,
53795
+ height: rect.height
53796
+ };
53797
+ }
53798
+ function isStaticPositioned(element) {
53799
+ return getComputedStyle$1(element).position === "static";
53800
+ }
53801
+ function getTrueOffsetParent(element, polyfill) {
53802
+ if (!isHTMLElement$2(element) || getComputedStyle$1(element).position === "fixed") {
53803
+ return null;
53804
+ }
53805
+ if (polyfill) {
53806
+ return polyfill(element);
53807
+ }
53808
+ let rawOffsetParent = element.offsetParent;
53809
+ if (getDocumentElement(element) === rawOffsetParent) {
53810
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
53811
+ }
53812
+ return rawOffsetParent;
53813
+ }
53814
+ function getOffsetParent(element, polyfill) {
53815
+ const win = getWindow(element);
53816
+ if (isTopLayer(element)) {
53817
+ return win;
53818
+ }
53819
+ if (!isHTMLElement$2(element)) {
53820
+ let svgOffsetParent = getParentNode$2(element);
53821
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
53822
+ if (isElement$3(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
53823
+ return svgOffsetParent;
53824
+ }
53825
+ svgOffsetParent = getParentNode$2(svgOffsetParent);
53826
+ }
53827
+ return win;
53828
+ }
53829
+ let offsetParent = getTrueOffsetParent(element, polyfill);
53830
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
53831
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
53832
+ }
53833
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
53834
+ return win;
53835
+ }
53836
+ return offsetParent || getContainingBlock(element) || win;
53837
+ }
53838
+ const getElementRects = async function(data) {
53839
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
53840
+ const getDimensionsFn = this.getDimensions;
53841
+ const floatingDimensions = await getDimensionsFn(data.floating);
53842
+ return {
53843
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
53844
+ floating: {
53845
+ x: 0,
53846
+ y: 0,
53847
+ width: floatingDimensions.width,
53848
+ height: floatingDimensions.height
53849
+ }
53850
+ };
53851
+ };
53852
+ function isRTL(element) {
53853
+ return getComputedStyle$1(element).direction === "rtl";
53854
+ }
53855
+ const platform = {
53856
+ convertOffsetParentRelativeRectToViewportRelativeRect,
53857
+ getDocumentElement,
53858
+ getClippingRect,
53859
+ getOffsetParent,
53860
+ getElementRects,
53861
+ getClientRects,
53862
+ getDimensions,
53863
+ getScale,
53864
+ isElement: isElement$3,
53865
+ isRTL
53866
+ };
53867
+ function rectsAreEqual(a, b) {
53868
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
53869
+ }
53870
+ function observeMove(element, onMove) {
53871
+ let io = null;
53872
+ let timeoutId;
53873
+ const root2 = getDocumentElement(element);
53874
+ function cleanup() {
53875
+ var _io;
53876
+ clearTimeout(timeoutId);
53877
+ (_io = io) == null || _io.disconnect();
53878
+ io = null;
53879
+ }
53880
+ function refresh(skip, threshold) {
53881
+ if (skip === void 0) {
53882
+ skip = false;
53883
+ }
53884
+ if (threshold === void 0) {
53885
+ threshold = 1;
53886
+ }
53887
+ cleanup();
53888
+ const elementRectForRootMargin = element.getBoundingClientRect();
53889
+ const {
53890
+ left: left2,
53891
+ top: top2,
53892
+ width,
53893
+ height
53894
+ } = elementRectForRootMargin;
53895
+ if (!skip) {
53896
+ onMove();
53897
+ }
53898
+ if (!width || !height) {
53899
+ return;
53900
+ }
53901
+ const insetTop = floor(top2);
53902
+ const insetRight = floor(root2.clientWidth - (left2 + width));
53903
+ const insetBottom = floor(root2.clientHeight - (top2 + height));
53904
+ const insetLeft = floor(left2);
53905
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
53906
+ const options2 = {
53907
+ rootMargin,
53908
+ threshold: max(0, min(1, threshold)) || 1
53909
+ };
53910
+ let isFirstUpdate = true;
53911
+ function handleObserve(entries) {
53912
+ const ratio = entries[0].intersectionRatio;
53913
+ if (ratio !== threshold) {
53914
+ if (!isFirstUpdate) {
53915
+ return refresh();
53916
+ }
53917
+ if (!ratio) {
53918
+ timeoutId = setTimeout(() => {
53919
+ refresh(false, 1e-7);
53920
+ }, 1e3);
53921
+ } else {
53922
+ refresh(false, ratio);
53923
+ }
53924
+ }
53925
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
53926
+ refresh();
53927
+ }
53928
+ isFirstUpdate = false;
53929
+ }
53930
+ try {
53931
+ io = new IntersectionObserver(handleObserve, {
53932
+ ...options2,
53933
+ // Handle <iframe>s
53934
+ root: root2.ownerDocument
53935
+ });
53936
+ } catch (_e) {
53937
+ io = new IntersectionObserver(handleObserve, options2);
53938
+ }
53939
+ io.observe(element);
53940
+ }
53941
+ refresh(true);
53942
+ return cleanup;
53943
+ }
53944
+ function autoUpdate(reference2, floating, update, options2) {
53945
+ if (options2 === void 0) {
53946
+ options2 = {};
53947
+ }
53948
+ const {
53949
+ ancestorScroll = true,
53950
+ ancestorResize = true,
53951
+ elementResize = typeof ResizeObserver === "function",
53952
+ layoutShift = typeof IntersectionObserver === "function",
53953
+ animationFrame = false
53954
+ } = options2;
53955
+ const referenceEl = unwrapElement(reference2);
53956
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
53957
+ ancestors.forEach((ancestor) => {
53958
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
53959
+ passive: true
53960
+ });
53961
+ ancestorResize && ancestor.addEventListener("resize", update);
53962
+ });
53963
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
53964
+ let reobserveFrame = -1;
53965
+ let resizeObserver = null;
53966
+ if (elementResize) {
53967
+ resizeObserver = new ResizeObserver((_ref) => {
53968
+ let [firstEntry] = _ref;
53969
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
53970
+ resizeObserver.unobserve(floating);
53971
+ cancelAnimationFrame(reobserveFrame);
53972
+ reobserveFrame = requestAnimationFrame(() => {
53973
+ var _resizeObserver;
53974
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
53975
+ });
53976
+ }
53977
+ update();
53978
+ });
53979
+ if (referenceEl && !animationFrame) {
53980
+ resizeObserver.observe(referenceEl);
53981
+ }
53982
+ resizeObserver.observe(floating);
53983
+ }
53984
+ let frameId;
53985
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference2) : null;
53986
+ if (animationFrame) {
53987
+ frameLoop();
53988
+ }
53989
+ function frameLoop() {
53990
+ const nextRefRect = getBoundingClientRect(reference2);
53991
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
53992
+ update();
53993
+ }
53994
+ prevRefRect = nextRefRect;
53995
+ frameId = requestAnimationFrame(frameLoop);
53996
+ }
53997
+ update();
53998
+ return () => {
53999
+ var _resizeObserver2;
54000
+ ancestors.forEach((ancestor) => {
54001
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
54002
+ ancestorResize && ancestor.removeEventListener("resize", update);
54003
+ });
54004
+ cleanupIo == null || cleanupIo();
54005
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
54006
+ resizeObserver = null;
54007
+ if (animationFrame) {
54008
+ cancelAnimationFrame(frameId);
54009
+ }
54010
+ };
54011
+ }
54012
+ const hide = hide$1;
54013
+ const computePosition = (reference2, floating, options2) => {
54014
+ const cache2 = /* @__PURE__ */ new Map();
54015
+ const mergedOptions = {
54016
+ platform,
54017
+ ...options2
54018
+ };
54019
+ const platformWithCache = {
54020
+ ...mergedOptions.platform,
54021
+ _c: cache2
54022
+ };
54023
+ return computePosition$1(reference2, floating, {
54024
+ ...mergedOptions,
54025
+ platform: platformWithCache
54026
+ });
54027
+ };
54028
+ const SEPARATOR_CLASS = "pagination-separator";
54029
+ const SEPARATOR_FLOATING_CLASS = "pagination-separator-floating";
52635
54030
  const isDebugging = false;
54031
+ const cleanupFunctions = /* @__PURE__ */ new Set();
52636
54032
  const Pagination = Extension.create({
52637
54033
  name: "pagination",
52638
54034
  addStorage() {
@@ -52722,7 +54118,7 @@ const Pagination = Extension.create({
52722
54118
  view: (view) => {
52723
54119
  let previousDecorations = DecorationSet.empty;
52724
54120
  return {
52725
- update: (view2) => {
54121
+ update: (view2, prevState) => {
52726
54122
  if (!shouldUpdate || isUpdating) return;
52727
54123
  isUpdating = true;
52728
54124
  hasInitialized = true;
@@ -52739,6 +54135,9 @@ const Pagination = Extension.create({
52739
54135
  }
52740
54136
  });
52741
54137
  return [paginationPlugin];
54138
+ },
54139
+ onDestroy() {
54140
+ cleanupFloatingSeparators();
52742
54141
  }
52743
54142
  });
52744
54143
  const getHeaderFooterId = (currentPageNumber, sectionType, editor, node2 = null) => {
@@ -52776,12 +54175,23 @@ const getHeaderFooterId = (currentPageNumber, sectionType, editor, node2 = null)
52776
54175
  const performUpdate = (editor, view, previousDecorations) => {
52777
54176
  const sectionData = editor.storage.pagination.sectionData;
52778
54177
  const newDecorations = calculatePageBreaks(view, editor, sectionData);
54178
+ const editorElement = editor.options.element;
52779
54179
  if (!previousDecorations.eq(newDecorations)) {
52780
54180
  const updateTransaction = view.state.tr.setMeta(
52781
54181
  PaginationPluginKey,
52782
54182
  { decorations: newDecorations }
52783
54183
  );
52784
54184
  view.dispatch(updateTransaction);
54185
+ requestAnimationFrame(() => {
54186
+ requestAnimationFrame(() => {
54187
+ cleanupFloatingSeparators();
54188
+ const separators = [...editorElement.querySelectorAll(`.${SEPARATOR_CLASS}--table`)];
54189
+ separators.forEach((separator) => {
54190
+ const { cleanup } = createFloatingSeparator(separator, editor);
54191
+ cleanupFunctions.add(cleanup);
54192
+ });
54193
+ });
54194
+ });
52785
54195
  }
52786
54196
  editor.emit("paginationUpdate");
52787
54197
  };
@@ -52822,16 +54232,15 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
52822
54232
  const decorations = [];
52823
54233
  const { pageSize, pageMargins } = editor.converter.pageStyles;
52824
54234
  const pageHeight = pageSize.height * 96;
52825
- editor.options.scale;
52826
54235
  let currentPageNumber = 1;
52827
54236
  let pageHeightThreshold = pageHeight;
52828
54237
  let footer = null, header = null;
52829
54238
  const firstHeaderId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
52830
- const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor);
54239
+ const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor, currentPageNumber);
52831
54240
  const pageBreak = createPageBreak({ editor, header: firstHeader, isFirstHeader: true });
52832
54241
  decorations.push(Decoration.widget(0, pageBreak, { key: "stable-key" }));
52833
54242
  const lastFooterId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
52834
- const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor);
54243
+ const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor, currentPageNumber);
52835
54244
  pageHeightThreshold -= firstHeader.headerHeight + lastFooter.footerHeight;
52836
54245
  let coords = view?.coordsAtPos(doc2.content.size);
52837
54246
  if (!coords) return [];
@@ -52850,7 +54259,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
52850
54259
  if (currentPageNumber === 1) {
52851
54260
  const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor, currentNode);
52852
54261
  decorations.pop();
52853
- const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor);
54262
+ const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber - 1);
52854
54263
  const pageBreak2 = createPageBreak({ editor, header: newFirstHeader, isFirstHeader: true });
52855
54264
  decorations.push(Decoration.widget(0, pageBreak2, { key: "stable-key" }));
52856
54265
  }
@@ -52866,7 +54275,9 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
52866
54275
  }
52867
54276
  if (isHardBreakNode || shouldAddPageBreak) {
52868
54277
  const $currentPos = view.state.doc.resolve(currentPos);
54278
+ const table = findParentNodeClosestToPos($currentPos, (node22) => node22.type.name === "table");
52869
54279
  const tableRow = findParentNodeClosestToPos($currentPos, (node22) => node22.type.name === "tableRow");
54280
+ let isInTable2 = table || tableRow ? true : false;
52870
54281
  if (tableRow) {
52871
54282
  currentNode = tableRow.node;
52872
54283
  currentPos = tableRow.pos;
@@ -52879,13 +54290,13 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
52879
54290
  const footerId2 = getHeaderFooterId(currentPageNumber, "footerIds", editor, currentNode);
52880
54291
  currentPageNumber++;
52881
54292
  const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor);
52882
- header = createHeader(pageMargins, pageSize, sectionData, headerId2, editor);
54293
+ header = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber - 1);
52883
54294
  footer = createFooter(pageMargins, pageSize, sectionData, footerId2, editor, currentPageNumber - 1);
52884
54295
  const bufferHeight2 = pageHeightThreshold - actualBreakBottom;
52885
54296
  const { node: spacingNode2 } = createFinalPagePadding(bufferHeight2);
52886
54297
  const pageSpacer2 = Decoration.widget(breakPos, spacingNode2, { key: "stable-key" });
52887
54298
  decorations.push(pageSpacer2);
52888
- const pageBreak2 = createPageBreak({ editor, header, footer });
54299
+ const pageBreak2 = createPageBreak({ editor, header, footer, isInTable: isInTable2 });
52889
54300
  decorations.push(Decoration.widget(breakPos, pageBreak2, { key: "stable-key" }));
52890
54301
  pageHeightThreshold = actualBreakBottom + (pageHeight - header.headerHeight - footer.footerHeight);
52891
54302
  }
@@ -52894,7 +54305,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
52894
54305
  const lastNodeCoords = view.coordsAtPos(finalPos);
52895
54306
  const headerId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
52896
54307
  const footerId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
52897
- header = createHeader(pageMargins, pageSize, sectionData, headerId, editor);
54308
+ header = createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber);
52898
54309
  footer = createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber);
52899
54310
  const bufferHeight = pageHeightThreshold - lastNodeCoords.bottom;
52900
54311
  const { node: spacingNode } = createFinalPagePadding(bufferHeight);
@@ -52911,6 +54322,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
52911
54322
  totalPageNumber.innerText = currentPageNumber;
52912
54323
  }
52913
54324
  });
54325
+ editor.currentTotalPages = currentPageNumber;
52914
54326
  return decorations;
52915
54327
  }
52916
54328
  function createFinalPagePadding(bufferHeight) {
@@ -52921,7 +54333,7 @@ function createFinalPagePadding(bufferHeight) {
52921
54333
  div2.style.height = bufferHeight + "px";
52922
54334
  return { nodeHeight: bufferHeight, node: div2 };
52923
54335
  }
52924
- function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
54336
+ function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber) {
52925
54337
  const headerDef = sectionData.headers?.[headerId];
52926
54338
  const minHeaderHeight = pageMargins.top * 96;
52927
54339
  const headerMargin = pageMargins.header * 96;
@@ -52948,7 +54360,8 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
52948
54360
  appendToBody: false,
52949
54361
  sectionId: headerId,
52950
54362
  type: "header",
52951
- availableHeight
54363
+ availableHeight,
54364
+ currentPageNumber
52952
54365
  });
52953
54366
  editor.converter.headerEditors.push({
52954
54367
  id: headerId,
@@ -52974,13 +54387,6 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
52974
54387
  const minFooterHeight = pageMargins.bottom * 96;
52975
54388
  const footerPaddingFromEdge = pageMargins.footer * 96;
52976
54389
  const footerHeight = Math.max(footerDef?.height || 0, minFooterHeight - footerPaddingFromEdge);
52977
- const sectionContainer = footerDef?.sectionContainer?.cloneNode(true);
52978
- const autoPageNumber = sectionContainer?.querySelector('span[data-id="auto-page-number"]');
52979
- if (autoPageNumber) {
52980
- const fontSize2 = autoPageNumber.previousElementSibling?.style?.fontSize || autoPageNumber.nextElementSibling?.style?.fontSize;
52981
- if (fontSize2) autoPageNumber.style.fontSize = fontSize2;
52982
- autoPageNumber.innerText = currentPageNumber;
52983
- }
52984
54390
  const editorContainer = document.createElement("div");
52985
54391
  if (!footerId && !editor.converter.footerIds["default"]) {
52986
54392
  footerId = "rId" + generateDocxRandomId();
@@ -53000,7 +54406,8 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
53000
54406
  appendToBody: false,
53001
54407
  sectionId: footerId,
53002
54408
  type: "footer",
53003
- availableHeight: footerHeight
54409
+ availableHeight: footerHeight,
54410
+ currentPageNumber
53004
54411
  });
53005
54412
  editor.converter.footerEditors.push({
53006
54413
  id: footerId,
@@ -53026,7 +54433,7 @@ const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
53026
54433
  editor.setEditable(false, false);
53027
54434
  toggleHeaderFooterEditMode(editor, currentFocusedSectionEditor, true);
53028
54435
  };
53029
- function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter }) {
54436
+ function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter, isInTable: isInTable2 = false }) {
53030
54437
  const { pageSize, pageMargins } = editor.converter.pageStyles;
53031
54438
  let sectionHeight = 0;
53032
54439
  const paginationDiv = document.createElement("div");
@@ -53045,7 +54452,10 @@ function createPageBreak({ editor, header, footer, footerBottom = null, isFirstH
53045
54452
  const separatorHeight = 20;
53046
54453
  sectionHeight += separatorHeight;
53047
54454
  const separator = document.createElement("div");
53048
- separator.className = "pagination-separator";
54455
+ separator.classList.add(SEPARATOR_CLASS);
54456
+ if (isInTable2) {
54457
+ separator.classList.add(`${SEPARATOR_CLASS}--table`);
54458
+ }
53049
54459
  innerDiv.appendChild(separator);
53050
54460
  }
53051
54461
  if (header) {
@@ -53084,6 +54494,85 @@ const onImageLoad = (editor) => {
53084
54494
  editor.view.dispatch(newTr);
53085
54495
  });
53086
54496
  };
54497
+ function createFloatingSeparator(separator, editor) {
54498
+ const floatingSeparator = document.createElement("div");
54499
+ floatingSeparator.classList.add(SEPARATOR_FLOATING_CLASS);
54500
+ floatingSeparator.dataset.floatingSeparator = "";
54501
+ const editorElement = editor.options.element;
54502
+ editorElement.append(floatingSeparator);
54503
+ const updatePosition2 = () => {
54504
+ computePosition(separator, floatingSeparator, {
54505
+ strategy: "absolute",
54506
+ placement: "top-start",
54507
+ middleware: [
54508
+ hide(),
54509
+ {
54510
+ name: "copy",
54511
+ fn: ({ elements }) => {
54512
+ const rect = elements.reference.getBoundingClientRect();
54513
+ const containerRect = editorElement.getBoundingClientRect();
54514
+ const scaleFactor = getScaleFactor(editorElement);
54515
+ const x = Math.round((rect.left - containerRect.left) / scaleFactor);
54516
+ const y = Math.round((rect.top - containerRect.top) / scaleFactor);
54517
+ const width = Math.round(rect.width / scaleFactor);
54518
+ const height = Math.round(rect.height / scaleFactor);
54519
+ return {
54520
+ x,
54521
+ y,
54522
+ data: { width, height }
54523
+ };
54524
+ }
54525
+ }
54526
+ ]
54527
+ }).then(({ x, y, middlewareData }) => {
54528
+ Object.assign(floatingSeparator.style, {
54529
+ top: `${y}px`,
54530
+ left: `${x}px`,
54531
+ width: `${middlewareData.copy.width}px`,
54532
+ height: `${middlewareData.copy.height}px`,
54533
+ visibility: middlewareData.hide?.referenceHidden ? "hidden" : "visible"
54534
+ });
54535
+ });
54536
+ };
54537
+ const cleanup = autoUpdate(
54538
+ separator,
54539
+ floatingSeparator,
54540
+ updatePosition2
54541
+ );
54542
+ const extendedCleanup = () => {
54543
+ floatingSeparator?.remove();
54544
+ cleanup();
54545
+ };
54546
+ return {
54547
+ cleanup: extendedCleanup,
54548
+ updatePosition: updatePosition2
54549
+ };
54550
+ }
54551
+ function cleanupFloatingSeparators() {
54552
+ cleanupFunctions.forEach((cleanup) => cleanup());
54553
+ cleanupFunctions.clear();
54554
+ }
54555
+ function getScaleFactor(element) {
54556
+ let scale = 1;
54557
+ let currentElement2 = element;
54558
+ while (currentElement2 && currentElement2 !== document.documentElement) {
54559
+ let zoomStyle = currentElement2.style.zoom;
54560
+ if (zoomStyle) {
54561
+ let zoom = parseFloat(zoomStyle) || 1;
54562
+ scale *= zoom;
54563
+ }
54564
+ let transformStyle = currentElement2.style.transform;
54565
+ if (transformStyle) {
54566
+ let scaleMatch = transformStyle.match(/scale\(([^)]+)\)/);
54567
+ if (scaleMatch) {
54568
+ let scaleValue = parseFloat(scaleMatch[1]) || 1;
54569
+ scale *= scaleValue;
54570
+ }
54571
+ }
54572
+ currentElement2 = currentElement2.parentElement;
54573
+ }
54574
+ return scale;
54575
+ }
53087
54576
  class SearchQuery {
53088
54577
  /**
53089
54578
  Create a query object.
@@ -57123,7 +58612,7 @@ var ResizeObserverController = function() {
57123
58612
  };
57124
58613
  return ResizeObserverController2;
57125
58614
  }();
57126
- var ResizeObserver = function() {
58615
+ var ResizeObserver$1 = function() {
57127
58616
  function ResizeObserver2(callback) {
57128
58617
  if (arguments.length === 0) {
57129
58618
  throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
@@ -57162,7 +58651,7 @@ var ResizeObserver = function() {
57162
58651
  class ResizeObserverDelegate {
57163
58652
  constructor() {
57164
58653
  this.handleResize = this.handleResize.bind(this);
57165
- this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver)(this.handleResize);
58654
+ this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$1)(this.handleResize);
57166
58655
  this.elHandlersMap = /* @__PURE__ */ new Map();
57167
58656
  }
57168
58657
  handleResize(entries) {
@@ -67568,7 +69057,7 @@ const _sfc_main$2 = {
67568
69057
  };
67569
69058
  }
67570
69059
  };
67571
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-199a4ecf"]]);
69060
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-4b700df1"]]);
67572
69061
  const _sfc_main$1 = {
67573
69062
  __name: "BasicUpload",
67574
69063
  emits: ["file-change"],