@bagelink/vue 0.0.596 → 0.0.598

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.mjs CHANGED
@@ -110,21 +110,12 @@ function getPaddingObject(padding) {
110
110
  };
111
111
  }
112
112
  function rectToClientRect$1(rect) {
113
- const {
114
- x: x2,
115
- y: y2,
116
- width,
117
- height
118
- } = rect;
119
113
  return {
120
- width,
121
- height,
122
- top: y2,
123
- left: x2,
124
- right: x2 + width,
125
- bottom: y2 + height,
126
- x: x2,
127
- y: y2
114
+ ...rect,
115
+ top: rect.y,
116
+ left: rect.x,
117
+ right: rect.x + rect.width,
118
+ bottom: rect.y + rect.height
128
119
  };
129
120
  }
130
121
  function computeCoordsFromPlacement(_ref, placement, rtl) {
@@ -295,10 +286,9 @@ async function detectOverflow$1(state2, options) {
295
286
  strategy
296
287
  }));
297
288
  const rect = elementContext === "floating" ? {
289
+ ...rects.floating,
298
290
  x: x2,
299
- y: y2,
300
- width: rects.floating.width,
301
- height: rects.floating.height
291
+ y: y2
302
292
  } : rects.reference;
303
293
  const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
304
294
  const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
@@ -509,12 +499,10 @@ const flip$2 = function(options) {
509
499
  return {};
510
500
  }
511
501
  const side = getSide$1(placement);
512
- const initialSideAxis = getSideAxis(initialPlacement);
513
502
  const isBasePlacement = getSide$1(initialPlacement) === initialPlacement;
514
503
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
515
504
  const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$1(initialPlacement)] : getExpandedPlacements(initialPlacement));
516
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
517
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
505
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
518
506
  fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
519
507
  }
520
508
  const placements2 = [initialPlacement, ...fallbackPlacements];
@@ -551,16 +539,8 @@ const flip$2 = function(options) {
551
539
  if (!resetPlacement) {
552
540
  switch (fallbackStrategy) {
553
541
  case "bestFit": {
554
- var _overflowsData$filter2;
555
- const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
556
- if (hasFallbackAxisSideDirection) {
557
- const currentSideAxis = getSideAxis(d2.placement);
558
- return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
559
- // reading directions favoring greater width.
560
- currentSideAxis === "y";
561
- }
562
- return true;
563
- }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
542
+ var _overflowsData$map$so;
543
+ const placement2 = (_overflowsData$map$so = overflowsData.map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
564
544
  if (placement2) {
565
545
  resetPlacement = placement2;
566
546
  }
@@ -755,16 +735,16 @@ const size = function(options) {
755
735
  widthSide = side;
756
736
  heightSide = alignment === "end" ? "top" : "bottom";
757
737
  }
758
- const maximumClippingHeight = height - overflow.top - overflow.bottom;
759
- const maximumClippingWidth = width - overflow.left - overflow.right;
760
- const overflowAvailableHeight = min$3(height - overflow[heightSide], maximumClippingHeight);
761
- const overflowAvailableWidth = min$3(width - overflow[widthSide], maximumClippingWidth);
738
+ const overflowAvailableHeight = height - overflow[heightSide];
739
+ const overflowAvailableWidth = width - overflow[widthSide];
762
740
  const noShift = !state2.middlewareData.shift;
763
741
  let availableHeight = overflowAvailableHeight;
764
742
  let availableWidth = overflowAvailableWidth;
765
743
  if (isYAxis) {
744
+ const maximumClippingWidth = width - overflow.left - overflow.right;
766
745
  availableWidth = alignment || noShift ? min$3(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
767
746
  } else {
747
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
768
748
  availableHeight = alignment || noShift ? min$3(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
769
749
  }
770
750
  if (noShift && !alignment) {
@@ -3401,6 +3381,7 @@ const defaults$1 = {
3401
3381
  utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
3402
3382
  defaults$1.headers[method] = {};
3403
3383
  });
3384
+ const defaults$2 = defaults$1;
3404
3385
  const ignoreDuplicateOf = utils$1.toObjectSet([
3405
3386
  "age",
3406
3387
  "authorization",
@@ -3662,10 +3643,11 @@ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
3662
3643
  };
3663
3644
  });
3664
3645
  utils$1.freezeMethods(AxiosHeaders);
3646
+ const AxiosHeaders$1 = AxiosHeaders;
3665
3647
  function transformData(fns, response) {
3666
- const config = this || defaults$1;
3648
+ const config = this || defaults$2;
3667
3649
  const context = response || config;
3668
- const headers = AxiosHeaders.from(context.headers);
3650
+ const headers = AxiosHeaders$1.from(context.headers);
3669
3651
  let data2 = context.data;
3670
3652
  utils$1.forEach(fns, function transform(fn3) {
3671
3653
  data2 = fn3.call(config, data2, headers.normalize(), response ? response.status : void 0);
@@ -3864,7 +3846,7 @@ function buildFullPath(baseURL, requestedURL) {
3864
3846
  }
3865
3847
  return requestedURL;
3866
3848
  }
3867
- const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
3849
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
3868
3850
  function mergeConfig(config1, config2) {
3869
3851
  config2 = config2 || {};
3870
3852
  const config = {};
@@ -3945,7 +3927,7 @@ function mergeConfig(config1, config2) {
3945
3927
  const resolveConfig = (config) => {
3946
3928
  const newConfig = mergeConfig({}, config);
3947
3929
  let { data: data2, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
3948
- newConfig.headers = headers = AxiosHeaders.from(headers);
3930
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
3949
3931
  newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
3950
3932
  if (auth) {
3951
3933
  headers.set(
@@ -3978,7 +3960,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
3978
3960
  return new Promise(function dispatchXhrRequest(resolve, reject3) {
3979
3961
  const _config = resolveConfig(config);
3980
3962
  let requestData = _config.data;
3981
- const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
3963
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
3982
3964
  let { responseType } = _config;
3983
3965
  let onCanceled;
3984
3966
  function done() {
@@ -3996,7 +3978,7 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
3996
3978
  if (!request) {
3997
3979
  return;
3998
3980
  }
3999
- const responseHeaders = AxiosHeaders.from(
3981
+ const responseHeaders = AxiosHeaders$1.from(
4000
3982
  "getAllResponseHeaders" in request && request.getAllResponseHeaders()
4001
3983
  );
4002
3984
  const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
@@ -4312,7 +4294,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
4312
4294
  return await new Promise((resolve, reject3) => {
4313
4295
  settle(resolve, reject3, {
4314
4296
  data: responseData,
4315
- headers: AxiosHeaders.from(response.headers),
4297
+ headers: AxiosHeaders$1.from(response.headers),
4316
4298
  status: response.status,
4317
4299
  statusText: response.statusText,
4318
4300
  config,
@@ -4394,7 +4376,7 @@ function throwIfCancellationRequested(config) {
4394
4376
  }
4395
4377
  function dispatchRequest(config) {
4396
4378
  throwIfCancellationRequested(config);
4397
- config.headers = AxiosHeaders.from(config.headers);
4379
+ config.headers = AxiosHeaders$1.from(config.headers);
4398
4380
  config.data = transformData.call(
4399
4381
  config,
4400
4382
  config.transformRequest
@@ -4402,7 +4384,7 @@ function dispatchRequest(config) {
4402
4384
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
4403
4385
  config.headers.setContentType("application/x-www-form-urlencoded", false);
4404
4386
  }
4405
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
4387
+ const adapter = adapters.getAdapter(config.adapter || defaults$2.adapter);
4406
4388
  return adapter(config).then(function onAdapterResolution(response) {
4407
4389
  throwIfCancellationRequested(config);
4408
4390
  response.data = transformData.call(
@@ -4410,7 +4392,7 @@ function dispatchRequest(config) {
4410
4392
  config.transformResponse,
4411
4393
  response
4412
4394
  );
4413
- response.headers = AxiosHeaders.from(response.headers);
4395
+ response.headers = AxiosHeaders$1.from(response.headers);
4414
4396
  return response;
4415
4397
  }, function onAdapterRejection(reason) {
4416
4398
  if (!isCancel(reason)) {
@@ -4421,7 +4403,7 @@ function dispatchRequest(config) {
4421
4403
  config.transformResponse,
4422
4404
  reason.response
4423
4405
  );
4424
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
4406
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
4425
4407
  }
4426
4408
  }
4427
4409
  return Promise.reject(reason);
@@ -4560,7 +4542,7 @@ class Axios {
4560
4542
  delete headers[method];
4561
4543
  }
4562
4544
  );
4563
- config.headers = AxiosHeaders.concat(contextHeaders, headers);
4545
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
4564
4546
  const requestInterceptorChain = [];
4565
4547
  let synchronousRequestInterceptors = true;
4566
4548
  this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
@@ -4644,6 +4626,7 @@ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method)
4644
4626
  Axios.prototype[method] = generateHTTPMethod();
4645
4627
  Axios.prototype[method + "Form"] = generateHTTPMethod(true);
4646
4628
  });
4629
+ const Axios$1 = Axios;
4647
4630
  class CancelToken {
4648
4631
  constructor(executor) {
4649
4632
  if (typeof executor !== "function") {
@@ -4730,6 +4713,7 @@ class CancelToken {
4730
4713
  };
4731
4714
  }
4732
4715
  }
4716
+ const CancelToken$1 = CancelToken;
4733
4717
  function spread(callback) {
4734
4718
  return function wrap2(arr) {
4735
4719
  return callback.apply(null, arr);
@@ -4806,20 +4790,21 @@ const HttpStatusCode = {
4806
4790
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
4807
4791
  HttpStatusCode[value] = key;
4808
4792
  });
4793
+ const HttpStatusCode$1 = HttpStatusCode;
4809
4794
  function createInstance(defaultConfig2) {
4810
- const context = new Axios(defaultConfig2);
4811
- const instance = bind$2(Axios.prototype.request, context);
4812
- utils$1.extend(instance, Axios.prototype, context, { allOwnKeys: true });
4795
+ const context = new Axios$1(defaultConfig2);
4796
+ const instance = bind$2(Axios$1.prototype.request, context);
4797
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
4813
4798
  utils$1.extend(instance, context, null, { allOwnKeys: true });
4814
4799
  instance.create = function create(instanceConfig) {
4815
4800
  return createInstance(mergeConfig(defaultConfig2, instanceConfig));
4816
4801
  };
4817
4802
  return instance;
4818
4803
  }
4819
- const axios$1 = createInstance(defaults$1);
4820
- axios$1.Axios = Axios;
4804
+ const axios$1 = createInstance(defaults$2);
4805
+ axios$1.Axios = Axios$1;
4821
4806
  axios$1.CanceledError = CanceledError;
4822
- axios$1.CancelToken = CancelToken;
4807
+ axios$1.CancelToken = CancelToken$1;
4823
4808
  axios$1.isCancel = isCancel;
4824
4809
  axios$1.VERSION = VERSION;
4825
4810
  axios$1.toFormData = toFormData;
@@ -4831,10 +4816,10 @@ axios$1.all = function all(promises) {
4831
4816
  axios$1.spread = spread;
4832
4817
  axios$1.isAxiosError = isAxiosError;
4833
4818
  axios$1.mergeConfig = mergeConfig;
4834
- axios$1.AxiosHeaders = AxiosHeaders;
4819
+ axios$1.AxiosHeaders = AxiosHeaders$1;
4835
4820
  axios$1.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4836
4821
  axios$1.getAdapter = adapters.getAdapter;
4837
- axios$1.HttpStatusCode = HttpStatusCode;
4822
+ axios$1.HttpStatusCode = HttpStatusCode$1;
4838
4823
  axios$1.default = axios$1;
4839
4824
  var __defProp = Object.defineProperty;
4840
4825
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -5078,10 +5063,7 @@ class Bagel {
5078
5063
  this._setAuthorization();
5079
5064
  const formData = new FormData();
5080
5065
  formData.append("file", file);
5081
- let url = "/static_files/upload";
5082
- if (options == null ? void 0 : options.topic)
5083
- url = `/static_files/upload?topic=${options.topic}`;
5084
- const { data: data2 } = await axios.post(url, formData, {
5066
+ const { data: data2 } = await axios.post("/static_files/upload", formData, {
5085
5067
  headers: {
5086
5068
  "Content-Type": "multipart/form-data"
5087
5069
  },
@@ -6050,7 +6032,7 @@ function toValue(r2) {
6050
6032
  const isClient = typeof window !== "undefined" && typeof document !== "undefined";
6051
6033
  typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
6052
6034
  function getLifeCycleTarget(target) {
6053
- return getCurrentInstance();
6035
+ return target || getCurrentInstance();
6054
6036
  }
6055
6037
  function tryOnMounted(fn3, sync = true, target) {
6056
6038
  const instance = getLifeCycleTarget();
@@ -6358,9 +6340,9 @@ const _hoisted_3$j = [
6358
6340
  const _hoisted_4$d = { class: "infinite-wrapper" };
6359
6341
  const _hoisted_5$d = { class: "row first-row" };
6360
6342
  const _hoisted_6$8 = { key: 0 };
6361
- const _hoisted_7$3 = ["onClick"];
6362
- const _hoisted_8$1 = { class: "flex" };
6363
- const _hoisted_9$1 = ["onClick"];
6343
+ const _hoisted_7$4 = ["onClick"];
6344
+ const _hoisted_8$2 = { class: "flex" };
6345
+ const _hoisted_9$2 = ["onClick"];
6364
6346
  const _hoisted_10$1 = { key: 0 };
6365
6347
  const _hoisted_11$1 = ["value"];
6366
6348
  const _hoisted_12$1 = { key: 1 };
@@ -6518,7 +6500,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6518
6500
  class: "col",
6519
6501
  onClick: ($event) => sort2((field == null ? void 0 : field.id) || "")
6520
6502
  }, [
6521
- createElementVNode("div", _hoisted_8$1, [
6503
+ createElementVNode("div", _hoisted_8$2, [
6522
6504
  createTextVNode(toDisplayString(field.label || unref(keyToLabel)(field.id)) + " ", 1),
6523
6505
  createElementVNode("div", {
6524
6506
  class: normalizeClass(["list-arrows", { sorted: unref(sortField) === field.id }])
@@ -6529,7 +6511,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6529
6511
  }, null, 8, ["class"])
6530
6512
  ], 2)
6531
6513
  ])
6532
- ], 8, _hoisted_7$3);
6514
+ ], 8, _hoisted_7$4);
6533
6515
  }), 128))
6534
6516
  ]),
6535
6517
  createElementVNode("tbody", null, [
@@ -6572,7 +6554,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6572
6554
  ]))
6573
6555
  ]);
6574
6556
  }), 128))
6575
- ], 10, _hoisted_9$1);
6557
+ ], 10, _hoisted_9$2);
6576
6558
  }), 128))
6577
6559
  ])
6578
6560
  ])
@@ -6622,9 +6604,12 @@ const _hoisted_2$s = {
6622
6604
  class: "data-row"
6623
6605
  };
6624
6606
  const _hoisted_3$i = { class: "key" };
6625
- const _hoisted_4$c = { key: 1 };
6626
- const _hoisted_5$c = { class: "key" };
6627
- const _hoisted_6$7 = { class: "vlue" };
6607
+ const _hoisted_4$c = { class: "m-0" };
6608
+ const _hoisted_5$c = { key: 1 };
6609
+ const _hoisted_6$7 = { class: "key" };
6610
+ const _hoisted_7$3 = { class: "m-0" };
6611
+ const _hoisted_8$1 = { class: "vlue" };
6612
+ const _hoisted_9$1 = { class: "m-0" };
6628
6613
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
6629
6614
  __name: "DataPreview",
6630
6615
  props: /* @__PURE__ */ mergeModels({
@@ -6657,7 +6642,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6657
6642
  key: field.id
6658
6643
  }, [
6659
6644
  unref(iffer)(field, itemData.value) ? (openBlock(), createElementBlock("div", _hoisted_2$s, [
6660
- createElementVNode("div", _hoisted_3$i, toDisplayString((field == null ? void 0 : field.label) || unref(keyToLabel)(field.id)), 1),
6645
+ createElementVNode("div", _hoisted_3$i, [
6646
+ createElementVNode("p", _hoisted_4$c, toDisplayString((field == null ? void 0 : field.label) || unref(keyToLabel)(field.id)), 1)
6647
+ ]),
6661
6648
  createVNode(unref(_sfc_main$p), {
6662
6649
  modelValue: itemData.value,
6663
6650
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => itemData.value = $event),
@@ -6668,14 +6655,18 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6668
6655
  ])) : createCommentVNode("", true)
6669
6656
  ], 64);
6670
6657
  }), 128)),
6671
- !((_a2 = _ctx.schema) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("div", _hoisted_4$c, [
6658
+ !((_a2 = _ctx.schema) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("div", _hoisted_5$c, [
6672
6659
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(computedSchema.value, ({ id, label }) => {
6673
6660
  return openBlock(), createElementBlock("div", {
6674
6661
  key: id,
6675
6662
  class: "data-row"
6676
6663
  }, [
6677
- createElementVNode("div", _hoisted_5$c, toDisplayString(label), 1),
6678
- createElementVNode("div", _hoisted_6$7, toDisplayString(itemData.value[id ?? ""]), 1)
6664
+ createElementVNode("div", _hoisted_6$7, [
6665
+ createElementVNode("p", _hoisted_7$3, toDisplayString(label), 1)
6666
+ ]),
6667
+ createElementVNode("div", _hoisted_8$1, [
6668
+ createElementVNode("p", _hoisted_9$1, toDisplayString(itemData.value[id ?? ""]), 1)
6669
+ ])
6679
6670
  ]);
6680
6671
  }), 128))
6681
6672
  ])) : createCommentVNode("", true),
@@ -6684,7 +6675,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6684
6675
  };
6685
6676
  }
6686
6677
  });
6687
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-2281300f"]]);
6678
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-02756011"]]);
6688
6679
  const _hoisted_1$z = {
6689
6680
  key: 0,
6690
6681
  class: "card_label"
@@ -16968,12 +16959,11 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
16968
16959
  }
16969
16960
  });
16970
16961
  const vIf = computed(() => {
16971
- if (props2.field["v-if"] === void 0) return true;
16972
- if (typeof props2.field["v-if"] === "boolean") return props2.field["v-if"];
16973
- if (typeof props2.field["v-if"] === "string") return true;
16974
- if (typeof props2.field["v-if"] === "function") {
16975
- return props2.field["v-if"](fieldData.value, formData.value);
16976
- }
16962
+ if (props2.field["v-if"] === void 0 && props2.field.vIf === void 0) return true;
16963
+ if (typeof props2.field["v-if"] === "boolean" || typeof props2.field.vIf === "boolean") return props2.field["v-if"];
16964
+ if (typeof props2.field["v-if"] === "string" || typeof props2.field.vIf === "string") return true;
16965
+ if (typeof props2.field["v-if"] === "function") return props2.field["v-if"](fieldData.value, formData.value);
16966
+ if (typeof props2.field.vIf === "function") return props2.field.vIf(fieldData.value, formData.value);
16977
16967
  return true;
16978
16968
  });
16979
16969
  const computedFieldData = computed(
@@ -17286,7 +17276,12 @@ function eachDayOfInterval(interval, options) {
17286
17276
  const endTime = reversed ? +startDate : +endDate;
17287
17277
  const currentDate = reversed ? endDate : startDate;
17288
17278
  currentDate.setHours(0, 0, 0, 0);
17289
- let step = 1;
17279
+ let step = (options == null ? void 0 : options.step) ?? 1;
17280
+ if (!step) return [];
17281
+ if (step < 0) {
17282
+ step = -step;
17283
+ reversed = !reversed;
17284
+ }
17290
17285
  const dates = [];
17291
17286
  while (+currentDate <= endTime) {
17292
17287
  dates.push(toDate(currentDate));
@@ -17309,7 +17304,12 @@ function eachQuarterOfInterval(interval, options) {
17309
17304
  let reversed = +startDate > +endDate;
17310
17305
  const endTime = reversed ? +startOfQuarter(startDate) : +startOfQuarter(endDate);
17311
17306
  let currentDate = reversed ? startOfQuarter(endDate) : startOfQuarter(startDate);
17312
- let step = 1;
17307
+ let step = (options == null ? void 0 : options.step) ?? 1;
17308
+ if (!step) return [];
17309
+ if (step < 0) {
17310
+ step = -step;
17311
+ reversed = !reversed;
17312
+ }
17313
17313
  const dates = [];
17314
17314
  while (+currentDate <= endTime) {
17315
17315
  dates.push(toDate(currentDate));
@@ -26155,8 +26155,10 @@ function isScrolledPast(el, elSide, parentSide) {
26155
26155
  var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
26156
26156
  while (parent) {
26157
26157
  var parentSideVal = getRect(parent)[parentSide], visible = void 0;
26158
- {
26158
+ if (parentSide === "top" || parentSide === "left") {
26159
26159
  visible = elSideVal >= parentSideVal;
26160
+ } else {
26161
+ visible = elSideVal <= parentSideVal;
26160
26162
  }
26161
26163
  if (!visible) return parent;
26162
26164
  if (parent === getWindowScrollingElement()) break;
@@ -29531,7 +29533,7 @@ class Fragment {
29531
29533
  /**
29532
29534
  Find the index and inner offset corresponding to a given relative
29533
29535
  position in this fragment. The result object will be reused
29534
- (overwritten) the next time the function is called. @internal
29536
+ (overwritten) the next time the function is called. (Not public.)
29535
29537
  */
29536
29538
  findIndex(pos, round2 = -1) {
29537
29539
  if (pos == 0)
@@ -29737,9 +29739,7 @@ let Mark$1 = class Mark2 {
29737
29739
  let type3 = schema.marks[json.type];
29738
29740
  if (!type3)
29739
29741
  throw new RangeError(`There is no mark type ${json.type} in this schema`);
29740
- let mark = type3.create(json.attrs);
29741
- type3.checkAttrs(mark.attrs);
29742
- return mark;
29742
+ return type3.create(json.attrs);
29743
29743
  }
29744
29744
  /**
29745
29745
  Test whether two sets of marks are identical.
@@ -29873,6 +29873,8 @@ function removeRange(content, from2, to2) {
29873
29873
  function insertInto(content, dist, insert, parent) {
29874
29874
  let { index: index2, offset: offset2 } = content.findIndex(dist), child = content.maybeChild(index2);
29875
29875
  if (offset2 == dist || child.isText) {
29876
+ if (parent && !parent.canReplace(index2, index2, insert))
29877
+ return null;
29876
29878
  return content.cut(0, dist).append(insert).append(content.cut(dist));
29877
29879
  }
29878
29880
  let inner = insertInto(child.content, dist - offset2 - 1, insert);
@@ -30234,28 +30236,17 @@ class ResolvedPos {
30234
30236
  @internal
30235
30237
  */
30236
30238
  static resolveCached(doc2, pos) {
30237
- let cache = resolveCache.get(doc2);
30238
- if (cache) {
30239
- for (let i2 = 0; i2 < cache.elts.length; i2++) {
30240
- let elt = cache.elts[i2];
30241
- if (elt.pos == pos)
30242
- return elt;
30243
- }
30244
- } else {
30245
- resolveCache.set(doc2, cache = new ResolveCache());
30239
+ for (let i2 = 0; i2 < resolveCache.length; i2++) {
30240
+ let cached2 = resolveCache[i2];
30241
+ if (cached2.pos == pos && cached2.doc == doc2)
30242
+ return cached2;
30246
30243
  }
30247
- let result2 = cache.elts[cache.i] = ResolvedPos.resolve(doc2, pos);
30248
- cache.i = (cache.i + 1) % resolveCacheSize;
30244
+ let result2 = resolveCache[resolveCachePos] = ResolvedPos.resolve(doc2, pos);
30245
+ resolveCachePos = (resolveCachePos + 1) % resolveCacheSize;
30249
30246
  return result2;
30250
30247
  }
30251
30248
  }
30252
- class ResolveCache {
30253
- constructor() {
30254
- this.elts = [];
30255
- this.i = 0;
30256
- }
30257
- }
30258
- const resolveCacheSize = 12, resolveCache = /* @__PURE__ */ new WeakMap();
30249
+ let resolveCache = [], resolveCachePos = 0, resolveCacheSize = 12;
30259
30250
  class NodeRange {
30260
30251
  /**
30261
30252
  Construct a node range. `$from` and `$to` should point into the
@@ -30641,17 +30632,13 @@ let Node$3 = class Node2 {
30641
30632
  }
30642
30633
  /**
30643
30634
  Check whether this node and its descendants conform to the
30644
- schema, and raise an exception when they do not.
30635
+ schema, and raise error when they do not.
30645
30636
  */
30646
30637
  check() {
30647
30638
  this.type.checkContent(this.content);
30648
- this.type.checkAttrs(this.attrs);
30649
30639
  let copy2 = Mark$1.none;
30650
- for (let i2 = 0; i2 < this.marks.length; i2++) {
30651
- let mark = this.marks[i2];
30652
- mark.type.checkAttrs(mark.attrs);
30653
- copy2 = mark.addToSet(copy2);
30654
- }
30640
+ for (let i2 = 0; i2 < this.marks.length; i2++)
30641
+ copy2 = this.marks[i2].addToSet(copy2);
30655
30642
  if (!Mark$1.sameSet(copy2, this.marks))
30656
30643
  throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
30657
30644
  this.content.forEach((node) => node.check());
@@ -30677,7 +30664,7 @@ let Node$3 = class Node2 {
30677
30664
  static fromJSON(schema, json) {
30678
30665
  if (!json)
30679
30666
  throw new RangeError("Invalid input for Node.fromJSON");
30680
- let marks = void 0;
30667
+ let marks = null;
30681
30668
  if (json.marks) {
30682
30669
  if (!Array.isArray(json.marks))
30683
30670
  throw new RangeError("Invalid mark data for Node.fromJSON");
@@ -30689,9 +30676,7 @@ let Node$3 = class Node2 {
30689
30676
  return schema.text(json.text, marks);
30690
30677
  }
30691
30678
  let content = Fragment.fromJSON(schema, json.content);
30692
- let node = schema.nodeType(json.type).create(json.attrs, content, marks);
30693
- node.type.checkAttrs(node.attrs);
30694
- return node;
30679
+ return schema.nodeType(json.type).create(json.attrs, content, marks);
30695
30680
  }
30696
30681
  };
30697
30682
  Node$3.prototype.text = void 0;
@@ -31173,16 +31158,6 @@ function computeAttrs(attrs, value) {
31173
31158
  }
31174
31159
  return built;
31175
31160
  }
31176
- function checkAttrs(attrs, values3, type3, name) {
31177
- for (let name2 in values3)
31178
- if (!(name2 in attrs))
31179
- throw new RangeError(`Unsupported attribute ${name2} for ${type3} of type ${name2}`);
31180
- for (let name2 in attrs) {
31181
- let attr = attrs[name2];
31182
- if (attr.validate)
31183
- attr.validate(values3[name2]);
31184
- }
31185
- }
31186
31161
  function initAttrs(attrs) {
31187
31162
  let result2 = /* @__PURE__ */ Object.create(null);
31188
31163
  if (attrs)
@@ -31312,7 +31287,7 @@ let NodeType$1 = class NodeType2 {
31312
31287
  }
31313
31288
  /**
31314
31289
  Returns true if the given fragment is valid content for this node
31315
- type.
31290
+ type with the given attributes.
31316
31291
  */
31317
31292
  validContent(content) {
31318
31293
  let result2 = this.contentMatch.matchFragment(content);
@@ -31333,12 +31308,6 @@ let NodeType$1 = class NodeType2 {
31333
31308
  throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
31334
31309
  }
31335
31310
  /**
31336
- @internal
31337
- */
31338
- checkAttrs(attrs) {
31339
- checkAttrs(this.attrs, attrs, "node", this.name);
31340
- }
31341
- /**
31342
31311
  Check whether the given mark type is allowed in this node.
31343
31312
  */
31344
31313
  allowsMarkType(markType) {
@@ -31388,19 +31357,10 @@ let NodeType$1 = class NodeType2 {
31388
31357
  return result2;
31389
31358
  }
31390
31359
  };
31391
- function validateType(type3) {
31392
- let types = type3.split("|");
31393
- return (value) => {
31394
- let name = value === null ? "null" : typeof value;
31395
- if (types.indexOf(name) < 0)
31396
- throw new RangeError(`Expected value of type ${types}, got ${name}`);
31397
- };
31398
- }
31399
31360
  class Attribute {
31400
31361
  constructor(options) {
31401
31362
  this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
31402
31363
  this.default = options.default;
31403
- this.validate = typeof options.validate == "string" ? validateType(options.validate) : options.validate;
31404
31364
  }
31405
31365
  get isRequired() {
31406
31366
  return !this.hasDefault;
@@ -31459,12 +31419,6 @@ class MarkType {
31459
31419
  return set2[i2];
31460
31420
  }
31461
31421
  /**
31462
- @internal
31463
- */
31464
- checkAttrs(attrs) {
31465
- checkAttrs(this.attrs, attrs, "mark", this.name);
31466
- }
31467
- /**
31468
31422
  Queries whether a given mark type is
31469
31423
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
31470
31424
  */
@@ -31477,7 +31431,6 @@ class Schema {
31477
31431
  Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
31478
31432
  */
31479
31433
  constructor(spec) {
31480
- this.linebreakReplacement = null;
31481
31434
  this.cached = /* @__PURE__ */ Object.create(null);
31482
31435
  let instanceSpec = this.spec = {};
31483
31436
  for (let prop3 in spec)
@@ -31491,13 +31444,6 @@ class Schema {
31491
31444
  let type3 = this.nodes[prop3], contentExpr = type3.spec.content || "", markExpr = type3.spec.marks;
31492
31445
  type3.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
31493
31446
  type3.inlineContent = type3.contentMatch.inlineContent;
31494
- if (type3.spec.linebreakReplacement) {
31495
- if (this.linebreakReplacement)
31496
- throw new RangeError("Multiple linebreak nodes defined");
31497
- if (!type3.isInline || !type3.isLeaf)
31498
- throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
31499
- this.linebreakReplacement = type3;
31500
- }
31501
31447
  type3.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type3.inlineContent ? [] : null;
31502
31448
  }
31503
31449
  for (let prop3 in this.marks) {
@@ -31582,12 +31528,6 @@ function gatherMarks(schema, marks) {
31582
31528
  }
31583
31529
  return found2;
31584
31530
  }
31585
- function isTagRule(rule) {
31586
- return rule.tag != null;
31587
- }
31588
- function isStyleRule(rule) {
31589
- return rule.style != null;
31590
- }
31591
31531
  class DOMParser {
31592
31532
  /**
31593
31533
  Create a parser that targets the given schema, using the given
@@ -31598,16 +31538,11 @@ class DOMParser {
31598
31538
  this.rules = rules;
31599
31539
  this.tags = [];
31600
31540
  this.styles = [];
31601
- let matchedStyles = this.matchedStyles = [];
31602
31541
  rules.forEach((rule) => {
31603
- if (isTagRule(rule)) {
31542
+ if (rule.tag)
31604
31543
  this.tags.push(rule);
31605
- } else if (isStyleRule(rule)) {
31606
- let prop3 = /[^=]*/.exec(rule.style)[0];
31607
- if (matchedStyles.indexOf(prop3) < 0)
31608
- matchedStyles.push(prop3);
31544
+ else if (rule.style)
31609
31545
  this.styles.push(rule);
31610
- }
31611
31546
  });
31612
31547
  this.normalizeLists = !this.tags.some((r2) => {
31613
31548
  if (!/^(ul|ol)\b/.test(r2.tag) || !r2.node)
@@ -31867,10 +31802,10 @@ class ParseContext {
31867
31802
  this.addElement(dom);
31868
31803
  }
31869
31804
  withStyleRules(dom, f2) {
31870
- let style2 = dom.style;
31871
- if (!style2 || !style2.length)
31805
+ let style2 = dom.getAttribute("style");
31806
+ if (!style2)
31872
31807
  return f2();
31873
- let marks = this.readStyles(dom.style);
31808
+ let marks = this.readStyles(parseStyles(style2));
31874
31809
  if (!marks)
31875
31810
  return;
31876
31811
  let [addMarks, removeMarks] = marks, top2 = this.top;
@@ -31964,30 +31899,27 @@ class ParseContext {
31964
31899
  // had a rule with `ignore` set.
31965
31900
  readStyles(styles) {
31966
31901
  let add2 = Mark$1.none, remove2 = Mark$1.none;
31967
- if (styles.length)
31968
- for (let i2 = 0; i2 < this.parser.matchedStyles.length; i2++) {
31969
- let name = this.parser.matchedStyles[i2], value = styles.getPropertyValue(name);
31970
- if (value)
31971
- for (let after = void 0; ; ) {
31972
- let rule = this.parser.matchStyle(name, value, this, after);
31973
- if (!rule)
31974
- break;
31975
- if (rule.ignore)
31976
- return null;
31977
- if (rule.clearMark) {
31978
- this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
31979
- if (rule.clearMark(m2))
31980
- remove2 = m2.addToSet(remove2);
31981
- });
31982
- } else {
31983
- add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
31984
- }
31985
- if (rule.consuming === false)
31986
- after = rule;
31987
- else
31988
- break;
31989
- }
31902
+ for (let i2 = 0; i2 < styles.length; i2 += 2) {
31903
+ for (let after = void 0; ; ) {
31904
+ let rule = this.parser.matchStyle(styles[i2], styles[i2 + 1], this, after);
31905
+ if (!rule)
31906
+ break;
31907
+ if (rule.ignore)
31908
+ return null;
31909
+ if (rule.clearMark) {
31910
+ this.top.pendingMarks.concat(this.top.activeMarks).forEach((m2) => {
31911
+ if (rule.clearMark(m2))
31912
+ remove2 = m2.addToSet(remove2);
31913
+ });
31914
+ } else {
31915
+ add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
31916
+ }
31917
+ if (rule.consuming === false)
31918
+ after = rule;
31919
+ else
31920
+ break;
31990
31921
  }
31922
+ }
31991
31923
  return [add2, remove2];
31992
31924
  }
31993
31925
  // Look up a handler for the given node. If none are found, return
@@ -32256,6 +32188,12 @@ function normalizeList(dom) {
32256
32188
  function matches(dom, selector2) {
32257
32189
  return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector2);
32258
32190
  }
32191
+ function parseStyles(style2) {
32192
+ let re2 = /\s*([\w-]+)\s*:\s*([^;]+)/g, m2, result2 = [];
32193
+ while (m2 = re2.exec(style2))
32194
+ result2.push(m2[1], m2[2].trim());
32195
+ return result2;
32196
+ }
32259
32197
  function copy$2(obj) {
32260
32198
  let copy2 = {};
32261
32199
  for (let prop3 in obj)
@@ -32346,7 +32284,7 @@ class DOMSerializer {
32346
32284
  @internal
32347
32285
  */
32348
32286
  serializeNodeInner(node, options) {
32349
- let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
32287
+ let { dom, contentDOM } = DOMSerializer.renderSpec(doc$1(options), this.nodes[node.type.name](node));
32350
32288
  if (contentDOM) {
32351
32289
  if (node.isLeaf)
32352
32290
  throw new RangeError("Content hole not allowed in a leaf node spec");
@@ -32377,7 +32315,7 @@ class DOMSerializer {
32377
32315
  */
32378
32316
  serializeMark(mark, inline, options = {}) {
32379
32317
  let toDOM = this.marks[mark.type.name];
32380
- return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
32318
+ return toDOM && DOMSerializer.renderSpec(doc$1(options), toDOM(mark, inline));
32381
32319
  }
32382
32320
  /**
32383
32321
  Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If
@@ -32385,7 +32323,48 @@ class DOMSerializer {
32385
32323
  node with the hole.
32386
32324
  */
32387
32325
  static renderSpec(doc2, structure, xmlNS = null) {
32388
- return renderSpec(doc2, structure, xmlNS);
32326
+ if (typeof structure == "string")
32327
+ return { dom: doc2.createTextNode(structure) };
32328
+ if (structure.nodeType != null)
32329
+ return { dom: structure };
32330
+ if (structure.dom && structure.dom.nodeType != null)
32331
+ return structure;
32332
+ let tagName = structure[0], space = tagName.indexOf(" ");
32333
+ if (space > 0) {
32334
+ xmlNS = tagName.slice(0, space);
32335
+ tagName = tagName.slice(space + 1);
32336
+ }
32337
+ let contentDOM;
32338
+ let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
32339
+ let attrs = structure[1], start2 = 1;
32340
+ if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
32341
+ start2 = 2;
32342
+ for (let name in attrs)
32343
+ if (attrs[name] != null) {
32344
+ let space2 = name.indexOf(" ");
32345
+ if (space2 > 0)
32346
+ dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
32347
+ else
32348
+ dom.setAttribute(name, attrs[name]);
32349
+ }
32350
+ }
32351
+ for (let i2 = start2; i2 < structure.length; i2++) {
32352
+ let child = structure[i2];
32353
+ if (child === 0) {
32354
+ if (i2 < structure.length - 1 || i2 > start2)
32355
+ throw new RangeError("Content hole must be the only child of its parent node");
32356
+ return { dom, contentDOM: dom };
32357
+ } else {
32358
+ let { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(doc2, child, xmlNS);
32359
+ dom.appendChild(inner);
32360
+ if (innerContent) {
32361
+ if (contentDOM)
32362
+ throw new RangeError("Multiple content holes");
32363
+ contentDOM = innerContent;
32364
+ }
32365
+ }
32366
+ }
32367
+ return { dom, contentDOM };
32389
32368
  }
32390
32369
  /**
32391
32370
  Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
@@ -32423,84 +32402,6 @@ function gatherToDOM(obj) {
32423
32402
  function doc$1(options) {
32424
32403
  return options.document || window.document;
32425
32404
  }
32426
- const suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
32427
- function suspiciousAttributes(attrs) {
32428
- let value = suspiciousAttributeCache.get(attrs);
32429
- if (value === void 0)
32430
- suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
32431
- return value;
32432
- }
32433
- function suspiciousAttributesInner(attrs) {
32434
- let result2 = null;
32435
- function scan(value) {
32436
- if (value && typeof value == "object") {
32437
- if (Array.isArray(value)) {
32438
- if (typeof value[0] == "string") {
32439
- if (!result2)
32440
- result2 = [];
32441
- result2.push(value);
32442
- } else {
32443
- for (let i2 = 0; i2 < value.length; i2++)
32444
- scan(value[i2]);
32445
- }
32446
- } else {
32447
- for (let prop3 in value)
32448
- scan(value[prop3]);
32449
- }
32450
- }
32451
- }
32452
- scan(attrs);
32453
- return result2;
32454
- }
32455
- function renderSpec(doc2, structure, xmlNS, blockArraysIn) {
32456
- if (typeof structure == "string")
32457
- return { dom: doc2.createTextNode(structure) };
32458
- if (structure.nodeType != null)
32459
- return { dom: structure };
32460
- if (structure.dom && structure.dom.nodeType != null)
32461
- return structure;
32462
- let tagName = structure[0], suspicious;
32463
- if (typeof tagName != "string")
32464
- throw new RangeError("Invalid array passed to renderSpec");
32465
- if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1)
32466
- throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
32467
- let space = tagName.indexOf(" ");
32468
- if (space > 0) {
32469
- xmlNS = tagName.slice(0, space);
32470
- tagName = tagName.slice(space + 1);
32471
- }
32472
- let contentDOM;
32473
- let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
32474
- let attrs = structure[1], start2 = 1;
32475
- if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
32476
- start2 = 2;
32477
- for (let name in attrs)
32478
- if (attrs[name] != null) {
32479
- let space2 = name.indexOf(" ");
32480
- if (space2 > 0)
32481
- dom.setAttributeNS(name.slice(0, space2), name.slice(space2 + 1), attrs[name]);
32482
- else
32483
- dom.setAttribute(name, attrs[name]);
32484
- }
32485
- }
32486
- for (let i2 = start2; i2 < structure.length; i2++) {
32487
- let child = structure[i2];
32488
- if (child === 0) {
32489
- if (i2 < structure.length - 1 || i2 > start2)
32490
- throw new RangeError("Content hole must be the only child of its parent node");
32491
- return { dom, contentDOM: dom };
32492
- } else {
32493
- let { dom: inner, contentDOM: innerContent } = renderSpec(doc2, child, xmlNS, blockArraysIn);
32494
- dom.appendChild(inner);
32495
- if (innerContent) {
32496
- if (contentDOM)
32497
- throw new RangeError("Multiple content holes");
32498
- contentDOM = innerContent;
32499
- }
32500
- }
32501
- }
32502
- return { dom, contentDOM };
32503
- }
32504
32405
  const lower16 = 65535;
32505
32406
  const factor16 = Math.pow(2, 16);
32506
32407
  function makeRecover(index2, offset2) {
@@ -33160,8 +33061,7 @@ class ReplaceAroundStep extends Step$1 {
33160
33061
  }
33161
33062
  map(mapping) {
33162
33063
  let from2 = mapping.mapResult(this.from, 1), to2 = mapping.mapResult(this.to, -1);
33163
- let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
33164
- let gapTo = this.to == this.gapTo ? to2.pos : mapping.map(this.gapTo, 1);
33064
+ let gapFrom = mapping.map(this.gapFrom, -1), gapTo = mapping.map(this.gapTo, 1);
33165
33065
  if (from2.deletedAcross && to2.deletedAcross || gapFrom < from2.pos || gapTo > to2.pos)
33166
33066
  return null;
33167
33067
  return new ReplaceAroundStep(from2.pos, to2.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
@@ -33274,7 +33174,7 @@ function removeMark(tr2, from2, to2, mark) {
33274
33174
  });
33275
33175
  matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
33276
33176
  }
33277
- function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) {
33177
+ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch) {
33278
33178
  let node = tr2.doc.nodeAt(pos);
33279
33179
  let replSteps = [], cur = pos + 1;
33280
33180
  for (let i2 = 0; i2 < node.childCount; i2++) {
@@ -33287,7 +33187,7 @@ function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatc
33287
33187
  for (let j2 = 0; j2 < child.marks.length; j2++)
33288
33188
  if (!parentType.allowsMarkType(child.marks[j2].type))
33289
33189
  tr2.step(new RemoveMarkStep(cur, end2, child.marks[j2]));
33290
- if (clearNewlines && child.isText && parentType.whitespace != "pre") {
33190
+ if (child.isText && !parentType.spec.code) {
33291
33191
  let m2, newline = /\r?\n|\r/g, slice4;
33292
33192
  while (m2 = newline.exec(child.text)) {
33293
33193
  if (!slice4)
@@ -33396,45 +33296,14 @@ function setBlockType$1(tr2, from2, to2, type3, attrs) {
33396
33296
  let mapFrom = tr2.steps.length;
33397
33297
  tr2.doc.nodesBetween(from2, to2, (node, pos) => {
33398
33298
  if (node.isTextblock && !node.hasMarkup(type3, attrs) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type3)) {
33399
- let convertNewlines = null;
33400
- if (type3.schema.linebreakReplacement) {
33401
- let pre = type3.whitespace == "pre", supportLinebreak = !!type3.contentMatch.matchType(type3.schema.linebreakReplacement);
33402
- if (pre && !supportLinebreak)
33403
- convertNewlines = false;
33404
- else if (!pre && supportLinebreak)
33405
- convertNewlines = true;
33406
- }
33407
- if (convertNewlines === false)
33408
- replaceLinebreaks(tr2, node, pos, mapFrom);
33409
- clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type3, void 0, convertNewlines === null);
33299
+ tr2.clearIncompatible(tr2.mapping.slice(mapFrom).map(pos, 1), type3);
33410
33300
  let mapping = tr2.mapping.slice(mapFrom);
33411
33301
  let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
33412
33302
  tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type3.create(attrs, null, node.marks)), 0, 0), 1, true));
33413
- if (convertNewlines === true)
33414
- replaceNewlines(tr2, node, pos, mapFrom);
33415
33303
  return false;
33416
33304
  }
33417
33305
  });
33418
33306
  }
33419
- function replaceNewlines(tr2, node, pos, mapFrom) {
33420
- node.forEach((child, offset2) => {
33421
- if (child.isText) {
33422
- let m2, newline = /\r?\n|\r/g;
33423
- while (m2 = newline.exec(child.text)) {
33424
- let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2 + m2.index);
33425
- tr2.replaceWith(start2, start2 + 1, node.type.schema.linebreakReplacement.create());
33426
- }
33427
- }
33428
- });
33429
- }
33430
- function replaceLinebreaks(tr2, node, pos, mapFrom) {
33431
- node.forEach((child, offset2) => {
33432
- if (child.type == child.type.schema.linebreakReplacement) {
33433
- let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset2);
33434
- tr2.replaceWith(start2, start2 + 1, node.type.schema.text("\n"));
33435
- }
33436
- });
33437
- }
33438
33307
  function canChangeType(doc2, pos, type3) {
33439
33308
  let $pos = doc2.resolve(pos), index2 = $pos.index();
33440
33309
  return $pos.parent.canReplaceWith(index2, index2 + 1, type3);
@@ -35200,9 +35069,6 @@ const textRange = function(node, from2, to2) {
35200
35069
  range2.setStart(node, from2 || 0);
35201
35070
  return range2;
35202
35071
  };
35203
- const clearReusedRange = function() {
35204
- reusedRange = null;
35205
- };
35206
35072
  const isEquivalentPosition = function(node, off2, targetNode, targetOff) {
35207
35073
  return targetNode && (scanFor(node, off2, targetNode, targetOff, -1) || scanFor(node, off2, targetNode, targetOff, 1));
35208
35074
  };
@@ -35230,40 +35096,6 @@ function scanFor(node, off2, targetNode, targetOff, dir) {
35230
35096
  function nodeSize(node) {
35231
35097
  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
35232
35098
  }
35233
- function textNodeBefore$1(node, offset2) {
35234
- for (; ; ) {
35235
- if (node.nodeType == 3 && offset2)
35236
- return node;
35237
- if (node.nodeType == 1 && offset2 > 0) {
35238
- if (node.contentEditable == "false")
35239
- return null;
35240
- node = node.childNodes[offset2 - 1];
35241
- offset2 = nodeSize(node);
35242
- } else if (node.parentNode && !hasBlockDesc(node)) {
35243
- offset2 = domIndex(node);
35244
- node = node.parentNode;
35245
- } else {
35246
- return null;
35247
- }
35248
- }
35249
- }
35250
- function textNodeAfter$1(node, offset2) {
35251
- for (; ; ) {
35252
- if (node.nodeType == 3 && offset2 < node.nodeValue.length)
35253
- return node;
35254
- if (node.nodeType == 1 && offset2 < node.childNodes.length) {
35255
- if (node.contentEditable == "false")
35256
- return null;
35257
- node = node.childNodes[offset2];
35258
- offset2 = 0;
35259
- } else if (node.parentNode && !hasBlockDesc(node)) {
35260
- offset2 = domIndex(node) + 1;
35261
- node = node.parentNode;
35262
- } else {
35263
- return null;
35264
- }
35265
- }
35266
- }
35267
35099
  function isOnEdge(node, offset2, parent) {
35268
35100
  for (let atStart = offset2 == 0, atEnd = offset2 == nodeSize(node); atStart || atEnd; ) {
35269
35101
  if (node == parent)
@@ -35335,14 +35167,6 @@ const android = /Android \d/.test(agent);
35335
35167
  const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
35336
35168
  const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
35337
35169
  function windowRect(doc2) {
35338
- let vp = doc2.defaultView && doc2.defaultView.visualViewport;
35339
- if (vp)
35340
- return {
35341
- left: 0,
35342
- right: vp.width,
35343
- top: 0,
35344
- bottom: vp.height
35345
- };
35346
35170
  return {
35347
35171
  left: 0,
35348
35172
  right: doc2.documentElement.clientWidth,
@@ -35544,14 +35368,14 @@ function posFromCaret(view, node, offset2, coords) {
35544
35368
  let desc = view.docView.nearestDesc(cur, true);
35545
35369
  if (!desc)
35546
35370
  return null;
35547
- if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {
35371
+ if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent && !sawBlock || !desc.contentDOM)) {
35548
35372
  let rect = desc.dom.getBoundingClientRect();
35549
- if (desc.node.isBlock && desc.parent) {
35550
- if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
35373
+ if (desc.node.isBlock && desc.parent && !sawBlock) {
35374
+ sawBlock = true;
35375
+ if (rect.left > coords.left || rect.top > coords.top)
35551
35376
  outsideBlock = desc.posBefore;
35552
- else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
35377
+ else if (rect.right < coords.left || rect.bottom < coords.top)
35553
35378
  outsideBlock = desc.posAfter;
35554
- sawBlock = true;
35555
35379
  }
35556
35380
  if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
35557
35381
  let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;
@@ -36166,9 +35990,6 @@ class ViewDesc {
36166
35990
  get ignoreForCoords() {
36167
35991
  return false;
36168
35992
  }
36169
- isText(text) {
36170
- return false;
36171
- }
36172
35993
  }
36173
35994
  class WidgetViewDesc extends ViewDesc {
36174
35995
  constructor(parent, widget, view, pos) {
@@ -36407,7 +36228,8 @@ class NodeViewDesc extends ViewDesc {
36407
36228
  let { from: from2, to: to2 } = view.state.selection;
36408
36229
  if (!(view.state.selection instanceof TextSelection) || from2 < pos || to2 > pos + this.node.content.size)
36409
36230
  return null;
36410
- let textNode = view.input.compositionNode;
36231
+ let sel = view.domSelectionRange();
36232
+ let textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);
36411
36233
  if (!textNode || !this.dom.contains(textNode.parentNode))
36412
36234
  return null;
36413
36235
  if (this.node.inlineContent) {
@@ -36473,11 +36295,10 @@ class NodeViewDesc extends ViewDesc {
36473
36295
  }
36474
36296
  // Remove selected node marking from this node.
36475
36297
  deselectNode() {
36476
- if (this.nodeDOM.nodeType == 1) {
36298
+ if (this.nodeDOM.nodeType == 1)
36477
36299
  this.nodeDOM.classList.remove("ProseMirror-selectednode");
36478
- if (this.contentDOM || !this.node.type.spec.draggable)
36479
- this.dom.removeAttribute("draggable");
36480
- }
36300
+ if (this.contentDOM || !this.node.type.spec.draggable)
36301
+ this.dom.removeAttribute("draggable");
36481
36302
  }
36482
36303
  get domAtom() {
36483
36304
  return this.node.isAtom;
@@ -36543,9 +36364,6 @@ class TextViewDesc extends NodeViewDesc {
36543
36364
  get domAtom() {
36544
36365
  return false;
36545
36366
  }
36546
- isText(text) {
36547
- return this.node.text == text;
36548
- }
36549
36367
  }
36550
36368
  class TrailingHackViewDesc extends ViewDesc {
36551
36369
  parseRule() {
@@ -37061,6 +36879,23 @@ function iosHacks(dom) {
37061
36879
  dom.style.cssText = oldCSS;
37062
36880
  }
37063
36881
  }
36882
+ function nearbyTextNode(node, offset2) {
36883
+ for (; ; ) {
36884
+ if (node.nodeType == 3)
36885
+ return node;
36886
+ if (node.nodeType == 1 && offset2 > 0) {
36887
+ if (node.childNodes.length > offset2 && node.childNodes[offset2].nodeType == 3)
36888
+ return node.childNodes[offset2];
36889
+ node = node.childNodes[offset2 - 1];
36890
+ offset2 = nodeSize(node);
36891
+ } else if (node.nodeType == 1 && offset2 < node.childNodes.length) {
36892
+ node = node.childNodes[offset2];
36893
+ offset2 = 0;
36894
+ } else {
36895
+ return null;
36896
+ }
36897
+ }
36898
+ }
37064
36899
  function findTextInFragment(frag, text, from2, to2) {
37065
36900
  for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to2; ) {
37066
36901
  let child = frag.child(i2++), childStart = pos;
@@ -37635,7 +37470,7 @@ function serializeForClipboard(view, slice4) {
37635
37470
  if (firstChild && firstChild.nodeType == 1)
37636
37471
  firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
37637
37472
  let text = view.someProp("clipboardTextSerializer", (f2) => f2(slice4, view)) || slice4.content.textBetween(0, slice4.content.size, "\n\n");
37638
- return { dom: wrap2, text, slice: slice4 };
37473
+ return { dom: wrap2, text };
37639
37474
  }
37640
37475
  function parseFromClipboard(view, text, html, plainText, $context) {
37641
37476
  let inCode = $context.parent.type.spec.code;
@@ -37855,7 +37690,6 @@ class InputState {
37855
37690
  this.lastTouch = 0;
37856
37691
  this.lastAndroidDelete = 0;
37857
37692
  this.composing = false;
37858
- this.compositionNode = null;
37859
37693
  this.composingTimeout = -1;
37860
37694
  this.compositionNodes = [];
37861
37695
  this.compositionEndedAt = -2e8;
@@ -37983,7 +37817,8 @@ function updateSelection(view, selection, origin2) {
37983
37817
  if (!view.focused)
37984
37818
  view.focus();
37985
37819
  let tr2 = view.state.tr.setSelection(selection);
37986
- tr2.setMeta("pointer", true);
37820
+ if (origin2 == "pointer")
37821
+ tr2.setMeta("pointer", true);
37987
37822
  view.dispatch(tr2);
37988
37823
  }
37989
37824
  function selectClickedLeaf(view, inside) {
@@ -37991,7 +37826,7 @@ function selectClickedLeaf(view, inside) {
37991
37826
  return false;
37992
37827
  let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
37993
37828
  if (node && node.isAtom && NodeSelection.isSelectable(node)) {
37994
- updateSelection(view, new NodeSelection($pos));
37829
+ updateSelection(view, new NodeSelection($pos), "pointer");
37995
37830
  return true;
37996
37831
  }
37997
37832
  return false;
@@ -38014,7 +37849,7 @@ function selectClickedNode(view, inside) {
38014
37849
  }
38015
37850
  }
38016
37851
  if (selectAt != null) {
38017
- updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
37852
+ updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer");
38018
37853
  return true;
38019
37854
  } else {
38020
37855
  return false;
@@ -38035,7 +37870,7 @@ function defaultTripleClick(view, inside, event) {
38035
37870
  let doc2 = view.state.doc;
38036
37871
  if (inside == -1) {
38037
37872
  if (doc2.inlineContent) {
38038
- updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size));
37873
+ updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size), "pointer");
38039
37874
  return true;
38040
37875
  }
38041
37876
  return false;
@@ -38045,9 +37880,9 @@ function defaultTripleClick(view, inside, event) {
38045
37880
  let node = i2 > $pos.depth ? $pos.nodeAfter : $pos.node(i2);
38046
37881
  let nodePos = $pos.before(i2);
38047
37882
  if (node.inlineContent)
38048
- updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size));
37883
+ updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size), "pointer");
38049
37884
  else if (NodeSelection.isSelectable(node))
38050
- updateSelection(view, NodeSelection.create(doc2, nodePos));
37885
+ updateSelection(view, NodeSelection.create(doc2, nodePos), "pointer");
38051
37886
  else
38052
37887
  continue;
38053
37888
  return true;
@@ -38104,7 +37939,7 @@ class MouseDown {
38104
37939
  }
38105
37940
  const target = flushed ? null : event.target;
38106
37941
  const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
38107
- this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;
37942
+ this.target = targetDesc ? targetDesc.dom : null;
38108
37943
  let { selection } = view.state;
38109
37944
  if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos)
38110
37945
  this.mightDrag = {
@@ -38164,7 +37999,7 @@ class MouseDown {
38164
37999
  // thus doesn't get a reaction from ProseMirror. This
38165
38000
  // works around that.
38166
38001
  chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {
38167
- updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)));
38002
+ updateSelection(this.view, Selection$1.near(this.view.state.doc.resolve(pos.pos)), "pointer");
38168
38003
  event.preventDefault();
38169
38004
  } else {
38170
38005
  setSelectionOrigin(this.view, "pointer");
@@ -38236,7 +38071,6 @@ editHandlers.compositionend = (view, event) => {
38236
38071
  view.input.composing = false;
38237
38072
  view.input.compositionEndedAt = event.timeStamp;
38238
38073
  view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
38239
- view.input.compositionNode = null;
38240
38074
  if (view.input.compositionPendingChanges)
38241
38075
  Promise.resolve().then(() => view.domObserver.flush());
38242
38076
  view.input.compositionID++;
@@ -38256,26 +38090,6 @@ function clearComposition(view) {
38256
38090
  while (view.input.compositionNodes.length > 0)
38257
38091
  view.input.compositionNodes.pop().markParentsDirty();
38258
38092
  }
38259
- function findCompositionNode(view) {
38260
- let sel = view.domSelectionRange();
38261
- if (!sel.focusNode)
38262
- return null;
38263
- let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
38264
- let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
38265
- if (textBefore && textAfter && textBefore != textAfter) {
38266
- let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
38267
- if (textBefore == lastChanged || textAfter == lastChanged)
38268
- return lastChanged;
38269
- if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
38270
- return textAfter;
38271
- } else if (view.input.compositionNode == textAfter) {
38272
- let descBefore = textBefore.pmViewDesc;
38273
- if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
38274
- return textAfter;
38275
- }
38276
- }
38277
- return textBefore || textAfter;
38278
- }
38279
38093
  function timestampFromCustomEvent() {
38280
38094
  let event = document.createEvent("Event");
38281
38095
  event.initEvent("event", true, true);
@@ -38410,8 +38224,7 @@ handlers.dragstart = (view, _event) => {
38410
38224
  if (desc && desc.node.type.spec.draggable && desc != view.docView)
38411
38225
  node = NodeSelection.create(view.state.doc, desc.posBefore);
38412
38226
  }
38413
- let draggedSlice = (node || view.state.selection).content();
38414
- let { dom, text, slice: slice4 } = serializeForClipboard(view, draggedSlice);
38227
+ let slice4 = (node || view.state.selection).content(), { dom, text } = serializeForClipboard(view, slice4);
38415
38228
  event.dataTransfer.clearData();
38416
38229
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
38417
38230
  event.dataTransfer.effectAllowed = "copyMove";
@@ -38831,6 +38644,9 @@ class DecorationSet {
38831
38644
  return this;
38832
38645
  return local.length || children2.length ? new DecorationSet(local, children2) : empty$1;
38833
38646
  }
38647
+ /**
38648
+ @internal
38649
+ */
38834
38650
  forChild(offset2, node) {
38835
38651
  if (this == empty$1)
38836
38652
  return this;
@@ -39184,7 +39000,6 @@ class DOMObserver {
39184
39000
  this.currentSelection = new SelectionState();
39185
39001
  this.onCharData = null;
39186
39002
  this.suppressingSelectionUpdates = false;
39187
- this.lastChangedTextNode = null;
39188
39003
  this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
39189
39004
  for (let i2 = 0; i2 < mutations.length; i2++)
39190
39005
  this.queue.push(mutations[i2]);
@@ -39310,21 +39125,14 @@ class DOMObserver {
39310
39125
  }
39311
39126
  }
39312
39127
  }
39313
- if (gecko && added.length) {
39128
+ if (gecko && added.length > 1) {
39314
39129
  let brs = added.filter((n2) => n2.nodeName == "BR");
39315
39130
  if (brs.length == 2) {
39316
- let [a2, b2] = brs;
39131
+ let a2 = brs[0], b2 = brs[1];
39317
39132
  if (a2.parentNode && a2.parentNode.parentNode == b2.parentNode)
39318
39133
  b2.remove();
39319
39134
  else
39320
39135
  a2.remove();
39321
- } else {
39322
- let { focusNode } = this.currentSelection;
39323
- for (let br2 of brs) {
39324
- let parent = br2.parentNode;
39325
- if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
39326
- br2.remove();
39327
- }
39328
39136
  }
39329
39137
  }
39330
39138
  let readSel = null;
@@ -39356,12 +39164,8 @@ class DOMObserver {
39356
39164
  if (!desc || desc.ignoreMutation(mut))
39357
39165
  return null;
39358
39166
  if (mut.type == "childList") {
39359
- for (let i2 = 0; i2 < mut.addedNodes.length; i2++) {
39360
- let node = mut.addedNodes[i2];
39361
- added.push(node);
39362
- if (node.nodeType == 3)
39363
- this.lastChangedTextNode = node;
39364
- }
39167
+ for (let i2 = 0; i2 < mut.addedNodes.length; i2++)
39168
+ added.push(mut.addedNodes[i2]);
39365
39169
  if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))
39366
39170
  return { from: desc.posBefore, to: desc.posAfter };
39367
39171
  let prev = mut.previousSibling, next = mut.nextSibling;
@@ -39382,7 +39186,6 @@ class DOMObserver {
39382
39186
  } else if (mut.type == "attributes") {
39383
39187
  return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
39384
39188
  } else {
39385
- this.lastChangedTextNode = mut.target;
39386
39189
  return {
39387
39190
  from: desc.posAtStart,
39388
39191
  to: desc.posAtEnd,
@@ -39409,20 +39212,7 @@ function checkCSS(view) {
39409
39212
  cssCheckWarned = true;
39410
39213
  }
39411
39214
  }
39412
- function rangeToSelectionRange(view, range2) {
39413
- let anchorNode = range2.startContainer, anchorOffset = range2.startOffset;
39414
- let focusNode = range2.endContainer, focusOffset = range2.endOffset;
39415
- let currentAnchor = view.domAtPos(view.state.selection.anchor);
39416
- if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
39417
- [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
39418
- return { anchorNode, anchorOffset, focusNode, focusOffset };
39419
- }
39420
- function safariShadowSelectionRange(view, selection) {
39421
- if (selection.getComposedRanges) {
39422
- let range2 = selection.getComposedRanges(view.root)[0];
39423
- if (range2)
39424
- return rangeToSelectionRange(view, range2);
39425
- }
39215
+ function safariShadowSelectionRange(view) {
39426
39216
  let found2;
39427
39217
  function read2(event) {
39428
39218
  event.preventDefault();
@@ -39432,15 +39222,12 @@ function safariShadowSelectionRange(view, selection) {
39432
39222
  view.dom.addEventListener("beforeinput", read2, true);
39433
39223
  document.execCommand("indent");
39434
39224
  view.dom.removeEventListener("beforeinput", read2, true);
39435
- return found2 ? rangeToSelectionRange(view, found2) : null;
39436
- }
39437
- function blockParent(view, node) {
39438
- for (let p2 = node.parentNode; p2 && p2 != view.dom; p2 = p2.parentNode) {
39439
- let desc = view.docView.nearestDesc(p2, true);
39440
- if (desc && desc.node.isBlock)
39441
- return p2;
39442
- }
39443
- return null;
39225
+ let anchorNode = found2.startContainer, anchorOffset = found2.startOffset;
39226
+ let focusNode = found2.endContainer, focusOffset = found2.endOffset;
39227
+ let currentAnchor = view.domAtPos(view.state.selection.anchor);
39228
+ if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
39229
+ [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
39230
+ return { anchorNode, anchorOffset, focusNode, focusOffset };
39444
39231
  }
39445
39232
  function parseBetween(view, from_, to_) {
39446
39233
  let { node: parent, fromOffset, toOffset, from: from2, to: to2 } = view.docView.parseRange(from_, to_);
@@ -39560,6 +39347,10 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
39560
39347
  return;
39561
39348
  }
39562
39349
  }
39350
+ if (chrome && view.cursorWrapper && parse2.sel && parse2.sel.anchor == view.cursorWrapper.deco.from && parse2.sel.head == parse2.sel.anchor) {
39351
+ let size2 = change.endB - change.start;
39352
+ parse2.sel = { anchor: parse2.sel.anchor + size2, head: parse2.sel.anchor + size2 };
39353
+ }
39563
39354
  view.input.domChangeCount++;
39564
39355
  if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
39565
39356
  if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
@@ -39583,7 +39374,7 @@ function readDOMChange(view, from2, to2, typeOver, addedNodes) {
39583
39374
  view.input.lastIOSEnter = 0;
39584
39375
  return;
39585
39376
  }
39586
- if (view.state.selection.anchor > change.start && looksLikeBackspace(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
39377
+ if (view.state.selection.anchor > change.start && looksLikeJoin(doc2, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f2) => f2(view, keyEvent(8, "Backspace")))) {
39587
39378
  if (android && chrome)
39588
39379
  view.domObserver.suppressSelectionUpdates();
39589
39380
  return;
@@ -39667,18 +39458,12 @@ function isMarkChange(cur, prev) {
39667
39458
  if (Fragment.from(updated).eq(cur))
39668
39459
  return { mark, type: type3 };
39669
39460
  }
39670
- function looksLikeBackspace(old, start2, end2, $newStart, $newEnd) {
39671
- if (
39672
- // The content must have shrunk
39673
- end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
39674
- skipClosingAndOpening($newStart, true, false) < $newEnd.pos
39675
- )
39461
+ function looksLikeJoin(old, start2, end2, $newStart, $newEnd) {
39462
+ if (!$newStart.parent.isTextblock || // The content must have shrunk
39463
+ end2 - start2 <= $newEnd.pos - $newStart.pos || // newEnd must point directly at or after the end of the block that newStart points into
39464
+ skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
39676
39465
  return false;
39677
39466
  let $start = old.resolve(start2);
39678
- if (!$newStart.parent.isTextblock) {
39679
- let after = $start.nodeAfter;
39680
- return after != null && end2 == start2 + after.nodeSize;
39681
- }
39682
39467
  if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
39683
39468
  return false;
39684
39469
  let $next = old.resolve(skipClosingAndOpening($start, true, true));
@@ -39867,10 +39652,8 @@ class EditorView {
39867
39652
  let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state2.selection.empty && selectionContextChanged(prev.selection, state2.selection);
39868
39653
  if (updateDoc) {
39869
39654
  let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
39870
- if (this.composing)
39871
- this.input.compositionNode = findCompositionNode(this);
39872
39655
  if (redraw || !this.docView.update(state2.doc, outerDeco, innerDeco, this)) {
39873
- this.docView.updateOuterDeco(outerDeco);
39656
+ this.docView.updateOuterDeco([]);
39874
39657
  this.docView.destroy();
39875
39658
  this.docView = docViewDesc(state2.doc, outerDeco, innerDeco, this.dom, this);
39876
39659
  }
@@ -40129,7 +39912,6 @@ class EditorView {
40129
39912
  }
40130
39913
  this.docView.destroy();
40131
39914
  this.docView = null;
40132
- clearReusedRange();
40133
39915
  }
40134
39916
  /**
40135
39917
  This is true when the view has been
@@ -40165,8 +39947,7 @@ class EditorView {
40165
39947
  @internal
40166
39948
  */
40167
39949
  domSelectionRange() {
40168
- let sel = this.domSelection();
40169
- return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
39950
+ return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom ? safariShadowSelectionRange(this) : this.domSelection();
40170
39951
  }
40171
39952
  /**
40172
39953
  @internal
@@ -41157,8 +40938,7 @@ function getAttributesFromExtensions(extensions) {
41157
40938
  const context = {
41158
40939
  name: extension.name,
41159
40940
  options: extension.options,
41160
- storage: extension.storage,
41161
- extensions: nodeAndMarkExtensions
40941
+ storage: extension.storage
41162
40942
  };
41163
40943
  const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", context);
41164
40944
  if (!addGlobalAttributes) {
@@ -41284,7 +41064,7 @@ function fromString(value) {
41284
41064
  return value;
41285
41065
  }
41286
41066
  function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
41287
- if ("style" in parseRule) {
41067
+ if (parseRule.style) {
41288
41068
  return parseRule;
41289
41069
  }
41290
41070
  return {
@@ -41349,7 +41129,6 @@ function getSchemaByResolvedExtensions(extensions, editor) {
41349
41129
  selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
41350
41130
  draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
41351
41131
  code: callOrReturn(getExtensionField(extension, "code", context)),
41352
- whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
41353
41132
  defining: callOrReturn(getExtensionField(extension, "defining", context)),
41354
41133
  isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
41355
41134
  attrs: Object.fromEntries(extensionAttributes.map((extensionAttribute) => {
@@ -41905,7 +41684,7 @@ class ExtensionManager {
41905
41684
  const plugins2 = [];
41906
41685
  const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
41907
41686
  let defaultBindings = {};
41908
- if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) {
41687
+ if (extension.type === "mark" && extension.config.exitable) {
41909
41688
  defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
41910
41689
  }
41911
41690
  if (addKeyboardShortcuts) {
@@ -42053,10 +41832,14 @@ function mergeDeep(target, source) {
42053
41832
  const output = { ...target };
42054
41833
  if (isPlainObject(target) && isPlainObject(source)) {
42055
41834
  Object.keys(source).forEach((key) => {
42056
- if (isPlainObject(source[key]) && isPlainObject(target[key])) {
42057
- output[key] = mergeDeep(target[key], source[key]);
41835
+ if (isPlainObject(source[key])) {
41836
+ if (!(key in target)) {
41837
+ Object.assign(output, { [key]: source[key] });
41838
+ } else {
41839
+ output[key] = mergeDeep(target[key], source[key]);
41840
+ }
42058
41841
  } else {
42059
- output[key] = source[key];
41842
+ Object.assign(output, { [key]: source[key] });
42060
41843
  }
42061
41844
  });
42062
41845
  }
@@ -42095,14 +41878,13 @@ class Extension {
42095
41878
  return new Extension(config);
42096
41879
  }
42097
41880
  configure(options = {}) {
42098
- const extension = this.extend({
42099
- ...this.config,
42100
- addOptions: () => {
42101
- return mergeDeep(this.options, options);
42102
- }
42103
- });
42104
- extension.name = this.name;
41881
+ const extension = this.extend();
42105
41882
  extension.parent = this.parent;
41883
+ extension.options = mergeDeep(this.options, options);
41884
+ extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
41885
+ name: extension.name,
41886
+ options: extension.options
41887
+ }));
42106
41888
  return extension;
42107
41889
  }
42108
41890
  extend(extendedConfig = {}) {
@@ -42110,7 +41892,7 @@ class Extension {
42110
41892
  extension.parent = this;
42111
41893
  this.child = extension;
42112
41894
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
42113
- if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
41895
+ if (extendedConfig.defaultOptions) {
42114
41896
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
42115
41897
  }
42116
41898
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -42494,47 +42276,13 @@ function createNodeFromContent(content, schema, options) {
42494
42276
  }
42495
42277
  return schema.nodeFromJSON(content);
42496
42278
  } catch (error) {
42497
- if (options.errorOnInvalidContent) {
42498
- throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
42499
- }
42500
42279
  console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
42501
42280
  return createNodeFromContent("", schema, options);
42502
42281
  }
42503
42282
  }
42504
42283
  if (isTextContent) {
42505
- let schemaToUse = schema;
42506
- let hasInvalidContent = false;
42507
- let invalidContent = "";
42508
- if (options.errorOnInvalidContent) {
42509
- schemaToUse = new Schema({
42510
- topNode: schema.spec.topNode,
42511
- marks: schema.spec.marks,
42512
- // Prosemirror's schemas are executed such that: the last to execute, matches last
42513
- // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
42514
- nodes: schema.spec.nodes.append({
42515
- __tiptap__private__unknown__catch__all__node: {
42516
- content: "inline*",
42517
- group: "block",
42518
- parseDOM: [
42519
- {
42520
- tag: "*",
42521
- getAttrs: (e) => {
42522
- hasInvalidContent = true;
42523
- invalidContent = typeof e === "string" ? e : e.outerHTML;
42524
- return null;
42525
- }
42526
- }
42527
- ]
42528
- }
42529
- })
42530
- });
42531
- }
42532
- const parser = DOMParser.fromSchema(schemaToUse);
42533
- const response = options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
42534
- if (options.errorOnInvalidContent && hasInvalidContent) {
42535
- throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${invalidContent}`) });
42536
- }
42537
- return response;
42284
+ const parser = DOMParser.fromSchema(schema);
42285
+ return options.slice ? parser.parseSlice(elementFromString(content), options.parseOptions).content : parser.parse(elementFromString(content), options.parseOptions);
42538
42286
  }
42539
42287
  return createNodeFromContent("", schema, options);
42540
42288
  }
@@ -42557,10 +42305,9 @@ function selectionToInsertionEnd(tr2, startLen, bias) {
42557
42305
  tr2.setSelection(Selection$1.near(tr2.doc.resolve(end2), bias));
42558
42306
  }
42559
42307
  const isFragment = (nodeOrFragment) => {
42560
- return !("type" in nodeOrFragment);
42308
+ return nodeOrFragment.toString().startsWith("<");
42561
42309
  };
42562
42310
  const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, editor }) => {
42563
- var _a2;
42564
42311
  if (dispatch) {
42565
42312
  options = {
42566
42313
  parseOptions: {},
@@ -42569,17 +42316,14 @@ const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, edit
42569
42316
  applyPasteRules: false,
42570
42317
  ...options
42571
42318
  };
42572
- let content;
42573
- try {
42574
- content = createNodeFromContent(value, editor.schema, {
42575
- parseOptions: {
42576
- preserveWhitespace: "full",
42577
- ...options.parseOptions
42578
- },
42579
- errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
42580
- });
42581
- } catch (e) {
42582
- return false;
42319
+ const content = createNodeFromContent(value, editor.schema, {
42320
+ parseOptions: {
42321
+ preserveWhitespace: "full",
42322
+ ...options.parseOptions
42323
+ }
42324
+ });
42325
+ if (content.toString() === "<>") {
42326
+ return true;
42583
42327
  }
42584
42328
  let { from: from2, to: to2 } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
42585
42329
  let isOnlyTextContent = true;
@@ -42636,7 +42380,7 @@ const joinBackward = () => ({ state: state2, dispatch }) => {
42636
42380
  const joinForward = () => ({ state: state2, dispatch }) => {
42637
42381
  return joinForward$1(state2, dispatch);
42638
42382
  };
42639
- const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
42383
+ const joinItemBackward = () => ({ tr: tr2, state: state2, dispatch }) => {
42640
42384
  try {
42641
42385
  const point2 = joinPoint(state2.doc, state2.selection.$from.pos, -1);
42642
42386
  if (point2 === null || point2 === void 0) {
@@ -42647,7 +42391,7 @@ const joinItemBackward = () => ({ state: state2, dispatch, tr: tr2 }) => {
42647
42391
  dispatch(tr2);
42648
42392
  }
42649
42393
  return true;
42650
- } catch (e) {
42394
+ } catch {
42651
42395
  return false;
42652
42396
  }
42653
42397
  };
@@ -42865,32 +42609,16 @@ const selectTextblockEnd = () => ({ state: state2, dispatch }) => {
42865
42609
  const selectTextblockStart = () => ({ state: state2, dispatch }) => {
42866
42610
  return selectTextblockStart$1(state2, dispatch);
42867
42611
  };
42868
- function createDocument(content, schema, parseOptions = {}, options = {}) {
42869
- return createNodeFromContent(content, schema, {
42870
- slice: false,
42871
- parseOptions,
42872
- errorOnInvalidContent: options.errorOnInvalidContent
42873
- });
42612
+ function createDocument(content, schema, parseOptions = {}) {
42613
+ return createNodeFromContent(content, schema, { slice: false, parseOptions });
42874
42614
  }
42875
- const setContent$1 = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({ editor, tr: tr2, dispatch, commands: commands2 }) => {
42876
- var _a2, _b;
42615
+ const setContent$1 = (content, emitUpdate = false, parseOptions = {}) => ({ tr: tr2, editor, dispatch }) => {
42877
42616
  const { doc: doc2 } = tr2;
42878
- if (parseOptions.preserveWhitespace !== "full") {
42879
- const document2 = createDocument(content, editor.schema, parseOptions, {
42880
- errorOnInvalidContent: (_a2 = options.errorOnInvalidContent) !== null && _a2 !== void 0 ? _a2 : editor.options.enableContentCheck
42881
- });
42882
- if (dispatch) {
42883
- tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
42884
- }
42885
- return true;
42886
- }
42617
+ const document2 = createDocument(content, editor.schema, parseOptions);
42887
42618
  if (dispatch) {
42888
- tr2.setMeta("preventUpdate", !emitUpdate);
42619
+ tr2.replaceWith(0, doc2.content.size, document2).setMeta("preventUpdate", !emitUpdate);
42889
42620
  }
42890
- return commands2.insertContentAt({ from: 0, to: doc2.content.size }, content, {
42891
- parseOptions,
42892
- errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck
42893
- });
42621
+ return true;
42894
42622
  };
42895
42623
  function getMarkAttributes(state2, typeOrName) {
42896
42624
  const type3 = getMarkType(typeOrName, state2.schema);
@@ -43093,11 +42821,10 @@ function isList(name, extensions) {
43093
42821
  return group.split(" ").includes("list");
43094
42822
  }
43095
42823
  function isNodeEmpty(node) {
43096
- const defaultContent = node.type.createAndFill();
43097
- if (!defaultContent) {
43098
- return false;
43099
- }
43100
- return node.eq(defaultContent);
42824
+ var _a2;
42825
+ const defaultContent = (_a2 = node.type.createAndFill()) === null || _a2 === void 0 ? void 0 : _a2.toJSON();
42826
+ const content = node.toJSON();
42827
+ return JSON.stringify(defaultContent) === JSON.stringify(content);
43101
42828
  }
43102
42829
  function isNodeSelection(value) {
43103
42830
  return value instanceof NodeSelection;
@@ -43612,14 +43339,14 @@ var commands = /* @__PURE__ */ Object.freeze({
43612
43339
  forEach,
43613
43340
  insertContent,
43614
43341
  insertContentAt,
43615
- joinBackward,
43342
+ joinUp,
43616
43343
  joinDown,
43344
+ joinBackward,
43617
43345
  joinForward,
43618
43346
  joinItemBackward,
43619
43347
  joinItemForward,
43620
43348
  joinTextblockBackward,
43621
43349
  joinTextblockForward,
43622
- joinUp,
43623
43350
  keyboardShortcut,
43624
43351
  lift,
43625
43352
  liftEmptyBlock,
@@ -43816,16 +43543,13 @@ const Tabindex = Extension.create({
43816
43543
  new Plugin({
43817
43544
  key: new PluginKey("tabindex"),
43818
43545
  props: {
43819
- attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
43546
+ attributes: this.editor.isEditable ? { tabindex: "0" } : {}
43820
43547
  }
43821
43548
  })
43822
43549
  ];
43823
43550
  }
43824
43551
  });
43825
43552
  class NodePos {
43826
- get name() {
43827
- return this.node.type.name;
43828
- }
43829
43553
  constructor(pos, editor, isBlock = false, node = null) {
43830
43554
  this.currentNode = null;
43831
43555
  this.actualDepth = null;
@@ -43834,6 +43558,9 @@ class NodePos {
43834
43558
  this.editor = editor;
43835
43559
  this.currentNode = node;
43836
43560
  }
43561
+ get name() {
43562
+ return this.node.type.name;
43563
+ }
43837
43564
  get node() {
43838
43565
  return this.currentNode || this.resolvedPos.node();
43839
43566
  }
@@ -44065,7 +43792,7 @@ img.ProseMirror-separator {
44065
43792
  opacity: 0
44066
43793
  }`;
44067
43794
  function createStyleTag(style2, nonce, suffix) {
44068
- const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${""}]`);
43795
+ const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
44069
43796
  if (tiptapStyleTag !== null) {
44070
43797
  return tiptapStyleTag;
44071
43798
  }
@@ -44073,7 +43800,7 @@ function createStyleTag(style2, nonce, suffix) {
44073
43800
  if (nonce) {
44074
43801
  styleNode.setAttribute("nonce", nonce);
44075
43802
  }
44076
- styleNode.setAttribute(`data-tiptap-style${""}`, "");
43803
+ styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
44077
43804
  styleNode.innerHTML = style2;
44078
43805
  document.getElementsByTagName("head")[0].appendChild(styleNode);
44079
43806
  return styleNode;
@@ -44097,7 +43824,6 @@ let Editor$1 = class Editor2 extends EventEmitter {
44097
43824
  enableInputRules: true,
44098
43825
  enablePasteRules: true,
44099
43826
  enableCoreExtensions: true,
44100
- enableContentCheck: false,
44101
43827
  onBeforeCreate: () => null,
44102
43828
  onCreate: () => null,
44103
43829
  onUpdate: () => null,
@@ -44105,10 +43831,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
44105
43831
  onTransaction: () => null,
44106
43832
  onFocus: () => null,
44107
43833
  onBlur: () => null,
44108
- onDestroy: () => null,
44109
- onContentError: ({ error }) => {
44110
- throw error;
44111
- }
43834
+ onDestroy: () => null
44112
43835
  };
44113
43836
  this.isCapturingTransaction = false;
44114
43837
  this.capturedTransaction = null;
@@ -44118,7 +43841,6 @@ let Editor$1 = class Editor2 extends EventEmitter {
44118
43841
  this.createSchema();
44119
43842
  this.on("beforeCreate", this.options.onBeforeCreate);
44120
43843
  this.emit("beforeCreate", { editor: this });
44121
- this.on("contentError", this.options.onContentError);
44122
43844
  this.createView();
44123
43845
  this.injectCSS();
44124
43846
  this.on("create", this.options.onCreate);
@@ -44272,23 +43994,7 @@ let Editor$1 = class Editor2 extends EventEmitter {
44272
43994
  * Creates a ProseMirror view.
44273
43995
  */
44274
43996
  createView() {
44275
- let doc2;
44276
- try {
44277
- doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
44278
- } catch (e) {
44279
- if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
44280
- throw e;
44281
- }
44282
- this.emit("contentError", {
44283
- editor: this,
44284
- error: e,
44285
- disableCollaboration: () => {
44286
- this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
44287
- this.createExtensionManager();
44288
- }
44289
- });
44290
- doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
44291
- }
43997
+ const doc2 = createDocument(this.options.content, this.schema, this.options.parseOptions);
44292
43998
  const selection = resolveFocusPosition(doc2, this.options.autofocus);
44293
43999
  this.view = new EditorView(this.options.element, {
44294
44000
  ...this.options.editorProps,
@@ -44526,8 +44232,7 @@ function nodeInputRule(config) {
44526
44232
  tr2.insertText(lastChar, start2 + match2[0].length - 1);
44527
44233
  tr2.replaceWith(matchStart, end2, newNode);
44528
44234
  } else if (match2[0]) {
44529
- const insertionStart = config.type.isInline ? start2 : start2 - 1;
44530
- tr2.insert(insertionStart, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
44235
+ tr2.insert(start2 - 1, config.type.create(attributes)).delete(tr2.mapping.map(start2), tr2.mapping.map(end2));
44531
44236
  }
44532
44237
  tr2.scrollIntoView();
44533
44238
  }
@@ -44612,22 +44317,20 @@ class Mark {
44612
44317
  return new Mark(config);
44613
44318
  }
44614
44319
  configure(options = {}) {
44615
- const extension = this.extend({
44616
- ...this.config,
44617
- addOptions: () => {
44618
- return mergeDeep(this.options, options);
44619
- }
44620
- });
44621
- extension.name = this.name;
44622
- extension.parent = this.parent;
44320
+ const extension = this.extend();
44321
+ extension.options = mergeDeep(this.options, options);
44322
+ extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
44323
+ name: extension.name,
44324
+ options: extension.options
44325
+ }));
44623
44326
  return extension;
44624
44327
  }
44625
44328
  extend(extendedConfig = {}) {
44626
- const extension = new Mark(extendedConfig);
44329
+ const extension = new Mark({ ...this.config, ...extendedConfig });
44627
44330
  extension.parent = this;
44628
44331
  this.child = extension;
44629
44332
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
44630
- if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
44333
+ if (extendedConfig.defaultOptions) {
44631
44334
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
44632
44335
  }
44633
44336
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -44693,22 +44396,20 @@ let Node$2 = class Node3 {
44693
44396
  return new Node3(config);
44694
44397
  }
44695
44398
  configure(options = {}) {
44696
- const extension = this.extend({
44697
- ...this.config,
44698
- addOptions: () => {
44699
- return mergeDeep(this.options, options);
44700
- }
44701
- });
44702
- extension.name = this.name;
44703
- extension.parent = this.parent;
44399
+ const extension = this.extend();
44400
+ extension.options = mergeDeep(this.options, options);
44401
+ extension.storage = callOrReturn(getExtensionField(extension, "addStorage", {
44402
+ name: extension.name,
44403
+ options: extension.options
44404
+ }));
44704
44405
  return extension;
44705
44406
  }
44706
44407
  extend(extendedConfig = {}) {
44707
- const extension = new Node3(extendedConfig);
44408
+ const extension = new Node3({ ...this.config, ...extendedConfig });
44708
44409
  extension.parent = this;
44709
44410
  this.child = extension;
44710
44411
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
44711
- if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {
44412
+ if (extendedConfig.defaultOptions) {
44712
44413
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
44713
44414
  }
44714
44415
  extension.options = callOrReturn(getExtensionField(extension, "addOptions", {
@@ -45243,12 +44944,14 @@ const CodeBlock = Node$2.create({
45243
44944
  if (!text || !language) {
45244
44945
  return false;
45245
44946
  }
45246
- const { tr: tr2, schema } = view.state;
45247
- const textNode = schema.text(text.replace(/\r\n?/g, "\n"));
45248
- tr2.replaceSelectionWith(this.type.create({ language }, textNode));
45249
- if (tr2.selection.$from.parent.type !== this.type) {
45250
- tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
44947
+ const { tr: tr2 } = view.state;
44948
+ if (view.state.selection.from === view.state.doc.nodeSize - (1 + view.state.selection.$to.depth * 2)) {
44949
+ tr2.insert(view.state.selection.from - 1, this.type.create({ language }));
44950
+ } else {
44951
+ tr2.replaceSelectionWith(this.type.create({ language }));
45251
44952
  }
44953
+ tr2.setSelection(TextSelection.near(tr2.doc.resolve(Math.max(0, tr2.selection.from - 2))));
44954
+ tr2.insertText(text.replace(/\r\n?/g, "\n"));
45252
44955
  tr2.setMeta("paste", true);
45253
44956
  view.dispatch(tr2);
45254
44957
  return true;
@@ -46164,13 +45867,13 @@ function applyTransaction(history2, state2, tr2, options) {
46164
45867
  return history2;
46165
45868
  } else if (appended && appended.getMeta(historyKey)) {
46166
45869
  if (appended.getMeta(historyKey).redo)
46167
- return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps), history2.prevTime, history2.prevComposition);
45870
+ return new HistoryState(history2.done.addTransform(tr2, void 0, options, mustPreserveItems(state2)), history2.undone, rangesFor(tr2.mapping.maps[tr2.steps.length - 1]), history2.prevTime, history2.prevComposition);
46168
45871
  else
46169
45872
  return new HistoryState(history2.done, history2.undone.addTransform(tr2, void 0, options, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
46170
45873
  } else if (tr2.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
46171
45874
  let composition = tr2.getMeta("composition");
46172
45875
  let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr2.time || 0) - options.newGroupDelay || !isAdjacentTo(tr2, history2.prevRanges));
46173
- let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps);
45876
+ let prevRanges = appended ? mapRanges(history2.prevRanges, tr2.mapping) : rangesFor(tr2.mapping.maps[tr2.steps.length - 1]);
46174
45877
  return new HistoryState(history2.done.addTransform(tr2, newGroup ? state2.selection.getBookmark() : void 0, options, mustPreserveItems(state2)), Branch.empty, prevRanges, tr2.time, composition == null ? history2.prevComposition : composition);
46175
45878
  } else if (rebased = tr2.getMeta("rebased")) {
46176
45879
  return new HistoryState(history2.done.rebased(tr2, rebased), history2.undone.rebased(tr2, rebased), mapRanges(history2.prevRanges, tr2.mapping), history2.prevTime, history2.prevComposition);
@@ -46191,10 +45894,9 @@ function isAdjacentTo(transform, prevRanges) {
46191
45894
  });
46192
45895
  return adjacent;
46193
45896
  }
46194
- function rangesFor(maps) {
45897
+ function rangesFor(map4) {
46195
45898
  let result2 = [];
46196
- for (let i2 = maps.length - 1; i2 >= 0 && result2.length == 0; i2--)
46197
- maps[i2].forEach((_from, _to, from2, to2) => result2.push(from2, to2));
45899
+ map4.forEach((_from, _to, from2, to2) => result2.push(from2, to2));
46198
45900
  return result2;
46199
45901
  }
46200
45902
  function mapRanges(ranges, mapping) {
@@ -46208,16 +45910,16 @@ function mapRanges(ranges, mapping) {
46208
45910
  }
46209
45911
  return result2;
46210
45912
  }
46211
- function histTransaction(history2, state2, redo2) {
45913
+ function histTransaction(history2, state2, dispatch, redo2) {
46212
45914
  let preserveItems = mustPreserveItems(state2);
46213
45915
  let histOptions = historyKey.get(state2).spec.config;
46214
45916
  let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
46215
45917
  if (!pop)
46216
- return null;
45918
+ return;
46217
45919
  let selection = pop.selection.resolve(pop.transform.doc);
46218
45920
  let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
46219
45921
  let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
46220
- return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
45922
+ dispatch(pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist }).scrollIntoView());
46221
45923
  }
46222
45924
  let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
46223
45925
  function mustPreserveItems(state2) {
@@ -46265,21 +45967,22 @@ function history(config = {}) {
46265
45967
  }
46266
45968
  });
46267
45969
  }
46268
- function buildCommand(redo2, scroll) {
46269
- return (state2, dispatch) => {
46270
- let hist = historyKey.getState(state2);
46271
- if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
46272
- return false;
46273
- if (dispatch) {
46274
- let tr2 = histTransaction(hist, state2, redo2);
46275
- if (tr2)
46276
- dispatch(scroll ? tr2.scrollIntoView() : tr2);
46277
- }
46278
- return true;
46279
- };
46280
- }
46281
- const undo = buildCommand(false, true);
46282
- const redo = buildCommand(true, true);
45970
+ const undo = (state2, dispatch) => {
45971
+ let hist = historyKey.getState(state2);
45972
+ if (!hist || hist.done.eventCount == 0)
45973
+ return false;
45974
+ if (dispatch)
45975
+ histTransaction(hist, state2, dispatch, false);
45976
+ return true;
45977
+ };
45978
+ const redo = (state2, dispatch) => {
45979
+ let hist = historyKey.getState(state2);
45980
+ if (!hist || hist.undone.eventCount == 0)
45981
+ return false;
45982
+ if (dispatch)
45983
+ histTransaction(hist, state2, dispatch, true);
45984
+ return true;
45985
+ };
46283
45986
  const History = Extension.create({
46284
45987
  name: "history",
46285
45988
  addOptions() {
@@ -46331,20 +46034,10 @@ const HorizontalRule = Node$2.create({
46331
46034
  addCommands() {
46332
46035
  return {
46333
46036
  setHorizontalRule: () => ({ chain, state: state2 }) => {
46334
- const { selection } = state2;
46335
- const { $from: $originFrom, $to: $originTo } = selection;
46037
+ const { $to: $originTo } = state2.selection;
46336
46038
  const currentChain = chain();
46337
- if ($originFrom.parentOffset === 0) {
46338
- currentChain.insertContentAt({
46339
- from: Math.max($originFrom.pos - 1, 0),
46340
- to: $originTo.pos
46341
- }, {
46342
- type: this.name
46343
- });
46344
- } else if (isNodeSelection(selection)) {
46345
- currentChain.insertContentAt($originTo.pos, {
46346
- type: this.name
46347
- });
46039
+ if ($originTo.parentOffset === 0) {
46040
+ currentChain.insertContentAt(Math.max($originTo.pos - 2, 0), { type: this.name });
46348
46041
  } else {
46349
46042
  currentChain.insertContent({ type: this.name });
46350
46043
  }
@@ -46730,11 +46423,11 @@ const StarterKit = Extension.create({
46730
46423
  addExtensions() {
46731
46424
  var _a2, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l2, _m, _o, _p, _q, _r2, _s, _t2;
46732
46425
  const extensions = [];
46733
- if (this.options.bold !== false) {
46734
- extensions.push(Bold.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.bold));
46735
- }
46736
46426
  if (this.options.blockquote !== false) {
46737
- extensions.push(Blockquote.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.blockquote));
46427
+ extensions.push(Blockquote.configure((_a2 = this.options) === null || _a2 === void 0 ? void 0 : _a2.blockquote));
46428
+ }
46429
+ if (this.options.bold !== false) {
46430
+ extensions.push(Bold.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.bold));
46738
46431
  }
46739
46432
  if (this.options.bulletList !== false) {
46740
46433
  extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
@@ -49541,7 +49234,7 @@ class BubbleMenuView {
49541
49234
  }
49542
49235
  update(view, oldState) {
49543
49236
  const { state: state2 } = view;
49544
- const hasValidSelection = state2.selection.from !== state2.selection.to;
49237
+ const hasValidSelection = state2.selection.$from.pos !== state2.selection.$to.pos;
49545
49238
  if (this.updateDelay > 0 && hasValidSelection) {
49546
49239
  this.handleDebouncedUpdate(view, oldState);
49547
49240
  return;
@@ -52586,6 +52279,9 @@ function createColGroup(node, cellMinWidth, overrideCol, overrideValue) {
52586
52279
  return { colgroup, tableWidth, tableMinWidth };
52587
52280
  }
52588
52281
  function createCell(cellType, cellContent) {
52282
+ if (cellContent) {
52283
+ return cellType.createChecked(null, cellContent);
52284
+ }
52589
52285
  return cellType.createAndFill();
52590
52286
  }
52591
52287
  function getTableNodeTypes(schema) {
@@ -52607,12 +52303,12 @@ function createTable$1(schema, rowsCount, colsCount, withHeaderRow, cellContent)
52607
52303
  const headerCells = [];
52608
52304
  const cells = [];
52609
52305
  for (let index2 = 0; index2 < colsCount; index2 += 1) {
52610
- const cell = createCell(types.cell);
52306
+ const cell = createCell(types.cell, cellContent);
52611
52307
  if (cell) {
52612
52308
  cells.push(cell);
52613
52309
  }
52614
52310
  if (withHeaderRow) {
52615
- const headerCell = createCell(types.header_cell);
52311
+ const headerCell = createCell(types.header_cell, cellContent);
52616
52312
  if (headerCell) {
52617
52313
  headerCells.push(headerCell);
52618
52314
  }
@@ -52690,7 +52386,7 @@ const Table = Node$2.create({
52690
52386
  insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => ({ tr: tr2, dispatch, editor }) => {
52691
52387
  const node = createTable$1(editor.schema, rows, cols, withHeaderRow);
52692
52388
  if (dispatch) {
52693
- const offset2 = tr2.selection.from + 1;
52389
+ const offset2 = tr2.selection.anchor + 1;
52694
52390
  tr2.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr2.doc.resolve(offset2)));
52695
52391
  }
52696
52392
  return true;
@@ -53167,7 +52863,18 @@ function _typeof$1(obj) {
53167
52863
  return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
53168
52864
  }, _typeof$1(obj);
53169
52865
  }
52866
+ function _defineProperties$2(target, props2) {
52867
+ for (var i2 = 0; i2 < props2.length; i2++) {
52868
+ var descriptor = props2[i2];
52869
+ descriptor.enumerable = descriptor.enumerable || false;
52870
+ descriptor.configurable = true;
52871
+ if ("value" in descriptor) descriptor.writable = true;
52872
+ Object.defineProperty(target, descriptor.key, descriptor);
52873
+ }
52874
+ }
53170
52875
  function _createClass$2(Constructor, protoProps, staticProps) {
52876
+ if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
52877
+ if (staticProps) _defineProperties$2(Constructor, staticProps);
53171
52878
  Object.defineProperty(Constructor, "prototype", { writable: false });
53172
52879
  return Constructor;
53173
52880
  }
@@ -53344,6 +53051,7 @@ function _defineProperties$1(target, props2) {
53344
53051
  }
53345
53052
  function _createClass$1(Constructor, protoProps, staticProps) {
53346
53053
  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
53054
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
53347
53055
  Object.defineProperty(Constructor, "prototype", { writable: false });
53348
53056
  return Constructor;
53349
53057
  }
@@ -53985,10 +53693,10 @@ var DIGITS = {
53985
53693
  function parseDigit(character) {
53986
53694
  return DIGITS[character];
53987
53695
  }
53988
- function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
53696
+ function _createForOfIteratorHelperLoose$4(o2, allowArrayLike) {
53989
53697
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
53990
53698
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
53991
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$4(o2)) || allowArrayLike) {
53699
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$5(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
53992
53700
  if (it2) o2 = it2;
53993
53701
  var i2 = 0;
53994
53702
  return function() {
@@ -53998,15 +53706,15 @@ function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
53998
53706
  }
53999
53707
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54000
53708
  }
54001
- function _unsupportedIterableToArray$4(o2, minLen) {
53709
+ function _unsupportedIterableToArray$5(o2, minLen) {
54002
53710
  if (!o2) return;
54003
- if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen);
53711
+ if (typeof o2 === "string") return _arrayLikeToArray$5(o2, minLen);
54004
53712
  var n2 = Object.prototype.toString.call(o2).slice(8, -1);
54005
53713
  if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
54006
53714
  if (n2 === "Map" || n2 === "Set") return Array.from(o2);
54007
- if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen);
53715
+ if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$5(o2, minLen);
54008
53716
  }
54009
- function _arrayLikeToArray$4(arr, len) {
53717
+ function _arrayLikeToArray$5(arr, len) {
54010
53718
  if (len == null || len > arr.length) len = arr.length;
54011
53719
  for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
54012
53720
  arr2[i2] = arr[i2];
@@ -54015,7 +53723,7 @@ function _arrayLikeToArray$4(arr, len) {
54015
53723
  }
54016
53724
  function parseIncompletePhoneNumber(string2) {
54017
53725
  var result2 = "";
54018
- for (var _iterator = _createForOfIteratorHelperLoose$3(string2.split("")), _step; !(_step = _iterator()).done; ) {
53726
+ for (var _iterator = _createForOfIteratorHelperLoose$4(string2.split("")), _step; !(_step = _iterator()).done; ) {
54019
53727
  var character = _step.value;
54020
53728
  result2 += parsePhoneNumberCharacter(character, result2) || "";
54021
53729
  }
@@ -54024,12 +53732,55 @@ function parseIncompletePhoneNumber(string2) {
54024
53732
  function parsePhoneNumberCharacter(character, prevParsedCharacters, emitEvent) {
54025
53733
  if (character === "+") {
54026
53734
  if (prevParsedCharacters) {
53735
+ if (typeof emitEvent === "function") {
53736
+ emitEvent("end");
53737
+ }
54027
53738
  return;
54028
53739
  }
54029
53740
  return "+";
54030
53741
  }
54031
53742
  return parseDigit(character);
54032
53743
  }
53744
+ function _createForOfIteratorHelperLoose$3(o2, allowArrayLike) {
53745
+ var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
53746
+ if (it2) return (it2 = it2.call(o2)).next.bind(it2);
53747
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$4(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
53748
+ if (it2) o2 = it2;
53749
+ var i2 = 0;
53750
+ return function() {
53751
+ if (i2 >= o2.length) return { done: true };
53752
+ return { done: false, value: o2[i2++] };
53753
+ };
53754
+ }
53755
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
53756
+ }
53757
+ function _unsupportedIterableToArray$4(o2, minLen) {
53758
+ if (!o2) return;
53759
+ if (typeof o2 === "string") return _arrayLikeToArray$4(o2, minLen);
53760
+ var n2 = Object.prototype.toString.call(o2).slice(8, -1);
53761
+ if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name;
53762
+ if (n2 === "Map" || n2 === "Set") return Array.from(o2);
53763
+ if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$4(o2, minLen);
53764
+ }
53765
+ function _arrayLikeToArray$4(arr, len) {
53766
+ if (len == null || len > arr.length) len = arr.length;
53767
+ for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
53768
+ arr2[i2] = arr[i2];
53769
+ }
53770
+ return arr2;
53771
+ }
53772
+ function mergeArrays(a2, b2) {
53773
+ var merged = a2.slice();
53774
+ for (var _iterator = _createForOfIteratorHelperLoose$3(b2), _step; !(_step = _iterator()).done; ) {
53775
+ var element = _step.value;
53776
+ if (a2.indexOf(element) < 0) {
53777
+ merged.push(element);
53778
+ }
53779
+ }
53780
+ return merged.sort(function(a3, b3) {
53781
+ return a3 - b3;
53782
+ });
53783
+ }
54033
53784
  function checkNumberLength(nationalNumber, metadata2) {
54034
53785
  return checkNumberLengthForType(nationalNumber, void 0, metadata2);
54035
53786
  }
@@ -54039,6 +53790,17 @@ function checkNumberLengthForType(nationalNumber, type3, metadata2) {
54039
53790
  if (!possible_lengths) {
54040
53791
  return "IS_POSSIBLE";
54041
53792
  }
53793
+ if (type3 === "FIXED_LINE_OR_MOBILE") {
53794
+ if (!metadata2.type("FIXED_LINE")) {
53795
+ return checkNumberLengthForType(nationalNumber, "MOBILE", metadata2);
53796
+ }
53797
+ var mobile_type = metadata2.type("MOBILE");
53798
+ if (mobile_type) {
53799
+ possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths());
53800
+ }
53801
+ } else if (type3 && !type_info) {
53802
+ return "INVALID_LENGTH";
53803
+ }
54042
53804
  var actual_length = nationalNumber.length;
54043
53805
  var minimum_length = possible_lengths[0];
54044
53806
  if (minimum_length === actual_length) {
@@ -54103,7 +53865,7 @@ function matchesEntirely(text, regular_expression) {
54103
53865
  function _createForOfIteratorHelperLoose$2(o2, allowArrayLike) {
54104
53866
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
54105
53867
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
54106
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$3(o2)) || allowArrayLike) {
53868
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$3(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54107
53869
  if (it2) o2 = it2;
54108
53870
  var i2 = 0;
54109
53871
  return function() {
@@ -54203,6 +53965,8 @@ function applyInternationalSeparatorStyle(formattedNumber) {
54203
53965
  var FIRST_GROUP_PATTERN = /(\$\d)/;
54204
53966
  function formatNationalNumberUsingFormat(number2, format2, _ref) {
54205
53967
  var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix;
53968
+ _ref.carrierCode;
53969
+ _ref.metadata;
54206
53970
  var formattedNumber = number2.replace(new RegExp(format2.pattern()), useInternationalFormat ? format2.internationalFormat() : (
54207
53971
  // This library doesn't use `domestic_carrier_code_formatting_rule`,
54208
53972
  // because that one is only used when formatting phone numbers
@@ -54248,7 +54012,7 @@ function formatRFC3966(_ref) {
54248
54012
  function _createForOfIteratorHelperLoose$1(o2, allowArrayLike) {
54249
54013
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
54250
54014
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
54251
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$2(o2)) || allowArrayLike) {
54015
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$2(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54252
54016
  if (it2) o2 = it2;
54253
54017
  var i2 = 0;
54254
54018
  return function() {
@@ -54444,6 +54208,7 @@ function _defineProperties(target, props2) {
54444
54208
  }
54445
54209
  function _createClass(Constructor, protoProps, staticProps) {
54446
54210
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
54211
+ if (staticProps) _defineProperties(Constructor, staticProps);
54447
54212
  Object.defineProperty(Constructor, "prototype", { writable: false });
54448
54213
  return Constructor;
54449
54214
  }
@@ -54740,7 +54505,7 @@ function extractCountryCallingCode(number2, country, callingCode, metadata2) {
54740
54505
  function _createForOfIteratorHelperLoose(o2, allowArrayLike) {
54741
54506
  var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
54742
54507
  if (it2) return (it2 = it2.call(o2)).next.bind(it2);
54743
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$1(o2)) || allowArrayLike) {
54508
+ if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray$1(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
54744
54509
  if (it2) o2 = it2;
54745
54510
  var i2 = 0;
54746
54511
  return function() {
@@ -54794,8 +54559,14 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
54794
54559
  return matchingCountries[0];
54795
54560
  }
54796
54561
  }
54562
+ var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
54797
54563
  function getCountryByCallingCode(callingCode, _ref) {
54798
54564
  var nationalPhoneNumber = _ref.nationalNumber, defaultCountry = _ref.defaultCountry, metadata2 = _ref.metadata;
54565
+ if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
54566
+ if (metadata2.isNonGeographicCallingCode(callingCode)) {
54567
+ return "001";
54568
+ }
54569
+ }
54799
54570
  var possibleCountries = metadata2.getCountryCodesForCallingCode(callingCode);
54800
54571
  if (!possibleCountries) {
54801
54572
  return;
@@ -57629,7 +57400,7 @@ const bisectCenter = bisector(number$2).center;
57629
57400
  function extent(values3, valueof) {
57630
57401
  let min2;
57631
57402
  let max2;
57632
- {
57403
+ if (valueof === void 0) {
57633
57404
  for (const value of values3) {
57634
57405
  if (value != null) {
57635
57406
  if (min2 === void 0) {
@@ -57640,6 +57411,18 @@ function extent(values3, valueof) {
57640
57411
  }
57641
57412
  }
57642
57413
  }
57414
+ } else {
57415
+ let index2 = -1;
57416
+ for (let value of values3) {
57417
+ if ((value = valueof(value, ++index2, values3)) != null) {
57418
+ if (min2 === void 0) {
57419
+ if (value >= value) min2 = max2 = value;
57420
+ } else {
57421
+ if (min2 > value) min2 = value;
57422
+ if (max2 < value) max2 = value;
57423
+ }
57424
+ }
57425
+ }
57643
57426
  }
57644
57427
  return [min2, max2];
57645
57428
  }