@harbour-enterprises/superdoc 1.0.0-next.9 → 1.0.2
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/chunks/{PdfViewer-C7Wo4VVN.es.js → PdfViewer-C51KNTCu.es.js} +2 -2
- package/dist/chunks/{PdfViewer-QwjK1Tx6.cjs → PdfViewer-Dk7wI3bm.cjs} +2 -2
- package/dist/chunks/{eventemitter3-DQmQUge-.cjs → eventemitter3-DIclNhoR.cjs} +1 -1
- package/dist/chunks/{eventemitter3-44XulWQe.es.js → eventemitter3-D_2kqkfV.es.js} +1 -1
- package/dist/chunks/{index-DI2R4qz8.cjs → index-Cf7hdzkm.cjs} +20 -15
- package/dist/chunks/{index-DNIymDRK-CzsYNHvC.cjs → index-DDZ1ZT8N-DzepXBTN.cjs} +1 -1
- package/dist/chunks/{index-DNIymDRK-BMrUTNeb.es.js → index-DDZ1ZT8N-MJzqg0qg.es.js} +1 -1
- package/dist/chunks/{index-CfSkb15j.es.js → index-rtbawgUA.es.js} +20 -15
- package/dist/chunks/{jszip-VP334ufO.es.js → jszip-B690S4j-.es.js} +1 -1
- package/dist/chunks/{jszip-BdEez1WM.cjs → jszip-qHp7FC78.cjs} +1 -1
- package/dist/chunks/{super-editor.es-BI8ByUNm.cjs → super-editor.es-BijxiFs9.cjs} +1671 -353
- package/dist/chunks/{super-editor.es-B42HV1fg.es.js → super-editor.es-DFXddrgb.es.js} +1671 -353
- package/dist/chunks/{vue-BuPTonTJ.es.js → vue-CLFbn_1r.es.js} +209 -185
- package/dist/chunks/{vue-jWLMl8Ts.cjs → vue-gvuFr0vx.cjs} +209 -185
- package/dist/chunks/xml-js-BXUvL-Mz.es.js +2 -0
- package/dist/chunks/xml-js-CCH4ckfW.cjs +3 -0
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-a3CAItrf.js → converter-VYPiNbpo.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-BsmzO0LG.js → docx-zipper-D8Tzq3RX.js} +1 -1
- package/dist/super-editor/chunks/{editor-qn0f9LDg.js → editor-mgoEnsBi.js} +1635 -288
- package/dist/super-editor/chunks/{index-DNIymDRK.js → index-DDZ1ZT8N.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DW8hTxsF.js → toolbar-DULgxvjl.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +1913 -572
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-Dz51sEbr.cjs +0 -3
- package/dist/chunks/xml-js-LkEmUa9-.es.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const vue = require("./vue-
|
|
2
|
+
const vue = require("./vue-gvuFr0vx.cjs");
|
|
3
3
|
const Y = require("yjs");
|
|
4
4
|
function _interopNamespaceDefault(e) {
|
|
5
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -27,7 +27,7 @@ var __publicField$2 = (obj, key2, value) => __defNormalProp$2(obj, typeof key2 !
|
|
|
27
27
|
var __accessCheck$2 = (obj, member, msg2) => member.has(obj) || __typeError$2("Cannot " + msg2);
|
|
28
28
|
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
29
29
|
var __privateMethod$2 = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method);
|
|
30
|
-
var _a, _b, _DocxExporter_instances, generate_xml_as_list_fn, replaceSpecialCharacters_fn, generateXml_fn, _SuperConverter_instances, generateDocumentHash_fn, exportNumberingFile_fn, prepareCommentsXmlFilesForExport_fn, exportProcessHeadersFooters_fn, exportProcessNewRelationships_fn, exportProcessMediaFiles_fn;
|
|
30
|
+
var _a$1, _b, _DocxExporter_instances, generate_xml_as_list_fn, replaceSpecialCharacters_fn, generateXml_fn, _SuperConverter_instances, generateDocumentHash_fn, exportNumberingFile_fn, prepareCommentsXmlFilesForExport_fn, exportProcessHeadersFooters_fn, exportProcessNewRelationships_fn, exportProcessMediaFiles_fn;
|
|
31
31
|
var buffer = {};
|
|
32
32
|
var base64Js = {};
|
|
33
33
|
base64Js.byteLength = byteLength;
|
|
@@ -639,7 +639,7 @@ ieee754.write = function(buffer2, value, offset2, isLE, mLen, nBytes) {
|
|
|
639
639
|
return slowToString.apply(this, arguments);
|
|
640
640
|
};
|
|
641
641
|
Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
|
|
642
|
-
Buffer3.prototype.equals = function
|
|
642
|
+
Buffer3.prototype.equals = function equals2(b2) {
|
|
643
643
|
if (!Buffer3.isBuffer(b2)) throw new TypeError("Argument must be a Buffer");
|
|
644
644
|
if (this === b2) return true;
|
|
645
645
|
return Buffer3.compare(this, b2) === 0;
|
|
@@ -2988,7 +2988,7 @@ function requireDist() {
|
|
|
2988
2988
|
return slowToString.apply(this, arguments);
|
|
2989
2989
|
};
|
|
2990
2990
|
Buffer4.prototype.toLocaleString = Buffer4.prototype.toString;
|
|
2991
|
-
Buffer4.prototype.equals = function
|
|
2991
|
+
Buffer4.prototype.equals = function equals2(b2) {
|
|
2992
2992
|
if (!Buffer4.isBuffer(b2)) throw new TypeError("Argument must be a Buffer");
|
|
2993
2993
|
if (this === b2) return true;
|
|
2994
2994
|
return Buffer4.compare(this, b2) === 0;
|
|
@@ -4445,8 +4445,8 @@ var hasRequiredObject_getPrototypeOf;
|
|
|
4445
4445
|
function requireObject_getPrototypeOf() {
|
|
4446
4446
|
if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf;
|
|
4447
4447
|
hasRequiredObject_getPrototypeOf = 1;
|
|
4448
|
-
var $
|
|
4449
|
-
Object_getPrototypeOf = $
|
|
4448
|
+
var $Object2 = /* @__PURE__ */ requireEsObjectAtoms();
|
|
4449
|
+
Object_getPrototypeOf = $Object2.getPrototypeOf || null;
|
|
4450
4450
|
return Object_getPrototypeOf;
|
|
4451
4451
|
}
|
|
4452
4452
|
var implementation;
|
|
@@ -4608,12 +4608,12 @@ function requireGet() {
|
|
|
4608
4608
|
/** @type {keyof typeof Object.prototype} */
|
|
4609
4609
|
"__proto__"
|
|
4610
4610
|
);
|
|
4611
|
-
var $
|
|
4612
|
-
var $getPrototypeOf = $
|
|
4611
|
+
var $Object2 = Object;
|
|
4612
|
+
var $getPrototypeOf = $Object2.getPrototypeOf;
|
|
4613
4613
|
get$1 = desc && typeof desc.get === "function" ? callBind2([desc.get]) : typeof $getPrototypeOf === "function" ? (
|
|
4614
4614
|
/** @type {import('./get')} */
|
|
4615
4615
|
(function getDunder(value) {
|
|
4616
|
-
return $getPrototypeOf(value == null ? value : $
|
|
4616
|
+
return $getPrototypeOf(value == null ? value : $Object2(value));
|
|
4617
4617
|
})
|
|
4618
4618
|
) : false;
|
|
4619
4619
|
return get$1;
|
|
@@ -4655,7 +4655,7 @@ function requireGetIntrinsic() {
|
|
|
4655
4655
|
if (hasRequiredGetIntrinsic) return getIntrinsic;
|
|
4656
4656
|
hasRequiredGetIntrinsic = 1;
|
|
4657
4657
|
var undefined$1;
|
|
4658
|
-
var $
|
|
4658
|
+
var $Object2 = /* @__PURE__ */ requireEsObjectAtoms();
|
|
4659
4659
|
var $Error = /* @__PURE__ */ requireEsErrors();
|
|
4660
4660
|
var $EvalError = /* @__PURE__ */ require_eval();
|
|
4661
4661
|
var $RangeError = /* @__PURE__ */ requireRange();
|
|
@@ -4745,7 +4745,7 @@ function requireGetIntrinsic() {
|
|
|
4745
4745
|
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols2 || !getProto2 ? undefined$1 : getProto2((/* @__PURE__ */ new Map())[Symbol.iterator]()),
|
|
4746
4746
|
"%Math%": Math,
|
|
4747
4747
|
"%Number%": Number,
|
|
4748
|
-
"%Object%": $
|
|
4748
|
+
"%Object%": $Object2,
|
|
4749
4749
|
"%Object.getOwnPropertyDescriptor%": $gOPD,
|
|
4750
4750
|
"%parseFloat%": parseFloat,
|
|
4751
4751
|
"%parseInt%": parseInt,
|
|
@@ -4888,8 +4888,8 @@ function requireGetIntrinsic() {
|
|
|
4888
4888
|
throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
|
|
4889
4889
|
}
|
|
4890
4890
|
var result = [];
|
|
4891
|
-
$replace(string, rePropName2, function(
|
|
4892
|
-
result[result.length] = quote ? $replace(subString, reEscapeChar2, "$1") : number ||
|
|
4891
|
+
$replace(string, rePropName2, function(match2, number, quote, subString) {
|
|
4892
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar2, "$1") : number || match2;
|
|
4893
4893
|
});
|
|
4894
4894
|
return result;
|
|
4895
4895
|
};
|
|
@@ -10793,9 +10793,9 @@ function requireXml2js() {
|
|
|
10793
10793
|
var attributes = {};
|
|
10794
10794
|
if (instruction.body && (instruction.name.toLowerCase() === "xml" || options.instructionHasAttributes)) {
|
|
10795
10795
|
var attrsRegExp = /([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;
|
|
10796
|
-
var
|
|
10797
|
-
while ((
|
|
10798
|
-
attributes[
|
|
10796
|
+
var match2;
|
|
10797
|
+
while ((match2 = attrsRegExp.exec(instruction.body)) !== null) {
|
|
10798
|
+
attributes[match2[1]] = match2[2] || match2[3] || match2[4];
|
|
10799
10799
|
}
|
|
10800
10800
|
attributes = manipulateAttributes(attributes);
|
|
10801
10801
|
}
|
|
@@ -11780,8 +11780,8 @@ const DOM_SIZE_UNITS = ["px", "rem", "em", "in", "q", "mm", "cm", "pt", "pc", "v
|
|
|
11780
11780
|
function parseSizeUnit(val = "0") {
|
|
11781
11781
|
const length2 = val.toString() || "0";
|
|
11782
11782
|
const value = Number.parseFloat(length2);
|
|
11783
|
-
const
|
|
11784
|
-
const unit = (
|
|
11783
|
+
const match2 = length2.match(CSS_DIMENSION_REGEX);
|
|
11784
|
+
const unit = (match2?.[1] ?? "").toLowerCase();
|
|
11785
11785
|
return [value, DOM_SIZE_UNITS.includes(unit) ? unit : null];
|
|
11786
11786
|
}
|
|
11787
11787
|
function minMax(value = 0, min2 = 0, max2 = 0) {
|
|
@@ -13234,10 +13234,10 @@ let Node$1$1 = class Node2 {
|
|
|
13234
13234
|
Get the content match in this node at the given index.
|
|
13235
13235
|
*/
|
|
13236
13236
|
contentMatchAt(index2) {
|
|
13237
|
-
let
|
|
13238
|
-
if (!
|
|
13237
|
+
let match2 = this.type.contentMatch.matchFragment(this.content, 0, index2);
|
|
13238
|
+
if (!match2)
|
|
13239
13239
|
throw new Error("Called contentMatchAt on a node with invalid content");
|
|
13240
|
-
return
|
|
13240
|
+
return match2;
|
|
13241
13241
|
}
|
|
13242
13242
|
/**
|
|
13243
13243
|
Test whether replacing the range between `from` and `to` (by
|
|
@@ -13405,9 +13405,9 @@ class ContentMatch {
|
|
|
13405
13405
|
let expr = parseExpr(stream);
|
|
13406
13406
|
if (stream.next)
|
|
13407
13407
|
stream.err("Unexpected trailing text");
|
|
13408
|
-
let
|
|
13409
|
-
checkForDeadEnds(
|
|
13410
|
-
return
|
|
13408
|
+
let match2 = dfa(nfa(expr));
|
|
13409
|
+
checkForDeadEnds(match2, stream);
|
|
13410
|
+
return match2;
|
|
13411
13411
|
}
|
|
13412
13412
|
/**
|
|
13413
13413
|
Match a node type, returning a match after that node if
|
|
@@ -13467,12 +13467,12 @@ class ContentMatch {
|
|
|
13467
13467
|
*/
|
|
13468
13468
|
fillBefore(after, toEnd = false, startIndex = 0) {
|
|
13469
13469
|
let seen = [this];
|
|
13470
|
-
function search2(
|
|
13471
|
-
let finished =
|
|
13470
|
+
function search2(match2, types2) {
|
|
13471
|
+
let finished = match2.matchFragment(after, startIndex);
|
|
13472
13472
|
if (finished && (!toEnd || finished.validEnd))
|
|
13473
13473
|
return Fragment.from(types2.map((tp) => tp.createAndFill()));
|
|
13474
|
-
for (let i = 0; i <
|
|
13475
|
-
let { type: type2, next } =
|
|
13474
|
+
for (let i = 0; i < match2.next.length; i++) {
|
|
13475
|
+
let { type: type2, next } = match2.next[i];
|
|
13476
13476
|
if (!(type2.isText || type2.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
|
|
13477
13477
|
seen.push(next);
|
|
13478
13478
|
let found2 = search2(next, types2.concat(type2));
|
|
@@ -13504,15 +13504,15 @@ class ContentMatch {
|
|
|
13504
13504
|
computeWrapping(target) {
|
|
13505
13505
|
let seen = /* @__PURE__ */ Object.create(null), active = [{ match: this, type: null, via: null }];
|
|
13506
13506
|
while (active.length) {
|
|
13507
|
-
let current = active.shift(),
|
|
13508
|
-
if (
|
|
13507
|
+
let current = active.shift(), match2 = current.match;
|
|
13508
|
+
if (match2.matchType(target)) {
|
|
13509
13509
|
let result = [];
|
|
13510
13510
|
for (let obj = current; obj.type; obj = obj.via)
|
|
13511
13511
|
result.push(obj.type);
|
|
13512
13512
|
return result.reverse();
|
|
13513
13513
|
}
|
|
13514
|
-
for (let i = 0; i <
|
|
13515
|
-
let { type: type2, next } =
|
|
13514
|
+
for (let i = 0; i < match2.next.length; i++) {
|
|
13515
|
+
let { type: type2, next } = match2.next[i];
|
|
13516
13516
|
if (!type2.isLeaf && !type2.hasRequiredAttrs() && !(type2.name in seen) && (!current.type || next.validEnd)) {
|
|
13517
13517
|
active.push({ match: type2.contentMatch, type: type2, via: current });
|
|
13518
13518
|
seen[type2.name] = true;
|
|
@@ -13773,8 +13773,8 @@ function dfa(nfa2) {
|
|
|
13773
13773
|
return state2;
|
|
13774
13774
|
}
|
|
13775
13775
|
}
|
|
13776
|
-
function checkForDeadEnds(
|
|
13777
|
-
for (let i = 0, work = [
|
|
13776
|
+
function checkForDeadEnds(match2, stream) {
|
|
13777
|
+
for (let i = 0, work = [match2]; i < work.length; i++) {
|
|
13778
13778
|
let state2 = work[i], dead = !state2.validEnd, nodes = [];
|
|
13779
13779
|
for (let j2 = 0; j2 < state2.next.length; j2++) {
|
|
13780
13780
|
let { type: type2, next } = state2.next[j2];
|
|
@@ -14119,7 +14119,7 @@ class MarkType {
|
|
|
14119
14119
|
return this.excluded.indexOf(other) > -1;
|
|
14120
14120
|
}
|
|
14121
14121
|
}
|
|
14122
|
-
let Schema$1 = class Schema {
|
|
14122
|
+
let Schema$1$1 = class Schema {
|
|
14123
14123
|
/**
|
|
14124
14124
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
14125
14125
|
*/
|
|
@@ -14400,7 +14400,7 @@ function wsOptionsFor(type2, preserveWhitespace, base2) {
|
|
|
14400
14400
|
return type2 && type2.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & ~OPT_OPEN_LEFT;
|
|
14401
14401
|
}
|
|
14402
14402
|
class NodeContext {
|
|
14403
|
-
constructor(type2, attrs, marks, solid,
|
|
14403
|
+
constructor(type2, attrs, marks, solid, match2, options) {
|
|
14404
14404
|
this.type = type2;
|
|
14405
14405
|
this.attrs = attrs;
|
|
14406
14406
|
this.marks = marks;
|
|
@@ -14408,7 +14408,7 @@ class NodeContext {
|
|
|
14408
14408
|
this.options = options;
|
|
14409
14409
|
this.content = [];
|
|
14410
14410
|
this.activeMarks = Mark$1.none;
|
|
14411
|
-
this.match =
|
|
14411
|
+
this.match = match2 || (options & OPT_OPEN_LEFT ? null : type2.contentMatch);
|
|
14412
14412
|
}
|
|
14413
14413
|
findWrapping(node) {
|
|
14414
14414
|
if (!this.match) {
|
|
@@ -14807,14 +14807,14 @@ class ParseContext {
|
|
|
14807
14807
|
let option = this.options.context;
|
|
14808
14808
|
let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);
|
|
14809
14809
|
let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);
|
|
14810
|
-
let
|
|
14810
|
+
let match2 = (i, depth) => {
|
|
14811
14811
|
for (; i >= 0; i--) {
|
|
14812
14812
|
let part = parts[i];
|
|
14813
14813
|
if (part == "") {
|
|
14814
14814
|
if (i == parts.length - 1 || i == 0)
|
|
14815
14815
|
continue;
|
|
14816
14816
|
for (; depth >= minDepth; depth--)
|
|
14817
|
-
if (
|
|
14817
|
+
if (match2(i - 1, depth))
|
|
14818
14818
|
return true;
|
|
14819
14819
|
return false;
|
|
14820
14820
|
} else {
|
|
@@ -14826,7 +14826,7 @@ class ParseContext {
|
|
|
14826
14826
|
}
|
|
14827
14827
|
return true;
|
|
14828
14828
|
};
|
|
14829
|
-
return
|
|
14829
|
+
return match2(parts.length - 1, this.open);
|
|
14830
14830
|
}
|
|
14831
14831
|
textblockFromContext() {
|
|
14832
14832
|
let $context = this.options.context;
|
|
@@ -14871,10 +14871,10 @@ function markMayApply(markType, nodeType) {
|
|
|
14871
14871
|
let parent = nodes[name];
|
|
14872
14872
|
if (!parent.allowsMarkType(markType))
|
|
14873
14873
|
continue;
|
|
14874
|
-
let seen = [], scan = (
|
|
14875
|
-
seen.push(
|
|
14876
|
-
for (let i = 0; i <
|
|
14877
|
-
let { type: type2, next } =
|
|
14874
|
+
let seen = [], scan = (match2) => {
|
|
14875
|
+
seen.push(match2);
|
|
14876
|
+
for (let i = 0; i < match2.edgeCount; i++) {
|
|
14877
|
+
let { type: type2, next } = match2.edge(i);
|
|
14878
14878
|
if (type2 == nodeType)
|
|
14879
14879
|
return true;
|
|
14880
14880
|
if (seen.indexOf(next) < 0 && scan(next))
|
|
@@ -22947,16 +22947,16 @@ function removeMark(tr, from2, to, mark) {
|
|
|
22947
22947
|
});
|
|
22948
22948
|
matched.forEach((m2) => tr.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
|
|
22949
22949
|
}
|
|
22950
|
-
function clearIncompatible(tr, pos, parentType,
|
|
22950
|
+
function clearIncompatible(tr, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) {
|
|
22951
22951
|
let node = tr.doc.nodeAt(pos);
|
|
22952
22952
|
let replSteps = [], cur = pos + 1;
|
|
22953
22953
|
for (let i = 0; i < node.childCount; i++) {
|
|
22954
22954
|
let child = node.child(i), end2 = cur + child.nodeSize;
|
|
22955
|
-
let allowed =
|
|
22955
|
+
let allowed = match2.matchType(child.type);
|
|
22956
22956
|
if (!allowed) {
|
|
22957
22957
|
replSteps.push(new ReplaceStep(cur, end2, Slice.empty));
|
|
22958
22958
|
} else {
|
|
22959
|
-
|
|
22959
|
+
match2 = allowed;
|
|
22960
22960
|
for (let j2 = 0; j2 < child.marks.length; j2++)
|
|
22961
22961
|
if (!parentType.allowsMarkType(child.marks[j2].type))
|
|
22962
22962
|
tr.step(new RemoveMarkStep(cur, end2, child.marks[j2]));
|
|
@@ -22971,8 +22971,8 @@ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch,
|
|
|
22971
22971
|
}
|
|
22972
22972
|
cur = end2;
|
|
22973
22973
|
}
|
|
22974
|
-
if (!
|
|
22975
|
-
let fill =
|
|
22974
|
+
if (!match2.validEnd) {
|
|
22975
|
+
let fill = match2.fillBefore(Fragment.empty, true);
|
|
22976
22976
|
tr.replace(cur, cur, new Slice(fill, 0, 0));
|
|
22977
22977
|
}
|
|
22978
22978
|
for (let i = replSteps.length - 1; i >= 0; i--)
|
|
@@ -23026,8 +23026,8 @@ function wrap(tr, range2, wrappers) {
|
|
|
23026
23026
|
let content = Fragment.empty;
|
|
23027
23027
|
for (let i = wrappers.length - 1; i >= 0; i--) {
|
|
23028
23028
|
if (content.size) {
|
|
23029
|
-
let
|
|
23030
|
-
if (!
|
|
23029
|
+
let match2 = wrappers[i].type.contentMatch.matchFragment(content);
|
|
23030
|
+
if (!match2 || !match2.validEnd)
|
|
23031
23031
|
throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
|
|
23032
23032
|
}
|
|
23033
23033
|
content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
@@ -23135,18 +23135,18 @@ function canJoin(doc2, pos) {
|
|
|
23135
23135
|
function canAppendWithSubstitutedLinebreaks(a, b2) {
|
|
23136
23136
|
if (!b2.content.size)
|
|
23137
23137
|
a.type.compatibleContent(b2.type);
|
|
23138
|
-
let
|
|
23138
|
+
let match2 = a.contentMatchAt(a.childCount);
|
|
23139
23139
|
let { linebreakReplacement } = a.type.schema;
|
|
23140
23140
|
for (let i = 0; i < b2.childCount; i++) {
|
|
23141
23141
|
let child = b2.child(i);
|
|
23142
23142
|
let type2 = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;
|
|
23143
|
-
|
|
23144
|
-
if (!
|
|
23143
|
+
match2 = match2.matchType(type2);
|
|
23144
|
+
if (!match2)
|
|
23145
23145
|
return false;
|
|
23146
23146
|
if (!a.type.allowsMarks(child.marks))
|
|
23147
23147
|
return false;
|
|
23148
23148
|
}
|
|
23149
|
-
return
|
|
23149
|
+
return match2.validEnd;
|
|
23150
23150
|
}
|
|
23151
23151
|
function joinable(a, b2) {
|
|
23152
23152
|
return !!(a && b2 && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b2));
|
|
@@ -23328,12 +23328,12 @@ class Fitter {
|
|
|
23328
23328
|
}
|
|
23329
23329
|
let first2 = fragment.firstChild;
|
|
23330
23330
|
for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
|
|
23331
|
-
let { type: type2, match } = this.frontier[frontierDepth], wrap2, inject = null;
|
|
23332
|
-
if (pass == 1 && (first2 ?
|
|
23331
|
+
let { type: type2, match: match2 } = this.frontier[frontierDepth], wrap2, inject = null;
|
|
23332
|
+
if (pass == 1 && (first2 ? match2.matchType(first2.type) || (inject = match2.fillBefore(Fragment.from(first2), false)) : parent && type2.compatibleContent(parent.type)))
|
|
23333
23333
|
return { sliceDepth, frontierDepth, parent, inject };
|
|
23334
|
-
else if (pass == 2 && first2 && (wrap2 =
|
|
23334
|
+
else if (pass == 2 && first2 && (wrap2 = match2.findWrapping(first2.type)))
|
|
23335
23335
|
return { sliceDepth, frontierDepth, parent, wrap: wrap2 };
|
|
23336
|
-
if (parent &&
|
|
23336
|
+
if (parent && match2.matchType(parent.type))
|
|
23337
23337
|
break;
|
|
23338
23338
|
}
|
|
23339
23339
|
}
|
|
@@ -23369,20 +23369,20 @@ class Fitter {
|
|
|
23369
23369
|
let slice2 = this.unplaced, fragment = parent ? parent.content : slice2.content;
|
|
23370
23370
|
let openStart = slice2.openStart - sliceDepth;
|
|
23371
23371
|
let taken = 0, add = [];
|
|
23372
|
-
let { match, type: type2 } = this.frontier[frontierDepth];
|
|
23372
|
+
let { match: match2, type: type2 } = this.frontier[frontierDepth];
|
|
23373
23373
|
if (inject) {
|
|
23374
23374
|
for (let i = 0; i < inject.childCount; i++)
|
|
23375
23375
|
add.push(inject.child(i));
|
|
23376
|
-
|
|
23376
|
+
match2 = match2.matchFragment(inject);
|
|
23377
23377
|
}
|
|
23378
23378
|
let openEndCount = fragment.size + sliceDepth - (slice2.content.size - slice2.openEnd);
|
|
23379
23379
|
while (taken < fragment.childCount) {
|
|
23380
|
-
let next = fragment.child(taken), matches2 =
|
|
23380
|
+
let next = fragment.child(taken), matches2 = match2.matchType(next.type);
|
|
23381
23381
|
if (!matches2)
|
|
23382
23382
|
break;
|
|
23383
23383
|
taken++;
|
|
23384
23384
|
if (taken > 1 || openStart == 0 || next.content.size) {
|
|
23385
|
-
|
|
23385
|
+
match2 = matches2;
|
|
23386
23386
|
add.push(closeNodeStart(next.mark(type2.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));
|
|
23387
23387
|
}
|
|
23388
23388
|
}
|
|
@@ -23390,7 +23390,7 @@ class Fitter {
|
|
|
23390
23390
|
if (!toEnd)
|
|
23391
23391
|
openEndCount = -1;
|
|
23392
23392
|
this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));
|
|
23393
|
-
this.frontier[frontierDepth].match =
|
|
23393
|
+
this.frontier[frontierDepth].match = match2;
|
|
23394
23394
|
if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)
|
|
23395
23395
|
this.closeFrontierNode();
|
|
23396
23396
|
for (let i = 0, cur = fragment; i < openEndCount; i++) {
|
|
@@ -23413,14 +23413,14 @@ class Fitter {
|
|
|
23413
23413
|
}
|
|
23414
23414
|
findCloseLevel($to) {
|
|
23415
23415
|
scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {
|
|
23416
|
-
let { match, type: type2 } = this.frontier[i];
|
|
23416
|
+
let { match: match2, type: type2 } = this.frontier[i];
|
|
23417
23417
|
let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
|
|
23418
|
-
let fit = contentAfterFits($to, i, type2,
|
|
23418
|
+
let fit = contentAfterFits($to, i, type2, match2, dropInner);
|
|
23419
23419
|
if (!fit)
|
|
23420
23420
|
continue;
|
|
23421
23421
|
for (let d2 = i - 1; d2 >= 0; d2--) {
|
|
23422
|
-
let { match:
|
|
23423
|
-
let matches2 = contentAfterFits($to, d2, type3,
|
|
23422
|
+
let { match: match22, type: type3 } = this.frontier[d2];
|
|
23423
|
+
let matches2 = contentAfterFits($to, d2, type3, match22, true);
|
|
23424
23424
|
if (!matches2 || matches2.childCount)
|
|
23425
23425
|
continue scan;
|
|
23426
23426
|
}
|
|
@@ -23483,11 +23483,11 @@ function closeNodeStart(node, openStart, openEnd) {
|
|
|
23483
23483
|
}
|
|
23484
23484
|
return node.copy(frag);
|
|
23485
23485
|
}
|
|
23486
|
-
function contentAfterFits($to, depth, type2,
|
|
23486
|
+
function contentAfterFits($to, depth, type2, match2, open) {
|
|
23487
23487
|
let node = $to.node(depth), index2 = open ? $to.indexAfter(depth) : $to.index(depth);
|
|
23488
23488
|
if (index2 == node.childCount && !type2.compatibleContent(node.type))
|
|
23489
23489
|
return null;
|
|
23490
|
-
let fit =
|
|
23490
|
+
let fit = match2.fillBefore(node.content, true, index2);
|
|
23491
23491
|
return fit && !invalidMarks(type2, node.content, index2) ? fit : null;
|
|
23492
23492
|
}
|
|
23493
23493
|
function invalidMarks(type2, fragment, start2) {
|
|
@@ -23569,9 +23569,9 @@ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
|
|
|
23569
23569
|
fragment = fragment.replaceChild(0, first2.copy(closeFragment(first2.content, depth + 1, oldOpen, newOpen, first2)));
|
|
23570
23570
|
}
|
|
23571
23571
|
if (depth > newOpen) {
|
|
23572
|
-
let
|
|
23573
|
-
let start2 =
|
|
23574
|
-
fragment = start2.append(
|
|
23572
|
+
let match2 = parent.contentMatchAt(0);
|
|
23573
|
+
let start2 = match2.fillBefore(fragment).append(fragment);
|
|
23574
|
+
fragment = start2.append(match2.matchFragment(start2).fillBefore(Fragment.empty, true));
|
|
23575
23575
|
}
|
|
23576
23576
|
return fragment;
|
|
23577
23577
|
}
|
|
@@ -23945,8 +23945,8 @@ class Transform {
|
|
|
23945
23945
|
an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as
|
|
23946
23946
|
third argument.
|
|
23947
23947
|
*/
|
|
23948
|
-
clearIncompatible(pos, parentType,
|
|
23949
|
-
clearIncompatible(this, pos, parentType,
|
|
23948
|
+
clearIncompatible(pos, parentType, match2) {
|
|
23949
|
+
clearIncompatible(this, pos, parentType, match2);
|
|
23950
23950
|
return this;
|
|
23951
23951
|
}
|
|
23952
23952
|
}
|
|
@@ -25301,7 +25301,7 @@ let isLoggingEnabled$1 = true;
|
|
|
25301
25301
|
function loggingEnabled$1(enabled) {
|
|
25302
25302
|
isLoggingEnabled$1 = enabled;
|
|
25303
25303
|
}
|
|
25304
|
-
let Helper$1 = (_a = class {
|
|
25304
|
+
let Helper$1 = (_a$1 = class {
|
|
25305
25305
|
static log(message) {
|
|
25306
25306
|
if (isLoggingEnabled$1) {
|
|
25307
25307
|
console.log(message);
|
|
@@ -25324,7 +25324,7 @@ let Helper$1 = (_a = class {
|
|
|
25324
25324
|
}
|
|
25325
25325
|
return ret;
|
|
25326
25326
|
}
|
|
25327
|
-
}, _a.GDI = {
|
|
25327
|
+
}, _a$1.GDI = {
|
|
25328
25328
|
FormatSignature: {
|
|
25329
25329
|
ENHMETA_SIGNATURE: 1179469088,
|
|
25330
25330
|
EPS_SIGNATURE: 1179865157
|
|
@@ -25604,7 +25604,7 @@ let Helper$1 = (_a = class {
|
|
|
25604
25604
|
DC_BRUSH: 2147483666,
|
|
25605
25605
|
DC_PEN: 2147483667
|
|
25606
25606
|
}
|
|
25607
|
-
}, _a._uniqueId = 0, _a);
|
|
25607
|
+
}, _a$1._uniqueId = 0, _a$1);
|
|
25608
25608
|
let Blob$2 = class Blob2 {
|
|
25609
25609
|
constructor(blob, offset2) {
|
|
25610
25610
|
if (blob instanceof Blob2) {
|
|
@@ -31313,9 +31313,9 @@ function getMarkType(nameOrType, schema) {
|
|
|
31313
31313
|
}
|
|
31314
31314
|
return nameOrType;
|
|
31315
31315
|
}
|
|
31316
|
-
function defaultBlockAt$1(
|
|
31317
|
-
for (let i = 0; i <
|
|
31318
|
-
const { type: type2 } =
|
|
31316
|
+
function defaultBlockAt$1(match2) {
|
|
31317
|
+
for (let i = 0; i < match2.edgeCount; i++) {
|
|
31318
|
+
const { type: type2 } = match2.edge(i);
|
|
31319
31319
|
if (type2.isTextblock && !type2.hasRequiredAttrs()) return type2;
|
|
31320
31320
|
}
|
|
31321
31321
|
return null;
|
|
@@ -31992,11 +31992,11 @@ const generateFromCustom = (path, lvlText, customFormat) => {
|
|
|
31992
31992
|
if (customFormat.match(/(?:[0]+\d,\s){3}\.{3}/) == null) {
|
|
31993
31993
|
return generateNumbering(path, lvlText, numberToStringFormatter);
|
|
31994
31994
|
}
|
|
31995
|
-
const
|
|
31996
|
-
if (!
|
|
31995
|
+
const match2 = customFormat.match(/(\d+)/);
|
|
31996
|
+
if (!match2) {
|
|
31997
31997
|
throw new Error("Invalid format string: no numeric pattern found");
|
|
31998
31998
|
}
|
|
31999
|
-
const digitCount =
|
|
31999
|
+
const digitCount = match2[1].length;
|
|
32000
32000
|
return generateNumbering(path, lvlText, (p) => String(p).padStart(digitCount, "0"));
|
|
32001
32001
|
};
|
|
32002
32002
|
const numberToStringFormatter = (value) => String(value);
|
|
@@ -33908,9 +33908,9 @@ const ListHelpers = {
|
|
|
33908
33908
|
};
|
|
33909
33909
|
const extractListLevelStyles = (cssText, listId, level, numId) => {
|
|
33910
33910
|
const pattern = new RegExp(`@list\\s+l${listId}:level${level}(?:\\s+lfo${numId})?\\s*\\{([^}]+)\\}`, "i");
|
|
33911
|
-
const
|
|
33912
|
-
if (!
|
|
33913
|
-
const rawStyles =
|
|
33911
|
+
const match2 = cssText.match(pattern);
|
|
33912
|
+
if (!match2) return null;
|
|
33913
|
+
const rawStyles = match2[1].split(";").map((line) => line.trim()).filter(Boolean);
|
|
33914
33914
|
const styleMap = {};
|
|
33915
33915
|
for (const style2 of rawStyles) {
|
|
33916
33916
|
const [key2, value] = style2.split(":").map((s2) => s2.trim());
|
|
@@ -33920,9 +33920,9 @@ const extractListLevelStyles = (cssText, listId, level, numId) => {
|
|
|
33920
33920
|
};
|
|
33921
33921
|
const extractParagraphStyles = (cssText, selector) => {
|
|
33922
33922
|
const pattern = new RegExp(`(${selector})\\s*\\{([^}]+)\\}`, "i");
|
|
33923
|
-
const
|
|
33924
|
-
if (!
|
|
33925
|
-
const rawStyles =
|
|
33923
|
+
const match2 = cssText.match(pattern);
|
|
33924
|
+
if (!match2) return null;
|
|
33925
|
+
const rawStyles = match2[2].split(";").map((line) => line.trim()).filter(Boolean);
|
|
33926
33926
|
const styleMap = {};
|
|
33927
33927
|
for (const style2 of rawStyles) {
|
|
33928
33928
|
const [key2, value] = style2.split(":").map((s2) => s2.trim());
|
|
@@ -33967,16 +33967,16 @@ const numDefByTypeMap = /* @__PURE__ */ new Map([
|
|
|
33967
33967
|
["i", "lowerRoman"]
|
|
33968
33968
|
]);
|
|
33969
33969
|
function getStartNumber(lvlText) {
|
|
33970
|
-
const
|
|
33971
|
-
if (
|
|
33970
|
+
const match2 = lvlText.match(/^(\d+)/);
|
|
33971
|
+
if (match2) return parseInt(match2[1], 10);
|
|
33972
33972
|
return null;
|
|
33973
33973
|
}
|
|
33974
|
-
function letterToNumber(
|
|
33975
|
-
return
|
|
33974
|
+
function letterToNumber(letter2) {
|
|
33975
|
+
return letter2.toLowerCase().charCodeAt(0) - "a".charCodeAt(0) + 1;
|
|
33976
33976
|
}
|
|
33977
33977
|
function getStartNumberFromAlpha(lvlText) {
|
|
33978
|
-
const
|
|
33979
|
-
if (
|
|
33978
|
+
const match2 = lvlText.match(/^([a-zA-Z])/);
|
|
33979
|
+
if (match2) return letterToNumber(match2[1]);
|
|
33980
33980
|
return null;
|
|
33981
33981
|
}
|
|
33982
33982
|
function romanToNumber(roman) {
|
|
@@ -33991,8 +33991,8 @@ function romanToNumber(roman) {
|
|
|
33991
33991
|
return num;
|
|
33992
33992
|
}
|
|
33993
33993
|
function getStartNumberFromRoman(lvlText) {
|
|
33994
|
-
const
|
|
33995
|
-
if (
|
|
33994
|
+
const match2 = lvlText.match(/^([ivxlcdmIVXLCDM]+)/);
|
|
33995
|
+
if (match2) return romanToNumber(match2[1]);
|
|
33996
33996
|
return null;
|
|
33997
33997
|
}
|
|
33998
33998
|
const startHelperMap = /* @__PURE__ */ new Map([
|
|
@@ -34794,11 +34794,11 @@ class InputRule {
|
|
|
34794
34794
|
this.handler = config2.handler;
|
|
34795
34795
|
}
|
|
34796
34796
|
}
|
|
34797
|
-
const inputRuleMatcherHandler = (text,
|
|
34798
|
-
if (isRegExp$1(
|
|
34799
|
-
return
|
|
34797
|
+
const inputRuleMatcherHandler = (text, match2) => {
|
|
34798
|
+
if (isRegExp$1(match2)) {
|
|
34799
|
+
return match2.exec(text);
|
|
34800
34800
|
}
|
|
34801
|
-
const inputRuleMatch =
|
|
34801
|
+
const inputRuleMatch = match2(text);
|
|
34802
34802
|
if (!inputRuleMatch) {
|
|
34803
34803
|
return null;
|
|
34804
34804
|
}
|
|
@@ -34830,14 +34830,14 @@ const run = (config2) => {
|
|
|
34830
34830
|
if (matched) {
|
|
34831
34831
|
return;
|
|
34832
34832
|
}
|
|
34833
|
-
const
|
|
34834
|
-
if (!
|
|
34833
|
+
const match2 = inputRuleMatcherHandler(textBefore, rule.match);
|
|
34834
|
+
if (!match2) {
|
|
34835
34835
|
return;
|
|
34836
34836
|
}
|
|
34837
34837
|
const tr = view.state.tr;
|
|
34838
34838
|
const state2 = chainableEditorState(tr, view.state);
|
|
34839
34839
|
const range2 = {
|
|
34840
|
-
from: from2 - (
|
|
34840
|
+
from: from2 - (match2[0].length - text.length),
|
|
34841
34841
|
to
|
|
34842
34842
|
};
|
|
34843
34843
|
const { commands: commands2, chain, can } = new CommandService({
|
|
@@ -34847,7 +34847,7 @@ const run = (config2) => {
|
|
|
34847
34847
|
const handler2 = rule.handler({
|
|
34848
34848
|
state: state2,
|
|
34849
34849
|
range: range2,
|
|
34850
|
-
match,
|
|
34850
|
+
match: match2,
|
|
34851
34851
|
commands: commands2,
|
|
34852
34852
|
chain,
|
|
34853
34853
|
can
|
|
@@ -35766,7 +35766,7 @@ ${e}</tr>
|
|
|
35766
35766
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
|
|
35767
35767
|
}
|
|
35768
35768
|
};
|
|
35769
|
-
var
|
|
35769
|
+
var $$1 = class $ {
|
|
35770
35770
|
strong({ text: e }) {
|
|
35771
35771
|
return e;
|
|
35772
35772
|
}
|
|
@@ -35800,7 +35800,7 @@ var b = class l2 {
|
|
|
35800
35800
|
__publicField$2(this, "options");
|
|
35801
35801
|
__publicField$2(this, "renderer");
|
|
35802
35802
|
__publicField$2(this, "textRenderer");
|
|
35803
|
-
this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new
|
|
35803
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $$1();
|
|
35804
35804
|
}
|
|
35805
35805
|
static parse(e, t) {
|
|
35806
35806
|
return new l2(t).parse(e);
|
|
@@ -35973,7 +35973,7 @@ var B = class {
|
|
|
35973
35973
|
__publicField$2(this, "parseInline", this.parseMarkdown(false));
|
|
35974
35974
|
__publicField$2(this, "Parser", b);
|
|
35975
35975
|
__publicField$2(this, "Renderer", P);
|
|
35976
|
-
__publicField$2(this, "TextRenderer",
|
|
35976
|
+
__publicField$2(this, "TextRenderer", $$1);
|
|
35977
35977
|
__publicField$2(this, "Lexer", x);
|
|
35978
35978
|
__publicField$2(this, "Tokenizer", y);
|
|
35979
35979
|
__publicField$2(this, "Hooks", S);
|
|
@@ -36145,7 +36145,7 @@ k$1.parseInline = _.parseInline;
|
|
|
36145
36145
|
k$1.Parser = b;
|
|
36146
36146
|
k$1.parser = b.parse;
|
|
36147
36147
|
k$1.Renderer = P;
|
|
36148
|
-
k$1.TextRenderer =
|
|
36148
|
+
k$1.TextRenderer = $$1;
|
|
36149
36149
|
k$1.Lexer = x;
|
|
36150
36150
|
k$1.lexer = x.lex;
|
|
36151
36151
|
k$1.Tokenizer = y;
|
|
@@ -37159,7 +37159,7 @@ function requireHe() {
|
|
|
37159
37159
|
if (strict && regexInvalidEntity.test(html)) {
|
|
37160
37160
|
parseError("malformed character reference");
|
|
37161
37161
|
}
|
|
37162
|
-
return html.replace(regexDecode, function($0, $1, $
|
|
37162
|
+
return html.replace(regexDecode, function($0, $1, $22, $3, $4, $5, $6, $7, $8) {
|
|
37163
37163
|
var codePoint;
|
|
37164
37164
|
var semicolon;
|
|
37165
37165
|
var decDigits;
|
|
@@ -37170,8 +37170,8 @@ function requireHe() {
|
|
|
37170
37170
|
reference2 = $1;
|
|
37171
37171
|
return decodeMap[reference2];
|
|
37172
37172
|
}
|
|
37173
|
-
if ($
|
|
37174
|
-
reference2 = $
|
|
37173
|
+
if ($22) {
|
|
37174
|
+
reference2 = $22;
|
|
37175
37175
|
next = $3;
|
|
37176
37176
|
if (next && options.isAttributeValue) {
|
|
37177
37177
|
if (strict && next == "=") {
|
|
@@ -40040,7 +40040,7 @@ const DocxHelpers = {
|
|
|
40040
40040
|
insertNewRelationship,
|
|
40041
40041
|
getNewRelationshipId
|
|
40042
40042
|
};
|
|
40043
|
-
const kebabCase$1 = (str) => str.replace(/[A-Z]/g, (
|
|
40043
|
+
const kebabCase$1 = (str) => str.replace(/[A-Z]/g, (match2) => `-${match2.toLowerCase()}`);
|
|
40044
40044
|
const comments_module_events = {
|
|
40045
40045
|
ADD: "add",
|
|
40046
40046
|
UPDATE: "update",
|
|
@@ -40310,9 +40310,9 @@ function preProcessHyperlinkInstruction(nodesToCombine, instruction, docx) {
|
|
|
40310
40310
|
};
|
|
40311
40311
|
const parsedSwitches = {};
|
|
40312
40312
|
for (const [key2, pattern] of Object.entries(availableSwitches)) {
|
|
40313
|
-
const
|
|
40314
|
-
if (
|
|
40315
|
-
parsedSwitches[key2] =
|
|
40313
|
+
const match2 = instruction.match(pattern);
|
|
40314
|
+
if (match2) {
|
|
40315
|
+
parsedSwitches[key2] = match2.groups?.value || true;
|
|
40316
40316
|
}
|
|
40317
40317
|
}
|
|
40318
40318
|
if (parsedSwitches.new_window) {
|
|
@@ -41886,7 +41886,7 @@ const getCommentDefinition = (comment, commentId, allComments, editor) => {
|
|
|
41886
41886
|
const getInitials = (name) => {
|
|
41887
41887
|
if (!name) return null;
|
|
41888
41888
|
const preparedText = name.replace("(imported)", "").trim();
|
|
41889
|
-
const initials = preparedText.split(" ").map((
|
|
41889
|
+
const initials = preparedText.split(" ").map((word2) => word2[0]).join("");
|
|
41890
41890
|
return initials;
|
|
41891
41891
|
};
|
|
41892
41892
|
const toIsoNoFractional = (unixMillis) => {
|
|
@@ -42427,7 +42427,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42427
42427
|
static getStoredSuperdocVersion(docx) {
|
|
42428
42428
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42429
42429
|
}
|
|
42430
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.
|
|
42430
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.2") {
|
|
42431
42431
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42432
42432
|
}
|
|
42433
42433
|
/**
|
|
@@ -45739,7 +45739,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
45739
45739
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
45740
45740
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
45741
45741
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
45742
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
45742
|
+
var _a, _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, wrapHiddenEditorFocus_fn, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
45743
45743
|
var GOOD_LEAF_SIZE = 200;
|
|
45744
45744
|
var RopeSequence = function RopeSequence2() {
|
|
45745
45745
|
};
|
|
@@ -48872,12 +48872,12 @@ function normalizeSiblings(fragment, $context) {
|
|
|
48872
48872
|
return fragment;
|
|
48873
48873
|
for (let d2 = $context.depth; d2 >= 0; d2--) {
|
|
48874
48874
|
let parent = $context.node(d2);
|
|
48875
|
-
let
|
|
48875
|
+
let match2 = parent.contentMatchAt($context.index(d2));
|
|
48876
48876
|
let lastWrap, result = [];
|
|
48877
48877
|
fragment.forEach((node) => {
|
|
48878
48878
|
if (!result)
|
|
48879
48879
|
return;
|
|
48880
|
-
let wrap2 =
|
|
48880
|
+
let wrap2 = match2.findWrapping(node.type), inLast;
|
|
48881
48881
|
if (!wrap2)
|
|
48882
48882
|
return result = null;
|
|
48883
48883
|
if (inLast = result.length && lastWrap.length && addToSibling(wrap2, lastWrap, node, result[result.length - 1], 0)) {
|
|
@@ -48887,7 +48887,7 @@ function normalizeSiblings(fragment, $context) {
|
|
|
48887
48887
|
result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length);
|
|
48888
48888
|
let wrapped = withWrappers(node, wrap2);
|
|
48889
48889
|
result.push(wrapped);
|
|
48890
|
-
|
|
48890
|
+
match2 = match2.matchType(wrapped.type);
|
|
48891
48891
|
lastWrap = wrap2;
|
|
48892
48892
|
}
|
|
48893
48893
|
});
|
|
@@ -48906,8 +48906,8 @@ function addToSibling(wrap2, lastWrap, node, sibling, depth) {
|
|
|
48906
48906
|
let inner = addToSibling(wrap2, lastWrap, node, sibling.lastChild, depth + 1);
|
|
48907
48907
|
if (inner)
|
|
48908
48908
|
return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));
|
|
48909
|
-
let
|
|
48910
|
-
if (
|
|
48909
|
+
let match2 = sibling.contentMatchAt(sibling.childCount);
|
|
48910
|
+
if (match2.matchType(depth == wrap2.length - 1 ? node.type : wrap2[depth + 1]))
|
|
48911
48911
|
return sibling.copy(sibling.content.append(Fragment.from(withWrappers(node, wrap2, depth + 1))));
|
|
48912
48912
|
}
|
|
48913
48913
|
}
|
|
@@ -51464,15 +51464,40 @@ const BIT30 = 1 << 29;
|
|
|
51464
51464
|
const BITS6 = 63;
|
|
51465
51465
|
const BITS7 = 127;
|
|
51466
51466
|
const BITS31 = 2147483647;
|
|
51467
|
+
const MAX_SAFE_INTEGER$2 = Number.MAX_SAFE_INTEGER;
|
|
51468
|
+
const MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER;
|
|
51467
51469
|
const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor(num) === num);
|
|
51468
51470
|
const create$2 = () => /* @__PURE__ */ new Set();
|
|
51471
|
+
const every$1 = (arr, f2) => {
|
|
51472
|
+
for (let i = 0; i < arr.length; i++) {
|
|
51473
|
+
if (!f2(arr[i], i, arr)) {
|
|
51474
|
+
return false;
|
|
51475
|
+
}
|
|
51476
|
+
}
|
|
51477
|
+
return true;
|
|
51478
|
+
};
|
|
51479
|
+
const some = (arr, f2) => {
|
|
51480
|
+
for (let i = 0; i < arr.length; i++) {
|
|
51481
|
+
if (f2(arr[i], i, arr)) {
|
|
51482
|
+
return true;
|
|
51483
|
+
}
|
|
51484
|
+
}
|
|
51485
|
+
return false;
|
|
51486
|
+
};
|
|
51487
|
+
const unfold = (len, f2) => {
|
|
51488
|
+
const array = new Array(len);
|
|
51489
|
+
for (let i = 0; i < len; i++) {
|
|
51490
|
+
array[i] = f2(i, array);
|
|
51491
|
+
}
|
|
51492
|
+
return array;
|
|
51493
|
+
};
|
|
51469
51494
|
const isArray$1 = Array.isArray;
|
|
51470
51495
|
const fromCharCode = String.fromCharCode;
|
|
51471
51496
|
const toLowerCase = (s2) => s2.toLowerCase();
|
|
51472
51497
|
const trimLeftRegex = /^\s*/g;
|
|
51473
51498
|
const trimLeft = (s2) => s2.replace(trimLeftRegex, "");
|
|
51474
51499
|
const fromCamelCaseRegex = /([A-Z])/g;
|
|
51475
|
-
const fromCamelCase = (s2, separator) => trimLeft(s2.replace(fromCamelCaseRegex, (
|
|
51500
|
+
const fromCamelCase = (s2, separator) => trimLeft(s2.replace(fromCamelCaseRegex, (match2) => `${separator}${toLowerCase(match2)}`));
|
|
51476
51501
|
const _encodeUtf8Polyfill = (str) => {
|
|
51477
51502
|
const encodedString = unescape(encodeURIComponent(str));
|
|
51478
51503
|
const len = encodedString.length;
|
|
@@ -51493,6 +51518,7 @@ let utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecode
|
|
|
51493
51518
|
if (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {
|
|
51494
51519
|
utf8TextDecoder = null;
|
|
51495
51520
|
}
|
|
51521
|
+
const repeat$1 = (source, n) => unfold(n, () => source).join("");
|
|
51496
51522
|
class Encoder {
|
|
51497
51523
|
constructor() {
|
|
51498
51524
|
this.cpos = 0;
|
|
@@ -51689,7 +51715,11 @@ const setIfUndefined = (map22, key2, createT) => {
|
|
|
51689
51715
|
}
|
|
51690
51716
|
return set;
|
|
51691
51717
|
};
|
|
51718
|
+
const EqualityTraitSymbol = Symbol("Equality");
|
|
51719
|
+
const equals = (a, b2) => a === b2 || a[EqualityTraitSymbol]?.(b2) || false;
|
|
51720
|
+
const isObject$2 = (o) => typeof o === "object";
|
|
51692
51721
|
const keys$1 = Object.keys;
|
|
51722
|
+
const size$1 = (obj) => keys$1(obj).length;
|
|
51693
51723
|
const every = (obj, f2) => {
|
|
51694
51724
|
for (const key2 in obj) {
|
|
51695
51725
|
if (!f2(obj[key2], key2)) {
|
|
@@ -51698,6 +51728,81 @@ const every = (obj, f2) => {
|
|
|
51698
51728
|
}
|
|
51699
51729
|
return true;
|
|
51700
51730
|
};
|
|
51731
|
+
const hasProperty = (obj, key2) => Object.prototype.hasOwnProperty.call(obj, key2);
|
|
51732
|
+
const equalityDeep = (a, b2) => {
|
|
51733
|
+
if (a === b2) {
|
|
51734
|
+
return true;
|
|
51735
|
+
}
|
|
51736
|
+
if (a == null || b2 == null || a.constructor !== b2.constructor && (a.constructor || Object) !== (b2.constructor || Object)) {
|
|
51737
|
+
return false;
|
|
51738
|
+
}
|
|
51739
|
+
if (a[EqualityTraitSymbol] != null) {
|
|
51740
|
+
return a[EqualityTraitSymbol](b2);
|
|
51741
|
+
}
|
|
51742
|
+
switch (a.constructor) {
|
|
51743
|
+
case ArrayBuffer:
|
|
51744
|
+
a = new Uint8Array(a);
|
|
51745
|
+
b2 = new Uint8Array(b2);
|
|
51746
|
+
// eslint-disable-next-line no-fallthrough
|
|
51747
|
+
case Uint8Array: {
|
|
51748
|
+
if (a.byteLength !== b2.byteLength) {
|
|
51749
|
+
return false;
|
|
51750
|
+
}
|
|
51751
|
+
for (let i = 0; i < a.length; i++) {
|
|
51752
|
+
if (a[i] !== b2[i]) {
|
|
51753
|
+
return false;
|
|
51754
|
+
}
|
|
51755
|
+
}
|
|
51756
|
+
break;
|
|
51757
|
+
}
|
|
51758
|
+
case Set: {
|
|
51759
|
+
if (a.size !== b2.size) {
|
|
51760
|
+
return false;
|
|
51761
|
+
}
|
|
51762
|
+
for (const value of a) {
|
|
51763
|
+
if (!b2.has(value)) {
|
|
51764
|
+
return false;
|
|
51765
|
+
}
|
|
51766
|
+
}
|
|
51767
|
+
break;
|
|
51768
|
+
}
|
|
51769
|
+
case Map: {
|
|
51770
|
+
if (a.size !== b2.size) {
|
|
51771
|
+
return false;
|
|
51772
|
+
}
|
|
51773
|
+
for (const key2 of a.keys()) {
|
|
51774
|
+
if (!b2.has(key2) || !equalityDeep(a.get(key2), b2.get(key2))) {
|
|
51775
|
+
return false;
|
|
51776
|
+
}
|
|
51777
|
+
}
|
|
51778
|
+
break;
|
|
51779
|
+
}
|
|
51780
|
+
case void 0:
|
|
51781
|
+
case Object:
|
|
51782
|
+
if (size$1(a) !== size$1(b2)) {
|
|
51783
|
+
return false;
|
|
51784
|
+
}
|
|
51785
|
+
for (const key2 in a) {
|
|
51786
|
+
if (!hasProperty(a, key2) || !equalityDeep(a[key2], b2[key2])) {
|
|
51787
|
+
return false;
|
|
51788
|
+
}
|
|
51789
|
+
}
|
|
51790
|
+
break;
|
|
51791
|
+
case Array:
|
|
51792
|
+
if (a.length !== b2.length) {
|
|
51793
|
+
return false;
|
|
51794
|
+
}
|
|
51795
|
+
for (let i = 0; i < a.length; i++) {
|
|
51796
|
+
if (!equalityDeep(a[i], b2[i])) {
|
|
51797
|
+
return false;
|
|
51798
|
+
}
|
|
51799
|
+
}
|
|
51800
|
+
break;
|
|
51801
|
+
default:
|
|
51802
|
+
return false;
|
|
51803
|
+
}
|
|
51804
|
+
return true;
|
|
51805
|
+
};
|
|
51701
51806
|
const isOneOf = (value, options) => options.includes(value);
|
|
51702
51807
|
const createMutex = () => {
|
|
51703
51808
|
let token = true;
|
|
@@ -51738,7 +51843,7 @@ const ySyncPluginKey = new PluginKey("y-sync");
|
|
|
51738
51843
|
const yUndoPluginKey = new PluginKey("y-undo");
|
|
51739
51844
|
const yCursorPluginKey = new PluginKey("yjs-cursor");
|
|
51740
51845
|
const rand = Math.random;
|
|
51741
|
-
const oneOf = (arr) => arr[floor(rand() * arr.length)];
|
|
51846
|
+
const oneOf$1 = (arr) => arr[floor(rand() * arr.length)];
|
|
51742
51847
|
const undefinedToNull = (v2) => v2 === void 0 ? null : v2;
|
|
51743
51848
|
class VarStoragePolyfill {
|
|
51744
51849
|
constructor() {
|
|
@@ -51812,15 +51917,771 @@ const computeParams = () => {
|
|
|
51812
51917
|
const hasParam = (name) => computeParams().has(name);
|
|
51813
51918
|
const getVariable = (name) => isNode ? undefinedToNull(process$1$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
|
|
51814
51919
|
const hasConf = (name) => hasParam("--" + name) || getVariable(name) !== null;
|
|
51815
|
-
hasConf("production");
|
|
51920
|
+
const production = hasConf("production");
|
|
51816
51921
|
const forceColor = isNode && isOneOf(process$1$1.env.FORCE_COLOR, ["true", "1", "2"]);
|
|
51817
51922
|
forceColor || !hasParam("--no-colors") && // @todo deprecate --no-colors
|
|
51818
51923
|
!hasConf("no-color") && (!isNode || process$1$1.stdout.isTTY) && (!isNode || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
|
|
51924
|
+
const toBase64Browser = (bytes) => {
|
|
51925
|
+
let s2 = "";
|
|
51926
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
51927
|
+
s2 += fromCharCode(bytes[i]);
|
|
51928
|
+
}
|
|
51929
|
+
return btoa(s2);
|
|
51930
|
+
};
|
|
51931
|
+
const toBase64Node = (bytes) => Buffer2.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64");
|
|
51932
|
+
const toBase64 = isBrowser$1$1 ? toBase64Browser : toBase64Node;
|
|
51933
|
+
const encodeAny = (data) => encode((encoder) => writeAny(encoder, data));
|
|
51934
|
+
const bool = (gen) => gen.next() >= 0.5;
|
|
51935
|
+
const int53 = (gen, min2, max2) => floor(gen.next() * (max2 + 1 - min2) + min2);
|
|
51936
|
+
const int32 = (gen, min2, max2) => floor(gen.next() * (max2 + 1 - min2) + min2);
|
|
51937
|
+
const int31 = (gen, min2, max2) => int32(gen, min2, max2);
|
|
51938
|
+
const letter = (gen) => fromCharCode(int31(gen, 97, 122));
|
|
51939
|
+
const word = (gen, minLen = 0, maxLen = 20) => {
|
|
51940
|
+
const len = int31(gen, minLen, maxLen);
|
|
51941
|
+
let str = "";
|
|
51942
|
+
for (let i = 0; i < len; i++) {
|
|
51943
|
+
str += letter(gen);
|
|
51944
|
+
}
|
|
51945
|
+
return str;
|
|
51946
|
+
};
|
|
51947
|
+
const oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)];
|
|
51948
|
+
const schemaSymbol = Symbol("0schema");
|
|
51949
|
+
class ValidationError {
|
|
51950
|
+
constructor() {
|
|
51951
|
+
this._rerrs = [];
|
|
51952
|
+
}
|
|
51953
|
+
/**
|
|
51954
|
+
* @param {string?} path
|
|
51955
|
+
* @param {string} expected
|
|
51956
|
+
* @param {string} has
|
|
51957
|
+
* @param {string?} message
|
|
51958
|
+
*/
|
|
51959
|
+
extend(path, expected, has, message = null) {
|
|
51960
|
+
this._rerrs.push({ path, expected, has, message });
|
|
51961
|
+
}
|
|
51962
|
+
toString() {
|
|
51963
|
+
const s2 = [];
|
|
51964
|
+
for (let i = this._rerrs.length - 1; i > 0; i--) {
|
|
51965
|
+
const r2 = this._rerrs[i];
|
|
51966
|
+
s2.push(repeat$1(" ", (this._rerrs.length - i) * 2) + `${r2.path != null ? `[${r2.path}] ` : ""}${r2.has} doesn't match ${r2.expected}. ${r2.message}`);
|
|
51967
|
+
}
|
|
51968
|
+
return s2.join("\n");
|
|
51969
|
+
}
|
|
51970
|
+
}
|
|
51971
|
+
const shapeExtends = (a, b2) => {
|
|
51972
|
+
if (a === b2) return true;
|
|
51973
|
+
if (a == null || b2 == null || a.constructor !== b2.constructor) return false;
|
|
51974
|
+
if (a[EqualityTraitSymbol]) return equals(a, b2);
|
|
51975
|
+
if (isArray$1(a)) {
|
|
51976
|
+
return every$1(
|
|
51977
|
+
a,
|
|
51978
|
+
(aitem) => some(b2, (bitem) => shapeExtends(aitem, bitem))
|
|
51979
|
+
);
|
|
51980
|
+
} else if (isObject$2(a)) {
|
|
51981
|
+
return every(
|
|
51982
|
+
a,
|
|
51983
|
+
(aitem, akey) => shapeExtends(aitem, b2[akey])
|
|
51984
|
+
);
|
|
51985
|
+
}
|
|
51986
|
+
return false;
|
|
51987
|
+
};
|
|
51988
|
+
let Schema$1 = (_a = class {
|
|
51989
|
+
/**
|
|
51990
|
+
* @param {Schema<any>} other
|
|
51991
|
+
*/
|
|
51992
|
+
extends(other) {
|
|
51993
|
+
let [a, b2] = [
|
|
51994
|
+
/** @type {any} */
|
|
51995
|
+
this.shape,
|
|
51996
|
+
/** @type {any} */
|
|
51997
|
+
other.shape
|
|
51998
|
+
];
|
|
51999
|
+
if (
|
|
52000
|
+
/** @type {typeof Schema<any>} */
|
|
52001
|
+
this.constructor._dilutes
|
|
52002
|
+
) [b2, a] = [a, b2];
|
|
52003
|
+
return shapeExtends(a, b2);
|
|
52004
|
+
}
|
|
52005
|
+
/**
|
|
52006
|
+
* Overwrite this when necessary. By default, we only check the `shape` property which every shape
|
|
52007
|
+
* should have.
|
|
52008
|
+
* @param {Schema<any>} other
|
|
52009
|
+
*/
|
|
52010
|
+
equals(other) {
|
|
52011
|
+
return this.constructor === other.constructor && equalityDeep(this.shape, other.shape);
|
|
52012
|
+
}
|
|
52013
|
+
[schemaSymbol]() {
|
|
52014
|
+
return true;
|
|
52015
|
+
}
|
|
52016
|
+
/**
|
|
52017
|
+
* @param {object} other
|
|
52018
|
+
*/
|
|
52019
|
+
[EqualityTraitSymbol](other) {
|
|
52020
|
+
return this.equals(
|
|
52021
|
+
/** @type {any} */
|
|
52022
|
+
other
|
|
52023
|
+
);
|
|
52024
|
+
}
|
|
52025
|
+
/**
|
|
52026
|
+
* Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of
|
|
52027
|
+
* Schema. Validate will check the structure of the parameter and return true iff the instance
|
|
52028
|
+
* really is an instance of Schema.
|
|
52029
|
+
*
|
|
52030
|
+
* @param {T} o
|
|
52031
|
+
* @return {boolean}
|
|
52032
|
+
*/
|
|
52033
|
+
validate(o) {
|
|
52034
|
+
return this.check(o);
|
|
52035
|
+
}
|
|
52036
|
+
/* c8 ignore start */
|
|
52037
|
+
/**
|
|
52038
|
+
* Similar to validate, but this method accepts untyped parameters.
|
|
52039
|
+
*
|
|
52040
|
+
* @param {any} _o
|
|
52041
|
+
* @param {ValidationError} [_err]
|
|
52042
|
+
* @return {_o is T}
|
|
52043
|
+
*/
|
|
52044
|
+
check(_o, _err) {
|
|
52045
|
+
methodUnimplemented();
|
|
52046
|
+
}
|
|
52047
|
+
/* c8 ignore stop */
|
|
52048
|
+
/**
|
|
52049
|
+
* @type {Schema<T?>}
|
|
52050
|
+
*/
|
|
52051
|
+
get nullable() {
|
|
52052
|
+
return $union(this, $null);
|
|
52053
|
+
}
|
|
52054
|
+
/**
|
|
52055
|
+
* @type {$Optional<Schema<T>>}
|
|
52056
|
+
*/
|
|
52057
|
+
get optional() {
|
|
52058
|
+
return new $Optional(
|
|
52059
|
+
/** @type {Schema<T>} */
|
|
52060
|
+
this
|
|
52061
|
+
);
|
|
52062
|
+
}
|
|
52063
|
+
/**
|
|
52064
|
+
* Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise.
|
|
52065
|
+
* Use this if you know that the type is of a specific type and you just want to convince the type
|
|
52066
|
+
* system.
|
|
52067
|
+
*
|
|
52068
|
+
* **Do not rely on these error messages!**
|
|
52069
|
+
* Performs an assertion check only if not in a production environment.
|
|
52070
|
+
*
|
|
52071
|
+
* @template OO
|
|
52072
|
+
* @param {OO} o
|
|
52073
|
+
* @return {Extract<OO, T> extends never ? T : (OO extends Array<never> ? T : Extract<OO,T>)}
|
|
52074
|
+
*/
|
|
52075
|
+
cast(o) {
|
|
52076
|
+
assert(o, this);
|
|
52077
|
+
return (
|
|
52078
|
+
/** @type {any} */
|
|
52079
|
+
o
|
|
52080
|
+
);
|
|
52081
|
+
}
|
|
52082
|
+
/**
|
|
52083
|
+
* EXPECTO PATRONUM!! 🪄
|
|
52084
|
+
* This function protects against type errors. Though it may not work in the real world.
|
|
52085
|
+
*
|
|
52086
|
+
* "After all this time?"
|
|
52087
|
+
* "Always." - Snape, talking about type safety
|
|
52088
|
+
*
|
|
52089
|
+
* Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed.
|
|
52090
|
+
* Use this if you know that the type is of a specific type and you just want to convince the type
|
|
52091
|
+
* system.
|
|
52092
|
+
*
|
|
52093
|
+
* Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)`
|
|
52094
|
+
*
|
|
52095
|
+
* **Do not rely on these error messages!**
|
|
52096
|
+
* Performs an assertion check if not in a production environment.
|
|
52097
|
+
*
|
|
52098
|
+
* @param {T} o
|
|
52099
|
+
* @return {o extends T ? T : never}
|
|
52100
|
+
*/
|
|
52101
|
+
expect(o) {
|
|
52102
|
+
assert(o, this);
|
|
52103
|
+
return o;
|
|
52104
|
+
}
|
|
52105
|
+
}, // this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore
|
|
52106
|
+
/**
|
|
52107
|
+
* If true, the more things are added to the shape the more objects this schema will accept (e.g.
|
|
52108
|
+
* union). By default, the more objects are added, the the fewer objects this schema will accept.
|
|
52109
|
+
* @protected
|
|
52110
|
+
*/
|
|
52111
|
+
__publicField$1(_a, "_dilutes", false), _a);
|
|
52112
|
+
class $ConstructedBy extends Schema$1 {
|
|
52113
|
+
/**
|
|
52114
|
+
* @param {C} c
|
|
52115
|
+
* @param {((o:Instance<C>)=>boolean)|null} check
|
|
52116
|
+
*/
|
|
52117
|
+
constructor(c2, check) {
|
|
52118
|
+
super();
|
|
52119
|
+
this.shape = c2;
|
|
52120
|
+
this._c = check;
|
|
52121
|
+
}
|
|
52122
|
+
/**
|
|
52123
|
+
* @param {any} o
|
|
52124
|
+
* @param {ValidationError} [err]
|
|
52125
|
+
* @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType<C> : never)} o
|
|
52126
|
+
*/
|
|
52127
|
+
check(o, err = void 0) {
|
|
52128
|
+
const c2 = o?.constructor === this.shape && (this._c == null || this._c(o));
|
|
52129
|
+
!c2 && err?.extend(null, this.shape.name, o?.constructor.name, o?.constructor !== this.shape ? "Constructor match failed" : "Check failed");
|
|
52130
|
+
return c2;
|
|
52131
|
+
}
|
|
52132
|
+
}
|
|
52133
|
+
const $constructedBy = (c2, check = null) => new $ConstructedBy(c2, check);
|
|
52134
|
+
$constructedBy($ConstructedBy);
|
|
52135
|
+
class $Custom extends Schema$1 {
|
|
52136
|
+
/**
|
|
52137
|
+
* @param {(o:any) => boolean} check
|
|
52138
|
+
*/
|
|
52139
|
+
constructor(check) {
|
|
52140
|
+
super();
|
|
52141
|
+
this.shape = check;
|
|
52142
|
+
}
|
|
52143
|
+
/**
|
|
52144
|
+
* @param {any} o
|
|
52145
|
+
* @param {ValidationError} err
|
|
52146
|
+
* @return {o is any}
|
|
52147
|
+
*/
|
|
52148
|
+
check(o, err) {
|
|
52149
|
+
const c2 = this.shape(o);
|
|
52150
|
+
!c2 && err?.extend(null, "custom prop", o?.constructor.name, "failed to check custom prop");
|
|
52151
|
+
return c2;
|
|
52152
|
+
}
|
|
52153
|
+
}
|
|
52154
|
+
const $custom = (check) => new $Custom(check);
|
|
52155
|
+
$constructedBy($Custom);
|
|
52156
|
+
class $Literal extends Schema$1 {
|
|
52157
|
+
/**
|
|
52158
|
+
* @param {Array<T>} literals
|
|
52159
|
+
*/
|
|
52160
|
+
constructor(literals) {
|
|
52161
|
+
super();
|
|
52162
|
+
this.shape = literals;
|
|
52163
|
+
}
|
|
52164
|
+
/**
|
|
52165
|
+
*
|
|
52166
|
+
* @param {any} o
|
|
52167
|
+
* @param {ValidationError} [err]
|
|
52168
|
+
* @return {o is T}
|
|
52169
|
+
*/
|
|
52170
|
+
check(o, err) {
|
|
52171
|
+
const c2 = this.shape.some((a) => a === o);
|
|
52172
|
+
!c2 && err?.extend(null, this.shape.join(" | "), o.toString());
|
|
52173
|
+
return c2;
|
|
52174
|
+
}
|
|
52175
|
+
}
|
|
52176
|
+
const $literal = (...literals) => new $Literal(literals);
|
|
52177
|
+
const $$literal = $constructedBy($Literal);
|
|
52178
|
+
const _regexEscape = (
|
|
52179
|
+
/** @type {any} */
|
|
52180
|
+
RegExp.escape || /** @type {(str:string) => string} */
|
|
52181
|
+
((str) => str.replace(/[().|&,$^[\]]/g, (s2) => "\\" + s2))
|
|
52182
|
+
);
|
|
52183
|
+
const _schemaStringTemplateToRegex = (s2) => {
|
|
52184
|
+
if ($string.check(s2)) {
|
|
52185
|
+
return [_regexEscape(s2)];
|
|
52186
|
+
}
|
|
52187
|
+
if ($$literal.check(s2)) {
|
|
52188
|
+
return (
|
|
52189
|
+
/** @type {Array<string|number>} */
|
|
52190
|
+
s2.shape.map((v2) => v2 + "")
|
|
52191
|
+
);
|
|
52192
|
+
}
|
|
52193
|
+
if ($$number.check(s2)) {
|
|
52194
|
+
return ["[+-]?\\d+.?\\d*"];
|
|
52195
|
+
}
|
|
52196
|
+
if ($$string.check(s2)) {
|
|
52197
|
+
return [".*"];
|
|
52198
|
+
}
|
|
52199
|
+
if ($$union.check(s2)) {
|
|
52200
|
+
return s2.shape.map(_schemaStringTemplateToRegex).flat(1);
|
|
52201
|
+
}
|
|
52202
|
+
unexpectedCase();
|
|
52203
|
+
};
|
|
52204
|
+
class $StringTemplate extends Schema$1 {
|
|
52205
|
+
/**
|
|
52206
|
+
* @param {T} shape
|
|
52207
|
+
*/
|
|
52208
|
+
constructor(shape) {
|
|
52209
|
+
super();
|
|
52210
|
+
this.shape = shape;
|
|
52211
|
+
this._r = new RegExp("^" + shape.map(_schemaStringTemplateToRegex).map((opts) => `(${opts.join("|")})`).join("") + "$");
|
|
52212
|
+
}
|
|
52213
|
+
/**
|
|
52214
|
+
* @param {any} o
|
|
52215
|
+
* @param {ValidationError} [err]
|
|
52216
|
+
* @return {o is CastStringTemplateArgsToTemplate<T>}
|
|
52217
|
+
*/
|
|
52218
|
+
check(o, err) {
|
|
52219
|
+
const c2 = this._r.exec(o) != null;
|
|
52220
|
+
!c2 && err?.extend(null, this._r.toString(), o.toString(), "String doesn't match string template.");
|
|
52221
|
+
return c2;
|
|
52222
|
+
}
|
|
52223
|
+
}
|
|
52224
|
+
$constructedBy($StringTemplate);
|
|
52225
|
+
const isOptionalSymbol = Symbol("optional");
|
|
52226
|
+
class $Optional extends Schema$1 {
|
|
52227
|
+
/**
|
|
52228
|
+
* @param {S} shape
|
|
52229
|
+
*/
|
|
52230
|
+
constructor(shape) {
|
|
52231
|
+
super();
|
|
52232
|
+
this.shape = shape;
|
|
52233
|
+
}
|
|
52234
|
+
/**
|
|
52235
|
+
* @param {any} o
|
|
52236
|
+
* @param {ValidationError} [err]
|
|
52237
|
+
* @return {o is (Unwrap<S>|undefined)}
|
|
52238
|
+
*/
|
|
52239
|
+
check(o, err) {
|
|
52240
|
+
const c2 = o === void 0 || this.shape.check(o);
|
|
52241
|
+
!c2 && err?.extend(null, "undefined (optional)", "()");
|
|
52242
|
+
return c2;
|
|
52243
|
+
}
|
|
52244
|
+
get [isOptionalSymbol]() {
|
|
52245
|
+
return true;
|
|
52246
|
+
}
|
|
52247
|
+
}
|
|
52248
|
+
const $$optional = $constructedBy($Optional);
|
|
52249
|
+
class $Never extends Schema$1 {
|
|
52250
|
+
/**
|
|
52251
|
+
* @param {any} _o
|
|
52252
|
+
* @param {ValidationError} [err]
|
|
52253
|
+
* @return {_o is never}
|
|
52254
|
+
*/
|
|
52255
|
+
check(_o, err) {
|
|
52256
|
+
err?.extend(null, "never", typeof _o);
|
|
52257
|
+
return false;
|
|
52258
|
+
}
|
|
52259
|
+
}
|
|
52260
|
+
$constructedBy($Never);
|
|
52261
|
+
const _$Object = class _$Object2 extends Schema$1 {
|
|
52262
|
+
/**
|
|
52263
|
+
* @param {S} shape
|
|
52264
|
+
* @param {boolean} partial
|
|
52265
|
+
*/
|
|
52266
|
+
constructor(shape, partial = false) {
|
|
52267
|
+
super();
|
|
52268
|
+
this.shape = shape;
|
|
52269
|
+
this._isPartial = partial;
|
|
52270
|
+
}
|
|
52271
|
+
/**
|
|
52272
|
+
* @type {Schema<Partial<$ObjectToType<S>>>}
|
|
52273
|
+
*/
|
|
52274
|
+
get partial() {
|
|
52275
|
+
return new _$Object2(this.shape, true);
|
|
52276
|
+
}
|
|
52277
|
+
/**
|
|
52278
|
+
* @param {any} o
|
|
52279
|
+
* @param {ValidationError} err
|
|
52280
|
+
* @return {o is $ObjectToType<S>}
|
|
52281
|
+
*/
|
|
52282
|
+
check(o, err) {
|
|
52283
|
+
if (o == null) {
|
|
52284
|
+
err?.extend(null, "object", "null");
|
|
52285
|
+
return false;
|
|
52286
|
+
}
|
|
52287
|
+
return every(this.shape, (vv, vk) => {
|
|
52288
|
+
const c2 = this._isPartial && !hasProperty(o, vk) || vv.check(o[vk], err);
|
|
52289
|
+
!c2 && err?.extend(vk.toString(), vv.toString(), typeof o[vk], "Object property does not match");
|
|
52290
|
+
return c2;
|
|
52291
|
+
});
|
|
52292
|
+
}
|
|
52293
|
+
};
|
|
52294
|
+
__publicField$1(_$Object, "_dilutes", true);
|
|
52295
|
+
let $Object = _$Object;
|
|
52296
|
+
const $object = (def) => (
|
|
52297
|
+
/** @type {any} */
|
|
52298
|
+
new $Object(def)
|
|
52299
|
+
);
|
|
52300
|
+
const $$object = $constructedBy($Object);
|
|
52301
|
+
const $objectAny = $custom((o) => o != null && (o.constructor === Object || o.constructor == null));
|
|
52302
|
+
class $Record extends Schema$1 {
|
|
52303
|
+
/**
|
|
52304
|
+
* @param {Keys} keys
|
|
52305
|
+
* @param {Values} values
|
|
52306
|
+
*/
|
|
52307
|
+
constructor(keys2, values) {
|
|
52308
|
+
super();
|
|
52309
|
+
this.shape = {
|
|
52310
|
+
keys: keys2,
|
|
52311
|
+
values
|
|
52312
|
+
};
|
|
52313
|
+
}
|
|
52314
|
+
/**
|
|
52315
|
+
* @param {any} o
|
|
52316
|
+
* @param {ValidationError} err
|
|
52317
|
+
* @return {o is { [key in Unwrap<Keys>]: Unwrap<Values> }}
|
|
52318
|
+
*/
|
|
52319
|
+
check(o, err) {
|
|
52320
|
+
return o != null && every(o, (vv, vk) => {
|
|
52321
|
+
const ck = this.shape.keys.check(vk, err);
|
|
52322
|
+
!ck && err?.extend(vk + "", "Record", typeof o, ck ? "Key doesn't match schema" : "Value doesn't match value");
|
|
52323
|
+
return ck && this.shape.values.check(vv, err);
|
|
52324
|
+
});
|
|
52325
|
+
}
|
|
52326
|
+
}
|
|
52327
|
+
const $record = (keys2, values) => new $Record(keys2, values);
|
|
52328
|
+
const $$record = $constructedBy($Record);
|
|
52329
|
+
class $Tuple extends Schema$1 {
|
|
52330
|
+
/**
|
|
52331
|
+
* @param {S} shape
|
|
52332
|
+
*/
|
|
52333
|
+
constructor(shape) {
|
|
52334
|
+
super();
|
|
52335
|
+
this.shape = shape;
|
|
52336
|
+
}
|
|
52337
|
+
/**
|
|
52338
|
+
* @param {any} o
|
|
52339
|
+
* @param {ValidationError} err
|
|
52340
|
+
* @return {o is { [K in keyof S]: S[K] extends Schema<infer Type> ? Type : never }}
|
|
52341
|
+
*/
|
|
52342
|
+
check(o, err) {
|
|
52343
|
+
return o != null && every(this.shape, (vv, vk) => {
|
|
52344
|
+
const c2 = (
|
|
52345
|
+
/** @type {Schema<any>} */
|
|
52346
|
+
vv.check(o[vk], err)
|
|
52347
|
+
);
|
|
52348
|
+
!c2 && err?.extend(vk.toString(), "Tuple", typeof vv);
|
|
52349
|
+
return c2;
|
|
52350
|
+
});
|
|
52351
|
+
}
|
|
52352
|
+
}
|
|
52353
|
+
const $tuple = (...def) => new $Tuple(def);
|
|
52354
|
+
$constructedBy($Tuple);
|
|
52355
|
+
class $Array extends Schema$1 {
|
|
52356
|
+
/**
|
|
52357
|
+
* @param {Array<S>} v
|
|
52358
|
+
*/
|
|
52359
|
+
constructor(v2) {
|
|
52360
|
+
super();
|
|
52361
|
+
this.shape = v2.length === 1 ? v2[0] : new $Union(v2);
|
|
52362
|
+
}
|
|
52363
|
+
/**
|
|
52364
|
+
* @param {any} o
|
|
52365
|
+
* @param {ValidationError} [err]
|
|
52366
|
+
* @return {o is Array<S extends Schema<infer T> ? T : never>} o
|
|
52367
|
+
*/
|
|
52368
|
+
check(o, err) {
|
|
52369
|
+
const c2 = isArray$1(o) && every$1(o, (oi) => this.shape.check(oi));
|
|
52370
|
+
!c2 && err?.extend(null, "Array", "");
|
|
52371
|
+
return c2;
|
|
52372
|
+
}
|
|
52373
|
+
}
|
|
52374
|
+
const $array = (...def) => new $Array(def);
|
|
52375
|
+
const $$array = $constructedBy($Array);
|
|
52376
|
+
const $arrayAny = $custom((o) => isArray$1(o));
|
|
52377
|
+
class $InstanceOf extends Schema$1 {
|
|
52378
|
+
/**
|
|
52379
|
+
* @param {new (...args:any) => T} constructor
|
|
52380
|
+
* @param {((o:T) => boolean)|null} check
|
|
52381
|
+
*/
|
|
52382
|
+
constructor(constructor, check) {
|
|
52383
|
+
super();
|
|
52384
|
+
this.shape = constructor;
|
|
52385
|
+
this._c = check;
|
|
52386
|
+
}
|
|
52387
|
+
/**
|
|
52388
|
+
* @param {any} o
|
|
52389
|
+
* @param {ValidationError} err
|
|
52390
|
+
* @return {o is T}
|
|
52391
|
+
*/
|
|
52392
|
+
check(o, err) {
|
|
52393
|
+
const c2 = o instanceof this.shape && (this._c == null || this._c(o));
|
|
52394
|
+
!c2 && err?.extend(null, this.shape.name, o?.constructor.name);
|
|
52395
|
+
return c2;
|
|
52396
|
+
}
|
|
52397
|
+
}
|
|
52398
|
+
const $instanceOf = (c2, check = null) => new $InstanceOf(c2, check);
|
|
52399
|
+
$constructedBy($InstanceOf);
|
|
52400
|
+
const $$schema = $instanceOf(Schema$1);
|
|
52401
|
+
class $Lambda extends Schema$1 {
|
|
52402
|
+
/**
|
|
52403
|
+
* @param {Args} args
|
|
52404
|
+
*/
|
|
52405
|
+
constructor(args) {
|
|
52406
|
+
super();
|
|
52407
|
+
this.len = args.length - 1;
|
|
52408
|
+
this.args = $tuple(...args.slice(-1));
|
|
52409
|
+
this.res = args[this.len];
|
|
52410
|
+
}
|
|
52411
|
+
/**
|
|
52412
|
+
* @param {any} f
|
|
52413
|
+
* @param {ValidationError} err
|
|
52414
|
+
* @return {f is _LArgsToLambdaDef<Args>}
|
|
52415
|
+
*/
|
|
52416
|
+
check(f2, err) {
|
|
52417
|
+
const c2 = f2.constructor === Function && f2.length <= this.len;
|
|
52418
|
+
!c2 && err?.extend(null, "function", typeof f2);
|
|
52419
|
+
return c2;
|
|
52420
|
+
}
|
|
52421
|
+
}
|
|
52422
|
+
const $$lambda = $constructedBy($Lambda);
|
|
52423
|
+
const $function = $custom((o) => typeof o === "function");
|
|
52424
|
+
class $Intersection extends Schema$1 {
|
|
52425
|
+
/**
|
|
52426
|
+
* @param {T} v
|
|
52427
|
+
*/
|
|
52428
|
+
constructor(v2) {
|
|
52429
|
+
super();
|
|
52430
|
+
this.shape = v2;
|
|
52431
|
+
}
|
|
52432
|
+
/**
|
|
52433
|
+
* @param {any} o
|
|
52434
|
+
* @param {ValidationError} [err]
|
|
52435
|
+
* @return {o is Intersect<UnwrapArray<T>>}
|
|
52436
|
+
*/
|
|
52437
|
+
check(o, err) {
|
|
52438
|
+
const c2 = every$1(this.shape, (check) => check.check(o, err));
|
|
52439
|
+
!c2 && err?.extend(null, "Intersectinon", typeof o);
|
|
52440
|
+
return c2;
|
|
52441
|
+
}
|
|
52442
|
+
}
|
|
52443
|
+
$constructedBy($Intersection, (o) => o.shape.length > 0);
|
|
52444
|
+
class $Union extends Schema$1 {
|
|
52445
|
+
/**
|
|
52446
|
+
* @param {Array<Schema<S>>} v
|
|
52447
|
+
*/
|
|
52448
|
+
constructor(v2) {
|
|
52449
|
+
super();
|
|
52450
|
+
this.shape = v2;
|
|
52451
|
+
}
|
|
52452
|
+
/**
|
|
52453
|
+
* @param {any} o
|
|
52454
|
+
* @param {ValidationError} [err]
|
|
52455
|
+
* @return {o is S}
|
|
52456
|
+
*/
|
|
52457
|
+
check(o, err) {
|
|
52458
|
+
const c2 = some(this.shape, (vv) => vv.check(o, err));
|
|
52459
|
+
err?.extend(null, "Union", typeof o);
|
|
52460
|
+
return c2;
|
|
52461
|
+
}
|
|
52462
|
+
}
|
|
52463
|
+
__publicField$1($Union, "_dilutes", true);
|
|
52464
|
+
const $union = (...schemas) => schemas.findIndex(($s) => $$union.check($s)) >= 0 ? $union(...schemas.map(($s) => $2($s)).map(($s) => $$union.check($s) ? $s.shape : [$s]).flat(1)) : schemas.length === 1 ? schemas[0] : new $Union(schemas);
|
|
52465
|
+
const $$union = (
|
|
52466
|
+
/** @type {Schema<$Union<any>>} */
|
|
52467
|
+
$constructedBy($Union)
|
|
52468
|
+
);
|
|
52469
|
+
const _t = () => true;
|
|
52470
|
+
const $any = $custom(_t);
|
|
52471
|
+
const $$any = (
|
|
52472
|
+
/** @type {Schema<Schema<any>>} */
|
|
52473
|
+
$constructedBy($Custom, (o) => o.shape === _t)
|
|
52474
|
+
);
|
|
52475
|
+
const $bigint = $custom((o) => typeof o === "bigint");
|
|
52476
|
+
const $$bigint = (
|
|
52477
|
+
/** @type {Schema<Schema<BigInt>>} */
|
|
52478
|
+
$custom((o) => o === $bigint)
|
|
52479
|
+
);
|
|
52480
|
+
const $symbol = $custom((o) => typeof o === "symbol");
|
|
52481
|
+
$custom((o) => o === $symbol);
|
|
52482
|
+
const $number = $custom((o) => typeof o === "number");
|
|
52483
|
+
const $$number = (
|
|
52484
|
+
/** @type {Schema<Schema<number>>} */
|
|
52485
|
+
$custom((o) => o === $number)
|
|
52486
|
+
);
|
|
52487
|
+
const $string = $custom((o) => typeof o === "string");
|
|
52488
|
+
const $$string = (
|
|
52489
|
+
/** @type {Schema<Schema<string>>} */
|
|
52490
|
+
$custom((o) => o === $string)
|
|
52491
|
+
);
|
|
52492
|
+
const $boolean = $custom((o) => typeof o === "boolean");
|
|
52493
|
+
const $$boolean = (
|
|
52494
|
+
/** @type {Schema<Schema<Boolean>>} */
|
|
52495
|
+
$custom((o) => o === $boolean)
|
|
52496
|
+
);
|
|
52497
|
+
const $undefined = $literal(void 0);
|
|
52498
|
+
$constructedBy($Literal, (o) => o.shape.length === 1 && o.shape[0] === void 0);
|
|
52499
|
+
$literal(void 0);
|
|
52500
|
+
const $null = $literal(null);
|
|
52501
|
+
const $$null = (
|
|
52502
|
+
/** @type {Schema<Schema<null>>} */
|
|
52503
|
+
$constructedBy($Literal, (o) => o.shape.length === 1 && o.shape[0] === null)
|
|
52504
|
+
);
|
|
52505
|
+
$constructedBy(Uint8Array);
|
|
52506
|
+
$constructedBy($ConstructedBy, (o) => o.shape === Uint8Array);
|
|
52507
|
+
const $primitive = $union($number, $string, $null, $undefined, $bigint, $boolean, $symbol);
|
|
52508
|
+
(() => {
|
|
52509
|
+
const $jsonArr = (
|
|
52510
|
+
/** @type {$Array<$any>} */
|
|
52511
|
+
$array($any)
|
|
52512
|
+
);
|
|
52513
|
+
const $jsonRecord = (
|
|
52514
|
+
/** @type {$Record<$string,$any>} */
|
|
52515
|
+
$record($string, $any)
|
|
52516
|
+
);
|
|
52517
|
+
const $json = $union($number, $string, $null, $boolean, $jsonArr, $jsonRecord);
|
|
52518
|
+
$jsonArr.shape = $json;
|
|
52519
|
+
$jsonRecord.shape.values = $json;
|
|
52520
|
+
return $json;
|
|
52521
|
+
})();
|
|
52522
|
+
const $2 = (o) => {
|
|
52523
|
+
if ($$schema.check(o)) {
|
|
52524
|
+
return (
|
|
52525
|
+
/** @type {any} */
|
|
52526
|
+
o
|
|
52527
|
+
);
|
|
52528
|
+
} else if ($objectAny.check(o)) {
|
|
52529
|
+
const o2 = {};
|
|
52530
|
+
for (const k2 in o) {
|
|
52531
|
+
o2[k2] = $2(o[k2]);
|
|
52532
|
+
}
|
|
52533
|
+
return (
|
|
52534
|
+
/** @type {any} */
|
|
52535
|
+
$object(o2)
|
|
52536
|
+
);
|
|
52537
|
+
} else if ($arrayAny.check(o)) {
|
|
52538
|
+
return (
|
|
52539
|
+
/** @type {any} */
|
|
52540
|
+
$union(...o.map($2))
|
|
52541
|
+
);
|
|
52542
|
+
} else if ($primitive.check(o)) {
|
|
52543
|
+
return (
|
|
52544
|
+
/** @type {any} */
|
|
52545
|
+
$literal(o)
|
|
52546
|
+
);
|
|
52547
|
+
} else if ($function.check(o)) {
|
|
52548
|
+
return (
|
|
52549
|
+
/** @type {any} */
|
|
52550
|
+
$constructedBy(
|
|
52551
|
+
/** @type {any} */
|
|
52552
|
+
o
|
|
52553
|
+
)
|
|
52554
|
+
);
|
|
52555
|
+
}
|
|
52556
|
+
unexpectedCase();
|
|
52557
|
+
};
|
|
52558
|
+
const assert = production ? () => {
|
|
52559
|
+
} : (o, schema) => {
|
|
52560
|
+
const err = new ValidationError();
|
|
52561
|
+
if (!schema.check(o, err)) {
|
|
52562
|
+
throw create$1(`Expected value to be of type ${schema.constructor.name}.
|
|
52563
|
+
${err.toString()}`);
|
|
52564
|
+
}
|
|
52565
|
+
};
|
|
52566
|
+
class PatternMatcher {
|
|
52567
|
+
/**
|
|
52568
|
+
* @param {Schema<State>} [$state]
|
|
52569
|
+
*/
|
|
52570
|
+
constructor($state) {
|
|
52571
|
+
this.patterns = [];
|
|
52572
|
+
this.$state = $state;
|
|
52573
|
+
}
|
|
52574
|
+
/**
|
|
52575
|
+
* @template P
|
|
52576
|
+
* @template R
|
|
52577
|
+
* @param {P} pattern
|
|
52578
|
+
* @param {(o:NoInfer<Unwrap<ReadSchema<P>>>,s:State)=>R} handler
|
|
52579
|
+
* @return {PatternMatcher<State,Patterns|Pattern<Unwrap<ReadSchema<P>>,R>>}
|
|
52580
|
+
*/
|
|
52581
|
+
if(pattern, handler2) {
|
|
52582
|
+
this.patterns.push({ if: $2(pattern), h: handler2 });
|
|
52583
|
+
return this;
|
|
52584
|
+
}
|
|
52585
|
+
/**
|
|
52586
|
+
* @template R
|
|
52587
|
+
* @param {(o:any,s:State)=>R} h
|
|
52588
|
+
*/
|
|
52589
|
+
else(h) {
|
|
52590
|
+
return this.if($any, h);
|
|
52591
|
+
}
|
|
52592
|
+
/**
|
|
52593
|
+
* @return {State extends undefined
|
|
52594
|
+
* ? <In extends Unwrap<Patterns['if']>>(o:In,state?:undefined)=>PatternMatchResult<Patterns,In>
|
|
52595
|
+
* : <In extends Unwrap<Patterns['if']>>(o:In,state:State)=>PatternMatchResult<Patterns,In>}
|
|
52596
|
+
*/
|
|
52597
|
+
done() {
|
|
52598
|
+
return (
|
|
52599
|
+
/** @type {any} */
|
|
52600
|
+
((o, s2) => {
|
|
52601
|
+
for (let i = 0; i < this.patterns.length; i++) {
|
|
52602
|
+
const p = this.patterns[i];
|
|
52603
|
+
if (p.if.check(o)) {
|
|
52604
|
+
return p.h(o, s2);
|
|
52605
|
+
}
|
|
52606
|
+
}
|
|
52607
|
+
throw create$1("Unhandled pattern");
|
|
52608
|
+
})
|
|
52609
|
+
);
|
|
52610
|
+
}
|
|
52611
|
+
}
|
|
52612
|
+
const match = (state2) => new PatternMatcher(
|
|
52613
|
+
/** @type {any} */
|
|
52614
|
+
state2
|
|
52615
|
+
);
|
|
52616
|
+
const _random = (
|
|
52617
|
+
/** @type {any} */
|
|
52618
|
+
match(
|
|
52619
|
+
/** @type {Schema<prng.PRNG>} */
|
|
52620
|
+
$any
|
|
52621
|
+
).if($$number, (_o, gen) => int53(gen, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER$2)).if($$string, (_o, gen) => word(gen)).if($$boolean, (_o, gen) => bool(gen)).if($$bigint, (_o, gen) => BigInt(int53(gen, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER$2))).if($$union, (o, gen) => random(gen, oneOf(gen, o.shape))).if($$object, (o, gen) => {
|
|
52622
|
+
const res = {};
|
|
52623
|
+
for (const k2 in o.shape) {
|
|
52624
|
+
let prop = o.shape[k2];
|
|
52625
|
+
if ($$optional.check(prop)) {
|
|
52626
|
+
if (bool(gen)) {
|
|
52627
|
+
continue;
|
|
52628
|
+
}
|
|
52629
|
+
prop = prop.shape;
|
|
52630
|
+
}
|
|
52631
|
+
res[k2] = _random(prop, gen);
|
|
52632
|
+
}
|
|
52633
|
+
return res;
|
|
52634
|
+
}).if($$array, (o, gen) => {
|
|
52635
|
+
const arr = [];
|
|
52636
|
+
const n = int32(gen, 0, 42);
|
|
52637
|
+
for (let i = 0; i < n; i++) {
|
|
52638
|
+
arr.push(random(gen, o.shape));
|
|
52639
|
+
}
|
|
52640
|
+
return arr;
|
|
52641
|
+
}).if($$literal, (o, gen) => {
|
|
52642
|
+
return oneOf(gen, o.shape);
|
|
52643
|
+
}).if($$null, (o, gen) => {
|
|
52644
|
+
return null;
|
|
52645
|
+
}).if($$lambda, (o, gen) => {
|
|
52646
|
+
const res = random(gen, o.res);
|
|
52647
|
+
return () => res;
|
|
52648
|
+
}).if($$any, (o, gen) => random(gen, oneOf(gen, [
|
|
52649
|
+
$number,
|
|
52650
|
+
$string,
|
|
52651
|
+
$null,
|
|
52652
|
+
$undefined,
|
|
52653
|
+
$bigint,
|
|
52654
|
+
$boolean,
|
|
52655
|
+
$array($number),
|
|
52656
|
+
$record($union("a", "b", "c"), $number)
|
|
52657
|
+
]))).if($$record, (o, gen) => {
|
|
52658
|
+
const res = {};
|
|
52659
|
+
const keysN = int53(gen, 0, 3);
|
|
52660
|
+
for (let i = 0; i < keysN; i++) {
|
|
52661
|
+
const key2 = random(gen, o.shape.keys);
|
|
52662
|
+
const val = random(gen, o.shape.values);
|
|
52663
|
+
res[key2] = val;
|
|
52664
|
+
}
|
|
52665
|
+
return res;
|
|
52666
|
+
}).done()
|
|
52667
|
+
);
|
|
52668
|
+
const random = (gen, schema) => (
|
|
52669
|
+
/** @type {any} */
|
|
52670
|
+
_random($2(schema), gen)
|
|
52671
|
+
);
|
|
51819
52672
|
const doc = (
|
|
51820
52673
|
/** @type {Document} */
|
|
51821
52674
|
typeof document !== "undefined" ? document : {}
|
|
51822
52675
|
);
|
|
52676
|
+
$custom((el) => el.nodeType === DOCUMENT_FRAGMENT_NODE);
|
|
51823
52677
|
typeof DOMParser !== "undefined" ? new DOMParser() : null;
|
|
52678
|
+
$custom((el) => el.nodeType === ELEMENT_NODE);
|
|
52679
|
+
$custom((el) => el.nodeType === TEXT_NODE);
|
|
52680
|
+
const ELEMENT_NODE = doc.ELEMENT_NODE;
|
|
52681
|
+
const TEXT_NODE = doc.TEXT_NODE;
|
|
52682
|
+
const DOCUMENT_NODE = doc.DOCUMENT_NODE;
|
|
52683
|
+
const DOCUMENT_FRAGMENT_NODE = doc.DOCUMENT_FRAGMENT_NODE;
|
|
52684
|
+
$custom((el) => el.nodeType === DOCUMENT_NODE);
|
|
51824
52685
|
const createTimeoutClass = (clearFunction) => class TT {
|
|
51825
52686
|
/**
|
|
51826
52687
|
* @param {number} timeoutId
|
|
@@ -52003,16 +52864,6 @@ class Hasher {
|
|
|
52003
52864
|
}
|
|
52004
52865
|
}
|
|
52005
52866
|
const digest = (data) => new Hasher().digest(data);
|
|
52006
|
-
const toBase64Browser = (bytes) => {
|
|
52007
|
-
let s2 = "";
|
|
52008
|
-
for (let i = 0; i < bytes.byteLength; i++) {
|
|
52009
|
-
s2 += fromCharCode(bytes[i]);
|
|
52010
|
-
}
|
|
52011
|
-
return btoa(s2);
|
|
52012
|
-
};
|
|
52013
|
-
const toBase64Node = (bytes) => Buffer2.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64");
|
|
52014
|
-
const toBase64 = isBrowser$1$1 ? toBase64Browser : toBase64Node;
|
|
52015
|
-
const encodeAny = (data) => encode((encoder) => writeAny(encoder, data));
|
|
52016
52867
|
const _convolute = (digest2) => {
|
|
52017
52868
|
const N2 = 6;
|
|
52018
52869
|
for (let i = N2; i < digest2.length; i++) {
|
|
@@ -52035,7 +52886,7 @@ const getUserColor = (colorMapping, colors2, user) => {
|
|
|
52035
52886
|
colorMapping.forEach((color) => usedColors.add(color));
|
|
52036
52887
|
colors2 = colors2.filter((color) => !usedColors.has(color));
|
|
52037
52888
|
}
|
|
52038
|
-
colorMapping.set(user, oneOf(colors2));
|
|
52889
|
+
colorMapping.set(user, oneOf$1(colors2));
|
|
52039
52890
|
}
|
|
52040
52891
|
return (
|
|
52041
52892
|
/** @type {ColorDef} */
|
|
@@ -53815,7 +54666,7 @@ const _Schema = class _Schema2 {
|
|
|
53815
54666
|
const attributes = Attribute2.getAttributesFromExtensions(extensions);
|
|
53816
54667
|
const nodes = __privateMethod$1(_a2 = _Schema2, _Schema_static, createNodesSchema_fn).call(_a2, nodeExtensions, attributes, editor);
|
|
53817
54668
|
const marks = __privateMethod$1(_b2 = _Schema2, _Schema_static, createMarksSchema_fn).call(_b2, markExtensions, attributes, editor);
|
|
53818
|
-
return new Schema$1({ topNode, nodes, marks });
|
|
54669
|
+
return new Schema$1$1({ topNode, nodes, marks });
|
|
53819
54670
|
}
|
|
53820
54671
|
};
|
|
53821
54672
|
_Schema_static = /* @__PURE__ */ new WeakSet();
|
|
@@ -54316,9 +55167,9 @@ const newlineInCode$1 = (state2, dispatch) => {
|
|
|
54316
55167
|
dispatch(state2.tr.insertText("\n").scrollIntoView());
|
|
54317
55168
|
return true;
|
|
54318
55169
|
};
|
|
54319
|
-
function defaultBlockAt(
|
|
54320
|
-
for (let i = 0; i <
|
|
54321
|
-
let { type: type2 } =
|
|
55170
|
+
function defaultBlockAt(match2) {
|
|
55171
|
+
for (let i = 0; i < match2.edgeCount; i++) {
|
|
55172
|
+
let { type: type2 } = match2.edge(i);
|
|
54322
55173
|
if (type2.isTextblock && !type2.hasRequiredAttrs())
|
|
54323
55174
|
return type2;
|
|
54324
55175
|
}
|
|
@@ -54445,12 +55296,12 @@ function joinMaybeClear(state2, $pos, dispatch) {
|
|
|
54445
55296
|
return true;
|
|
54446
55297
|
}
|
|
54447
55298
|
function deleteBarrier(state2, $cut, dispatch, dir) {
|
|
54448
|
-
let before = $cut.nodeBefore, after = $cut.nodeAfter, conn,
|
|
55299
|
+
let before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match2;
|
|
54449
55300
|
let isolated = before.type.spec.isolating || after.type.spec.isolating;
|
|
54450
55301
|
if (!isolated && joinMaybeClear(state2, $cut, dispatch))
|
|
54451
55302
|
return true;
|
|
54452
55303
|
let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);
|
|
54453
|
-
if (canDelAfter && (conn = (
|
|
55304
|
+
if (canDelAfter && (conn = (match2 = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match2.matchType(conn[0] || after.type).validEnd) {
|
|
54454
55305
|
if (dispatch) {
|
|
54455
55306
|
let end2 = $cut.pos + after.nodeSize, wrap2 = Fragment.empty;
|
|
54456
55307
|
for (let i = conn.length - 1; i >= 0; i--)
|
|
@@ -55062,7 +55913,7 @@ function createNodeFromContent(content, editor, options) {
|
|
|
55062
55913
|
if (options.errorOnInvalidContent) {
|
|
55063
55914
|
let hasInvalidContent = false;
|
|
55064
55915
|
let invalidContent = "";
|
|
55065
|
-
const contentCheckSchema = new Schema$1({
|
|
55916
|
+
const contentCheckSchema = new Schema$1$1({
|
|
55066
55917
|
topNode: schema.spec.topNode,
|
|
55067
55918
|
marks: schema.spec.marks,
|
|
55068
55919
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -57984,7 +58835,11 @@ const trackedTransaction = ({ tr, state: state2, user }) => {
|
|
|
57984
58835
|
const onlyInputTypeMeta = ["inputType", "uiEvent", "paste", "pointer"];
|
|
57985
58836
|
const notAllowedMeta = ["historyUndo", "historyRedo", "acceptReject"];
|
|
57986
58837
|
const isProgrammaticInput = tr.getMeta("inputType") === "programmatic";
|
|
57987
|
-
|
|
58838
|
+
const ySyncMeta = tr.getMeta(ySyncPluginKey);
|
|
58839
|
+
const allowedMeta = /* @__PURE__ */ new Set([...onlyInputTypeMeta, ySyncPluginKey.key]);
|
|
58840
|
+
const hasDisallowedMeta = tr.meta && Object.keys(tr.meta).some((meta) => !allowedMeta.has(meta));
|
|
58841
|
+
if (ySyncMeta?.isChangeOrigin || // Skip Yjs-origin transactions (remote/rehydration).
|
|
58842
|
+
!tr.steps.length || hasDisallowedMeta && !isProgrammaticInput || notAllowedMeta.includes(tr.getMeta("inputType")) || tr.getMeta(CommentsPluginKey)) {
|
|
57988
58843
|
return tr;
|
|
57989
58844
|
}
|
|
57990
58845
|
const newTr = state2.tr;
|
|
@@ -59653,7 +60508,7 @@ const isHeadless = (editor) => {
|
|
|
59653
60508
|
const shouldSkipNodeView = (editor) => {
|
|
59654
60509
|
return isHeadless(editor);
|
|
59655
60510
|
};
|
|
59656
|
-
const summaryVersion = "1.0.
|
|
60511
|
+
const summaryVersion = "1.0.2";
|
|
59657
60512
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59658
60513
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59659
60514
|
function mapAttributes(attrs) {
|
|
@@ -60442,7 +61297,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60442
61297
|
{ default: remarkStringify },
|
|
60443
61298
|
{ default: remarkGfm }
|
|
60444
61299
|
] = await Promise.all([
|
|
60445
|
-
Promise.resolve().then(() => require("./index-
|
|
61300
|
+
Promise.resolve().then(() => require("./index-DDZ1ZT8N-DzepXBTN.cjs")),
|
|
60446
61301
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
60447
61302
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
60448
61303
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -60647,7 +61502,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60647
61502
|
* Process collaboration migrations
|
|
60648
61503
|
*/
|
|
60649
61504
|
processCollaborationMigrations() {
|
|
60650
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.
|
|
61505
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.2");
|
|
60651
61506
|
if (!this.options.ydoc) return;
|
|
60652
61507
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60653
61508
|
let docVersion = metaMap.get("version");
|
|
@@ -71646,6 +72501,86 @@ const createDomPainter = (options) => {
|
|
|
71646
72501
|
}
|
|
71647
72502
|
};
|
|
71648
72503
|
};
|
|
72504
|
+
const DEFAULT_CONFIG = {
|
|
72505
|
+
logLevel: "off",
|
|
72506
|
+
hud: false,
|
|
72507
|
+
dumpRects: false,
|
|
72508
|
+
disableRectDedupe: false
|
|
72509
|
+
};
|
|
72510
|
+
const levelOrder = {
|
|
72511
|
+
error: 0,
|
|
72512
|
+
warn: 1,
|
|
72513
|
+
info: 2,
|
|
72514
|
+
verbose: 3
|
|
72515
|
+
};
|
|
72516
|
+
function getSelectionDebugConfig() {
|
|
72517
|
+
var _a2;
|
|
72518
|
+
if (typeof window === "undefined") {
|
|
72519
|
+
return DEFAULT_CONFIG;
|
|
72520
|
+
}
|
|
72521
|
+
window.superdocDebug ?? (window.superdocDebug = {});
|
|
72522
|
+
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
72523
|
+
const cfg = window.superdocDebug.selection;
|
|
72524
|
+
return {
|
|
72525
|
+
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
72526
|
+
hud: cfg.hud ?? DEFAULT_CONFIG.hud,
|
|
72527
|
+
dumpRects: cfg.dumpRects ?? DEFAULT_CONFIG.dumpRects,
|
|
72528
|
+
disableRectDedupe: cfg.disableRectDedupe ?? DEFAULT_CONFIG.disableRectDedupe
|
|
72529
|
+
};
|
|
72530
|
+
}
|
|
72531
|
+
function debugLog(level, message, data) {
|
|
72532
|
+
const cfg = getSelectionDebugConfig();
|
|
72533
|
+
if (cfg.logLevel === "off") return;
|
|
72534
|
+
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
72535
|
+
const prefix2 = "[Selection]";
|
|
72536
|
+
if (data) {
|
|
72537
|
+
console.log(prefix2, message, data);
|
|
72538
|
+
} else {
|
|
72539
|
+
console.log(prefix2, message);
|
|
72540
|
+
}
|
|
72541
|
+
}
|
|
72542
|
+
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
72543
|
+
function updateSelectionDebugHud(host, state2) {
|
|
72544
|
+
const cfg = getSelectionDebugConfig();
|
|
72545
|
+
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
72546
|
+
if (!doc2) return;
|
|
72547
|
+
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
72548
|
+
if (!cfg.hud) {
|
|
72549
|
+
existing?.remove();
|
|
72550
|
+
return;
|
|
72551
|
+
}
|
|
72552
|
+
const hud = existing ?? doc2.createElement("div");
|
|
72553
|
+
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
72554
|
+
hud.style.position = "absolute";
|
|
72555
|
+
hud.style.top = "8px";
|
|
72556
|
+
hud.style.left = "8px";
|
|
72557
|
+
hud.style.zIndex = "9999";
|
|
72558
|
+
hud.style.maxWidth = "420px";
|
|
72559
|
+
hud.style.padding = "6px 8px";
|
|
72560
|
+
hud.style.borderRadius = "6px";
|
|
72561
|
+
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
72562
|
+
hud.style.color = "white";
|
|
72563
|
+
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
72564
|
+
hud.style.fontSize = "12px";
|
|
72565
|
+
hud.style.lineHeight = "1.3";
|
|
72566
|
+
hud.style.pointerEvents = "none";
|
|
72567
|
+
hud.style.whiteSpace = "pre";
|
|
72568
|
+
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
72569
|
+
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
72570
|
+
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
72571
|
+
state2.lastPointer.y
|
|
72572
|
+
)}` : "null";
|
|
72573
|
+
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
72574
|
+
hud.textContent = [
|
|
72575
|
+
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
72576
|
+
`selection=${selectionText}`,
|
|
72577
|
+
`pointer=${pointerText}`,
|
|
72578
|
+
`hit=${hitText}`
|
|
72579
|
+
].join("\n");
|
|
72580
|
+
if (!existing) {
|
|
72581
|
+
host.appendChild(hud);
|
|
72582
|
+
}
|
|
72583
|
+
}
|
|
71649
72584
|
class DomPositionIndex {
|
|
71650
72585
|
constructor() {
|
|
71651
72586
|
__privateAdd$1(this, _entries, []);
|
|
@@ -71702,6 +72637,7 @@ class DomPositionIndex {
|
|
|
71702
72637
|
}
|
|
71703
72638
|
for (const node of pmNodes) {
|
|
71704
72639
|
if (node.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER)) continue;
|
|
72640
|
+
if (node.closest(".superdoc-page-header, .superdoc-page-footer")) continue;
|
|
71705
72641
|
if (leafOnly && nonLeaf.has(node)) continue;
|
|
71706
72642
|
const pmStart = Number(node.dataset.pmStart ?? "NaN");
|
|
71707
72643
|
const pmEnd = Number(node.dataset.pmEnd ?? "NaN");
|
|
@@ -71711,6 +72647,60 @@ class DomPositionIndex {
|
|
|
71711
72647
|
}
|
|
71712
72648
|
entries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
71713
72649
|
__privateSet(this, _entries, entries);
|
|
72650
|
+
const isVerbose = getSelectionDebugConfig().logLevel === "verbose";
|
|
72651
|
+
if (isVerbose) {
|
|
72652
|
+
const counts = { total: entries.length, body: 0, header: 0, footer: 0 };
|
|
72653
|
+
const bodySamples = [];
|
|
72654
|
+
const headerSamples = [];
|
|
72655
|
+
const footerSamples = [];
|
|
72656
|
+
for (const entry of entries) {
|
|
72657
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
72658
|
+
const pageIndex = pageEl?.dataset.pageIndex ?? null;
|
|
72659
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
72660
|
+
if (section === "header") {
|
|
72661
|
+
counts.header += 1;
|
|
72662
|
+
if (headerSamples.length < 10) {
|
|
72663
|
+
headerSamples.push({
|
|
72664
|
+
pmStart: entry.pmStart,
|
|
72665
|
+
pmEnd: entry.pmEnd,
|
|
72666
|
+
pageIndex,
|
|
72667
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
72668
|
+
});
|
|
72669
|
+
}
|
|
72670
|
+
continue;
|
|
72671
|
+
}
|
|
72672
|
+
if (section === "footer") {
|
|
72673
|
+
counts.footer += 1;
|
|
72674
|
+
if (footerSamples.length < 10) {
|
|
72675
|
+
footerSamples.push({
|
|
72676
|
+
pmStart: entry.pmStart,
|
|
72677
|
+
pmEnd: entry.pmEnd,
|
|
72678
|
+
pageIndex,
|
|
72679
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
72680
|
+
});
|
|
72681
|
+
}
|
|
72682
|
+
continue;
|
|
72683
|
+
}
|
|
72684
|
+
counts.body += 1;
|
|
72685
|
+
if (bodySamples.length < 10) {
|
|
72686
|
+
bodySamples.push({
|
|
72687
|
+
pmStart: entry.pmStart,
|
|
72688
|
+
pmEnd: entry.pmEnd,
|
|
72689
|
+
pageIndex,
|
|
72690
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
72691
|
+
});
|
|
72692
|
+
}
|
|
72693
|
+
}
|
|
72694
|
+
debugLog(
|
|
72695
|
+
"verbose",
|
|
72696
|
+
`DomPositionIndex: rebuild summary ${JSON.stringify({
|
|
72697
|
+
counts,
|
|
72698
|
+
bodySamples,
|
|
72699
|
+
headerSamples,
|
|
72700
|
+
footerSamples
|
|
72701
|
+
})}`
|
|
72702
|
+
);
|
|
72703
|
+
}
|
|
71714
72704
|
}
|
|
71715
72705
|
/**
|
|
71716
72706
|
* Finds the index entry whose position range contains the given position.
|
|
@@ -71960,82 +72950,6 @@ _onRebuild = /* @__PURE__ */ new WeakMap();
|
|
|
71960
72950
|
_observer = /* @__PURE__ */ new WeakMap();
|
|
71961
72951
|
_rebuildScheduled = /* @__PURE__ */ new WeakMap();
|
|
71962
72952
|
_rebuildRafId = /* @__PURE__ */ new WeakMap();
|
|
71963
|
-
const DEFAULT_CONFIG = {
|
|
71964
|
-
logLevel: "off",
|
|
71965
|
-
hud: false
|
|
71966
|
-
};
|
|
71967
|
-
const levelOrder = {
|
|
71968
|
-
error: 0,
|
|
71969
|
-
warn: 1,
|
|
71970
|
-
info: 2,
|
|
71971
|
-
verbose: 3
|
|
71972
|
-
};
|
|
71973
|
-
function getSelectionDebugConfig() {
|
|
71974
|
-
var _a2;
|
|
71975
|
-
if (typeof window === "undefined") {
|
|
71976
|
-
return DEFAULT_CONFIG;
|
|
71977
|
-
}
|
|
71978
|
-
window.superdocDebug ?? (window.superdocDebug = {});
|
|
71979
|
-
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
71980
|
-
const cfg = window.superdocDebug.selection;
|
|
71981
|
-
return {
|
|
71982
|
-
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
71983
|
-
hud: cfg.hud ?? DEFAULT_CONFIG.hud
|
|
71984
|
-
};
|
|
71985
|
-
}
|
|
71986
|
-
function debugLog(level, message, data) {
|
|
71987
|
-
const cfg = getSelectionDebugConfig();
|
|
71988
|
-
if (cfg.logLevel === "off") return;
|
|
71989
|
-
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
71990
|
-
const prefix2 = "[Selection]";
|
|
71991
|
-
if (data) {
|
|
71992
|
-
console.log(prefix2, message, data);
|
|
71993
|
-
} else {
|
|
71994
|
-
console.log(prefix2, message);
|
|
71995
|
-
}
|
|
71996
|
-
}
|
|
71997
|
-
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
71998
|
-
function updateSelectionDebugHud(host, state2) {
|
|
71999
|
-
const cfg = getSelectionDebugConfig();
|
|
72000
|
-
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
72001
|
-
if (!doc2) return;
|
|
72002
|
-
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
72003
|
-
if (!cfg.hud) {
|
|
72004
|
-
existing?.remove();
|
|
72005
|
-
return;
|
|
72006
|
-
}
|
|
72007
|
-
const hud = existing ?? doc2.createElement("div");
|
|
72008
|
-
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
72009
|
-
hud.style.position = "absolute";
|
|
72010
|
-
hud.style.top = "8px";
|
|
72011
|
-
hud.style.left = "8px";
|
|
72012
|
-
hud.style.zIndex = "9999";
|
|
72013
|
-
hud.style.maxWidth = "420px";
|
|
72014
|
-
hud.style.padding = "6px 8px";
|
|
72015
|
-
hud.style.borderRadius = "6px";
|
|
72016
|
-
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
72017
|
-
hud.style.color = "white";
|
|
72018
|
-
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
72019
|
-
hud.style.fontSize = "12px";
|
|
72020
|
-
hud.style.lineHeight = "1.3";
|
|
72021
|
-
hud.style.pointerEvents = "none";
|
|
72022
|
-
hud.style.whiteSpace = "pre";
|
|
72023
|
-
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
72024
|
-
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
72025
|
-
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
72026
|
-
state2.lastPointer.y
|
|
72027
|
-
)}` : "null";
|
|
72028
|
-
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
72029
|
-
hud.textContent = [
|
|
72030
|
-
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
72031
|
-
`selection=${selectionText}`,
|
|
72032
|
-
`pointer=${pointerText}`,
|
|
72033
|
-
`hit=${hitText}`
|
|
72034
|
-
].join("\n");
|
|
72035
|
-
if (!existing) {
|
|
72036
|
-
host.appendChild(hud);
|
|
72037
|
-
}
|
|
72038
|
-
}
|
|
72039
72953
|
function computeSelectionRectsFromDom(options, from2, to) {
|
|
72040
72954
|
const painterHost = options.painterHost;
|
|
72041
72955
|
if (!painterHost) return null;
|
|
@@ -72056,6 +72970,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72056
72970
|
);
|
|
72057
72971
|
const out = [];
|
|
72058
72972
|
let rebuiltOnce = false;
|
|
72973
|
+
const debugConfig = getSelectionDebugConfig();
|
|
72974
|
+
const isVerbose = debugConfig.logLevel === "verbose";
|
|
72975
|
+
const dumpRects = isVerbose && debugConfig.dumpRects;
|
|
72976
|
+
const disableRectDedupe = debugConfig.disableRectDedupe;
|
|
72977
|
+
const entryDebugInfo = (entry) => {
|
|
72978
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
72979
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
72980
|
+
return {
|
|
72981
|
+
pmStart: entry.pmStart,
|
|
72982
|
+
pmEnd: entry.pmEnd,
|
|
72983
|
+
pageIndex: pageEl?.dataset.pageIndex ?? null,
|
|
72984
|
+
section,
|
|
72985
|
+
connected: entry.el.isConnected,
|
|
72986
|
+
layoutEpoch: entry.el.dataset.layoutEpoch ?? null,
|
|
72987
|
+
pageEpoch: pageEl?.dataset.layoutEpoch ?? null,
|
|
72988
|
+
text: (entry.el.textContent ?? "").slice(0, 80)
|
|
72989
|
+
};
|
|
72990
|
+
};
|
|
72991
|
+
const rectDebugInfo = (rect) => ({
|
|
72992
|
+
x: rect.x,
|
|
72993
|
+
y: rect.y,
|
|
72994
|
+
width: rect.width,
|
|
72995
|
+
height: rect.height,
|
|
72996
|
+
top: rect.top,
|
|
72997
|
+
left: rect.left,
|
|
72998
|
+
right: rect.right,
|
|
72999
|
+
bottom: rect.bottom
|
|
73000
|
+
});
|
|
72059
73001
|
for (const pageEl of pageEls) {
|
|
72060
73002
|
const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
72061
73003
|
if (!Number.isFinite(pageIndex)) continue;
|
|
@@ -72079,9 +73021,47 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72079
73021
|
if (sliceEntries.length === 0) {
|
|
72080
73022
|
continue;
|
|
72081
73023
|
}
|
|
73024
|
+
if (isVerbose) {
|
|
73025
|
+
debugLog(
|
|
73026
|
+
"verbose",
|
|
73027
|
+
`DOM selection rects: slice entries ${JSON.stringify({
|
|
73028
|
+
pageIndex,
|
|
73029
|
+
sliceFrom,
|
|
73030
|
+
sliceTo,
|
|
73031
|
+
entriesCount: sliceEntries.length,
|
|
73032
|
+
entriesPreview: sliceEntries.slice(0, 20).map(entryDebugInfo)
|
|
73033
|
+
})}`
|
|
73034
|
+
);
|
|
73035
|
+
}
|
|
72082
73036
|
let startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72083
73037
|
let endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
72084
|
-
if (
|
|
73038
|
+
if (isVerbose) {
|
|
73039
|
+
debugLog(
|
|
73040
|
+
"verbose",
|
|
73041
|
+
`DOM selection rects: boundaries ${JSON.stringify({
|
|
73042
|
+
pageIndex,
|
|
73043
|
+
sliceFrom,
|
|
73044
|
+
sliceTo,
|
|
73045
|
+
start: entryDebugInfo(startEntry),
|
|
73046
|
+
end: entryDebugInfo(endEntry)
|
|
73047
|
+
})}`
|
|
73048
|
+
);
|
|
73049
|
+
}
|
|
73050
|
+
let startContained = pageEl.contains(startEntry.el);
|
|
73051
|
+
let endContained = pageEl.contains(endEntry.el);
|
|
73052
|
+
if (!startContained || !endContained) {
|
|
73053
|
+
if (isVerbose) {
|
|
73054
|
+
debugLog(
|
|
73055
|
+
"verbose",
|
|
73056
|
+
`DOM selection rects: boundary containment ${JSON.stringify({
|
|
73057
|
+
pageIndex,
|
|
73058
|
+
sliceFrom,
|
|
73059
|
+
sliceTo,
|
|
73060
|
+
startContained,
|
|
73061
|
+
endContained
|
|
73062
|
+
})}`
|
|
73063
|
+
);
|
|
73064
|
+
}
|
|
72085
73065
|
if (!rebuiltOnce) {
|
|
72086
73066
|
options.rebuildDomPositionIndex();
|
|
72087
73067
|
rebuiltOnce = true;
|
|
@@ -72089,9 +73069,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72089
73069
|
if (sliceEntries.length === 0) continue;
|
|
72090
73070
|
startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72091
73071
|
endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
73072
|
+
startContained = pageEl.contains(startEntry.el);
|
|
73073
|
+
endContained = pageEl.contains(endEntry.el);
|
|
73074
|
+
if (isVerbose) {
|
|
73075
|
+
debugLog(
|
|
73076
|
+
"verbose",
|
|
73077
|
+
`DOM selection rects: boundary containment after rebuild ${JSON.stringify({
|
|
73078
|
+
pageIndex,
|
|
73079
|
+
sliceFrom,
|
|
73080
|
+
sliceTo,
|
|
73081
|
+
startContained,
|
|
73082
|
+
endContained,
|
|
73083
|
+
start: entryDebugInfo(startEntry),
|
|
73084
|
+
end: entryDebugInfo(endEntry)
|
|
73085
|
+
})}`
|
|
73086
|
+
);
|
|
73087
|
+
}
|
|
72092
73088
|
}
|
|
72093
|
-
if (!
|
|
72094
|
-
debugLog(
|
|
73089
|
+
if (!startContained || !endContained) {
|
|
73090
|
+
debugLog(
|
|
73091
|
+
"warn",
|
|
73092
|
+
`DOM selection rects: stale index after rebuild ${JSON.stringify({
|
|
73093
|
+
pageIndex,
|
|
73094
|
+
sliceFrom,
|
|
73095
|
+
sliceTo,
|
|
73096
|
+
start: entryDebugInfo(startEntry),
|
|
73097
|
+
end: entryDebugInfo(endEntry)
|
|
73098
|
+
})}`
|
|
73099
|
+
);
|
|
72095
73100
|
return null;
|
|
72096
73101
|
}
|
|
72097
73102
|
}
|
|
@@ -72106,8 +73111,83 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72106
73111
|
}
|
|
72107
73112
|
let clientRects = [];
|
|
72108
73113
|
try {
|
|
72109
|
-
|
|
72110
|
-
|
|
73114
|
+
let rawRects = Array.from(range2.getClientRects());
|
|
73115
|
+
if (dumpRects) {
|
|
73116
|
+
debugLog(
|
|
73117
|
+
"verbose",
|
|
73118
|
+
`DOM selection rects: raw rects ${JSON.stringify({
|
|
73119
|
+
pageIndex,
|
|
73120
|
+
sliceFrom,
|
|
73121
|
+
sliceTo,
|
|
73122
|
+
rects: rawRects.map(rectDebugInfo)
|
|
73123
|
+
})}`
|
|
73124
|
+
);
|
|
73125
|
+
}
|
|
73126
|
+
let missingEntries = null;
|
|
73127
|
+
if (typeof range2.intersectsNode === "function") {
|
|
73128
|
+
for (const entry of sliceEntries) {
|
|
73129
|
+
try {
|
|
73130
|
+
if (!range2.intersectsNode(entry.el)) {
|
|
73131
|
+
missingEntries ?? (missingEntries = []);
|
|
73132
|
+
missingEntries.push(entry);
|
|
73133
|
+
}
|
|
73134
|
+
} catch {
|
|
73135
|
+
}
|
|
73136
|
+
}
|
|
73137
|
+
}
|
|
73138
|
+
if (missingEntries && missingEntries.length > 0) {
|
|
73139
|
+
if (isVerbose) {
|
|
73140
|
+
debugLog(
|
|
73141
|
+
"verbose",
|
|
73142
|
+
`DOM selection rects: range missing entries ${JSON.stringify({
|
|
73143
|
+
pageIndex,
|
|
73144
|
+
sliceFrom,
|
|
73145
|
+
sliceTo,
|
|
73146
|
+
missingCount: missingEntries.length,
|
|
73147
|
+
missingPreview: missingEntries.slice(0, 20).map(entryDebugInfo)
|
|
73148
|
+
})}`
|
|
73149
|
+
);
|
|
73150
|
+
}
|
|
73151
|
+
rawRects = collectClientRectsByLine(doc2, sliceEntries, sliceFrom, sliceTo);
|
|
73152
|
+
if (dumpRects) {
|
|
73153
|
+
debugLog(
|
|
73154
|
+
"verbose",
|
|
73155
|
+
`DOM selection rects: fallback raw rects ${JSON.stringify({
|
|
73156
|
+
pageIndex,
|
|
73157
|
+
sliceFrom,
|
|
73158
|
+
sliceTo,
|
|
73159
|
+
rects: rawRects.map(rectDebugInfo)
|
|
73160
|
+
})}`
|
|
73161
|
+
);
|
|
73162
|
+
}
|
|
73163
|
+
}
|
|
73164
|
+
clientRects = disableRectDedupe ? rawRects : deduplicateOverlappingRects(rawRects);
|
|
73165
|
+
if (dumpRects) {
|
|
73166
|
+
debugLog(
|
|
73167
|
+
"verbose",
|
|
73168
|
+
`DOM selection rects: final rects ${JSON.stringify({
|
|
73169
|
+
pageIndex,
|
|
73170
|
+
sliceFrom,
|
|
73171
|
+
sliceTo,
|
|
73172
|
+
dedupeDisabled: disableRectDedupe,
|
|
73173
|
+
rects: clientRects.map(rectDebugInfo)
|
|
73174
|
+
})}`
|
|
73175
|
+
);
|
|
73176
|
+
const nonPositive = clientRects.filter(
|
|
73177
|
+
(rect) => !Number.isFinite(rect.width) || !Number.isFinite(rect.height) || rect.width <= 0 || rect.height <= 0
|
|
73178
|
+
);
|
|
73179
|
+
if (nonPositive.length > 0) {
|
|
73180
|
+
debugLog(
|
|
73181
|
+
"verbose",
|
|
73182
|
+
`DOM selection rects: non-positive rects ${JSON.stringify({
|
|
73183
|
+
pageIndex,
|
|
73184
|
+
sliceFrom,
|
|
73185
|
+
sliceTo,
|
|
73186
|
+
rects: nonPositive.map(rectDebugInfo)
|
|
73187
|
+
})}`
|
|
73188
|
+
);
|
|
73189
|
+
}
|
|
73190
|
+
}
|
|
72111
73191
|
} catch (error) {
|
|
72112
73192
|
debugLog("warn", "DOM selection rects: getClientRects failed", { error: String(error) });
|
|
72113
73193
|
return null;
|
|
@@ -72131,6 +73211,57 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72131
73211
|
}
|
|
72132
73212
|
return out;
|
|
72133
73213
|
}
|
|
73214
|
+
function collectClientRectsByLine(doc2, entries, sliceFrom, sliceTo) {
|
|
73215
|
+
const rects = [];
|
|
73216
|
+
const lineMap = /* @__PURE__ */ new Map();
|
|
73217
|
+
const looseEntries = [];
|
|
73218
|
+
for (const entry of entries) {
|
|
73219
|
+
const lineEl = entry.el.closest(".superdoc-line");
|
|
73220
|
+
if (!lineEl) {
|
|
73221
|
+
looseEntries.push(entry);
|
|
73222
|
+
continue;
|
|
73223
|
+
}
|
|
73224
|
+
const list = lineMap.get(lineEl);
|
|
73225
|
+
if (list) {
|
|
73226
|
+
list.push(entry);
|
|
73227
|
+
} else {
|
|
73228
|
+
lineMap.set(lineEl, [entry]);
|
|
73229
|
+
}
|
|
73230
|
+
}
|
|
73231
|
+
for (const [, lineEntries] of lineMap) {
|
|
73232
|
+
lineEntries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
73233
|
+
const linePmStart = lineEntries[0]?.pmStart ?? Infinity;
|
|
73234
|
+
const linePmEnd = lineEntries[lineEntries.length - 1]?.pmEnd ?? -Infinity;
|
|
73235
|
+
if (!Number.isFinite(linePmStart) || !Number.isFinite(linePmEnd) || linePmEnd <= linePmStart) continue;
|
|
73236
|
+
const lineFrom = Math.max(sliceFrom, linePmStart);
|
|
73237
|
+
const lineTo = Math.min(sliceTo, linePmEnd);
|
|
73238
|
+
if (lineFrom >= lineTo) continue;
|
|
73239
|
+
const startEntry = lineEntries.find((entry) => lineFrom >= entry.pmStart && lineFrom <= entry.pmEnd) ?? lineEntries[0];
|
|
73240
|
+
const endEntry = lineEntries.find((entry) => lineTo >= entry.pmStart && lineTo <= entry.pmEnd) ?? lineEntries[lineEntries.length - 1];
|
|
73241
|
+
const range2 = doc2.createRange();
|
|
73242
|
+
try {
|
|
73243
|
+
if (!setDomRangeStart(range2, startEntry, lineFrom)) continue;
|
|
73244
|
+
if (!setDomRangeEnd(range2, endEntry, lineTo)) continue;
|
|
73245
|
+
} catch {
|
|
73246
|
+
continue;
|
|
73247
|
+
}
|
|
73248
|
+
rects.push(...Array.from(range2.getClientRects()));
|
|
73249
|
+
}
|
|
73250
|
+
for (const entry of looseEntries) {
|
|
73251
|
+
const entryFrom = Math.max(sliceFrom, entry.pmStart);
|
|
73252
|
+
const entryTo = Math.min(sliceTo, entry.pmEnd);
|
|
73253
|
+
if (entryFrom >= entryTo) continue;
|
|
73254
|
+
const range2 = doc2.createRange();
|
|
73255
|
+
try {
|
|
73256
|
+
if (!setDomRangeStart(range2, entry, entryFrom)) continue;
|
|
73257
|
+
if (!setDomRangeEnd(range2, entry, entryTo)) continue;
|
|
73258
|
+
} catch {
|
|
73259
|
+
continue;
|
|
73260
|
+
}
|
|
73261
|
+
rects.push(...Array.from(range2.getClientRects()));
|
|
73262
|
+
}
|
|
73263
|
+
return rects;
|
|
73264
|
+
}
|
|
72134
73265
|
function setDomRangeStart(range2, entry, pos) {
|
|
72135
73266
|
const el = entry.el;
|
|
72136
73267
|
const pmStart = entry.pmStart;
|
|
@@ -72240,31 +73371,69 @@ function deduplicateOverlappingRects(rects) {
|
|
|
72240
73371
|
return a.x - b2.x;
|
|
72241
73372
|
});
|
|
72242
73373
|
const result = [];
|
|
72243
|
-
|
|
72244
|
-
|
|
72245
|
-
|
|
72246
|
-
|
|
72247
|
-
|
|
72248
|
-
|
|
72249
|
-
|
|
72250
|
-
|
|
72251
|
-
|
|
72252
|
-
|
|
72253
|
-
|
|
72254
|
-
|
|
72255
|
-
|
|
72256
|
-
|
|
72257
|
-
|
|
72258
|
-
|
|
72259
|
-
|
|
72260
|
-
|
|
72261
|
-
|
|
72262
|
-
|
|
72263
|
-
|
|
73374
|
+
const groups = [];
|
|
73375
|
+
let currentGroup = [];
|
|
73376
|
+
for (const rect of sorted) {
|
|
73377
|
+
if (currentGroup.length === 0) {
|
|
73378
|
+
currentGroup.push(rect);
|
|
73379
|
+
continue;
|
|
73380
|
+
}
|
|
73381
|
+
const groupY = currentGroup[0].y;
|
|
73382
|
+
if (Math.abs(rect.y - groupY) <= Y_SAME_LINE_THRESHOLD_PX) {
|
|
73383
|
+
currentGroup.push(rect);
|
|
73384
|
+
} else {
|
|
73385
|
+
groups.push(currentGroup);
|
|
73386
|
+
currentGroup = [rect];
|
|
73387
|
+
}
|
|
73388
|
+
}
|
|
73389
|
+
if (currentGroup.length > 0) {
|
|
73390
|
+
groups.push(currentGroup);
|
|
73391
|
+
}
|
|
73392
|
+
const SIZE_EPS_PX = 0.5;
|
|
73393
|
+
const X_DUPLICATE_EPS_PX = 1;
|
|
73394
|
+
const hasSignificantOverlap = (a, b2) => {
|
|
73395
|
+
const xOverlapStart = Math.max(a.x, b2.x);
|
|
73396
|
+
const xOverlapEnd = Math.min(a.x + a.width, b2.x + b2.width);
|
|
73397
|
+
const hasHorizontalOverlap = xOverlapEnd > xOverlapStart;
|
|
73398
|
+
if (!hasHorizontalOverlap) return false;
|
|
73399
|
+
const overlapWidth = Math.max(0, xOverlapEnd - xOverlapStart);
|
|
73400
|
+
const minWidth = Math.min(a.width, b2.width);
|
|
73401
|
+
return minWidth > 0 && overlapWidth / minWidth > HORIZONTAL_OVERLAP_THRESHOLD;
|
|
73402
|
+
};
|
|
73403
|
+
const isLargerRect = (a, b2) => {
|
|
73404
|
+
return a.width > b2.width + SIZE_EPS_PX || a.height > b2.height + SIZE_EPS_PX;
|
|
73405
|
+
};
|
|
73406
|
+
for (const group of groups) {
|
|
73407
|
+
const unique2 = [];
|
|
73408
|
+
for (const rect of group) {
|
|
73409
|
+
const isDuplicate = unique2.some((existing) => {
|
|
73410
|
+
const xClose = Math.abs(existing.x - rect.x) <= X_DUPLICATE_EPS_PX;
|
|
73411
|
+
const yClose = Math.abs(existing.y - rect.y) <= Y_SAME_LINE_THRESHOLD_PX;
|
|
73412
|
+
const widthClose = Math.abs(existing.width - rect.width) <= SIZE_EPS_PX;
|
|
73413
|
+
const heightClose = Math.abs(existing.height - rect.height) <= SIZE_EPS_PX;
|
|
73414
|
+
return xClose && yClose && widthClose && heightClose;
|
|
73415
|
+
});
|
|
73416
|
+
if (!isDuplicate) {
|
|
73417
|
+
unique2.push(rect);
|
|
72264
73418
|
}
|
|
72265
73419
|
}
|
|
72266
|
-
|
|
72267
|
-
|
|
73420
|
+
if (unique2.length <= 1) {
|
|
73421
|
+
result.push(...unique2);
|
|
73422
|
+
continue;
|
|
73423
|
+
}
|
|
73424
|
+
const containers = /* @__PURE__ */ new Set();
|
|
73425
|
+
for (const rect of unique2) {
|
|
73426
|
+
for (const other of unique2) {
|
|
73427
|
+
if (rect === other) continue;
|
|
73428
|
+
if (!hasSignificantOverlap(rect, other)) continue;
|
|
73429
|
+
if (isLargerRect(rect, other)) {
|
|
73430
|
+
containers.add(rect);
|
|
73431
|
+
break;
|
|
73432
|
+
}
|
|
73433
|
+
}
|
|
73434
|
+
}
|
|
73435
|
+
const filtered = unique2.filter((rect) => !containers.has(rect));
|
|
73436
|
+
result.push(...filtered.length > 0 ? filtered : unique2);
|
|
72268
73437
|
}
|
|
72269
73438
|
return result;
|
|
72270
73439
|
}
|
|
@@ -72388,10 +73557,11 @@ function safeCleanup(fn2, context) {
|
|
|
72388
73557
|
function createHiddenHost(doc2, widthPx) {
|
|
72389
73558
|
const host = doc2.createElement("div");
|
|
72390
73559
|
host.className = "presentation-editor__hidden-host";
|
|
72391
|
-
host.style.position = "
|
|
73560
|
+
host.style.position = "fixed";
|
|
72392
73561
|
host.style.left = "-9999px";
|
|
72393
73562
|
host.style.top = "0";
|
|
72394
73563
|
host.style.width = `${widthPx}px`;
|
|
73564
|
+
host.style.setProperty("overflow-anchor", "none");
|
|
72395
73565
|
host.style.pointerEvents = "none";
|
|
72396
73566
|
host.style.opacity = "0";
|
|
72397
73567
|
host.style.zIndex = "-1";
|
|
@@ -72865,7 +74035,8 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72865
74035
|
});
|
|
72866
74036
|
let hitChain = [];
|
|
72867
74037
|
const doc2 = document;
|
|
72868
|
-
|
|
74038
|
+
const hasElementsFromPoint = typeof doc2.elementsFromPoint === "function";
|
|
74039
|
+
if (hasElementsFromPoint) {
|
|
72869
74040
|
try {
|
|
72870
74041
|
hitChain = doc2.elementsFromPoint(viewX, viewY) ?? [];
|
|
72871
74042
|
} catch {
|
|
@@ -72911,11 +74082,14 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72911
74082
|
log("All fragments on page:", JSON.stringify(fragmentData, null, 2));
|
|
72912
74083
|
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
|
|
72913
74084
|
if (!fragmentEl) {
|
|
74085
|
+
if (hasElementsFromPoint) {
|
|
74086
|
+
return null;
|
|
74087
|
+
}
|
|
72914
74088
|
const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
|
|
72915
74089
|
if (!fallbackFragment) {
|
|
72916
74090
|
return null;
|
|
72917
74091
|
}
|
|
72918
|
-
log("Using fallback fragment:", {
|
|
74092
|
+
log("Using fallback fragment (no elementsFromPoint):", {
|
|
72919
74093
|
blockId: fallbackFragment.dataset.blockId,
|
|
72920
74094
|
pmStart: fallbackFragment.dataset.pmStart,
|
|
72921
74095
|
pmEnd: fallbackFragment.dataset.pmEnd
|
|
@@ -80526,9 +81700,9 @@ function getAtomNodeTypes(schema) {
|
|
|
80526
81700
|
}
|
|
80527
81701
|
return types2;
|
|
80528
81702
|
}
|
|
80529
|
-
const isObject$
|
|
81703
|
+
const isObject$3 = (value) => typeof value === "object" && value !== null;
|
|
80530
81704
|
function buildPositionMapFromPmDoc(pmDoc, jsonDoc) {
|
|
80531
|
-
if (!pmDoc || !isObject$
|
|
81705
|
+
if (!pmDoc || !isObject$3(jsonDoc)) return null;
|
|
80532
81706
|
const map22 = /* @__PURE__ */ new WeakMap();
|
|
80533
81707
|
const walk = (pmNode, jsonNode, pos, isDoc) => {
|
|
80534
81708
|
const jsonType = jsonNode.type;
|
|
@@ -80549,7 +81723,7 @@ function buildPositionMapFromPmDoc(pmDoc, jsonDoc) {
|
|
|
80549
81723
|
let ok2 = true;
|
|
80550
81724
|
pmNode.forEach((child, offset2, index2) => {
|
|
80551
81725
|
const jsonChild = jsonContent[index2];
|
|
80552
|
-
if (!isObject$
|
|
81726
|
+
if (!isObject$3(jsonChild)) {
|
|
80553
81727
|
ok2 = false;
|
|
80554
81728
|
return;
|
|
80555
81729
|
}
|
|
@@ -84953,13 +86127,13 @@ const inferBooleanFromParagraphElements = (paragraphProps, elementNames) => {
|
|
|
84953
86127
|
(name) => name.startsWith("w:") ? [name, name.slice(2)] : [name, `w:${name}`]
|
|
84954
86128
|
)
|
|
84955
86129
|
);
|
|
84956
|
-
const
|
|
86130
|
+
const match2 = elements.find((el) => {
|
|
84957
86131
|
if (!el || typeof el !== "object") return false;
|
|
84958
86132
|
const name = el.name;
|
|
84959
86133
|
return typeof name === "string" && normalizedTargets.has(name);
|
|
84960
86134
|
});
|
|
84961
|
-
if (!
|
|
84962
|
-
const rawVal =
|
|
86135
|
+
if (!match2) return void 0;
|
|
86136
|
+
const rawVal = match2.attributes?.["w:val"] ?? match2.attributes?.val;
|
|
84963
86137
|
if (rawVal == null) return true;
|
|
84964
86138
|
if (isExplicitFalse(rawVal)) return false;
|
|
84965
86139
|
if (isTruthy(rawVal)) return true;
|
|
@@ -86494,11 +87668,11 @@ const toPxNumber = (value) => {
|
|
|
86494
87668
|
if (typeof raw === "number" && Number.isFinite(raw)) return raw;
|
|
86495
87669
|
if (typeof raw !== "string") return void 0;
|
|
86496
87670
|
const trimmed = raw.trim();
|
|
86497
|
-
const
|
|
86498
|
-
if (!
|
|
86499
|
-
const numeric = parseFloat(
|
|
87671
|
+
const match2 = trimmed.match(/^(-?\d+(\.\d+)?)([a-z%]*)$/i);
|
|
87672
|
+
if (!match2) return void 0;
|
|
87673
|
+
const numeric = parseFloat(match2[1]);
|
|
86500
87674
|
if (!Number.isFinite(numeric)) return void 0;
|
|
86501
|
-
const unit =
|
|
87675
|
+
const unit = match2[3]?.toLowerCase();
|
|
86502
87676
|
if (!unit || unit === "px") return numeric;
|
|
86503
87677
|
if (unit === "pt") return numeric * PT_TO_PX;
|
|
86504
87678
|
return numeric;
|
|
@@ -90606,8 +91780,8 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
90606
91780
|
}
|
|
90607
91781
|
}
|
|
90608
91782
|
for (let wordIndex = 0; wordIndex < words.length; wordIndex++) {
|
|
90609
|
-
const
|
|
90610
|
-
if (
|
|
91783
|
+
const word2 = words[wordIndex];
|
|
91784
|
+
if (word2 === "") {
|
|
90611
91785
|
const spaceStartChar = charPosInRun;
|
|
90612
91786
|
const spaceEndChar = charPosInRun + 1;
|
|
90613
91787
|
const singleSpaceWidth = measureRunWidth(" ", font, ctx2, run2);
|
|
@@ -90661,15 +91835,15 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
90661
91835
|
charPosInRun = spaceEndChar;
|
|
90662
91836
|
continue;
|
|
90663
91837
|
}
|
|
90664
|
-
const wordOnlyWidth = measureRunWidth(
|
|
91838
|
+
const wordOnlyWidth = measureRunWidth(word2, font, ctx2, run2);
|
|
90665
91839
|
const shouldIncludeDelimiterSpace = wordIndex < lastNonEmptyWordIndex;
|
|
90666
91840
|
const spaceWidth = shouldIncludeDelimiterSpace ? measureRunWidth(" ", font, ctx2, run2) : 0;
|
|
90667
91841
|
const wordCommitWidth = wordOnlyWidth + spaceWidth;
|
|
90668
91842
|
const wordStartChar = charPosInRun;
|
|
90669
|
-
const wordEndNoSpace = charPosInRun +
|
|
91843
|
+
const wordEndNoSpace = charPosInRun + word2.length;
|
|
90670
91844
|
const wordEndWithSpace = wordEndNoSpace + (shouldIncludeDelimiterSpace ? 1 : 0);
|
|
90671
91845
|
const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
90672
|
-
if (wordOnlyWidth > effectiveMaxWidth &&
|
|
91846
|
+
if (wordOnlyWidth > effectiveMaxWidth && word2.length > 1) {
|
|
90673
91847
|
if (currentLine && currentLine.width > 0 && currentLine.segments && currentLine.segments.length > 0) {
|
|
90674
91848
|
trimTrailingWrapSpaces(currentLine);
|
|
90675
91849
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
@@ -90685,7 +91859,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
90685
91859
|
const hasTabOnlyLine = currentLine && currentLine.segments && currentLine.segments.length === 0 && currentLine.width > 0;
|
|
90686
91860
|
const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
|
|
90687
91861
|
const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
|
|
90688
|
-
const chunks = breakWordIntoChunks(
|
|
91862
|
+
const chunks = breakWordIntoChunks(word2, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run2);
|
|
90689
91863
|
let chunkCharOffset = wordStartChar;
|
|
90690
91864
|
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
90691
91865
|
const chunk = chunks[chunkIndex];
|
|
@@ -91360,10 +92534,10 @@ const measureRunWidth = (text, font, ctx2, run2) => {
|
|
|
91360
92534
|
const width = getMeasuredTextWidth(text, font, letterSpacing, ctx2);
|
|
91361
92535
|
return roundValue(width);
|
|
91362
92536
|
};
|
|
91363
|
-
const breakWordIntoChunks = (
|
|
92537
|
+
const breakWordIntoChunks = (word2, maxWidth, font, ctx2, run2) => {
|
|
91364
92538
|
const chunks = [];
|
|
91365
92539
|
if (maxWidth <= 0) {
|
|
91366
|
-
for (const char of
|
|
92540
|
+
for (const char of word2) {
|
|
91367
92541
|
const charWidth = measureRunWidth(char, font, ctx2, run2);
|
|
91368
92542
|
chunks.push({ text: char, width: charWidth });
|
|
91369
92543
|
}
|
|
@@ -91371,8 +92545,8 @@ const breakWordIntoChunks = (word, maxWidth, font, ctx2, run2) => {
|
|
|
91371
92545
|
}
|
|
91372
92546
|
let currentChunk = "";
|
|
91373
92547
|
let currentWidth = 0;
|
|
91374
|
-
for (let i = 0; i <
|
|
91375
|
-
const char =
|
|
92548
|
+
for (let i = 0; i < word2.length; i++) {
|
|
92549
|
+
const char = word2[i];
|
|
91376
92550
|
const testChunk = currentChunk + char;
|
|
91377
92551
|
const testWidth = measureRunWidth(testChunk, font, ctx2, run2);
|
|
91378
92552
|
if (testWidth > maxWidth && currentChunk.length > 0) {
|
|
@@ -91945,6 +93119,25 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91945
93119
|
} else {
|
|
91946
93120
|
__privateSet(this, _dragExtensionMode, "char");
|
|
91947
93121
|
}
|
|
93122
|
+
debugLog(
|
|
93123
|
+
"verbose",
|
|
93124
|
+
`Drag selection start ${JSON.stringify({
|
|
93125
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: x2, y: y2 },
|
|
93126
|
+
clickDepth,
|
|
93127
|
+
extensionMode: __privateGet$1(this, _dragExtensionMode),
|
|
93128
|
+
anchor: __privateGet$1(this, _dragAnchor),
|
|
93129
|
+
anchorPageIndex: __privateGet$1(this, _dragAnchorPageIndex),
|
|
93130
|
+
rawHit: rawHit ? {
|
|
93131
|
+
pos: rawHit.pos,
|
|
93132
|
+
pageIndex: rawHit.pageIndex,
|
|
93133
|
+
blockId: rawHit.blockId,
|
|
93134
|
+
lineIndex: rawHit.lineIndex,
|
|
93135
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
93136
|
+
} : null,
|
|
93137
|
+
mapped: mapped ? mapped.ok ? { ok: true, pos: mapped.pos, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : { ok: false, reason: mapped.reason, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : null,
|
|
93138
|
+
hit: hit ? { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch } : null
|
|
93139
|
+
})}`
|
|
93140
|
+
);
|
|
91948
93141
|
if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
|
|
91949
93142
|
__privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
|
|
91950
93143
|
}
|
|
@@ -91981,6 +93174,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91981
93174
|
if (!normalized) return;
|
|
91982
93175
|
if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
|
|
91983
93176
|
__privateSet(this, _pendingMarginClick, null);
|
|
93177
|
+
const prevPointer = __privateGet$1(this, _dragLastPointer);
|
|
93178
|
+
const prevRawHit = __privateGet$1(this, _dragLastRawHit);
|
|
91984
93179
|
__privateSet(this, _dragLastPointer, { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y });
|
|
91985
93180
|
const rawHit = clickToPosition(
|
|
91986
93181
|
__privateGet$1(this, _layoutState).layout,
|
|
@@ -91992,7 +93187,17 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91992
93187
|
event.clientY,
|
|
91993
93188
|
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
91994
93189
|
);
|
|
91995
|
-
if (!rawHit)
|
|
93190
|
+
if (!rawHit) {
|
|
93191
|
+
debugLog(
|
|
93192
|
+
"verbose",
|
|
93193
|
+
`Drag selection update (no hit) ${JSON.stringify({
|
|
93194
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
93195
|
+
prevPointer,
|
|
93196
|
+
anchor: __privateGet$1(this, _dragAnchor)
|
|
93197
|
+
})}`
|
|
93198
|
+
);
|
|
93199
|
+
return;
|
|
93200
|
+
}
|
|
91996
93201
|
const doc22 = __privateGet$1(this, _editor3).state?.doc;
|
|
91997
93202
|
if (!doc22) return;
|
|
91998
93203
|
__privateSet(this, _dragLastRawHit, rawHit);
|
|
@@ -92005,6 +93210,27 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92005
93210
|
const mappedHead = __privateGet$1(this, _epochMapper).mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1);
|
|
92006
93211
|
if (!mappedHead.ok) {
|
|
92007
93212
|
debugLog("warn", "drag mapping failed", mappedHead);
|
|
93213
|
+
debugLog(
|
|
93214
|
+
"verbose",
|
|
93215
|
+
`Drag selection update (map failed) ${JSON.stringify({
|
|
93216
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
93217
|
+
prevPointer,
|
|
93218
|
+
anchor: __privateGet$1(this, _dragAnchor),
|
|
93219
|
+
rawHit: {
|
|
93220
|
+
pos: rawHit.pos,
|
|
93221
|
+
pageIndex: rawHit.pageIndex,
|
|
93222
|
+
blockId: rawHit.blockId,
|
|
93223
|
+
lineIndex: rawHit.lineIndex,
|
|
93224
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
93225
|
+
},
|
|
93226
|
+
mapped: {
|
|
93227
|
+
ok: false,
|
|
93228
|
+
reason: mappedHead.reason,
|
|
93229
|
+
fromEpoch: mappedHead.fromEpoch,
|
|
93230
|
+
toEpoch: mappedHead.toEpoch
|
|
93231
|
+
}
|
|
93232
|
+
})}`
|
|
93233
|
+
);
|
|
92008
93234
|
return;
|
|
92009
93235
|
}
|
|
92010
93236
|
const hit = {
|
|
@@ -92019,6 +93245,41 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92019
93245
|
mappedPos: hit.pos
|
|
92020
93246
|
});
|
|
92021
93247
|
__privateMethod$1(this, _PresentationEditor_instances, updateSelectionDebugHud_fn).call(this);
|
|
93248
|
+
const anchor = __privateGet$1(this, _dragAnchor);
|
|
93249
|
+
const head = hit.pos;
|
|
93250
|
+
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
93251
|
+
debugLog(
|
|
93252
|
+
"verbose",
|
|
93253
|
+
`Drag selection update ${JSON.stringify({
|
|
93254
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
93255
|
+
prevPointer,
|
|
93256
|
+
rawHit: {
|
|
93257
|
+
pos: rawHit.pos,
|
|
93258
|
+
pageIndex: rawHit.pageIndex,
|
|
93259
|
+
blockId: rawHit.blockId,
|
|
93260
|
+
lineIndex: rawHit.lineIndex,
|
|
93261
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
93262
|
+
},
|
|
93263
|
+
prevRawHit: prevRawHit ? {
|
|
93264
|
+
pos: prevRawHit.pos,
|
|
93265
|
+
pageIndex: prevRawHit.pageIndex,
|
|
93266
|
+
blockId: prevRawHit.blockId,
|
|
93267
|
+
lineIndex: prevRawHit.lineIndex,
|
|
93268
|
+
layoutEpoch: prevRawHit.layoutEpoch
|
|
93269
|
+
} : null,
|
|
93270
|
+
mappedHead: { pos: mappedHead.pos, fromEpoch: mappedHead.fromEpoch, toEpoch: mappedHead.toEpoch },
|
|
93271
|
+
hit: { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch },
|
|
93272
|
+
anchor,
|
|
93273
|
+
head,
|
|
93274
|
+
selAnchor,
|
|
93275
|
+
selHead,
|
|
93276
|
+
direction: head >= anchor ? "down" : "up",
|
|
93277
|
+
selectionDirection: selHead >= selAnchor ? "down" : "up",
|
|
93278
|
+
extensionMode: __privateGet$1(this, _dragExtensionMode),
|
|
93279
|
+
hitSource: pageMounted ? "dom" : "geometry",
|
|
93280
|
+
pageMounted
|
|
93281
|
+
})}`
|
|
93282
|
+
);
|
|
92022
93283
|
const currentTableHit = __privateMethod$1(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
92023
93284
|
const shouldUseCellSel = __privateMethod$1(this, _PresentationEditor_instances, shouldUseCellSelection_fn).call(this, currentTableHit);
|
|
92024
93285
|
if (shouldUseCellSel && __privateGet$1(this, _cellAnchor)) {
|
|
@@ -92053,9 +93314,6 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92053
93314
|
return;
|
|
92054
93315
|
}
|
|
92055
93316
|
}
|
|
92056
|
-
const anchor = __privateGet$1(this, _dragAnchor);
|
|
92057
|
-
const head = hit.pos;
|
|
92058
|
-
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
92059
93317
|
try {
|
|
92060
93318
|
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
|
|
92061
93319
|
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
@@ -92450,6 +93708,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92450
93708
|
editorProps: normalizedEditorProps,
|
|
92451
93709
|
documentMode: __privateGet$1(this, _documentMode)
|
|
92452
93710
|
}));
|
|
93711
|
+
__privateMethod$1(this, _PresentationEditor_instances, wrapHiddenEditorFocus_fn).call(this);
|
|
92453
93712
|
__privateGet$1(this, _editor3).presentationEditor = this;
|
|
92454
93713
|
__privateGet$1(this, _editor3)._presentationEditor = this;
|
|
92455
93714
|
__privateMethod$1(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
|
|
@@ -93649,6 +94908,65 @@ _scrollTimeout = /* @__PURE__ */ new WeakMap();
|
|
|
93649
94908
|
_lastRemoteCursorRenderTime = /* @__PURE__ */ new WeakMap();
|
|
93650
94909
|
_remoteCursorThrottleTimeout = /* @__PURE__ */ new WeakMap();
|
|
93651
94910
|
_PresentationEditor_instances = /* @__PURE__ */ new WeakSet();
|
|
94911
|
+
wrapHiddenEditorFocus_fn = function() {
|
|
94912
|
+
const view = __privateGet$1(this, _editor3)?.view;
|
|
94913
|
+
if (!view || !view.dom || typeof view.focus !== "function") {
|
|
94914
|
+
return;
|
|
94915
|
+
}
|
|
94916
|
+
const viewWithFlag = view;
|
|
94917
|
+
if (viewWithFlag.__sdPreventScrollFocus) {
|
|
94918
|
+
return;
|
|
94919
|
+
}
|
|
94920
|
+
const focusFn = view.focus;
|
|
94921
|
+
if (focusFn.mock) {
|
|
94922
|
+
return;
|
|
94923
|
+
}
|
|
94924
|
+
viewWithFlag.__sdPreventScrollFocus = true;
|
|
94925
|
+
const originalFocus = view.focus.bind(view);
|
|
94926
|
+
view.focus = () => {
|
|
94927
|
+
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView;
|
|
94928
|
+
if (!win) {
|
|
94929
|
+
originalFocus();
|
|
94930
|
+
return;
|
|
94931
|
+
}
|
|
94932
|
+
const beforeX = win.scrollX;
|
|
94933
|
+
const beforeY = win.scrollY;
|
|
94934
|
+
let focused = false;
|
|
94935
|
+
try {
|
|
94936
|
+
view.dom.focus({ preventScroll: true });
|
|
94937
|
+
focused = true;
|
|
94938
|
+
} catch (error) {
|
|
94939
|
+
debugLog("warn", "Hidden editor focus: preventScroll failed", {
|
|
94940
|
+
error: String(error),
|
|
94941
|
+
strategy: "preventScroll"
|
|
94942
|
+
});
|
|
94943
|
+
}
|
|
94944
|
+
if (!focused) {
|
|
94945
|
+
try {
|
|
94946
|
+
view.dom.focus();
|
|
94947
|
+
focused = true;
|
|
94948
|
+
} catch (error) {
|
|
94949
|
+
debugLog("warn", "Hidden editor focus: standard focus failed", {
|
|
94950
|
+
error: String(error),
|
|
94951
|
+
strategy: "standard"
|
|
94952
|
+
});
|
|
94953
|
+
}
|
|
94954
|
+
}
|
|
94955
|
+
if (!focused) {
|
|
94956
|
+
try {
|
|
94957
|
+
originalFocus();
|
|
94958
|
+
} catch (error) {
|
|
94959
|
+
debugLog("error", "Hidden editor focus: all strategies failed", {
|
|
94960
|
+
error: String(error),
|
|
94961
|
+
strategy: "original"
|
|
94962
|
+
});
|
|
94963
|
+
}
|
|
94964
|
+
}
|
|
94965
|
+
if (win.scrollX !== beforeX || win.scrollY !== beforeY) {
|
|
94966
|
+
win.scrollTo(beforeX, beforeY);
|
|
94967
|
+
}
|
|
94968
|
+
};
|
|
94969
|
+
};
|
|
93652
94970
|
collectCommentPositions_fn = function() {
|
|
93653
94971
|
return collectCommentPositions(__privateGet$1(this, _editor3)?.state?.doc ?? null, {
|
|
93654
94972
|
commentMarkName: CommentMarkName,
|
|
@@ -95163,8 +96481,8 @@ resolveDescriptorForRegion_fn = function(region) {
|
|
|
95163
96481
|
}
|
|
95164
96482
|
if (region.sectionType) {
|
|
95165
96483
|
const descriptors2 = __privateGet$1(this, _headerFooterManager).getDescriptors(region.kind);
|
|
95166
|
-
const
|
|
95167
|
-
if (
|
|
96484
|
+
const match2 = descriptors2.find((entry) => entry.variant === region.sectionType);
|
|
96485
|
+
if (match2) return match2;
|
|
95168
96486
|
}
|
|
95169
96487
|
const descriptors = __privateGet$1(this, _headerFooterManager).getDescriptors(region.kind);
|
|
95170
96488
|
if (!descriptors.length) {
|
|
@@ -98406,7 +99724,7 @@ const Document = Node$1.create({
|
|
|
98406
99724
|
*/
|
|
98407
99725
|
getDocumentStats: () => ({ editor }) => {
|
|
98408
99726
|
const text = editor.getText();
|
|
98409
|
-
const words = text.split(/\s+/).filter((
|
|
99727
|
+
const words = text.split(/\s+/).filter((word2) => word2.length > 0).length;
|
|
98410
99728
|
const characters = text.length;
|
|
98411
99729
|
const paragraphs = editor.state.doc.content.childCount;
|
|
98412
99730
|
return {
|
|
@@ -98522,9 +99840,9 @@ const buildWrapTransaction = (state2, ranges, runType) => {
|
|
|
98522
99840
|
ranges.forEach(({ from: from2, to }) => {
|
|
98523
99841
|
state2.doc.nodesBetween(from2, to, (node, pos, parent, index2) => {
|
|
98524
99842
|
if (!node.isText || !parent || parent.type === runType) return;
|
|
98525
|
-
const
|
|
98526
|
-
if (
|
|
98527
|
-
if (!
|
|
99843
|
+
const match2 = parent.contentMatchAt ? parent.contentMatchAt(index2) : null;
|
|
99844
|
+
if (match2 && !match2.matchType(runType)) return;
|
|
99845
|
+
if (!match2 && !parent.type.contentMatch.matchType(runType)) return;
|
|
98528
99846
|
const runProperties = decodeRPrFromMarks(node.marks);
|
|
98529
99847
|
const runNode = runType.create({ runProperties }, node);
|
|
98530
99848
|
replacements.push({ from: pos, to: pos + node.nodeSize, runNode });
|
|
@@ -101221,8 +102539,8 @@ const Table = Node$1.create({
|
|
|
101221
102539
|
let resolvedTablePos = tablePos;
|
|
101222
102540
|
if (typeof resolvedTablePos !== "number" && workingTable) {
|
|
101223
102541
|
const tables = editor.getNodesOfType("table");
|
|
101224
|
-
const
|
|
101225
|
-
resolvedTablePos =
|
|
102542
|
+
const match2 = workingTable ? tables.find((t) => t.node.eq(workingTable)) : tables[0];
|
|
102543
|
+
resolvedTablePos = match2?.pos ?? null;
|
|
101226
102544
|
}
|
|
101227
102545
|
if (typeof resolvedTablePos !== "number") {
|
|
101228
102546
|
return false;
|
|
@@ -112209,8 +113527,8 @@ class Popover {
|
|
|
112209
113527
|
if (from2 < 1) return false;
|
|
112210
113528
|
const textBefore = this.getMentionText(from2);
|
|
112211
113529
|
const mentionPattern = /(?:^|\s)@[\w]*$/;
|
|
112212
|
-
const
|
|
112213
|
-
return
|
|
113530
|
+
const match2 = textBefore.match(mentionPattern);
|
|
113531
|
+
return match2 && this.state.selection.empty;
|
|
112214
113532
|
}
|
|
112215
113533
|
destroy() {
|
|
112216
113534
|
this.tippyInstance.destroy();
|
|
@@ -112288,8 +113606,8 @@ class SearchQuery {
|
|
|
112288
113606
|
let $from = state2.doc.resolve(result.from);
|
|
112289
113607
|
let marks = $from.marksAcross(state2.doc.resolve(result.to));
|
|
112290
113608
|
let ranges = [];
|
|
112291
|
-
let frag = Fragment.empty, pos = result.from, { match } = result;
|
|
112292
|
-
let groups =
|
|
113609
|
+
let frag = Fragment.empty, pos = result.from, { match: match2 } = result;
|
|
113610
|
+
let groups = match2 ? getGroupIndices(match2) : [[0, result.to - result.from]];
|
|
112293
113611
|
let replParts = parseReplacement(this.unquote(this.replace));
|
|
112294
113612
|
for (let part of replParts) {
|
|
112295
113613
|
if (typeof part == "string") {
|
|
@@ -112367,39 +113685,39 @@ class RegExpQuery {
|
|
|
112367
113685
|
return scanTextblocks(state2.doc, from2, to, (node, start2) => {
|
|
112368
113686
|
let content = textContent(node).slice(0, Math.min(node.content.size, to - start2));
|
|
112369
113687
|
this.regexp.lastIndex = from2 - start2;
|
|
112370
|
-
let
|
|
112371
|
-
if (!
|
|
112372
|
-
const absoluteIndex =
|
|
113688
|
+
let match2 = this.regexp.exec(content);
|
|
113689
|
+
if (!match2) return null;
|
|
113690
|
+
const absoluteIndex = match2.index;
|
|
112373
113691
|
const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
|
|
112374
|
-
const toPos = mapIndexToDocPos(node, start2, absoluteIndex +
|
|
112375
|
-
return { from: fromPos, to: toPos, match, matchStart: start2 };
|
|
113692
|
+
const toPos = mapIndexToDocPos(node, start2, absoluteIndex + match2[0].length);
|
|
113693
|
+
return { from: fromPos, to: toPos, match: match2, matchStart: start2 };
|
|
112376
113694
|
});
|
|
112377
113695
|
}
|
|
112378
113696
|
findPrev(state2, from2, to) {
|
|
112379
113697
|
return scanTextblocks(state2.doc, from2, to, (node, start2) => {
|
|
112380
113698
|
let content = textContent(node).slice(0, Math.min(node.content.size, from2 - start2));
|
|
112381
|
-
let
|
|
113699
|
+
let match2;
|
|
112382
113700
|
for (let off2 = 0; ; ) {
|
|
112383
113701
|
this.regexp.lastIndex = off2;
|
|
112384
113702
|
let next = this.regexp.exec(content);
|
|
112385
113703
|
if (!next) break;
|
|
112386
|
-
|
|
113704
|
+
match2 = next;
|
|
112387
113705
|
off2 = next.index + 1;
|
|
112388
113706
|
}
|
|
112389
|
-
if (!
|
|
112390
|
-
const absoluteIndex =
|
|
113707
|
+
if (!match2) return null;
|
|
113708
|
+
const absoluteIndex = match2.index;
|
|
112391
113709
|
const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
|
|
112392
|
-
const toPos = mapIndexToDocPos(node, start2, absoluteIndex +
|
|
112393
|
-
return { from: fromPos, to: toPos, match, matchStart: start2 };
|
|
113710
|
+
const toPos = mapIndexToDocPos(node, start2, absoluteIndex + match2[0].length);
|
|
113711
|
+
return { from: fromPos, to: toPos, match: match2, matchStart: start2 };
|
|
112394
113712
|
});
|
|
112395
113713
|
}
|
|
112396
113714
|
}
|
|
112397
|
-
function getGroupIndices(
|
|
112398
|
-
if (
|
|
112399
|
-
let result = [[0,
|
|
112400
|
-
for (let i = 1, pos = 0; i <
|
|
112401
|
-
let found2 =
|
|
112402
|
-
result.push(found2 < 0 ? void 0 : [found2, pos = found2 +
|
|
113715
|
+
function getGroupIndices(match2) {
|
|
113716
|
+
if (match2.indices) return match2.indices;
|
|
113717
|
+
let result = [[0, match2[0].length]];
|
|
113718
|
+
for (let i = 1, pos = 0; i < match2.length; i++) {
|
|
113719
|
+
let found2 = match2[i] ? match2[0].indexOf(match2[i], pos) : -1;
|
|
113720
|
+
result.push(found2 < 0 ? void 0 : [found2, pos = found2 + match2[i].length]);
|
|
112403
113721
|
}
|
|
112404
113722
|
return result;
|
|
112405
113723
|
}
|
|
@@ -112641,8 +113959,8 @@ const Search = Extension.create({
|
|
|
112641
113959
|
const matches2 = storage?.searchResults;
|
|
112642
113960
|
if (!matches2?.length) return null;
|
|
112643
113961
|
const decorations = matches2.map(
|
|
112644
|
-
(
|
|
112645
|
-
id: `search-match-${
|
|
113962
|
+
(match2) => Decoration.inline(match2.from, match2.to, {
|
|
113963
|
+
id: `search-match-${match2.id}`
|
|
112646
113964
|
})
|
|
112647
113965
|
);
|
|
112648
113966
|
return DecorationSet.create(state2.doc, decorations);
|
|
@@ -112746,10 +114064,10 @@ const Search = Extension.create({
|
|
|
112746
114064
|
* editor.commands.goToSearchResult(searchResults[3])
|
|
112747
114065
|
* @note Scrolls to match and selects it
|
|
112748
114066
|
*/
|
|
112749
|
-
goToSearchResult: (
|
|
114067
|
+
goToSearchResult: (match2) => (
|
|
112750
114068
|
/** @returns {boolean} */
|
|
112751
114069
|
(({ state: state2, dispatch, editor }) => {
|
|
112752
|
-
const { from: from2, to } =
|
|
114070
|
+
const { from: from2, to } = match2;
|
|
112753
114071
|
editor.view.focus();
|
|
112754
114072
|
const tr = state2.tr.setSelection(TextSelection$1.create(state2.doc, from2, to)).scrollIntoView();
|
|
112755
114073
|
dispatch(tr);
|
|
@@ -113489,7 +114807,7 @@ function isMediaOrSupports(selector) {
|
|
|
113489
114807
|
}
|
|
113490
114808
|
const kebabRegex = /[A-Z]/g;
|
|
113491
114809
|
function kebabCase(pattern) {
|
|
113492
|
-
return pattern.replace(kebabRegex, (
|
|
114810
|
+
return pattern.replace(kebabRegex, (match2) => "-" + match2.toLowerCase());
|
|
113493
114811
|
}
|
|
113494
114812
|
function unwrapProperty(prop, indent = " ") {
|
|
113495
114813
|
if (typeof prop === "object" && prop !== null) {
|
|
@@ -113563,16 +114881,16 @@ function loopCNodeListWithCallback(children, options, callback) {
|
|
|
113563
114881
|
});
|
|
113564
114882
|
}
|
|
113565
114883
|
function traverseCNode(node, selectorPaths, styles, instance, params2) {
|
|
113566
|
-
const $
|
|
114884
|
+
const $3 = node.$;
|
|
113567
114885
|
let blockSelector = "";
|
|
113568
|
-
if (!$
|
|
113569
|
-
if (isMediaOrSupports($
|
|
113570
|
-
blockSelector = $
|
|
114886
|
+
if (!$3 || typeof $3 === "string") {
|
|
114887
|
+
if (isMediaOrSupports($3)) {
|
|
114888
|
+
blockSelector = $3;
|
|
113571
114889
|
} else {
|
|
113572
|
-
selectorPaths.push($
|
|
114890
|
+
selectorPaths.push($3);
|
|
113573
114891
|
}
|
|
113574
|
-
} else if (typeof $
|
|
113575
|
-
const selector2 = $
|
|
114892
|
+
} else if (typeof $3 === "function") {
|
|
114893
|
+
const selector2 = $3({
|
|
113576
114894
|
context: instance.context,
|
|
113577
114895
|
props: params2
|
|
113578
114896
|
});
|
|
@@ -113582,16 +114900,16 @@ function traverseCNode(node, selectorPaths, styles, instance, params2) {
|
|
|
113582
114900
|
selectorPaths.push(selector2);
|
|
113583
114901
|
}
|
|
113584
114902
|
} else {
|
|
113585
|
-
if ($
|
|
113586
|
-
$
|
|
113587
|
-
if (!$
|
|
113588
|
-
if (isMediaOrSupports($
|
|
113589
|
-
blockSelector = $
|
|
114903
|
+
if ($3.before)
|
|
114904
|
+
$3.before(instance.context);
|
|
114905
|
+
if (!$3.$ || typeof $3.$ === "string") {
|
|
114906
|
+
if (isMediaOrSupports($3.$)) {
|
|
114907
|
+
blockSelector = $3.$;
|
|
113590
114908
|
} else {
|
|
113591
|
-
selectorPaths.push($
|
|
114909
|
+
selectorPaths.push($3.$);
|
|
113592
114910
|
}
|
|
113593
|
-
} else if ($
|
|
113594
|
-
const selector2 = $
|
|
114911
|
+
} else if ($3.$) {
|
|
114912
|
+
const selector2 = $3.$({
|
|
113595
114913
|
context: instance.context,
|
|
113596
114914
|
props: params2
|
|
113597
114915
|
});
|
|
@@ -113626,8 +114944,8 @@ function traverseCNode(node, selectorPaths, styles, instance, params2) {
|
|
|
113626
114944
|
if (blockSelector) {
|
|
113627
114945
|
styles.push("}");
|
|
113628
114946
|
}
|
|
113629
|
-
if ($
|
|
113630
|
-
$
|
|
114947
|
+
if ($3 && $3.after)
|
|
114948
|
+
$3.after(instance.context);
|
|
113631
114949
|
}
|
|
113632
114950
|
function render$1(node, instance, props) {
|
|
113633
114951
|
const styles = [];
|
|
@@ -113732,10 +115050,10 @@ function wrappedUnmount(options = {}) {
|
|
|
113732
115050
|
const { id, parent } = options;
|
|
113733
115051
|
unmount(this.instance, this, id, parent);
|
|
113734
115052
|
}
|
|
113735
|
-
const createCNode = function(instance, $
|
|
115053
|
+
const createCNode = function(instance, $3, props, children) {
|
|
113736
115054
|
return {
|
|
113737
115055
|
instance,
|
|
113738
|
-
$: $
|
|
115056
|
+
$: $3,
|
|
113739
115057
|
props,
|
|
113740
115058
|
children,
|
|
113741
115059
|
els: [],
|
|
@@ -113744,15 +115062,15 @@ const createCNode = function(instance, $2, props, children) {
|
|
|
113744
115062
|
unmount: wrappedUnmount
|
|
113745
115063
|
};
|
|
113746
115064
|
};
|
|
113747
|
-
const c$2 = function(instance, $
|
|
113748
|
-
if (Array.isArray($
|
|
113749
|
-
return createCNode(instance, { $: null }, null, $
|
|
115065
|
+
const c$2 = function(instance, $3, props, children) {
|
|
115066
|
+
if (Array.isArray($3)) {
|
|
115067
|
+
return createCNode(instance, { $: null }, null, $3);
|
|
113750
115068
|
} else if (Array.isArray(props)) {
|
|
113751
|
-
return createCNode(instance, $
|
|
115069
|
+
return createCNode(instance, $3, null, props);
|
|
113752
115070
|
} else if (Array.isArray(children)) {
|
|
113753
|
-
return createCNode(instance, $
|
|
115071
|
+
return createCNode(instance, $3, props, children);
|
|
113754
115072
|
} else {
|
|
113755
|
-
return createCNode(instance, $
|
|
115073
|
+
return createCNode(instance, $3, props, null);
|
|
113756
115074
|
}
|
|
113757
115075
|
};
|
|
113758
115076
|
function CssRender(config2 = {}) {
|
|
@@ -117601,8 +118919,8 @@ var stringToPath = memoizeCapped(function(string) {
|
|
|
117601
118919
|
if (string.charCodeAt(0) === 46) {
|
|
117602
118920
|
result.push("");
|
|
117603
118921
|
}
|
|
117604
|
-
string.replace(rePropName, function(
|
|
117605
|
-
result.push(quote ? subString.replace(reEscapeChar, "$1") : number ||
|
|
118922
|
+
string.replace(rePropName, function(match2, number, quote, subString) {
|
|
118923
|
+
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match2);
|
|
117606
118924
|
});
|
|
117607
118925
|
return result;
|
|
117608
118926
|
});
|
|
@@ -123601,9 +124919,9 @@ async function processStream(stream, onChunk, onDone) {
|
|
|
123601
124919
|
function getJsonBetweenFencesFromResponse(buffer2) {
|
|
123602
124920
|
try {
|
|
123603
124921
|
const jsonRegex = /```json\s*\n([\s\S]*?)\n\s*```/;
|
|
123604
|
-
const
|
|
123605
|
-
if (
|
|
123606
|
-
const jsonObj = JSON.parse(
|
|
124922
|
+
const match2 = buffer2.match(jsonRegex);
|
|
124923
|
+
if (match2 && match2[1]) {
|
|
124924
|
+
const jsonObj = JSON.parse(match2[1]);
|
|
123607
124925
|
if (jsonObj.custom_prompt && jsonObj.custom_prompt.value !== void 0) {
|
|
123608
124926
|
return jsonObj.custom_prompt.value || "";
|
|
123609
124927
|
}
|
|
@@ -123695,19 +125013,19 @@ function formatDocument(editor) {
|
|
|
123695
125013
|
formatRegistry.rules.forEach((rule) => {
|
|
123696
125014
|
rule.pattern.lastIndex = 0;
|
|
123697
125015
|
const matches2 = [];
|
|
123698
|
-
let
|
|
123699
|
-
while ((
|
|
125016
|
+
let match2;
|
|
125017
|
+
while ((match2 = rule.pattern.exec(docText)) !== null) {
|
|
123700
125018
|
matches2.push({
|
|
123701
125019
|
rule,
|
|
123702
|
-
startPos:
|
|
123703
|
-
endPos:
|
|
123704
|
-
originalText:
|
|
123705
|
-
contentText:
|
|
125020
|
+
startPos: match2.index,
|
|
125021
|
+
endPos: match2.index + match2[0].length,
|
|
125022
|
+
originalText: match2[0],
|
|
125023
|
+
contentText: match2[1]
|
|
123706
125024
|
});
|
|
123707
125025
|
}
|
|
123708
125026
|
matches2.sort((a, b2) => b2.startPos - a.startPos);
|
|
123709
|
-
for (const
|
|
123710
|
-
const { startPos, endPos, originalText, contentText } =
|
|
125027
|
+
for (const match22 of matches2) {
|
|
125028
|
+
const { startPos, endPos, originalText, contentText } = match22;
|
|
123711
125029
|
try {
|
|
123712
125030
|
let tr = editor.state.tr;
|
|
123713
125031
|
const replacement = rule.transform(originalText, contentText, editor);
|