@bagelink/vue 0.0.398 → 0.0.402

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -317,7 +317,7 @@ async function detectOverflow$1(state2, options) {
317
317
  right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
318
318
  };
319
319
  }
320
- const arrow$3 = (options) => ({
320
+ const arrow$4 = (options) => ({
321
321
  name: "arrow",
322
322
  options,
323
323
  async fn(state2) {
@@ -1508,7 +1508,7 @@ const q = "__floating-vue__popper", Q = () => vue.defineComponent({
1508
1508
  })), !t && this.flip && e.middleware.push(flip$2({
1509
1509
  padding: this.overflowPadding,
1510
1510
  boundary: this.boundary
1511
- }))), e.middleware.push(arrow$3({
1511
+ }))), e.middleware.push(arrow$4({
1512
1512
  element: this.$_arrowNode,
1513
1513
  padding: this.arrowPadding
1514
1514
  })), this.arrowOverflow && e.middleware.push({
@@ -4857,6 +4857,15 @@ const ModalPlugin = {
4857
4857
  const hideModal = (index2) => {
4858
4858
  modalStack.value.splice(index2, 1);
4859
4859
  };
4860
+ const modalConfirm = (options) => new Promise((resolve) => {
4861
+ if (typeof options === "string")
4862
+ options = { title: options, message: "" };
4863
+ modalStack.value.push({
4864
+ modalOptions: { ...options, resolve },
4865
+ modalType: "confirm",
4866
+ componentSlots: {}
4867
+ });
4868
+ });
4860
4869
  const showModal = (modalType, options, slots = {}) => {
4861
4870
  modalStack.value.push({
4862
4871
  modalOptions: options,
@@ -4870,6 +4879,7 @@ const ModalPlugin = {
4870
4879
  app.provide(ModalSymbol, {
4871
4880
  showModal: (options, slots) => showModal("modal", options, slots),
4872
4881
  showModalForm: (options, slots) => showModal("modalForm", options, slots),
4882
+ confirm: (userOptions) => modalConfirm(userOptions),
4873
4883
  hideModal: (index2 = modalStack.value.length - 1) => hideModal(index2)
4874
4884
  // modalOptions,
4875
4885
  });
@@ -4880,7 +4890,9 @@ const ModalPlugin = {
4880
4890
  const props2 = { ...modal.modalOptions, visible: true, "onUpdate:visible": () => hideModal(index2) };
4881
4891
  if (modal.modalType === "modalForm")
4882
4892
  return vue.h(ModalForm, props2, modal.componentSlots);
4883
- return vue.h(_sfc_main$E, props2, modal.componentSlots);
4893
+ if (modal.modalType === "confirm")
4894
+ return vue.h(_sfc_main$n, props2, {});
4895
+ return vue.h(_sfc_main$F, props2, modal.componentSlots);
4884
4896
  });
4885
4897
  }
4886
4898
  });
@@ -5019,7 +5031,7 @@ const iffer = (field, itemData) => {
5019
5031
  return true;
5020
5032
  };
5021
5033
  const denullify = (itemData, fieldID) => fieldID && itemData ? itemData[fieldID] : null;
5022
- const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
5034
+ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
5023
5035
  __name: "MaterialIcon",
5024
5036
  props: {
5025
5037
  icon: {},
@@ -5042,7 +5054,7 @@ const _hoisted_3$l = { class: "nav-links-wrapper" };
5042
5054
  const _hoisted_4$e = { class: "tooltip" };
5043
5055
  const _hoisted_5$b = { class: "bot-buttons-wrapper" };
5044
5056
  const _hoisted_6$7 = { class: "tooltip" };
5045
- const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
5057
+ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
5046
5058
  __name: "NavBar",
5047
5059
  props: {
5048
5060
  footerLinks: { default: () => [] },
@@ -5066,7 +5078,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
5066
5078
  "aria-label": "Toggle Navigation",
5067
5079
  tabindex: "0"
5068
5080
  }, [
5069
- vue.createVNode(vue.unref(_sfc_main$H), {
5081
+ vue.createVNode(vue.unref(_sfc_main$I), {
5070
5082
  icon: "chevron_right",
5071
5083
  class: "top-arrow"
5072
5084
  })
@@ -5085,7 +5097,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
5085
5097
  }
5086
5098
  }, {
5087
5099
  default: vue.withCtx(() => [
5088
- vue.createVNode(vue.unref(_sfc_main$H), {
5100
+ vue.createVNode(vue.unref(_sfc_main$I), {
5089
5101
  icon: link.icon
5090
5102
  }, null, 8, ["icon"]),
5091
5103
  vue.createElementVNode("div", _hoisted_4$e, vue.toDisplayString(link.label), 1)
@@ -5107,7 +5119,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
5107
5119
  key: link.label
5108
5120
  }, {
5109
5121
  default: vue.withCtx(() => [
5110
- vue.createVNode(vue.unref(_sfc_main$H), {
5122
+ vue.createVNode(vue.unref(_sfc_main$I), {
5111
5123
  icon: link.icon
5112
5124
  }, null, 8, ["icon"]),
5113
5125
  vue.createElementVNode("div", _hoisted_6$7, vue.toDisplayString(link.label), 1)
@@ -5129,7 +5141,7 @@ const _export_sfc = (sfc, props2) => {
5129
5141
  }
5130
5142
  return target;
5131
5143
  };
5132
- const NavBar = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-727b754a"]]);
5144
+ const NavBar = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-727b754a"]]);
5133
5145
  const _hoisted_1$D = {
5134
5146
  key: 0,
5135
5147
  class: "loading"
@@ -5138,7 +5150,7 @@ const _hoisted_2$w = {
5138
5150
  key: 1,
5139
5151
  class: "bgl_btn-flex"
5140
5152
  };
5141
- const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
5153
+ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
5142
5154
  __name: "Btn",
5143
5155
  props: {
5144
5156
  disabled: { type: Boolean, default: false },
@@ -5226,7 +5238,7 @@ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
5226
5238
  }, {
5227
5239
  default: vue.withCtx(() => [
5228
5240
  _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$D)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$w, [
5229
- _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
5241
+ _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
5230
5242
  key: 0,
5231
5243
  icon: _ctx.icon
5232
5244
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -5234,7 +5246,7 @@ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
5234
5246
  !vue.unref(slots)["default"] && _ctx.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
5235
5247
  vue.createTextVNode(vue.toDisplayString(_ctx.value), 1)
5236
5248
  ], 64)) : vue.createCommentVNode("", true),
5237
- props2["icon.end"] ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
5249
+ props2["icon.end"] ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
5238
5250
  key: 2,
5239
5251
  icon: props2["icon.end"]
5240
5252
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true)
@@ -5245,10 +5257,10 @@ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
5245
5257
  };
5246
5258
  }
5247
5259
  });
5248
- const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-d09a83c5"]]);
5260
+ const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-d09a83c5"]]);
5249
5261
  const _hoisted_1$C = { class: "tool-bar" };
5250
5262
  const _hoisted_2$v = { class: "modal-footer mt-3" };
5251
- const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5263
+ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
5252
5264
  __name: "Modal",
5253
5265
  props: {
5254
5266
  side: { type: Boolean },
@@ -5302,7 +5314,7 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5302
5314
  onClick: _cache[1] || (_cache[1] = () => _ctx.dismissable ? closeModal() : ""),
5303
5315
  onKeydown: vue.withKeys(closeModal, ["esc"])
5304
5316
  }, [
5305
- vue.createVNode(vue.unref(_sfc_main$u), {
5317
+ vue.createVNode(vue.unref(_sfc_main$v), {
5306
5318
  class: "modal",
5307
5319
  onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
5308
5320
  }, ["stop"])),
@@ -5317,7 +5329,7 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5317
5329
  icon: "close",
5318
5330
  onClick: closeModal
5319
5331
  }, null, 8, ["style"]),
5320
- _ctx.title ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$s), {
5332
+ _ctx.title ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$t), {
5321
5333
  key: 0,
5322
5334
  class: "modal-title",
5323
5335
  tag: "h3",
@@ -5342,7 +5354,7 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5342
5354
  };
5343
5355
  }
5344
5356
  });
5345
- const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5357
+ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
5346
5358
  __name: "ModalForm",
5347
5359
  props: /* @__PURE__ */ vue.mergeModels({
5348
5360
  side: { type: Boolean },
@@ -5353,7 +5365,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5353
5365
  schema: { type: Function },
5354
5366
  onSubmit: { type: Function },
5355
5367
  onDelete: { type: Function },
5356
- "onUpdate:isModalVisible": { type: Function },
5368
+ visible: { type: Boolean },
5357
5369
  onError: { type: Function },
5358
5370
  modelValue: {}
5359
5371
  }, {
@@ -5362,10 +5374,11 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5362
5374
  },
5363
5375
  "modelModifiers": {}
5364
5376
  }),
5365
- emits: ["update:modelValue"],
5366
- setup(__props, { expose: __expose }) {
5377
+ emits: /* @__PURE__ */ vue.mergeModels(["update:visible"], ["update:modelValue"]),
5378
+ setup(__props, { expose: __expose, emit: __emit }) {
5367
5379
  const bagel = useBagel();
5368
5380
  const props2 = __props;
5381
+ const emit2 = __emit;
5369
5382
  const modal = vue.ref();
5370
5383
  const computedFormSchema = vue.computed(() => {
5371
5384
  if (typeof props2.schema === "function")
@@ -5402,12 +5415,13 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5402
5415
  }
5403
5416
  __expose({ setFormValues });
5404
5417
  return (_ctx, _cache) => {
5405
- return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$E), {
5406
- "onOnUpdate:isModalVisible": props2["onUpdate:isModalVisible"],
5418
+ return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$F), {
5419
+ "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => emit2("update:visible", $event)),
5407
5420
  side: _ctx.side,
5408
5421
  ref_key: "modal",
5409
5422
  ref: modal,
5410
5423
  width: _ctx.width,
5424
+ visible: _ctx.visible,
5411
5425
  dismissable: _ctx.dismissable,
5412
5426
  title: _ctx.title
5413
5427
  }, vue.createSlots({
@@ -5450,16 +5464,16 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5450
5464
  ]),
5451
5465
  key: "0"
5452
5466
  } : void 0
5453
- ]), 1032, ["onOnUpdate:isModalVisible", "side", "width", "dismissable", "title"]);
5467
+ ]), 1032, ["side", "width", "visible", "dismissable", "title"]);
5454
5468
  };
5455
5469
  }
5456
5470
  });
5457
- const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-204f5236"]]);
5471
+ const ModalForm = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-04d84995"]]);
5458
5472
  const _hoisted_1$B = { class: "accordion-item" };
5459
5473
  const _hoisted_2$u = ["aria-expanded", "aria-controls"];
5460
5474
  const _hoisted_3$k = { class: "accordion-label" };
5461
5475
  const _hoisted_4$d = ["id", "aria-hidden"];
5462
- const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5476
+ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
5463
5477
  __name: "AccordionItem",
5464
5478
  props: {
5465
5479
  label: {},
@@ -5494,7 +5508,7 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5494
5508
  vue.createElementVNode("div", {
5495
5509
  class: vue.normalizeClass(["accordion-icon", { open: vue.unref(open) }])
5496
5510
  }, [
5497
- vue.createVNode(vue.unref(_sfc_main$H), { icon: "expand_more" })
5511
+ vue.createVNode(vue.unref(_sfc_main$I), { icon: "expand_more" })
5498
5512
  ], 2)
5499
5513
  ], 8, _hoisted_2$u),
5500
5514
  vue.createVNode(vue.Transition, { name: "expand" }, {
@@ -5514,11 +5528,11 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5514
5528
  };
5515
5529
  }
5516
5530
  });
5517
- const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-bf74738b"]]);
5531
+ const AccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-bf74738b"]]);
5518
5532
  const _hoisted_1$A = { class: "list-wrap bgl_card thin grid overflow-hidden h-100 p-0" };
5519
5533
  const _hoisted_2$t = { class: "p-1" };
5520
5534
  const _hoisted_3$j = { class: "list-content auto-flow-rows align-items-start overflow-y h-100" };
5521
- const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
5535
+ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
5522
5536
  __name: "ListView",
5523
5537
  setup(__props) {
5524
5538
  return (_ctx, _cache) => {
@@ -5535,7 +5549,7 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
5535
5549
  });
5536
5550
  const _hoisted_1$z = { class: "txt16 no-margin ellipsis" };
5537
5551
  const _hoisted_2$s = { class: "txt14 no-margin txt-gray ellipsis" };
5538
- const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
5552
+ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
5539
5553
  __name: "ListItem",
5540
5554
  props: {
5541
5555
  src: {},
@@ -5576,7 +5590,7 @@ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
5576
5590
  });
5577
5591
  const _hoisted_1$y = { class: "page-top" };
5578
5592
  const _hoisted_2$r = { class: "top-title" };
5579
- const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5593
+ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
5580
5594
  __name: "PageTitle",
5581
5595
  props: {
5582
5596
  value: {
@@ -5602,7 +5616,7 @@ const _hoisted_4$c = ["onClick"];
5602
5616
  const _hoisted_5$a = { class: "flex" };
5603
5617
  const _hoisted_6$6 = ["onClick"];
5604
5618
  const _hoisted_7$2 = { key: 1 };
5605
- const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
5619
+ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5606
5620
  __name: "TableSchema",
5607
5621
  props: {
5608
5622
  data: {},
@@ -5650,7 +5664,7 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
5650
5664
  vue.createElementVNode("div", {
5651
5665
  class: vue.normalizeClass(["list-arrows", { sorted: vue.unref(sortField) === field.id }])
5652
5666
  }, [
5653
- vue.createVNode(vue.unref(_sfc_main$H), {
5667
+ vue.createVNode(vue.unref(_sfc_main$I), {
5654
5668
  class: vue.normalizeClass({ desc: vue.unref(sortDirection) === "DESC" }),
5655
5669
  icon: "keyboard_arrow_up"
5656
5670
  }, null, 8, ["class"])
@@ -5696,16 +5710,16 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
5696
5710
  };
5697
5711
  }
5698
5712
  });
5699
- const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-10808aad"]]);
5700
- const _sfc_main$x = {};
5713
+ const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-10808aad"]]);
5714
+ const _sfc_main$y = {};
5701
5715
  const _hoisted_1$w = { class: "flex space-between" };
5702
5716
  function _sfc_render$1(_ctx, _cache) {
5703
5717
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$w, [
5704
5718
  vue.renderSlot(_ctx.$slots, "default")
5705
5719
  ]);
5706
5720
  }
5707
- const TopBar = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$1]]);
5708
- const _sfc_main$w = {};
5721
+ const TopBar = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$1]]);
5722
+ const _sfc_main$x = {};
5709
5723
  function _sfc_render(_ctx, _cache) {
5710
5724
  const _component_router_view = vue.resolveComponent("router-view");
5711
5725
  return vue.openBlock(), vue.createBlock(_component_router_view, null, {
@@ -5727,7 +5741,7 @@ function _sfc_render(_ctx, _cache) {
5727
5741
  _: 1
5728
5742
  });
5729
5743
  }
5730
- const RouterWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render]]);
5744
+ const RouterWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render]]);
5731
5745
  const _hoisted_1$v = {
5732
5746
  key: 0,
5733
5747
  class: "data"
@@ -5740,7 +5754,7 @@ const _hoisted_3$h = { class: "key" };
5740
5754
  const _hoisted_4$b = { key: 1 };
5741
5755
  const _hoisted_5$9 = { class: "key" };
5742
5756
  const _hoisted_6$5 = { class: "vlue" };
5743
- const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
5757
+ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
5744
5758
  __name: "DataPreview",
5745
5759
  props: /* @__PURE__ */ vue.mergeModels({
5746
5760
  schema: {},
@@ -5755,7 +5769,7 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
5755
5769
  return (_ctx, _cache) => {
5756
5770
  var _a2;
5757
5771
  return __props.data ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$v, [
5758
- _ctx.title ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$s), {
5772
+ _ctx.title ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$t), {
5759
5773
  key: 0,
5760
5774
  label: _ctx.title
5761
5775
  }, null, 8, ["label"])) : vue.createCommentVNode("", true),
@@ -5789,12 +5803,12 @@ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
5789
5803
  };
5790
5804
  }
5791
5805
  });
5792
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-bb2526f9"]]);
5806
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-bb2526f9"]]);
5793
5807
  const _hoisted_1$u = {
5794
5808
  key: 0,
5795
5809
  class: "card_label"
5796
5810
  };
5797
- const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
5811
+ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
5798
5812
  __name: "Card",
5799
5813
  props: {
5800
5814
  label: {},
@@ -5824,7 +5838,7 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
5824
5838
  }
5825
5839
  });
5826
5840
  const _hoisted_1$t = ["src", "alt"];
5827
- const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
5841
+ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
5828
5842
  __name: "Avatar",
5829
5843
  props: {
5830
5844
  fallback: {},
@@ -5850,8 +5864,8 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
5850
5864
  };
5851
5865
  }
5852
5866
  });
5853
- const Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-c38bc02a"]]);
5854
- const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
5867
+ const Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-c38bc02a"]]);
5868
+ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
5855
5869
  __name: "Title",
5856
5870
  props: {
5857
5871
  value: {
@@ -5879,7 +5893,7 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
5879
5893
  };
5880
5894
  }
5881
5895
  });
5882
- const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
5896
+ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
5883
5897
  __name: "Accordion",
5884
5898
  setup(__props) {
5885
5899
  const state2 = vue.reactive({
@@ -5895,7 +5909,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
5895
5909
  });
5896
5910
  const _hoisted_1$s = ["dismissable"];
5897
5911
  const _hoisted_2$o = { class: "m-0" };
5898
- const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
5912
+ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
5899
5913
  __name: "Alert",
5900
5914
  props: {
5901
5915
  message: {},
@@ -5915,7 +5929,7 @@ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
5915
5929
  class: vue.normalizeClass(["alert", [_ctx.type]]),
5916
5930
  dismissable: _ctx.dismissable
5917
5931
  }, [
5918
- vue.createVNode(vue.unref(_sfc_main$H), {
5932
+ vue.createVNode(vue.unref(_sfc_main$I), {
5919
5933
  class: "alert_icon",
5920
5934
  icon: _ctx.type,
5921
5935
  size: 2,
@@ -5933,8 +5947,8 @@ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
5933
5947
  };
5934
5948
  }
5935
5949
  });
5936
- const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-4017e821"]]);
5937
- const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
5950
+ const Alert = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-4017e821"]]);
5951
+ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
5938
5952
  __name: "Badge",
5939
5953
  props: {
5940
5954
  color: {},
@@ -5949,13 +5963,13 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
5949
5963
  return vue.openBlock(), vue.createElementBlock("div", {
5950
5964
  class: vue.normalizeClass(["pill", [_ctx.color]])
5951
5965
  }, [
5952
- _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
5966
+ _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
5953
5967
  key: 0,
5954
5968
  class: "inline",
5955
5969
  icon: _ctx.icon
5956
5970
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
5957
5971
  vue.createTextVNode(" " + vue.toDisplayString(_ctx.text) + " ", 1),
5958
- props2["icon.end"] ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
5972
+ props2["icon.end"] ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
5959
5973
  key: 1,
5960
5974
  class: "inline",
5961
5975
  icon: props2["icon.end"]
@@ -5964,10 +5978,10 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
5964
5978
  };
5965
5979
  }
5966
5980
  });
5967
- const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-561f7a72"]]);
5981
+ const Badge = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-561f7a72"]]);
5968
5982
  const _hoisted_1$r = ["src"];
5969
5983
  const _hoisted_2$n = ["src", "autoplay", "muted", "loop", "controls"];
5970
- const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
5984
+ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
5971
5985
  __name: "BglVideo",
5972
5986
  props: {
5973
5987
  src: {},
@@ -6035,13 +6049,13 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
6035
6049
  };
6036
6050
  }
6037
6051
  });
6038
- const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-bbfc4353"]]);
6052
+ const BglVideo = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-b1ad7c32"]]);
6039
6053
  const _hoisted_1$q = {
6040
6054
  key: 0,
6041
6055
  class: "blocker"
6042
6056
  };
6043
6057
  const _hoisted_2$m = { class: "Handlers" };
6044
- const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
6058
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
6045
6059
  __name: "Carousel",
6046
6060
  props: {
6047
6061
  autoHeight: {
@@ -6215,7 +6229,48 @@ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
6215
6229
  };
6216
6230
  }
6217
6231
  });
6218
- const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-068aa914"]]);
6232
+ const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-068aa914"]]);
6233
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
6234
+ __name: "ModalConfirm",
6235
+ props: {
6236
+ title: {},
6237
+ message: {},
6238
+ resolve: { type: Function }
6239
+ },
6240
+ emits: ["update:visible"],
6241
+ setup(__props, { emit: __emit }) {
6242
+ const props2 = __props;
6243
+ const emit2 = __emit;
6244
+ function select2(val) {
6245
+ props2.resolve(val);
6246
+ emit2("update:visible");
6247
+ }
6248
+ return (_ctx, _cache) => {
6249
+ return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$F), {
6250
+ width: "380px",
6251
+ dismissable: false,
6252
+ title: _ctx.title
6253
+ }, {
6254
+ footer: vue.withCtx(() => [
6255
+ vue.createVNode(vue.unref(Btn), {
6256
+ onClick: _cache[0] || (_cache[0] = ($event) => select2(true)),
6257
+ color: "primary",
6258
+ value: "Confirm"
6259
+ }),
6260
+ vue.createVNode(vue.unref(Btn), {
6261
+ onClick: _cache[1] || (_cache[1] = ($event) => select2(false)),
6262
+ color: "red",
6263
+ value: "Cancel"
6264
+ })
6265
+ ]),
6266
+ default: vue.withCtx(() => [
6267
+ vue.createTextVNode(vue.toDisplayString(_ctx.message) + " ", 1)
6268
+ ]),
6269
+ _: 1
6270
+ }, 8, ["title"]);
6271
+ };
6272
+ }
6273
+ });
6219
6274
  const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6220
6275
  __name: "BglForm",
6221
6276
  props: {
@@ -6299,7 +6354,7 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6299
6354
  ref: form,
6300
6355
  onSubmit: vue.withModifiers(runSubmit, ["prevent"])
6301
6356
  }, [
6302
- _ctx.label ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$s), {
6357
+ _ctx.label ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$t), {
6303
6358
  key: 0,
6304
6359
  tag: "h4",
6305
6360
  label: _ctx.label
@@ -15225,6 +15280,8 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15225
15280
  });
15226
15281
  const emit2 = __emit;
15227
15282
  const getLabel = (option2) => {
15283
+ if (!option2)
15284
+ return "";
15228
15285
  if (typeof option2 === "string")
15229
15286
  return option2;
15230
15287
  if (typeof option2 === "number")
@@ -15232,6 +15289,8 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15232
15289
  return option2.label;
15233
15290
  };
15234
15291
  const getValue = (option2) => {
15292
+ if (!option2)
15293
+ return "";
15235
15294
  if (typeof option2 === "string")
15236
15295
  return option2;
15237
15296
  if (typeof option2 === "number")
@@ -15279,8 +15338,6 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15279
15338
  vue.watch(
15280
15339
  () => props2.modelValue,
15281
15340
  (newVal) => {
15282
- if (!newVal)
15283
- return;
15284
15341
  if (!props2.multiselect) {
15285
15342
  const newOption = props2.options.find((o2) => getValue(o2) === newVal) || newVal;
15286
15343
  if (!isSelected(newOption)) {
@@ -15298,7 +15355,6 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15298
15355
  vue.watch(
15299
15356
  () => props2.options,
15300
15357
  () => {
15301
- const original = JSON.stringify(props2.options.map(getValue));
15302
15358
  [...selectedItems.value].forEach((option2, i2) => {
15303
15359
  const exists = props2.options.find(
15304
15360
  (o2) => getValue(o2) === getValue(option2)
@@ -15308,9 +15364,6 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15308
15364
  else
15309
15365
  selectedItems.value.splice(i2, 1, exists);
15310
15366
  });
15311
- const newSelection = JSON.stringify(selectedItems.value.map(getValue));
15312
- if (original !== newSelection)
15313
- emitUpdate();
15314
15367
  },
15315
15368
  { deep: true }
15316
15369
  );
@@ -15323,7 +15376,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15323
15376
  class: "bagel-input selectinput"
15324
15377
  }, {
15325
15378
  popper: vue.withCtx(({ hide: hide2 }) => [
15326
- vue.createVNode(vue.unref(_sfc_main$u), {
15379
+ vue.createVNode(vue.unref(_sfc_main$v), {
15327
15380
  class: "selectinput-options p-05",
15328
15381
  style: vue.normalizeStyle({ width: _ctx.fullWidth ? "100%" : "auto" })
15329
15382
  }, {
@@ -15344,11 +15397,11 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15344
15397
  key: `${option2}${i2}`,
15345
15398
  onClick: ($event) => select2(option2)
15346
15399
  }, [
15347
- isSelected(option2) ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
15400
+ isSelected(option2) ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
15348
15401
  key: 0,
15349
15402
  icon: "check"
15350
15403
  })) : vue.createCommentVNode("", true),
15351
- !isSelected(option2) ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
15404
+ !isSelected(option2) ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
15352
15405
  key: 1,
15353
15406
  class: "opacity-3",
15354
15407
  icon: "fiber_manual_record"
@@ -15372,7 +15425,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15372
15425
  class: vue.normalizeClass(["selectinput-btn", { isEmpty: selectedItems.value.length === 0 }])
15373
15426
  }, [
15374
15427
  vue.createElementVNode("p", null, vue.toDisplayString(selectedLabel.value), 1),
15375
- vue.createVNode(vue.unref(_sfc_main$H), vue.normalizeProps(vue.guardReactiveProps({ icon: vue.unref(open) ? "unfold_less" : "unfold_more" })), null, 16)
15428
+ vue.createVNode(vue.unref(_sfc_main$I), vue.normalizeProps(vue.guardReactiveProps({ icon: vue.unref(open) ? "unfold_less" : "unfold_more" })), null, 16)
15376
15429
  ], 42, _hoisted_1$m),
15377
15430
  _ctx.required ? (vue.openBlock(), vue.createElementBlock("input", {
15378
15431
  key: 0,
@@ -15389,7 +15442,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
15389
15442
  };
15390
15443
  }
15391
15444
  });
15392
- const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-3e27cf1d"]]);
15445
+ const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-fdfda40b"]]);
15393
15446
  /*!
15394
15447
  * vue-draggable-next v2.2.0
15395
15448
  * (c) 2023 Anish George
@@ -17945,7 +17998,7 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
17945
17998
  rows[index2][fieldname] = value;
17946
17999
  emits("update:modelValue", rows);
17947
18000
  }
17948
- function addRow() {
18001
+ function addRow2() {
17949
18002
  const rows = [...props2.modelValue];
17950
18003
  const entry = {
17951
18004
  idx: rows.length
@@ -17962,7 +18015,7 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
17962
18015
  rows.push(entry);
17963
18016
  emits("update:modelValue", rows);
17964
18017
  }
17965
- function removeRow(idx) {
18018
+ function removeRow2(idx) {
17966
18019
  const rows = [...props2.modelValue];
17967
18020
  rows.splice(idx, 1);
17968
18021
  emits("update:modelValue", rows);
@@ -18015,7 +18068,7 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
18015
18068
  key: row.id
18016
18069
  }, [
18017
18070
  vue.createElementVNode("div", _hoisted_5$8, [
18018
- vue.createVNode(vue.unref(_sfc_main$H), { icon: "more_vert" })
18071
+ vue.createVNode(vue.unref(_sfc_main$I), { icon: "more_vert" })
18019
18072
  ]),
18020
18073
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList((_a3 = vue.unref(entityMeta)) == null ? void 0 : _a3.fields, (field) => {
18021
18074
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -18032,9 +18085,9 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
18032
18085
  ], 2);
18033
18086
  }), 128)),
18034
18087
  vue.createElementVNode("div", _hoisted_6$4, [
18035
- vue.createVNode(vue.unref(_sfc_main$H), {
18088
+ vue.createVNode(vue.unref(_sfc_main$I), {
18036
18089
  icon: "delete",
18037
- onClick: ($event) => removeRow(index2)
18090
+ onClick: ($event) => removeRow2(index2)
18038
18091
  }, null, 8, ["onClick"])
18039
18092
  ])
18040
18093
  ]);
@@ -18051,7 +18104,7 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
18051
18104
  flat: "",
18052
18105
  icon: "add",
18053
18106
  color: "light",
18054
- onClick: addRow
18107
+ onClick: addRow2
18055
18108
  }, {
18056
18109
  default: vue.withCtx(() => [
18057
18110
  vue.createTextVNode(" New ")
@@ -18202,12 +18255,12 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
18202
18255
  ]),
18203
18256
  _ctx.helptext ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_5$7, vue.toDisplayString(_ctx.helptext), 1)) : vue.createCommentVNode("", true)
18204
18257
  ], 8, _hoisted_2$g),
18205
- _ctx.iconStart ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
18258
+ _ctx.iconStart ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
18206
18259
  key: 0,
18207
18260
  class: "iconStart",
18208
18261
  icon: _ctx.iconStart
18209
18262
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
18210
- _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
18263
+ _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
18211
18264
  key: 1,
18212
18265
  icon: _ctx.icon
18213
18266
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -18246,7 +18299,7 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
18246
18299
  [vue.vModelCheckbox, val.value]
18247
18300
  ]),
18248
18301
  vue.createElementVNode("span", null, [
18249
- vue.createVNode(vue.unref(_sfc_main$H), { icon: "check" })
18302
+ vue.createVNode(vue.unref(_sfc_main$I), { icon: "check" })
18250
18303
  ])
18251
18304
  ]);
18252
18305
  };
@@ -18638,7 +18691,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
18638
18691
  style: vue.normalizeStyle([`--p:${fileQ.progress}`, { "--b": "2px" }])
18639
18692
  }, [
18640
18693
  fileQ.progress < 100 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_12, vue.toDisplayString(`${fileQ.progress.toFixed(0)}`), 1)) : vue.createCommentVNode("", true),
18641
- vue.createVNode(vue.unref(_sfc_main$H), {
18694
+ vue.createVNode(vue.unref(_sfc_main$I), {
18642
18695
  class: "success",
18643
18696
  icon: "check"
18644
18697
  })
@@ -27413,7 +27466,7 @@ function handleSingleClick(view, pos, inside, event, selectNode) {
27413
27466
  function handleDoubleClick(view, pos, inside, event) {
27414
27467
  return runHandlerOnContext(view, "handleDoubleClickOn", pos, inside, event) || view.someProp("handleDoubleClick", (f2) => f2(view, pos, event));
27415
27468
  }
27416
- function handleTripleClick(view, pos, inside, event) {
27469
+ function handleTripleClick$1(view, pos, inside, event) {
27417
27470
  return runHandlerOnContext(view, "handleTripleClickOn", pos, inside, event) || view.someProp("handleTripleClick", (f2) => f2(view, pos, event)) || defaultTripleClick(view, inside, event);
27418
27471
  }
27419
27472
  function defaultTripleClick(view, inside, event) {
@@ -27463,7 +27516,7 @@ handlers.mousedown = (view, _event) => {
27463
27516
  if (view.input.mouseDown)
27464
27517
  view.input.mouseDown.done();
27465
27518
  view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);
27466
- } else if ((type3 == "doubleClick" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {
27519
+ } else if ((type3 == "doubleClick" ? handleDoubleClick : handleTripleClick$1)(view, pos.pos, pos.inside, event)) {
27467
27520
  event.preventDefault();
27468
27521
  } else {
27469
27522
  setSelectionOrigin(view, "pointer");
@@ -32974,8 +33027,8 @@ const Keymap = Extension.create({
32974
33027
  if (empty2 || !allWasSelected) {
32975
33028
  return;
32976
33029
  }
32977
- const isEmpty = newState.doc.textBetween(0, newState.doc.content.size, " ", " ").length === 0;
32978
- if (!isEmpty) {
33030
+ const isEmpty2 = newState.doc.textBetween(0, newState.doc.content.size, " ", " ").length === 0;
33031
+ if (!isEmpty2) {
32979
33032
  return;
32980
33033
  }
32981
33034
  const tr2 = newState.tr;
@@ -34711,18 +34764,18 @@ function gapCursor() {
34711
34764
  return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;
34712
34765
  },
34713
34766
  handleClick,
34714
- handleKeyDown,
34767
+ handleKeyDown: handleKeyDown$1,
34715
34768
  handleDOMEvents: { beforeinput }
34716
34769
  }
34717
34770
  });
34718
34771
  }
34719
- const handleKeyDown = keydownHandler({
34720
- "ArrowLeft": arrow$2("horiz", -1),
34721
- "ArrowRight": arrow$2("horiz", 1),
34722
- "ArrowUp": arrow$2("vert", -1),
34723
- "ArrowDown": arrow$2("vert", 1)
34772
+ const handleKeyDown$1 = keydownHandler({
34773
+ "ArrowLeft": arrow$3("horiz", -1),
34774
+ "ArrowRight": arrow$3("horiz", 1),
34775
+ "ArrowUp": arrow$3("vert", -1),
34776
+ "ArrowDown": arrow$3("vert", 1)
34724
34777
  });
34725
- function arrow$2(axis2, dir) {
34778
+ function arrow$3(axis2, dir) {
34726
34779
  const dirStr = axis2 == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
34727
34780
  return function(state2, dispatch, view) {
34728
34781
  let sel = state2.selection;
@@ -36255,7 +36308,7 @@ var toPaddingObject = function toPaddingObject2(padding, state2) {
36255
36308
  })) : padding;
36256
36309
  return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
36257
36310
  };
36258
- function arrow(_ref) {
36311
+ function arrow$1(_ref) {
36259
36312
  var _state$modifiersData$;
36260
36313
  var state2 = _ref.state, name = _ref.name, options = _ref.options;
36261
36314
  var arrowElement = state2.elements.arrow;
@@ -36300,11 +36353,11 @@ function effect$1(_ref2) {
36300
36353
  }
36301
36354
  state2.elements.arrow = arrowElement;
36302
36355
  }
36303
- const arrow$1 = {
36356
+ const arrow$2 = {
36304
36357
  name: "arrow",
36305
36358
  enabled: true,
36306
36359
  phase: "main",
36307
- fn: arrow,
36360
+ fn: arrow$1,
36308
36361
  effect: effect$1,
36309
36362
  requires: ["popperOffsets"],
36310
36363
  requiresIfExists: ["preventOverflow"]
@@ -37296,7 +37349,7 @@ function popperGenerator(generatorOptions) {
37296
37349
  return instance;
37297
37350
  };
37298
37351
  }
37299
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
37352
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$2, hide$1];
37300
37353
  var createPopper = /* @__PURE__ */ popperGenerator({
37301
37354
  defaultModifiers
37302
37355
  });
@@ -39442,6 +39495,2633 @@ const Youtube = Node$2.create({
39442
39495
  ];
39443
39496
  }
39444
39497
  });
39498
+ var readFromCache;
39499
+ var addToCache;
39500
+ if (typeof WeakMap != "undefined") {
39501
+ let cache = /* @__PURE__ */ new WeakMap();
39502
+ readFromCache = (key) => cache.get(key);
39503
+ addToCache = (key, value) => {
39504
+ cache.set(key, value);
39505
+ return value;
39506
+ };
39507
+ } else {
39508
+ const cache = [];
39509
+ const cacheSize = 10;
39510
+ let cachePos = 0;
39511
+ readFromCache = (key) => {
39512
+ for (let i2 = 0; i2 < cache.length; i2 += 2)
39513
+ if (cache[i2] == key)
39514
+ return cache[i2 + 1];
39515
+ };
39516
+ addToCache = (key, value) => {
39517
+ if (cachePos == cacheSize)
39518
+ cachePos = 0;
39519
+ cache[cachePos++] = key;
39520
+ return cache[cachePos++] = value;
39521
+ };
39522
+ }
39523
+ var TableMap = class {
39524
+ constructor(width, height, map4, problems) {
39525
+ this.width = width;
39526
+ this.height = height;
39527
+ this.map = map4;
39528
+ this.problems = problems;
39529
+ }
39530
+ // Find the dimensions of the cell at the given position.
39531
+ findCell(pos) {
39532
+ for (let i2 = 0; i2 < this.map.length; i2++) {
39533
+ const curPos = this.map[i2];
39534
+ if (curPos != pos)
39535
+ continue;
39536
+ const left2 = i2 % this.width;
39537
+ const top2 = i2 / this.width | 0;
39538
+ let right2 = left2 + 1;
39539
+ let bottom2 = top2 + 1;
39540
+ for (let j = 1; right2 < this.width && this.map[i2 + j] == curPos; j++) {
39541
+ right2++;
39542
+ }
39543
+ for (let j = 1; bottom2 < this.height && this.map[i2 + this.width * j] == curPos; j++) {
39544
+ bottom2++;
39545
+ }
39546
+ return { left: left2, top: top2, right: right2, bottom: bottom2 };
39547
+ }
39548
+ throw new RangeError(`No cell with offset ${pos} found`);
39549
+ }
39550
+ // Find the left side of the cell at the given position.
39551
+ colCount(pos) {
39552
+ for (let i2 = 0; i2 < this.map.length; i2++) {
39553
+ if (this.map[i2] == pos) {
39554
+ return i2 % this.width;
39555
+ }
39556
+ }
39557
+ throw new RangeError(`No cell with offset ${pos} found`);
39558
+ }
39559
+ // Find the next cell in the given direction, starting from the cell
39560
+ // at `pos`, if any.
39561
+ nextCell(pos, axis2, dir) {
39562
+ const { left: left2, right: right2, top: top2, bottom: bottom2 } = this.findCell(pos);
39563
+ if (axis2 == "horiz") {
39564
+ if (dir < 0 ? left2 == 0 : right2 == this.width)
39565
+ return null;
39566
+ return this.map[top2 * this.width + (dir < 0 ? left2 - 1 : right2)];
39567
+ } else {
39568
+ if (dir < 0 ? top2 == 0 : bottom2 == this.height)
39569
+ return null;
39570
+ return this.map[left2 + this.width * (dir < 0 ? top2 - 1 : bottom2)];
39571
+ }
39572
+ }
39573
+ // Get the rectangle spanning the two given cells.
39574
+ rectBetween(a2, b2) {
39575
+ const {
39576
+ left: leftA,
39577
+ right: rightA,
39578
+ top: topA,
39579
+ bottom: bottomA
39580
+ } = this.findCell(a2);
39581
+ const {
39582
+ left: leftB,
39583
+ right: rightB,
39584
+ top: topB,
39585
+ bottom: bottomB
39586
+ } = this.findCell(b2);
39587
+ return {
39588
+ left: Math.min(leftA, leftB),
39589
+ top: Math.min(topA, topB),
39590
+ right: Math.max(rightA, rightB),
39591
+ bottom: Math.max(bottomA, bottomB)
39592
+ };
39593
+ }
39594
+ // Return the position of all cells that have the top left corner in
39595
+ // the given rectangle.
39596
+ cellsInRect(rect) {
39597
+ const result = [];
39598
+ const seen = {};
39599
+ for (let row = rect.top; row < rect.bottom; row++) {
39600
+ for (let col = rect.left; col < rect.right; col++) {
39601
+ const index2 = row * this.width + col;
39602
+ const pos = this.map[index2];
39603
+ if (seen[pos])
39604
+ continue;
39605
+ seen[pos] = true;
39606
+ if (col == rect.left && col && this.map[index2 - 1] == pos || row == rect.top && row && this.map[index2 - this.width] == pos) {
39607
+ continue;
39608
+ }
39609
+ result.push(pos);
39610
+ }
39611
+ }
39612
+ return result;
39613
+ }
39614
+ // Return the position at which the cell at the given row and column
39615
+ // starts, or would start, if a cell started there.
39616
+ positionAt(row, col, table) {
39617
+ for (let i2 = 0, rowStart = 0; ; i2++) {
39618
+ const rowEnd = rowStart + table.child(i2).nodeSize;
39619
+ if (i2 == row) {
39620
+ let index2 = col + row * this.width;
39621
+ const rowEndIndex = (row + 1) * this.width;
39622
+ while (index2 < rowEndIndex && this.map[index2] < rowStart)
39623
+ index2++;
39624
+ return index2 == rowEndIndex ? rowEnd - 1 : this.map[index2];
39625
+ }
39626
+ rowStart = rowEnd;
39627
+ }
39628
+ }
39629
+ // Find the table map for the given table node.
39630
+ static get(table) {
39631
+ return readFromCache(table) || addToCache(table, computeMap(table));
39632
+ }
39633
+ };
39634
+ function computeMap(table) {
39635
+ if (table.type.spec.tableRole != "table")
39636
+ throw new RangeError("Not a table node: " + table.type.name);
39637
+ const width = findWidth(table), height = table.childCount;
39638
+ const map4 = [];
39639
+ let mapPos = 0;
39640
+ let problems = null;
39641
+ const colWidths = [];
39642
+ for (let i2 = 0, e = width * height; i2 < e; i2++)
39643
+ map4[i2] = 0;
39644
+ for (let row = 0, pos = 0; row < height; row++) {
39645
+ const rowNode = table.child(row);
39646
+ pos++;
39647
+ for (let i2 = 0; ; i2++) {
39648
+ while (mapPos < map4.length && map4[mapPos] != 0)
39649
+ mapPos++;
39650
+ if (i2 == rowNode.childCount)
39651
+ break;
39652
+ const cellNode = rowNode.child(i2);
39653
+ const { colspan, rowspan, colwidth } = cellNode.attrs;
39654
+ for (let h2 = 0; h2 < rowspan; h2++) {
39655
+ if (h2 + row >= height) {
39656
+ (problems || (problems = [])).push({
39657
+ type: "overlong_rowspan",
39658
+ pos,
39659
+ n: rowspan - h2
39660
+ });
39661
+ break;
39662
+ }
39663
+ const start2 = mapPos + h2 * width;
39664
+ for (let w2 = 0; w2 < colspan; w2++) {
39665
+ if (map4[start2 + w2] == 0)
39666
+ map4[start2 + w2] = pos;
39667
+ else
39668
+ (problems || (problems = [])).push({
39669
+ type: "collision",
39670
+ row,
39671
+ pos,
39672
+ n: colspan - w2
39673
+ });
39674
+ const colW = colwidth && colwidth[w2];
39675
+ if (colW) {
39676
+ const widthIndex = (start2 + w2) % width * 2, prev = colWidths[widthIndex];
39677
+ if (prev == null || prev != colW && colWidths[widthIndex + 1] == 1) {
39678
+ colWidths[widthIndex] = colW;
39679
+ colWidths[widthIndex + 1] = 1;
39680
+ } else if (prev == colW) {
39681
+ colWidths[widthIndex + 1]++;
39682
+ }
39683
+ }
39684
+ }
39685
+ }
39686
+ mapPos += colspan;
39687
+ pos += cellNode.nodeSize;
39688
+ }
39689
+ const expectedPos = (row + 1) * width;
39690
+ let missing = 0;
39691
+ while (mapPos < expectedPos)
39692
+ if (map4[mapPos++] == 0)
39693
+ missing++;
39694
+ if (missing)
39695
+ (problems || (problems = [])).push({ type: "missing", row, n: missing });
39696
+ pos++;
39697
+ }
39698
+ const tableMap = new TableMap(width, height, map4, problems);
39699
+ let badWidths = false;
39700
+ for (let i2 = 0; !badWidths && i2 < colWidths.length; i2 += 2)
39701
+ if (colWidths[i2] != null && colWidths[i2 + 1] < height)
39702
+ badWidths = true;
39703
+ if (badWidths)
39704
+ findBadColWidths(tableMap, colWidths, table);
39705
+ return tableMap;
39706
+ }
39707
+ function findWidth(table) {
39708
+ let width = -1;
39709
+ let hasRowSpan = false;
39710
+ for (let row = 0; row < table.childCount; row++) {
39711
+ const rowNode = table.child(row);
39712
+ let rowWidth = 0;
39713
+ if (hasRowSpan)
39714
+ for (let j = 0; j < row; j++) {
39715
+ const prevRow = table.child(j);
39716
+ for (let i2 = 0; i2 < prevRow.childCount; i2++) {
39717
+ const cell = prevRow.child(i2);
39718
+ if (j + cell.attrs.rowspan > row)
39719
+ rowWidth += cell.attrs.colspan;
39720
+ }
39721
+ }
39722
+ for (let i2 = 0; i2 < rowNode.childCount; i2++) {
39723
+ const cell = rowNode.child(i2);
39724
+ rowWidth += cell.attrs.colspan;
39725
+ if (cell.attrs.rowspan > 1)
39726
+ hasRowSpan = true;
39727
+ }
39728
+ if (width == -1)
39729
+ width = rowWidth;
39730
+ else if (width != rowWidth)
39731
+ width = Math.max(width, rowWidth);
39732
+ }
39733
+ return width;
39734
+ }
39735
+ function findBadColWidths(map4, colWidths, table) {
39736
+ if (!map4.problems)
39737
+ map4.problems = [];
39738
+ const seen = {};
39739
+ for (let i2 = 0; i2 < map4.map.length; i2++) {
39740
+ const pos = map4.map[i2];
39741
+ if (seen[pos])
39742
+ continue;
39743
+ seen[pos] = true;
39744
+ const node = table.nodeAt(pos);
39745
+ if (!node) {
39746
+ throw new RangeError(`No cell with offset ${pos} found`);
39747
+ }
39748
+ let updated = null;
39749
+ const attrs = node.attrs;
39750
+ for (let j = 0; j < attrs.colspan; j++) {
39751
+ const col = (i2 + j) % map4.width;
39752
+ const colWidth = colWidths[col * 2];
39753
+ if (colWidth != null && (!attrs.colwidth || attrs.colwidth[j] != colWidth))
39754
+ (updated || (updated = freshColWidth(attrs)))[j] = colWidth;
39755
+ }
39756
+ if (updated)
39757
+ map4.problems.unshift({
39758
+ type: "colwidth mismatch",
39759
+ pos,
39760
+ colwidth: updated
39761
+ });
39762
+ }
39763
+ }
39764
+ function freshColWidth(attrs) {
39765
+ if (attrs.colwidth)
39766
+ return attrs.colwidth.slice();
39767
+ const result = [];
39768
+ for (let i2 = 0; i2 < attrs.colspan; i2++)
39769
+ result.push(0);
39770
+ return result;
39771
+ }
39772
+ function tableNodeTypes(schema) {
39773
+ let result = schema.cached.tableNodeTypes;
39774
+ if (!result) {
39775
+ result = schema.cached.tableNodeTypes = {};
39776
+ for (const name in schema.nodes) {
39777
+ const type3 = schema.nodes[name], role = type3.spec.tableRole;
39778
+ if (role)
39779
+ result[role] = type3;
39780
+ }
39781
+ }
39782
+ return result;
39783
+ }
39784
+ var tableEditingKey = new PluginKey("selectingCells");
39785
+ function cellAround($pos) {
39786
+ for (let d2 = $pos.depth - 1; d2 > 0; d2--)
39787
+ if ($pos.node(d2).type.spec.tableRole == "row")
39788
+ return $pos.node(0).resolve($pos.before(d2 + 1));
39789
+ return null;
39790
+ }
39791
+ function cellWrapping($pos) {
39792
+ for (let d2 = $pos.depth; d2 > 0; d2--) {
39793
+ const role = $pos.node(d2).type.spec.tableRole;
39794
+ if (role === "cell" || role === "header_cell")
39795
+ return $pos.node(d2);
39796
+ }
39797
+ return null;
39798
+ }
39799
+ function isInTable(state2) {
39800
+ const $head = state2.selection.$head;
39801
+ for (let d2 = $head.depth; d2 > 0; d2--)
39802
+ if ($head.node(d2).type.spec.tableRole == "row")
39803
+ return true;
39804
+ return false;
39805
+ }
39806
+ function selectionCell(state2) {
39807
+ const sel = state2.selection;
39808
+ if ("$anchorCell" in sel && sel.$anchorCell) {
39809
+ return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;
39810
+ } else if ("node" in sel && sel.node && sel.node.type.spec.tableRole == "cell") {
39811
+ return sel.$anchor;
39812
+ }
39813
+ const $cell = cellAround(sel.$head) || cellNear(sel.$head);
39814
+ if ($cell) {
39815
+ return $cell;
39816
+ }
39817
+ throw new RangeError(`No cell found around position ${sel.head}`);
39818
+ }
39819
+ function cellNear($pos) {
39820
+ for (let after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {
39821
+ const role = after.type.spec.tableRole;
39822
+ if (role == "cell" || role == "header_cell")
39823
+ return $pos.doc.resolve(pos);
39824
+ }
39825
+ for (let before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) {
39826
+ const role = before.type.spec.tableRole;
39827
+ if (role == "cell" || role == "header_cell")
39828
+ return $pos.doc.resolve(pos - before.nodeSize);
39829
+ }
39830
+ }
39831
+ function pointsAtCell($pos) {
39832
+ return $pos.parent.type.spec.tableRole == "row" && !!$pos.nodeAfter;
39833
+ }
39834
+ function moveCellForward($pos) {
39835
+ return $pos.node(0).resolve($pos.pos + $pos.nodeAfter.nodeSize);
39836
+ }
39837
+ function inSameTable($cellA, $cellB) {
39838
+ return $cellA.depth == $cellB.depth && $cellA.pos >= $cellB.start(-1) && $cellA.pos <= $cellB.end(-1);
39839
+ }
39840
+ function nextCell($pos, axis2, dir) {
39841
+ const table = $pos.node(-1);
39842
+ const map4 = TableMap.get(table);
39843
+ const tableStart = $pos.start(-1);
39844
+ const moved2 = map4.nextCell($pos.pos - tableStart, axis2, dir);
39845
+ return moved2 == null ? null : $pos.node(0).resolve(tableStart + moved2);
39846
+ }
39847
+ function removeColSpan(attrs, pos, n2 = 1) {
39848
+ const result = { ...attrs, colspan: attrs.colspan - n2 };
39849
+ if (result.colwidth) {
39850
+ result.colwidth = result.colwidth.slice();
39851
+ result.colwidth.splice(pos, n2);
39852
+ if (!result.colwidth.some((w2) => w2 > 0))
39853
+ result.colwidth = null;
39854
+ }
39855
+ return result;
39856
+ }
39857
+ function addColSpan(attrs, pos, n2 = 1) {
39858
+ const result = { ...attrs, colspan: attrs.colspan + n2 };
39859
+ if (result.colwidth) {
39860
+ result.colwidth = result.colwidth.slice();
39861
+ for (let i2 = 0; i2 < n2; i2++)
39862
+ result.colwidth.splice(pos, 0, 0);
39863
+ }
39864
+ return result;
39865
+ }
39866
+ function columnIsHeader(map4, table, col) {
39867
+ const headerCell = tableNodeTypes(table.type.schema).header_cell;
39868
+ for (let row = 0; row < map4.height; row++)
39869
+ if (table.nodeAt(map4.map[col + row * map4.width]).type != headerCell)
39870
+ return false;
39871
+ return true;
39872
+ }
39873
+ var CellSelection = class _CellSelection extends Selection$1 {
39874
+ // A table selection is identified by its anchor and head cells. The
39875
+ // positions given to this constructor should point _before_ two
39876
+ // cells in the same table. They may be the same, to select a single
39877
+ // cell.
39878
+ constructor($anchorCell, $headCell = $anchorCell) {
39879
+ const table = $anchorCell.node(-1);
39880
+ const map4 = TableMap.get(table);
39881
+ const tableStart = $anchorCell.start(-1);
39882
+ const rect = map4.rectBetween(
39883
+ $anchorCell.pos - tableStart,
39884
+ $headCell.pos - tableStart
39885
+ );
39886
+ const doc2 = $anchorCell.node(0);
39887
+ const cells = map4.cellsInRect(rect).filter((p2) => p2 != $headCell.pos - tableStart);
39888
+ cells.unshift($headCell.pos - tableStart);
39889
+ const ranges = cells.map((pos) => {
39890
+ const cell = table.nodeAt(pos);
39891
+ if (!cell) {
39892
+ throw RangeError(`No cell with offset ${pos} found`);
39893
+ }
39894
+ const from2 = tableStart + pos + 1;
39895
+ return new SelectionRange(
39896
+ doc2.resolve(from2),
39897
+ doc2.resolve(from2 + cell.content.size)
39898
+ );
39899
+ });
39900
+ super(ranges[0].$from, ranges[0].$to, ranges);
39901
+ this.$anchorCell = $anchorCell;
39902
+ this.$headCell = $headCell;
39903
+ }
39904
+ map(doc2, mapping) {
39905
+ const $anchorCell = doc2.resolve(mapping.map(this.$anchorCell.pos));
39906
+ const $headCell = doc2.resolve(mapping.map(this.$headCell.pos));
39907
+ if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {
39908
+ const tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);
39909
+ if (tableChanged && this.isRowSelection())
39910
+ return _CellSelection.rowSelection($anchorCell, $headCell);
39911
+ else if (tableChanged && this.isColSelection())
39912
+ return _CellSelection.colSelection($anchorCell, $headCell);
39913
+ else
39914
+ return new _CellSelection($anchorCell, $headCell);
39915
+ }
39916
+ return TextSelection.between($anchorCell, $headCell);
39917
+ }
39918
+ // Returns a rectangular slice of table rows containing the selected
39919
+ // cells.
39920
+ content() {
39921
+ const table = this.$anchorCell.node(-1);
39922
+ const map4 = TableMap.get(table);
39923
+ const tableStart = this.$anchorCell.start(-1);
39924
+ const rect = map4.rectBetween(
39925
+ this.$anchorCell.pos - tableStart,
39926
+ this.$headCell.pos - tableStart
39927
+ );
39928
+ const seen = {};
39929
+ const rows = [];
39930
+ for (let row = rect.top; row < rect.bottom; row++) {
39931
+ const rowContent = [];
39932
+ for (let index2 = row * map4.width + rect.left, col = rect.left; col < rect.right; col++, index2++) {
39933
+ const pos = map4.map[index2];
39934
+ if (seen[pos])
39935
+ continue;
39936
+ seen[pos] = true;
39937
+ const cellRect = map4.findCell(pos);
39938
+ let cell = table.nodeAt(pos);
39939
+ if (!cell) {
39940
+ throw RangeError(`No cell with offset ${pos} found`);
39941
+ }
39942
+ const extraLeft = rect.left - cellRect.left;
39943
+ const extraRight = cellRect.right - rect.right;
39944
+ if (extraLeft > 0 || extraRight > 0) {
39945
+ let attrs = cell.attrs;
39946
+ if (extraLeft > 0) {
39947
+ attrs = removeColSpan(attrs, 0, extraLeft);
39948
+ }
39949
+ if (extraRight > 0) {
39950
+ attrs = removeColSpan(
39951
+ attrs,
39952
+ attrs.colspan - extraRight,
39953
+ extraRight
39954
+ );
39955
+ }
39956
+ if (cellRect.left < rect.left) {
39957
+ cell = cell.type.createAndFill(attrs);
39958
+ if (!cell) {
39959
+ throw RangeError(
39960
+ `Could not create cell with attrs ${JSON.stringify(attrs)}`
39961
+ );
39962
+ }
39963
+ } else {
39964
+ cell = cell.type.create(attrs, cell.content);
39965
+ }
39966
+ }
39967
+ if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {
39968
+ const attrs = {
39969
+ ...cell.attrs,
39970
+ rowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top)
39971
+ };
39972
+ if (cellRect.top < rect.top) {
39973
+ cell = cell.type.createAndFill(attrs);
39974
+ } else {
39975
+ cell = cell.type.create(attrs, cell.content);
39976
+ }
39977
+ }
39978
+ rowContent.push(cell);
39979
+ }
39980
+ rows.push(table.child(row).copy(Fragment.from(rowContent)));
39981
+ }
39982
+ const fragment = this.isColSelection() && this.isRowSelection() ? table : rows;
39983
+ return new Slice(Fragment.from(fragment), 1, 1);
39984
+ }
39985
+ replace(tr2, content = Slice.empty) {
39986
+ const mapFrom = tr2.steps.length, ranges = this.ranges;
39987
+ for (let i2 = 0; i2 < ranges.length; i2++) {
39988
+ const { $from, $to } = ranges[i2], mapping = tr2.mapping.slice(mapFrom);
39989
+ tr2.replace(
39990
+ mapping.map($from.pos),
39991
+ mapping.map($to.pos),
39992
+ i2 ? Slice.empty : content
39993
+ );
39994
+ }
39995
+ const sel = Selection$1.findFrom(
39996
+ tr2.doc.resolve(tr2.mapping.slice(mapFrom).map(this.to)),
39997
+ -1
39998
+ );
39999
+ if (sel)
40000
+ tr2.setSelection(sel);
40001
+ }
40002
+ replaceWith(tr2, node) {
40003
+ this.replace(tr2, new Slice(Fragment.from(node), 0, 0));
40004
+ }
40005
+ forEachCell(f2) {
40006
+ const table = this.$anchorCell.node(-1);
40007
+ const map4 = TableMap.get(table);
40008
+ const tableStart = this.$anchorCell.start(-1);
40009
+ const cells = map4.cellsInRect(
40010
+ map4.rectBetween(
40011
+ this.$anchorCell.pos - tableStart,
40012
+ this.$headCell.pos - tableStart
40013
+ )
40014
+ );
40015
+ for (let i2 = 0; i2 < cells.length; i2++) {
40016
+ f2(table.nodeAt(cells[i2]), tableStart + cells[i2]);
40017
+ }
40018
+ }
40019
+ // True if this selection goes all the way from the top to the
40020
+ // bottom of the table.
40021
+ isColSelection() {
40022
+ const anchorTop = this.$anchorCell.index(-1);
40023
+ const headTop = this.$headCell.index(-1);
40024
+ if (Math.min(anchorTop, headTop) > 0)
40025
+ return false;
40026
+ const anchorBottom = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan;
40027
+ const headBottom = headTop + this.$headCell.nodeAfter.attrs.rowspan;
40028
+ return Math.max(anchorBottom, headBottom) == this.$headCell.node(-1).childCount;
40029
+ }
40030
+ // Returns the smallest column selection that covers the given anchor
40031
+ // and head cell.
40032
+ static colSelection($anchorCell, $headCell = $anchorCell) {
40033
+ const table = $anchorCell.node(-1);
40034
+ const map4 = TableMap.get(table);
40035
+ const tableStart = $anchorCell.start(-1);
40036
+ const anchorRect = map4.findCell($anchorCell.pos - tableStart);
40037
+ const headRect = map4.findCell($headCell.pos - tableStart);
40038
+ const doc2 = $anchorCell.node(0);
40039
+ if (anchorRect.top <= headRect.top) {
40040
+ if (anchorRect.top > 0)
40041
+ $anchorCell = doc2.resolve(tableStart + map4.map[anchorRect.left]);
40042
+ if (headRect.bottom < map4.height)
40043
+ $headCell = doc2.resolve(
40044
+ tableStart + map4.map[map4.width * (map4.height - 1) + headRect.right - 1]
40045
+ );
40046
+ } else {
40047
+ if (headRect.top > 0)
40048
+ $headCell = doc2.resolve(tableStart + map4.map[headRect.left]);
40049
+ if (anchorRect.bottom < map4.height)
40050
+ $anchorCell = doc2.resolve(
40051
+ tableStart + map4.map[map4.width * (map4.height - 1) + anchorRect.right - 1]
40052
+ );
40053
+ }
40054
+ return new _CellSelection($anchorCell, $headCell);
40055
+ }
40056
+ // True if this selection goes all the way from the left to the
40057
+ // right of the table.
40058
+ isRowSelection() {
40059
+ const table = this.$anchorCell.node(-1);
40060
+ const map4 = TableMap.get(table);
40061
+ const tableStart = this.$anchorCell.start(-1);
40062
+ const anchorLeft = map4.colCount(this.$anchorCell.pos - tableStart);
40063
+ const headLeft = map4.colCount(this.$headCell.pos - tableStart);
40064
+ if (Math.min(anchorLeft, headLeft) > 0)
40065
+ return false;
40066
+ const anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan;
40067
+ const headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;
40068
+ return Math.max(anchorRight, headRight) == map4.width;
40069
+ }
40070
+ eq(other) {
40071
+ return other instanceof _CellSelection && other.$anchorCell.pos == this.$anchorCell.pos && other.$headCell.pos == this.$headCell.pos;
40072
+ }
40073
+ // Returns the smallest row selection that covers the given anchor
40074
+ // and head cell.
40075
+ static rowSelection($anchorCell, $headCell = $anchorCell) {
40076
+ const table = $anchorCell.node(-1);
40077
+ const map4 = TableMap.get(table);
40078
+ const tableStart = $anchorCell.start(-1);
40079
+ const anchorRect = map4.findCell($anchorCell.pos - tableStart);
40080
+ const headRect = map4.findCell($headCell.pos - tableStart);
40081
+ const doc2 = $anchorCell.node(0);
40082
+ if (anchorRect.left <= headRect.left) {
40083
+ if (anchorRect.left > 0)
40084
+ $anchorCell = doc2.resolve(
40085
+ tableStart + map4.map[anchorRect.top * map4.width]
40086
+ );
40087
+ if (headRect.right < map4.width)
40088
+ $headCell = doc2.resolve(
40089
+ tableStart + map4.map[map4.width * (headRect.top + 1) - 1]
40090
+ );
40091
+ } else {
40092
+ if (headRect.left > 0)
40093
+ $headCell = doc2.resolve(tableStart + map4.map[headRect.top * map4.width]);
40094
+ if (anchorRect.right < map4.width)
40095
+ $anchorCell = doc2.resolve(
40096
+ tableStart + map4.map[map4.width * (anchorRect.top + 1) - 1]
40097
+ );
40098
+ }
40099
+ return new _CellSelection($anchorCell, $headCell);
40100
+ }
40101
+ toJSON() {
40102
+ return {
40103
+ type: "cell",
40104
+ anchor: this.$anchorCell.pos,
40105
+ head: this.$headCell.pos
40106
+ };
40107
+ }
40108
+ static fromJSON(doc2, json) {
40109
+ return new _CellSelection(doc2.resolve(json.anchor), doc2.resolve(json.head));
40110
+ }
40111
+ static create(doc2, anchorCell, headCell = anchorCell) {
40112
+ return new _CellSelection(doc2.resolve(anchorCell), doc2.resolve(headCell));
40113
+ }
40114
+ getBookmark() {
40115
+ return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos);
40116
+ }
40117
+ };
40118
+ CellSelection.prototype.visible = false;
40119
+ Selection$1.jsonID("cell", CellSelection);
40120
+ var CellBookmark = class _CellBookmark {
40121
+ constructor(anchor, head) {
40122
+ this.anchor = anchor;
40123
+ this.head = head;
40124
+ }
40125
+ map(mapping) {
40126
+ return new _CellBookmark(mapping.map(this.anchor), mapping.map(this.head));
40127
+ }
40128
+ resolve(doc2) {
40129
+ const $anchorCell = doc2.resolve(this.anchor), $headCell = doc2.resolve(this.head);
40130
+ if ($anchorCell.parent.type.spec.tableRole == "row" && $headCell.parent.type.spec.tableRole == "row" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell))
40131
+ return new CellSelection($anchorCell, $headCell);
40132
+ else
40133
+ return Selection$1.near($headCell, 1);
40134
+ }
40135
+ };
40136
+ function drawCellSelection(state2) {
40137
+ if (!(state2.selection instanceof CellSelection))
40138
+ return null;
40139
+ const cells = [];
40140
+ state2.selection.forEachCell((node, pos) => {
40141
+ cells.push(
40142
+ Decoration.node(pos, pos + node.nodeSize, { class: "selectedCell" })
40143
+ );
40144
+ });
40145
+ return DecorationSet.create(state2.doc, cells);
40146
+ }
40147
+ function isCellBoundarySelection({ $from, $to }) {
40148
+ if ($from.pos == $to.pos || $from.pos < $from.pos - 6)
40149
+ return false;
40150
+ let afterFrom = $from.pos;
40151
+ let beforeTo = $to.pos;
40152
+ let depth = $from.depth;
40153
+ for (; depth >= 0; depth--, afterFrom++)
40154
+ if ($from.after(depth + 1) < $from.end(depth))
40155
+ break;
40156
+ for (let d2 = $to.depth; d2 >= 0; d2--, beforeTo--)
40157
+ if ($to.before(d2 + 1) > $to.start(d2))
40158
+ break;
40159
+ return afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole);
40160
+ }
40161
+ function isTextSelectionAcrossCells({ $from, $to }) {
40162
+ let fromCellBoundaryNode;
40163
+ let toCellBoundaryNode;
40164
+ for (let i2 = $from.depth; i2 > 0; i2--) {
40165
+ const node = $from.node(i2);
40166
+ if (node.type.spec.tableRole === "cell" || node.type.spec.tableRole === "header_cell") {
40167
+ fromCellBoundaryNode = node;
40168
+ break;
40169
+ }
40170
+ }
40171
+ for (let i2 = $to.depth; i2 > 0; i2--) {
40172
+ const node = $to.node(i2);
40173
+ if (node.type.spec.tableRole === "cell" || node.type.spec.tableRole === "header_cell") {
40174
+ toCellBoundaryNode = node;
40175
+ break;
40176
+ }
40177
+ }
40178
+ return fromCellBoundaryNode !== toCellBoundaryNode && $to.parentOffset === 0;
40179
+ }
40180
+ function normalizeSelection(state2, tr2, allowTableNodeSelection) {
40181
+ const sel = (tr2 || state2).selection;
40182
+ const doc2 = (tr2 || state2).doc;
40183
+ let normalize2;
40184
+ let role;
40185
+ if (sel instanceof NodeSelection && (role = sel.node.type.spec.tableRole)) {
40186
+ if (role == "cell" || role == "header_cell") {
40187
+ normalize2 = CellSelection.create(doc2, sel.from);
40188
+ } else if (role == "row") {
40189
+ const $cell = doc2.resolve(sel.from + 1);
40190
+ normalize2 = CellSelection.rowSelection($cell, $cell);
40191
+ } else if (!allowTableNodeSelection) {
40192
+ const map4 = TableMap.get(sel.node);
40193
+ const start2 = sel.from + 1;
40194
+ const lastCell = start2 + map4.map[map4.width * map4.height - 1];
40195
+ normalize2 = CellSelection.create(doc2, start2 + 1, lastCell);
40196
+ }
40197
+ } else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) {
40198
+ normalize2 = TextSelection.create(doc2, sel.from);
40199
+ } else if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) {
40200
+ normalize2 = TextSelection.create(doc2, sel.$from.start(), sel.$from.end());
40201
+ }
40202
+ if (normalize2)
40203
+ (tr2 || (tr2 = state2.tr)).setSelection(normalize2);
40204
+ return tr2;
40205
+ }
40206
+ var fixTablesKey = new PluginKey("fix-tables");
40207
+ function changedDescendants(old, cur, offset2, f2) {
40208
+ const oldSize = old.childCount, curSize = cur.childCount;
40209
+ outer:
40210
+ for (let i2 = 0, j = 0; i2 < curSize; i2++) {
40211
+ const child = cur.child(i2);
40212
+ for (let scan = j, e = Math.min(oldSize, i2 + 3); scan < e; scan++) {
40213
+ if (old.child(scan) == child) {
40214
+ j = scan + 1;
40215
+ offset2 += child.nodeSize;
40216
+ continue outer;
40217
+ }
40218
+ }
40219
+ f2(child, offset2);
40220
+ if (j < oldSize && old.child(j).sameMarkup(child))
40221
+ changedDescendants(old.child(j), child, offset2 + 1, f2);
40222
+ else
40223
+ child.nodesBetween(0, child.content.size, f2, offset2 + 1);
40224
+ offset2 += child.nodeSize;
40225
+ }
40226
+ }
40227
+ function fixTables(state2, oldState) {
40228
+ let tr2;
40229
+ const check = (node, pos) => {
40230
+ if (node.type.spec.tableRole == "table")
40231
+ tr2 = fixTable(state2, node, pos, tr2);
40232
+ };
40233
+ if (!oldState)
40234
+ state2.doc.descendants(check);
40235
+ else if (oldState.doc != state2.doc)
40236
+ changedDescendants(oldState.doc, state2.doc, 0, check);
40237
+ return tr2;
40238
+ }
40239
+ function fixTable(state2, table, tablePos, tr2) {
40240
+ const map4 = TableMap.get(table);
40241
+ if (!map4.problems)
40242
+ return tr2;
40243
+ if (!tr2)
40244
+ tr2 = state2.tr;
40245
+ const mustAdd = [];
40246
+ for (let i2 = 0; i2 < map4.height; i2++)
40247
+ mustAdd.push(0);
40248
+ for (let i2 = 0; i2 < map4.problems.length; i2++) {
40249
+ const prob = map4.problems[i2];
40250
+ if (prob.type == "collision") {
40251
+ const cell = table.nodeAt(prob.pos);
40252
+ if (!cell)
40253
+ continue;
40254
+ const attrs = cell.attrs;
40255
+ for (let j = 0; j < attrs.rowspan; j++)
40256
+ mustAdd[prob.row + j] += prob.n;
40257
+ tr2.setNodeMarkup(
40258
+ tr2.mapping.map(tablePos + 1 + prob.pos),
40259
+ null,
40260
+ removeColSpan(attrs, attrs.colspan - prob.n, prob.n)
40261
+ );
40262
+ } else if (prob.type == "missing") {
40263
+ mustAdd[prob.row] += prob.n;
40264
+ } else if (prob.type == "overlong_rowspan") {
40265
+ const cell = table.nodeAt(prob.pos);
40266
+ if (!cell)
40267
+ continue;
40268
+ tr2.setNodeMarkup(tr2.mapping.map(tablePos + 1 + prob.pos), null, {
40269
+ ...cell.attrs,
40270
+ rowspan: cell.attrs.rowspan - prob.n
40271
+ });
40272
+ } else if (prob.type == "colwidth mismatch") {
40273
+ const cell = table.nodeAt(prob.pos);
40274
+ if (!cell)
40275
+ continue;
40276
+ tr2.setNodeMarkup(tr2.mapping.map(tablePos + 1 + prob.pos), null, {
40277
+ ...cell.attrs,
40278
+ colwidth: prob.colwidth
40279
+ });
40280
+ }
40281
+ }
40282
+ let first2, last;
40283
+ for (let i2 = 0; i2 < mustAdd.length; i2++)
40284
+ if (mustAdd[i2]) {
40285
+ if (first2 == null)
40286
+ first2 = i2;
40287
+ last = i2;
40288
+ }
40289
+ for (let i2 = 0, pos = tablePos + 1; i2 < map4.height; i2++) {
40290
+ const row = table.child(i2);
40291
+ const end2 = pos + row.nodeSize;
40292
+ const add2 = mustAdd[i2];
40293
+ if (add2 > 0) {
40294
+ let role = "cell";
40295
+ if (row.firstChild) {
40296
+ role = row.firstChild.type.spec.tableRole;
40297
+ }
40298
+ const nodes = [];
40299
+ for (let j = 0; j < add2; j++) {
40300
+ const node = tableNodeTypes(state2.schema)[role].createAndFill();
40301
+ if (node)
40302
+ nodes.push(node);
40303
+ }
40304
+ const side = (i2 == 0 || first2 == i2 - 1) && last == i2 ? pos + 1 : end2 - 1;
40305
+ tr2.insert(tr2.mapping.map(side), nodes);
40306
+ }
40307
+ pos = end2;
40308
+ }
40309
+ return tr2.setMeta(fixTablesKey, { fixTables: true });
40310
+ }
40311
+ function pastedCells(slice4) {
40312
+ if (!slice4.size)
40313
+ return null;
40314
+ let { content, openStart, openEnd } = slice4;
40315
+ while (content.childCount == 1 && (openStart > 0 && openEnd > 0 || content.child(0).type.spec.tableRole == "table")) {
40316
+ openStart--;
40317
+ openEnd--;
40318
+ content = content.child(0).content;
40319
+ }
40320
+ const first2 = content.child(0);
40321
+ const role = first2.type.spec.tableRole;
40322
+ const schema = first2.type.schema, rows = [];
40323
+ if (role == "row") {
40324
+ for (let i2 = 0; i2 < content.childCount; i2++) {
40325
+ let cells = content.child(i2).content;
40326
+ const left2 = i2 ? 0 : Math.max(0, openStart - 1);
40327
+ const right2 = i2 < content.childCount - 1 ? 0 : Math.max(0, openEnd - 1);
40328
+ if (left2 || right2)
40329
+ cells = fitSlice(
40330
+ tableNodeTypes(schema).row,
40331
+ new Slice(cells, left2, right2)
40332
+ ).content;
40333
+ rows.push(cells);
40334
+ }
40335
+ } else if (role == "cell" || role == "header_cell") {
40336
+ rows.push(
40337
+ openStart || openEnd ? fitSlice(
40338
+ tableNodeTypes(schema).row,
40339
+ new Slice(content, openStart, openEnd)
40340
+ ).content : content
40341
+ );
40342
+ } else {
40343
+ return null;
40344
+ }
40345
+ return ensureRectangular(schema, rows);
40346
+ }
40347
+ function ensureRectangular(schema, rows) {
40348
+ const widths = [];
40349
+ for (let i2 = 0; i2 < rows.length; i2++) {
40350
+ const row = rows[i2];
40351
+ for (let j = row.childCount - 1; j >= 0; j--) {
40352
+ const { rowspan, colspan } = row.child(j).attrs;
40353
+ for (let r2 = i2; r2 < i2 + rowspan; r2++)
40354
+ widths[r2] = (widths[r2] || 0) + colspan;
40355
+ }
40356
+ }
40357
+ let width = 0;
40358
+ for (let r2 = 0; r2 < widths.length; r2++)
40359
+ width = Math.max(width, widths[r2]);
40360
+ for (let r2 = 0; r2 < widths.length; r2++) {
40361
+ if (r2 >= rows.length)
40362
+ rows.push(Fragment.empty);
40363
+ if (widths[r2] < width) {
40364
+ const empty2 = tableNodeTypes(schema).cell.createAndFill();
40365
+ const cells = [];
40366
+ for (let i2 = widths[r2]; i2 < width; i2++) {
40367
+ cells.push(empty2);
40368
+ }
40369
+ rows[r2] = rows[r2].append(Fragment.from(cells));
40370
+ }
40371
+ }
40372
+ return { height: rows.length, width, rows };
40373
+ }
40374
+ function fitSlice(nodeType, slice4) {
40375
+ const node = nodeType.createAndFill();
40376
+ const tr2 = new Transform(node).replace(0, node.content.size, slice4);
40377
+ return tr2.doc;
40378
+ }
40379
+ function clipCells({ width, height, rows }, newWidth, newHeight) {
40380
+ if (width != newWidth) {
40381
+ const added = [];
40382
+ const newRows = [];
40383
+ for (let row = 0; row < rows.length; row++) {
40384
+ const frag = rows[row], cells = [];
40385
+ for (let col = added[row] || 0, i2 = 0; col < newWidth; i2++) {
40386
+ let cell = frag.child(i2 % frag.childCount);
40387
+ if (col + cell.attrs.colspan > newWidth)
40388
+ cell = cell.type.createChecked(
40389
+ removeColSpan(
40390
+ cell.attrs,
40391
+ cell.attrs.colspan,
40392
+ col + cell.attrs.colspan - newWidth
40393
+ ),
40394
+ cell.content
40395
+ );
40396
+ cells.push(cell);
40397
+ col += cell.attrs.colspan;
40398
+ for (let j = 1; j < cell.attrs.rowspan; j++)
40399
+ added[row + j] = (added[row + j] || 0) + cell.attrs.colspan;
40400
+ }
40401
+ newRows.push(Fragment.from(cells));
40402
+ }
40403
+ rows = newRows;
40404
+ width = newWidth;
40405
+ }
40406
+ if (height != newHeight) {
40407
+ const newRows = [];
40408
+ for (let row = 0, i2 = 0; row < newHeight; row++, i2++) {
40409
+ const cells = [], source = rows[i2 % height];
40410
+ for (let j = 0; j < source.childCount; j++) {
40411
+ let cell = source.child(j);
40412
+ if (row + cell.attrs.rowspan > newHeight)
40413
+ cell = cell.type.create(
40414
+ {
40415
+ ...cell.attrs,
40416
+ rowspan: Math.max(1, newHeight - cell.attrs.rowspan)
40417
+ },
40418
+ cell.content
40419
+ );
40420
+ cells.push(cell);
40421
+ }
40422
+ newRows.push(Fragment.from(cells));
40423
+ }
40424
+ rows = newRows;
40425
+ height = newHeight;
40426
+ }
40427
+ return { width, height, rows };
40428
+ }
40429
+ function growTable(tr2, map4, table, start2, width, height, mapFrom) {
40430
+ const schema = tr2.doc.type.schema;
40431
+ const types = tableNodeTypes(schema);
40432
+ let empty2;
40433
+ let emptyHead;
40434
+ if (width > map4.width) {
40435
+ for (let row = 0, rowEnd = 0; row < map4.height; row++) {
40436
+ const rowNode = table.child(row);
40437
+ rowEnd += rowNode.nodeSize;
40438
+ const cells = [];
40439
+ let add2;
40440
+ if (rowNode.lastChild == null || rowNode.lastChild.type == types.cell)
40441
+ add2 = empty2 || (empty2 = types.cell.createAndFill());
40442
+ else
40443
+ add2 = emptyHead || (emptyHead = types.header_cell.createAndFill());
40444
+ for (let i2 = map4.width; i2 < width; i2++)
40445
+ cells.push(add2);
40446
+ tr2.insert(tr2.mapping.slice(mapFrom).map(rowEnd - 1 + start2), cells);
40447
+ }
40448
+ }
40449
+ if (height > map4.height) {
40450
+ const cells = [];
40451
+ for (let i2 = 0, start22 = (map4.height - 1) * map4.width; i2 < Math.max(map4.width, width); i2++) {
40452
+ const header = i2 >= map4.width ? false : table.nodeAt(map4.map[start22 + i2]).type == types.header_cell;
40453
+ cells.push(
40454
+ header ? emptyHead || (emptyHead = types.header_cell.createAndFill()) : empty2 || (empty2 = types.cell.createAndFill())
40455
+ );
40456
+ }
40457
+ const emptyRow = types.row.create(null, Fragment.from(cells)), rows = [];
40458
+ for (let i2 = map4.height; i2 < height; i2++)
40459
+ rows.push(emptyRow);
40460
+ tr2.insert(tr2.mapping.slice(mapFrom).map(start2 + table.nodeSize - 2), rows);
40461
+ }
40462
+ return !!(empty2 || emptyHead);
40463
+ }
40464
+ function isolateHorizontal(tr2, map4, table, start2, left2, right2, top2, mapFrom) {
40465
+ if (top2 == 0 || top2 == map4.height)
40466
+ return false;
40467
+ let found2 = false;
40468
+ for (let col = left2; col < right2; col++) {
40469
+ const index2 = top2 * map4.width + col, pos = map4.map[index2];
40470
+ if (map4.map[index2 - map4.width] == pos) {
40471
+ found2 = true;
40472
+ const cell = table.nodeAt(pos);
40473
+ const { top: cellTop, left: cellLeft } = map4.findCell(pos);
40474
+ tr2.setNodeMarkup(tr2.mapping.slice(mapFrom).map(pos + start2), null, {
40475
+ ...cell.attrs,
40476
+ rowspan: top2 - cellTop
40477
+ });
40478
+ tr2.insert(
40479
+ tr2.mapping.slice(mapFrom).map(map4.positionAt(top2, cellLeft, table)),
40480
+ cell.type.createAndFill({
40481
+ ...cell.attrs,
40482
+ rowspan: cellTop + cell.attrs.rowspan - top2
40483
+ })
40484
+ );
40485
+ col += cell.attrs.colspan - 1;
40486
+ }
40487
+ }
40488
+ return found2;
40489
+ }
40490
+ function isolateVertical(tr2, map4, table, start2, top2, bottom2, left2, mapFrom) {
40491
+ if (left2 == 0 || left2 == map4.width)
40492
+ return false;
40493
+ let found2 = false;
40494
+ for (let row = top2; row < bottom2; row++) {
40495
+ const index2 = row * map4.width + left2, pos = map4.map[index2];
40496
+ if (map4.map[index2 - 1] == pos) {
40497
+ found2 = true;
40498
+ const cell = table.nodeAt(pos);
40499
+ const cellLeft = map4.colCount(pos);
40500
+ const updatePos = tr2.mapping.slice(mapFrom).map(pos + start2);
40501
+ tr2.setNodeMarkup(
40502
+ updatePos,
40503
+ null,
40504
+ removeColSpan(
40505
+ cell.attrs,
40506
+ left2 - cellLeft,
40507
+ cell.attrs.colspan - (left2 - cellLeft)
40508
+ )
40509
+ );
40510
+ tr2.insert(
40511
+ updatePos + cell.nodeSize,
40512
+ cell.type.createAndFill(
40513
+ removeColSpan(cell.attrs, 0, left2 - cellLeft)
40514
+ )
40515
+ );
40516
+ row += cell.attrs.rowspan - 1;
40517
+ }
40518
+ }
40519
+ return found2;
40520
+ }
40521
+ function insertCells(state2, dispatch, tableStart, rect, cells) {
40522
+ let table = tableStart ? state2.doc.nodeAt(tableStart - 1) : state2.doc;
40523
+ if (!table) {
40524
+ throw new Error("No table found");
40525
+ }
40526
+ let map4 = TableMap.get(table);
40527
+ const { top: top2, left: left2 } = rect;
40528
+ const right2 = left2 + cells.width, bottom2 = top2 + cells.height;
40529
+ const tr2 = state2.tr;
40530
+ let mapFrom = 0;
40531
+ function recomp() {
40532
+ table = tableStart ? tr2.doc.nodeAt(tableStart - 1) : tr2.doc;
40533
+ if (!table) {
40534
+ throw new Error("No table found");
40535
+ }
40536
+ map4 = TableMap.get(table);
40537
+ mapFrom = tr2.mapping.maps.length;
40538
+ }
40539
+ if (growTable(tr2, map4, table, tableStart, right2, bottom2, mapFrom))
40540
+ recomp();
40541
+ if (isolateHorizontal(tr2, map4, table, tableStart, left2, right2, top2, mapFrom))
40542
+ recomp();
40543
+ if (isolateHorizontal(tr2, map4, table, tableStart, left2, right2, bottom2, mapFrom))
40544
+ recomp();
40545
+ if (isolateVertical(tr2, map4, table, tableStart, top2, bottom2, left2, mapFrom))
40546
+ recomp();
40547
+ if (isolateVertical(tr2, map4, table, tableStart, top2, bottom2, right2, mapFrom))
40548
+ recomp();
40549
+ for (let row = top2; row < bottom2; row++) {
40550
+ const from2 = map4.positionAt(row, left2, table), to2 = map4.positionAt(row, right2, table);
40551
+ tr2.replace(
40552
+ tr2.mapping.slice(mapFrom).map(from2 + tableStart),
40553
+ tr2.mapping.slice(mapFrom).map(to2 + tableStart),
40554
+ new Slice(cells.rows[row - top2], 0, 0)
40555
+ );
40556
+ }
40557
+ recomp();
40558
+ tr2.setSelection(
40559
+ new CellSelection(
40560
+ tr2.doc.resolve(tableStart + map4.positionAt(top2, left2, table)),
40561
+ tr2.doc.resolve(tableStart + map4.positionAt(bottom2 - 1, right2 - 1, table))
40562
+ )
40563
+ );
40564
+ dispatch(tr2);
40565
+ }
40566
+ var handleKeyDown = keydownHandler({
40567
+ ArrowLeft: arrow("horiz", -1),
40568
+ ArrowRight: arrow("horiz", 1),
40569
+ ArrowUp: arrow("vert", -1),
40570
+ ArrowDown: arrow("vert", 1),
40571
+ "Shift-ArrowLeft": shiftArrow("horiz", -1),
40572
+ "Shift-ArrowRight": shiftArrow("horiz", 1),
40573
+ "Shift-ArrowUp": shiftArrow("vert", -1),
40574
+ "Shift-ArrowDown": shiftArrow("vert", 1),
40575
+ Backspace: deleteCellSelection,
40576
+ "Mod-Backspace": deleteCellSelection,
40577
+ Delete: deleteCellSelection,
40578
+ "Mod-Delete": deleteCellSelection
40579
+ });
40580
+ function maybeSetSelection(state2, dispatch, selection) {
40581
+ if (selection.eq(state2.selection))
40582
+ return false;
40583
+ if (dispatch)
40584
+ dispatch(state2.tr.setSelection(selection).scrollIntoView());
40585
+ return true;
40586
+ }
40587
+ function arrow(axis2, dir) {
40588
+ return (state2, dispatch, view) => {
40589
+ if (!view)
40590
+ return false;
40591
+ const sel = state2.selection;
40592
+ if (sel instanceof CellSelection) {
40593
+ return maybeSetSelection(
40594
+ state2,
40595
+ dispatch,
40596
+ Selection$1.near(sel.$headCell, dir)
40597
+ );
40598
+ }
40599
+ if (axis2 != "horiz" && !sel.empty)
40600
+ return false;
40601
+ const end2 = atEndOfCell(view, axis2, dir);
40602
+ if (end2 == null)
40603
+ return false;
40604
+ if (axis2 == "horiz") {
40605
+ return maybeSetSelection(
40606
+ state2,
40607
+ dispatch,
40608
+ Selection$1.near(state2.doc.resolve(sel.head + dir), dir)
40609
+ );
40610
+ } else {
40611
+ const $cell = state2.doc.resolve(end2);
40612
+ const $next = nextCell($cell, axis2, dir);
40613
+ let newSel;
40614
+ if ($next)
40615
+ newSel = Selection$1.near($next, 1);
40616
+ else if (dir < 0)
40617
+ newSel = Selection$1.near(state2.doc.resolve($cell.before(-1)), -1);
40618
+ else
40619
+ newSel = Selection$1.near(state2.doc.resolve($cell.after(-1)), 1);
40620
+ return maybeSetSelection(state2, dispatch, newSel);
40621
+ }
40622
+ };
40623
+ }
40624
+ function shiftArrow(axis2, dir) {
40625
+ return (state2, dispatch, view) => {
40626
+ if (!view)
40627
+ return false;
40628
+ const sel = state2.selection;
40629
+ let cellSel;
40630
+ if (sel instanceof CellSelection) {
40631
+ cellSel = sel;
40632
+ } else {
40633
+ const end2 = atEndOfCell(view, axis2, dir);
40634
+ if (end2 == null)
40635
+ return false;
40636
+ cellSel = new CellSelection(state2.doc.resolve(end2));
40637
+ }
40638
+ const $head = nextCell(cellSel.$headCell, axis2, dir);
40639
+ if (!$head)
40640
+ return false;
40641
+ return maybeSetSelection(
40642
+ state2,
40643
+ dispatch,
40644
+ new CellSelection(cellSel.$anchorCell, $head)
40645
+ );
40646
+ };
40647
+ }
40648
+ function deleteCellSelection(state2, dispatch) {
40649
+ const sel = state2.selection;
40650
+ if (!(sel instanceof CellSelection))
40651
+ return false;
40652
+ if (dispatch) {
40653
+ const tr2 = state2.tr;
40654
+ const baseContent = tableNodeTypes(state2.schema).cell.createAndFill().content;
40655
+ sel.forEachCell((cell, pos) => {
40656
+ if (!cell.content.eq(baseContent))
40657
+ tr2.replace(
40658
+ tr2.mapping.map(pos + 1),
40659
+ tr2.mapping.map(pos + cell.nodeSize - 1),
40660
+ new Slice(baseContent, 0, 0)
40661
+ );
40662
+ });
40663
+ if (tr2.docChanged)
40664
+ dispatch(tr2);
40665
+ }
40666
+ return true;
40667
+ }
40668
+ function handleTripleClick(view, pos) {
40669
+ const doc2 = view.state.doc, $cell = cellAround(doc2.resolve(pos));
40670
+ if (!$cell)
40671
+ return false;
40672
+ view.dispatch(view.state.tr.setSelection(new CellSelection($cell)));
40673
+ return true;
40674
+ }
40675
+ function handlePaste(view, _2, slice4) {
40676
+ if (!isInTable(view.state))
40677
+ return false;
40678
+ let cells = pastedCells(slice4);
40679
+ const sel = view.state.selection;
40680
+ if (sel instanceof CellSelection) {
40681
+ if (!cells)
40682
+ cells = {
40683
+ width: 1,
40684
+ height: 1,
40685
+ rows: [
40686
+ Fragment.from(
40687
+ fitSlice(tableNodeTypes(view.state.schema).cell, slice4)
40688
+ )
40689
+ ]
40690
+ };
40691
+ const table = sel.$anchorCell.node(-1);
40692
+ const start2 = sel.$anchorCell.start(-1);
40693
+ const rect = TableMap.get(table).rectBetween(
40694
+ sel.$anchorCell.pos - start2,
40695
+ sel.$headCell.pos - start2
40696
+ );
40697
+ cells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);
40698
+ insertCells(view.state, view.dispatch, start2, rect, cells);
40699
+ return true;
40700
+ } else if (cells) {
40701
+ const $cell = selectionCell(view.state);
40702
+ const start2 = $cell.start(-1);
40703
+ insertCells(
40704
+ view.state,
40705
+ view.dispatch,
40706
+ start2,
40707
+ TableMap.get($cell.node(-1)).findCell($cell.pos - start2),
40708
+ cells
40709
+ );
40710
+ return true;
40711
+ } else {
40712
+ return false;
40713
+ }
40714
+ }
40715
+ function handleMouseDown(view, startEvent) {
40716
+ var _a2;
40717
+ if (startEvent.ctrlKey || startEvent.metaKey)
40718
+ return;
40719
+ const startDOMCell = domInCell(view, startEvent.target);
40720
+ let $anchor;
40721
+ if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
40722
+ setCellSelection(view.state.selection.$anchorCell, startEvent);
40723
+ startEvent.preventDefault();
40724
+ } else if (startEvent.shiftKey && startDOMCell && ($anchor = cellAround(view.state.selection.$anchor)) != null && ((_a2 = cellUnderMouse(view, startEvent)) == null ? void 0 : _a2.pos) != $anchor.pos) {
40725
+ setCellSelection($anchor, startEvent);
40726
+ startEvent.preventDefault();
40727
+ } else if (!startDOMCell) {
40728
+ return;
40729
+ }
40730
+ function setCellSelection($anchor2, event) {
40731
+ let $head = cellUnderMouse(view, event);
40732
+ const starting = tableEditingKey.getState(view.state) == null;
40733
+ if (!$head || !inSameTable($anchor2, $head)) {
40734
+ if (starting)
40735
+ $head = $anchor2;
40736
+ else
40737
+ return;
40738
+ }
40739
+ const selection = new CellSelection($anchor2, $head);
40740
+ if (starting || !view.state.selection.eq(selection)) {
40741
+ const tr2 = view.state.tr.setSelection(selection);
40742
+ if (starting)
40743
+ tr2.setMeta(tableEditingKey, $anchor2.pos);
40744
+ view.dispatch(tr2);
40745
+ }
40746
+ }
40747
+ function stop() {
40748
+ view.root.removeEventListener("mouseup", stop);
40749
+ view.root.removeEventListener("dragstart", stop);
40750
+ view.root.removeEventListener("mousemove", move);
40751
+ if (tableEditingKey.getState(view.state) != null)
40752
+ view.dispatch(view.state.tr.setMeta(tableEditingKey, -1));
40753
+ }
40754
+ function move(_event) {
40755
+ const event = _event;
40756
+ const anchor = tableEditingKey.getState(view.state);
40757
+ let $anchor2;
40758
+ if (anchor != null) {
40759
+ $anchor2 = view.state.doc.resolve(anchor);
40760
+ } else if (domInCell(view, event.target) != startDOMCell) {
40761
+ $anchor2 = cellUnderMouse(view, startEvent);
40762
+ if (!$anchor2)
40763
+ return stop();
40764
+ }
40765
+ if ($anchor2)
40766
+ setCellSelection($anchor2, event);
40767
+ }
40768
+ view.root.addEventListener("mouseup", stop);
40769
+ view.root.addEventListener("dragstart", stop);
40770
+ view.root.addEventListener("mousemove", move);
40771
+ }
40772
+ function atEndOfCell(view, axis2, dir) {
40773
+ if (!(view.state.selection instanceof TextSelection))
40774
+ return null;
40775
+ const { $head } = view.state.selection;
40776
+ for (let d2 = $head.depth - 1; d2 >= 0; d2--) {
40777
+ const parent = $head.node(d2), index2 = dir < 0 ? $head.index(d2) : $head.indexAfter(d2);
40778
+ if (index2 != (dir < 0 ? 0 : parent.childCount))
40779
+ return null;
40780
+ if (parent.type.spec.tableRole == "cell" || parent.type.spec.tableRole == "header_cell") {
40781
+ const cellPos = $head.before(d2);
40782
+ const dirStr = axis2 == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
40783
+ return view.endOfTextblock(dirStr) ? cellPos : null;
40784
+ }
40785
+ }
40786
+ return null;
40787
+ }
40788
+ function domInCell(view, dom) {
40789
+ for (; dom && dom != view.dom; dom = dom.parentNode) {
40790
+ if (dom.nodeName == "TD" || dom.nodeName == "TH") {
40791
+ return dom;
40792
+ }
40793
+ }
40794
+ return null;
40795
+ }
40796
+ function cellUnderMouse(view, event) {
40797
+ const mousePos = view.posAtCoords({
40798
+ left: event.clientX,
40799
+ top: event.clientY
40800
+ });
40801
+ if (!mousePos)
40802
+ return null;
40803
+ return mousePos ? cellAround(view.state.doc.resolve(mousePos.pos)) : null;
40804
+ }
40805
+ var TableView$1 = class TableView2 {
40806
+ constructor(node, cellMinWidth) {
40807
+ this.node = node;
40808
+ this.cellMinWidth = cellMinWidth;
40809
+ this.dom = document.createElement("div");
40810
+ this.dom.className = "tableWrapper";
40811
+ this.table = this.dom.appendChild(document.createElement("table"));
40812
+ this.colgroup = this.table.appendChild(document.createElement("colgroup"));
40813
+ updateColumnsOnResize(node, this.colgroup, this.table, cellMinWidth);
40814
+ this.contentDOM = this.table.appendChild(document.createElement("tbody"));
40815
+ }
40816
+ update(node) {
40817
+ if (node.type != this.node.type)
40818
+ return false;
40819
+ this.node = node;
40820
+ updateColumnsOnResize(node, this.colgroup, this.table, this.cellMinWidth);
40821
+ return true;
40822
+ }
40823
+ ignoreMutation(record) {
40824
+ return record.type == "attributes" && (record.target == this.table || this.colgroup.contains(record.target));
40825
+ }
40826
+ };
40827
+ function updateColumnsOnResize(node, colgroup, table, cellMinWidth, overrideCol, overrideValue) {
40828
+ var _a2;
40829
+ let totalWidth = 0;
40830
+ let fixedWidth = true;
40831
+ let nextDOM = colgroup.firstChild;
40832
+ const row = node.firstChild;
40833
+ if (!row)
40834
+ return;
40835
+ for (let i2 = 0, col = 0; i2 < row.childCount; i2++) {
40836
+ const { colspan, colwidth } = row.child(i2).attrs;
40837
+ for (let j = 0; j < colspan; j++, col++) {
40838
+ const hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j];
40839
+ const cssWidth = hasWidth ? hasWidth + "px" : "";
40840
+ totalWidth += hasWidth || cellMinWidth;
40841
+ if (!hasWidth)
40842
+ fixedWidth = false;
40843
+ if (!nextDOM) {
40844
+ colgroup.appendChild(document.createElement("col")).style.width = cssWidth;
40845
+ } else {
40846
+ if (nextDOM.style.width != cssWidth)
40847
+ nextDOM.style.width = cssWidth;
40848
+ nextDOM = nextDOM.nextSibling;
40849
+ }
40850
+ }
40851
+ }
40852
+ while (nextDOM) {
40853
+ const after = nextDOM.nextSibling;
40854
+ (_a2 = nextDOM.parentNode) == null ? void 0 : _a2.removeChild(nextDOM);
40855
+ nextDOM = after;
40856
+ }
40857
+ if (fixedWidth) {
40858
+ table.style.width = totalWidth + "px";
40859
+ table.style.minWidth = "";
40860
+ } else {
40861
+ table.style.width = "";
40862
+ table.style.minWidth = totalWidth + "px";
40863
+ }
40864
+ }
40865
+ var columnResizingPluginKey = new PluginKey(
40866
+ "tableColumnResizing"
40867
+ );
40868
+ function columnResizing({
40869
+ handleWidth = 5,
40870
+ cellMinWidth = 25,
40871
+ View = TableView$1,
40872
+ lastColumnResizable = true
40873
+ } = {}) {
40874
+ const plugin = new Plugin({
40875
+ key: columnResizingPluginKey,
40876
+ state: {
40877
+ init(_2, state2) {
40878
+ plugin.spec.props.nodeViews[tableNodeTypes(state2.schema).table.name] = (node, view) => new View(node, cellMinWidth, view);
40879
+ return new ResizeState(-1, false);
40880
+ },
40881
+ apply(tr2, prev) {
40882
+ return prev.apply(tr2);
40883
+ }
40884
+ },
40885
+ props: {
40886
+ attributes: (state2) => {
40887
+ const pluginState = columnResizingPluginKey.getState(state2);
40888
+ return pluginState && pluginState.activeHandle > -1 ? { class: "resize-cursor" } : {};
40889
+ },
40890
+ handleDOMEvents: {
40891
+ mousemove: (view, event) => {
40892
+ handleMouseMove(
40893
+ view,
40894
+ event,
40895
+ handleWidth,
40896
+ cellMinWidth,
40897
+ lastColumnResizable
40898
+ );
40899
+ },
40900
+ mouseleave: (view) => {
40901
+ handleMouseLeave(view);
40902
+ },
40903
+ mousedown: (view, event) => {
40904
+ handleMouseDown2(view, event, cellMinWidth);
40905
+ }
40906
+ },
40907
+ decorations: (state2) => {
40908
+ const pluginState = columnResizingPluginKey.getState(state2);
40909
+ if (pluginState && pluginState.activeHandle > -1) {
40910
+ return handleDecorations(state2, pluginState.activeHandle);
40911
+ }
40912
+ },
40913
+ nodeViews: {}
40914
+ }
40915
+ });
40916
+ return plugin;
40917
+ }
40918
+ var ResizeState = class _ResizeState {
40919
+ constructor(activeHandle, dragging) {
40920
+ this.activeHandle = activeHandle;
40921
+ this.dragging = dragging;
40922
+ }
40923
+ apply(tr2) {
40924
+ const state2 = this;
40925
+ const action = tr2.getMeta(columnResizingPluginKey);
40926
+ if (action && action.setHandle != null)
40927
+ return new _ResizeState(action.setHandle, false);
40928
+ if (action && action.setDragging !== void 0)
40929
+ return new _ResizeState(state2.activeHandle, action.setDragging);
40930
+ if (state2.activeHandle > -1 && tr2.docChanged) {
40931
+ let handle = tr2.mapping.map(state2.activeHandle, -1);
40932
+ if (!pointsAtCell(tr2.doc.resolve(handle))) {
40933
+ handle = -1;
40934
+ }
40935
+ return new _ResizeState(handle, state2.dragging);
40936
+ }
40937
+ return state2;
40938
+ }
40939
+ };
40940
+ function handleMouseMove(view, event, handleWidth, cellMinWidth, lastColumnResizable) {
40941
+ const pluginState = columnResizingPluginKey.getState(view.state);
40942
+ if (!pluginState)
40943
+ return;
40944
+ if (!pluginState.dragging) {
40945
+ const target = domCellAround(event.target);
40946
+ let cell = -1;
40947
+ if (target) {
40948
+ const { left: left2, right: right2 } = target.getBoundingClientRect();
40949
+ if (event.clientX - left2 <= handleWidth)
40950
+ cell = edgeCell(view, event, "left", handleWidth);
40951
+ else if (right2 - event.clientX <= handleWidth)
40952
+ cell = edgeCell(view, event, "right", handleWidth);
40953
+ }
40954
+ if (cell != pluginState.activeHandle) {
40955
+ if (!lastColumnResizable && cell !== -1) {
40956
+ const $cell = view.state.doc.resolve(cell);
40957
+ const table = $cell.node(-1);
40958
+ const map4 = TableMap.get(table);
40959
+ const tableStart = $cell.start(-1);
40960
+ const col = map4.colCount($cell.pos - tableStart) + $cell.nodeAfter.attrs.colspan - 1;
40961
+ if (col == map4.width - 1) {
40962
+ return;
40963
+ }
40964
+ }
40965
+ updateHandle(view, cell);
40966
+ }
40967
+ }
40968
+ }
40969
+ function handleMouseLeave(view) {
40970
+ const pluginState = columnResizingPluginKey.getState(view.state);
40971
+ if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging)
40972
+ updateHandle(view, -1);
40973
+ }
40974
+ function handleMouseDown2(view, event, cellMinWidth) {
40975
+ var _a2;
40976
+ const win = (_a2 = view.dom.ownerDocument.defaultView) != null ? _a2 : window;
40977
+ const pluginState = columnResizingPluginKey.getState(view.state);
40978
+ if (!pluginState || pluginState.activeHandle == -1 || pluginState.dragging)
40979
+ return false;
40980
+ const cell = view.state.doc.nodeAt(pluginState.activeHandle);
40981
+ const width = currentColWidth(view, pluginState.activeHandle, cell.attrs);
40982
+ view.dispatch(
40983
+ view.state.tr.setMeta(columnResizingPluginKey, {
40984
+ setDragging: { startX: event.clientX, startWidth: width }
40985
+ })
40986
+ );
40987
+ function finish(event2) {
40988
+ win.removeEventListener("mouseup", finish);
40989
+ win.removeEventListener("mousemove", move);
40990
+ const pluginState2 = columnResizingPluginKey.getState(view.state);
40991
+ if (pluginState2 == null ? void 0 : pluginState2.dragging) {
40992
+ updateColumnWidth(
40993
+ view,
40994
+ pluginState2.activeHandle,
40995
+ draggedWidth(pluginState2.dragging, event2, cellMinWidth)
40996
+ );
40997
+ view.dispatch(
40998
+ view.state.tr.setMeta(columnResizingPluginKey, { setDragging: null })
40999
+ );
41000
+ }
41001
+ }
41002
+ function move(event2) {
41003
+ if (!event2.which)
41004
+ return finish(event2);
41005
+ const pluginState2 = columnResizingPluginKey.getState(view.state);
41006
+ if (!pluginState2)
41007
+ return;
41008
+ if (pluginState2.dragging) {
41009
+ const dragged = draggedWidth(pluginState2.dragging, event2, cellMinWidth);
41010
+ displayColumnWidth(view, pluginState2.activeHandle, dragged, cellMinWidth);
41011
+ }
41012
+ }
41013
+ win.addEventListener("mouseup", finish);
41014
+ win.addEventListener("mousemove", move);
41015
+ event.preventDefault();
41016
+ return true;
41017
+ }
41018
+ function currentColWidth(view, cellPos, { colspan, colwidth }) {
41019
+ const width = colwidth && colwidth[colwidth.length - 1];
41020
+ if (width)
41021
+ return width;
41022
+ const dom = view.domAtPos(cellPos);
41023
+ const node = dom.node.childNodes[dom.offset];
41024
+ let domWidth = node.offsetWidth, parts = colspan;
41025
+ if (colwidth) {
41026
+ for (let i2 = 0; i2 < colspan; i2++)
41027
+ if (colwidth[i2]) {
41028
+ domWidth -= colwidth[i2];
41029
+ parts--;
41030
+ }
41031
+ }
41032
+ return domWidth / parts;
41033
+ }
41034
+ function domCellAround(target) {
41035
+ while (target && target.nodeName != "TD" && target.nodeName != "TH")
41036
+ target = target.classList && target.classList.contains("ProseMirror") ? null : target.parentNode;
41037
+ return target;
41038
+ }
41039
+ function edgeCell(view, event, side, handleWidth) {
41040
+ const offset2 = side == "right" ? -handleWidth : handleWidth;
41041
+ const found2 = view.posAtCoords({
41042
+ left: event.clientX + offset2,
41043
+ top: event.clientY
41044
+ });
41045
+ if (!found2)
41046
+ return -1;
41047
+ const { pos } = found2;
41048
+ const $cell = cellAround(view.state.doc.resolve(pos));
41049
+ if (!$cell)
41050
+ return -1;
41051
+ if (side == "right")
41052
+ return $cell.pos;
41053
+ const map4 = TableMap.get($cell.node(-1)), start2 = $cell.start(-1);
41054
+ const index2 = map4.map.indexOf($cell.pos - start2);
41055
+ return index2 % map4.width == 0 ? -1 : start2 + map4.map[index2 - 1];
41056
+ }
41057
+ function draggedWidth(dragging, event, cellMinWidth) {
41058
+ const offset2 = event.clientX - dragging.startX;
41059
+ return Math.max(cellMinWidth, dragging.startWidth + offset2);
41060
+ }
41061
+ function updateHandle(view, value) {
41062
+ view.dispatch(
41063
+ view.state.tr.setMeta(columnResizingPluginKey, { setHandle: value })
41064
+ );
41065
+ }
41066
+ function updateColumnWidth(view, cell, width) {
41067
+ const $cell = view.state.doc.resolve(cell);
41068
+ const table = $cell.node(-1), map4 = TableMap.get(table), start2 = $cell.start(-1);
41069
+ const col = map4.colCount($cell.pos - start2) + $cell.nodeAfter.attrs.colspan - 1;
41070
+ const tr2 = view.state.tr;
41071
+ for (let row = 0; row < map4.height; row++) {
41072
+ const mapIndex = row * map4.width + col;
41073
+ if (row && map4.map[mapIndex] == map4.map[mapIndex - map4.width])
41074
+ continue;
41075
+ const pos = map4.map[mapIndex];
41076
+ const attrs = table.nodeAt(pos).attrs;
41077
+ const index2 = attrs.colspan == 1 ? 0 : col - map4.colCount(pos);
41078
+ if (attrs.colwidth && attrs.colwidth[index2] == width)
41079
+ continue;
41080
+ const colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);
41081
+ colwidth[index2] = width;
41082
+ tr2.setNodeMarkup(start2 + pos, null, { ...attrs, colwidth });
41083
+ }
41084
+ if (tr2.docChanged)
41085
+ view.dispatch(tr2);
41086
+ }
41087
+ function displayColumnWidth(view, cell, width, cellMinWidth) {
41088
+ const $cell = view.state.doc.resolve(cell);
41089
+ const table = $cell.node(-1), start2 = $cell.start(-1);
41090
+ const col = TableMap.get(table).colCount($cell.pos - start2) + $cell.nodeAfter.attrs.colspan - 1;
41091
+ let dom = view.domAtPos($cell.start(-1)).node;
41092
+ while (dom && dom.nodeName != "TABLE") {
41093
+ dom = dom.parentNode;
41094
+ }
41095
+ if (!dom)
41096
+ return;
41097
+ updateColumnsOnResize(
41098
+ table,
41099
+ dom.firstChild,
41100
+ dom,
41101
+ cellMinWidth,
41102
+ col,
41103
+ width
41104
+ );
41105
+ }
41106
+ function zeroes(n2) {
41107
+ return Array(n2).fill(0);
41108
+ }
41109
+ function handleDecorations(state2, cell) {
41110
+ const decorations = [];
41111
+ const $cell = state2.doc.resolve(cell);
41112
+ const table = $cell.node(-1);
41113
+ if (!table) {
41114
+ return DecorationSet.empty;
41115
+ }
41116
+ const map4 = TableMap.get(table);
41117
+ const start2 = $cell.start(-1);
41118
+ const col = map4.colCount($cell.pos - start2) + $cell.nodeAfter.attrs.colspan;
41119
+ for (let row = 0; row < map4.height; row++) {
41120
+ const index2 = col + row * map4.width - 1;
41121
+ if ((col == map4.width || map4.map[index2] != map4.map[index2 + 1]) && (row == 0 || map4.map[index2] != map4.map[index2 - map4.width])) {
41122
+ const cellPos = map4.map[index2];
41123
+ const pos = start2 + cellPos + table.nodeAt(cellPos).nodeSize - 1;
41124
+ const dom = document.createElement("div");
41125
+ dom.className = "column-resize-handle";
41126
+ decorations.push(Decoration.widget(pos, dom));
41127
+ }
41128
+ }
41129
+ return DecorationSet.create(state2.doc, decorations);
41130
+ }
41131
+ function selectedRect(state2) {
41132
+ const sel = state2.selection;
41133
+ const $pos = selectionCell(state2);
41134
+ const table = $pos.node(-1);
41135
+ const tableStart = $pos.start(-1);
41136
+ const map4 = TableMap.get(table);
41137
+ const rect = sel instanceof CellSelection ? map4.rectBetween(
41138
+ sel.$anchorCell.pos - tableStart,
41139
+ sel.$headCell.pos - tableStart
41140
+ ) : map4.findCell($pos.pos - tableStart);
41141
+ return { ...rect, tableStart, map: map4, table };
41142
+ }
41143
+ function addColumn(tr2, { map: map4, tableStart, table }, col) {
41144
+ let refColumn = col > 0 ? -1 : 0;
41145
+ if (columnIsHeader(map4, table, col + refColumn)) {
41146
+ refColumn = col == 0 || col == map4.width ? null : 0;
41147
+ }
41148
+ for (let row = 0; row < map4.height; row++) {
41149
+ const index2 = row * map4.width + col;
41150
+ if (col > 0 && col < map4.width && map4.map[index2 - 1] == map4.map[index2]) {
41151
+ const pos = map4.map[index2];
41152
+ const cell = table.nodeAt(pos);
41153
+ tr2.setNodeMarkup(
41154
+ tr2.mapping.map(tableStart + pos),
41155
+ null,
41156
+ addColSpan(cell.attrs, col - map4.colCount(pos))
41157
+ );
41158
+ row += cell.attrs.rowspan - 1;
41159
+ } else {
41160
+ const type3 = refColumn == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map4.map[index2 + refColumn]).type;
41161
+ const pos = map4.positionAt(row, col, table);
41162
+ tr2.insert(tr2.mapping.map(tableStart + pos), type3.createAndFill());
41163
+ }
41164
+ }
41165
+ return tr2;
41166
+ }
41167
+ function addColumnBefore(state2, dispatch) {
41168
+ if (!isInTable(state2))
41169
+ return false;
41170
+ if (dispatch) {
41171
+ const rect = selectedRect(state2);
41172
+ dispatch(addColumn(state2.tr, rect, rect.left));
41173
+ }
41174
+ return true;
41175
+ }
41176
+ function addColumnAfter(state2, dispatch) {
41177
+ if (!isInTable(state2))
41178
+ return false;
41179
+ if (dispatch) {
41180
+ const rect = selectedRect(state2);
41181
+ dispatch(addColumn(state2.tr, rect, rect.right));
41182
+ }
41183
+ return true;
41184
+ }
41185
+ function removeColumn(tr2, { map: map4, table, tableStart }, col) {
41186
+ const mapStart = tr2.mapping.maps.length;
41187
+ for (let row = 0; row < map4.height; ) {
41188
+ const index2 = row * map4.width + col;
41189
+ const pos = map4.map[index2];
41190
+ const cell = table.nodeAt(pos);
41191
+ const attrs = cell.attrs;
41192
+ if (col > 0 && map4.map[index2 - 1] == pos || col < map4.width - 1 && map4.map[index2 + 1] == pos) {
41193
+ tr2.setNodeMarkup(
41194
+ tr2.mapping.slice(mapStart).map(tableStart + pos),
41195
+ null,
41196
+ removeColSpan(attrs, col - map4.colCount(pos))
41197
+ );
41198
+ } else {
41199
+ const start2 = tr2.mapping.slice(mapStart).map(tableStart + pos);
41200
+ tr2.delete(start2, start2 + cell.nodeSize);
41201
+ }
41202
+ row += attrs.rowspan;
41203
+ }
41204
+ }
41205
+ function deleteColumn(state2, dispatch) {
41206
+ if (!isInTable(state2))
41207
+ return false;
41208
+ if (dispatch) {
41209
+ const rect = selectedRect(state2);
41210
+ const tr2 = state2.tr;
41211
+ if (rect.left == 0 && rect.right == rect.map.width)
41212
+ return false;
41213
+ for (let i2 = rect.right - 1; ; i2--) {
41214
+ removeColumn(tr2, rect, i2);
41215
+ if (i2 == rect.left)
41216
+ break;
41217
+ const table = rect.tableStart ? tr2.doc.nodeAt(rect.tableStart - 1) : tr2.doc;
41218
+ if (!table) {
41219
+ throw RangeError("No table found");
41220
+ }
41221
+ rect.table = table;
41222
+ rect.map = TableMap.get(table);
41223
+ }
41224
+ dispatch(tr2);
41225
+ }
41226
+ return true;
41227
+ }
41228
+ function rowIsHeader(map4, table, row) {
41229
+ var _a2;
41230
+ const headerCell = tableNodeTypes(table.type.schema).header_cell;
41231
+ for (let col = 0; col < map4.width; col++)
41232
+ if (((_a2 = table.nodeAt(map4.map[col + row * map4.width])) == null ? void 0 : _a2.type) != headerCell)
41233
+ return false;
41234
+ return true;
41235
+ }
41236
+ function addRow(tr2, { map: map4, tableStart, table }, row) {
41237
+ var _a2;
41238
+ let rowPos = tableStart;
41239
+ for (let i2 = 0; i2 < row; i2++)
41240
+ rowPos += table.child(i2).nodeSize;
41241
+ const cells = [];
41242
+ let refRow = row > 0 ? -1 : 0;
41243
+ if (rowIsHeader(map4, table, row + refRow))
41244
+ refRow = row == 0 || row == map4.height ? null : 0;
41245
+ for (let col = 0, index2 = map4.width * row; col < map4.width; col++, index2++) {
41246
+ if (row > 0 && row < map4.height && map4.map[index2] == map4.map[index2 - map4.width]) {
41247
+ const pos = map4.map[index2];
41248
+ const attrs = table.nodeAt(pos).attrs;
41249
+ tr2.setNodeMarkup(tableStart + pos, null, {
41250
+ ...attrs,
41251
+ rowspan: attrs.rowspan + 1
41252
+ });
41253
+ col += attrs.colspan - 1;
41254
+ } else {
41255
+ const type3 = refRow == null ? tableNodeTypes(table.type.schema).cell : (_a2 = table.nodeAt(map4.map[index2 + refRow * map4.width])) == null ? void 0 : _a2.type;
41256
+ const node = type3 == null ? void 0 : type3.createAndFill();
41257
+ if (node)
41258
+ cells.push(node);
41259
+ }
41260
+ }
41261
+ tr2.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));
41262
+ return tr2;
41263
+ }
41264
+ function addRowBefore(state2, dispatch) {
41265
+ if (!isInTable(state2))
41266
+ return false;
41267
+ if (dispatch) {
41268
+ const rect = selectedRect(state2);
41269
+ dispatch(addRow(state2.tr, rect, rect.top));
41270
+ }
41271
+ return true;
41272
+ }
41273
+ function addRowAfter(state2, dispatch) {
41274
+ if (!isInTable(state2))
41275
+ return false;
41276
+ if (dispatch) {
41277
+ const rect = selectedRect(state2);
41278
+ dispatch(addRow(state2.tr, rect, rect.bottom));
41279
+ }
41280
+ return true;
41281
+ }
41282
+ function removeRow(tr2, { map: map4, table, tableStart }, row) {
41283
+ let rowPos = 0;
41284
+ for (let i2 = 0; i2 < row; i2++)
41285
+ rowPos += table.child(i2).nodeSize;
41286
+ const nextRow = rowPos + table.child(row).nodeSize;
41287
+ const mapFrom = tr2.mapping.maps.length;
41288
+ tr2.delete(rowPos + tableStart, nextRow + tableStart);
41289
+ const seen = /* @__PURE__ */ new Set();
41290
+ for (let col = 0, index2 = row * map4.width; col < map4.width; col++, index2++) {
41291
+ const pos = map4.map[index2];
41292
+ if (seen.has(pos))
41293
+ continue;
41294
+ seen.add(pos);
41295
+ if (row > 0 && pos == map4.map[index2 - map4.width]) {
41296
+ const attrs = table.nodeAt(pos).attrs;
41297
+ tr2.setNodeMarkup(tr2.mapping.slice(mapFrom).map(pos + tableStart), null, {
41298
+ ...attrs,
41299
+ rowspan: attrs.rowspan - 1
41300
+ });
41301
+ col += attrs.colspan - 1;
41302
+ } else if (row < map4.height && pos == map4.map[index2 + map4.width]) {
41303
+ const cell = table.nodeAt(pos);
41304
+ const attrs = cell.attrs;
41305
+ const copy2 = cell.type.create(
41306
+ { ...attrs, rowspan: cell.attrs.rowspan - 1 },
41307
+ cell.content
41308
+ );
41309
+ const newPos = map4.positionAt(row + 1, col, table);
41310
+ tr2.insert(tr2.mapping.slice(mapFrom).map(tableStart + newPos), copy2);
41311
+ col += attrs.colspan - 1;
41312
+ }
41313
+ }
41314
+ }
41315
+ function deleteRow(state2, dispatch) {
41316
+ if (!isInTable(state2))
41317
+ return false;
41318
+ if (dispatch) {
41319
+ const rect = selectedRect(state2), tr2 = state2.tr;
41320
+ if (rect.top == 0 && rect.bottom == rect.map.height)
41321
+ return false;
41322
+ for (let i2 = rect.bottom - 1; ; i2--) {
41323
+ removeRow(tr2, rect, i2);
41324
+ if (i2 == rect.top)
41325
+ break;
41326
+ const table = rect.tableStart ? tr2.doc.nodeAt(rect.tableStart - 1) : tr2.doc;
41327
+ if (!table) {
41328
+ throw RangeError("No table found");
41329
+ }
41330
+ rect.table = table;
41331
+ rect.map = TableMap.get(rect.table);
41332
+ }
41333
+ dispatch(tr2);
41334
+ }
41335
+ return true;
41336
+ }
41337
+ function isEmpty(cell) {
41338
+ const c2 = cell.content;
41339
+ return c2.childCount == 1 && c2.child(0).isTextblock && c2.child(0).childCount == 0;
41340
+ }
41341
+ function cellsOverlapRectangle({ width, height, map: map4 }, rect) {
41342
+ let indexTop = rect.top * width + rect.left, indexLeft = indexTop;
41343
+ let indexBottom = (rect.bottom - 1) * width + rect.left, indexRight = indexTop + (rect.right - rect.left - 1);
41344
+ for (let i2 = rect.top; i2 < rect.bottom; i2++) {
41345
+ if (rect.left > 0 && map4[indexLeft] == map4[indexLeft - 1] || rect.right < width && map4[indexRight] == map4[indexRight + 1])
41346
+ return true;
41347
+ indexLeft += width;
41348
+ indexRight += width;
41349
+ }
41350
+ for (let i2 = rect.left; i2 < rect.right; i2++) {
41351
+ if (rect.top > 0 && map4[indexTop] == map4[indexTop - width] || rect.bottom < height && map4[indexBottom] == map4[indexBottom + width])
41352
+ return true;
41353
+ indexTop++;
41354
+ indexBottom++;
41355
+ }
41356
+ return false;
41357
+ }
41358
+ function mergeCells(state2, dispatch) {
41359
+ const sel = state2.selection;
41360
+ if (!(sel instanceof CellSelection) || sel.$anchorCell.pos == sel.$headCell.pos)
41361
+ return false;
41362
+ const rect = selectedRect(state2), { map: map4 } = rect;
41363
+ if (cellsOverlapRectangle(map4, rect))
41364
+ return false;
41365
+ if (dispatch) {
41366
+ const tr2 = state2.tr;
41367
+ const seen = {};
41368
+ let content = Fragment.empty;
41369
+ let mergedPos;
41370
+ let mergedCell;
41371
+ for (let row = rect.top; row < rect.bottom; row++) {
41372
+ for (let col = rect.left; col < rect.right; col++) {
41373
+ const cellPos = map4.map[row * map4.width + col];
41374
+ const cell = rect.table.nodeAt(cellPos);
41375
+ if (seen[cellPos] || !cell)
41376
+ continue;
41377
+ seen[cellPos] = true;
41378
+ if (mergedPos == null) {
41379
+ mergedPos = cellPos;
41380
+ mergedCell = cell;
41381
+ } else {
41382
+ if (!isEmpty(cell))
41383
+ content = content.append(cell.content);
41384
+ const mapped = tr2.mapping.map(cellPos + rect.tableStart);
41385
+ tr2.delete(mapped, mapped + cell.nodeSize);
41386
+ }
41387
+ }
41388
+ }
41389
+ if (mergedPos == null || mergedCell == null) {
41390
+ return true;
41391
+ }
41392
+ tr2.setNodeMarkup(mergedPos + rect.tableStart, null, {
41393
+ ...addColSpan(
41394
+ mergedCell.attrs,
41395
+ mergedCell.attrs.colspan,
41396
+ rect.right - rect.left - mergedCell.attrs.colspan
41397
+ ),
41398
+ rowspan: rect.bottom - rect.top
41399
+ });
41400
+ if (content.size) {
41401
+ const end2 = mergedPos + 1 + mergedCell.content.size;
41402
+ const start2 = isEmpty(mergedCell) ? mergedPos + 1 : end2;
41403
+ tr2.replaceWith(start2 + rect.tableStart, end2 + rect.tableStart, content);
41404
+ }
41405
+ tr2.setSelection(
41406
+ new CellSelection(tr2.doc.resolve(mergedPos + rect.tableStart))
41407
+ );
41408
+ dispatch(tr2);
41409
+ }
41410
+ return true;
41411
+ }
41412
+ function splitCell(state2, dispatch) {
41413
+ const nodeTypes = tableNodeTypes(state2.schema);
41414
+ return splitCellWithType(({ node }) => {
41415
+ return nodeTypes[node.type.spec.tableRole];
41416
+ })(state2, dispatch);
41417
+ }
41418
+ function splitCellWithType(getCellType) {
41419
+ return (state2, dispatch) => {
41420
+ var _a2;
41421
+ const sel = state2.selection;
41422
+ let cellNode;
41423
+ let cellPos;
41424
+ if (!(sel instanceof CellSelection)) {
41425
+ cellNode = cellWrapping(sel.$from);
41426
+ if (!cellNode)
41427
+ return false;
41428
+ cellPos = (_a2 = cellAround(sel.$from)) == null ? void 0 : _a2.pos;
41429
+ } else {
41430
+ if (sel.$anchorCell.pos != sel.$headCell.pos)
41431
+ return false;
41432
+ cellNode = sel.$anchorCell.nodeAfter;
41433
+ cellPos = sel.$anchorCell.pos;
41434
+ }
41435
+ if (cellNode == null || cellPos == null) {
41436
+ return false;
41437
+ }
41438
+ if (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) {
41439
+ return false;
41440
+ }
41441
+ if (dispatch) {
41442
+ let baseAttrs = cellNode.attrs;
41443
+ const attrs = [];
41444
+ const colwidth = baseAttrs.colwidth;
41445
+ if (baseAttrs.rowspan > 1)
41446
+ baseAttrs = { ...baseAttrs, rowspan: 1 };
41447
+ if (baseAttrs.colspan > 1)
41448
+ baseAttrs = { ...baseAttrs, colspan: 1 };
41449
+ const rect = selectedRect(state2), tr2 = state2.tr;
41450
+ for (let i2 = 0; i2 < rect.right - rect.left; i2++)
41451
+ attrs.push(
41452
+ colwidth ? {
41453
+ ...baseAttrs,
41454
+ colwidth: colwidth && colwidth[i2] ? [colwidth[i2]] : null
41455
+ } : baseAttrs
41456
+ );
41457
+ let lastCell;
41458
+ for (let row = rect.top; row < rect.bottom; row++) {
41459
+ let pos = rect.map.positionAt(row, rect.left, rect.table);
41460
+ if (row == rect.top)
41461
+ pos += cellNode.nodeSize;
41462
+ for (let col = rect.left, i2 = 0; col < rect.right; col++, i2++) {
41463
+ if (col == rect.left && row == rect.top)
41464
+ continue;
41465
+ tr2.insert(
41466
+ lastCell = tr2.mapping.map(pos + rect.tableStart, 1),
41467
+ getCellType({ node: cellNode, row, col }).createAndFill(attrs[i2])
41468
+ );
41469
+ }
41470
+ }
41471
+ tr2.setNodeMarkup(
41472
+ cellPos,
41473
+ getCellType({ node: cellNode, row: rect.top, col: rect.left }),
41474
+ attrs[0]
41475
+ );
41476
+ if (sel instanceof CellSelection)
41477
+ tr2.setSelection(
41478
+ new CellSelection(
41479
+ tr2.doc.resolve(sel.$anchorCell.pos),
41480
+ lastCell ? tr2.doc.resolve(lastCell) : void 0
41481
+ )
41482
+ );
41483
+ dispatch(tr2);
41484
+ }
41485
+ return true;
41486
+ };
41487
+ }
41488
+ function setCellAttr(name, value) {
41489
+ return function(state2, dispatch) {
41490
+ if (!isInTable(state2))
41491
+ return false;
41492
+ const $cell = selectionCell(state2);
41493
+ if ($cell.nodeAfter.attrs[name] === value)
41494
+ return false;
41495
+ if (dispatch) {
41496
+ const tr2 = state2.tr;
41497
+ if (state2.selection instanceof CellSelection)
41498
+ state2.selection.forEachCell((node, pos) => {
41499
+ if (node.attrs[name] !== value)
41500
+ tr2.setNodeMarkup(pos, null, {
41501
+ ...node.attrs,
41502
+ [name]: value
41503
+ });
41504
+ });
41505
+ else
41506
+ tr2.setNodeMarkup($cell.pos, null, {
41507
+ ...$cell.nodeAfter.attrs,
41508
+ [name]: value
41509
+ });
41510
+ dispatch(tr2);
41511
+ }
41512
+ return true;
41513
+ };
41514
+ }
41515
+ function deprecated_toggleHeader(type3) {
41516
+ return function(state2, dispatch) {
41517
+ if (!isInTable(state2))
41518
+ return false;
41519
+ if (dispatch) {
41520
+ const types = tableNodeTypes(state2.schema);
41521
+ const rect = selectedRect(state2), tr2 = state2.tr;
41522
+ const cells = rect.map.cellsInRect(
41523
+ type3 == "column" ? {
41524
+ left: rect.left,
41525
+ top: 0,
41526
+ right: rect.right,
41527
+ bottom: rect.map.height
41528
+ } : type3 == "row" ? {
41529
+ left: 0,
41530
+ top: rect.top,
41531
+ right: rect.map.width,
41532
+ bottom: rect.bottom
41533
+ } : rect
41534
+ );
41535
+ const nodes = cells.map((pos) => rect.table.nodeAt(pos));
41536
+ for (let i2 = 0; i2 < cells.length; i2++)
41537
+ if (nodes[i2].type == types.header_cell)
41538
+ tr2.setNodeMarkup(
41539
+ rect.tableStart + cells[i2],
41540
+ types.cell,
41541
+ nodes[i2].attrs
41542
+ );
41543
+ if (tr2.steps.length == 0)
41544
+ for (let i2 = 0; i2 < cells.length; i2++)
41545
+ tr2.setNodeMarkup(
41546
+ rect.tableStart + cells[i2],
41547
+ types.header_cell,
41548
+ nodes[i2].attrs
41549
+ );
41550
+ dispatch(tr2);
41551
+ }
41552
+ return true;
41553
+ };
41554
+ }
41555
+ function isHeaderEnabledByType(type3, rect, types) {
41556
+ const cellPositions = rect.map.cellsInRect({
41557
+ left: 0,
41558
+ top: 0,
41559
+ right: type3 == "row" ? rect.map.width : 1,
41560
+ bottom: type3 == "column" ? rect.map.height : 1
41561
+ });
41562
+ for (let i2 = 0; i2 < cellPositions.length; i2++) {
41563
+ const cell = rect.table.nodeAt(cellPositions[i2]);
41564
+ if (cell && cell.type !== types.header_cell) {
41565
+ return false;
41566
+ }
41567
+ }
41568
+ return true;
41569
+ }
41570
+ function toggleHeader(type3, options) {
41571
+ options = options || { useDeprecatedLogic: false };
41572
+ if (options.useDeprecatedLogic)
41573
+ return deprecated_toggleHeader(type3);
41574
+ return function(state2, dispatch) {
41575
+ if (!isInTable(state2))
41576
+ return false;
41577
+ if (dispatch) {
41578
+ const types = tableNodeTypes(state2.schema);
41579
+ const rect = selectedRect(state2), tr2 = state2.tr;
41580
+ const isHeaderRowEnabled = isHeaderEnabledByType("row", rect, types);
41581
+ const isHeaderColumnEnabled = isHeaderEnabledByType(
41582
+ "column",
41583
+ rect,
41584
+ types
41585
+ );
41586
+ const isHeaderEnabled = type3 === "column" ? isHeaderRowEnabled : type3 === "row" ? isHeaderColumnEnabled : false;
41587
+ const selectionStartsAt = isHeaderEnabled ? 1 : 0;
41588
+ const cellsRect = type3 == "column" ? {
41589
+ left: 0,
41590
+ top: selectionStartsAt,
41591
+ right: 1,
41592
+ bottom: rect.map.height
41593
+ } : type3 == "row" ? {
41594
+ left: selectionStartsAt,
41595
+ top: 0,
41596
+ right: rect.map.width,
41597
+ bottom: 1
41598
+ } : rect;
41599
+ const newType = type3 == "column" ? isHeaderColumnEnabled ? types.cell : types.header_cell : type3 == "row" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell;
41600
+ rect.map.cellsInRect(cellsRect).forEach((relativeCellPos) => {
41601
+ const cellPos = relativeCellPos + rect.tableStart;
41602
+ const cell = tr2.doc.nodeAt(cellPos);
41603
+ if (cell) {
41604
+ tr2.setNodeMarkup(cellPos, newType, cell.attrs);
41605
+ }
41606
+ });
41607
+ dispatch(tr2);
41608
+ }
41609
+ return true;
41610
+ };
41611
+ }
41612
+ toggleHeader("row", {
41613
+ useDeprecatedLogic: true
41614
+ });
41615
+ toggleHeader("column", {
41616
+ useDeprecatedLogic: true
41617
+ });
41618
+ var toggleHeaderCell = toggleHeader("cell", {
41619
+ useDeprecatedLogic: true
41620
+ });
41621
+ function findNextCell($cell, dir) {
41622
+ if (dir < 0) {
41623
+ const before = $cell.nodeBefore;
41624
+ if (before)
41625
+ return $cell.pos - before.nodeSize;
41626
+ for (let row = $cell.index(-1) - 1, rowEnd = $cell.before(); row >= 0; row--) {
41627
+ const rowNode = $cell.node(-1).child(row);
41628
+ const lastChild2 = rowNode.lastChild;
41629
+ if (lastChild2) {
41630
+ return rowEnd - 1 - lastChild2.nodeSize;
41631
+ }
41632
+ rowEnd -= rowNode.nodeSize;
41633
+ }
41634
+ } else {
41635
+ if ($cell.index() < $cell.parent.childCount - 1) {
41636
+ return $cell.pos + $cell.nodeAfter.nodeSize;
41637
+ }
41638
+ const table = $cell.node(-1);
41639
+ for (let row = $cell.indexAfter(-1), rowStart = $cell.after(); row < table.childCount; row++) {
41640
+ const rowNode = table.child(row);
41641
+ if (rowNode.childCount)
41642
+ return rowStart + 1;
41643
+ rowStart += rowNode.nodeSize;
41644
+ }
41645
+ }
41646
+ return null;
41647
+ }
41648
+ function goToNextCell(direction) {
41649
+ return function(state2, dispatch) {
41650
+ if (!isInTable(state2))
41651
+ return false;
41652
+ const cell = findNextCell(selectionCell(state2), direction);
41653
+ if (cell == null)
41654
+ return false;
41655
+ if (dispatch) {
41656
+ const $cell = state2.doc.resolve(cell);
41657
+ dispatch(
41658
+ state2.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView()
41659
+ );
41660
+ }
41661
+ return true;
41662
+ };
41663
+ }
41664
+ function deleteTable(state2, dispatch) {
41665
+ const $pos = state2.selection.$anchor;
41666
+ for (let d2 = $pos.depth; d2 > 0; d2--) {
41667
+ const node = $pos.node(d2);
41668
+ if (node.type.spec.tableRole == "table") {
41669
+ if (dispatch)
41670
+ dispatch(
41671
+ state2.tr.delete($pos.before(d2), $pos.after(d2)).scrollIntoView()
41672
+ );
41673
+ return true;
41674
+ }
41675
+ }
41676
+ return false;
41677
+ }
41678
+ function tableEditing({
41679
+ allowTableNodeSelection = false
41680
+ } = {}) {
41681
+ return new Plugin({
41682
+ key: tableEditingKey,
41683
+ // This piece of state is used to remember when a mouse-drag
41684
+ // cell-selection is happening, so that it can continue even as
41685
+ // transactions (which might move its anchor cell) come in.
41686
+ state: {
41687
+ init() {
41688
+ return null;
41689
+ },
41690
+ apply(tr2, cur) {
41691
+ const set2 = tr2.getMeta(tableEditingKey);
41692
+ if (set2 != null)
41693
+ return set2 == -1 ? null : set2;
41694
+ if (cur == null || !tr2.docChanged)
41695
+ return cur;
41696
+ const { deleted, pos } = tr2.mapping.mapResult(cur);
41697
+ return deleted ? null : pos;
41698
+ }
41699
+ },
41700
+ props: {
41701
+ decorations: drawCellSelection,
41702
+ handleDOMEvents: {
41703
+ mousedown: handleMouseDown
41704
+ },
41705
+ createSelectionBetween(view) {
41706
+ return tableEditingKey.getState(view.state) != null ? view.state.selection : null;
41707
+ },
41708
+ handleTripleClick,
41709
+ handleKeyDown,
41710
+ handlePaste
41711
+ },
41712
+ appendTransaction(_2, oldState, state2) {
41713
+ return normalizeSelection(
41714
+ state2,
41715
+ fixTables(state2, oldState),
41716
+ allowTableNodeSelection
41717
+ );
41718
+ }
41719
+ });
41720
+ }
41721
+ function updateColumns(node, colgroup, table, cellMinWidth, overrideCol, overrideValue) {
41722
+ let totalWidth = 0;
41723
+ let fixedWidth = true;
41724
+ let nextDOM = colgroup.firstChild;
41725
+ const row = node.firstChild;
41726
+ for (let i2 = 0, col = 0; i2 < row.childCount; i2 += 1) {
41727
+ const { colspan, colwidth } = row.child(i2).attrs;
41728
+ for (let j = 0; j < colspan; j += 1, col += 1) {
41729
+ const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j];
41730
+ const cssWidth = hasWidth ? `${hasWidth}px` : "";
41731
+ totalWidth += hasWidth || cellMinWidth;
41732
+ if (!hasWidth) {
41733
+ fixedWidth = false;
41734
+ }
41735
+ if (!nextDOM) {
41736
+ colgroup.appendChild(document.createElement("col")).style.width = cssWidth;
41737
+ } else {
41738
+ if (nextDOM.style.width !== cssWidth) {
41739
+ nextDOM.style.width = cssWidth;
41740
+ }
41741
+ nextDOM = nextDOM.nextSibling;
41742
+ }
41743
+ }
41744
+ }
41745
+ while (nextDOM) {
41746
+ const after = nextDOM.nextSibling;
41747
+ nextDOM.parentNode.removeChild(nextDOM);
41748
+ nextDOM = after;
41749
+ }
41750
+ if (fixedWidth) {
41751
+ table.style.width = `${totalWidth}px`;
41752
+ table.style.minWidth = "";
41753
+ } else {
41754
+ table.style.width = "";
41755
+ table.style.minWidth = `${totalWidth}px`;
41756
+ }
41757
+ }
41758
+ class TableView {
41759
+ constructor(node, cellMinWidth) {
41760
+ this.node = node;
41761
+ this.cellMinWidth = cellMinWidth;
41762
+ this.dom = document.createElement("div");
41763
+ this.dom.className = "tableWrapper";
41764
+ this.table = this.dom.appendChild(document.createElement("table"));
41765
+ this.colgroup = this.table.appendChild(document.createElement("colgroup"));
41766
+ updateColumns(node, this.colgroup, this.table, cellMinWidth);
41767
+ this.contentDOM = this.table.appendChild(document.createElement("tbody"));
41768
+ }
41769
+ update(node) {
41770
+ if (node.type !== this.node.type) {
41771
+ return false;
41772
+ }
41773
+ this.node = node;
41774
+ updateColumns(node, this.colgroup, this.table, this.cellMinWidth);
41775
+ return true;
41776
+ }
41777
+ ignoreMutation(mutation) {
41778
+ return mutation.type === "attributes" && (mutation.target === this.table || this.colgroup.contains(mutation.target));
41779
+ }
41780
+ }
41781
+ function createColGroup(node, cellMinWidth, overrideCol, overrideValue) {
41782
+ let totalWidth = 0;
41783
+ let fixedWidth = true;
41784
+ const cols = [];
41785
+ const row = node.firstChild;
41786
+ if (!row) {
41787
+ return {};
41788
+ }
41789
+ for (let i2 = 0, col = 0; i2 < row.childCount; i2 += 1) {
41790
+ const { colspan, colwidth } = row.child(i2).attrs;
41791
+ for (let j = 0; j < colspan; j += 1, col += 1) {
41792
+ const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j];
41793
+ const cssWidth = hasWidth ? `${hasWidth}px` : "";
41794
+ totalWidth += hasWidth || cellMinWidth;
41795
+ if (!hasWidth) {
41796
+ fixedWidth = false;
41797
+ }
41798
+ cols.push(["col", cssWidth ? { style: `width: ${cssWidth}` } : {}]);
41799
+ }
41800
+ }
41801
+ const tableWidth = fixedWidth ? `${totalWidth}px` : "";
41802
+ const tableMinWidth = fixedWidth ? "" : `${totalWidth}px`;
41803
+ const colgroup = ["colgroup", {}, ...cols];
41804
+ return { colgroup, tableWidth, tableMinWidth };
41805
+ }
41806
+ function createCell(cellType, cellContent) {
41807
+ if (cellContent) {
41808
+ return cellType.createChecked(null, cellContent);
41809
+ }
41810
+ return cellType.createAndFill();
41811
+ }
41812
+ function getTableNodeTypes(schema) {
41813
+ if (schema.cached.tableNodeTypes) {
41814
+ return schema.cached.tableNodeTypes;
41815
+ }
41816
+ const roles = {};
41817
+ Object.keys(schema.nodes).forEach((type3) => {
41818
+ const nodeType = schema.nodes[type3];
41819
+ if (nodeType.spec.tableRole) {
41820
+ roles[nodeType.spec.tableRole] = nodeType;
41821
+ }
41822
+ });
41823
+ schema.cached.tableNodeTypes = roles;
41824
+ return roles;
41825
+ }
41826
+ function createTable(schema, rowsCount, colsCount, withHeaderRow, cellContent) {
41827
+ const types = getTableNodeTypes(schema);
41828
+ const headerCells = [];
41829
+ const cells = [];
41830
+ for (let index2 = 0; index2 < colsCount; index2 += 1) {
41831
+ const cell = createCell(types.cell, cellContent);
41832
+ if (cell) {
41833
+ cells.push(cell);
41834
+ }
41835
+ if (withHeaderRow) {
41836
+ const headerCell = createCell(types.header_cell, cellContent);
41837
+ if (headerCell) {
41838
+ headerCells.push(headerCell);
41839
+ }
41840
+ }
41841
+ }
41842
+ const rows = [];
41843
+ for (let index2 = 0; index2 < rowsCount; index2 += 1) {
41844
+ rows.push(types.row.createChecked(null, withHeaderRow && index2 === 0 ? headerCells : cells));
41845
+ }
41846
+ return types.table.createChecked(null, rows);
41847
+ }
41848
+ function isCellSelection(value) {
41849
+ return value instanceof CellSelection;
41850
+ }
41851
+ const deleteTableWhenAllCellsSelected = ({ editor }) => {
41852
+ const { selection } = editor.state;
41853
+ if (!isCellSelection(selection)) {
41854
+ return false;
41855
+ }
41856
+ let cellCount = 0;
41857
+ const table = findParentNodeClosestToPos(selection.ranges[0].$from, (node) => {
41858
+ return node.type.name === "table";
41859
+ });
41860
+ table === null || table === void 0 ? void 0 : table.node.descendants((node) => {
41861
+ if (node.type.name === "table") {
41862
+ return false;
41863
+ }
41864
+ if (["tableCell", "tableHeader"].includes(node.type.name)) {
41865
+ cellCount += 1;
41866
+ }
41867
+ });
41868
+ const allCellsSelected = cellCount === selection.ranges.length;
41869
+ if (!allCellsSelected) {
41870
+ return false;
41871
+ }
41872
+ editor.commands.deleteTable();
41873
+ return true;
41874
+ };
41875
+ const Table = Node$2.create({
41876
+ name: "table",
41877
+ // @ts-ignore
41878
+ addOptions() {
41879
+ return {
41880
+ HTMLAttributes: {},
41881
+ resizable: false,
41882
+ handleWidth: 5,
41883
+ cellMinWidth: 25,
41884
+ // TODO: fix
41885
+ View: TableView,
41886
+ lastColumnResizable: true,
41887
+ allowTableNodeSelection: false
41888
+ };
41889
+ },
41890
+ content: "tableRow+",
41891
+ tableRole: "table",
41892
+ isolating: true,
41893
+ group: "block",
41894
+ parseHTML() {
41895
+ return [{ tag: "table" }];
41896
+ },
41897
+ renderHTML({ node, HTMLAttributes }) {
41898
+ const { colgroup, tableWidth, tableMinWidth } = createColGroup(node, this.options.cellMinWidth);
41899
+ const table = [
41900
+ "table",
41901
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
41902
+ style: tableWidth ? `width: ${tableWidth}` : `minWidth: ${tableMinWidth}`
41903
+ }),
41904
+ colgroup,
41905
+ ["tbody", 0]
41906
+ ];
41907
+ return table;
41908
+ },
41909
+ addCommands() {
41910
+ return {
41911
+ insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr: tr2, dispatch, editor }) => {
41912
+ const node = createTable(editor.schema, rows, cols, withHeaderRow);
41913
+ if (dispatch) {
41914
+ const offset2 = tr2.selection.anchor + 1;
41915
+ tr2.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr2.doc.resolve(offset2)));
41916
+ }
41917
+ return true;
41918
+ },
41919
+ addColumnBefore: () => ({ state: state2, dispatch }) => {
41920
+ return addColumnBefore(state2, dispatch);
41921
+ },
41922
+ addColumnAfter: () => ({ state: state2, dispatch }) => {
41923
+ return addColumnAfter(state2, dispatch);
41924
+ },
41925
+ deleteColumn: () => ({ state: state2, dispatch }) => {
41926
+ return deleteColumn(state2, dispatch);
41927
+ },
41928
+ addRowBefore: () => ({ state: state2, dispatch }) => {
41929
+ return addRowBefore(state2, dispatch);
41930
+ },
41931
+ addRowAfter: () => ({ state: state2, dispatch }) => {
41932
+ return addRowAfter(state2, dispatch);
41933
+ },
41934
+ deleteRow: () => ({ state: state2, dispatch }) => {
41935
+ return deleteRow(state2, dispatch);
41936
+ },
41937
+ deleteTable: () => ({ state: state2, dispatch }) => {
41938
+ return deleteTable(state2, dispatch);
41939
+ },
41940
+ mergeCells: () => ({ state: state2, dispatch }) => {
41941
+ return mergeCells(state2, dispatch);
41942
+ },
41943
+ splitCell: () => ({ state: state2, dispatch }) => {
41944
+ return splitCell(state2, dispatch);
41945
+ },
41946
+ toggleHeaderColumn: () => ({ state: state2, dispatch }) => {
41947
+ return toggleHeader("column")(state2, dispatch);
41948
+ },
41949
+ toggleHeaderRow: () => ({ state: state2, dispatch }) => {
41950
+ return toggleHeader("row")(state2, dispatch);
41951
+ },
41952
+ toggleHeaderCell: () => ({ state: state2, dispatch }) => {
41953
+ return toggleHeaderCell(state2, dispatch);
41954
+ },
41955
+ mergeOrSplit: () => ({ state: state2, dispatch }) => {
41956
+ if (mergeCells(state2, dispatch)) {
41957
+ return true;
41958
+ }
41959
+ return splitCell(state2, dispatch);
41960
+ },
41961
+ setCellAttribute: (name, value) => ({ state: state2, dispatch }) => {
41962
+ return setCellAttr(name, value)(state2, dispatch);
41963
+ },
41964
+ goToNextCell: () => ({ state: state2, dispatch }) => {
41965
+ return goToNextCell(1)(state2, dispatch);
41966
+ },
41967
+ goToPreviousCell: () => ({ state: state2, dispatch }) => {
41968
+ return goToNextCell(-1)(state2, dispatch);
41969
+ },
41970
+ fixTables: () => ({ state: state2, dispatch }) => {
41971
+ if (dispatch) {
41972
+ fixTables(state2);
41973
+ }
41974
+ return true;
41975
+ },
41976
+ setCellSelection: (position) => ({ tr: tr2, dispatch }) => {
41977
+ if (dispatch) {
41978
+ const selection = CellSelection.create(tr2.doc, position.anchorCell, position.headCell);
41979
+ tr2.setSelection(selection);
41980
+ }
41981
+ return true;
41982
+ }
41983
+ };
41984
+ },
41985
+ addKeyboardShortcuts() {
41986
+ return {
41987
+ Tab: () => {
41988
+ if (this.editor.commands.goToNextCell()) {
41989
+ return true;
41990
+ }
41991
+ if (!this.editor.can().addRowAfter()) {
41992
+ return false;
41993
+ }
41994
+ return this.editor.chain().addRowAfter().goToNextCell().run();
41995
+ },
41996
+ "Shift-Tab": () => this.editor.commands.goToPreviousCell(),
41997
+ Backspace: deleteTableWhenAllCellsSelected,
41998
+ "Mod-Backspace": deleteTableWhenAllCellsSelected,
41999
+ Delete: deleteTableWhenAllCellsSelected,
42000
+ "Mod-Delete": deleteTableWhenAllCellsSelected
42001
+ };
42002
+ },
42003
+ addProseMirrorPlugins() {
42004
+ const isResizable = this.options.resizable && this.editor.isEditable;
42005
+ return [
42006
+ ...isResizable ? [
42007
+ columnResizing({
42008
+ handleWidth: this.options.handleWidth,
42009
+ cellMinWidth: this.options.cellMinWidth,
42010
+ // @ts-ignore (incorrect type)
42011
+ View: this.options.View,
42012
+ // TODO: PR for @types/prosemirror-tables
42013
+ // @ts-ignore (incorrect type)
42014
+ lastColumnResizable: this.options.lastColumnResizable
42015
+ })
42016
+ ] : [],
42017
+ tableEditing({
42018
+ allowTableNodeSelection: this.options.allowTableNodeSelection
42019
+ })
42020
+ ];
42021
+ },
42022
+ extendNodeSchema(extension) {
42023
+ const context = {
42024
+ name: extension.name,
42025
+ options: extension.options,
42026
+ storage: extension.storage
42027
+ };
42028
+ return {
42029
+ tableRole: callOrReturn(getExtensionField(extension, "tableRole", context))
42030
+ };
42031
+ }
42032
+ });
42033
+ const TableRow = Node$2.create({
42034
+ name: "tableRow",
42035
+ addOptions() {
42036
+ return {
42037
+ HTMLAttributes: {}
42038
+ };
42039
+ },
42040
+ content: "(tableCell | tableHeader)*",
42041
+ tableRole: "row",
42042
+ parseHTML() {
42043
+ return [
42044
+ { tag: "tr" }
42045
+ ];
42046
+ },
42047
+ renderHTML({ HTMLAttributes }) {
42048
+ return ["tr", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
42049
+ }
42050
+ });
42051
+ const TableCell = Node$2.create({
42052
+ name: "tableCell",
42053
+ addOptions() {
42054
+ return {
42055
+ HTMLAttributes: {}
42056
+ };
42057
+ },
42058
+ content: "block+",
42059
+ addAttributes() {
42060
+ return {
42061
+ colspan: {
42062
+ default: 1
42063
+ },
42064
+ rowspan: {
42065
+ default: 1
42066
+ },
42067
+ colwidth: {
42068
+ default: null,
42069
+ parseHTML: (element) => {
42070
+ const colwidth = element.getAttribute("colwidth");
42071
+ const value = colwidth ? [parseInt(colwidth, 10)] : null;
42072
+ return value;
42073
+ }
42074
+ }
42075
+ };
42076
+ },
42077
+ tableRole: "cell",
42078
+ isolating: true,
42079
+ parseHTML() {
42080
+ return [
42081
+ { tag: "td" }
42082
+ ];
42083
+ },
42084
+ renderHTML({ HTMLAttributes }) {
42085
+ return ["td", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
42086
+ }
42087
+ });
42088
+ const TableHeader = Node$2.create({
42089
+ name: "tableHeader",
42090
+ addOptions() {
42091
+ return {
42092
+ HTMLAttributes: {}
42093
+ };
42094
+ },
42095
+ content: "block+",
42096
+ addAttributes() {
42097
+ return {
42098
+ colspan: {
42099
+ default: 1
42100
+ },
42101
+ rowspan: {
42102
+ default: 1
42103
+ },
42104
+ colwidth: {
42105
+ default: null,
42106
+ parseHTML: (element) => {
42107
+ const colwidth = element.getAttribute("colwidth");
42108
+ const value = colwidth ? [parseInt(colwidth, 10)] : null;
42109
+ return value;
42110
+ }
42111
+ }
42112
+ };
42113
+ },
42114
+ tableRole: "header_cell",
42115
+ isolating: true,
42116
+ parseHTML() {
42117
+ return [
42118
+ { tag: "th" }
42119
+ ];
42120
+ },
42121
+ renderHTML({ HTMLAttributes }) {
42122
+ return ["th", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
42123
+ }
42124
+ });
39445
42125
  const _hoisted_1$d = { class: "RichText" };
39446
42126
  const _hoisted_2$a = {
39447
42127
  key: 0,
@@ -39615,6 +42295,11 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39615
42295
  command: () => focus2().setHardBreak().run(),
39616
42296
  icon: "keyboard_return"
39617
42297
  },
42298
+ {
42299
+ name: "Table",
42300
+ command: () => editor.value.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(),
42301
+ icon: "table_chart"
42302
+ },
39618
42303
  {
39619
42304
  name: "Undo",
39620
42305
  command: () => focus2().undo().run(),
@@ -39637,7 +42322,15 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
39637
42322
  const emit2 = __emit;
39638
42323
  function initEditor() {
39639
42324
  editor.value = new Editor({
39640
- extensions: [StarterKit, Image, Youtube],
42325
+ extensions: [
42326
+ StarterKit,
42327
+ Image,
42328
+ Youtube,
42329
+ Table,
42330
+ TableRow,
42331
+ TableCell,
42332
+ TableHeader
42333
+ ],
39641
42334
  content: props2.modelValue,
39642
42335
  onUpdate: ({ editor: editor2 }) => emit2("update:modelValue", editor2.getHTML())
39643
42336
  });
@@ -46098,7 +48791,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
46098
48791
  }
46099
48792
  return (_ctx, _cache) => {
46100
48793
  const _directive_tooltip = vue.resolveDirective("tooltip");
46101
- return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$u), {
48794
+ return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$v), {
46102
48795
  class: vue.normalizeClass(["flex column gap-05 pt-1 bgl_sidebar", { wideNav: vue.unref(isOpen) }])
46103
48796
  }, {
46104
48797
  default: vue.withCtx(() => [
@@ -46121,7 +48814,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
46121
48814
  class: "nav-button px-075"
46122
48815
  }, {
46123
48816
  default: vue.withCtx(() => [
46124
- vue.createVNode(vue.unref(_sfc_main$H), {
48817
+ vue.createVNode(vue.unref(_sfc_main$I), {
46125
48818
  icon: nav2.icon,
46126
48819
  size: 1.4
46127
48820
  }, null, 8, ["icon"]),
@@ -46158,7 +48851,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
46158
48851
  },
46159
48852
  setup(__props) {
46160
48853
  return (_ctx, _cache) => {
46161
- return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$u), { class: "hide m_grid gap-05 bgl_bottombar px-1 txt14 justify-content-start align-items-center overflow-x" }, {
48854
+ return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$v), { class: "hide m_grid gap-05 bgl_bottombar px-1 txt14 justify-content-start align-items-center overflow-x" }, {
46162
48855
  default: vue.withCtx(() => [
46163
48856
  vue.renderSlot(_ctx.$slots, "brand", {}, void 0, true),
46164
48857
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.navLinks, (nav2, i2) => {
@@ -46169,7 +48862,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
46169
48862
  class: "m_h-auto"
46170
48863
  }, {
46171
48864
  default: vue.withCtx(() => [
46172
- vue.createVNode(vue.unref(_sfc_main$H), {
48865
+ vue.createVNode(vue.unref(_sfc_main$I), {
46173
48866
  icon: nav2.icon,
46174
48867
  size: 1.4,
46175
48868
  class: "m-0"
@@ -46273,7 +48966,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
46273
48966
  onClick: ($event) => selectTab(tab),
46274
48967
  key: i2
46275
48968
  }, [
46276
- typeof tab !== "string" && tab.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$H), {
48969
+ typeof tab !== "string" && tab.icon ? (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$I), {
46277
48970
  key: 0,
46278
48971
  icon: tab.icon
46279
48972
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -46367,7 +49060,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
46367
49060
  }
46368
49061
  });
46369
49062
  const TabbedLayout = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fd61196d"]]);
46370
- exports.Accordion = _sfc_main$r;
49063
+ exports.Accordion = _sfc_main$s;
46371
49064
  exports.AccordionItem = AccordionItem;
46372
49065
  exports.Alert = Alert;
46373
49066
  exports.Avatar = Avatar;
@@ -46379,7 +49072,7 @@ exports.BglForm = _sfc_main$m;
46379
49072
  exports.BglVideo = BglVideo;
46380
49073
  exports.BottomMenu = BottomMenu;
46381
49074
  exports.Btn = Btn;
46382
- exports.Card = _sfc_main$u;
49075
+ exports.Card = _sfc_main$v;
46383
49076
  exports.Carousel = Carousel;
46384
49077
  exports.CheckInput = CheckInput;
46385
49078
  exports.Checkbox = Checkbox;
@@ -46389,18 +49082,19 @@ exports.DateInput = _sfc_main$j;
46389
49082
  exports.DatePicker = _sfc_main$c;
46390
49083
  exports.Dropdown = kt$1;
46391
49084
  exports.FileUpload = $el;
46392
- exports.Icon = _sfc_main$H;
49085
+ exports.Icon = _sfc_main$I;
46393
49086
  exports.JSONInput = JSONInput;
46394
49087
  exports.Layout = Layout;
46395
49088
  exports.Lineart = _sfc_main$7;
46396
- exports.ListItem = _sfc_main$A;
46397
- exports.ListView = _sfc_main$B;
46398
- exports.MaterialIcon = _sfc_main$H;
46399
- exports.Modal = _sfc_main$E;
49089
+ exports.ListItem = _sfc_main$B;
49090
+ exports.ListView = _sfc_main$C;
49091
+ exports.MaterialIcon = _sfc_main$I;
49092
+ exports.Modal = _sfc_main$F;
49093
+ exports.ModalConfirm = _sfc_main$n;
46400
49094
  exports.ModalForm = ModalForm;
46401
49095
  exports.ModalPlugin = ModalPlugin;
46402
49096
  exports.NavBar = NavBar;
46403
- exports.PageTitle = _sfc_main$z;
49097
+ exports.PageTitle = _sfc_main$A;
46404
49098
  exports.RadioPillsInput = RadioPillsInput;
46405
49099
  exports.RichText = _sfc_main$8;
46406
49100
  exports.RouterWrapper = RouterWrapper;
@@ -46413,7 +49107,7 @@ exports.Tabs = _sfc_main$3;
46413
49107
  exports.TabsBody = _sfc_main$1;
46414
49108
  exports.TabsNav = TabsNav;
46415
49109
  exports.TextInput = TextInput;
46416
- exports.Title = _sfc_main$s;
49110
+ exports.Title = _sfc_main$t;
46417
49111
  exports.ToggleInput = ToggleInput;
46418
49112
  exports.TopBar = TopBar;
46419
49113
  exports.bagelFormUtils = bagelFormUtils;