@panphora/clayjs 1.11.1 → 1.11.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/clay.standalone.js +768 -547
- package/package.json +2 -1
- package/src/attrs/save-freeze.js +6 -3
- package/src/core/persist.js +11 -1
- package/src/core/save.js +63 -8
- package/src/core/snapshot.js +8 -16
- package/src/core/source-map.js +61 -19
- package/src/lib/content-dom.js +58 -28
- package/src/lib/ephemeral.js +88 -0
- package/src/lib/extension-noise.js +11 -4
- package/src/lib/mutation.js +4 -1
- package/src/lib/root-attrs.js +24 -1
- package/src/loader.js +2 -0
- package/src/plugins/undo.js +17 -2
- package/src/sync/live-sync.js +8 -6
- package/src/tailwind.js +12 -0
- package/src/vendor/hyper-morph.vendor.js +3 -3
package/dist/clay.standalone.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* clayjs 1.11.
|
|
1
|
+
/* clayjs 1.11.2 standalone build: every clayjs module in one file. https://clayjs.com/offline
|
|
2
2
|
Third-party code inside keeps its own license (Sortable MIT, Squire MIT, DOMPurify Apache-2.0 OR MPL-2.0, MicroModal MIT, parse5 MIT): https://clayjs.com/THIRD-PARTY-NOTICES.md */
|
|
3
3
|
(() => {
|
|
4
4
|
var __create = Object.create;
|
|
@@ -101,12 +101,167 @@
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
// src/lib/region-capabilities.js
|
|
105
|
+
function hasPolicyToken(element, token) {
|
|
106
|
+
if (!element || element.nodeType !== 1) return false;
|
|
107
|
+
const clay5 = element.getAttribute?.("clay");
|
|
108
|
+
return !!(clay5 && clay5.split(/\s+/).includes(token) || element.hasAttribute?.(token));
|
|
109
|
+
}
|
|
110
|
+
function expandsTo(element, token) {
|
|
111
|
+
if (hasPolicyToken(element, token)) return true;
|
|
112
|
+
for (const [bundle, members] of Object.entries(BUNDLES)) {
|
|
113
|
+
if (members.includes(token) && hasPolicyToken(element, bundle)) return true;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
function capabilitySelector(capability) {
|
|
118
|
+
const definition = CAPABILITIES[capability];
|
|
119
|
+
if (!definition) throw new Error(`Unknown region capability: ${capability}`);
|
|
120
|
+
return [...definition.tokens, ...definition.bundles].flatMap((token) => [`[clay~="${token}"]`, `[${token}]`]).join(", ");
|
|
121
|
+
}
|
|
122
|
+
function closestWithCapability(node, capability) {
|
|
123
|
+
let element = node && node.nodeType === 1 ? node : node?.parentElement;
|
|
124
|
+
while (element && element.nodeType === 1) {
|
|
125
|
+
const definition = CAPABILITIES[capability];
|
|
126
|
+
if (!definition) throw new Error(`Unknown region capability: ${capability}`);
|
|
127
|
+
if (definition.tokens.some((token) => expandsTo(element, token)) || definition.bundles.some((bundle) => hasPolicyToken(element, bundle))) return element;
|
|
128
|
+
element = element.parentElement;
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
function hasCapability(node, capability) {
|
|
133
|
+
return !!closestWithCapability(node, capability);
|
|
134
|
+
}
|
|
135
|
+
function isPolicyAttribute(name) {
|
|
136
|
+
return name === "clay" || POLICY_TOKENS.includes(name);
|
|
137
|
+
}
|
|
138
|
+
var CAPABILITIES, BUNDLES, POLICY_TOKENS;
|
|
139
|
+
var init_region_capabilities = __esm({
|
|
140
|
+
"src/lib/region-capabilities.js"() {
|
|
141
|
+
CAPABILITIES = Object.freeze({
|
|
142
|
+
data: Object.freeze({ tokens: ["no-data"], bundles: ["editor-ui"] }),
|
|
143
|
+
save: Object.freeze({ tokens: ["no-save"], bundles: ["editor-ui"] }),
|
|
144
|
+
snapshot: Object.freeze({ tokens: ["no-snapshot"], bundles: ["editor-ui"] }),
|
|
145
|
+
watch: Object.freeze({ tokens: ["no-watch"], bundles: ["editor-ui"] }),
|
|
146
|
+
undo: Object.freeze({ tokens: ["no-undo"], bundles: ["editor-ui"] }),
|
|
147
|
+
history: Object.freeze({ tokens: [], bundles: ["editor-ui"] })
|
|
148
|
+
});
|
|
149
|
+
BUNDLES = Object.freeze({
|
|
150
|
+
"editor-ui": Object.freeze(["no-data", "no-save", "no-snapshot", "no-watch", "no-undo"])
|
|
151
|
+
});
|
|
152
|
+
POLICY_TOKENS = Object.freeze([
|
|
153
|
+
"no-save",
|
|
154
|
+
"no-snapshot",
|
|
155
|
+
"no-trigger-autosave",
|
|
156
|
+
"no-dirty",
|
|
157
|
+
"no-watch",
|
|
158
|
+
"no-undo",
|
|
159
|
+
"no-data",
|
|
160
|
+
"freeze",
|
|
161
|
+
"editor-ui",
|
|
162
|
+
"live"
|
|
163
|
+
]);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// src/lib/ephemeral.js
|
|
168
|
+
function isEphemeralAttr(name, el5) {
|
|
169
|
+
if (name === EPHEMERAL_ATTR) return true;
|
|
170
|
+
if (!name || !el5 || el5.nodeType !== 1 || never(name) || name.startsWith(MARKER)) return false;
|
|
171
|
+
if (name === "open" && el5.localName === "dialog") return true;
|
|
172
|
+
return el5.hasAttribute(MARKER + name);
|
|
173
|
+
}
|
|
174
|
+
function isMarkedAttr(name, el5) {
|
|
175
|
+
return !!el5 && el5.nodeType === 1 && el5.hasAttribute(MARKER + name);
|
|
176
|
+
}
|
|
177
|
+
function stripElement(el5) {
|
|
178
|
+
if (el5.localName === "dialog" && el5.hasAttribute("open")) el5.removeAttribute("open");
|
|
179
|
+
if (el5.hasAttribute(EPHEMERAL_ATTR)) el5.removeAttribute(EPHEMERAL_ATTR);
|
|
180
|
+
const attrs = el5.attributes;
|
|
181
|
+
let names = null;
|
|
182
|
+
for (let i2 = 0; i2 < attrs.length; i2++) {
|
|
183
|
+
const name = attrs[i2].name;
|
|
184
|
+
if (!name.startsWith(MARKER)) continue;
|
|
185
|
+
const target = name.slice(MARKER.length);
|
|
186
|
+
if (target && !never(target)) (names || (names = [])).push(target);
|
|
187
|
+
}
|
|
188
|
+
if (names) for (const name of names) el5.removeAttribute(name);
|
|
189
|
+
}
|
|
190
|
+
function stripEphemeral(root3) {
|
|
191
|
+
if (!root3 || root3.nodeType !== 1) return;
|
|
192
|
+
stripElement(root3);
|
|
193
|
+
for (const el5 of root3.querySelectorAll("*")) {
|
|
194
|
+
stripElement(el5);
|
|
195
|
+
if (el5.localName === "template" && el5.content) {
|
|
196
|
+
for (const child of el5.content.children) stripEphemeral(child);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (root3.localName === "template" && root3.content) {
|
|
200
|
+
for (const child of root3.content.children) stripEphemeral(child);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function words(el5) {
|
|
204
|
+
return (el5.getAttribute(EPHEMERAL_ATTR) || "").split(/\s+/).filter(Boolean);
|
|
205
|
+
}
|
|
206
|
+
function write(el5, list3) {
|
|
207
|
+
if (list3.length) el5.setAttribute(EPHEMERAL_ATTR, list3.join(" "));
|
|
208
|
+
else el5.removeAttribute(EPHEMERAL_ATTR);
|
|
209
|
+
}
|
|
210
|
+
var EPHEMERAL_ATTR, MARKER, NEVER, never, ephemeral;
|
|
211
|
+
var init_ephemeral = __esm({
|
|
212
|
+
"src/lib/ephemeral.js"() {
|
|
213
|
+
init_region_capabilities();
|
|
214
|
+
EPHEMERAL_ATTR = "ephemeral";
|
|
215
|
+
MARKER = "ephemeral:";
|
|
216
|
+
NEVER = /* @__PURE__ */ new Set([
|
|
217
|
+
"class",
|
|
218
|
+
"id",
|
|
219
|
+
"data-id",
|
|
220
|
+
"value",
|
|
221
|
+
"checked",
|
|
222
|
+
"selected",
|
|
223
|
+
"save-remove",
|
|
224
|
+
"save-ignore",
|
|
225
|
+
"save-freeze",
|
|
226
|
+
"mutations-ignore",
|
|
227
|
+
"snapshot-remove"
|
|
228
|
+
]);
|
|
229
|
+
never = (name) => NEVER.has(name) || isPolicyAttribute(name);
|
|
230
|
+
ephemeral = {
|
|
231
|
+
has(el5, word) {
|
|
232
|
+
return words(el5).includes(word);
|
|
233
|
+
},
|
|
234
|
+
add(el5, word) {
|
|
235
|
+
const list3 = words(el5);
|
|
236
|
+
if (!list3.includes(word)) write(el5, [...list3, word]);
|
|
237
|
+
},
|
|
238
|
+
remove(el5, word) {
|
|
239
|
+
const list3 = words(el5);
|
|
240
|
+
if (list3.includes(word)) write(el5, list3.filter((w2) => w2 !== word));
|
|
241
|
+
},
|
|
242
|
+
toggle(el5, word, force) {
|
|
243
|
+
const on3 = force === void 0 ? !ephemeral.has(el5, word) : !!force;
|
|
244
|
+
if (on3) ephemeral.add(el5, word);
|
|
245
|
+
else ephemeral.remove(el5, word);
|
|
246
|
+
return on3;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
104
252
|
// src/lib/root-attrs.js
|
|
105
253
|
function isTabLocalAttr(name, el5) {
|
|
254
|
+
if (isEphemeralAttr(name, el5)) return true;
|
|
106
255
|
if (name === ROUTE_ACTIVE_ATTR) return true;
|
|
107
256
|
if (!el5 || el5.localName !== "html" || el5.parentElement) return false;
|
|
108
257
|
return TAB_LOCAL_ROOT_ATTRS.has(name) || name.startsWith(ROUTE_ROOT_PREFIX);
|
|
109
258
|
}
|
|
259
|
+
function mergeIgnoresAttr(el5, name, merged) {
|
|
260
|
+
return isTabLocalAttr(name, merged || el5);
|
|
261
|
+
}
|
|
262
|
+
function mergeVetoesAttr(name, el5) {
|
|
263
|
+
return isTabLocalAttr(name, el5) && !isMarkedAttr(name, el5) ? false : void 0;
|
|
264
|
+
}
|
|
110
265
|
function stripRouteAttrs(root3) {
|
|
111
266
|
for (const attr of [...root3.attributes]) {
|
|
112
267
|
if (attr.name.startsWith(ROUTE_ROOT_PREFIX)) root3.removeAttribute(attr.name);
|
|
@@ -116,6 +271,7 @@
|
|
|
116
271
|
var SAVE_TOKEN_ATTRS, LEGACY_SAVE_TOKEN_ATTRS, HOST_IDENTITY_ATTRS, HOST_RESPONSE_ATTRS, HOST_TOKEN_ATTRS, ROOT_LIBRARY_ATTRS, TAB_LOCAL_ROOT_ATTRS, ROUTE_ROOT_PREFIX, ROUTE_ACTIVE_ATTR;
|
|
117
272
|
var init_root_attrs = __esm({
|
|
118
273
|
"src/lib/root-attrs.js"() {
|
|
274
|
+
init_ephemeral();
|
|
119
275
|
SAVE_TOKEN_ATTRS = ["savetoken"];
|
|
120
276
|
LEGACY_SAVE_TOKEN_ATTRS = ["htmlclaytoken"];
|
|
121
277
|
HOST_IDENTITY_ATTRS = ["documentid", "htmlclayid"];
|
|
@@ -215,12 +371,18 @@
|
|
|
215
371
|
if (!root3 || !root3.querySelectorAll) return;
|
|
216
372
|
try {
|
|
217
373
|
for (const el5 of root3.querySelectorAll(EXTENSION_NODE_SELECTOR)) el5.remove();
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
374
|
+
const strip = (el5) => {
|
|
375
|
+
const attrs = el5.attributes;
|
|
376
|
+
if (!attrs) return;
|
|
377
|
+
let found = null;
|
|
378
|
+
for (let i2 = 0; i2 < attrs.length; i2++) {
|
|
379
|
+
const name = attrs[i2].name;
|
|
380
|
+
if (EXTENSION_ATTR_PATTERN.test(name.toLowerCase())) (found || (found = [])).push(name);
|
|
381
|
+
}
|
|
382
|
+
if (found) for (const name of found) el5.removeAttribute(name);
|
|
383
|
+
};
|
|
384
|
+
strip(root3);
|
|
385
|
+
for (const el5 of root3.querySelectorAll("*")) strip(el5);
|
|
224
386
|
} catch (e) {
|
|
225
387
|
if (typeof console !== "undefined") console.warn("[clay] stripExtensionNoise skipped:", e);
|
|
226
388
|
}
|
|
@@ -293,69 +455,6 @@
|
|
|
293
455
|
}
|
|
294
456
|
});
|
|
295
457
|
|
|
296
|
-
// src/lib/region-capabilities.js
|
|
297
|
-
function hasPolicyToken(element, token) {
|
|
298
|
-
if (!element || element.nodeType !== 1) return false;
|
|
299
|
-
const clay5 = element.getAttribute?.("clay");
|
|
300
|
-
return !!(clay5 && clay5.split(/\s+/).includes(token) || element.hasAttribute?.(token));
|
|
301
|
-
}
|
|
302
|
-
function expandsTo(element, token) {
|
|
303
|
-
if (hasPolicyToken(element, token)) return true;
|
|
304
|
-
for (const [bundle, members] of Object.entries(BUNDLES)) {
|
|
305
|
-
if (members.includes(token) && hasPolicyToken(element, bundle)) return true;
|
|
306
|
-
}
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
function capabilitySelector(capability) {
|
|
310
|
-
const definition = CAPABILITIES[capability];
|
|
311
|
-
if (!definition) throw new Error(`Unknown region capability: ${capability}`);
|
|
312
|
-
return [...definition.tokens, ...definition.bundles].flatMap((token) => [`[clay~="${token}"]`, `[${token}]`]).join(", ");
|
|
313
|
-
}
|
|
314
|
-
function closestWithCapability(node, capability) {
|
|
315
|
-
let element = node && node.nodeType === 1 ? node : node?.parentElement;
|
|
316
|
-
while (element && element.nodeType === 1) {
|
|
317
|
-
const definition = CAPABILITIES[capability];
|
|
318
|
-
if (!definition) throw new Error(`Unknown region capability: ${capability}`);
|
|
319
|
-
if (definition.tokens.some((token) => expandsTo(element, token)) || definition.bundles.some((bundle) => hasPolicyToken(element, bundle))) return element;
|
|
320
|
-
element = element.parentElement;
|
|
321
|
-
}
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
function hasCapability(node, capability) {
|
|
325
|
-
return !!closestWithCapability(node, capability);
|
|
326
|
-
}
|
|
327
|
-
function isPolicyAttribute(name) {
|
|
328
|
-
return name === "clay" || POLICY_TOKENS.includes(name);
|
|
329
|
-
}
|
|
330
|
-
var CAPABILITIES, BUNDLES, POLICY_TOKENS;
|
|
331
|
-
var init_region_capabilities = __esm({
|
|
332
|
-
"src/lib/region-capabilities.js"() {
|
|
333
|
-
CAPABILITIES = Object.freeze({
|
|
334
|
-
data: Object.freeze({ tokens: ["no-data"], bundles: ["editor-ui"] }),
|
|
335
|
-
save: Object.freeze({ tokens: ["no-save"], bundles: ["editor-ui"] }),
|
|
336
|
-
snapshot: Object.freeze({ tokens: ["no-snapshot"], bundles: ["editor-ui"] }),
|
|
337
|
-
watch: Object.freeze({ tokens: ["no-watch"], bundles: ["editor-ui"] }),
|
|
338
|
-
undo: Object.freeze({ tokens: ["no-undo"], bundles: ["editor-ui"] }),
|
|
339
|
-
history: Object.freeze({ tokens: [], bundles: ["editor-ui"] })
|
|
340
|
-
});
|
|
341
|
-
BUNDLES = Object.freeze({
|
|
342
|
-
"editor-ui": Object.freeze(["no-data", "no-save", "no-snapshot", "no-watch", "no-undo"])
|
|
343
|
-
});
|
|
344
|
-
POLICY_TOKENS = Object.freeze([
|
|
345
|
-
"no-save",
|
|
346
|
-
"no-snapshot",
|
|
347
|
-
"no-trigger-autosave",
|
|
348
|
-
"no-dirty",
|
|
349
|
-
"no-watch",
|
|
350
|
-
"no-undo",
|
|
351
|
-
"no-data",
|
|
352
|
-
"freeze",
|
|
353
|
-
"editor-ui",
|
|
354
|
-
"live"
|
|
355
|
-
]);
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
|
|
359
458
|
// src/lib/region-policy.js
|
|
360
459
|
var region_policy_exports = {};
|
|
361
460
|
__export(region_policy_exports, {
|
|
@@ -637,6 +736,7 @@
|
|
|
637
736
|
if (record2.type !== "attributes") return false;
|
|
638
737
|
const name = record2.attributeName;
|
|
639
738
|
if (name === ROUTE_ACTIVE_ATTR) return true;
|
|
739
|
+
if (isEphemeralAttr(name, record2.target)) return true;
|
|
640
740
|
return record2.target === document.documentElement && (ROOT_LIBRARY_ATTR_SET.has(name) || name.startsWith(ROUTE_ROOT_PREFIX));
|
|
641
741
|
}
|
|
642
742
|
function withoutLibraryNoise(records3) {
|
|
@@ -663,6 +763,7 @@
|
|
|
663
763
|
init_region_policy();
|
|
664
764
|
init_region_capabilities();
|
|
665
765
|
init_root_attrs();
|
|
766
|
+
init_ephemeral();
|
|
666
767
|
init_user_gesture();
|
|
667
768
|
dummyElem = document.createElement("div");
|
|
668
769
|
ROOT_LIBRARY_ATTR_SET = new Set(ROOT_LIBRARY_ATTRS);
|
|
@@ -1319,9 +1420,6 @@
|
|
|
1319
1420
|
if ("value" in source2 && "value" in copy2 && source2.tagName !== "OPTION" && type !== "checkbox" && type !== "radio" && type !== "file") copy2.value = source2.value;
|
|
1320
1421
|
if (source2.tagName === "INPUT" && (type === "checkbox" || type === "radio")) copy2.checked = source2.checked;
|
|
1321
1422
|
if (source2.tagName === "OPTION") copy2.selected = source2.selected;
|
|
1322
|
-
if (source2.tagName === "SELECT") {
|
|
1323
|
-
for (let i2 = 0; i2 < source2.options.length; i2++) copy2.options[i2].selected = source2.options[i2].selected;
|
|
1324
|
-
}
|
|
1325
1423
|
if ("indeterminate" in source2 && "indeterminate" in copy2) copy2.indeterminate = source2.indeterminate;
|
|
1326
1424
|
}
|
|
1327
1425
|
function matchesWithin(node, selector, boundary, inherit) {
|
|
@@ -1334,40 +1432,59 @@
|
|
|
1334
1432
|
}
|
|
1335
1433
|
return false;
|
|
1336
1434
|
}
|
|
1337
|
-
function
|
|
1338
|
-
|
|
1339
|
-
|
|
1435
|
+
function excluded(source2, capability, capabilityMatch, exclude, boundary, inherit) {
|
|
1436
|
+
return (inherit ? hasCapability(source2, capability) : matchesWithin(source2, capabilityMatch, boundary, false)) || !!(exclude && (inherit && source2 !== boundary ? source2.matches(exclude) : matchesWithin(source2, exclude, boundary, inherit)));
|
|
1437
|
+
}
|
|
1438
|
+
function hasOwnCapability(element, capability) {
|
|
1439
|
+
const definition = CAPABILITIES[capability];
|
|
1440
|
+
return definition.tokens.some((token) => expandsTo(element, token)) || definition.bundles.some((bundle) => hasPolicyToken(element, bundle));
|
|
1441
|
+
}
|
|
1442
|
+
function pairTree(source2, copy2, maps, drop) {
|
|
1443
|
+
if (source2.nodeType === 1 && drop(source2)) {
|
|
1444
|
+
maps.dropped.push(copy2);
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1340
1447
|
maps.cloneToLive.set(copy2, source2);
|
|
1341
1448
|
maps.liveToClone.set(source2, copy2);
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
if (
|
|
1345
|
-
maps.
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1449
|
+
let sourceChildren = source2;
|
|
1450
|
+
let copyChildren = copy2;
|
|
1451
|
+
if (source2.nodeType === 1) {
|
|
1452
|
+
if (CONTROL_TAGS.has(source2.tagName)) maps.controls.push(source2, copy2);
|
|
1453
|
+
if (source2.tagName === "TEMPLATE") {
|
|
1454
|
+
while (copy2.firstChild) copy2.removeChild(copy2.firstChild);
|
|
1455
|
+
sourceChildren = source2.content;
|
|
1456
|
+
copyChildren = copy2.content;
|
|
1457
|
+
maps.cloneToLive.set(copyChildren, sourceChildren);
|
|
1458
|
+
maps.liveToClone.set(sourceChildren, copyChildren);
|
|
1459
|
+
}
|
|
1460
|
+
} else if (source2.nodeType !== 11) return;
|
|
1461
|
+
let c2 = copyChildren.firstChild;
|
|
1462
|
+
for (let s2 = sourceChildren.firstChild; s2 && c2; s2 = s2.nextSibling) {
|
|
1463
|
+
pairTree(s2, c2, maps, drop);
|
|
1464
|
+
c2 = c2.nextSibling;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
function createContentView(context, { capability = "data", exclude = null, inherit = true, provenance = null } = {}) {
|
|
1359
1468
|
if (!context) throw new TypeError("createContentView requires a DOM context");
|
|
1360
1469
|
const sourceDocument = context.nodeType === 9 ? context : context.ownerDocument;
|
|
1361
1470
|
if (!sourceDocument?.implementation?.createHTMLDocument) {
|
|
1362
1471
|
throw new TypeError("createContentView requires an HTML DOM implementation");
|
|
1363
1472
|
}
|
|
1364
1473
|
const inertDocument = sourceDocument.implementation.createHTMLDocument("");
|
|
1365
|
-
const cloneToLive = /* @__PURE__ */ new WeakMap();
|
|
1474
|
+
const cloneToLive = provenance || /* @__PURE__ */ new WeakMap();
|
|
1366
1475
|
const liveToClone = /* @__PURE__ */ new WeakMap();
|
|
1367
1476
|
const sourceRoot = context.nodeType === 9 ? context.documentElement : context;
|
|
1368
1477
|
if (exclude) inertDocument.documentElement.matches(exclude);
|
|
1369
1478
|
const capabilityMatch = capabilitySelector(capability);
|
|
1370
|
-
const
|
|
1479
|
+
const drop = inherit ? (el5) => hasOwnCapability(el5, capability) || !!(exclude && el5.matches(exclude)) : (el5) => excluded(el5, capability, capabilityMatch, exclude, sourceRoot, false);
|
|
1480
|
+
let root3 = null;
|
|
1481
|
+
if (sourceRoot.nodeType !== 1 || !excluded(sourceRoot, capability, capabilityMatch, exclude, sourceRoot, inherit)) {
|
|
1482
|
+
root3 = inertDocument.importNode(sourceRoot, true);
|
|
1483
|
+
const maps = { cloneToLive, liveToClone, dropped: [], controls: [] };
|
|
1484
|
+
pairTree(sourceRoot, root3, maps, drop);
|
|
1485
|
+
for (const node of maps.dropped) node.remove();
|
|
1486
|
+
for (let i2 = 0; i2 < maps.controls.length; i2 += 2) copyControlState(maps.controls[i2], maps.controls[i2 + 1]);
|
|
1487
|
+
}
|
|
1371
1488
|
if (context.nodeType === 9 && root3) {
|
|
1372
1489
|
inertDocument.replaceChild(root3, inertDocument.documentElement);
|
|
1373
1490
|
liveToClone.set(context, inertDocument);
|
|
@@ -1412,11 +1529,12 @@
|
|
|
1412
1529
|
function cleanContentClone(node, options) {
|
|
1413
1530
|
return createContentView(node, options).root;
|
|
1414
1531
|
}
|
|
1415
|
-
var UNSUPPORTED_SELECTOR;
|
|
1532
|
+
var UNSUPPORTED_SELECTOR, CONTROL_TAGS;
|
|
1416
1533
|
var init_content_dom = __esm({
|
|
1417
1534
|
"src/lib/content-dom.js"() {
|
|
1418
1535
|
init_region_capabilities();
|
|
1419
1536
|
UNSUPPORTED_SELECTOR = /:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;
|
|
1537
|
+
CONTROL_TAGS = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT", "OPTION"]);
|
|
1420
1538
|
}
|
|
1421
1539
|
});
|
|
1422
1540
|
|
|
@@ -1520,15 +1638,8 @@
|
|
|
1520
1638
|
if (flushUndo && typeof window !== "undefined" && window.clay?.undo?.flush) {
|
|
1521
1639
|
window.clay.undo.flush();
|
|
1522
1640
|
}
|
|
1523
|
-
const view3 = createContentView(document.documentElement, { capability: "snapshot" });
|
|
1641
|
+
const view3 = createContentView(document.documentElement, { capability: "snapshot", provenance: snapshotProvenance });
|
|
1524
1642
|
const clone = view3.root;
|
|
1525
|
-
const remember2 = (node) => {
|
|
1526
|
-
const live2 = view3.original(node);
|
|
1527
|
-
if (live2) snapshotProvenance.set(node, live2);
|
|
1528
|
-
const children = node.nodeType === 1 && node.tagName === "TEMPLATE" && node.content ? node.content.childNodes : node.childNodes;
|
|
1529
|
-
for (const child of children || []) remember2(child);
|
|
1530
|
-
};
|
|
1531
|
-
remember2(clone);
|
|
1532
1643
|
for (const hook of snapshotHooks) {
|
|
1533
1644
|
stripSnapshotRegions(clone);
|
|
1534
1645
|
hook(clone, { original: originalSnapshotNode });
|
|
@@ -1539,6 +1650,7 @@
|
|
|
1539
1650
|
stripSnapshotRegions(clone);
|
|
1540
1651
|
stripExtensionNoise(clone);
|
|
1541
1652
|
stripRouteAttrs(clone);
|
|
1653
|
+
stripEphemeral(clone);
|
|
1542
1654
|
return clone;
|
|
1543
1655
|
}
|
|
1544
1656
|
function prepareCloneForSave(clone, { authored: authored3 = true } = {}) {
|
|
@@ -1720,6 +1832,7 @@
|
|
|
1720
1832
|
init_authored_url();
|
|
1721
1833
|
init_region_policy();
|
|
1722
1834
|
init_root_attrs();
|
|
1835
|
+
init_ephemeral();
|
|
1723
1836
|
init_content_dom();
|
|
1724
1837
|
snapshotHooks = [];
|
|
1725
1838
|
documentTransforms = [];
|
|
@@ -3594,8 +3707,12 @@
|
|
|
3594
3707
|
previewHold--;
|
|
3595
3708
|
if (previewHold > 0) return;
|
|
3596
3709
|
const missed = previewMissed;
|
|
3710
|
+
const autosaveMissedInHold = previewAutosaveMissed;
|
|
3597
3711
|
previewMissed = false;
|
|
3598
|
-
|
|
3712
|
+
previewAutosaveMissed = false;
|
|
3713
|
+
if (!replay) return;
|
|
3714
|
+
if (missed) savePage();
|
|
3715
|
+
else if (autosaveMissedInHold) savePageThrottled();
|
|
3599
3716
|
}
|
|
3600
3717
|
function savesHeld() {
|
|
3601
3718
|
return previewHold > 0;
|
|
@@ -3676,10 +3793,16 @@
|
|
|
3676
3793
|
}
|
|
3677
3794
|
}
|
|
3678
3795
|
function drainPendingSave() {
|
|
3679
|
-
if (!pendingSave) return;
|
|
3796
|
+
if (!pendingSave && !pendingAutosave) return;
|
|
3680
3797
|
if (saveFateIsUnknown()) return;
|
|
3681
|
-
pendingSave
|
|
3682
|
-
|
|
3798
|
+
if (pendingSave) {
|
|
3799
|
+
pendingSave = false;
|
|
3800
|
+
pendingAutosave = false;
|
|
3801
|
+
savePage();
|
|
3802
|
+
return;
|
|
3803
|
+
}
|
|
3804
|
+
pendingAutosave = false;
|
|
3805
|
+
savePageThrottled();
|
|
3683
3806
|
}
|
|
3684
3807
|
function getUnsavedChanges() {
|
|
3685
3808
|
return unsavedChanges;
|
|
@@ -3748,7 +3871,9 @@
|
|
|
3748
3871
|
return resolve(skipped);
|
|
3749
3872
|
}
|
|
3750
3873
|
setSavingState();
|
|
3874
|
+
ownSaveOnWire = true;
|
|
3751
3875
|
saveHtml(forSave, (result2) => {
|
|
3876
|
+
ownSaveOnWire = false;
|
|
3752
3877
|
applySaveResult(result2, forComparison, forDirty, "updated after save", gateToken, forSave);
|
|
3753
3878
|
if (typeof callback === "function") {
|
|
3754
3879
|
callback(result2);
|
|
@@ -3791,7 +3916,9 @@
|
|
|
3791
3916
|
return resolve(result2);
|
|
3792
3917
|
}
|
|
3793
3918
|
setSavingState();
|
|
3919
|
+
ownSaveOnWire = true;
|
|
3794
3920
|
saveHtml(forSave, (result2) => {
|
|
3921
|
+
ownSaveOnWire = false;
|
|
3795
3922
|
applySaveResult(result2, forComparison, forDirty, "updated after force save", gateToken, forSave);
|
|
3796
3923
|
if (typeof callback === "function") {
|
|
3797
3924
|
callback(result2);
|
|
@@ -3956,7 +4083,7 @@
|
|
|
3956
4083
|
return Promise.resolve(skipped);
|
|
3957
4084
|
}
|
|
3958
4085
|
if (previewHold > 0) {
|
|
3959
|
-
|
|
4086
|
+
previewAutosaveMissed = true;
|
|
3960
4087
|
const skipped = skipped_(saveHoldReason());
|
|
3961
4088
|
callback(skipped);
|
|
3962
4089
|
return Promise.resolve(skipped);
|
|
@@ -3967,14 +4094,37 @@
|
|
|
3967
4094
|
callback(skipped);
|
|
3968
4095
|
return Promise.resolve(skipped);
|
|
3969
4096
|
}
|
|
4097
|
+
if (!baselineActive && ownSaveOnWire) {
|
|
4098
|
+
pendingAutosave = true;
|
|
4099
|
+
const skipped = skipped_("Save already in progress");
|
|
4100
|
+
callback(skipped);
|
|
4101
|
+
return Promise.resolve(skipped);
|
|
4102
|
+
}
|
|
3970
4103
|
const gateToken = gateCaptureToken();
|
|
3971
|
-
|
|
4104
|
+
let currentForCompare;
|
|
4105
|
+
let dirtyMatchesLastSave;
|
|
4106
|
+
try {
|
|
4107
|
+
currentForCompare = captureForComparison();
|
|
4108
|
+
dirtyMatchesLastSave = () => !document.querySelector(NO_TRIGGER_AUTOSAVE_SELECTOR) || pageMaybeDirty() && captureForDirtyCheck({ flushUndo: false }) === lastSavedDirty;
|
|
4109
|
+
} catch (err) {
|
|
4110
|
+
console.error("savePageThrottled: captureForComparison failed", err);
|
|
4111
|
+
setSaveState("error", err.message);
|
|
4112
|
+
const result2 = { msg: err.message, msgType: "error", code: null, etag: null };
|
|
4113
|
+
callback(result2);
|
|
4114
|
+
return Promise.resolve(result2);
|
|
4115
|
+
}
|
|
3972
4116
|
const differsFromBaseline = !baselineActive || currentForCompare !== baselineContents;
|
|
3973
4117
|
const differsFromLastSave = currentForCompare !== lastSavedContents;
|
|
3974
4118
|
logSaveCheck("throttled vs baseline", !differsFromBaseline);
|
|
3975
4119
|
logSaveCheck("throttled vs lastSave", !differsFromLastSave);
|
|
3976
4120
|
if (!(differsFromBaseline && differsFromLastSave)) {
|
|
3977
|
-
|
|
4121
|
+
let clear = false;
|
|
4122
|
+
try {
|
|
4123
|
+
clear = !differsFromLastSave && dirtyMatchesLastSave();
|
|
4124
|
+
} catch (err) {
|
|
4125
|
+
console.error("savePageThrottled: captureForDirtyCheck failed", err);
|
|
4126
|
+
}
|
|
4127
|
+
if (clear) gateClearIfUnchanged(gateToken);
|
|
3978
4128
|
const skipped = skipped_("No changes to save");
|
|
3979
4129
|
callback(skipped);
|
|
3980
4130
|
return Promise.resolve(skipped);
|
|
@@ -4012,7 +4162,7 @@
|
|
|
4012
4162
|
initSaveKeyboardShortcut();
|
|
4013
4163
|
initHyperclaySaveButton();
|
|
4014
4164
|
}
|
|
4015
|
-
var savingTimeout, unsavedChanges, lastSavedContents, lastSavedDirty, pendingSave, autosaveSuspended, autosaveMissed, previewHold, previewMissed, PREVIEW_HOLD_REASON, holdReasons, conflictHold, conflictEtag, lastSavedBytes, throttledSave, baselineContents, baselineActive, baselineSettledAt, SETTLE_MS, MAX_SETTLE_MS, save_default;
|
|
4165
|
+
var savingTimeout, unsavedChanges, lastSavedContents, lastSavedDirty, pendingSave, pendingAutosave, ownSaveOnWire, autosaveSuspended, autosaveMissed, previewHold, previewMissed, previewAutosaveMissed, PREVIEW_HOLD_REASON, holdReasons, conflictHold, conflictEtag, lastSavedBytes, throttledSave, baselineContents, baselineActive, baselineSettledAt, SETTLE_MS, MAX_SETTLE_MS, save_default;
|
|
4016
4166
|
var init_save = __esm({
|
|
4017
4167
|
"src/core/save.js"() {
|
|
4018
4168
|
init_throttle();
|
|
@@ -4020,6 +4170,7 @@
|
|
|
4020
4170
|
init_is_edit_mode();
|
|
4021
4171
|
init_save_core();
|
|
4022
4172
|
init_snapshot();
|
|
4173
|
+
init_region_policy();
|
|
4023
4174
|
init_etag();
|
|
4024
4175
|
init_dirty_gate();
|
|
4025
4176
|
init_unsaved_state();
|
|
@@ -4050,10 +4201,13 @@
|
|
|
4050
4201
|
lastSavedContents = "";
|
|
4051
4202
|
lastSavedDirty = "";
|
|
4052
4203
|
pendingSave = false;
|
|
4204
|
+
pendingAutosave = false;
|
|
4205
|
+
ownSaveOnWire = false;
|
|
4053
4206
|
autosaveSuspended = 0;
|
|
4054
4207
|
autosaveMissed = false;
|
|
4055
4208
|
previewHold = 0;
|
|
4056
4209
|
previewMissed = false;
|
|
4210
|
+
previewAutosaveMissed = false;
|
|
4057
4211
|
PREVIEW_HOLD_REASON = "Waiting for the AI edit to be kept or reverted";
|
|
4058
4212
|
holdReasons = /* @__PURE__ */ new Map();
|
|
4059
4213
|
conflictHold = false;
|
|
@@ -4580,7 +4734,7 @@
|
|
|
4580
4734
|
};
|
|
4581
4735
|
}
|
|
4582
4736
|
function jsonPathWords(path) {
|
|
4583
|
-
const
|
|
4737
|
+
const words2 = [];
|
|
4584
4738
|
let i2 = 0;
|
|
4585
4739
|
while (i2 < path.length) {
|
|
4586
4740
|
if (path[i2] === ".") {
|
|
@@ -4602,19 +4756,19 @@
|
|
|
4602
4756
|
const keyed2 = /^[A-Za-z_$][\w$]*=/.exec(inner);
|
|
4603
4757
|
if (keyed2) inner = inner.slice(keyed2[0].length);
|
|
4604
4758
|
try {
|
|
4605
|
-
|
|
4759
|
+
words2.push(String(JSON.parse(inner)));
|
|
4606
4760
|
} catch {
|
|
4607
|
-
|
|
4761
|
+
words2.push(inner);
|
|
4608
4762
|
}
|
|
4609
4763
|
i2 = j3 + 1;
|
|
4610
4764
|
continue;
|
|
4611
4765
|
}
|
|
4612
4766
|
let j2 = i2;
|
|
4613
4767
|
while (j2 < path.length && path[j2] !== "." && path[j2] !== "[") j2++;
|
|
4614
|
-
|
|
4768
|
+
words2.push(path.slice(i2, j2));
|
|
4615
4769
|
i2 = j2;
|
|
4616
4770
|
}
|
|
4617
|
-
return
|
|
4771
|
+
return words2.join(" \u2192 ");
|
|
4618
4772
|
}
|
|
4619
4773
|
function rowOf(record2) {
|
|
4620
4774
|
const id = record2.id;
|
|
@@ -5011,12 +5165,12 @@
|
|
|
5011
5165
|
function h(A2) {
|
|
5012
5166
|
let E2 = A2.attributes, N2 = E2.length;
|
|
5013
5167
|
if (N2 === 0) return { all: "", sig: A2.tagName + "|" };
|
|
5014
|
-
let M2 = [],
|
|
5168
|
+
let M2 = [], P2 = "", V3 = [];
|
|
5015
5169
|
for (let D2 = 0; D2 < N2; D2++) {
|
|
5016
5170
|
let j2 = E2[D2], y2 = j2.name;
|
|
5017
|
-
o2(A2, y2) || M2.push(y2 + "=" + j2.value), y2 === "class" ?
|
|
5171
|
+
o2(A2, y2) || M2.push(y2 + "=" + j2.value), y2 === "class" ? P2 = j2.value.indexOf(" ") < 0 ? j2.value : j2.value.split(/\s+/).filter(Boolean).sort().join(" ") : ui3.has(y2) && V3.push(y2 + "=" + j2.value);
|
|
5018
5172
|
}
|
|
5019
|
-
return M2.length > 1 && M2.sort(), V3.length > 1 && V3.sort(), { all: M2.join(""), sig: A2.tagName + "|" +
|
|
5173
|
+
return M2.length > 1 && M2.sort(), V3.length > 1 && V3.sort(), { all: M2.join(""), sig: A2.tagName + "|" + P2 + (V3.length ? "|" + V3.join("|") : "") };
|
|
5020
5174
|
}
|
|
5021
5175
|
function l(A2) {
|
|
5022
5176
|
return A2.nodeType === 1 && A2.tagName === "TEMPLATE" && A2.content ? A2.content.childNodes : A2.childNodes;
|
|
@@ -5027,12 +5181,12 @@
|
|
|
5027
5181
|
if (A2.nodeType === 3) E2 = { hash: "T" + ro2(A2.nodeValue), hint: Ws2(A2.nodeValue).slice(0, 64), sig: null, tok: null };
|
|
5028
5182
|
else if (A2.nodeType === 8) E2 = { hash: "C" + ro2(A2.nodeValue), hint: "", sig: null, tok: null };
|
|
5029
5183
|
else if (A2.nodeType === 1) {
|
|
5030
|
-
let N2 = h(A2), M2 = ro2(A2.tagName + "" + N2.all),
|
|
5184
|
+
let N2 = h(A2), M2 = ro2(A2.tagName + "" + N2.all), P2 = "";
|
|
5031
5185
|
for (let V3 of u2(A2)) if (V3.nodeType === 1) {
|
|
5032
5186
|
let D2 = r(V3);
|
|
5033
|
-
M2 = ro2(D2.hash, M2),
|
|
5034
|
-
} else M2 = ro2(w2(V3), M2), V3.kind === "text" &&
|
|
5035
|
-
E2 = { hash: "E" + M2, hint: Ws2(
|
|
5187
|
+
M2 = ro2(D2.hash, M2), P2.length < 64 && (P2 += " " + D2.hint);
|
|
5188
|
+
} else M2 = ro2(w2(V3), M2), V3.kind === "text" && P2.length < 64 && (P2 += V3.value.slice(0, 64));
|
|
5189
|
+
E2 = { hash: "E" + M2, hint: Ws2(P2).trim().slice(0, 64), sig: N2.sig, tok: null };
|
|
5036
5190
|
} else E2 = { hash: "N" + A2.nodeType, hint: "", sig: null, tok: null };
|
|
5037
5191
|
return n2.set(A2, E2), E2;
|
|
5038
5192
|
}
|
|
@@ -5048,14 +5202,14 @@
|
|
|
5048
5202
|
if (E2) return E2;
|
|
5049
5203
|
E2 = [];
|
|
5050
5204
|
let N2 = null, M2 = () => {
|
|
5051
|
-
N2 && (N2.value = N2.nodes.map((
|
|
5205
|
+
N2 && (N2.value = N2.nodes.map((P2) => P2.nodeValue).join(""), E2.push(N2), N2 = null);
|
|
5052
5206
|
};
|
|
5053
|
-
for (let
|
|
5054
|
-
if (
|
|
5055
|
-
N2 || (N2 = { kind: "text", nodes: [], value: "", parent: A2, hash: void 0 }), N2.nodes.push(
|
|
5207
|
+
for (let P2 of l(A2)) {
|
|
5208
|
+
if (P2.nodeType === 3) {
|
|
5209
|
+
N2 || (N2 = { kind: "text", nodes: [], value: "", parent: A2, hash: void 0 }), N2.nodes.push(P2);
|
|
5056
5210
|
continue;
|
|
5057
5211
|
}
|
|
5058
|
-
M2(),
|
|
5212
|
+
M2(), P2.nodeType === 8 ? E2.push({ kind: "comment", nodes: [P2], value: P2.nodeValue, parent: A2, hash: void 0 }) : P2.nodeType === 1 && !e(P2) && E2.push(P2);
|
|
5059
5213
|
}
|
|
5060
5214
|
return M2(), s2.set(A2, E2), E2;
|
|
5061
5215
|
}
|
|
@@ -5066,9 +5220,9 @@
|
|
|
5066
5220
|
let N2 = i2(r(A2)), M2 = i2(r(E2));
|
|
5067
5221
|
if (N2.size === 0 && M2.size === 0) return { coef: 1, share: 1 };
|
|
5068
5222
|
if (N2.size === 0 || M2.size === 0) return null;
|
|
5069
|
-
let
|
|
5070
|
-
for (let V3 of N2) M2.has(V3) &&
|
|
5071
|
-
return { coef:
|
|
5223
|
+
let P2 = 0;
|
|
5224
|
+
for (let V3 of N2) M2.has(V3) && P2++;
|
|
5225
|
+
return { coef: P2 / Math.min(N2.size, M2.size), share: P2 / Math.max(N2.size, M2.size) };
|
|
5072
5226
|
}
|
|
5073
5227
|
function p2(A2, E2) {
|
|
5074
5228
|
let N2 = c2(A2, E2);
|
|
@@ -5090,8 +5244,8 @@
|
|
|
5090
5244
|
if (N2 && N2.has(E2)) return N2.get(E2);
|
|
5091
5245
|
let M2 = C2.get(E2);
|
|
5092
5246
|
if (M2 && M2.has(A2)) return M2.get(A2);
|
|
5093
|
-
let
|
|
5094
|
-
return
|
|
5247
|
+
let P2 = f2(A2, E2), V3 = P2 === true;
|
|
5248
|
+
return P2 === false && t && t.hashRejected++, N2 || C2.set(A2, N2 = /* @__PURE__ */ new WeakMap()), N2.set(E2, V3), V3;
|
|
5095
5249
|
}
|
|
5096
5250
|
function f2(A2, E2) {
|
|
5097
5251
|
if (A2.nodeType === 1) {
|
|
@@ -5099,11 +5253,11 @@
|
|
|
5099
5253
|
let N2 = S2(A2), M2 = S2(E2);
|
|
5100
5254
|
if (N2.length !== M2.length) return false;
|
|
5101
5255
|
for (let D2 = 0; D2 < N2.length; D2++) if (N2[D2][0] !== M2[D2][0] || N2[D2][1] !== M2[D2][1] || N2[D2][2] !== M2[D2][2]) return false;
|
|
5102
|
-
let
|
|
5103
|
-
if (
|
|
5104
|
-
for (let D2 = 0; D2 <
|
|
5105
|
-
if (w2(
|
|
5106
|
-
if (!m2(
|
|
5256
|
+
let P2 = u2(A2), V3 = u2(E2);
|
|
5257
|
+
if (P2.length !== V3.length) return false;
|
|
5258
|
+
for (let D2 = 0; D2 < P2.length; D2++) {
|
|
5259
|
+
if (w2(P2[D2]) !== w2(V3[D2])) return false;
|
|
5260
|
+
if (!m2(P2[D2], V3[D2])) return di2;
|
|
5107
5261
|
}
|
|
5108
5262
|
return true;
|
|
5109
5263
|
}
|
|
@@ -5115,14 +5269,14 @@
|
|
|
5115
5269
|
if (E2) return E2;
|
|
5116
5270
|
let N2 = w2(A2), M2 = I3.get(N2);
|
|
5117
5271
|
M2 || I3.set(N2, M2 = []);
|
|
5118
|
-
let
|
|
5119
|
-
return E2 =
|
|
5272
|
+
let P2 = M2.find((V3) => m2(V3.unit, A2));
|
|
5273
|
+
return E2 = P2 ? P2.key : "K" + v2++, P2 || M2.push({ unit: A2, key: E2 }), g.set(A2, E2), E2;
|
|
5120
5274
|
}
|
|
5121
5275
|
return { meta: r, unitsOf: u2, unitHash: w2, similar: p2, score: c2, childrenOf: l, equalUnits: m2, exactUnitKey: T2, ignored: e };
|
|
5122
5276
|
}
|
|
5123
5277
|
var Fs2 = 16, hi2 = 2e3, pi2 = 3, as2 = { align: 0, certifyVisited: 0, certifyScheduled: 0 };
|
|
5124
5278
|
function cs2(e, o2, t) {
|
|
5125
|
-
let { meta: n2, unitsOf: s2, unitHash: h, similar: l, score: r, childrenOf: i2, equalUnits: u2, ignored: w2 } = t.analyzer, c2 = t.baseId || (() => null), p2 = t.sideId || (() => null), b = t.baseKey || (() => null), S2 = t.sideKey || (() => null), C2 = t.baseDropped || /* @__PURE__ */ new Set(), m2 = t.sideDropped || /* @__PURE__ */ new Set(), f2 = t.stats || null, g = f2 ? /* @__PURE__ */ new Set() : null, I3 = f2 ? /* @__PURE__ */ new Set() : null, v2 = /* @__PURE__ */ new Map(), T2 = /* @__PURE__ */ new Map(), A2 = /* @__PURE__ */ new Set(), E2 = /* @__PURE__ */ new Map(), N2 = /* @__PURE__ */ new Set(), M2 = /* @__PURE__ */ new Set(),
|
|
5279
|
+
let { meta: n2, unitsOf: s2, unitHash: h, similar: l, score: r, childrenOf: i2, equalUnits: u2, ignored: w2 } = t.analyzer, c2 = t.baseId || (() => null), p2 = t.sideId || (() => null), b = t.baseKey || (() => null), S2 = t.sideKey || (() => null), C2 = t.baseDropped || /* @__PURE__ */ new Set(), m2 = t.sideDropped || /* @__PURE__ */ new Set(), f2 = t.stats || null, g = f2 ? /* @__PURE__ */ new Set() : null, I3 = f2 ? /* @__PURE__ */ new Set() : null, v2 = /* @__PURE__ */ new Map(), T2 = /* @__PURE__ */ new Map(), A2 = /* @__PURE__ */ new Set(), E2 = /* @__PURE__ */ new Map(), N2 = /* @__PURE__ */ new Set(), M2 = /* @__PURE__ */ new Set(), P2 = /* @__PURE__ */ new Set(), V3 = [], D2 = [], j2 = [], y2 = [], k2 = hi2, J3 = /* @__PURE__ */ new Map(), H2 = /* @__PURE__ */ new Map(), q3 = (W3, X2) => {
|
|
5126
5280
|
v2.set(W3, X2), T2.set(X2, W3);
|
|
5127
5281
|
}, Me3 = /* @__PURE__ */ new Set(), Oe3 = /* @__PURE__ */ new Set(), Re3 = null, ie3 = (W3) => {
|
|
5128
5282
|
let X2 = W3.nodeType ? W3.parentNode : W3.parent;
|
|
@@ -5199,7 +5353,7 @@
|
|
|
5199
5353
|
let pe3 = /* @__PURE__ */ new Set();
|
|
5200
5354
|
for (let he3 = W3.length - 1; he3 >= 0; he3--) {
|
|
5201
5355
|
let ee3 = W3[he3];
|
|
5202
|
-
t.scope && t.scope.onChain.has(ee3) ? pe3.add(ee3) : Dt3(ee3, v2.get(ee3), pe3) ? (M2.add(ee3),
|
|
5356
|
+
t.scope && t.scope.onChain.has(ee3) ? pe3.add(ee3) : Dt3(ee3, v2.get(ee3), pe3) ? (M2.add(ee3), P2.add(ee3), f2 && f2.certificationPairs++) : pe3.add(ee3);
|
|
5203
5357
|
}
|
|
5204
5358
|
let be3 = /* @__PURE__ */ new Set();
|
|
5205
5359
|
for (let he3 of W3) M2.has(he3) && !be3.has(he3) && Ot3(he3, be3);
|
|
@@ -5230,7 +5384,7 @@
|
|
|
5230
5384
|
if (!X2) return;
|
|
5231
5385
|
E2.has(W3) || E2.set(W3, /* @__PURE__ */ new Set()), E2.get(W3).add(X2);
|
|
5232
5386
|
let pe3 = (he3, ee3) => {
|
|
5233
|
-
v2.delete(he3), T2.delete(ee3), N2.delete(he3), M2.delete(he3), A2.delete(he3),
|
|
5387
|
+
v2.delete(he3), T2.delete(ee3), N2.delete(he3), M2.delete(he3), A2.delete(he3), P2.delete(he3);
|
|
5234
5388
|
}, be3 = (he3, ee3) => {
|
|
5235
5389
|
for (let te3 of s2(he3)) {
|
|
5236
5390
|
let z2 = v2.get(te3);
|
|
@@ -5251,14 +5405,14 @@
|
|
|
5251
5405
|
function Lt2() {
|
|
5252
5406
|
for (; y2.length; ) {
|
|
5253
5407
|
let [W3, X2] = y2.shift();
|
|
5254
|
-
v2.get(W3) !== X2 ||
|
|
5408
|
+
v2.get(W3) !== X2 || P2.has(W3) || M2.has(W3) || cn2(W3, X2);
|
|
5255
5409
|
}
|
|
5256
5410
|
}
|
|
5257
5411
|
function qt3(W3, X2) {
|
|
5258
5412
|
if (!ae3(W3)) for (let pe3 of s2(W3)) x2(pe3) && (X2.push(pe3), qt3(pe3, X2));
|
|
5259
5413
|
}
|
|
5260
5414
|
function cn2(W3, X2) {
|
|
5261
|
-
|
|
5415
|
+
P2.add(W3);
|
|
5262
5416
|
let pe3 = s2(W3), be3 = s2(X2);
|
|
5263
5417
|
as2.align += pe3.length + be3.length, J3 = /* @__PURE__ */ new Map(), H2 = /* @__PURE__ */ new Map();
|
|
5264
5418
|
for (let ne3 = 0; ne3 < pe3.length; ne3++) J3.set(pe3[ne3], ne3);
|
|
@@ -5273,7 +5427,7 @@
|
|
|
5273
5427
|
}
|
|
5274
5428
|
le3(pe3, be3);
|
|
5275
5429
|
let he3 = pe3.filter((ne3) => !v2.has(ne3)), ee3 = be3.filter((ne3) => !T2.has(ne3));
|
|
5276
|
-
he3.length && ee3.length && (wn2(he3, ee3),
|
|
5430
|
+
he3.length && ee3.length && (wn2(he3, ee3), R2(he3, ee3), K2(he3, ee3, pe3, be3), de3(pe3, be3));
|
|
5277
5431
|
let te3 = false, z2 = false;
|
|
5278
5432
|
for (let ne3 of pe3) {
|
|
5279
5433
|
if (!v2.has(ne3)) {
|
|
@@ -5366,13 +5520,13 @@
|
|
|
5366
5520
|
let he3 = pe3[be3], ee3 = pe3[be3 + 1], te3 = v2.get(he3);
|
|
5367
5521
|
te3 !== void 0 && te3 !== ee3 && fn2(he3, te3);
|
|
5368
5522
|
let z2 = T2.get(ee3);
|
|
5369
|
-
z2 !== void 0 && z2 !== he3 && fn2(z2, ee3), v2.get(he3) === ee3 && (N2.delete(he3), A2.delete(he3), M2.add(he3),
|
|
5523
|
+
z2 !== void 0 && z2 !== he3 && fn2(z2, ee3), v2.get(he3) === ee3 && (N2.delete(he3), A2.delete(he3), M2.add(he3), P2.add(he3));
|
|
5370
5524
|
}
|
|
5371
5525
|
}
|
|
5372
5526
|
a(W3, X2);
|
|
5373
5527
|
}
|
|
5374
5528
|
function fn2(W3, X2) {
|
|
5375
|
-
v2.delete(W3), T2.delete(X2), N2.delete(W3), M2.delete(W3), A2.delete(W3),
|
|
5529
|
+
v2.delete(W3), T2.delete(X2), N2.delete(W3), M2.delete(W3), A2.delete(W3), P2.delete(W3);
|
|
5376
5530
|
}
|
|
5377
5531
|
function $3(W3, X2) {
|
|
5378
5532
|
let pe3 = [W3, X2, false], be3 = [];
|
|
@@ -5402,7 +5556,7 @@
|
|
|
5402
5556
|
return be3;
|
|
5403
5557
|
}
|
|
5404
5558
|
function a(W3, X2) {
|
|
5405
|
-
q3(W3, X2), M2.add(W3), x2(W3) &&
|
|
5559
|
+
q3(W3, X2), M2.add(W3), x2(W3) && P2.add(W3);
|
|
5406
5560
|
}
|
|
5407
5561
|
function O2(W3) {
|
|
5408
5562
|
let X2 = v2.get(W3);
|
|
@@ -5410,7 +5564,7 @@
|
|
|
5410
5564
|
let pe3 = s2(W3), be3 = s2(X2);
|
|
5411
5565
|
for (let he3 = 0; he3 < pe3.length && he3 < be3.length; he3++) v2.has(pe3[he3]) || a(pe3[he3], be3[he3]);
|
|
5412
5566
|
}
|
|
5413
|
-
function
|
|
5567
|
+
function R2(W3, X2) {
|
|
5414
5568
|
let pe3 = (te3) => x2(te3) && !ae3(te3) ? n2(te3).sig + "" + n2(te3).hint : null, be3 = io2(W3, pe3), he3 = io2(X2, pe3), ee3 = /* @__PURE__ */ new Map();
|
|
5415
5569
|
for (let te3 of X2) {
|
|
5416
5570
|
let z2 = pe3(te3);
|
|
@@ -5755,14 +5909,14 @@
|
|
|
5755
5909
|
if (v2 >= T2 || C2 + 1 < S2.list.length && S2.list[C2 + 1].bs <= I3.be || f2 > 0 && m2.list[f2 - 1].be >= g.bs) return false;
|
|
5756
5910
|
for (let H2 = v2; H2 < T2; H2++) if (!Gn2(t[H2]) || t[H2].k.includes(`
|
|
5757
5911
|
`)) return false;
|
|
5758
|
-
let A2 = (H2) => t.slice(v2, T2).map((q3, Me3) => H2.raw.get(v2 + Me3) || q3), E2 = [...g.toks, ...A2(S2)], N2 = [...A2(m2), ...I3.toks], M2 = (H2, q3, Me3) => q3 >= 0 && q3 + Me3.length <= H2.length && Me3.every((Oe3, Re3) => H2[q3 + Re3].k === Oe3.k),
|
|
5912
|
+
let A2 = (H2) => t.slice(v2, T2).map((q3, Me3) => H2.raw.get(v2 + Me3) || q3), E2 = [...g.toks, ...A2(S2)], N2 = [...A2(m2), ...I3.toks], M2 = (H2, q3, Me3) => q3 >= 0 && q3 + Me3.length <= H2.length && Me3.every((Oe3, Re3) => H2[q3 + Re3].k === Oe3.k), P2 = (H2, q3, Me3) => fs(H2) && t.slice(q3, Me3).some((Oe3) => !Gn2(Oe3)), V3 = (H2) => H2.some((q3) => !Gn2(q3)), D2, j2, y2, k2;
|
|
5759
5913
|
if (r(g) && V3(g.toks) && M2(N2, 0, g.toks)) {
|
|
5760
5914
|
let H2 = N2.slice(g.toks.length);
|
|
5761
|
-
|
|
5915
|
+
P2(H2, v2, I3.be) || (D2 = v2, j2 = g.toks, y2 = N2.slice(0, g.toks.length), k2 = [null, { bs: v2, be: I3.be, toks: H2 }]);
|
|
5762
5916
|
}
|
|
5763
5917
|
if (D2 === void 0 && r(I3) && V3(I3.toks)) {
|
|
5764
5918
|
let H2 = E2.length - I3.toks.length, q3 = E2.slice(0, H2);
|
|
5765
|
-
M2(E2, H2, I3.toks) && !
|
|
5919
|
+
M2(E2, H2, I3.toks) && !P2(q3, g.bs, T2) && (D2 = T2, j2 = E2.slice(H2), y2 = I3.toks, k2 = [{ bs: g.bs, be: T2, toks: q3 }, null]);
|
|
5766
5920
|
}
|
|
5767
5921
|
if (D2 === void 0) return false;
|
|
5768
5922
|
let J3 = (H2) => H2 && (H2.bs < H2.be || H2.toks.length);
|
|
@@ -5778,8 +5932,8 @@
|
|
|
5778
5932
|
for (let E2 of A2) {
|
|
5779
5933
|
let N2 = i2(p2, m2, E2, T2), M2 = N2 && i2(b, f2, E2, T2);
|
|
5780
5934
|
if (!M2) continue;
|
|
5781
|
-
let
|
|
5782
|
-
for (; V3 < N2.length && V3 < M2.length &&
|
|
5935
|
+
let P2 = (k2, J3) => v2 ? k2[k2.length - 1 - J3] : k2[J3], V3 = 0;
|
|
5936
|
+
for (; V3 < N2.length && V3 < M2.length && P2(N2, V3).k === P2(M2, V3).k; ) V3++;
|
|
5783
5937
|
if (!V3) continue;
|
|
5784
5938
|
let D2 = v2 ? N2.slice(0, N2.length - V3) : N2.slice(V3), j2 = v2 ? M2.slice(0, M2.length - V3) : M2.slice(V3);
|
|
5785
5939
|
if (!(V3 < N2.length && V3 < M2.length && !fs(D2) && !fs(j2) && (r(g) && r(I3) || g.bs === I3.bs && g.be === I3.be) || !(v2 ? N2.slice(N2.length - V3) : N2.slice(0, V3)).some((k2) => !Gn2(k2)))) {
|
|
@@ -5861,9 +6015,9 @@
|
|
|
5861
6015
|
}), De3.length && Ee3.every((Ne3) => Ne3 === 1)) for (let Ne3 of De3) A2(Y2, Ne3);
|
|
5862
6016
|
}
|
|
5863
6017
|
});
|
|
5864
|
-
let
|
|
5865
|
-
for (;
|
|
5866
|
-
|
|
6018
|
+
let P2 = true;
|
|
6019
|
+
for (; P2; ) {
|
|
6020
|
+
P2 = false;
|
|
5867
6021
|
let x2 = /* @__PURE__ */ new Map();
|
|
5868
6022
|
m2.forEach((Y2, ae3) => {
|
|
5869
6023
|
let oe3 = T2(ae3), Ee3 = x2.get(oe3) || { bs: Y2.bs, be: Y2.be, L: false, R: false };
|
|
@@ -5872,7 +6026,7 @@
|
|
|
5872
6026
|
for (let [oe3, Ee3] of x2) {
|
|
5873
6027
|
if (T2(ae3) === T2(oe3) || !(Ee3.L && Ee3.R)) continue;
|
|
5874
6028
|
let De3 = Y2.bs < Ee3.be && Y2.be > Ee3.bs, Ne3 = w2(Y2) && c2(Y2) && (Y2.bs === Ee3.be || Y2.bs === Ee3.bs);
|
|
5875
|
-
(De3 || Ne3) && A2(ae3, oe3) && (
|
|
6029
|
+
(De3 || Ne3) && A2(ae3, oe3) && (P2 = true);
|
|
5876
6030
|
}
|
|
5877
6031
|
});
|
|
5878
6032
|
}
|
|
@@ -6018,8 +6172,8 @@
|
|
|
6018
6172
|
let r = [], i2 = (T2) => ({ status: "fallback", reason: T2 }), u2 = (T2) => T2 > l.remaining ? false : (l.remaining -= T2, true);
|
|
6019
6173
|
if (!u2((t.length + n2.length) * 3)) return i2("work-limit");
|
|
6020
6174
|
for (let [T2, A2] of [["retained", t], ["transfer", n2]]) for (let E2 of A2) {
|
|
6021
|
-
let { from: N2, to: M2, target:
|
|
6022
|
-
if (!Number.isInteger(N2) || !Number.isInteger(M2) || !Number.isInteger(
|
|
6175
|
+
let { from: N2, to: M2, target: P2 } = E2;
|
|
6176
|
+
if (!Number.isInteger(N2) || !Number.isInteger(M2) || !Number.isInteger(P2) || N2 < 0 || M2 <= N2 || M2 > e.text.length || P2 < 0 || P2 + M2 - N2 > o2.text.length) return i2("invalid-range");
|
|
6023
6177
|
r.push({ ...E2, kind: T2 });
|
|
6024
6178
|
}
|
|
6025
6179
|
let w2 = /* @__PURE__ */ Symbol(), c2 = (T2) => (A2, E2) => {
|
|
@@ -6041,8 +6195,8 @@
|
|
|
6041
6195
|
for (let E2 = 0; E2 < A2; E2++) {
|
|
6042
6196
|
let N2 = T2.from + E2, M2 = T2.target + E2;
|
|
6043
6197
|
if (l.comparisons++, e.text[N2] !== o2.text[M2]) return i2("unequal-occurrence");
|
|
6044
|
-
let
|
|
6045
|
-
if (!!
|
|
6198
|
+
let P2 = e.atomAt.get(N2), V3 = o2.atomAt.get(M2);
|
|
6199
|
+
if (!!P2 != !!V3 || P2 && s2(P2) !== h(V3)) return i2("different-atom");
|
|
6046
6200
|
}
|
|
6047
6201
|
}
|
|
6048
6202
|
let S2 = e.text.length + o2.text.length + 2, C2 = r.reduce((T2, A2) => T2 + (A2.to - A2.from) * 2, 2);
|
|
@@ -6158,12 +6312,12 @@
|
|
|
6158
6312
|
if (u2(i2, v2.length + T2.length * 3), !Vo.test(T2) || T2.length >= v2.length) return null;
|
|
6159
6313
|
let A2 = v2.startsWith(T2), E2 = v2.endsWith(T2);
|
|
6160
6314
|
if (A2 === E2) return null;
|
|
6161
|
-
let N2 = A2 ? T2.length : 0, M2 = A2 ? v2.length : v2.length - T2.length,
|
|
6162
|
-
for (;
|
|
6163
|
-
for (; V3 >
|
|
6164
|
-
if (
|
|
6315
|
+
let N2 = A2 ? T2.length : 0, M2 = A2 ? v2.length : v2.length - T2.length, P2 = N2, V3 = M2;
|
|
6316
|
+
for (; P2 < V3 && (u2(i2, 1), !!$s2.test(v2[P2])); ) P2++;
|
|
6317
|
+
for (; V3 > P2 && (u2(i2, 1), !!$s2.test(v2[V3 - 1])); ) V3--;
|
|
6318
|
+
if (P2 === V3) return null;
|
|
6165
6319
|
let D2 = r(f2, i2), j2 = false, y2 = false;
|
|
6166
|
-
for (let k2 of D2) u2(i2, 1), k2.from ===
|
|
6320
|
+
for (let k2 of D2) u2(i2, 1), k2.from === P2 && (j2 = true), k2.to === V3 && (y2 = true);
|
|
6167
6321
|
return !j2 || !y2 ? null : { source: e, side: o2, flat: f2.flat, from: N2, to: M2 };
|
|
6168
6322
|
}
|
|
6169
6323
|
function Gs2({ base: e, views: o2, side: t, attempt: n2, eligible: s2, blocked: h, baseId: l, model: r, tokensOf: i2, certificates: u2, charge: w2, exhausted: c2, limit: p2 }) {
|
|
@@ -6176,9 +6330,9 @@
|
|
|
6176
6330
|
if (N2.nodeType !== 1 || C2.identical.has(N2) || f2.A.identical.has(N2) || h.has(N2) || !s2(N2)) continue;
|
|
6177
6331
|
let M2 = ys({ source: N2, side: t, views: o2, eligible: s2, blocked: h, baseId: l, model: r, tokensOf: i2, budget: b, charge: w2 });
|
|
6178
6332
|
if (!M2 || ws2(M2, u2, b, w2)) continue;
|
|
6179
|
-
let { flat:
|
|
6333
|
+
let { flat: P2, from: V3, to: D2 } = M2;
|
|
6180
6334
|
w2(b, (D2 - V3) * 2);
|
|
6181
|
-
let j2 =
|
|
6335
|
+
let j2 = P2.text.slice(V3, D2).trim();
|
|
6182
6336
|
for (let y2 = v2; y2 <= T2; y2++) {
|
|
6183
6337
|
w2(b, 1);
|
|
6184
6338
|
let k2 = S2.units[y2], J3 = S2.baseOf(k2);
|
|
@@ -6580,7 +6734,7 @@
|
|
|
6580
6734
|
let Q3 = B2 || d, me3 = F2 || d, ke3 = t === "local" ? Q3.isEqualNode(d) ? me3 : Q3 : me3.isEqualNode(d) ? Q3 : me3;
|
|
6581
6735
|
for (let Se3 of ke3.childNodes) _.appendChild(o2.importNode(Se3, true));
|
|
6582
6736
|
return h.set(_, { base: d, local: B2, remote: F2 }), _;
|
|
6583
|
-
}),
|
|
6737
|
+
}), P2 = e.cloneUnit || ((d, B2) => {
|
|
6584
6738
|
let F2 = o2.importNode(d, true);
|
|
6585
6739
|
return h.set(F2, { base: null, local: B2 === "local" ? d : null, remote: B2 === "remote" ? d : null }), F2;
|
|
6586
6740
|
}), V3 = e.atomKey || ((d) => sr2(d, () => false)), D2 = (d, B2) => {
|
|
@@ -6707,7 +6861,7 @@
|
|
|
6707
6861
|
for (; B2 > 0 && /\s/.test(m2.text[B2 - 1]); ) B2--;
|
|
6708
6862
|
for (; F2 < m2.text.length && /\s/.test(m2.text[F2]); ) F2++;
|
|
6709
6863
|
return (B2 === 0 || m2.text[B2 - 1] === kt3) && (F2 === m2.text.length || m2.text[F2] === kt3);
|
|
6710
|
-
}, O2 = (d, B2) => !$3(d, B2) && !a(d),
|
|
6864
|
+
}, O2 = (d, B2) => !$3(d, B2) && !a(d), R2 = (d, B2) => Yt3(d, B2) || fn2(d, B2) && !(d.transferIn || d.transferOut || B2.transferIn || B2.transferOut) && !(rn(d, f2, B2) && O2(B2, g)) && !(rn(B2, g, d) && O2(d, f2)), K2 = (d, B2) => {
|
|
6711
6865
|
if (d.bs !== B2.bs || d.be !== B2.be || d.toks.length !== B2.toks.length) return false;
|
|
6712
6866
|
let F2 = d.ss, _ = B2.ss;
|
|
6713
6867
|
for (let Q3 = 0; Q3 < d.toks.length; Q3++) {
|
|
@@ -6732,7 +6886,7 @@
|
|
|
6732
6886
|
let _t2 = rn(d, f2), So2 = rn(B2, g);
|
|
6733
6887
|
_t2 !== So2 && (F2 = So2);
|
|
6734
6888
|
}
|
|
6735
|
-
let _ = F2 ? d : B2, Q3 = F2 ? B2 : d, me3 = !!Q3 && K2(d, B2), ke3 = !!Q3 && (F2 ? !!le3[W3 + 1] && K2(le3[W3 + 1], B2) : !!Ae3[X2 + 1] && K2(d, Ae3[X2 + 1])), Se3 = !!Q3 && !me3 && !ke3 && (qe3 === 0 ||
|
|
6889
|
+
let _ = F2 ? d : B2, Q3 = F2 ? B2 : d, me3 = !!Q3 && K2(d, B2), ke3 = !!Q3 && (F2 ? !!le3[W3 + 1] && K2(le3[W3 + 1], B2) : !!Ae3[X2 + 1] && K2(d, Ae3[X2 + 1])), Se3 = !!Q3 && !me3 && !ke3 && (qe3 === 0 || R2(d, B2)), je3 = Se3, Le3 = wn2(_, F2 ? It3 : cn2);
|
|
6736
6890
|
if (Le3 === "straddle" && (je3 = true), !je3 && _.be > _.bs && (je3 = Z3(_, F2 ? xe3 : ie3, F2 ? g : f2, F2 ? oe3 : Ee3)), !je3 && me3) {
|
|
6737
6891
|
ee3(_.bs), U3.push({ src: "both", lfrom: d.ss, rfrom: B2.ss, len: _.text.length, owner: d.owner || B2.owner || null, transfer: d.transferIn || B2.transferIn || null }), pe3 = _.be, be3 += _.text.length - (_.be - _.bs), he3 += _.text.length - (_.be - _.bs), W3++, X2++;
|
|
6738
6892
|
continue;
|
|
@@ -7128,7 +7282,7 @@
|
|
|
7128
7282
|
let Le3 = n2.map.get(je3.el) || null, Ue3 = s2.map.get(je3.el) || null;
|
|
7129
7283
|
Se3 = M2(je3.el, Le3, Ue3), (!Le3 || !Ue3) && w2({ kind: "structure", el: null, detail: "move-beats-delete", base: je3.el }, { subject: je3.el, deleted: Le3 ? "remote" : "local" }), i2.push({ kind: "move", el: Se3, source: ke3.from });
|
|
7130
7284
|
}
|
|
7131
|
-
} else ke3.al ? (Se3 =
|
|
7285
|
+
} else ke3.al ? (Se3 = P2(ke3.al.el, "local"), ke3.ar && (h.get(Se3).remote = ke3.ar.el), i2.push({ kind: "insert", el: Se3, source: ke3.ar ? "both" : "local" })) : (Se3 = P2(ke3.ar.el, "remote"), i2.push({ kind: "insert", el: Se3, source: "remote" }));
|
|
7132
7286
|
_n2 && c2.atomOut.set(d, Se3), on3(Se3);
|
|
7133
7287
|
continue;
|
|
7134
7288
|
}
|
|
@@ -7325,10 +7479,10 @@
|
|
|
7325
7479
|
u2.add(A2.node);
|
|
7326
7480
|
let E2 = 0, N2 = null;
|
|
7327
7481
|
for (let M2 = A2.s; M2 < A2.e; M2++) {
|
|
7328
|
-
let
|
|
7329
|
-
if (
|
|
7330
|
-
for ((!T2[E2] ||
|
|
7331
|
-
let V3 = T2[E2] && T2[E2].ms <=
|
|
7482
|
+
let P2 = v2.lToM[M2];
|
|
7483
|
+
if (P2 < 0) continue;
|
|
7484
|
+
for ((!T2[E2] || P2 < T2[E2].ms) && (E2 = 0); E2 < T2.length && T2[E2].me <= P2; ) E2++;
|
|
7485
|
+
let V3 = T2[E2] && T2[E2].ms <= P2 ? T2[E2].node : Ts2;
|
|
7332
7486
|
V3 !== N2 && r(A2.node, V3), N2 = V3;
|
|
7333
7487
|
}
|
|
7334
7488
|
}
|
|
@@ -7365,15 +7519,15 @@
|
|
|
7365
7519
|
let A2 = T2 ? T2.values().next().value : null;
|
|
7366
7520
|
if (A2 && (A2.nodeType !== 1 || !w2.has(A2))) return { kind: "unknown", reason: "output-not-placed" };
|
|
7367
7521
|
if (!A2) {
|
|
7368
|
-
let
|
|
7369
|
-
if (
|
|
7370
|
-
if (
|
|
7522
|
+
let P2 = m2(v2) ? "decided" : f2(v2);
|
|
7523
|
+
if (P2 === "kept") return { kind: "untouched" };
|
|
7524
|
+
if (P2 !== "decided") return { kind: "unknown", reason: "unmapped" };
|
|
7371
7525
|
}
|
|
7372
7526
|
let E2 = [], N2 = M2(v2, !!A2 && (p2.has(v2) || b.has(v2)), !A2 || m2(v2));
|
|
7373
7527
|
if (N2) return { kind: "unknown", reason: N2 };
|
|
7374
7528
|
return A2 ? { kind: "single", output: A2, owned: E2, carried: b.has(v2) } : { kind: "removed" };
|
|
7375
|
-
function M2(
|
|
7376
|
-
for (let j2 = ir2(
|
|
7529
|
+
function M2(P2, V3, D2) {
|
|
7530
|
+
for (let j2 = ir2(P2).firstChild; j2; j2 = j2.nextSibling) {
|
|
7377
7531
|
if (j2.nodeType === 1 ? h(j2) : j2.nodeType !== 3 && j2.nodeType !== 8) continue;
|
|
7378
7532
|
let y2 = l.get(j2);
|
|
7379
7533
|
if (y2) for (let k2 of y2) {
|
|
@@ -7543,15 +7697,15 @@
|
|
|
7543
7697
|
let i2 = (N2) => N2 > r.remaining ? false : (r.remaining -= N2, r.nativeSteps = (r.nativeSteps || 0) + N2, true);
|
|
7544
7698
|
if (e.length < 2 || o2.length !== e.length || t.length !== e.length || !i2(e.length * 12)) return null;
|
|
7545
7699
|
for (let [N2, M2] of [["base", e], ["local", o2], ["remote", t]]) {
|
|
7546
|
-
let
|
|
7547
|
-
if (
|
|
7700
|
+
let P2 = l[N2];
|
|
7701
|
+
if (P2.length !== M2.length || P2.some((V3, D2) => V3 !== M2[D2])) return null;
|
|
7548
7702
|
}
|
|
7549
7703
|
let u2 = [], w2 = 0;
|
|
7550
7704
|
for (let N2 = 0; N2 < e.length; N2++) {
|
|
7551
|
-
let M2 = e[N2],
|
|
7552
|
-
if (n2(M2) !==
|
|
7705
|
+
let M2 = e[N2], P2 = o2[N2], V3 = t[N2];
|
|
7706
|
+
if (n2(M2) !== P2 || s2(M2) !== V3) return null;
|
|
7553
7707
|
let D2 = {};
|
|
7554
|
-
for (let [j2, y2] of [["base", M2], ["local",
|
|
7708
|
+
for (let [j2, y2] of [["base", M2], ["local", P2], ["remote", V3]]) {
|
|
7555
7709
|
if (!h(y2) || y2.tagName !== M2.tagName || y2.namespaceURI !== M2.namespaceURI || !i2(y2.childNodes.length + 1)) return null;
|
|
7556
7710
|
let k2 = "";
|
|
7557
7711
|
for (let J3 of y2.childNodes) {
|
|
@@ -7561,20 +7715,20 @@
|
|
|
7561
7715
|
if (k2.includes(kt3) || (w2 += k2.length + 1, w2 > 2e4)) return null;
|
|
7562
7716
|
D2[j2] = k2;
|
|
7563
7717
|
}
|
|
7564
|
-
u2.push({ base: M2, local:
|
|
7718
|
+
u2.push({ base: M2, local: P2, remote: V3, index: N2, text: D2 });
|
|
7565
7719
|
}
|
|
7566
7720
|
let c2 = u2.every((N2) => xn2(N2.text.base, N2.text.local, N2.text.remote)), p2 = { local: [], remote: [] };
|
|
7567
7721
|
for (let N2 of u2) {
|
|
7568
7722
|
N2.hunks = { local: [], remote: [] };
|
|
7569
7723
|
for (let M2 of ["local", "remote"]) {
|
|
7570
|
-
let
|
|
7571
|
-
if (
|
|
7572
|
-
let D2 =
|
|
7724
|
+
let P2 = N2.text.base, V3 = N2.text[M2];
|
|
7725
|
+
if (P2 === V3) continue;
|
|
7726
|
+
let D2 = P2.length + V3.length + 4, j2 = D2 * 8;
|
|
7573
7727
|
if (!i2(j2)) return null;
|
|
7574
7728
|
let y2 = Math.floor(r.remaining / 8), k2 = Math.min(4e3, Math.max(0, Math.floor((Math.sqrt(D2 * D2 + y2) - D2) / 2)));
|
|
7575
7729
|
if (k2 < 1 || !i2(4 * (k2 + 1) * (D2 + k2 + 1))) return null;
|
|
7576
7730
|
let J3 = 0;
|
|
7577
|
-
for (let H2 of Yn2(
|
|
7731
|
+
for (let H2 of Yn2(P2, V3, k2)) {
|
|
7578
7732
|
if (!i2(H2.text.length + 1)) return null;
|
|
7579
7733
|
let q3 = H2.bs + J3, Me3 = { ...H2, ss: q3, se: q3 + H2.text.length, toks: an2(H2.text, c2), owner: N2.base, ownerIndex: N2.index };
|
|
7580
7734
|
N2.hunks[M2].push(Me3), p2[M2].push(Me3), J3 += H2.text.length - (H2.be - H2.bs);
|
|
@@ -7583,7 +7737,7 @@
|
|
|
7583
7737
|
}
|
|
7584
7738
|
let b = [], S2 = { local: /* @__PURE__ */ new Map(), remote: /* @__PURE__ */ new Map() };
|
|
7585
7739
|
for (let N2 of ["local", "remote"]) {
|
|
7586
|
-
let M2 = /* @__PURE__ */ new Map(),
|
|
7740
|
+
let M2 = /* @__PURE__ */ new Map(), P2 = /* @__PURE__ */ new Map(), V3 = false, D2 = (j2, y2, k2) => {
|
|
7587
7741
|
j2.has(y2) ? j2.set(y2, null) : j2.set(y2, k2);
|
|
7588
7742
|
};
|
|
7589
7743
|
for (let j2 of p2[N2]) {
|
|
@@ -7595,12 +7749,12 @@
|
|
|
7595
7749
|
/\S/.test(k2) && D2(M2, k2, j2);
|
|
7596
7750
|
} else if (j2.bs === j2.be && /\S/.test(j2.text)) {
|
|
7597
7751
|
if (!i2(j2.text.length * 2)) return null;
|
|
7598
|
-
D2(
|
|
7752
|
+
D2(P2, j2.text, j2);
|
|
7599
7753
|
} else j2.bs < j2.be && (V3 = true);
|
|
7600
7754
|
}
|
|
7601
7755
|
for (let [j2, y2] of M2) {
|
|
7602
7756
|
if (!i2(j2.length + 1)) return null;
|
|
7603
|
-
let k2 =
|
|
7757
|
+
let k2 = P2.get(j2);
|
|
7604
7758
|
if (!y2 || !k2 || y2.owner === k2.owner) continue;
|
|
7605
7759
|
let J3 = u2[y2.ownerIndex];
|
|
7606
7760
|
if (!i2(J3.text.base.length)) return null;
|
|
@@ -7608,47 +7762,47 @@
|
|
|
7608
7762
|
let H2 = `${J3.index}:${y2.bs}:${y2.be}`, q3 = { key: H2, side: N2, source: y2.owner, destination: k2.owner, deletion: y2, insertion: k2 };
|
|
7609
7763
|
y2.transferOut = q3, k2.transferIn = q3, S2[N2].set(H2, q3), b.push(q3);
|
|
7610
7764
|
}
|
|
7611
|
-
if (V3 &&
|
|
7765
|
+
if (V3 && P2.size && !Wi2(N2, p2[N2], u2, b, S2, c2, i2)) return null;
|
|
7612
7766
|
}
|
|
7613
7767
|
if (!b.length) return null;
|
|
7614
7768
|
let C2 = (N2, M2) => N2.bs < M2.be && M2.bs < N2.be, m2 = (N2) => N2.bs === N2.be, f2 = (N2, M2) => N2.bs <= M2.be && M2.bs <= N2.be && m2(N2) !== m2(M2), g = (N2, M2) => N2.bs === M2.bs && N2.be === M2.be && N2.text === M2.text, I3 = (N2, M2) => !!(N2.transferIn || N2.transferOut && (!N2.text || M2.bs === N2.be && /\s/.test(M2.text[0]) || M2.bs === N2.bs && /\s/.test(M2.text[M2.text.length - 1])));
|
|
7615
7769
|
for (let N2 of b) {
|
|
7616
|
-
let M2 = N2.side === "local" ? "remote" : "local",
|
|
7617
|
-
for (let V3 of
|
|
7770
|
+
let M2 = N2.side === "local" ? "remote" : "local", P2 = u2[N2.deletion.ownerIndex];
|
|
7771
|
+
for (let V3 of P2.hunks[M2]) if (!i2(1) || C2(N2.deletion, V3) && V3.transferOut?.key !== N2.key) return null;
|
|
7618
7772
|
}
|
|
7619
|
-
for (let N2 of u2) for (let M2 of N2.hunks.local) for (let
|
|
7773
|
+
for (let N2 of u2) for (let M2 of N2.hunks.local) for (let P2 of N2.hunks.remote) {
|
|
7620
7774
|
if (!i2(1)) return null;
|
|
7621
|
-
if (g(M2,
|
|
7622
|
-
if (M2.transferIn?.key !==
|
|
7775
|
+
if (g(M2, P2)) {
|
|
7776
|
+
if (M2.transferIn?.key !== P2.transferIn?.key) return null;
|
|
7623
7777
|
continue;
|
|
7624
7778
|
}
|
|
7625
|
-
if (C2(M2,
|
|
7779
|
+
if (C2(M2, P2) || f2(M2, P2) && !I3(M2, P2) && !I3(P2, M2)) return null;
|
|
7626
7780
|
}
|
|
7627
7781
|
if (!i2(w2 * 8)) return null;
|
|
7628
7782
|
let v2 = /* @__PURE__ */ new Set([...e, ...o2, ...t]), T2 = { base: nn2(e, { blocks: v2 }), local: nn2(o2, { blocks: v2 }), remote: nn2(t, { blocks: v2 }) }, A2 = {};
|
|
7629
7783
|
for (let N2 of ["base", "local", "remote"]) {
|
|
7630
7784
|
let M2 = T2[N2];
|
|
7631
7785
|
if (M2.atoms.length || M2.pins.length) return null;
|
|
7632
|
-
A2[N2] = new Map(M2.marks.filter((
|
|
7786
|
+
A2[N2] = new Map(M2.marks.filter((P2) => P2.block).map((P2) => [P2.el, P2.from]));
|
|
7633
7787
|
}
|
|
7634
7788
|
for (let N2 of u2) {
|
|
7635
7789
|
let M2 = A2.base.get(N2.base);
|
|
7636
7790
|
if (M2 === void 0) return null;
|
|
7637
|
-
for (let
|
|
7638
|
-
let V3 = A2[
|
|
7791
|
+
for (let P2 of ["local", "remote"]) {
|
|
7792
|
+
let V3 = A2[P2].get(N2[P2]);
|
|
7639
7793
|
if (V3 === void 0) return null;
|
|
7640
|
-
for (let D2 of N2.hunks[
|
|
7794
|
+
for (let D2 of N2.hunks[P2]) D2.bs += M2, D2.be += M2, D2.ss += V3, D2.se += V3;
|
|
7641
7795
|
}
|
|
7642
7796
|
}
|
|
7643
7797
|
for (let N2 of b) N2.bs = N2.deletion.bs + (N2.sourceOffset || 0), N2.be = N2.length === void 0 ? N2.deletion.be : N2.bs + N2.length, N2.ss = N2.insertion.ss + (N2.targetOffset || 0), N2.se = N2.length === void 0 ? N2.insertion.se : N2.ss + N2.length;
|
|
7644
7798
|
let E2 = {};
|
|
7645
7799
|
for (let N2 of ["local", "remote"]) {
|
|
7646
|
-
let M2 = 0,
|
|
7800
|
+
let M2 = 0, P2 = 0, V3 = [];
|
|
7647
7801
|
for (let j2 of p2[N2]) {
|
|
7648
7802
|
if (!i2(1)) return null;
|
|
7649
|
-
j2.bs > M2 && V3.push({ from: M2, to: j2.bs, target:
|
|
7803
|
+
j2.bs > M2 && V3.push({ from: M2, to: j2.bs, target: P2 }), M2 = j2.be, P2 = j2.se;
|
|
7650
7804
|
}
|
|
7651
|
-
M2 < T2.base.text.length && V3.push({ from: M2, to: T2.base.text.length, target:
|
|
7805
|
+
M2 < T2.base.text.length && V3.push({ from: M2, to: T2.base.text.length, target: P2 });
|
|
7652
7806
|
let D2 = b.filter((j2) => j2.side === N2).map((j2) => ({ from: j2.bs, to: j2.be, target: j2.ss, destination: j2.destination }));
|
|
7653
7807
|
if (E2[N2] = Dn2({ base: T2.base, side: T2[N2], retained: V3, transfers: D2, budget: r }), E2[N2].status !== "ready") return null;
|
|
7654
7808
|
}
|
|
@@ -7687,11 +7841,11 @@
|
|
|
7687
7841
|
u2(1);
|
|
7688
7842
|
let { source: f2, target: g, side: I3, models: v2, runs: T2 } = m2;
|
|
7689
7843
|
if (I3 !== 0 && I3 !== 1 || !c2[0].has(f2) || !c2[I3 + 1].has(g)) continue;
|
|
7690
|
-
let { V: A2, A: E2, idOf: N2 } = t[I3], M2 = t[1 - I3],
|
|
7691
|
-
if (!
|
|
7844
|
+
let { V: A2, A: E2, idOf: N2 } = t[I3], M2 = t[1 - I3], P2 = A2.twin(f2), V3 = M2.V.twin(f2), D2 = A2.baseOf(g);
|
|
7845
|
+
if (!P2 || !V3 || !D2 || D2 === f2 || !c2[0].has(D2) || !c2[I3 + 1].has(P2) || !c2[2 - I3].has(V3) || E2.map.get(f2) !== P2 || E2.reverse.get(P2) !== f2 || M2.A.map.get(f2) !== V3 || M2.A.reverse.get(V3) !== f2 || E2.map.get(D2) !== g || E2.reverse.get(g) !== D2 || g.parentNode !== P2.parentNode || D2.parentNode !== f2.parentNode || f2.tagName !== P2.tagName || f2.tagName !== V3.tagName || s2(f2) !== N2(P2) || s2(f2) !== M2.idOf(V3) || s2(D2) !== N2(g)) continue;
|
|
7692
7846
|
let j2 = v2.get(f2), y2 = v2.get(g);
|
|
7693
7847
|
if (!j2 || !y2) continue;
|
|
7694
|
-
let k2 = w2(f2, j2), J3 = w2(g, y2), H2 = w2(
|
|
7848
|
+
let k2 = w2(f2, j2), J3 = w2(g, y2), H2 = w2(P2), q3 = w2(V3);
|
|
7695
7849
|
if (u2((k2?.length || 0) + (q3?.length || 0)), k2 === null || J3 === null || H2 === null || q3 === null || q3 === k2) continue;
|
|
7696
7850
|
let Me3 = T2.length > 0, Oe3 = false;
|
|
7697
7851
|
for (let ie3 of T2) {
|
|
@@ -8388,10 +8542,10 @@
|
|
|
8388
8542
|
let c2 = { base: to2(e.roots.base), local: to2(e.roots.local), remote: to2(e.roots.remote) }, p2 = ($3) => $3 === "local" ? o2 : t, b = ($3, a) => {
|
|
8389
8543
|
if (!a) return null;
|
|
8390
8544
|
if ($3.map.has(a)) return $3.map.get(a);
|
|
8391
|
-
let O2 = [],
|
|
8392
|
-
for (;
|
|
8393
|
-
if (!
|
|
8394
|
-
let K2 = $3.map.get(
|
|
8545
|
+
let O2 = [], R2 = dn2(a) ? c2.base.logicalParent(a) : a.parent;
|
|
8546
|
+
for (; R2 && !$3.map.has(R2); R2 = c2.base.logicalParent(R2)) O2.push(R2);
|
|
8547
|
+
if (!R2 || !$3.identical.has(R2)) return null;
|
|
8548
|
+
let K2 = $3.map.get(R2);
|
|
8395
8549
|
for (let Z3 = O2.length - 1; Z3 >= 0 && K2; Z3--) K2 = Cn2(K2).childNodes[c2.base.indexIn(O2[Z3].parentNode, O2[Z3])];
|
|
8396
8550
|
return K2 ? dn2(a) ? Cn2(K2).childNodes[c2.base.indexIn(a.parentNode, a)] || null : n2(K2)[n2(a.parent).indexOf(a)] || null : null;
|
|
8397
8551
|
}, S2 = /* @__PURE__ */ new Map(), C2 = /* @__PURE__ */ new Map(), m2 = /* @__PURE__ */ new WeakMap(), f2 = 0, g = ($3, a) => {
|
|
@@ -8402,37 +8556,37 @@
|
|
|
8402
8556
|
C2.set(a, f2++);
|
|
8403
8557
|
let O2 = s2.get(a);
|
|
8404
8558
|
if (O2 && !O2.pinned) {
|
|
8405
|
-
for (let
|
|
8406
|
-
else g(
|
|
8559
|
+
for (let R2 of [O2.base, O2.local, O2.remote]) if (R2) if (Array.isArray(R2)) for (let K2 of R2) g(K2, a);
|
|
8560
|
+
else g(R2, a);
|
|
8407
8561
|
}
|
|
8408
8562
|
if (Xo2(a)) {
|
|
8409
8563
|
m2.set(a.content, a);
|
|
8410
|
-
for (let
|
|
8564
|
+
for (let R2 = a.content.firstChild; R2; R2 = R2.nextSibling) $3(R2);
|
|
8411
8565
|
}
|
|
8412
|
-
for (let
|
|
8566
|
+
for (let R2 = a.firstChild; R2; R2 = R2.nextSibling) $3(R2);
|
|
8413
8567
|
})(w2);
|
|
8414
8568
|
let I3 = /* @__PURE__ */ new Map();
|
|
8415
8569
|
c2.out = to2(w2, m2, I3);
|
|
8416
8570
|
let v2 = { refs: /* @__PURE__ */ new Map(), spans: /* @__PURE__ */ new Map(), anchors: /* @__PURE__ */ new Map(), via: I3, outOwners: m2, outRoot: w2, localRoot: e.roots.local }, T2 = ($3) => dn2($3) ? [$3] : $3.nodes, A2 = ($3, a) => {
|
|
8417
8571
|
let O2 = c2[a].logicalParent($3);
|
|
8418
8572
|
if (!O2) return null;
|
|
8419
|
-
for (let
|
|
8573
|
+
for (let R2 of n2(O2)) if (!dn2(R2) && R2.nodes.includes($3)) return R2;
|
|
8420
8574
|
return null;
|
|
8421
8575
|
}, E2 = ($3, a) => $3 == null ? null : Array.isArray($3) ? $3.length ? A2($3[0], a) : null : $3, N2 = ($3) => {
|
|
8422
8576
|
let a = /* @__PURE__ */ new Set(), O2 = [];
|
|
8423
|
-
for (let
|
|
8424
|
-
return O2.sort((
|
|
8425
|
-
}, M2 = /* @__PURE__ */ new Map(),
|
|
8577
|
+
for (let R2 of $3) for (let K2 of S2.get(R2) || []) a.has(K2) || (a.add(K2), O2.push(K2));
|
|
8578
|
+
return O2.sort((R2, K2) => C2.get(R2) - C2.get(K2));
|
|
8579
|
+
}, M2 = /* @__PURE__ */ new Map(), P2 = ($3) => {
|
|
8426
8580
|
let a = $3.b || $3.l || $3.r, O2 = M2.get(a);
|
|
8427
8581
|
if (O2) return O2;
|
|
8428
|
-
let
|
|
8429
|
-
for (let K2 of [$3.b, $3.l, $3.r]) K2 &&
|
|
8430
|
-
return O2 = N2(
|
|
8582
|
+
let R2 = [];
|
|
8583
|
+
for (let K2 of [$3.b, $3.l, $3.r]) K2 && R2.push(...T2(K2));
|
|
8584
|
+
return O2 = N2(R2), M2.set(a, O2), O2;
|
|
8431
8585
|
}, V3 = ($3) => ({ b: $3, l: b(o2, $3), r: b(t, $3) }), D2 = ($3, a) => {
|
|
8432
8586
|
let O2 = p2(a).reverse.get($3);
|
|
8433
8587
|
if (O2) return V3(O2);
|
|
8434
|
-
for (let
|
|
8435
|
-
let K2 = s2.get(
|
|
8588
|
+
for (let R2 of N2(T2($3))) {
|
|
8589
|
+
let K2 = s2.get(R2);
|
|
8436
8590
|
if (K2 && !K2.base && K2.local && K2.remote) return { b: null, l: E2(K2.local, "local"), r: E2(K2.remote, "remote") };
|
|
8437
8591
|
}
|
|
8438
8592
|
return a === "local" ? { b: null, l: $3, r: null } : { b: null, l: null, r: $3 };
|
|
@@ -8441,33 +8595,33 @@
|
|
|
8441
8595
|
if (!a || a.pinned) return null;
|
|
8442
8596
|
let O2 = E2(a.base, "base");
|
|
8443
8597
|
if (O2) return V3(O2);
|
|
8444
|
-
let
|
|
8445
|
-
if (
|
|
8446
|
-
let Z3 = o2.reverse.get(
|
|
8598
|
+
let R2 = E2(a.local, "local"), K2 = E2(a.remote, "remote");
|
|
8599
|
+
if (R2) {
|
|
8600
|
+
let Z3 = o2.reverse.get(R2);
|
|
8447
8601
|
if (Z3) return V3(Z3);
|
|
8448
8602
|
}
|
|
8449
8603
|
if (K2) {
|
|
8450
8604
|
let Z3 = t.reverse.get(K2);
|
|
8451
8605
|
if (Z3) return V3(Z3);
|
|
8452
8606
|
}
|
|
8453
|
-
return
|
|
8607
|
+
return R2 || K2 ? { b: null, l: R2, r: K2 } : null;
|
|
8454
8608
|
}, k2 = ($3) => (j2.has($3) || j2.set($3, y2($3)), j2.get($3)), J3 = ($3, a) => dn2($3) ? c2[a].logicalParent($3) : $3.parent, H2 = /* @__PURE__ */ new Map(), q3 = /* @__PURE__ */ new Map(), Me3 = ($3, a) => (dn2($3) ? [c2[a].pathOf($3)] : $3.nodes.map((O2) => c2[a].pathOf(O2))).filter(Boolean), Oe3 = ($3) => {
|
|
8455
|
-
let a = $3.b || $3.l || $3.r, O2 = $3.b ? "base" : $3.l ? "local" : "remote",
|
|
8456
|
-
if (
|
|
8609
|
+
let a = $3.b || $3.l || $3.r, O2 = $3.b ? "base" : $3.l ? "local" : "remote", R2 = q3.get(a);
|
|
8610
|
+
if (R2) return R2;
|
|
8457
8611
|
let K2 = !dn2(a), Z3 = Me3(a, O2)[0], U3 = `${O2[0]}:${JSON.stringify(Z3 === void 0 ? null : Z3)}${K2 ? ":run" : ""}`, de3 = H2.get(U3);
|
|
8458
8612
|
if (de3) return q3.set(a, de3), de3;
|
|
8459
|
-
let we3 =
|
|
8613
|
+
let we3 = P2($3);
|
|
8460
8614
|
return de3 = { key: U3, nodeType: dn2(a) ? 1 : a.kind === "comment" ? 8 : 3, base: $3.b ? Me3($3.b, "base") : [], local: $3.l ? Me3($3.l, "local") : [], remote: $3.r ? Me3($3.r, "remote") : [], merged: we3.map((le3) => c2.out.pathOf(le3)).filter(Boolean), live: [] }, H2.set(U3, de3), q3.set(a, de3), v2.refs.set(de3, we3), de3;
|
|
8461
8615
|
}, Re3 = { base: /* @__PURE__ */ new Map(), local: /* @__PURE__ */ new Map(), remote: /* @__PURE__ */ new Map() }, ie3 = /* @__PURE__ */ new Map(), xe3 = ($3, a) => {
|
|
8462
8616
|
let O2 = J3($3, a);
|
|
8463
8617
|
if (!O2 || O2.nodeType !== 1) return null;
|
|
8464
|
-
let
|
|
8465
|
-
if (!
|
|
8618
|
+
let R2 = Re3[a].get(O2);
|
|
8619
|
+
if (!R2) {
|
|
8466
8620
|
let Z3 = n2(O2), U3 = (de3) => Oe3(a === "base" ? V3(de3) : D2(de3, a));
|
|
8467
|
-
|
|
8621
|
+
R2 = { parent: U3(O2), refs: Z3.map(U3), index: new Map(Z3.map((de3, we3) => [de3, we3])) }, Re3[a].set(O2, R2);
|
|
8468
8622
|
}
|
|
8469
|
-
let K2 =
|
|
8470
|
-
return { parent:
|
|
8623
|
+
let K2 = R2.index.get($3) ?? -1;
|
|
8624
|
+
return { parent: R2.parent, before: R2.refs.slice(K2 + 1), after: R2.refs.slice(0, Math.max(0, K2)).reverse() };
|
|
8471
8625
|
}, qe3 = ($3) => {
|
|
8472
8626
|
let a = $3.parentNode;
|
|
8473
8627
|
if (!a) return null;
|
|
@@ -8489,27 +8643,27 @@
|
|
|
8489
8643
|
}
|
|
8490
8644
|
O2 = { parent: Oe3(Z3), refs: U3, index: we3 }, ie3.set(a, O2);
|
|
8491
8645
|
}
|
|
8492
|
-
let
|
|
8493
|
-
return { parent: O2.parent, before: O2.refs.slice(
|
|
8646
|
+
let R2 = O2.index.get($3);
|
|
8647
|
+
return { parent: O2.parent, before: O2.refs.slice(R2.before), after: O2.refs.slice(0, R2.after).reverse() };
|
|
8494
8648
|
}, fe3 = ($3) => dn2($3) ? $3.outerHTML : $3.value, x2 = ($3) => dn2($3) ? "element" : $3.kind === "comment" ? "comment" : "text", Y2 = ($3, a) => ({ path: $3, offset: a }), ae3 = ($3, a, O2) => {
|
|
8495
8649
|
if (!$3) return null;
|
|
8496
|
-
let
|
|
8650
|
+
let R2 = c2[O2], K2 = 0;
|
|
8497
8651
|
if (a) {
|
|
8498
8652
|
let Z3 = dn2(a) ? a : a.nodes[a.nodes.length - 1];
|
|
8499
|
-
Z3.parentNode && (K2 =
|
|
8653
|
+
Z3.parentNode && (K2 = R2.indexIn(Z3.parentNode, Z3) + 1);
|
|
8500
8654
|
}
|
|
8501
|
-
return Y2(
|
|
8655
|
+
return Y2(R2.containerPath($3), K2);
|
|
8502
8656
|
}, oe3 = ($3, a) => {
|
|
8503
|
-
let O2 = J3($3, "base"),
|
|
8504
|
-
if (!dn2(
|
|
8657
|
+
let O2 = J3($3, "base"), R2 = O2 ? b(p2(a), O2) : null;
|
|
8658
|
+
if (!dn2(R2)) return null;
|
|
8505
8659
|
let K2 = n2(O2), Z3 = null;
|
|
8506
8660
|
for (let U3 = K2.indexOf($3) - 1; U3 >= 0 && !Z3; U3--) {
|
|
8507
8661
|
let de3 = b(p2(a), K2[U3]);
|
|
8508
|
-
de3 && J3(de3, a) ===
|
|
8662
|
+
de3 && J3(de3, a) === R2 && (Z3 = de3);
|
|
8509
8663
|
}
|
|
8510
|
-
return ae3(
|
|
8511
|
-
}, Ee3 = ($3, a, O2,
|
|
8512
|
-
let K2 = c2[
|
|
8664
|
+
return ae3(R2, Z3, a);
|
|
8665
|
+
}, Ee3 = ($3, a, O2, R2) => {
|
|
8666
|
+
let K2 = c2[R2], Z3 = 0;
|
|
8513
8667
|
for (let U3 = 0; U3 < $3.nodes.length; U3++) {
|
|
8514
8668
|
let de3 = $3.nodes[U3], we3 = de3.nodeValue.length, le3 = U3 === $3.nodes.length - 1;
|
|
8515
8669
|
if ((O2 === "start" ? a < Z3 + we3 : a <= Z3 + we3) || le3) return Y2(K2.pathOf(de3), Math.max(0, Math.min(a - Z3, we3)));
|
|
@@ -8517,19 +8671,19 @@
|
|
|
8517
8671
|
}
|
|
8518
8672
|
return null;
|
|
8519
8673
|
}, De3 = ($3, a) => {
|
|
8520
|
-
let O2 = c2[a],
|
|
8521
|
-
return
|
|
8674
|
+
let O2 = c2[a], R2 = $3.firstChild, K2 = $3.lastChild;
|
|
8675
|
+
return R2 && R2.nodeType === 3 && K2.nodeType === 3 ? { start: Y2(O2.pathOf(R2), 0), end: Y2(O2.pathOf(K2), K2.nodeValue.length) } : { start: Y2(O2.pathOf($3), 0), end: Y2(O2.pathOf($3), $3.childNodes.length) };
|
|
8522
8676
|
}, Ne3 = ($3, a, O2) => {
|
|
8523
8677
|
for (let U3 of $3.nodes) if (O2 === "start" ? U3.s <= a && a < U3.e : U3.s < a && a <= U3.e) return { kind: "text", node: U3.node, offset: a - U3.s };
|
|
8524
|
-
let
|
|
8678
|
+
let R2 = O2 === "start" ? a : a - 1, K2 = () => {
|
|
8525
8679
|
for (let U3 of $3.nodes) if (U3.s === a || U3.e === a) return { kind: "text", node: U3.node, offset: a - U3.s };
|
|
8526
8680
|
return null;
|
|
8527
|
-
}, Z3 = $3.atomAt.get(
|
|
8681
|
+
}, Z3 = $3.atomAt.get(R2);
|
|
8528
8682
|
if (Z3) return { kind: O2 === "start" ? "before" : "after", node: Z3.el };
|
|
8529
|
-
if ($3.text[
|
|
8530
|
-
let U3 = $3.marks.find((we3) => we3.block && we3.to ===
|
|
8683
|
+
if ($3.text[R2] === kt3) {
|
|
8684
|
+
let U3 = $3.marks.find((we3) => we3.block && we3.to === R2 + 1);
|
|
8531
8685
|
if (U3) return O2 === "start" ? { kind: "end", node: U3.el } : { kind: "after", node: U3.el };
|
|
8532
|
-
let de3 = $3.marks.find((we3) => we3.block && we3.from ===
|
|
8686
|
+
let de3 = $3.marks.find((we3) => we3.block && we3.from === R2 + 1);
|
|
8533
8687
|
if (de3) return O2 === "start" ? { kind: "before", node: de3.el } : { kind: "startOf", node: de3.el };
|
|
8534
8688
|
}
|
|
8535
8689
|
return K2();
|
|
@@ -8546,10 +8700,10 @@
|
|
|
8546
8700
|
return Y2($3.containerPath(O2), $3.indexIn(O2, a.node) + (a.kind === "after" ? 1 : 0));
|
|
8547
8701
|
}
|
|
8548
8702
|
}
|
|
8549
|
-
}, ht3 = ($3, a, O2,
|
|
8703
|
+
}, ht3 = ($3, a, O2, R2, K2) => {
|
|
8550
8704
|
let Z3 = Ne3($3, a, O2);
|
|
8551
|
-
return Z3 ? Xe3(c2[
|
|
8552
|
-
}, Ge3 = ($3, a, O2,
|
|
8705
|
+
return Z3 ? Xe3(c2[R2], Z3) : K2();
|
|
8706
|
+
}, Ge3 = ($3, a, O2, R2) => {
|
|
8553
8707
|
let K2 = $3.textNodes.map((le3) => ({ s: le3.ms, e: le3.me, start: { kind: "text", node: le3.node, offset: 0 }, end: { kind: "text", node: le3.node, offset: le3.me - le3.ms } }));
|
|
8554
8708
|
for (let [le3, Ae3] of $3.atomOut) K2.push({ s: le3, e: le3 + 1, start: { kind: "before", node: Ae3 }, end: { kind: "after", node: Ae3 } });
|
|
8555
8709
|
for (let [le3, Ae3] of $3.breakOut) K2.push({ s: le3, e: le3 + 1, start: { kind: "end", node: Ae3 }, end: { kind: "after", node: Ae3 } });
|
|
@@ -8564,7 +8718,7 @@
|
|
|
8564
8718
|
if (U3) return U3.start;
|
|
8565
8719
|
let de3 = null, we3 = null;
|
|
8566
8720
|
for (let le3 of K2) le3.e <= a && (!de3 || le3.e > de3.e) && (de3 = le3), le3.s >= a && (!we3 || le3.s < we3.s) && (we3 = le3);
|
|
8567
|
-
return de3 ? de3.end : we3 ? we3.start :
|
|
8721
|
+
return de3 ? de3.end : we3 ? we3.start : R2();
|
|
8568
8722
|
}, rt3 = ($3, a) => {
|
|
8569
8723
|
if (!a) return null;
|
|
8570
8724
|
if (a.kind === "text") {
|
|
@@ -8573,9 +8727,9 @@
|
|
|
8573
8727
|
}
|
|
8574
8728
|
let O2 = $3.atoms.find((K2) => K2.el === a.node);
|
|
8575
8729
|
if (O2) return a.kind === "after" ? O2.i + 1 : O2.i;
|
|
8576
|
-
let
|
|
8577
|
-
return
|
|
8578
|
-
}, Ot3 = ($3, a, O2,
|
|
8730
|
+
let R2 = $3.marks.find((K2) => K2.el === a.node);
|
|
8731
|
+
return R2 ? a.kind === "before" && R2.block && $3.text[R2.from - 1] === kt3 && !$3.marks.some((K2) => K2.block && K2.to === R2.from) ? R2.from - 1 : a.kind === "startOf" || a.kind === "before" ? R2.from : a.kind === "end" && R2.block ? R2.to - 1 : R2.to : null;
|
|
8732
|
+
}, Ot3 = ($3, a, O2, R2) => {
|
|
8579
8733
|
for (let de3 of $3.nodes) if (O2 === "start" ? de3.s <= a && a < de3.e : de3.s < a && a <= de3.e) return { kind: "text", node: de3.node, offset: a - de3.s };
|
|
8580
8734
|
let K2 = O2 === "start" ? a : a - 1;
|
|
8581
8735
|
if (!$3.atomAt.has(K2) && $3.text[K2] !== kt3) {
|
|
@@ -8590,7 +8744,7 @@
|
|
|
8590
8744
|
if (we3) return O2 === "start" ? { kind: "before", node: we3.el } : { kind: "startOf", node: we3.el };
|
|
8591
8745
|
}
|
|
8592
8746
|
let U3 = $3.marks.find((de3) => de3.block && de3.from === a);
|
|
8593
|
-
return U3 ? { kind: "startOf", node: U3.el } :
|
|
8747
|
+
return U3 ? { kind: "startOf", node: U3.el } : R2 ? { kind: O2 === "start" ? "startOf" : "end", node: R2 } : null;
|
|
8594
8748
|
}, Ct3 = ($3) => {
|
|
8595
8749
|
if (!$3) return null;
|
|
8596
8750
|
if ($3.kind === "wholeStart" || $3.kind === "wholeEnd") {
|
|
@@ -8602,19 +8756,19 @@
|
|
|
8602
8756
|
let a = $3.firstChild, O2 = $3.lastChild;
|
|
8603
8757
|
return a && a.nodeType === 3 && O2.nodeType === 3 ? { start: Y2(c2.out.pathOf(a), 0), end: Y2(c2.out.pathOf(O2), O2.nodeValue.length) } : { start: Y2(c2.out.pathOf($3), 0), end: Y2(c2.out.pathOf($3), $3.childNodes.length) };
|
|
8604
8758
|
}, Nt3 = ($3) => {
|
|
8605
|
-
let a = J3($3, "base"), O2 = a ?
|
|
8759
|
+
let a = J3($3, "base"), O2 = a ? P2(V3(a))[0] : null;
|
|
8606
8760
|
if (!O2) return null;
|
|
8607
|
-
let
|
|
8761
|
+
let R2 = Cn2(O2), K2 = n2(a);
|
|
8608
8762
|
for (let Z3 = K2.indexOf($3) - 1; Z3 >= 0; Z3--) {
|
|
8609
|
-
let U3 =
|
|
8763
|
+
let U3 = P2(V3(K2[Z3])).filter((de3) => de3.parentNode === R2);
|
|
8610
8764
|
if (U3.length) return { kind: "after", node: U3[U3.length - 1] };
|
|
8611
8765
|
}
|
|
8612
8766
|
return { kind: "startOf", node: O2 };
|
|
8613
|
-
}, Lt2 = ($3, a, O2,
|
|
8614
|
-
let
|
|
8615
|
-
return Gt2.set(
|
|
8767
|
+
}, Lt2 = ($3, a, O2, R2, K2, Z3) => ({ text: $3, start: a, end: O2, fragment: R2, span: K2, scope: Z3 }), qt3 = ($3, a, O2, R2, K2) => Lt2($3, a, O2, $3.slice(a, O2), R2, K2), cn2 = ($3, a, O2, R2, K2) => (v2.spans.set($3, { start: a, end: O2, scopeStart: R2, scopeEnd: K2 }), $3), It3 = /* @__PURE__ */ new Map(), Gt2 = /* @__PURE__ */ new Map(), wn2 = ($3, a, O2) => {
|
|
8768
|
+
let R2 = `text:${$3.key}:${a}:${O2}`, K2 = Gt2.get(R2) || 0;
|
|
8769
|
+
return Gt2.set(R2, K2 + 1), `${R2}:${K2}`;
|
|
8616
8770
|
}, Dt3 = ($3, a) => {
|
|
8617
|
-
let O2,
|
|
8771
|
+
let O2, R2, K2, Z3 = "plain", U3, de3, we3, le3, Ae3, W3 = (be3, he3, ee3, te3, z2) => {
|
|
8618
8772
|
if (!be3) {
|
|
8619
8773
|
let ne3 = oe3(z2, te3);
|
|
8620
8774
|
return qt3("", 0, 0, { start: ne3, end: ne3 }, { start: ne3, end: ne3 });
|
|
@@ -8623,12 +8777,12 @@
|
|
|
8623
8777
|
};
|
|
8624
8778
|
if (a.site === "run") {
|
|
8625
8779
|
let { bRun: be3, lRun: he3, rRun: ee3, node: te3, c: z2 } = a;
|
|
8626
|
-
O2 = V3(be3),
|
|
8780
|
+
O2 = V3(be3), R2 = z2.bs, K2 = z2.be, U3 = W3(be3, z2.bs, z2.be, "base", be3), de3 = W3(he3, z2.ls, z2.le, "local", be3), we3 = W3(ee3, z2.rs, z2.re, "remote", be3);
|
|
8627
8781
|
let ne3 = te3 ? te3.nodeValue : "", Te3 = (Ce3) => te3 ? { kind: "text", node: te3, offset: Ce3 } : Nt3(be3);
|
|
8628
8782
|
le3 = cn2(qt3(ne3, z2.ms, z2.me, { start: Ct3(Te3(z2.ms)), end: Ct3(Te3(z2.me)) }, { start: Ct3(Te3(0)), end: Ct3(Te3(ne3.length)) }), Te3(z2.ms), Te3(z2.me), Te3(0), Te3(ne3.length)), Ae3 = te3 || (Nt3(be3) || {}).node || null;
|
|
8629
8783
|
} else if (a.site === "whole") {
|
|
8630
8784
|
let be3 = a.el, he3 = s2.get(be3);
|
|
8631
|
-
O2 = V3(he3.base),
|
|
8785
|
+
O2 = V3(he3.base), R2 = 0, K2 = $3.base.length;
|
|
8632
8786
|
let ee3 = (z2, ne3, Te3) => {
|
|
8633
8787
|
let Ce3 = De3(ne3, Te3);
|
|
8634
8788
|
return qt3(z2, 0, z2.length, Ce3, Ce3);
|
|
@@ -8638,7 +8792,7 @@
|
|
|
8638
8792
|
le3 = cn2(qt3($3.resolved, 0, $3.resolved.length, te3, te3), { kind: "wholeStart", node: be3 }, { kind: "wholeEnd", node: be3 }, { kind: "wholeStart", node: be3 }, { kind: "wholeEnd", node: be3 }), Ae3 = be3;
|
|
8639
8793
|
} else if (a.site === "comment") {
|
|
8640
8794
|
let { bRun: be3, lRun: he3, rRun: ee3, node: te3 } = a;
|
|
8641
|
-
O2 = V3(be3),
|
|
8795
|
+
O2 = V3(be3), R2 = 0, K2 = $3.base.length;
|
|
8642
8796
|
let z2 = (Pe3, ve3) => {
|
|
8643
8797
|
if (!Pe3) {
|
|
8644
8798
|
let Ze3 = oe3(be3, ve3);
|
|
@@ -8652,7 +8806,7 @@
|
|
|
8652
8806
|
le3 = cn2(qt3(ne3, 0, ne3.length, Ce3, Ce3), Te3(0), Te3(ne3.length), Te3(0), Te3(ne3.length)), Ae3 = te3 || (Nt3(be3) || {}).node || null;
|
|
8653
8807
|
} else {
|
|
8654
8808
|
let { fb: be3, fl: he3, fr: ee3, scope: te3 } = a, z2 = a.merged;
|
|
8655
|
-
Z3 = "html", O2 = te3.base ? V3(te3.base) : D2(te3.local, "local"),
|
|
8809
|
+
Z3 = "html", O2 = te3.base ? V3(te3.base) : D2(te3.local, "local"), R2 = $3.bs, K2 = $3.be;
|
|
8656
8810
|
let ne3 = (se3) => {
|
|
8657
8811
|
let Ie3 = te3[se3];
|
|
8658
8812
|
for (let Be3 = te3.at - 1; Be3 >= 0; Be3--) {
|
|
@@ -8670,11 +8824,11 @@
|
|
|
8670
8824
|
let [Pe3, ve3] = $3.range || [0, 0], _e3 = z2.out, Je3 = () => {
|
|
8671
8825
|
let se3 = Cn2(z2.node);
|
|
8672
8826
|
for (let Ie3 = te3.at - 1; Ie3 >= 0; Ie3--) {
|
|
8673
|
-
let Be3 =
|
|
8827
|
+
let Be3 = P2(V3(te3.units[Ie3])).filter((He3) => He3.parentNode === se3);
|
|
8674
8828
|
if (Be3.length) return { kind: "after", node: Be3[Be3.length - 1] };
|
|
8675
8829
|
}
|
|
8676
8830
|
for (let Ie3 = te3.at; Ie3 < te3.units.length; Ie3++) {
|
|
8677
|
-
let Be3 =
|
|
8831
|
+
let Be3 = P2(V3(te3.units[Ie3])).filter((He3) => He3.parentNode === se3);
|
|
8678
8832
|
if (Be3.length) return { kind: "before", node: Be3[0] };
|
|
8679
8833
|
}
|
|
8680
8834
|
return { kind: "startOf", node: z2.node };
|
|
@@ -8690,16 +8844,16 @@
|
|
|
8690
8844
|
Ae3 = Ze3 ? Ze3.node : z2.node;
|
|
8691
8845
|
}
|
|
8692
8846
|
let X2 = Oe3(O2), pe3 = (a.site === "whole" || a.site === "comment" || (a.policy || h) !== "both") && $3.resolved !== $3.local;
|
|
8693
|
-
return { key: a.site === "comment" && It3.get(O2.b || O2.l || O2.r) || wn2(X2,
|
|
8847
|
+
return { key: a.site === "comment" && It3.get(O2.b || O2.l || O2.r) || wn2(X2, R2, K2), subject: X2, localLost: pe3, anchor: Ae3, text: { encoding: Z3, base: U3, local: de3, remote: we3, merged: le3, liveSpan: null, liveScope: null } };
|
|
8694
8848
|
}, rn = ($3, a) => {
|
|
8695
|
-
let O2 = k2(a.el),
|
|
8696
|
-
return { key: `attr:${
|
|
8849
|
+
let O2 = k2(a.el), R2 = Oe3(O2), K2 = a.sample;
|
|
8850
|
+
return { key: `attr:${R2.key}:${K2.namespaceURI || ""}:${K2.localName}`, subject: R2, localLost: $3.resolved !== $3.local, anchor: a.el, attribute: { namespaceURI: K2.namespaceURI || null, localName: K2.localName, qualifiedName: K2.name } };
|
|
8697
8851
|
}, Yt3 = ($3, a) => {
|
|
8698
|
-
let O2 = $3.detail,
|
|
8852
|
+
let O2 = $3.detail, R2 = a.unit || V3(a.subject), K2 = Oe3(R2), Z3 = v2.refs.get(K2), U3 = R2.l ? xe3(R2.l, "local") : null, de3 = R2.r ? xe3(R2.r, "remote") : null, we3 = Z3.length ? qe3(Z3[0]) : null, le3, Ae3, W3, X2 = null, pe3 = null, be3 = a.deleted;
|
|
8699
8853
|
switch (O2) {
|
|
8700
8854
|
case "both-reordered": {
|
|
8701
8855
|
le3 = Ae3 = "reordered";
|
|
8702
|
-
let he3 = new Set(a.rKept), ee3 = a.lKept.filter((Ce3) => he3.has(Ce3) &&
|
|
8856
|
+
let he3 = new Set(a.rKept), ee3 = a.lKept.filter((Ce3) => he3.has(Ce3) && P2(V3(Ce3)).length), te3 = (Ce3) => C2.get(P2(V3(Ce3))[0]);
|
|
8703
8857
|
X2 = ee3.map((Ce3) => Oe3(V3(Ce3))), pe3 = ee3.slice().sort((Ce3, Pe3) => te3(Ce3) - te3(Pe3)).map((Ce3) => Oe3(V3(Ce3)));
|
|
8704
8858
|
let z2 = (Ce3) => !dn2(Ce3) && Ce3.kind !== "comment" && Ce3.nodes.every((Pe3) => !/[^\t\n\f\r ]/.test(Pe3.data)), ne3 = ee3.filter((Ce3) => !z2(Ce3)), Te3 = ne3.slice().sort((Ce3, Pe3) => te3(Ce3) - te3(Pe3));
|
|
8705
8859
|
W3 = ne3.some((Ce3, Pe3) => Ce3 !== Te3[Pe3]);
|
|
@@ -8723,12 +8877,12 @@
|
|
|
8723
8877
|
default:
|
|
8724
8878
|
le3 = Ae3 = "inserted", W3 = a.localLost;
|
|
8725
8879
|
}
|
|
8726
|
-
return { key: `structure:${K2.key}:${O2}`, subject: K2, localLost: W3, anchor: Z3[0] || null, structure: { localAction: le3, remoteAction: Ae3, localPlacement: U3, remotePlacement: de3, mergedPlacement: we3, localOrder: X2, mergedOrder: pe3, localFragment: O2 === "both-reordered" || !
|
|
8880
|
+
return { key: `structure:${K2.key}:${O2}`, subject: K2, localLost: W3, anchor: Z3[0] || null, structure: { localAction: le3, remoteAction: Ae3, localPlacement: U3, remotePlacement: de3, mergedPlacement: we3, localOrder: X2, mergedOrder: pe3, localFragment: O2 === "both-reordered" || !R2.l ? null : fe3(R2.l), fragmentKind: x2(R2.b || R2.l || R2.r) } };
|
|
8727
8881
|
};
|
|
8728
8882
|
for (let [$3, a] of l) {
|
|
8729
8883
|
if ($3.kind !== "structure") continue;
|
|
8730
|
-
let O2 = a.unit || V3(a.subject),
|
|
8731
|
-
!dn2(
|
|
8884
|
+
let O2 = a.unit || V3(a.subject), R2 = O2.b || O2.l || O2.r;
|
|
8885
|
+
!dn2(R2) && R2.kind === "comment" && It3.set(R2, `structure:${Oe3(O2).key}:${$3.detail}`);
|
|
8732
8886
|
}
|
|
8733
8887
|
let fn2 = /* @__PURE__ */ new Map();
|
|
8734
8888
|
for (let [$3, a] of l) {
|
|
@@ -8741,8 +8895,8 @@
|
|
|
8741
8895
|
continue;
|
|
8742
8896
|
}
|
|
8743
8897
|
}
|
|
8744
|
-
let O2 = $3.kind === "text" ? Dt3($3, a) : $3.kind === "attr" ? rn($3, a) : Yt3($3, a),
|
|
8745
|
-
|
|
8898
|
+
let O2 = $3.kind === "text" ? Dt3($3, a) : $3.kind === "attr" ? rn($3, a) : Yt3($3, a), R2 = fn2.get(O2.key);
|
|
8899
|
+
R2 || (R2 = { version: cl2, key: O2.key, localLost: O2.localLost, subject: O2.subject, applied: false, unavailable: null }, fn2.set(O2.key, R2), v2.anchors.set(R2, O2.anchor)), O2.text && (R2.text = O2.text), O2.attribute && (R2.attribute = O2.attribute), O2.structure && (R2.structure = O2.structure), O2.text && (R2.localLost = O2.localLost), $3.recovery = R2;
|
|
8746
8900
|
let K2 = v2.refs.get(O2.subject);
|
|
8747
8901
|
$3.kind === "structure" && $3.el == null && K2.length && ($3.el = dn2(K2[0]) ? K2[0] : c2.out.logicalParent(K2[0])), $3.kind === "text" && $3.node == null && K2.length && O2.subject.nodeType === 8 && ($3.node = K2[0]);
|
|
8748
8902
|
}
|
|
@@ -8856,9 +9010,9 @@
|
|
|
8856
9010
|
}, M2 = (y2, k2) => {
|
|
8857
9011
|
let J3 = g(y2), H2 = g(k2);
|
|
8858
9012
|
return J3 && H2 ? { startContainer: J3[0], startOffset: J3[1], endContainer: H2[0], endOffset: H2[1] } : null;
|
|
8859
|
-
},
|
|
8860
|
-
if (!y2 ||
|
|
8861
|
-
|
|
9013
|
+
}, P2 = /* @__PURE__ */ new Set(), V3 = (y2) => {
|
|
9014
|
+
if (!y2 || P2.has(y2)) return;
|
|
9015
|
+
P2.add(y2);
|
|
8862
9016
|
let k2 = [];
|
|
8863
9017
|
for (let J3 of o2.refs.get(y2) || []) {
|
|
8864
9018
|
let H2 = m2(J3);
|
|
@@ -9008,7 +9162,7 @@
|
|
|
9008
9162
|
}
|
|
9009
9163
|
k2.appendChild(D2);
|
|
9010
9164
|
};
|
|
9011
|
-
function
|
|
9165
|
+
function P2(D2, j2, y2) {
|
|
9012
9166
|
let k2 = j2 === "base" ? D2 : n2(D2, j2), J3 = i2.get(k2);
|
|
9013
9167
|
J3 && J3 !== y2 && V3(J3);
|
|
9014
9168
|
}
|
|
@@ -9023,13 +9177,13 @@
|
|
|
9023
9177
|
}
|
|
9024
9178
|
D2.parent = o2(y2), D2.port = y2, D2.sourceSide = "remote";
|
|
9025
9179
|
}
|
|
9026
|
-
if (
|
|
9180
|
+
if (P2(D2.parent, D2.sourceSide, D2), A2(D2)) {
|
|
9027
9181
|
g.delete(D2);
|
|
9028
9182
|
return;
|
|
9029
9183
|
}
|
|
9030
9184
|
let k2 = E2(D2.parent, D2), J3 = D2.port;
|
|
9031
9185
|
if (!k2) {
|
|
9032
|
-
if (
|
|
9186
|
+
if (P2(D2.originalParent, "base", D2), A2(D2)) {
|
|
9033
9187
|
g.delete(D2);
|
|
9034
9188
|
return;
|
|
9035
9189
|
}
|
|
@@ -9100,14 +9254,14 @@
|
|
|
9100
9254
|
if (E2.kind !== "text" || g.twin(E2)) continue;
|
|
9101
9255
|
let N2 = I3.twin(E2);
|
|
9102
9256
|
if (!N2 || N2.kind !== "text" || !I3.here(N2)) continue;
|
|
9103
|
-
let M2 = C2(E2),
|
|
9104
|
-
if (!M2 || !
|
|
9257
|
+
let M2 = C2(E2), P2 = C2(N2);
|
|
9258
|
+
if (!M2 || !P2 || !/\S/.test(M2.flat.text)) continue;
|
|
9105
9259
|
p2(M2.flat.text.length * 2 + 1);
|
|
9106
9260
|
let V3 = M2.flat.text;
|
|
9107
|
-
T2.set(V3, (T2.get(V3) || 0) + 1), v2.push({ source: E2, opposite: N2, sourceModel: M2, oppositeModel:
|
|
9261
|
+
T2.set(V3, (T2.get(V3) || 0) + 1), v2.push({ source: E2, opposite: N2, sourceModel: M2, oppositeModel: P2, index: A2 });
|
|
9108
9262
|
}
|
|
9109
9263
|
for (let A2 of v2) {
|
|
9110
|
-
let { source: E2, opposite: N2, sourceModel: M2, oppositeModel:
|
|
9264
|
+
let { source: E2, opposite: N2, sourceModel: M2, oppositeModel: P2, index: V3 } = A2, D2 = [];
|
|
9111
9265
|
for (let Y2 of [-1, 1]) {
|
|
9112
9266
|
p2(1);
|
|
9113
9267
|
let ae3 = o2[V3 + Y2];
|
|
@@ -9130,7 +9284,7 @@
|
|
|
9130
9284
|
let ie3 = { source: E2, target: k2, from: 0, to: M2.flat.text.length, targetFrom: Oe3 }, xe3 = Dn2({ base: M2.flat, side: q3.flat, retained: [], transfers: [{ from: ie3.from, to: ie3.to, target: Oe3, destination: y2 }], budget: l });
|
|
9131
9285
|
if (xe3.status !== "ready" || xe3.covers(ie3.from, ie3.to) !== true) return u2("fallback", xe3.reason || "work-limit");
|
|
9132
9286
|
let qe3 = [{ unit: E2, model: M2, from: 0, to: M2.flat.text.length }, null, null];
|
|
9133
|
-
qe3[f2 + 1] = { unit: k2, model: q3, from: Oe3, to: Oe3 + M2.flat.text.length }, qe3[2 - f2] = { unit: N2, model:
|
|
9287
|
+
qe3[f2 + 1] = { unit: k2, model: q3, from: Oe3, to: Oe3 + M2.flat.text.length }, qe3[2 - f2] = { unit: N2, model: P2, from: 0, to: P2.flat.text.length };
|
|
9134
9288
|
let fe3 = [H2, null, null];
|
|
9135
9289
|
fe3[f2 + 1] = q3, fe3[2 - f2] = Me3;
|
|
9136
9290
|
let x2 = [y2, null, null];
|
|
@@ -9171,8 +9325,8 @@
|
|
|
9171
9325
|
N2 = -1;
|
|
9172
9326
|
continue;
|
|
9173
9327
|
}
|
|
9174
|
-
let
|
|
9175
|
-
N2 >= 0 &&
|
|
9328
|
+
let P2 = m2.at(-1);
|
|
9329
|
+
N2 >= 0 && P2.to === T2 + M2 && P2.target + P2.to - P2.from === A2 + E2[M2] ? P2.to++ : (m2.push({ from: T2 + M2, to: T2 + M2 + 1, target: A2 + E2[M2] }), N2 = M2);
|
|
9176
9330
|
}
|
|
9177
9331
|
}
|
|
9178
9332
|
let f2 = Dn2({ base: i2, side: w2, retained: m2, transfers: [], budget: o2 });
|
|
@@ -9201,7 +9355,7 @@
|
|
|
9201
9355
|
A2.set(y2.owner, H2), E2.add(y2.source), E2.add(y2.native[2].unit), N2.push(H2);
|
|
9202
9356
|
}
|
|
9203
9357
|
}
|
|
9204
|
-
function
|
|
9358
|
+
function P2(D2, j2) {
|
|
9205
9359
|
let y2 = A2.get(D2);
|
|
9206
9360
|
if (!y2) return false;
|
|
9207
9361
|
if (!y2.result) {
|
|
@@ -9253,12 +9407,12 @@
|
|
|
9253
9407
|
Me3(D2);
|
|
9254
9408
|
for (let xe3 of N2) {
|
|
9255
9409
|
let { record: qe3 } = xe3, fe3 = Oe3(qe3.owner) || Oe3(qe3.owners[1]) || Oe3(qe3.owners[2]);
|
|
9256
|
-
if (fe3) (!xe3.result || xe3.output !== fe3 || xe3.result.nodes.some((x2) => !j2.has(x2) || y2.get(x2) !== fe3) || fe3.textContent !== xe3.result.text) && (
|
|
9410
|
+
if (fe3) (!xe3.result || xe3.output !== fe3 || xe3.result.nodes.some((x2) => !j2.has(x2) || y2.get(x2) !== fe3) || fe3.textContent !== xe3.result.text) && (P2(qe3.owner, fe3), Me3(fe3, y2.get(fe3), k2.get(fe3)));
|
|
9257
9411
|
else {
|
|
9258
9412
|
let x2 = qe3.parent, Y2 = qe3.owner, ae3 = null;
|
|
9259
9413
|
for (; x2 && !ae3; ) ae3 = Oe3(x2), ae3 || (Y2 = x2, x2 = h(x2));
|
|
9260
9414
|
if (!ae3) throw new Error("A cross-parent payload has no allowed surviving parent");
|
|
9261
|
-
fe3 = xe3.output || u2(qe3.owner, qe3.owners[1], qe3.owners[2], false), xe3.result ||
|
|
9415
|
+
fe3 = xe3.output || u2(qe3.owner, qe3.owners[1], qe3.owners[2], false), xe3.result || P2(qe3.owner, fe3), ie3(fe3, ae3, Y2), Me3(fe3, ae3, k2.get(ae3));
|
|
9262
9416
|
}
|
|
9263
9417
|
xe3.state = "attached";
|
|
9264
9418
|
}
|
|
@@ -9267,7 +9421,7 @@
|
|
|
9267
9421
|
M2(h(D2));
|
|
9268
9422
|
}, consumes(D2) {
|
|
9269
9423
|
return E2.has(D2);
|
|
9270
|
-
}, render:
|
|
9424
|
+
}, render: P2, drain: V3 };
|
|
9271
9425
|
}
|
|
9272
9426
|
var Mn = /\S/, Er2 = /[\p{L}\p{N}]/u;
|
|
9273
9427
|
function no2(e, o2, t, n2) {
|
|
@@ -9298,10 +9452,10 @@
|
|
|
9298
9452
|
if (In2(E2, g, p2(r, b), b, S2, true) !== T2) return false;
|
|
9299
9453
|
let N2 = In2(E2, C2, p2(s2, b), b, S2, true);
|
|
9300
9454
|
if (N2 < 0) return false;
|
|
9301
|
-
let M2 = N2 + E2.length,
|
|
9302
|
-
if (
|
|
9303
|
-
let D2 =
|
|
9304
|
-
if (S2(b, C2.length + f2.length), j2 < 0 || !Mn.test(D2) || In2(D2, f2, p2(l, b), b, S2, true) !== j2 || !Mn.test(
|
|
9455
|
+
let M2 = N2 + E2.length, P2 = !Mn.test(C2.slice(0, N2)), V3 = !Mn.test(C2.slice(M2));
|
|
9456
|
+
if (P2 === V3 || In2(E2, m2, p2(h, b), b, S2, false) >= 0) return false;
|
|
9457
|
+
let D2 = P2 ? C2.slice(M2) : C2.slice(0, N2), j2 = P2 ? f2.length - D2.length : 0;
|
|
9458
|
+
if (S2(b, C2.length + f2.length), j2 < 0 || !Mn.test(D2) || In2(D2, f2, p2(l, b), b, S2, true) !== j2 || !Mn.test(P2 ? f2.slice(0, j2) : f2.slice(D2.length))) return false;
|
|
9305
9459
|
for (let y2 of e) {
|
|
9306
9460
|
if (S2(b, 1), y2 === n2 || !no2(y2, w2, b, S2)) continue;
|
|
9307
9461
|
let k2 = c2(y2, null, b);
|
|
@@ -9324,8 +9478,8 @@
|
|
|
9324
9478
|
if (E2.parentNode?.nodeType !== 1 || h.has(E2) || S2.identical.has(E2) || m2.A.identical.has(E2) || !no2(E2, s2, p2, u2) || l(E2)) continue;
|
|
9325
9479
|
let N2 = b.twin(E2), M2 = m2.V.twin(E2);
|
|
9326
9480
|
if (!N2 || !M2 || !b.here(N2) || !m2.V.here(M2) || S2.map.get(E2) !== N2 || S2.reverse.get(N2) !== E2 || m2.A.map.get(E2) !== M2 || m2.A.reverse.get(M2) !== E2 || C2(N2) || m2.idOf(M2) || N2.tagName !== E2.tagName || M2.tagName !== E2.tagName || !no2(N2, s2, p2, u2) || !no2(M2, s2, p2, u2) || !Is2(E2, p2, u2) || !Is2(N2, p2, u2) || !Is2(M2, p2, u2)) continue;
|
|
9327
|
-
let
|
|
9328
|
-
if (u2(p2, j2.length + y2.length + k2.length), !Mn.test(j2) || !Mn.test(y2) || !Mn.test(k2) || j2 === y2 || j2 === k2 || y2 === k2 || !Rr2(
|
|
9481
|
+
let P2 = r(E2, null, p2), V3 = r(N2, S2, p2), D2 = r(M2, m2.A, p2), j2 = P2.flat.text, y2 = V3.flat.text, k2 = D2.flat.text;
|
|
9482
|
+
if (u2(p2, j2.length + y2.length + k2.length), !Mn.test(j2) || !Mn.test(y2) || !Mn.test(k2) || j2 === y2 || j2 === k2 || y2 === k2 || !Rr2(P2, V3, i2, p2, u2) || !Rr2(P2, D2, i2, p2, u2)) continue;
|
|
9329
9483
|
let J3 = null, H2 = false;
|
|
9330
9484
|
for (let Oe3 = I3; Oe3 <= v2; Oe3++) {
|
|
9331
9485
|
u2(p2, 1);
|
|
@@ -9334,7 +9488,7 @@
|
|
|
9334
9488
|
let xe3 = r(ie3, null, p2), qe3 = r(Re3, S2, p2), fe3 = xe3.flat.text, x2 = qe3.flat.text;
|
|
9335
9489
|
if (u2(p2, fe3.length), !Mn.test(fe3) || x2.length <= fe3.length) continue;
|
|
9336
9490
|
let Y2 = i2(qe3, p2), ae3 = In2(fe3, x2, Y2, p2, u2, true);
|
|
9337
|
-
if (!(ae3 < 0 || In2(j2, x2, Y2, p2, u2, true, ae3, ae3 + fe3.length) < 0 && !hl2({ base: e, V: b, A: S2, source: E2, original:
|
|
9491
|
+
if (!(ae3 < 0 || In2(j2, x2, Y2, p2, u2, true, ae3, ae3 + fe3.length) < 0 && !hl2({ base: e, V: b, A: S2, source: E2, original: P2, current: V3, edited: D2, destination: qe3, at: ae3, ownLength: fe3.length, eligible: s2, model: r, tokensOf: i2, budget: p2, charge: u2 }))) {
|
|
9338
9492
|
if (J3) {
|
|
9339
9493
|
H2 = true;
|
|
9340
9494
|
break;
|
|
@@ -9344,7 +9498,7 @@
|
|
|
9344
9498
|
}
|
|
9345
9499
|
if (!J3 || H2) continue;
|
|
9346
9500
|
let q3 = t === 0 ? N2 : M2, Me3 = t === 0 ? M2 : N2;
|
|
9347
|
-
(T2 ||= []).push({ source: E2, local: q3, remote: Me3, models: [
|
|
9501
|
+
(T2 ||= []).push({ source: E2, local: q3, remote: Me3, models: [P2, t === 0 ? V3 : D2, t === 0 ? D2 : V3] });
|
|
9348
9502
|
}
|
|
9349
9503
|
} catch (A2) {
|
|
9350
9504
|
if (A2 !== w2) throw A2;
|
|
@@ -9416,10 +9570,10 @@
|
|
|
9416
9570
|
let T2 = false;
|
|
9417
9571
|
for (let A2 of g) {
|
|
9418
9572
|
let E2 = h.get(A2), N2 = l.get(A2), M2 = r(E2, u2);
|
|
9419
|
-
for (let
|
|
9420
|
-
let V3 = M2[
|
|
9573
|
+
for (let P2 = 0; P2 < M2.length; P2++) {
|
|
9574
|
+
let V3 = M2[P2].from, D2 = V3 + f2.length;
|
|
9421
9575
|
if (i2(u2, f2.length * 2 + 1), E2.flat.text.slice(V3, D2) !== f2) continue;
|
|
9422
|
-
let j2 =
|
|
9576
|
+
let j2 = P2;
|
|
9423
9577
|
for (; j2 < M2.length && M2[j2].to < D2; ) i2(u2, 1), j2++;
|
|
9424
9578
|
if (j2 === M2.length || M2[j2].to !== D2) continue;
|
|
9425
9579
|
let y2 = true;
|
|
@@ -9470,52 +9624,52 @@
|
|
|
9470
9624
|
let N2 = nn2(Array.from(v2.childNodes), { ignored: s2, remoteWins: h });
|
|
9471
9625
|
return C2.set(v2, N2), N2;
|
|
9472
9626
|
}, f2 = (v2, T2, A2, E2, N2, M2) => {
|
|
9473
|
-
for (let
|
|
9627
|
+
for (let P2 of v2.atoms) {
|
|
9474
9628
|
u2(M2, 1);
|
|
9475
|
-
let V3 = T2.atomAt.get(
|
|
9629
|
+
let V3 = T2.atomAt.get(P2.i + A2);
|
|
9476
9630
|
if (!V3) return false;
|
|
9477
|
-
let D2 = E2?.reverse.get(
|
|
9631
|
+
let D2 = E2?.reverse.get(P2.el) || l(P2.el), j2 = N2?.reverse.get(V3.el) || l(V3.el);
|
|
9478
9632
|
if (D2 !== j2) return false;
|
|
9479
9633
|
}
|
|
9480
9634
|
return true;
|
|
9481
9635
|
}, g = (v2, T2, A2, E2, N2) => {
|
|
9482
|
-
let M2 = v2.text.length <= T2.text.length ? v2 : T2,
|
|
9483
|
-
if (u2(N2, M2.text.length +
|
|
9636
|
+
let M2 = v2.text.length <= T2.text.length ? v2 : T2, P2 = M2 === v2 ? T2 : v2;
|
|
9637
|
+
if (u2(N2, M2.text.length + P2.text.length), !M2.text || !Hn2.test(M2.text.replaceAll(Un2, ""))) return false;
|
|
9484
9638
|
let V3;
|
|
9485
|
-
if (M2.text ===
|
|
9639
|
+
if (M2.text === P2.text) V3 = 0;
|
|
9486
9640
|
else {
|
|
9487
|
-
let D2 =
|
|
9488
|
-
if (u2(N2, (D2 + 1) * M2.text.length * 2),
|
|
9489
|
-
else if (
|
|
9641
|
+
let D2 = P2.text.length - M2.text.length;
|
|
9642
|
+
if (u2(N2, (D2 + 1) * M2.text.length * 2), P2.text.startsWith(M2.text)) V3 = 0;
|
|
9643
|
+
else if (P2.text.endsWith(M2.text)) V3 = D2;
|
|
9490
9644
|
else return false;
|
|
9491
|
-
if (
|
|
9492
|
-
u2(N2,
|
|
9645
|
+
if (P2.text.indexOf(M2.text) !== V3 || P2.text.lastIndexOf(M2.text) !== V3) return false;
|
|
9646
|
+
u2(N2, P2.text.length * 2);
|
|
9493
9647
|
let j2 = 0, y2 = V3 === 0, k2 = false;
|
|
9494
|
-
for (let J3 of an2(
|
|
9648
|
+
for (let J3 of an2(P2.text, xn2(P2.text))) j2 += J3.len, j2 === V3 && (y2 = true), j2 === V3 + M2.text.length && (k2 = true);
|
|
9495
9649
|
if (!y2 || !k2) return false;
|
|
9496
9650
|
}
|
|
9497
|
-
return M2 === v2 ? f2(M2,
|
|
9651
|
+
return M2 === v2 ? f2(M2, P2, V3, A2, E2, N2) : f2(M2, P2, V3, E2, A2, N2);
|
|
9498
9652
|
}, I3 = null;
|
|
9499
9653
|
for (let v2 = 0; v2 < 2; v2++) {
|
|
9500
9654
|
let { V: T2, A: A2, idOf: E2 } = o2[v2], N2 = o2[1 - v2];
|
|
9501
9655
|
if (!T2.asBase) for (let M2 = 0; M2 < e.length; M2++) {
|
|
9502
|
-
let
|
|
9503
|
-
if (T2.twin(
|
|
9504
|
-
let V3 = N2.V.twin(
|
|
9656
|
+
let P2 = e[M2];
|
|
9657
|
+
if (T2.twin(P2) || !t(P2)) continue;
|
|
9658
|
+
let V3 = N2.V.twin(P2);
|
|
9505
9659
|
if (!V3 || !w2[1 - v2].has(V3) || !t(V3)) continue;
|
|
9506
9660
|
let D2 = { remaining: r };
|
|
9507
9661
|
try {
|
|
9508
9662
|
let j2 = c2[M2], y2 = p2[M2], k2 = 0;
|
|
9509
9663
|
for (let Me3 = j2 + 1; Me3 < y2; Me3++) u2(D2, 1), !T2.twin(e[Me3]) && N2.V.twin(e[Me3]) && t(e[Me3]) && k2++;
|
|
9510
|
-
if (k2 !== 1 || m2(
|
|
9664
|
+
if (k2 !== 1 || m2(P2, D2).text === m2(V3, D2).text) continue;
|
|
9511
9665
|
let J3 = j2 < 0 ? -1 : w2[v2].get(T2.twin(e[j2])), H2 = y2 === e.length ? T2.units.length : w2[v2].get(T2.twin(e[y2]));
|
|
9512
9666
|
if (J3 === void 0 || H2 === void 0 || J3 >= H2) continue;
|
|
9513
9667
|
let q3 = null;
|
|
9514
9668
|
for (let Me3 = J3 + 1; Me3 < H2; Me3++) {
|
|
9515
9669
|
u2(D2, 1);
|
|
9516
9670
|
let Oe3 = T2.units[Me3];
|
|
9517
|
-
if (T2.baseOf(Oe3) || !t(Oe3) || Oe3.tagName !==
|
|
9518
|
-
let Re3 = n2(
|
|
9671
|
+
if (T2.baseOf(Oe3) || !t(Oe3) || Oe3.tagName !== P2.tagName || Oe3.namespaceURI !== P2.namespaceURI) continue;
|
|
9672
|
+
let Re3 = n2(P2), ie3 = N2.idOf(V3), xe3 = E2(Oe3);
|
|
9519
9673
|
if (!(Re3 && ie3 && Re3 !== ie3 || Re3 && xe3 && Re3 !== xe3 || ie3 && xe3 && ie3 !== xe3) && g(m2(V3, D2), m2(Oe3, D2), N2.A, A2, D2)) {
|
|
9520
9674
|
if (q3) {
|
|
9521
9675
|
q3 = null;
|
|
@@ -9525,7 +9679,7 @@
|
|
|
9525
9679
|
}
|
|
9526
9680
|
}
|
|
9527
9681
|
if (!q3) continue;
|
|
9528
|
-
I3 || (I3 = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()]), I3[v2].set(
|
|
9682
|
+
I3 || (I3 = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()]), I3[v2].set(P2, q3);
|
|
9529
9683
|
} catch (j2) {
|
|
9530
9684
|
if (j2 !== i2) throw j2;
|
|
9531
9685
|
}
|
|
@@ -9621,7 +9775,7 @@
|
|
|
9621
9775
|
}
|
|
9622
9776
|
}
|
|
9623
9777
|
j2.push({ source: y2, target: k2, from: J3, to: H2, targetFrom: q3 });
|
|
9624
|
-
},
|
|
9778
|
+
}, P2 = (j2) => j2.replace(pl2, "");
|
|
9625
9779
|
for (let j2 = 0; j2 < n2.length; j2++) {
|
|
9626
9780
|
let { V: y2, A: k2, idOf: J3 } = n2[j2];
|
|
9627
9781
|
if (y2.asBase) continue;
|
|
@@ -9689,7 +9843,7 @@
|
|
|
9689
9843
|
Nt3 += de3.flat.text, Lt2 += de3.flat.text.length;
|
|
9690
9844
|
}
|
|
9691
9845
|
v2(Ne3, Lt2);
|
|
9692
|
-
let qt3 =
|
|
9846
|
+
let qt3 = P2(wt3), cn2 = P2(Nt3), It3 = qt3 === cn2;
|
|
9693
9847
|
if (ht3 = It3, De3 && !It3) continue;
|
|
9694
9848
|
let Gt2 = It3 ? null : /* @__PURE__ */ new Map();
|
|
9695
9849
|
if (Gt2) for (let U3 of Ge3.concat(rt3)) {
|
|
@@ -9737,11 +9891,11 @@
|
|
|
9737
9891
|
break;
|
|
9738
9892
|
}
|
|
9739
9893
|
if (!be3) continue;
|
|
9740
|
-
let he3 =
|
|
9894
|
+
let he3 = P2(le3.slice(W3, X2)), ee3 = null, te3 = false;
|
|
9741
9895
|
for (let Pe3 of rt3) {
|
|
9742
9896
|
if (y2.baseOf(Pe3)) continue;
|
|
9743
9897
|
let ve3 = p2.get(Pe3);
|
|
9744
|
-
if (!ve3.flat.atoms.length && (v2(Ne3, ve3.flat.text.length),
|
|
9898
|
+
if (!ve3.flat.atoms.length && (v2(Ne3, ve3.flat.text.length), P2(ve3.flat.text) === he3)) {
|
|
9745
9899
|
if (ee3) {
|
|
9746
9900
|
te3 = true;
|
|
9747
9901
|
break;
|
|
@@ -9795,10 +9949,10 @@
|
|
|
9795
9949
|
}
|
|
9796
9950
|
}
|
|
9797
9951
|
return de3;
|
|
9798
|
-
}, $3 = It3 ? wn2(Ge3) : fn2(Ge3), a = It3 ? wn2(rt3) : fn2(rt3), O2 = It3 ? qt3 : $3.map((U3) =>
|
|
9799
|
-
if ((!O2 || !
|
|
9952
|
+
}, $3 = It3 ? wn2(Ge3) : fn2(Ge3), a = It3 ? wn2(rt3) : fn2(rt3), O2 = It3 ? qt3 : $3.map((U3) => P2(U3.raw)).join(""), R2 = It3 ? cn2 : a.map((U3) => P2(U3.raw)).join("");
|
|
9953
|
+
if ((!O2 || !R2) && !rn) continue;
|
|
9800
9954
|
let K2 = rn || [];
|
|
9801
|
-
if (O2 &&
|
|
9955
|
+
if (O2 && R2 && O2 === R2) {
|
|
9802
9956
|
let U3 = 0, de3 = 0, we3 = 0, le3 = 0;
|
|
9803
9957
|
for (; U3 < $3.length && de3 < a.length; ) {
|
|
9804
9958
|
let Ae3 = $3[U3], W3 = a[de3];
|
|
@@ -9818,7 +9972,7 @@
|
|
|
9818
9972
|
}
|
|
9819
9973
|
M2(K2, Ae3.unit, W3.unit, Ae3.from + we3, Ae3.from + we3 + 1, W3.from + le3, Ne3), we3++, le3++;
|
|
9820
9974
|
}
|
|
9821
|
-
} else if (O2 &&
|
|
9975
|
+
} else if (O2 && R2) {
|
|
9822
9976
|
let U3 = N2($3, a, Ne3);
|
|
9823
9977
|
if (!U3) continue;
|
|
9824
9978
|
for (let [de3, we3] of U3) M2(K2, de3.unit, we3.unit, de3.from, de3.to, we3.from, Ne3);
|
|
@@ -9840,7 +9994,7 @@
|
|
|
9840
9994
|
for (let ve3 of new Set(de3.map((_e3) => _e3.target))) {
|
|
9841
9995
|
if (U3.nodeType !== 1 && ve3.nodeType !== 1) continue;
|
|
9842
9996
|
let _e3 = T2(ve3, k2, Ne3), Je3 = y2.baseOf(ve3);
|
|
9843
|
-
if (U3.nodeType !== 1 && Je3 || (v2(Ne3, Ae3.length * 2 + _e3.flat.text.length * 3 + Dt3.length * 2), le3 &&
|
|
9997
|
+
if (U3.nodeType !== 1 && Je3 || (v2(Ne3, Ae3.length * 2 + _e3.flat.text.length * 3 + Dt3.length * 2), le3 && P2(Ae3) === P2(_e3.flat.text) && T2(le3, k2, Ne3).flat.text.trim())) continue;
|
|
9844
9998
|
if (!le3 && !Je3 && U3.nodeType === 1 && ve3.nodeType === 1) {
|
|
9845
9999
|
let G3 = r(U3), re3 = J3(ve3);
|
|
9846
10000
|
if (G3 && re3 && G3 !== re3) continue;
|
|
@@ -10080,8 +10234,8 @@
|
|
|
10080
10234
|
}, b = (m2, f2, g, I3) => {
|
|
10081
10235
|
r((I3 - g) * 4);
|
|
10082
10236
|
let v2 = [], T2 = g, A2 = (M2) => {
|
|
10083
|
-
let
|
|
10084
|
-
for (let V3 of an2(
|
|
10237
|
+
let P2 = m2.text.slice(T2, M2);
|
|
10238
|
+
for (let V3 of an2(P2, xn2(P2))) V3.from = T2, V3.to = T2 + V3.len, v2.push(V3), T2 += V3.len;
|
|
10085
10239
|
}, E2 = 0, N2 = m2.atoms.length;
|
|
10086
10240
|
for (; E2 < N2; ) {
|
|
10087
10241
|
r(1);
|
|
@@ -10090,8 +10244,8 @@
|
|
|
10090
10244
|
}
|
|
10091
10245
|
for (let M2 = E2; M2 < m2.atoms.length && m2.atoms[M2].i < I3; M2++) {
|
|
10092
10246
|
r(1);
|
|
10093
|
-
let
|
|
10094
|
-
A2(
|
|
10247
|
+
let P2 = m2.atoms[M2];
|
|
10248
|
+
A2(P2.i), v2.push({ k: f2(P2), raw: Un2, len: 1, from: T2, to: T2 + 1 }), T2++;
|
|
10095
10249
|
}
|
|
10096
10250
|
return A2(I3), v2;
|
|
10097
10251
|
}, S2 = (m2, f2, g, I3, v2, T2) => {
|
|
@@ -10118,52 +10272,52 @@
|
|
|
10118
10272
|
let A2 = b(t[0], n2[0], g, I3), E2 = b(t[f2], n2[f2], v2, T2), N2 = A2.length + E2.length + 4, M2 = Math.min(A2.length + E2.length, 4e3, Math.floor((Math.sqrt(N2 * N2 + l.remaining / 2) - N2) / 2));
|
|
10119
10273
|
if (M2 < 1) throw h;
|
|
10120
10274
|
r(4 * (M2 + 1) * (N2 + M2 + 1));
|
|
10121
|
-
let
|
|
10275
|
+
let P2 = Wn2(A2, E2, M2), V3 = 0, D2 = 0, j2 = () => {
|
|
10122
10276
|
let y2 = A2[V3++], k2 = E2[D2++];
|
|
10123
10277
|
r(y2.len), y2.raw === k2.raw && p2(m2, y2.from, y2.to, k2.from, "retained");
|
|
10124
10278
|
};
|
|
10125
|
-
for (let y2 of
|
|
10279
|
+
for (let y2 of P2.hunks) {
|
|
10126
10280
|
for (; V3 < y2.bs; ) j2();
|
|
10127
10281
|
V3 = y2.be, D2 += y2.toks.length;
|
|
10128
10282
|
}
|
|
10129
10283
|
for (; V3 < A2.length && D2 < E2.length; ) j2();
|
|
10130
10284
|
}, C2 = (m2) => {
|
|
10131
|
-
let f2 = e.filter((
|
|
10285
|
+
let f2 = e.filter((P2) => P2.side === m2 - 1 && i2[0].has(P2.source) && i2[m2].has(P2.target));
|
|
10132
10286
|
if (!f2.length) return null;
|
|
10133
|
-
let g = [], I3 = (
|
|
10134
|
-
if (!i2[0].has(
|
|
10135
|
-
let j2 = c2(V3.get(
|
|
10136
|
-
r(
|
|
10137
|
-
for (let k2 = 0; k2 <
|
|
10138
|
-
let J3 = j2[
|
|
10287
|
+
let g = [], I3 = (P2, V3, D2) => {
|
|
10288
|
+
if (!i2[0].has(P2.source) || !i2[m2].has(P2.target)) return;
|
|
10289
|
+
let j2 = c2(V3.get(P2.source).flat, t[0]), y2 = c2(V3.get(P2.target).flat, t[m2]);
|
|
10290
|
+
r(P2.to - P2.from);
|
|
10291
|
+
for (let k2 = 0; k2 < P2.to - P2.from; k2++) {
|
|
10292
|
+
let J3 = j2[P2.from + k2], H2 = y2[P2.targetFrom + k2];
|
|
10139
10293
|
if (J3 < 0 || H2 < 0) throw h;
|
|
10140
10294
|
p2(g, J3, J3 + 1, H2, D2);
|
|
10141
10295
|
}
|
|
10142
10296
|
}, v2 = /* @__PURE__ */ new Set();
|
|
10143
|
-
for (let
|
|
10144
|
-
if (!v2.has(
|
|
10145
|
-
v2.add(
|
|
10146
|
-
for (let V3 of
|
|
10297
|
+
for (let P2 of f2) {
|
|
10298
|
+
if (!v2.has(P2.retained)) {
|
|
10299
|
+
v2.add(P2.retained);
|
|
10300
|
+
for (let V3 of P2.retained) I3(V3, P2.models, "retained");
|
|
10147
10301
|
}
|
|
10148
|
-
for (let V3 of
|
|
10302
|
+
for (let V3 of P2.runs) I3(V3, P2.models, "transfer");
|
|
10149
10303
|
}
|
|
10150
|
-
g.sort((
|
|
10304
|
+
g.sort((P2, V3) => (r(1), P2.from - V3.from || P2.target - V3.target));
|
|
10151
10305
|
let T2 = [];
|
|
10152
|
-
for (let
|
|
10306
|
+
for (let P2 of g) {
|
|
10153
10307
|
r(1);
|
|
10154
10308
|
let V3 = T2[T2.length - 1];
|
|
10155
|
-
if (V3 &&
|
|
10156
|
-
if (
|
|
10157
|
-
V3.to = Math.max(V3.to,
|
|
10158
|
-
} else T2.push(
|
|
10309
|
+
if (V3 && P2.from < V3.to) {
|
|
10310
|
+
if (P2.target - P2.from !== V3.target - V3.from) throw h;
|
|
10311
|
+
V3.to = Math.max(V3.to, P2.to), P2.kind === "transfer" && (V3.kind = "transfer");
|
|
10312
|
+
} else T2.push(P2);
|
|
10159
10313
|
}
|
|
10160
10314
|
let A2 = [], E2 = 0, N2 = 0;
|
|
10161
|
-
for (let
|
|
10162
|
-
if (
|
|
10163
|
-
S2(A2, m2, E2,
|
|
10315
|
+
for (let P2 of T2) {
|
|
10316
|
+
if (P2.target < N2) throw h;
|
|
10317
|
+
S2(A2, m2, E2, P2.from, N2, P2.target), A2.push(P2), E2 = P2.to, N2 = P2.target + P2.to - P2.from;
|
|
10164
10318
|
}
|
|
10165
10319
|
S2(A2, m2, E2, t[0].text.length, N2, t[m2].text.length);
|
|
10166
|
-
let M2 = Dn2({ base: t[0], side: t[m2], retained: A2.filter((
|
|
10320
|
+
let M2 = Dn2({ base: t[0], side: t[m2], retained: A2.filter((P2) => P2.kind === "retained"), transfers: A2.filter((P2) => P2.kind === "transfer"), baseAtomKey: n2[0], sideAtomKey: n2[m2], budget: l });
|
|
10167
10321
|
if (M2.status !== "ready" || !M2.monotone) throw h;
|
|
10168
10322
|
return M2;
|
|
10169
10323
|
};
|
|
@@ -10218,13 +10372,13 @@
|
|
|
10218
10372
|
let s2 = n2.ignored, h = n2.stats || $n2(), l = Ks2({ ignored: s2, ignoreAttribute: n2.ignoreAttribute, stats: h }), { unitsOf: r, meta: i2 } = l, u2 = n2.baseURI, w2 = n2.mergeTags !== null, c2 = Rs2(n2.mergeTags, u2), p2 = (L3) => (G3) => {
|
|
10219
10373
|
let re3 = c2(G3);
|
|
10220
10374
|
return re3 !== null ? re3 : L3(G3);
|
|
10221
|
-
}, b = p2(n2.identity.base), S2 = p2(n2.identity.local), C2 = p2(n2.identity.remote), m2 = n2.authored || n2.identity, f2 = (L3) => L3 && L3.nodeType === 9 ? L3.documentElement : L3, g = f2(e), I3 = f2(o2), v2 = f2(t), T2 = globalThis.__hyperMorphProfile, A2 = T2 ? performance.now() : 0, E2 = (L3) => L3 === kn ? Co2 : null, N2 = n2.scope || null, M2 = N2 ? N2.baseDropped : /* @__PURE__ */ new Set(),
|
|
10375
|
+
}, b = p2(n2.identity.base), S2 = p2(n2.identity.local), C2 = p2(n2.identity.remote), m2 = n2.authored || n2.identity, f2 = (L3) => L3 && L3.nodeType === 9 ? L3.documentElement : L3, g = f2(e), I3 = f2(o2), v2 = f2(t), T2 = globalThis.__hyperMorphProfile, A2 = T2 ? performance.now() : 0, E2 = (L3) => L3 === kn ? Co2 : null, N2 = n2.scope || null, M2 = N2 ? N2.baseDropped : /* @__PURE__ */ new Set(), P2 = /* @__PURE__ */ new Set(), V3 = N2 ? N2.remoteDropped : /* @__PURE__ */ new Set(), D2 = N2 ? N2.baseIndex : Uo2(g, b, s2, E2(n2.identity.base), M2), j2 = n2.localIsBase || g === I3 ? null : Uo2(I3, S2, s2, E2(n2.identity.local), P2), y2 = N2 ? N2.remoteIndex : Uo2(v2, C2, s2, E2(n2.identity.remote), V3), k2 = (L3) => {
|
|
10222
10376
|
let G3 = it3(L3) && S2(L3);
|
|
10223
10377
|
return G3 && j2?.get(G3) === L3 && !D2.has(G3) ? G3 : null;
|
|
10224
10378
|
}, J3 = (L3) => {
|
|
10225
10379
|
let G3 = it3(L3) && C2(L3);
|
|
10226
10380
|
return G3 && y2.get(G3) === L3 && !D2.has(G3) ? G3 : null;
|
|
10227
|
-
}, H2 = j2 ? cs2(g, I3, { analyzer: l, baseIndex: D2, sideIndex: j2, baseId: m2.base, sideId: m2.local, baseKey: b, sideKey: S2, baseDropped: M2, sideDropped:
|
|
10381
|
+
}, H2 = j2 ? cs2(g, I3, { analyzer: l, baseIndex: D2, sideIndex: j2, baseId: m2.base, sideId: m2.local, baseKey: b, sideKey: S2, baseDropped: M2, sideDropped: P2, stats: h }) : Vr2(), q3 = cs2(g, v2, { analyzer: l, baseIndex: D2, sideIndex: y2, baseId: m2.base, sideId: m2.remote, baseKey: b, sideKey: C2, baseDropped: M2, sideDropped: V3, stats: h, scope: N2, comparisons: n2.comparisons });
|
|
10228
10382
|
if (N2) {
|
|
10229
10383
|
if (!N2.held(q3)) return null;
|
|
10230
10384
|
for (let L3 of N2.dropped) ls2(L3);
|
|
@@ -10387,7 +10541,7 @@
|
|
|
10387
10541
|
function O2(L3, G3, re3, ge2) {
|
|
10388
10542
|
if (it3(L3) && Ln2.has(L3.tagName) && !H2.identical.has(L3) && (L3.previousSibling?.nodeType === 3 || L3.nextSibling?.nodeType === 3)) {
|
|
10389
10543
|
let Ie3 = Re3(L3), Be3 = a(H2, L3), He3 = a(q3, L3);
|
|
10390
|
-
Be3 && He3 && Ut3(Be3, a(H2, Ie3), H2) && !Ut3(He3, a(q3, Ie3), q3) && (Lt2 ||= Lr2({ L: H2, R: q3, twinIn: a, unitsOf: r, view:
|
|
10544
|
+
Be3 && He3 && Ut3(Be3, a(H2, Ie3), H2) && !Ut3(He3, a(q3, Ie3), q3) && (Lt2 ||= Lr2({ L: H2, R: q3, twinIn: a, unitsOf: r, view: R2, parentOf: Re3, ignored: s2, remoteWins: n2.remoteWins, eligible: (Ke3) => it3(Ke3) && Ln2.has(Ke3.tagName), build: U3, out: ie3, policy: Ge3, provenance: xe3, textMappers: qe3, segments: ae3, conflicts: x2, conflict: wt3, decisions: fe3 }), Lt2.ensureOwner(L3));
|
|
10391
10545
|
}
|
|
10392
10546
|
if (G3 === null) return null;
|
|
10393
10547
|
if (ge2 !== void 0) return Nt3 ||= go2(xe3, Re3, H2, q3, a, U3, s2, n2.remoteWins, x2, wt3, K2, I3, v2), Nt3.plan(L3, G3, re3, !!ge2), ge2 && (Nt3.produced(L3, ge2), Ee3.add(L3)), ge2;
|
|
@@ -10398,7 +10552,7 @@
|
|
|
10398
10552
|
let se3 = U3(L3, ye3, ce3, false);
|
|
10399
10553
|
return (G3 === "local" ? rt3 : Ot3)({ kind: "move", el: se3, source: G3 }), se3;
|
|
10400
10554
|
}
|
|
10401
|
-
function
|
|
10555
|
+
function R2(L3, G3, re3, ge2) {
|
|
10402
10556
|
return ge2 || !G3 || G3 === re3 ? { el: re3, asBase: true, twin: (ye3) => ye3, baseOf: (ye3) => ye3, units: r(re3), here: () => true, parentOfTwin: () => re3 } : { el: G3, asBase: false, twin: (ye3) => a(L3, ye3), baseOf: (ye3) => L3.reverse.get(ye3), units: r(G3), here: (ye3) => it3(ye3) ? ye3.parentNode === G3 || G3.tagName === "TEMPLATE" && ye3.parentNode === G3.content : ye3.parent === G3 || G3.tagName === "TEMPLATE" && ye3.parent === G3.content };
|
|
10403
10557
|
}
|
|
10404
10558
|
function K2(L3, G3, re3) {
|
|
@@ -10579,7 +10733,7 @@
|
|
|
10579
10733
|
}
|
|
10580
10734
|
function ee3(L3, G3, re3, ge2, ye3) {
|
|
10581
10735
|
G3 && H2.identical.has(L3) && H2.pairIdenticalChildren(L3), re3 && q3.identical.has(L3) && q3.pairIdenticalChildren(L3);
|
|
10582
|
-
let ce3 =
|
|
10736
|
+
let ce3 = R2(H2, G3, L3, ge2), se3 = R2(q3, re3, L3, false), Ie3 = r(L3), Be3 = new Set(Ie3), He3 = /* @__PURE__ */ new Map();
|
|
10583
10737
|
for (let ue3 = 0; ue3 < Ie3.length; ue3++) He3.set(Ie3[ue3], ue3);
|
|
10584
10738
|
let Ke3 = [], pt3 = /* @__PURE__ */ new Set(), tt3 = /* @__PURE__ */ new Map(), Kt2 = /* @__PURE__ */ new Set(), Ht3 = Xe3 && [], un2 = Xe3 && [], bt3 = /* @__PURE__ */ new Set(), lt3 = [], $e3 = null, vt2 = /* @__PURE__ */ new Map();
|
|
10585
10739
|
if (!ce3.asBase && !se3.asBase && !H2.identical.has(L3) && !q3.identical.has(L3)) for (let ue3 of Ie3) {
|
|
@@ -11070,21 +11224,21 @@
|
|
|
11070
11224
|
var Hr2 = /* @__PURE__ */ new Set(["INPUT", "OPTION", "TEXTAREA"]), Ps2 = /[\t\n\f\r ]+/;
|
|
11071
11225
|
function Wr(e, o2, t, n2) {
|
|
11072
11226
|
let s2 = e.ownerDocument, { provenance: h, textMappers: l } = t, r = n2.hooks, i2 = [], u2 = [], w2 = [], c2 = /* @__PURE__ */ new Set(), p2 = [], b = [], S2 = /* @__PURE__ */ new Map(), C2 = /* @__PURE__ */ new Set(), m2 = /* @__PURE__ */ new Map(), f2 = t.conflicts.length > 0 || n2.trackInserted === true, g = /* @__PURE__ */ new Map(), I3 = /* @__PURE__ */ new Set(), v2 = /* @__PURE__ */ new Map(), T2 = (a, O2) => {
|
|
11073
|
-
let
|
|
11074
|
-
|
|
11075
|
-
}, A2 = f2 ? /* @__PURE__ */ new Set() : null, E2 = (a, O2,
|
|
11076
|
-
let K2 = r.beforeAttributeUpdated(a, O2,
|
|
11227
|
+
let R2 = v2.get(a);
|
|
11228
|
+
R2 || v2.set(a, R2 = /* @__PURE__ */ new Set()), R2.add(O2);
|
|
11229
|
+
}, A2 = f2 ? /* @__PURE__ */ new Set() : null, E2 = (a, O2, R2) => {
|
|
11230
|
+
let K2 = r.beforeAttributeUpdated(a, O2, R2);
|
|
11077
11231
|
return f2 && K2 === false && T2(O2, a), K2;
|
|
11078
|
-
}, N2 = (a) => !!a && (a === e || e.contains(a) || e.nodeType === 1 && e.tagName === "TEMPLATE" && e.content.contains(a)), M2 = /* @__PURE__ */ new Map(),
|
|
11232
|
+
}, N2 = (a) => !!a && (a === e || e.contains(a) || e.nodeType === 1 && e.tagName === "TEMPLATE" && e.content.contains(a)), M2 = /* @__PURE__ */ new Map(), P2 = /* @__PURE__ */ new Map(), V3 = /* @__PURE__ */ new Map(), D2 = /* @__PURE__ */ new Set(), j2 = /* @__PURE__ */ new Map();
|
|
11079
11233
|
(function a(O2) {
|
|
11080
|
-
let
|
|
11081
|
-
if (
|
|
11234
|
+
let R2 = h.get(O2);
|
|
11235
|
+
if (R2) {
|
|
11082
11236
|
if (O2.nodeType === 1) {
|
|
11083
|
-
let Z3 =
|
|
11084
|
-
Z3 && N2(Z3) && Z3.nodeType === 1 && (M2.set(O2, Z3),
|
|
11085
|
-
} else if (Array.isArray(
|
|
11086
|
-
let Z3 = q3(
|
|
11087
|
-
if (Z3.length && (M2.set(O2, Z3[0]),
|
|
11237
|
+
let Z3 = R2.local ? n2.toLive(R2.local) : null;
|
|
11238
|
+
Z3 && N2(Z3) && Z3.nodeType === 1 && (M2.set(O2, Z3), P2.set(Z3, O2));
|
|
11239
|
+
} else if (Array.isArray(R2.local)) {
|
|
11240
|
+
let Z3 = q3(R2.local, R2.local.map((U3) => n2.toLive(U3)).filter((U3) => U3 && N2(U3) && U3.nodeType === O2.nodeType));
|
|
11241
|
+
if (Z3.length && (M2.set(O2, Z3[0]), P2.set(Z3[0], O2), V3.set(O2, Z3)), Array.isArray(R2.caret)) for (let U3 of R2.caret) {
|
|
11088
11242
|
let de3 = n2.toLive(U3.node);
|
|
11089
11243
|
if (!de3 || !N2(de3) || de3.nodeType !== 3) continue;
|
|
11090
11244
|
let we3 = j2.get(de3);
|
|
@@ -11105,8 +11259,8 @@
|
|
|
11105
11259
|
let k2 = n2.localRoot && n2.localRoot !== e ? /* @__PURE__ */ new Set() : null;
|
|
11106
11260
|
if (k2) {
|
|
11107
11261
|
for (let a = n2.localRoot.firstElementChild; a; a = a.nextElementSibling) if (a.tagName === "HEAD") for (let O2 = a.firstElementChild; O2; O2 = O2.nextElementSibling) {
|
|
11108
|
-
let
|
|
11109
|
-
|
|
11262
|
+
let R2 = n2.toLive(O2);
|
|
11263
|
+
R2 && k2.add(R2);
|
|
11110
11264
|
}
|
|
11111
11265
|
}
|
|
11112
11266
|
for (let a of t.segments || []) Me3(a);
|
|
@@ -11115,15 +11269,15 @@
|
|
|
11115
11269
|
for (let { node: a, parent: O2 } of p2) c2.has(a) || !a.parentNode || a.nodeType === 1 && (n2.ignored(a) || qe3(a)) || nt3(a, O2);
|
|
11116
11270
|
return xl2(s2, J3, j2, l, V3, m2, D2), { applied: i2, moved: u2, replaced: w2, identities: b, mergedScriptsLive: C2, liveOf: M2, heldBy: m2, runOf: V3, keptRuns: D2, insertedLive: g, vetoed: I3, vetoedAttrs: v2, removedVetoes: A2 };
|
|
11117
11271
|
function H2(a, O2) {
|
|
11118
|
-
let
|
|
11119
|
-
for (; K2 <
|
|
11272
|
+
let R2 = a.slice(O2.bs, O2.be), K2 = 0;
|
|
11273
|
+
for (; K2 < R2.length && K2 < O2.text.length && R2[K2] === O2.text[K2]; ) K2++;
|
|
11120
11274
|
let Z3 = 0;
|
|
11121
|
-
for (; Z3 <
|
|
11275
|
+
for (; Z3 < R2.length - K2 && Z3 < O2.text.length - K2 && R2[R2.length - 1 - Z3] === O2.text[O2.text.length - 1 - Z3]; ) Z3++;
|
|
11122
11276
|
return { bs: O2.bs + K2, be: O2.be - Z3, text: O2.text.slice(K2, O2.text.length - Z3) };
|
|
11123
11277
|
}
|
|
11124
11278
|
function q3(a, O2) {
|
|
11125
11279
|
if (!O2.length) return O2;
|
|
11126
|
-
let
|
|
11280
|
+
let R2 = [];
|
|
11127
11281
|
for (let U3 of a) {
|
|
11128
11282
|
let de3 = U3.parentNode;
|
|
11129
11283
|
if (!de3) continue;
|
|
@@ -11133,9 +11287,9 @@
|
|
|
11133
11287
|
for (let le3 = de3.firstChild; le3; le3 = le3.nextSibling) le3.nodeType === 3 && we3.add(n2.toLive(le3));
|
|
11134
11288
|
S2.set(de3, we3);
|
|
11135
11289
|
}
|
|
11136
|
-
|
|
11290
|
+
R2.includes(we3) || R2.push(we3);
|
|
11137
11291
|
}
|
|
11138
|
-
let K2 = { has: (U3) =>
|
|
11292
|
+
let K2 = { has: (U3) => R2.some((de3) => de3.has(U3)) }, Z3 = [];
|
|
11139
11293
|
for (let U3 of O2) {
|
|
11140
11294
|
Z3.push(U3);
|
|
11141
11295
|
for (let de3 = U3.nextSibling; de3 && de3.nodeType === 3 && !K2.has(de3) && !Z3.includes(de3); de3 = de3.nextSibling) Z3.push(de3);
|
|
@@ -11149,13 +11303,13 @@
|
|
|
11149
11303
|
if (!te3 || !N2(te3) || te3.nodeType !== 3) return;
|
|
11150
11304
|
O2.push(te3);
|
|
11151
11305
|
}
|
|
11152
|
-
let
|
|
11153
|
-
if (!
|
|
11154
|
-
let K2 =
|
|
11306
|
+
let R2 = q3(a.localNodes.map((ee3) => ee3.node), O2);
|
|
11307
|
+
if (!R2.length) return;
|
|
11308
|
+
let K2 = R2.map((ee3) => ee3.nodeValue).join(""), { flatLocal: Z3, lToM: U3, mapLocal: de3 } = a;
|
|
11155
11309
|
if (K2 === Z3) return;
|
|
11156
11310
|
let we3 = a.textNodes.map((ee3) => ({ node: ee3.node, ms: ee3.ms, me: ee3.me })), le3 = [], Ae3 = 0;
|
|
11157
|
-
for (let ee3 of
|
|
11158
|
-
let W3 = (ee3, te3) =>
|
|
11311
|
+
for (let ee3 of R2) le3.push(Ae3), Ae3 += ee3.nodeValue.length;
|
|
11312
|
+
let W3 = (ee3, te3) => R2.find((z2, ne3) => le3[ne3] <= ee3 && ee3 + te3 <= le3[ne3] + z2.nodeValue.length) || null, X2 = [], pe3 = 0;
|
|
11159
11313
|
for (let ee3 of Yn2(Z3, K2).map((te3) => H2(Z3, te3))) {
|
|
11160
11314
|
let te3 = ee3.bs + pe3;
|
|
11161
11315
|
pe3 += ee3.text.length - (ee3.be - ee3.bs);
|
|
@@ -11203,25 +11357,25 @@
|
|
|
11203
11357
|
}
|
|
11204
11358
|
function Re3(a, O2) {
|
|
11205
11359
|
c2.add(a);
|
|
11206
|
-
let
|
|
11207
|
-
if (
|
|
11208
|
-
let Z3 = t.remoteIdOf(
|
|
11360
|
+
let R2 = h.get(O2);
|
|
11361
|
+
if (R2 && R2.remote && t.remoteIdOf) {
|
|
11362
|
+
let Z3 = t.remoteIdOf(R2.remote);
|
|
11209
11363
|
Z3 && b.push([a, Z3]);
|
|
11210
11364
|
}
|
|
11211
|
-
if (
|
|
11212
|
-
n2.opaque && n2.opaque(a) || (t.customIdentity &&
|
|
11365
|
+
if (R2 && R2.unchanged) {
|
|
11366
|
+
n2.opaque && n2.opaque(a) || (t.customIdentity && R2.remote && ae3(a, R2.remote), R2.remote && Y2(a, R2.remote));
|
|
11213
11367
|
return;
|
|
11214
11368
|
}
|
|
11215
11369
|
if (r.beforeNodeMorphed(a, O2) === false) {
|
|
11216
11370
|
I3.add(O2);
|
|
11217
11371
|
return;
|
|
11218
11372
|
}
|
|
11219
|
-
Ct3(a, O2, n2.keepLiveOnly &&
|
|
11373
|
+
Ct3(a, O2, n2.keepLiveOnly && R2 && R2.local && R2.local.nodeType === 1 && R2.local !== a ? R2.local : null);
|
|
11220
11374
|
let K2 = a.tagName;
|
|
11221
11375
|
if (pn2(a)) a.textContent !== O2.textContent && (i2.push({ kind: "text", node: a, before: a.textContent, after: O2.textContent }), a.textContent = O2.textContent), t.mergedScripts.has(O2) && C2.add(a);
|
|
11222
|
-
else if (K2 === "TEXTAREA") $3(a, O2,
|
|
11376
|
+
else if (K2 === "TEXTAREA") $3(a, O2, R2);
|
|
11223
11377
|
else {
|
|
11224
|
-
Yt3(a, O2,
|
|
11378
|
+
Yt3(a, O2, R2);
|
|
11225
11379
|
let Z3 = K2 === "TEMPLATE" && a.content ? a.content : a, U3 = K2 === "TEMPLATE" && O2.content ? O2.content : O2;
|
|
11226
11380
|
n2.opaque && n2.opaque(a) || n2.protectFocusedValue === "subtree" && Nt3(a) && a !== s2.body ? ie3(Z3) : xe3(Z3, U3);
|
|
11227
11381
|
}
|
|
@@ -11229,32 +11383,32 @@
|
|
|
11229
11383
|
}
|
|
11230
11384
|
function ie3(a) {
|
|
11231
11385
|
for (let O2 = a.firstChild; O2; O2 = O2.nextSibling) {
|
|
11232
|
-
let
|
|
11233
|
-
|
|
11386
|
+
let R2 = P2.get(O2);
|
|
11387
|
+
R2 && M2.get(R2.parentNode) !== a || (c2.add(O2), O2.nodeType === 1 && ie3(O2));
|
|
11234
11388
|
}
|
|
11235
11389
|
}
|
|
11236
11390
|
function xe3(a, O2) {
|
|
11237
|
-
let
|
|
11391
|
+
let R2 = De3(a.firstChild), K2 = /* @__PURE__ */ new Set();
|
|
11238
11392
|
for (let Z3 of Array.from(O2.childNodes)) {
|
|
11239
11393
|
let U3 = M2.get(Z3);
|
|
11240
11394
|
U3 && c2.has(U3) && !K2.has(U3) && (U3 = null);
|
|
11241
11395
|
let de3 = h.get(Z3);
|
|
11242
11396
|
if (de3 && de3.pinned) {
|
|
11243
|
-
U3 && U3.nodeType === 1 && ((U3.parentNode !== a || De3(U3.nextSibling) !==
|
|
11397
|
+
U3 && U3.nodeType === 1 && ((U3.parentNode !== a || De3(U3.nextSibling) !== R2) && Ne3(a, U3, R2), c2.add(U3), K2.add(U3));
|
|
11244
11398
|
continue;
|
|
11245
11399
|
}
|
|
11246
11400
|
if (U3 && U3.nodeType === 1) {
|
|
11247
|
-
if (U3 !==
|
|
11401
|
+
if (U3 !== R2) {
|
|
11248
11402
|
let Ae3 = U3.parentNode;
|
|
11249
|
-
if (Ae3 === a &&
|
|
11403
|
+
if (Ae3 === a && R2 && Lt2(U3)) {
|
|
11250
11404
|
let W3 = U3.nextSibling;
|
|
11251
|
-
for (let X2 =
|
|
11405
|
+
for (let X2 = R2; X2 && X2 !== U3; ) {
|
|
11252
11406
|
let pe3 = X2.nextSibling;
|
|
11253
11407
|
Ne3(a, X2, W3), X2 = pe3;
|
|
11254
11408
|
}
|
|
11255
|
-
} else Ne3(a, U3,
|
|
11409
|
+
} else Ne3(a, U3, R2), Ae3 !== a && (u2.push(U3), i2.push({ kind: "move", el: U3, from: Ae3, to: a }));
|
|
11256
11410
|
}
|
|
11257
|
-
K2.add(U3), Re3(U3, Z3),
|
|
11411
|
+
K2.add(U3), Re3(U3, Z3), R2 = De3(U3.nextSibling);
|
|
11258
11412
|
continue;
|
|
11259
11413
|
}
|
|
11260
11414
|
if (U3 && U3.nodeType !== 1) {
|
|
@@ -11263,18 +11417,18 @@
|
|
|
11263
11417
|
let pe3 = fe3(Z3);
|
|
11264
11418
|
pe3 != null && W3 !== pe3 && (X2 = lo2(pe3, W3, Z3.nodeValue).text);
|
|
11265
11419
|
}
|
|
11266
|
-
if (Ae3.length > 1 && W3 === X2 && !Ae3.includes(
|
|
11267
|
-
if (U3 !==
|
|
11420
|
+
if (Ae3.length > 1 && W3 === X2 && !Ae3.includes(R2, 1) && Ae3.every((pe3, be3) => pe3.parentNode === a && (be3 === 0 || Ae3[be3 - 1].nextSibling === pe3))) {
|
|
11421
|
+
if (U3 !== R2) for (let pe3 of Ae3) Ne3(a, pe3, R2);
|
|
11268
11422
|
r.beforeNodeMorphed(U3, Z3) !== false ? r.afterNodeMorphed(U3, Z3) : f2 && I3.add(Z3);
|
|
11269
11423
|
for (let pe3 of Ae3) c2.add(pe3), K2.add(pe3);
|
|
11270
|
-
m2.set(Z3, U3), D2.add(Z3),
|
|
11424
|
+
m2.set(Z3, U3), D2.add(Z3), R2 = De3(Ae3[Ae3.length - 1].nextSibling);
|
|
11271
11425
|
continue;
|
|
11272
11426
|
}
|
|
11273
|
-
U3 !==
|
|
11427
|
+
U3 !== R2 && Ne3(a, U3, R2), r.beforeNodeMorphed(U3, Z3) !== false ? (U3.nodeValue !== X2 && (i2.push({ kind: "text", node: U3, before: U3.nodeValue, after: X2 }), U3.nodeValue = X2), r.afterNodeMorphed(U3, Z3)) : I3.add(Z3), c2.add(U3), K2.add(U3), m2.set(Z3, U3), R2 = De3(U3.nextSibling);
|
|
11274
11428
|
continue;
|
|
11275
11429
|
}
|
|
11276
|
-
if (Z3.nodeType === 3 &&
|
|
11277
|
-
|
|
11430
|
+
if (Z3.nodeType === 3 && R2 && R2.nodeType === 3 && !c2.has(R2) && !j2.has(R2)) {
|
|
11431
|
+
R2.nodeValue !== Z3.nodeValue && (i2.push({ kind: "text", node: R2, before: R2.nodeValue, after: Z3.nodeValue }), R2.nodeValue = Z3.nodeValue), c2.add(R2), m2.set(Z3, R2), R2 = De3(R2.nextSibling);
|
|
11278
11432
|
continue;
|
|
11279
11433
|
}
|
|
11280
11434
|
let we3 = h.get(Z3), le3 = Xe3(we3 && we3.unchanged && we3.remote ? we3.remote : Z3);
|
|
@@ -11282,7 +11436,7 @@
|
|
|
11282
11436
|
I3.add(Z3);
|
|
11283
11437
|
continue;
|
|
11284
11438
|
}
|
|
11285
|
-
a.insertBefore(le3,
|
|
11439
|
+
a.insertBefore(le3, R2), c2.add(le3), f2 && g.set(Z3, le3), le3.nodeType === 3 && m2.set(Z3, le3), le3.nodeType === 1 && (w2.push(le3), Ee3(le3, Z3), t.customIdentity && we3 && we3.unchanged && we3.remote && ae3(le3, we3.remote), pn2(le3) || ht3(le3, Z3), n2.formState === "property" && rn(we3) && Y2(le3, we3.remote)), R2 = De3(le3.nextSibling), i2.push({ kind: "insert", node: le3, parent: a }), r.afterNodeAdded(le3);
|
|
11286
11440
|
}
|
|
11287
11441
|
for (let Z3 of Array.from(a.childNodes)) c2.has(Z3) || K2.has(Z3) || Z3.nodeType === 1 && (n2.ignored(Z3) || qe3(Z3)) || (y2.has(Z3) ? p2.push({ node: Z3, parent: a }) : nt3(Z3, a));
|
|
11288
11442
|
}
|
|
@@ -11291,56 +11445,56 @@
|
|
|
11291
11445
|
}
|
|
11292
11446
|
function fe3(a) {
|
|
11293
11447
|
let O2 = h.get(a);
|
|
11294
|
-
return !O2 || !Array.isArray(O2.local) ? null : O2.local.map((
|
|
11448
|
+
return !O2 || !Array.isArray(O2.local) ? null : O2.local.map((R2) => R2.nodeValue).join("");
|
|
11295
11449
|
}
|
|
11296
11450
|
function x2(a) {
|
|
11297
11451
|
return h.get(a);
|
|
11298
11452
|
}
|
|
11299
11453
|
function Y2(a, O2) {
|
|
11300
11454
|
if (!Hr2.has(a.tagName) && !a.querySelector("input,option,textarea")) return;
|
|
11301
|
-
let
|
|
11455
|
+
let R2 = (K2, Z3) => {
|
|
11302
11456
|
if (K2.tagName !== Z3.tagName || (K2.tagName === "TEXTAREA" ? $3(K2, Z3, { remote: Z3 }) : Hr2.has(K2.tagName) && Yt3(K2, Z3, { remote: Z3 }), n2.opaque && n2.opaque(K2))) return;
|
|
11303
11457
|
let U3 = oe3(K2), de3 = oe3(Z3);
|
|
11304
|
-
if (U3.length === de3.length) for (let we3 = 0; we3 < U3.length; we3++)
|
|
11458
|
+
if (U3.length === de3.length) for (let we3 = 0; we3 < U3.length; we3++) R2(U3[we3], de3[we3]);
|
|
11305
11459
|
};
|
|
11306
|
-
|
|
11460
|
+
R2(a, O2);
|
|
11307
11461
|
}
|
|
11308
11462
|
function ae3(a, O2) {
|
|
11309
11463
|
if (n2.opaque && n2.opaque(a)) return;
|
|
11310
|
-
let
|
|
11311
|
-
if (
|
|
11464
|
+
let R2 = oe3(a), K2 = oe3(O2);
|
|
11465
|
+
if (R2.length === K2.length) for (let Z3 = 0; Z3 < R2.length; Z3++) {
|
|
11312
11466
|
let U3 = t.remoteIdOf(K2[Z3]);
|
|
11313
|
-
U3 && b.push([
|
|
11467
|
+
U3 && b.push([R2[Z3], U3]), ae3(R2[Z3], K2[Z3]);
|
|
11314
11468
|
}
|
|
11315
11469
|
}
|
|
11316
11470
|
function oe3(a) {
|
|
11317
11471
|
let O2 = a.tagName === "TEMPLATE" && a.content ? a.content : a;
|
|
11318
|
-
return Array.from(O2.children).filter((
|
|
11472
|
+
return Array.from(O2.children).filter((R2) => !n2.ignored(R2));
|
|
11319
11473
|
}
|
|
11320
11474
|
function Ee3(a, O2) {
|
|
11321
11475
|
if (!t.remoteIdOf) return;
|
|
11322
|
-
let
|
|
11476
|
+
let R2 = (K2, Z3) => {
|
|
11323
11477
|
let U3 = h.get(Z3);
|
|
11324
11478
|
if (U3 && U3.remote && Z3.nodeType === 1) {
|
|
11325
11479
|
let le3 = t.remoteIdOf(U3.remote);
|
|
11326
11480
|
le3 && b.push([K2, le3]);
|
|
11327
11481
|
}
|
|
11328
11482
|
let de3 = K2.childNodes, we3 = Z3.childNodes;
|
|
11329
|
-
for (let le3 = 0; le3 < de3.length && le3 < we3.length; le3++)
|
|
11483
|
+
for (let le3 = 0; le3 < de3.length && le3 < we3.length; le3++) R2(de3[le3], we3[le3]);
|
|
11330
11484
|
};
|
|
11331
|
-
|
|
11485
|
+
R2(a, O2);
|
|
11332
11486
|
}
|
|
11333
11487
|
function De3(a) {
|
|
11334
11488
|
for (; a && a.nodeType === 1 && n2.ignored(a); ) a = a.nextSibling;
|
|
11335
11489
|
return a;
|
|
11336
11490
|
}
|
|
11337
|
-
function Ne3(a, O2,
|
|
11491
|
+
function Ne3(a, O2, R2) {
|
|
11338
11492
|
if (typeof a.moveBefore == "function" && O2.ownerDocument === a.ownerDocument) try {
|
|
11339
|
-
a.moveBefore(O2,
|
|
11493
|
+
a.moveBefore(O2, R2);
|
|
11340
11494
|
return;
|
|
11341
11495
|
} catch {
|
|
11342
11496
|
}
|
|
11343
|
-
a.insertBefore(O2,
|
|
11497
|
+
a.insertBefore(O2, R2);
|
|
11344
11498
|
}
|
|
11345
11499
|
function nt3(a, O2) {
|
|
11346
11500
|
if (r.beforeNodeRemoved(a) === false) {
|
|
@@ -11352,11 +11506,11 @@
|
|
|
11352
11506
|
function Xe3(a) {
|
|
11353
11507
|
if (pn2(a)) return Mo(a, s2);
|
|
11354
11508
|
let O2 = s2.importNode(a, true);
|
|
11355
|
-
if (O2.nodeType === 1) for (let
|
|
11509
|
+
if (O2.nodeType === 1) for (let R2 of Array.from(O2.querySelectorAll("script"))) pn2(R2) && R2.replaceWith(Mo(R2, s2));
|
|
11356
11510
|
return O2;
|
|
11357
11511
|
}
|
|
11358
11512
|
function ht3(a, O2) {
|
|
11359
|
-
let
|
|
11513
|
+
let R2 = a.tagName === "TEMPLATE" && a.content ? a.content : a, K2 = O2.tagName === "TEMPLATE" && O2.content ? O2.content : O2, Z3 = Array.from(R2.childNodes), U3 = Array.from(K2.childNodes);
|
|
11360
11514
|
for (let de3 = 0; de3 < U3.length && de3 < Z3.length; de3++) {
|
|
11361
11515
|
let we3 = U3[de3], le3 = Z3[de3], Ae3 = M2.get(we3);
|
|
11362
11516
|
Ae3 && c2.has(Ae3) && (Ae3 = null);
|
|
@@ -11364,38 +11518,38 @@
|
|
|
11364
11518
|
if (W3 && W3.pinned) {
|
|
11365
11519
|
if (Ae3 && Ae3.nodeType === 1) {
|
|
11366
11520
|
let X2 = Ae3.parentNode;
|
|
11367
|
-
Ne3(
|
|
11521
|
+
Ne3(R2, Ae3, le3), X2 !== R2 && (u2.push(Ae3), i2.push({ kind: "move", el: Ae3, from: X2, to: R2 })), c2.add(Ae3);
|
|
11368
11522
|
}
|
|
11369
11523
|
le3.remove();
|
|
11370
11524
|
continue;
|
|
11371
11525
|
}
|
|
11372
11526
|
if (Ae3) {
|
|
11373
11527
|
let X2 = Ae3.parentNode;
|
|
11374
|
-
Ne3(
|
|
11528
|
+
Ne3(R2, Ae3, le3), le3.remove(), Ae3.nodeType === 1 ? (X2 !== R2 && (u2.push(Ae3), i2.push({ kind: "move", el: Ae3, from: X2, to: R2 })), Re3(Ae3, we3)) : (c2.add(Ae3), m2.set(we3, Ae3), Ae3.nodeValue !== we3.nodeValue && (i2.push({ kind: "text", node: Ae3, before: Ae3.nodeValue, after: we3.nodeValue }), Ae3.nodeValue = we3.nodeValue));
|
|
11375
11529
|
continue;
|
|
11376
11530
|
}
|
|
11377
11531
|
c2.add(le3), f2 && g.set(we3, le3), le3.nodeType === 3 && m2.set(we3, le3), W3 && W3.unchanged && W3.remote ? (Ge3(le3, W3.remote), t.customIdentity && ae3(le3, W3.remote)) : we3.nodeType === 1 && !pn2(we3) && ht3(le3, we3);
|
|
11378
11532
|
}
|
|
11379
11533
|
}
|
|
11380
11534
|
function Ge3(a, O2) {
|
|
11381
|
-
let
|
|
11382
|
-
for (let Z3 of Array.from(K2.childNodes))
|
|
11535
|
+
let R2 = a.tagName === "TEMPLATE" && a.content ? a.content : a, K2 = O2.tagName === "TEMPLATE" && O2.content ? O2.content : O2;
|
|
11536
|
+
for (let Z3 of Array.from(K2.childNodes)) R2.appendChild(Xe3(Z3));
|
|
11383
11537
|
}
|
|
11384
11538
|
function rt3(a, O2) {
|
|
11385
11539
|
return O2.namespaceURI ? a.getAttributeNS(O2.namespaceURI, O2.localName) : a.getAttribute(O2.name);
|
|
11386
11540
|
}
|
|
11387
11541
|
function Ot3(a, O2) {
|
|
11388
|
-
let
|
|
11389
|
-
return (a || "").split(Ps2).filter((K2) => K2 && !
|
|
11542
|
+
let R2 = new Set((O2 || "").split(Ps2).filter(Boolean));
|
|
11543
|
+
return (a || "").split(Ps2).filter((K2) => K2 && !R2.has(K2));
|
|
11390
11544
|
}
|
|
11391
|
-
function Ct3(a, O2,
|
|
11545
|
+
function Ct3(a, O2, R2) {
|
|
11392
11546
|
for (let K2 of Array.from(O2.attributes)) {
|
|
11393
|
-
if (wt3(a, K2.name) || n2.ignoreAttribute(a, K2.name)) continue;
|
|
11547
|
+
if (wt3(a, K2.name) || n2.ignoreAttribute(a, K2.name, O2)) continue;
|
|
11394
11548
|
let Z3 = rt3(a, K2);
|
|
11395
|
-
if (Z3 === K2.value ||
|
|
11549
|
+
if (Z3 === K2.value || R2 && rt3(R2, K2) === K2.value) continue;
|
|
11396
11550
|
let U3 = K2.value;
|
|
11397
|
-
if (
|
|
11398
|
-
let de3 = K2.value.split(Ps2).filter(Boolean), we3 = Ot3(Z3,
|
|
11551
|
+
if (R2 && K2.name === "class" && !K2.namespaceURI) {
|
|
11552
|
+
let de3 = K2.value.split(Ps2).filter(Boolean), we3 = Ot3(Z3, R2.getAttribute("class")).filter((le3) => !de3.includes(le3));
|
|
11399
11553
|
we3.length && (U3 = [...de3, ...we3].join(" "));
|
|
11400
11554
|
}
|
|
11401
11555
|
if (Z3 !== U3) {
|
|
@@ -11407,9 +11561,9 @@
|
|
|
11407
11561
|
}
|
|
11408
11562
|
}
|
|
11409
11563
|
for (let K2 of Array.from(a.attributes)) {
|
|
11410
|
-
if (wt3(a, K2.name) || n2.ignoreAttribute(a, K2.name) || (K2.namespaceURI ? O2.hasAttributeNS(K2.namespaceURI, K2.localName) : O2.hasAttribute(K2.name))) continue;
|
|
11411
|
-
if (
|
|
11412
|
-
let de3 = Ot3(K2.value,
|
|
11564
|
+
if (wt3(a, K2.name) || n2.ignoreAttribute(a, K2.name, O2) || (K2.namespaceURI ? O2.hasAttributeNS(K2.namespaceURI, K2.localName) : O2.hasAttribute(K2.name))) continue;
|
|
11565
|
+
if (R2 && K2.name === "class" && !K2.namespaceURI) {
|
|
11566
|
+
let de3 = Ot3(K2.value, R2.getAttribute("class"));
|
|
11413
11567
|
if (de3.length) {
|
|
11414
11568
|
let we3 = de3.join(" ");
|
|
11415
11569
|
if (we3 === K2.value) continue;
|
|
@@ -11421,7 +11575,7 @@
|
|
|
11421
11575
|
continue;
|
|
11422
11576
|
}
|
|
11423
11577
|
}
|
|
11424
|
-
if (
|
|
11578
|
+
if (R2 && rt3(R2, K2) === null && !n2.ignoreAttribute(R2, K2.name)) continue;
|
|
11425
11579
|
if (r.beforeAttributeUpdated(K2.name, a, "remove") === false) {
|
|
11426
11580
|
f2 && T2(O2, K2.name);
|
|
11427
11581
|
continue;
|
|
@@ -11431,8 +11585,8 @@
|
|
|
11431
11585
|
}
|
|
11432
11586
|
}
|
|
11433
11587
|
function wt3(a, O2) {
|
|
11434
|
-
let
|
|
11435
|
-
return
|
|
11588
|
+
let R2 = a.tagName;
|
|
11589
|
+
return R2 === "INPUT" ? O2 === "value" || O2 === "checked" || O2 === "disabled" : R2 === "OPTION" ? O2 === "selected" : false;
|
|
11436
11590
|
}
|
|
11437
11591
|
function Nt3(a) {
|
|
11438
11592
|
return a === s2.activeElement;
|
|
@@ -11442,21 +11596,21 @@
|
|
|
11442
11596
|
return !!O2 && O2 !== s2.body && a.contains(O2);
|
|
11443
11597
|
}
|
|
11444
11598
|
function qt3(a, O2) {
|
|
11445
|
-
let
|
|
11446
|
-
if (!
|
|
11447
|
-
let K2 = a.tagName === "TEXTAREA" ?
|
|
11599
|
+
let R2 = O2 && O2.local && O2.local.nodeType === 1 && O2.local !== a ? O2.local : null;
|
|
11600
|
+
if (!R2) return true;
|
|
11601
|
+
let K2 = a.tagName === "TEXTAREA" ? R2.textContent : R2.getAttribute("value") ?? "";
|
|
11448
11602
|
return a.value !== K2;
|
|
11449
11603
|
}
|
|
11450
11604
|
function cn2(a, O2) {
|
|
11451
11605
|
return !!n2.protectFocusedValue && Nt3(a) && qt3(a, O2);
|
|
11452
11606
|
}
|
|
11453
|
-
function It3(a, O2,
|
|
11607
|
+
function It3(a, O2, R2) {
|
|
11454
11608
|
let K2 = Math.min(a.length, O2.length), Z3 = 0;
|
|
11455
11609
|
for (; Z3 < K2 && a[Z3] === O2[Z3]; ) Z3++;
|
|
11456
|
-
if (
|
|
11610
|
+
if (R2 <= Z3) return R2;
|
|
11457
11611
|
let U3 = 0;
|
|
11458
11612
|
for (; U3 < K2 - Z3 && a[a.length - 1 - U3] === O2[O2.length - 1 - U3]; ) U3++;
|
|
11459
|
-
return
|
|
11613
|
+
return R2 >= a.length - U3 ? R2 + O2.length - a.length : O2.length - U3;
|
|
11460
11614
|
}
|
|
11461
11615
|
function Gt2(a) {
|
|
11462
11616
|
try {
|
|
@@ -11465,24 +11619,24 @@
|
|
|
11465
11619
|
return null;
|
|
11466
11620
|
}
|
|
11467
11621
|
}
|
|
11468
|
-
function wn2(a, O2,
|
|
11622
|
+
function wn2(a, O2, R2, K2) {
|
|
11469
11623
|
try {
|
|
11470
|
-
a.setSelectionRange(It3(O2,
|
|
11624
|
+
a.setSelectionRange(It3(O2, R2, K2[0]), It3(O2, R2, K2[1]), K2[2] || "none");
|
|
11471
11625
|
} catch {
|
|
11472
11626
|
}
|
|
11473
11627
|
}
|
|
11474
11628
|
function Dt3(a, O2) {
|
|
11475
|
-
let
|
|
11476
|
-
a.value = O2, K2 && wn2(a,
|
|
11629
|
+
let R2 = a.value, K2 = Gt2(a);
|
|
11630
|
+
a.value = O2, K2 && wn2(a, R2, O2, K2);
|
|
11477
11631
|
}
|
|
11478
11632
|
function rn(a) {
|
|
11479
11633
|
let O2 = a && a.remote;
|
|
11480
11634
|
return O2 && O2.nodeType === 1 ? O2 : null;
|
|
11481
11635
|
}
|
|
11482
|
-
function Yt3(a, O2,
|
|
11483
|
-
let K2 = a.tagName, Z3 = rn(
|
|
11636
|
+
function Yt3(a, O2, R2) {
|
|
11637
|
+
let K2 = a.tagName, Z3 = rn(R2), U3 = n2.formState === "property" && Z3 ? Z3 : O2;
|
|
11484
11638
|
if (K2 === "INPUT") {
|
|
11485
|
-
let de3 = cn2(a,
|
|
11639
|
+
let de3 = cn2(a, R2), we3 = (a.getAttribute("type") || "").toLowerCase(), le3 = we3 !== "file" && we3 !== "checkbox" && we3 !== "radio", Ae3 = Z3 && Z3.hasAttribute("value") && Z3.value !== Z3.getAttribute("value") ? Z3.value : null;
|
|
11486
11640
|
if (le3 && !de3) if (n2.formState === "property") {
|
|
11487
11641
|
let W3 = O2.getAttribute("value"), X2 = a.getAttribute("value");
|
|
11488
11642
|
(X2 !== W3 || a.value !== U3.value) && E2("value", a, W3 == null ? "remove" : "update") !== false && (X2 !== W3 && (W3 == null ? a.removeAttribute("value") : a.setAttribute("value", W3), i2.push({ kind: "attr", el: a, name: "value", before: X2, after: W3 })), a.value !== U3.value && (Nt3(a) ? Dt3(a, U3.value) : a.value = U3.value));
|
|
@@ -11500,20 +11654,21 @@
|
|
|
11500
11654
|
n2.protectFocusedValue && de3 && Nt3(de3) || fn2(a, U3, "selected");
|
|
11501
11655
|
}
|
|
11502
11656
|
}
|
|
11503
|
-
function fn2(a, O2,
|
|
11504
|
-
|
|
11657
|
+
function fn2(a, O2, R2) {
|
|
11658
|
+
if (n2.ignoreAttribute(a, R2, O2)) return;
|
|
11659
|
+
let K2 = n2.formState === "property" ? !!O2[R2] : O2.hasAttribute(R2);
|
|
11505
11660
|
if (n2.formState !== "property") {
|
|
11506
|
-
let Z3 = a.hasAttribute(
|
|
11661
|
+
let Z3 = a.hasAttribute(R2);
|
|
11507
11662
|
if (Z3 !== K2) {
|
|
11508
|
-
if (E2(
|
|
11509
|
-
K2 ? a.setAttribute(
|
|
11663
|
+
if (E2(R2, a, K2 ? "update" : "remove") === false) return;
|
|
11664
|
+
K2 ? a.setAttribute(R2, "") : a.removeAttribute(R2), i2.push({ kind: "attr", el: a, name: R2, before: Z3 ? "" : null, after: K2 ? "" : null });
|
|
11510
11665
|
}
|
|
11511
11666
|
}
|
|
11512
|
-
a[
|
|
11667
|
+
a[R2] !== K2 && (a[R2] = K2);
|
|
11513
11668
|
}
|
|
11514
|
-
function $3(a, O2,
|
|
11515
|
-
if (cn2(a,
|
|
11516
|
-
let K2 = rn(
|
|
11669
|
+
function $3(a, O2, R2) {
|
|
11670
|
+
if (cn2(a, R2) || E2("value", a, "update") === false) return;
|
|
11671
|
+
let K2 = rn(R2), Z3 = O2.textContent, U3 = K2 && K2.value !== K2.defaultValue ? K2.value : Z3, de3 = Nt3(a) ? Gt2(a) : null, we3 = a.value;
|
|
11517
11672
|
n2.formState !== "property" && a.textContent !== Z3 && (i2.push({ kind: "text", node: a, before: a.textContent, after: Z3 }), a.textContent = Z3), a.value !== U3 && (a.value = U3), de3 && a.value !== we3 && wn2(a, we3, a.value, de3);
|
|
11518
11673
|
}
|
|
11519
11674
|
}
|
|
@@ -11689,8 +11844,8 @@
|
|
|
11689
11844
|
let x2 = n2(fe3);
|
|
11690
11845
|
if (!x2 || x2.nodeType !== 1) return f2("ancestor-live");
|
|
11691
11846
|
}
|
|
11692
|
-
let N2 = h.base === kn && h.remote === kn && r === ss2, M2 = /* @__PURE__ */ new Set(),
|
|
11693
|
-
fe3 && (M2.has(fe3) ?
|
|
11847
|
+
let N2 = h.base === kn && h.remote === kn && r === ss2, M2 = /* @__PURE__ */ new Set(), P2 = /* @__PURE__ */ new Set(), V3 = [], D2 = null, j2 = (fe3) => {
|
|
11848
|
+
fe3 && (M2.has(fe3) ? P2.add(fe3) : M2.add(fe3));
|
|
11694
11849
|
}, y2 = (fe3, x2) => {
|
|
11695
11850
|
let Y2 = u2(fe3), ae3 = Y2 !== null ? Y2 : h.base(fe3) || null;
|
|
11696
11851
|
return ae3 !== (Y2 !== null ? Y2 : h.remote(x2) || null) ? false : (j2(ae3), true);
|
|
@@ -11726,7 +11881,7 @@
|
|
|
11726
11881
|
for (let fe3 of e.querySelectorAll(Co2)) fe3 === I3 || q3.has(fe3) || (I3.contains(fe3) ? Me3.push(fe3) : N2 && j2(w2(fe3)));
|
|
11727
11882
|
}
|
|
11728
11883
|
let Oe3 = /* @__PURE__ */ new Set(), Re3 = /* @__PURE__ */ new Set(), ie3 = /* @__PURE__ */ new Set(), xe3 = qr2(p2, I3, w2, r, M2, Oe3, Me3, Re3), qe3 = qr2(b, v2, c2, r, M2, Oe3, h.remote === kn && v2.querySelectorAll(Co2), ie3);
|
|
11729
|
-
return D2 && (
|
|
11884
|
+
return D2 && (P2.has(w2(D2[0])) || Oe3.has(w2(D2[0]))) && (D2 = null), { scope: { chain: p2, root: I3, onChain: q3, baseIndex: xe3, remoteIndex: qe3, baseDropped: Re3, remoteDropped: ie3, head: D2, same: S2, differ: C2, dropped: [...Kr(e, w2, r, P2, Re3, h.base), ...Kr(o2, c2, r, P2, ie3, h.remote)], held: (fe3) => {
|
|
11730
11885
|
for (let x2 = 1; x2 < p2.length; x2++) if (fe3.map.get(p2[x2]) !== b[x2]) return false;
|
|
11731
11886
|
for (let [x2, Y2] of V3) if (fe3.map.get(x2) !== Y2) return false;
|
|
11732
11887
|
return true;
|
|
@@ -11772,45 +11927,45 @@
|
|
|
11772
11927
|
function w2(M2) {
|
|
11773
11928
|
return !M2.parentElement || !M2.parentElement.parentElement;
|
|
11774
11929
|
}
|
|
11775
|
-
function c2(M2,
|
|
11776
|
-
return w2(M2) || bo2(M2, r(), h) ? (V3.push({ type: "subtree", el: M2, base:
|
|
11930
|
+
function c2(M2, P2, V3) {
|
|
11931
|
+
return w2(M2) || bo2(M2, r(), h) ? (V3.push({ type: "subtree", el: M2, base: P2 }), false) : true;
|
|
11777
11932
|
}
|
|
11778
|
-
function p2(M2,
|
|
11933
|
+
function p2(M2, P2) {
|
|
11779
11934
|
let V3 = [];
|
|
11780
|
-
for (let D2 of M2.attributes) s2(M2, D2.name) ||
|
|
11781
|
-
for (let D2 of
|
|
11935
|
+
for (let D2 of M2.attributes) s2(M2, D2.name) || P2.getAttribute(D2.name) !== D2.value && V3.push(D2.name);
|
|
11936
|
+
for (let D2 of P2.attributes) s2(M2, D2.name) || M2.hasAttribute(D2.name) || V3.push(D2.name);
|
|
11782
11937
|
return V3;
|
|
11783
11938
|
}
|
|
11784
11939
|
function b(M2) {
|
|
11785
|
-
let
|
|
11786
|
-
V3 !== null && (
|
|
11940
|
+
let P2 = [], V3 = null, D2 = () => {
|
|
11941
|
+
V3 !== null && (P2.push({ nodeType: 3, nodeValue: V3 }), V3 = null);
|
|
11787
11942
|
};
|
|
11788
11943
|
for (let j2 of M2.childNodes) {
|
|
11789
11944
|
if (j2.nodeType === 3) {
|
|
11790
11945
|
V3 = (V3 === null ? "" : V3) + j2.nodeValue;
|
|
11791
11946
|
continue;
|
|
11792
11947
|
}
|
|
11793
|
-
j2.nodeType === 1 && n2(j2) || (D2(), (j2.nodeType === 1 || j2.nodeType === 8) &&
|
|
11948
|
+
j2.nodeType === 1 && n2(j2) || (D2(), (j2.nodeType === 1 || j2.nodeType === 8) && P2.push(j2));
|
|
11794
11949
|
}
|
|
11795
|
-
return D2(),
|
|
11950
|
+
return D2(), P2;
|
|
11796
11951
|
}
|
|
11797
|
-
function S2(M2,
|
|
11798
|
-
if (M2.nodeType !==
|
|
11952
|
+
function S2(M2, P2) {
|
|
11953
|
+
if (M2.nodeType !== P2.nodeType) return false;
|
|
11799
11954
|
if (M2.nodeType !== 1) return true;
|
|
11800
|
-
if (M2.tagName !==
|
|
11955
|
+
if (M2.tagName !== P2.tagName) return false;
|
|
11801
11956
|
for (let V3 of h) {
|
|
11802
|
-
let D2 = V3(M2), j2 = V3(
|
|
11957
|
+
let D2 = V3(M2), j2 = V3(P2);
|
|
11803
11958
|
if (D2 != null && D2 !== "" && j2 != null && j2 !== "" && D2 !== j2) return false;
|
|
11804
11959
|
}
|
|
11805
11960
|
return true;
|
|
11806
11961
|
}
|
|
11807
11962
|
function C2(M2) {
|
|
11808
|
-
let
|
|
11809
|
-
for (let V3 of M2) V3.nodeType === 3 && V3.nodeValue.trim() !== "" ?
|
|
11810
|
-
return
|
|
11963
|
+
let P2 = "";
|
|
11964
|
+
for (let V3 of M2) V3.nodeType === 3 && V3.nodeValue.trim() !== "" ? P2 += "\0" + V3.nodeValue : V3.nodeType === 8 && (P2 += "" + V3.nodeValue);
|
|
11965
|
+
return P2;
|
|
11811
11966
|
}
|
|
11812
|
-
function m2(M2,
|
|
11813
|
-
let D2 = b(M2), j2 = b(
|
|
11967
|
+
function m2(M2, P2, V3) {
|
|
11968
|
+
let D2 = b(M2), j2 = b(P2);
|
|
11814
11969
|
if (D2.length === j2.length) {
|
|
11815
11970
|
let fe3 = true;
|
|
11816
11971
|
for (let x2 = 0; x2 < D2.length; x2++) if (!S2(D2[x2], j2[x2])) {
|
|
@@ -11854,19 +12009,19 @@
|
|
|
11854
12009
|
for (let [fe3, x2] of q3) if (f2(fe3, x2, V3)) return true;
|
|
11855
12010
|
return false;
|
|
11856
12011
|
}
|
|
11857
|
-
function f2(M2,
|
|
11858
|
-
if (M2.tagName !==
|
|
11859
|
-
let D2 = p2(M2,
|
|
11860
|
-
if (m2(M2,
|
|
12012
|
+
function f2(M2, P2, V3) {
|
|
12013
|
+
if (M2.tagName !== P2.tagName) return c2(M2, P2, V3);
|
|
12014
|
+
let D2 = p2(M2, P2), j2 = [];
|
|
12015
|
+
if (m2(M2, P2, j2)) return c2(M2, P2, V3);
|
|
11861
12016
|
if (D2.length) {
|
|
11862
|
-
if (!w2(M2) && !bo2(
|
|
11863
|
-
V3.push({ type: "attrs", el: M2, names: D2, base:
|
|
12017
|
+
if (!w2(M2) && !bo2(P2, u2(), h)) return true;
|
|
12018
|
+
V3.push({ type: "attrs", el: M2, names: D2, base: P2 });
|
|
11864
12019
|
}
|
|
11865
12020
|
return V3.push(...j2), false;
|
|
11866
12021
|
}
|
|
11867
12022
|
let g = [], I3 = p2(e, o2);
|
|
11868
12023
|
I3.length && g.push({ type: "attrs", el: e, names: I3 });
|
|
11869
|
-
let v2 = (M2,
|
|
12024
|
+
let v2 = (M2, P2) => Array.from(M2.children).find((V3) => V3.tagName === P2) || null, T2 = v2(e, "HEAD"), A2 = v2(o2, "HEAD");
|
|
11870
12025
|
if (T2 && A2) {
|
|
11871
12026
|
let M2 = [];
|
|
11872
12027
|
f2(T2, A2, M2), M2.length && g.push({ type: "head", el: T2 });
|
|
@@ -12097,7 +12252,7 @@
|
|
|
12097
12252
|
let y2 = wr2(e, p2, { ignored: u2.ignored, skip: T2.mergedScriptsLive, baseURI: w2.baseURI, beforeNodeAdded: u2.hooks.beforeNodeAdded, afterNodeAdded: u2.hooks.afterNodeAdded, trackRecovery: !!f2.recoveryLinks });
|
|
12098
12253
|
A2.push(...y2.loads), E2 = y2.swapped, N2 = y2.vetoed;
|
|
12099
12254
|
}
|
|
12100
|
-
let M2 = (y2) => E2 && E2.get(y2) || y2,
|
|
12255
|
+
let M2 = (y2) => E2 && E2.get(y2) || y2, P2 = (y2) => {
|
|
12101
12256
|
if (T2.keptRuns.has(y2)) return T2.runOf.get(y2);
|
|
12102
12257
|
let k2 = T2.liveOf.get(y2) || T2.heldBy.get(y2) || T2.insertedLive.get(y2);
|
|
12103
12258
|
return k2 ? M2(k2) : null;
|
|
@@ -12105,15 +12260,15 @@
|
|
|
12105
12260
|
let k2 = y2 && T2.liveOf.get(y2);
|
|
12106
12261
|
return k2 ? M2(k2) : null;
|
|
12107
12262
|
}, D2 = (y2) => {
|
|
12108
|
-
let k2 = y2 &&
|
|
12263
|
+
let k2 = y2 && P2(y2);
|
|
12109
12264
|
return Array.isArray(k2) ? k2[0] : k2;
|
|
12110
12265
|
};
|
|
12111
12266
|
if (f2.recoveryLinks) {
|
|
12112
12267
|
let y2 = (k2, J3, H2) => (J3.namespaceURI ? k2.getAttributeNS(J3.namespaceURI, J3.localName) : k2.getAttribute(J3.qualifiedName)) === H2;
|
|
12113
|
-
Ir2(f2.conflicts, f2.recoveryLinks, { lookup:
|
|
12268
|
+
Ir2(f2.conflicts, f2.recoveryLinks, { lookup: P2, vetoed: T2.vetoed, vetoedAttrs: T2.vetoedAttrs, removedVetoes: T2.removedVetoes, vetoedLive: N2, liveAttr: y2, ignored: u2.ignored, liveRoot: e });
|
|
12114
12269
|
}
|
|
12115
12270
|
let j2 = { applied: T2.applied, decisions: f2.decisions.map((y2) => Object.assign({}, y2, { node: y2.node ? V3(y2.node) : null, el: y2.el ? V3(y2.el) : null, applied: !!(y2.node ? V3(y2.node) : y2.el && V3(y2.el)) })), conflicts: f2.conflicts.map((y2) => Object.assign({}, y2, { node: y2.node ? y2.kind === "text" && y2.recovery.subject.nodeType === 8 ? D2(y2.node) : V3(y2.node) : y2.node, el: y2.el ? y2.kind === "structure" ? D2(y2.el) : V3(y2.el) : y2.el })), localDiverged: f2.localDiverged, identities: T2.identities, moved: T2.moved, replaced: T2.replaced, stats: b };
|
|
12116
|
-
return c2 && (j2.lineage = c2.finish(f2.lineage,
|
|
12271
|
+
return c2 && (j2.lineage = c2.finish(f2.lineage, P2)), { report: j2, loads: A2, lineage: c2 };
|
|
12117
12272
|
}
|
|
12118
12273
|
var Qr = /* @__PURE__ */ new WeakMap();
|
|
12119
12274
|
function Ds2() {
|
|
@@ -13778,7 +13933,7 @@
|
|
|
13778
13933
|
"[no-watch]",
|
|
13779
13934
|
"[mutations-ignore]"
|
|
13780
13935
|
].join(",");
|
|
13781
|
-
isRootLocalAttr = (el5, name) =>
|
|
13936
|
+
isRootLocalAttr = (el5, name, merged) => mergeIgnoresAttr(el5, name, merged) || EXTENSION_ATTR_PATTERN.test(name.toLowerCase());
|
|
13782
13937
|
authoredAttr = (el5) => el5.getAttribute("data-id") || el5.getAttribute("id") || null;
|
|
13783
13938
|
uniqueAuthoredIdentity = (memo) => (el5) => {
|
|
13784
13939
|
const id = authoredAttr(el5);
|
|
@@ -14774,7 +14929,7 @@
|
|
|
14774
14929
|
}
|
|
14775
14930
|
};
|
|
14776
14931
|
const store = this.identity;
|
|
14777
|
-
const beforeAttributeUpdated =
|
|
14932
|
+
const beforeAttributeUpdated = mergeVetoesAttr;
|
|
14778
14933
|
const authored3 = uniqueAuthoredIdentity(/* @__PURE__ */ new WeakMap());
|
|
14779
14934
|
const sideIdentity = (map) => isIdMap(map) ? { first: authored3, map, then: authored3 } : authored3;
|
|
14780
14935
|
const localIdentity = synthetic ? (el5) => authored3(el5) || store.idOf(originalSnapshotNode(el5) || el5) || null : authored3;
|
|
@@ -16789,7 +16944,14 @@
|
|
|
16789
16944
|
};
|
|
16790
16945
|
finalize(inputSelector);
|
|
16791
16946
|
finalize(textareaSelector);
|
|
16792
|
-
|
|
16947
|
+
for (const control of doc.querySelectorAll(selectSelector)) {
|
|
16948
|
+
if (!provenance.original(control)) continue;
|
|
16949
|
+
for (const option of control.options) {
|
|
16950
|
+
const live2 = provenance.original(option);
|
|
16951
|
+
if (!(live2 && live2.selected)) option.removeAttribute("selected");
|
|
16952
|
+
else if (!option.hasAttribute("selected")) option.setAttribute("selected", "");
|
|
16953
|
+
}
|
|
16954
|
+
}
|
|
16793
16955
|
});
|
|
16794
16956
|
}
|
|
16795
16957
|
function init9() {
|
|
@@ -16890,9 +17052,11 @@
|
|
|
16890
17052
|
if (saveFreeze.debug) console.log("[save-freeze]", ...args);
|
|
16891
17053
|
}
|
|
16892
17054
|
function authoredInnerHTML(el5) {
|
|
16893
|
-
|
|
17055
|
+
const html = el5.innerHTML;
|
|
17056
|
+
if (!el5.querySelector(`[${ROUTE_ACTIVE_ATTR}]`) && !html.includes("ephemeral") && !html.includes("<dialog")) return html;
|
|
16894
17057
|
const copy2 = el5.cloneNode(true);
|
|
16895
17058
|
for (const s2 of copy2.querySelectorAll(`[${ROUTE_ACTIVE_ATTR}]`)) s2.removeAttribute(ROUTE_ACTIVE_ATTR);
|
|
17059
|
+
for (const child of copy2.children) stripEphemeral(child);
|
|
16896
17060
|
return copy2.innerHTML;
|
|
16897
17061
|
}
|
|
16898
17062
|
function capture(el5) {
|
|
@@ -16954,6 +17118,7 @@
|
|
|
16954
17118
|
init_is_edit_mode();
|
|
16955
17119
|
init_region_policy();
|
|
16956
17120
|
init_root_attrs();
|
|
17121
|
+
init_ephemeral();
|
|
16957
17122
|
init_mutation();
|
|
16958
17123
|
originals = /* @__PURE__ */ new WeakMap();
|
|
16959
17124
|
saveFreeze = { debug: false };
|
|
@@ -21646,7 +21811,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
21646
21811
|
}
|
|
21647
21812
|
applyOp(root3, op);
|
|
21648
21813
|
}
|
|
21649
|
-
function createStore({ name, value, ephemeral = false }) {
|
|
21814
|
+
function createStore({ name, value, ephemeral: ephemeral2 = false }) {
|
|
21650
21815
|
if (!isContainer2(value)) throw new TypeError(`clay.live("${name}"): the tag must hold a JSON object or list`);
|
|
21651
21816
|
let authoritative = cloneJson(value);
|
|
21652
21817
|
const state2 = cloneJson(value);
|
|
@@ -21771,7 +21936,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
21771
21936
|
});
|
|
21772
21937
|
const handle = Object.freeze({
|
|
21773
21938
|
name,
|
|
21774
|
-
ephemeral,
|
|
21939
|
+
ephemeral: ephemeral2,
|
|
21775
21940
|
ready: ready4,
|
|
21776
21941
|
get data() {
|
|
21777
21942
|
return data;
|
|
@@ -21832,7 +21997,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
21832
21997
|
return {
|
|
21833
21998
|
handle,
|
|
21834
21999
|
name,
|
|
21835
|
-
ephemeral,
|
|
22000
|
+
ephemeral: ephemeral2,
|
|
21836
22001
|
// The live value itself, for serializing into a save. Never mutate it.
|
|
21837
22002
|
get value() {
|
|
21838
22003
|
return state2;
|
|
@@ -24850,16 +25015,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24850
25015
|
if (!isEditMode) return;
|
|
24851
25016
|
if (typeof document === "undefined") return;
|
|
24852
25017
|
if (document.readyState === "loading") {
|
|
24853
|
-
document.addEventListener("DOMContentLoaded", () => undo.start({ bindKeys: true }));
|
|
25018
|
+
document.addEventListener("DOMContentLoaded", () => undo.start(withTabLocal({ bindKeys: true })));
|
|
24854
25019
|
} else {
|
|
24855
|
-
undo.start({ bindKeys: true });
|
|
25020
|
+
undo.start(withTabLocal({ bindKeys: true }));
|
|
24856
25021
|
}
|
|
24857
25022
|
}
|
|
24858
|
-
var undo_default;
|
|
25023
|
+
var withTabLocal, createScope, undo_default;
|
|
24859
25024
|
var init_undo = __esm({
|
|
24860
25025
|
"src/plugins/undo.js"() {
|
|
24861
25026
|
init_hyper_undo_vendor();
|
|
24862
25027
|
init_is_edit_mode();
|
|
25028
|
+
init_root_attrs();
|
|
25029
|
+
withTabLocal = (opts = {}) => {
|
|
25030
|
+
const own = opts.ignoreAttribute;
|
|
25031
|
+
return {
|
|
25032
|
+
...opts,
|
|
25033
|
+
ignoreAttribute: (name, target) => isTabLocalAttr(name, target) || (own ? own(name, target) : false)
|
|
25034
|
+
};
|
|
25035
|
+
};
|
|
25036
|
+
createScope = undo.create.bind(undo);
|
|
25037
|
+
undo.create = (opts) => createScope(withTabLocal(opts));
|
|
24863
25038
|
init18();
|
|
24864
25039
|
undo_default = undo;
|
|
24865
25040
|
}
|
|
@@ -38836,8 +39011,12 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
38836
39011
|
const t0 = now3();
|
|
38837
39012
|
const src = m2.src;
|
|
38838
39013
|
const pieces = [];
|
|
39014
|
+
let sealedAt = 0;
|
|
38839
39015
|
const keep = (from, to2) => {
|
|
38840
|
-
if (from >= 0 && to2 > from)
|
|
39016
|
+
if (!(from >= 0 && to2 > from)) return;
|
|
39017
|
+
const last = pieces.length > sealedAt ? pieces[pieces.length - 1] : null;
|
|
39018
|
+
if (last && last.text === void 0 && last.to === from) last.to = to2;
|
|
39019
|
+
else pieces.push({ from, to: to2 });
|
|
38841
39020
|
};
|
|
38842
39021
|
const text = (t) => {
|
|
38843
39022
|
if (t) pieces.push({ text: t });
|
|
@@ -38870,6 +39049,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
38870
39049
|
}
|
|
38871
39050
|
function endOfBody() {
|
|
38872
39051
|
afterBody = pieces.length;
|
|
39052
|
+
sealedAt = pieces.length;
|
|
38873
39053
|
tailClean = !!tailMark && tailMark.whole && /^(?:<\/[^>]*>)*$/.test(pieces.slice(tailMark.at).map(piece).join(""));
|
|
38874
39054
|
}
|
|
38875
39055
|
function emitNode(n2, parentTag) {
|
|
@@ -38905,7 +39085,10 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
38905
39085
|
if (loc && loc.kind === "text" && loc.value === data && loc.from >= 0 && !opts.breakText && sameContext) {
|
|
38906
39086
|
keep(loc.from, loc.to);
|
|
38907
39087
|
if (opts.doubleCopied !== void 0 && data === opts.doubleCopied) keep(loc.from, loc.to);
|
|
38908
|
-
if (loc.outsideTail)
|
|
39088
|
+
if (loc.outsideTail) {
|
|
39089
|
+
tailMark = { at: pieces.length, tail: loc.outsideTail, whole: true };
|
|
39090
|
+
sealedAt = pieces.length;
|
|
39091
|
+
}
|
|
38909
39092
|
return;
|
|
38910
39093
|
}
|
|
38911
39094
|
let owner = null;
|
|
@@ -38915,7 +39098,10 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
38915
39098
|
owner = { tail: whole ? loc.outsideTail : "", whole };
|
|
38916
39099
|
}
|
|
38917
39100
|
text(RAW_TEXT.has(parentTag) ? data : escText(data));
|
|
38918
|
-
if (owner)
|
|
39101
|
+
if (owner) {
|
|
39102
|
+
tailMark = { at: pieces.length, ...owner };
|
|
39103
|
+
sealedAt = pieces.length;
|
|
39104
|
+
}
|
|
38919
39105
|
}
|
|
38920
39106
|
function emitElement(n2, loc) {
|
|
38921
39107
|
const tag = n2.localName;
|
|
@@ -38953,7 +39139,20 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
38953
39139
|
for (const a of n2.attributes) s2 += " " + a.name + (a.value === "" ? "" : '="' + escAttr(a.value) + '"');
|
|
38954
39140
|
return s2 + ">";
|
|
38955
39141
|
}
|
|
39142
|
+
function sameAttrs2(n2, loc) {
|
|
39143
|
+
const attrs = n2.attributes;
|
|
39144
|
+
if (attrs.length !== loc.attrs.length) return false;
|
|
39145
|
+
for (let i2 = 0; i2 < attrs.length; i2++) {
|
|
39146
|
+
const a = loc.attrs[i2];
|
|
39147
|
+
if (a.from < 0 || attrs[i2].value !== a.value || attrs[i2].name.toLowerCase() !== a.key) return false;
|
|
39148
|
+
}
|
|
39149
|
+
return true;
|
|
39150
|
+
}
|
|
38956
39151
|
function emitOpenTag(n2, loc) {
|
|
39152
|
+
if (sameAttrs2(n2, loc)) {
|
|
39153
|
+
keep(loc.openFrom, loc.openTo);
|
|
39154
|
+
return;
|
|
39155
|
+
}
|
|
38957
39156
|
const live2 = /* @__PURE__ */ new Map();
|
|
38958
39157
|
for (const a of n2.attributes) live2.set(a.name.toLowerCase(), a);
|
|
38959
39158
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -39061,7 +39260,10 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
39061
39260
|
if (!whole.has(i2)) return emitNode(c2, parentTag);
|
|
39062
39261
|
const s2 = S2[owned2[i2]];
|
|
39063
39262
|
keep(s2.from, s2.to);
|
|
39064
|
-
if (s2.outsideTail)
|
|
39263
|
+
if (s2.outsideTail) {
|
|
39264
|
+
tailMark = { at: pieces.length, tail: s2.outsideTail, whole: true };
|
|
39265
|
+
sealedAt = pieces.length;
|
|
39266
|
+
}
|
|
39065
39267
|
};
|
|
39066
39268
|
const openOf = (c2, i2) => {
|
|
39067
39269
|
if (!whole.has(i2)) return openChain(c2);
|
|
@@ -39128,20 +39330,23 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
39128
39330
|
function verify(rendered, today, liveDocument, clone = null, sourceErrors = null) {
|
|
39129
39331
|
const P2 = new DOMParser();
|
|
39130
39332
|
const A2 = P2.parseFromString(rendered, "text/html");
|
|
39131
|
-
const B2 = P2.parseFromString(today, "text/html");
|
|
39132
39333
|
const outsideA = vOutside(A2), outsideLive = vOutside(liveDocument);
|
|
39133
39334
|
if (outsideA.join("\n") !== outsideLive.join("\n")) return { ok: false, diff: "document: outside <html> " + JSON.stringify(outsideA) + " vs live " + JSON.stringify(outsideLive) };
|
|
39134
|
-
|
|
39135
|
-
|
|
39136
|
-
if (!diff) return worse ? { ok: false, diff: worse } : { ok: true, diff: null, oracle: "today" };
|
|
39335
|
+
let at3 = null;
|
|
39336
|
+
let cloneDiff = null;
|
|
39137
39337
|
if (clone) {
|
|
39138
|
-
|
|
39139
|
-
|
|
39338
|
+
at3 = [];
|
|
39339
|
+
cloneDiff = vDiff(A2.documentElement, clone, "html", at3);
|
|
39340
|
+
if (!cloneDiff) {
|
|
39140
39341
|
const w2 = vParseErrors(rendered, sourceErrors);
|
|
39141
|
-
return w2 ? { ok: false, diff: w2 } : { ok: true, diff: null, oracle: "clone"
|
|
39342
|
+
return w2 ? { ok: false, diff: w2 } : { ok: true, diff: null, oracle: "clone" };
|
|
39142
39343
|
}
|
|
39143
|
-
return { ok: false, diff, at: at3 };
|
|
39144
39344
|
}
|
|
39345
|
+
const B2 = P2.parseFromString(today, "text/html");
|
|
39346
|
+
const diff = vDiff(A2.documentElement, B2.documentElement, "html");
|
|
39347
|
+
const worse = diff ? null : vParseErrors(rendered, sourceErrors);
|
|
39348
|
+
if (!diff) return worse ? { ok: false, diff: worse } : { ok: true, diff: null, oracle: "today" };
|
|
39349
|
+
if (clone) return { ok: false, diff, at: at3 };
|
|
39145
39350
|
return { ok: false, diff };
|
|
39146
39351
|
}
|
|
39147
39352
|
function nodeAt2(root3, at3) {
|
|
@@ -39182,13 +39387,27 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
|
39182
39387
|
}
|
|
39183
39388
|
function vKids(el5) {
|
|
39184
39389
|
const list3 = el5.localName === "template" && el5.content ? el5.content.childNodes : el5.childNodes;
|
|
39185
|
-
|
|
39390
|
+
const out = [];
|
|
39391
|
+
for (let i2 = 0; i2 < list3.length; i2++) {
|
|
39392
|
+
const n2 = list3[i2];
|
|
39393
|
+
if (n2.nodeType === 1 || n2.nodeType === 3 || n2.nodeType === 8) out.push(n2);
|
|
39394
|
+
}
|
|
39395
|
+
return out;
|
|
39396
|
+
}
|
|
39397
|
+
function sameAttrsInOrder(a, b) {
|
|
39398
|
+
const A2 = a.attributes, B2 = b.attributes;
|
|
39399
|
+
if (A2.length !== B2.length) return false;
|
|
39400
|
+
for (let i2 = 0; i2 < A2.length; i2++) {
|
|
39401
|
+
const x2 = A2[i2], y2 = B2[i2];
|
|
39402
|
+
if (x2.name !== y2.name || x2.value !== y2.value || x2.namespaceURI !== y2.namespaceURI) return false;
|
|
39403
|
+
}
|
|
39404
|
+
return true;
|
|
39186
39405
|
}
|
|
39187
39406
|
function vDiff(a, b, path, at3 = []) {
|
|
39188
39407
|
if (a.nodeType !== b.nodeType) return path + ": node type " + a.nodeType + " vs " + b.nodeType;
|
|
39189
39408
|
if (a.nodeType === 3 || a.nodeType === 8) return a.data === b.data ? null : path + ": text " + JSON.stringify(a.data.slice(0, 60)) + " vs " + JSON.stringify(b.data.slice(0, 60));
|
|
39190
39409
|
if (a.localName !== b.localName || a.namespaceURI !== b.namespaceURI) return path + ": tag " + a.localName + " vs " + b.localName;
|
|
39191
|
-
if (vAttrs(a) !== vAttrs(b)) return path + ": attrs " + vAttrs(a) + " vs " + vAttrs(b);
|
|
39410
|
+
if (!sameAttrsInOrder(a, b) && vAttrs(a) !== vAttrs(b)) return path + ": attrs " + vAttrs(a) + " vs " + vAttrs(b);
|
|
39192
39411
|
if (a.localName === "noscript" && a.namespaceURI === XHTML) return vNoscript(a, b, path);
|
|
39193
39412
|
const ka2 = vKids(a), kb = vKids(b);
|
|
39194
39413
|
if (ka2.length !== kb.length) return path + ": " + ka2.length + " vs " + kb.length + " children";
|
|
@@ -44482,19 +44701,19 @@ ${t}` : `"use strict"; return (${t});`;
|
|
|
44482
44701
|
if (isEditMode2) core.push(...CORE_WAVES.editOnly);
|
|
44483
44702
|
const explicit = /* @__PURE__ */ new Set();
|
|
44484
44703
|
parseCsv(params, "plugins", explicit, (set3, name) => set3.add(name));
|
|
44485
|
-
const
|
|
44486
|
-
parseCsv(params, "exclude",
|
|
44704
|
+
const excluded2 = /* @__PURE__ */ new Set();
|
|
44705
|
+
parseCsv(params, "exclude", excluded2, (set3, name) => set3.add(name));
|
|
44487
44706
|
const enabled = new Set(explicit);
|
|
44488
44707
|
for (const [name, spec] of Object.entries(PLUGIN_PATHS)) {
|
|
44489
44708
|
if (spec.default) enabled.add(name);
|
|
44490
44709
|
}
|
|
44491
|
-
if (
|
|
44710
|
+
if (excluded2.has("wire")) enabled.delete("ai-edit");
|
|
44492
44711
|
for (const name of [...enabled]) {
|
|
44493
|
-
if (
|
|
44712
|
+
if (excluded2.has(name)) continue;
|
|
44494
44713
|
if (!explicit.has(name) && PLUGIN_PATHS[name].editOnly && !isEditMode2) continue;
|
|
44495
44714
|
for (const implied of IMPLIES[name] || []) enabled.add(implied);
|
|
44496
44715
|
}
|
|
44497
|
-
for (const name of
|
|
44716
|
+
for (const name of excluded2) enabled.delete(name);
|
|
44498
44717
|
const plugins = [];
|
|
44499
44718
|
for (const name of PLUGIN_ORDER) {
|
|
44500
44719
|
if (!enabled.has(name)) continue;
|
|
@@ -44508,6 +44727,7 @@ ${t}` : `"use strict"; return (${t});`;
|
|
|
44508
44727
|
// src/loader.js
|
|
44509
44728
|
init_dom_ready();
|
|
44510
44729
|
init_theme();
|
|
44730
|
+
init_ephemeral();
|
|
44511
44731
|
function domReady() {
|
|
44512
44732
|
return new Promise((resolve) => dom_ready_default(resolve));
|
|
44513
44733
|
}
|
|
@@ -44559,6 +44779,7 @@ ${t}` : `"use strict"; return (${t});`;
|
|
|
44559
44779
|
const pageData2 = loaded["core/page-data.js"];
|
|
44560
44780
|
clay5.readData = pageData2.readData;
|
|
44561
44781
|
clay5.writeData = pageData2.writeData;
|
|
44782
|
+
clay5.ephemeral = ephemeral;
|
|
44562
44783
|
if (save) {
|
|
44563
44784
|
const saveFn = save.savePage || save.default;
|
|
44564
44785
|
saveFn.force = save.savePageForce;
|