@mlightcad/cad-diff-viewer 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +203 -0
  3. package/dist/cad-diff-viewer.js +3543 -0
  4. package/dist/cad-diff-viewer.umd.cjs +969 -0
  5. package/lib/AcApDiffSettingsDialog.d.ts +99 -0
  6. package/lib/AcApDiffSettingsDialog.d.ts.map +1 -0
  7. package/lib/AcApDiffSettingsDialog.js +534 -0
  8. package/lib/AcApDiffSettingsDialog.js.map +1 -0
  9. package/lib/AcApDiffViewer.d.ts +532 -0
  10. package/lib/AcApDiffViewer.d.ts.map +1 -0
  11. package/lib/AcApDiffViewer.js +2757 -0
  12. package/lib/AcApDiffViewer.js.map +1 -0
  13. package/lib/compare/acapCompareChangeSets.d.ts +54 -0
  14. package/lib/compare/acapCompareChangeSets.d.ts.map +1 -0
  15. package/lib/compare/acapCompareChangeSets.js +191 -0
  16. package/lib/compare/acapCompareChangeSets.js.map +1 -0
  17. package/lib/compare/acapCompareDrawings.d.ts +116 -0
  18. package/lib/compare/acapCompareDrawings.d.ts.map +1 -0
  19. package/lib/compare/acapCompareDrawings.js +645 -0
  20. package/lib/compare/acapCompareDrawings.js.map +1 -0
  21. package/lib/compare/acapCompareSysVars.d.ts +97 -0
  22. package/lib/compare/acapCompareSysVars.d.ts.map +1 -0
  23. package/lib/compare/acapCompareSysVars.js +156 -0
  24. package/lib/compare/acapCompareSysVars.js.map +1 -0
  25. package/lib/compare/index.d.ts +4 -0
  26. package/lib/compare/index.d.ts.map +1 -0
  27. package/lib/compare/index.js +4 -0
  28. package/lib/compare/index.js.map +1 -0
  29. package/lib/i18n/index.d.ts +15 -0
  30. package/lib/i18n/index.d.ts.map +1 -0
  31. package/lib/i18n/index.js +30 -0
  32. package/lib/i18n/index.js.map +1 -0
  33. package/lib/i18n/messages.d.ts +527 -0
  34. package/lib/i18n/messages.d.ts.map +1 -0
  35. package/lib/i18n/messages.js +527 -0
  36. package/lib/i18n/messages.js.map +1 -0
  37. package/lib/icons.d.ts +29 -0
  38. package/lib/icons.d.ts.map +1 -0
  39. package/lib/icons.js +43 -0
  40. package/lib/icons.js.map +1 -0
  41. package/lib/index.d.ts +5 -0
  42. package/lib/index.d.ts.map +1 -0
  43. package/lib/index.js +5 -0
  44. package/lib/index.js.map +1 -0
  45. package/lib/injectDiffViewerStyles.d.ts +3 -0
  46. package/lib/injectDiffViewerStyles.d.ts.map +1 -0
  47. package/lib/injectDiffViewerStyles.js +15 -0
  48. package/lib/injectDiffViewerStyles.js.map +1 -0
  49. package/package.json +49 -0
@@ -0,0 +1,3543 @@
1
+ import { AcApI18n as L, AcUiDialog as Te, ACAP_DEFAULT_COMPARE_COLORS as we, AcEdOpenMode as Me, AcApDocManager as K, acedApplyUiTheme as ce, isMarkupVisible as Y, setMarkupVisible as fe, getMarkupPresenter as me, runMarkupEdit as Le, getMarkupStore as Ae, createMarkupMeta as Re, listMarkupsForSession as pe } from "@mlightcad/cad-simple-viewer";
2
+ import { ICON_MARKUP_CLOUD as De, ICON_MARKUP_RECT as Oe, ICON_MARKUP_CIRCLE as Ve, ICON_MARKUP_CALLOUT as Ne, ICON_MARKUP_ARROW as Ie, ICON_MARKUP_LINE as Be, ICON_MARKUP_TEXT as Fe, ICON_MARKUP_STAMP as _e, ICON_CLEAR_MARKUPS as He, ICON_ANNOTATION_HIDE as je, ICON_ANNOTATION_SHOW as ze } from "@mlightcad/cad-simple-viewer/icons";
3
+ import { AcDbSysVarManager as Z, AcDbSystemVariables as P, ACDB_COMPAREPROPS_COLOR as Ue, ACDB_COMPAREPROPS_LAYER as Ke, ACDB_COMPAREPROPS_LINETYPE as Ge, ACDB_COMPAREPROPS_LINETYPESCALE as $e, ACDB_COMPAREPROPS_LINEWEIGHT as Xe, ACDB_COMPAREPROPS_TRANSPARENCY as Ye, ACDB_COMPAREPROPS_THICKNESS as We, ACDB_COMPAREPROPS_DEFAULT as qe, ACDB_COMPAREHATCH_DEFAULT as Ze, ACDB_COMPARERCMARGIN_DEFAULT as Je, ACDB_COMPARERCMARGIN_MIN as Qe, ACDB_COMPARERCMARGIN_MAX as et, ACDB_COMPARETEXT_DEFAULT as tt, ACDB_COMPARETOLERANCE_DEFAULT as it, ACDB_COMPARETOLERANCE_MIN as nt, ACDB_COMPARETOLERANCE_MAX as st, AcGeBox2d as he } from "@mlightcad/data-model";
4
+ function ot(a) {
5
+ const e = [];
6
+ for (const t of a.kinds)
7
+ t !== "added" && t !== "deleted" && t !== "modified" || e.includes(t) || e.push(t);
8
+ return e.length === 1 ? e[0] : "modified";
9
+ }
10
+ function rt(a, e) {
11
+ e !== "unchanged" && (a.includes(e) || a.push(e));
12
+ }
13
+ function at(a, e) {
14
+ const t = Math.max(1, Math.min(25, Math.trunc(e)));
15
+ return Math.max(a, 1) * (t / 250);
16
+ }
17
+ function W(a, e) {
18
+ return {
19
+ minX: a.minX - e,
20
+ minY: a.minY - e,
21
+ maxX: a.maxX + e,
22
+ maxY: a.maxY + e
23
+ };
24
+ }
25
+ function lt(a, e) {
26
+ return a.minX <= e.maxX && a.maxX >= e.minX && a.minY <= e.maxY && a.maxY >= e.minY;
27
+ }
28
+ function dt(a, e) {
29
+ return {
30
+ minX: Math.min(a.minX, e.minX),
31
+ minY: Math.min(a.minY, e.minY),
32
+ maxX: Math.max(a.maxX, e.maxX),
33
+ maxY: Math.max(a.maxY, e.maxY)
34
+ };
35
+ }
36
+ function ct(a, e, t) {
37
+ const i = [];
38
+ for (const c of a) {
39
+ if (c.kind === "unchanged") continue;
40
+ const l = c.extents;
41
+ l && i.push({
42
+ box: { minX: l.minX, minY: l.minY, maxX: l.maxX, maxY: l.maxY },
43
+ objectId: c.objectId,
44
+ side: c.side,
45
+ kind: c.kind
46
+ });
47
+ }
48
+ if (i.length === 0) return [];
49
+ const n = at(e, t), o = i.map((c) => W(c.box, n)), s = i.map((c, l) => l), r = (c) => {
50
+ let l = c;
51
+ for (; s[l] !== l; ) l = s[l];
52
+ let f = c;
53
+ for (; s[f] !== l; ) {
54
+ const p = s[f];
55
+ s[f] = l, f = p;
56
+ }
57
+ return l;
58
+ };
59
+ for (let c = 0; c < i.length; c++)
60
+ for (let l = c + 1; l < i.length; l++)
61
+ if (lt(o[c], o[l])) {
62
+ const f = r(c), p = r(l);
63
+ f !== p && (s[p] = f);
64
+ }
65
+ const d = /* @__PURE__ */ new Map();
66
+ for (let c = 0; c < i.length; c++) {
67
+ const l = r(c), f = i[c], p = d.get(l);
68
+ if (!p) {
69
+ d.set(l, {
70
+ extents: W(f.box, n),
71
+ objectIds: [f.objectId],
72
+ hasLeft: f.side === "left",
73
+ hasRight: f.side === "right",
74
+ kinds: [f.kind]
75
+ });
76
+ continue;
77
+ }
78
+ p.extents = dt(p.extents, W(f.box, n)), p.objectIds.push(f.objectId), f.side === "left" ? p.hasLeft = !0 : p.hasRight = !0, rt(p.kinds, f.kind);
79
+ }
80
+ return [...d.values()];
81
+ }
82
+ function S(a, e) {
83
+ const t = typeof a == "number" ? a : Number(a);
84
+ return Number.isFinite(t) ? Math.trunc(t) : e;
85
+ }
86
+ const J = S(Ue, 1), $ = S(Ke, 2), Q = S(
87
+ Ge,
88
+ 4
89
+ ), ee = S(
90
+ $e,
91
+ 8
92
+ ), te = S(
93
+ Xe,
94
+ 16
95
+ ), ie = S(
96
+ Ye,
97
+ 32
98
+ ), ne = S(
99
+ We,
100
+ 64
101
+ ), se = S(
102
+ qe,
103
+ 0
104
+ ), oe = S(
105
+ Ze,
106
+ 0
107
+ ), re = S(
108
+ Je,
109
+ 5
110
+ ), ft = S(Qe, 1), mt = S(
111
+ et,
112
+ 25
113
+ ), ae = S(tt, 1), X = S(
114
+ it,
115
+ 6
116
+ ), Ce = S(
117
+ nt,
118
+ 0
119
+ ), Se = S(
120
+ st,
121
+ 14
122
+ );
123
+ function D(a, e) {
124
+ const t = typeof a == "number" ? a : Number(a);
125
+ return Number.isFinite(t) ? Math.trunc(t) : e;
126
+ }
127
+ function le() {
128
+ const a = Z.instance();
129
+ return {
130
+ compareprops: D(
131
+ a.getDefaultValue(P.COMPAREPROPS),
132
+ se
133
+ ),
134
+ comparehatch: D(
135
+ a.getDefaultValue(P.COMPAREHATCH),
136
+ oe
137
+ ),
138
+ comparercmargin: D(
139
+ a.getDefaultValue(P.COMPARERCMARGIN),
140
+ re
141
+ ),
142
+ comparetext: D(
143
+ a.getDefaultValue(P.COMPARETEXT),
144
+ ae
145
+ ),
146
+ comparetolerance: D(
147
+ a.getDefaultValue(P.COMPARETOLERANCE),
148
+ X
149
+ )
150
+ };
151
+ }
152
+ function pt(a, e) {
153
+ const t = Z.instance(), i = le(), n = a ?? e, o = a ?? e;
154
+ return {
155
+ compareprops: n ? D(
156
+ t.getVar(P.COMPAREPROPS, n),
157
+ i.compareprops
158
+ ) : i.compareprops,
159
+ comparehatch: o ? D(
160
+ t.getVar(P.COMPAREHATCH, o),
161
+ i.comparehatch
162
+ ) : i.comparehatch,
163
+ comparercmargin: o ? D(
164
+ t.getVar(P.COMPARERCMARGIN, o),
165
+ i.comparercmargin
166
+ ) : i.comparercmargin,
167
+ comparetext: o ? D(
168
+ t.getVar(P.COMPARETEXT, o),
169
+ i.comparetext
170
+ ) : i.comparetext,
171
+ comparetolerance: o ? D(
172
+ t.getVar(P.COMPARETOLERANCE, o),
173
+ i.comparetolerance
174
+ ) : i.comparetolerance
175
+ };
176
+ }
177
+ function ue(a, e) {
178
+ if (e.length === 0) return;
179
+ const t = Z.instance(), i = e[0];
180
+ t.setVar(P.COMPAREPROPS, a.compareprops, i);
181
+ for (const n of e)
182
+ t.setVar(P.COMPAREHATCH, a.comparehatch, n), t.setVar(P.COMPARERCMARGIN, a.comparercmargin, n), t.setVar(P.COMPARETEXT, a.comparetext, n), t.setVar(P.COMPARETOLERANCE, a.comparetolerance, n);
183
+ }
184
+ function ht(a) {
185
+ const e = S(a, X);
186
+ return 10 ** -Math.max(
187
+ Ce,
188
+ Math.min(Se, e)
189
+ );
190
+ }
191
+ const ut = {
192
+ color: J,
193
+ layer: $,
194
+ lineType: Q,
195
+ lineTypeScale: ee,
196
+ lineWeight: te,
197
+ transparency: ie,
198
+ thickness: ne
199
+ }, gt = /* @__PURE__ */ new Set(["HATCH"]), yt = /* @__PURE__ */ new Set(["TEXT", "MTEXT", "ATTRIB", "ATTDEF"]);
200
+ function v(a, e) {
201
+ return Number.isFinite(a) ? Math.round(a / e) * e : 0;
202
+ }
203
+ function de(a) {
204
+ try {
205
+ const e = a.geometricExtents;
206
+ return !(e != null && e.min) || !(e != null && e.max) ? void 0 : {
207
+ minX: e.min.x,
208
+ minY: e.min.y,
209
+ maxX: e.max.x,
210
+ maxY: e.max.y
211
+ };
212
+ } catch {
213
+ return;
214
+ }
215
+ }
216
+ function O(a, e) {
217
+ return a ? `${v(a.x ?? 0, e)},${v(a.y ?? 0, e)},${v(a.z ?? 0, e)}` : "";
218
+ }
219
+ function R(a) {
220
+ return Number.isFinite(a) ? String(Number(a.toFixed(6))) : String(a);
221
+ }
222
+ function H(a) {
223
+ const e = R(a.x ?? 0), t = R(a.y ?? 0), i = a.z ?? 0;
224
+ return Math.abs(i) < 1e-9 ? `(${e}, ${t})` : `(${e}, ${t}, ${R(i)})`;
225
+ }
226
+ function q(a) {
227
+ return `${R(a * 180 / Math.PI)}°`;
228
+ }
229
+ function bt(a, e) {
230
+ var l, f, p, u;
231
+ const t = a, i = [], n = (h, g, b) => {
232
+ i.push({ id: h, display: g, key: b });
233
+ };
234
+ n("layer", String(t.layer ?? ""), String(t.layer ?? ""));
235
+ const o = ((f = (l = t.color) == null ? void 0 : l.toString) == null ? void 0 : f.call(l)) ?? "";
236
+ n("color", o, o);
237
+ const s = t.lineType ?? "";
238
+ n("lineType", s, s), n(
239
+ "lineWeight",
240
+ t.lineWeight != null ? String(t.lineWeight) : "",
241
+ String(t.lineWeight ?? "")
242
+ ), typeof t.linetypeScale == "number" && n(
243
+ "lineTypeScale",
244
+ R(t.linetypeScale),
245
+ String(v(t.linetypeScale, e))
246
+ );
247
+ const r = (u = (p = t.transparency) == null ? void 0 : p.toString) == null ? void 0 : u.call(p);
248
+ r != null && r !== "" && n("transparency", r, r), typeof t.thickness == "number" && n(
249
+ "thickness",
250
+ R(t.thickness),
251
+ String(v(t.thickness, e))
252
+ );
253
+ const d = i.length;
254
+ if (t.startPoint && t.endPoint) {
255
+ const h = t.startPoint, g = t.endPoint;
256
+ n("startPoint", H(h), O(h, e)), n("endPoint", H(g), O(g, e));
257
+ }
258
+ if (t.center) {
259
+ const h = t.center;
260
+ n("center", H(h), O(h, e));
261
+ }
262
+ if (typeof t.radius == "number" && n("radius", R(t.radius), String(v(t.radius, e))), typeof t.startAngle == "number" && typeof t.endAngle == "number" && (n(
263
+ "startAngle",
264
+ q(t.startAngle),
265
+ String(v(t.startAngle, e))
266
+ ), n("endAngle", q(t.endAngle), String(v(t.endAngle, e)))), t.position) {
267
+ const h = t.position;
268
+ n("position", H(h), O(h, e));
269
+ }
270
+ if (t.location) {
271
+ const h = t.location;
272
+ n("location", H(h), O(h, e));
273
+ }
274
+ if (typeof t.rotation == "number" && n("rotation", q(t.rotation), String(v(t.rotation, e))), typeof t.height == "number" && n("height", R(t.height), String(v(t.height, e))), typeof t.blockName == "string" && n("blockName", t.blockName, t.blockName), t.scaleFactors) {
275
+ const h = t.scaleFactors;
276
+ n(
277
+ "scale",
278
+ `${R(h.x ?? 1)}, ${R(h.y ?? 1)}, ${R(h.z ?? 1)}`,
279
+ `${v(h.x ?? 1, e)},${v(h.y ?? 1, e)},${v(h.z ?? 1, e)}`
280
+ );
281
+ }
282
+ typeof t.textString == "string" && n("text", t.textString, t.textString), typeof t.contents == "string" && n("mtext", t.contents, t.contents);
283
+ const c = de(a);
284
+ return c && i.length === d && n(
285
+ "extents",
286
+ `${H({ x: c.minX, y: c.minY })} – ${H({ x: c.maxX, y: c.maxY })}`,
287
+ `${v(c.minX, e)},${v(c.minY, e)},${v(c.maxX, e)},${v(c.maxY, e)}`
288
+ ), n("objectId", String(a.objectId ?? ""), String(a.objectId ?? "")), i;
289
+ }
290
+ function vt(a, e, t) {
291
+ const i = new Map(a.fields.map((u) => [u.id, u])), n = new Map(e.fields.map((u) => [u.id, u])), o = [], s = /* @__PURE__ */ new Set();
292
+ for (const u of [...a.fields, ...e.fields])
293
+ s.has(u.id) || (s.add(u.id), o.push(u.id));
294
+ const r = i.get("startPoint"), d = i.get("endPoint"), c = n.get("startPoint"), l = n.get("endPoint"), f = r != null && d != null && c != null && l != null && [r.key, d.key].sort().join("|") === [c.key, l.key].sort().join("|"), p = [];
295
+ for (const u of o) {
296
+ if (f && (u === "startPoint" || u === "endPoint")) continue;
297
+ const h = ut[u];
298
+ if (h != null && (t & h) === 0) continue;
299
+ const g = i.get(u), b = n.get(u);
300
+ ((g == null ? void 0 : g.key) ?? "") !== ((b == null ? void 0 : b.key) ?? "") && p.push({
301
+ field: u,
302
+ oldValue: (g == null ? void 0 : g.display) ?? "",
303
+ newValue: (b == null ? void 0 : b.display) ?? ""
304
+ });
305
+ }
306
+ return p.length === 0 && a.fingerprint !== e.fingerprint && p.push({ field: "geometry", oldValue: "", newValue: "" }), p;
307
+ }
308
+ function kt(a, e) {
309
+ const t = a, i = [String(t.dxfTypeName ?? t.type ?? "")];
310
+ if (t.startPoint && t.endPoint) {
311
+ const o = O(t.startPoint, e), s = O(t.endPoint, e);
312
+ i.push(o < s ? `${o}|${s}` : `${s}|${o}`);
313
+ }
314
+ if (t.center && i.push(`c:${O(t.center, e)}`), typeof t.radius == "number" && i.push(`r:${v(t.radius, e)}`), typeof t.startAngle == "number" && typeof t.endAngle == "number" && i.push(`a:${v(t.startAngle, e)}:${v(t.endAngle, e)}`), t.position && i.push(`p:${O(t.position, e)}`), t.location && i.push(`l:${O(t.location, e)}`), typeof t.rotation == "number" && i.push(`rot:${v(t.rotation, e)}`), typeof t.height == "number" && i.push(`h:${v(t.height, e)}`), typeof t.blockName == "string" && i.push(`blk:${t.blockName}`), t.scaleFactors) {
315
+ const o = t.scaleFactors;
316
+ i.push(
317
+ `s:${v(o.x ?? 1, e)},${v(o.y ?? 1, e)},${v(o.z ?? 1, e)}`
318
+ );
319
+ }
320
+ typeof t.textString == "string" && i.push(`t:${t.textString}`), typeof t.contents == "string" && i.push(`m:${t.contents}`);
321
+ const n = de(a);
322
+ return n && i.length <= 1 && i.push(
323
+ `ext:${v(n.minX, e)},${v(n.minY, e)},${v(n.maxX, e)},${v(n.maxY, e)}`
324
+ ), i.join(";");
325
+ }
326
+ function xt(a, e) {
327
+ var n, o, s, r;
328
+ if (e === 0) return "";
329
+ const t = a, i = [];
330
+ return e & J && i.push(((o = (n = t.color) == null ? void 0 : n.toString) == null ? void 0 : o.call(n)) ?? ""), e & $ && i.push(String(t.layer ?? "")), e & Q && i.push(t.lineType ?? ""), e & ee && i.push(String(t.linetypeScale ?? "")), e & te && i.push(String(t.lineWeight ?? "")), e & ie && i.push(((r = (s = t.transparency) == null ? void 0 : s.toString) == null ? void 0 : r.call(s)) ?? ""), e & ne && i.push(String(t.thickness ?? "")), i.join("|");
331
+ }
332
+ function wt(a) {
333
+ return gt.has(a.toUpperCase());
334
+ }
335
+ function Ct(a) {
336
+ return yt.has(a.toUpperCase());
337
+ }
338
+ function St(a, e, t, i, n) {
339
+ const o = [], s = a.tables.blockTable.modelSpace;
340
+ for (const r of s.newIterator()) {
341
+ const d = String(r.objectId ?? "");
342
+ if (!d) continue;
343
+ const c = String(r.dxfTypeName ?? r.type ?? "UNKNOWN");
344
+ !i && wt(c) || !n && Ct(c) || o.push({
345
+ entity: r,
346
+ objectId: d,
347
+ dxfType: c,
348
+ layer: String(r.layer ?? "0"),
349
+ fingerprint: kt(r, e),
350
+ propKey: xt(r, t),
351
+ extents: de(r),
352
+ fields: bt(r, e)
353
+ });
354
+ }
355
+ return o;
356
+ }
357
+ function Pt(a, e) {
358
+ let t = 1 / 0, i = 1 / 0, n = -1 / 0, o = -1 / 0;
359
+ for (const s of [...a, ...e]) {
360
+ const r = s.extents;
361
+ r && (t = Math.min(t, r.minX), i = Math.min(i, r.minY), n = Math.max(n, r.maxX), o = Math.max(o, r.maxY));
362
+ }
363
+ return Number.isFinite(t) ? Math.max(n - t, o - i, 1) : 1;
364
+ }
365
+ function B(a, e, t, i, n) {
366
+ return {
367
+ side: e,
368
+ objectId: a.objectId,
369
+ dxfType: a.dxfType,
370
+ layer: a.layer,
371
+ kind: t,
372
+ pairedId: i,
373
+ extents: a.extents,
374
+ changes: n
375
+ };
376
+ }
377
+ function ge(a, e, t, i) {
378
+ const n = vt(e, t, i);
379
+ a.push(B(e, "left", "modified", t.objectId, n)), a.push(B(t, "right", "modified", e.objectId, n));
380
+ }
381
+ function Et(a, e, t = {}) {
382
+ const i = t.compareProps ?? se, n = (t.compareHatch ?? oe) !== 0, o = (t.compareText ?? ae) !== 0, s = t.compareTolerance ?? X, r = t.compareRcMargin ?? re, d = t.tolerance != null && t.tolerance > 0 ? t.tolerance : ht(s), c = (y) => St(y, d, i, n, o), l = c(a), f = c(e), p = new Map(f.map((y) => [y.objectId, y])), u = /* @__PURE__ */ new Set(), h = [], g = [], b = [], k = [], A = [];
383
+ for (const y of l) {
384
+ const x = p.get(y.objectId);
385
+ if (x && y.dxfType === x.dxfType) {
386
+ u.add(x.objectId);
387
+ const T = y.fingerprint === x.fingerprint, E = y.propKey === x.propKey;
388
+ T && E ? t.includeUnchanged && (k.push(B(y, "left", "unchanged", x.objectId)), k.push(B(x, "right", "unchanged", y.objectId))) : ge(b, y, x, i);
389
+ } else
390
+ A.push(y);
391
+ }
392
+ const M = f.filter((y) => !u.has(y.objectId)), z = (i & $) !== 0, I = (y) => z ? `${y.dxfType}\0${y.layer}` : y.dxfType, V = /* @__PURE__ */ new Map();
393
+ for (const y of M) {
394
+ const x = I(y), T = V.get(x);
395
+ T ? T.push(y) : V.set(x, [y]);
396
+ }
397
+ for (const y of A) {
398
+ const x = V.get(I(y));
399
+ let T = -1;
400
+ if (x && (T = x.findIndex((E) => E.fingerprint === y.fingerprint)), T >= 0 && x) {
401
+ const E = x.splice(T, 1)[0];
402
+ u.add(E.objectId), y.propKey === E.propKey ? t.includeUnchanged && (k.push(B(y, "left", "unchanged", E.objectId)), k.push(B(E, "right", "unchanged", y.objectId))) : ge(b, y, E, i);
403
+ } else
404
+ g.push(B(y, "left", "deleted"));
405
+ }
406
+ for (const y of M)
407
+ u.has(y.objectId) || h.push(B(y, "right", "added"));
408
+ const U = [
409
+ ...g,
410
+ ...b.filter((y) => y.side === "left"),
411
+ ...h
412
+ ], _ = ct(
413
+ [...g, ...b, ...h],
414
+ Pt(l, f),
415
+ r
416
+ );
417
+ return { added: h, deleted: g, modified: b, unchanged: k, navigation: U, changeSets: _ };
418
+ }
419
+ const Pe = {
420
+ openFile: "Open file",
421
+ noDrawing: "No drawing",
422
+ emptyTitle: "Drop a drawing here",
423
+ emptyHint: "or click to open a DWG / DXF",
424
+ invalidFile: "Please choose a .dwg or .dxf file",
425
+ toolbarSideBySide: "Side by side",
426
+ toolbarOverlay: "Overlay",
427
+ toolbarSyncViews: "Sync views",
428
+ toolbarTogglePanel: "Results panel",
429
+ toolbarPrev: "Previous difference",
430
+ toolbarNext: "Next difference",
431
+ toolbarSettings: "Settings",
432
+ toolbarLanguage: "Language",
433
+ toolbarThemeLight: "Switch to dark theme",
434
+ toolbarThemeDark: "Switch to light theme",
435
+ toolbarMarkup: "Markup",
436
+ markupGenerateClouds: "Generate cloud markups",
437
+ markupCloud: "Cloud",
438
+ markupCallout: "Callout",
439
+ markupText: "Text",
440
+ markupRect: "Rectangle",
441
+ markupCircle: "Circle",
442
+ markupArrow: "Arrow",
443
+ markupStamp: "Stamp",
444
+ markupLine: "Line",
445
+ markupHighlight: "Highlight",
446
+ markupShow: "Show markups",
447
+ markupHide: "Hide markups",
448
+ markupClear: "Clear markups",
449
+ panelTitle: "Compare",
450
+ panelClose: "Close panel",
451
+ tabResults: "Results",
452
+ tabMarkups: "Markups",
453
+ groupByType: "By entity type",
454
+ groupByKind: "By change",
455
+ kindAdded: "Added",
456
+ kindDeleted: "Deleted",
457
+ kindModified: "Modified",
458
+ diffDetails: "Show differences",
459
+ diffColProperty: "Property",
460
+ diffColOld: "Old",
461
+ diffColNew: "New",
462
+ diffGeometryChanged: "Geometry changed",
463
+ diffVisible: "Visible",
464
+ diffHidden: "Hidden",
465
+ fieldObjectId: "Handle",
466
+ fieldLayer: "Layer",
467
+ fieldColor: "Color",
468
+ fieldLineType: "Linetype",
469
+ fieldLineWeight: "Lineweight",
470
+ fieldLineTypeScale: "Linetype scale",
471
+ fieldTransparency: "Transparency",
472
+ fieldThickness: "Thickness",
473
+ fieldVisibility: "Visibility",
474
+ fieldStartPoint: "Start point",
475
+ fieldEndPoint: "End point",
476
+ fieldCenter: "Center",
477
+ fieldRadius: "Radius",
478
+ fieldStartAngle: "Start angle",
479
+ fieldEndAngle: "End angle",
480
+ fieldPosition: "Position",
481
+ fieldLocation: "Location",
482
+ fieldRotation: "Rotation",
483
+ fieldHeight: "Height",
484
+ fieldBlockName: "Block",
485
+ fieldScale: "Scale",
486
+ fieldText: "Text",
487
+ fieldMtext: "MText",
488
+ fieldExtents: "Extents",
489
+ fieldGeometry: "Geometry",
490
+ noResults: "Open two drawings to compare",
491
+ noMarkups: "No markups yet",
492
+ markupFromLeft: "Left",
493
+ markupFromRight: "Right",
494
+ comparing: "Comparing…",
495
+ settingsTitle: "Settings",
496
+ settingsTabColors: "Colors",
497
+ settingsTabObjects: "Objects",
498
+ settingsTabGeometry: "Geometry",
499
+ settingsUnchanged: "Unchanged objects",
500
+ settingsDeleted: "Deleted objects",
501
+ settingsAdded: "Added objects",
502
+ settingsModified: "Modified objects",
503
+ settingsSectionColors: "Colors",
504
+ settingsSectionObjects: "Objects",
505
+ settingsIncludeHatch: "Include hatch objects",
506
+ settingsIncludeText: "Include text objects",
507
+ settingsSectionProps: "Object properties",
508
+ settingsPropsHint: "Property changes are ignored unless selected (COMPAREPROPS). Layer-table color or linetype changes are never compared.",
509
+ settingsPropColor: "Color",
510
+ settingsPropLayer: "Layer",
511
+ settingsPropLinetype: "Linetype",
512
+ settingsPropLinetypeScale: "Linetype scale",
513
+ settingsPropLineweight: "Lineweight",
514
+ settingsPropTransparency: "Transparency",
515
+ settingsPropThickness: "Thickness",
516
+ settingsSectionClouds: "Revision clouds",
517
+ settingsRcMargin: "Margin",
518
+ settingsSectionTolerance: "Tolerance",
519
+ settingsTolerance: "Decimal places",
520
+ settingsOk: "OK",
521
+ settingsCancel: "Cancel",
522
+ settingsReset: "Reset",
523
+ settingsClose: "Close"
524
+ }, Tt = {
525
+ openFile: "打开文件",
526
+ noDrawing: "未打开图纸",
527
+ emptyTitle: "拖拽图纸到此处",
528
+ emptyHint: "或点击打开 DWG / DXF",
529
+ invalidFile: "请选择 .dwg 或 .dxf 文件",
530
+ toolbarSideBySide: "左右分屏",
531
+ toolbarOverlay: "叠图",
532
+ toolbarSyncViews: "同步左右视图",
533
+ toolbarTogglePanel: "结果面板",
534
+ toolbarPrev: "上一个差异",
535
+ toolbarNext: "下一个差异",
536
+ toolbarSettings: "设置",
537
+ toolbarLanguage: "语言",
538
+ toolbarThemeLight: "切换为深色主题",
539
+ toolbarThemeDark: "切换为浅色主题",
540
+ toolbarMarkup: "批注",
541
+ markupGenerateClouds: "生成云线批注",
542
+ markupCloud: "云线",
543
+ markupCallout: "引出标注",
544
+ markupText: "文字",
545
+ markupRect: "矩形",
546
+ markupCircle: "圆",
547
+ markupArrow: "箭头",
548
+ markupStamp: "图章",
549
+ markupLine: "直线",
550
+ markupHighlight: "高亮",
551
+ markupShow: "显示批注",
552
+ markupHide: "隐藏批注",
553
+ markupClear: "清除批注",
554
+ panelTitle: "比对",
555
+ panelClose: "关闭面板",
556
+ tabResults: "比对结果",
557
+ tabMarkups: "批注",
558
+ groupByType: "按图元类型",
559
+ groupByKind: "按增删改",
560
+ kindAdded: "新增",
561
+ kindDeleted: "删除",
562
+ kindModified: "修改",
563
+ diffDetails: "查看差异",
564
+ diffColProperty: "属性",
565
+ diffColOld: "旧版",
566
+ diffColNew: "新版",
567
+ diffGeometryChanged: "几何已变化",
568
+ diffVisible: "可见",
569
+ diffHidden: "隐藏",
570
+ fieldObjectId: "句柄",
571
+ fieldLayer: "图层",
572
+ fieldColor: "颜色",
573
+ fieldLineType: "线型",
574
+ fieldLineWeight: "线宽",
575
+ fieldLineTypeScale: "线型比例",
576
+ fieldTransparency: "透明度",
577
+ fieldThickness: "厚度",
578
+ fieldVisibility: "可见性",
579
+ fieldStartPoint: "起点",
580
+ fieldEndPoint: "终点",
581
+ fieldCenter: "圆心",
582
+ fieldRadius: "半径",
583
+ fieldStartAngle: "起始角度",
584
+ fieldEndAngle: "终止角度",
585
+ fieldPosition: "位置",
586
+ fieldLocation: "插入点",
587
+ fieldRotation: "旋转",
588
+ fieldHeight: "高度",
589
+ fieldBlockName: "块名",
590
+ fieldScale: "缩放",
591
+ fieldText: "文字",
592
+ fieldMtext: "多行文字",
593
+ fieldExtents: "范围",
594
+ fieldGeometry: "几何",
595
+ noResults: "请打开两张图纸进行比对",
596
+ noMarkups: "暂无批注",
597
+ markupFromLeft: "左侧",
598
+ markupFromRight: "右侧",
599
+ comparing: "正在比对…",
600
+ settingsTitle: "设置",
601
+ settingsTabColors: "颜色",
602
+ settingsTabObjects: "对象",
603
+ settingsTabGeometry: "几何",
604
+ settingsUnchanged: "相同对象",
605
+ settingsDeleted: "删除的对象",
606
+ settingsAdded: "新增的对象",
607
+ settingsModified: "修改的对象",
608
+ settingsSectionColors: "颜色",
609
+ settingsSectionObjects: "对象",
610
+ settingsIncludeHatch: "包含填充对象",
611
+ settingsIncludeText: "包含文字对象",
612
+ settingsSectionProps: "对象属性",
613
+ settingsPropsHint: "未勾选的属性变化不会计入差异(COMPAREPROPS)。图层表中的颜色或线型变化不会比较。",
614
+ settingsPropColor: "颜色",
615
+ settingsPropLayer: "图层",
616
+ settingsPropLinetype: "线型",
617
+ settingsPropLinetypeScale: "线型比例",
618
+ settingsPropLineweight: "线宽",
619
+ settingsPropTransparency: "透明度",
620
+ settingsPropThickness: "厚度",
621
+ settingsSectionClouds: "修订云线",
622
+ settingsRcMargin: "边距",
623
+ settingsSectionTolerance: "公差",
624
+ settingsTolerance: "小数位数",
625
+ settingsOk: "确定",
626
+ settingsCancel: "取消",
627
+ settingsReset: "恢复默认",
628
+ settingsClose: "关闭"
629
+ }, Mt = {
630
+ openFile: "Dosya aç",
631
+ noDrawing: "Çizim yok",
632
+ emptyTitle: "Bir çizimi buraya bırakın",
633
+ emptyHint: "veya DWG / DXF açmak için tıklayın",
634
+ invalidFile: "Lütfen bir .dwg veya .dxf dosyası seçin",
635
+ toolbarSideBySide: "Yan yana",
636
+ toolbarOverlay: "Üst üste",
637
+ toolbarSyncViews: "Görünümleri eşitle",
638
+ toolbarTogglePanel: "Sonuç paneli",
639
+ toolbarPrev: "Önceki fark",
640
+ toolbarNext: "Sonraki fark",
641
+ toolbarSettings: "Ayarlar",
642
+ toolbarLanguage: "Dil",
643
+ toolbarThemeLight: "Koyu temaya geç",
644
+ toolbarThemeDark: "Açık temaya geç",
645
+ toolbarMarkup: "İşaretleme",
646
+ markupGenerateClouds: "Bulut işaretlemeleri oluştur",
647
+ markupCloud: "Bulut",
648
+ markupCallout: "Çağrı",
649
+ markupText: "Metin",
650
+ markupRect: "Dikdörtgen",
651
+ markupCircle: "Daire",
652
+ markupArrow: "Ok",
653
+ markupStamp: "Damga",
654
+ markupLine: "Çizgi",
655
+ markupHighlight: "Vurgu",
656
+ markupShow: "İşaretleri Göster",
657
+ markupHide: "İşaretleri Gizle",
658
+ markupClear: "İşaretleri Temizle",
659
+ panelTitle: "Karşılaştır",
660
+ panelClose: "Paneli kapat",
661
+ tabResults: "Sonuçlar",
662
+ tabMarkups: "İşaretlemeler",
663
+ groupByType: "Varlık türüne göre",
664
+ groupByKind: "Değişime göre",
665
+ kindAdded: "Eklenen",
666
+ kindDeleted: "Silinen",
667
+ kindModified: "Değiştirilen",
668
+ diffDetails: "Farkları göster",
669
+ diffColProperty: "Özellik",
670
+ diffColOld: "Eski",
671
+ diffColNew: "Yeni",
672
+ diffGeometryChanged: "Geometri değişti",
673
+ diffVisible: "Görünür",
674
+ diffHidden: "Gizli",
675
+ fieldObjectId: "Tutamak",
676
+ fieldLayer: "Katman",
677
+ fieldColor: "Renk",
678
+ fieldLineType: "Çizgi tipi",
679
+ fieldLineWeight: "Çizgi kalınlığı",
680
+ fieldLineTypeScale: "Çizgi tipi ölçeği",
681
+ fieldTransparency: "Saydamlık",
682
+ fieldThickness: "Kalınlık",
683
+ fieldVisibility: "Görünürlük",
684
+ fieldStartPoint: "Başlangıç noktası",
685
+ fieldEndPoint: "Bitiş noktası",
686
+ fieldCenter: "Merkez",
687
+ fieldRadius: "Yarıçap",
688
+ fieldStartAngle: "Başlangıç açısı",
689
+ fieldEndAngle: "Bitiş açısı",
690
+ fieldPosition: "Konum",
691
+ fieldLocation: "Konum",
692
+ fieldRotation: "Döndürme",
693
+ fieldHeight: "Yükseklik",
694
+ fieldBlockName: "Blok",
695
+ fieldScale: "Ölçek",
696
+ fieldText: "Metin",
697
+ fieldMtext: "Çok satırlı metin",
698
+ fieldExtents: "Sınırlar",
699
+ fieldGeometry: "Geometri",
700
+ noResults: "Karşılaştırmak için iki çizim açın",
701
+ noMarkups: "Henüz işaretleme yok",
702
+ markupFromLeft: "Sol",
703
+ markupFromRight: "Sağ",
704
+ comparing: "Karşılaştırılıyor…",
705
+ settingsTitle: "Ayarlar",
706
+ settingsTabColors: "Renkler",
707
+ settingsTabObjects: "Nesneler",
708
+ settingsTabGeometry: "Geometri",
709
+ settingsUnchanged: "Aynı nesneler",
710
+ settingsDeleted: "Silinen nesneler",
711
+ settingsAdded: "Eklenen nesneler",
712
+ settingsModified: "Değiştirilen nesneler",
713
+ settingsSectionColors: "Renkler",
714
+ settingsSectionObjects: "Nesneler",
715
+ settingsIncludeHatch: "Tarama nesnelerini dahil et",
716
+ settingsIncludeText: "Metin nesnelerini dahil et",
717
+ settingsSectionProps: "Nesne özellikleri",
718
+ settingsPropsHint: "Seçilmeyen özellik değişiklikleri karşılaştırılmaz (COMPAREPROPS). Katman tablosundaki renk veya çizgi tipi değişiklikleri karşılaştırılmaz.",
719
+ settingsPropColor: "Renk",
720
+ settingsPropLayer: "Katman",
721
+ settingsPropLinetype: "Çizgi tipi",
722
+ settingsPropLinetypeScale: "Çizgi tipi ölçeği",
723
+ settingsPropLineweight: "Çizgi kalınlığı",
724
+ settingsPropTransparency: "Saydamlık",
725
+ settingsPropThickness: "Kalınlık",
726
+ settingsSectionClouds: "Revizyon bulutları",
727
+ settingsRcMargin: "Kenar boşluğu",
728
+ settingsSectionTolerance: "Tolerans",
729
+ settingsTolerance: "Ondalık basamak",
730
+ settingsOk: "Tamam",
731
+ settingsCancel: "İptal",
732
+ settingsReset: "Sıfırla",
733
+ settingsClose: "Kapat"
734
+ }, Lt = {
735
+ openFile: "Otevřít soubor",
736
+ noDrawing: "Žádný výkres",
737
+ emptyTitle: "Přetáhněte výkres sem",
738
+ emptyHint: "nebo klikněte pro otevření DWG / DXF",
739
+ invalidFile: "Vyberte soubor .dwg nebo .dxf",
740
+ toolbarSideBySide: "Vedle sebe",
741
+ toolbarOverlay: "Překrytí",
742
+ toolbarSyncViews: "Synchronizovat pohledy",
743
+ toolbarTogglePanel: "Panel výsledků",
744
+ toolbarPrev: "Předchozí rozdíl",
745
+ toolbarNext: "Další rozdíl",
746
+ toolbarSettings: "Nastavení",
747
+ toolbarLanguage: "Jazyk",
748
+ toolbarThemeLight: "Přepnout na tmavý motiv",
749
+ toolbarThemeDark: "Přepnout na světlý motiv",
750
+ toolbarMarkup: "Poznámky",
751
+ markupGenerateClouds: "Vytvořit obláčky",
752
+ markupCloud: "Oblak",
753
+ markupCallout: "Popisek",
754
+ markupText: "Text",
755
+ markupRect: "Obdélník",
756
+ markupCircle: "Kružnice",
757
+ markupArrow: "Šipka",
758
+ markupStamp: "Razítko",
759
+ markupLine: "Úsečka",
760
+ markupHighlight: "Zvýraznění",
761
+ markupShow: "Zobrazit poznámky",
762
+ markupHide: "Skrýt poznámky",
763
+ markupClear: "Vymazat poznámky",
764
+ panelTitle: "Porovnání",
765
+ panelClose: "Zavřít panel",
766
+ tabResults: "Výsledky",
767
+ tabMarkups: "Poznámky",
768
+ groupByType: "Podle typu entity",
769
+ groupByKind: "Podle změny",
770
+ kindAdded: "Přidané",
771
+ kindDeleted: "Smazané",
772
+ kindModified: "Upravené",
773
+ diffDetails: "Zobrazit rozdíly",
774
+ diffColProperty: "Vlastnost",
775
+ diffColOld: "Staré",
776
+ diffColNew: "Nové",
777
+ diffGeometryChanged: "Geometrie se změnila",
778
+ diffVisible: "Viditelné",
779
+ diffHidden: "Skryté",
780
+ fieldObjectId: "Handle",
781
+ fieldLayer: "Hladina",
782
+ fieldColor: "Barva",
783
+ fieldLineType: "Typ čáry",
784
+ fieldLineWeight: "Tloušťka čáry",
785
+ fieldLineTypeScale: "Měřítko typu čáry",
786
+ fieldTransparency: "Průhlednost",
787
+ fieldThickness: "Tloušťka",
788
+ fieldVisibility: "Viditelnost",
789
+ fieldStartPoint: "Počáteční bod",
790
+ fieldEndPoint: "Koncový bod",
791
+ fieldCenter: "Střed",
792
+ fieldRadius: "Poloměr",
793
+ fieldStartAngle: "Počáteční úhel",
794
+ fieldEndAngle: "Koncový úhel",
795
+ fieldPosition: "Pozice",
796
+ fieldLocation: "Umístění",
797
+ fieldRotation: "Rotace",
798
+ fieldHeight: "Výška",
799
+ fieldBlockName: "Blok",
800
+ fieldScale: "Měřítko",
801
+ fieldText: "Text",
802
+ fieldMtext: "MText",
803
+ fieldExtents: "Rozsah",
804
+ fieldGeometry: "Geometrie",
805
+ noResults: "Otevřete dva výkresy pro porovnání",
806
+ noMarkups: "Zatím žádné poznámky",
807
+ markupFromLeft: "Levý",
808
+ markupFromRight: "Pravý",
809
+ comparing: "Porovnávání…",
810
+ settingsTitle: "Nastavení",
811
+ settingsTabColors: "Barvy",
812
+ settingsTabObjects: "Objekty",
813
+ settingsTabGeometry: "Geometrie",
814
+ settingsUnchanged: "Stejné objekty",
815
+ settingsDeleted: "Smazané objekty",
816
+ settingsAdded: "Přidané objekty",
817
+ settingsModified: "Upravené objekty",
818
+ settingsSectionColors: "Barvy",
819
+ settingsSectionObjects: "Objekty",
820
+ settingsIncludeHatch: "Zahrnout šrafy",
821
+ settingsIncludeText: "Zahrnout textové objekty",
822
+ settingsSectionProps: "Vlastnosti objektů",
823
+ settingsPropsHint: "Nezaškrtnuté změny vlastností se neporovnávají (COMPAREPROPS). Změny barvy nebo typu čáry v tabulce hladin se neporovnávají.",
824
+ settingsPropColor: "Barva",
825
+ settingsPropLayer: "Hladina",
826
+ settingsPropLinetype: "Typ čáry",
827
+ settingsPropLinetypeScale: "Měřítko typu čáry",
828
+ settingsPropLineweight: "Tloušťka čáry",
829
+ settingsPropTransparency: "Průhlednost",
830
+ settingsPropThickness: "Tloušťka",
831
+ settingsSectionClouds: "Revizní obláčky",
832
+ settingsRcMargin: "Okraj",
833
+ settingsSectionTolerance: "Tolerance",
834
+ settingsTolerance: "Desetinná místa",
835
+ settingsOk: "OK",
836
+ settingsCancel: "Zrušit",
837
+ settingsReset: "Obnovit výchozí",
838
+ settingsClose: "Zavřít"
839
+ }, At = {
840
+ openFile: "فتح ملف",
841
+ noDrawing: "لا يوجد رسم",
842
+ emptyTitle: "أسقط رسمًا هنا",
843
+ emptyHint: "أو انقر لفتح ملف DWG / DXF",
844
+ invalidFile: "يرجى اختيار ملف .dwg أو .dxf",
845
+ toolbarSideBySide: "جنبًا إلى جنب",
846
+ toolbarOverlay: "تراكب",
847
+ toolbarTogglePanel: "لوحة النتائج",
848
+ toolbarPrev: "الاختلاف السابق",
849
+ toolbarNext: "الاختلاف التالي",
850
+ toolbarLanguage: "اللغة",
851
+ toolbarMarkup: "علامات المراجعة",
852
+ markupGenerateClouds: "إنشاء سحب المراجعة",
853
+ markupCloud: "سحابة",
854
+ markupCallout: "تعليق توضيحي",
855
+ markupText: "نص",
856
+ markupRect: "مستطيل",
857
+ markupCircle: "دائرة",
858
+ markupArrow: "سهم",
859
+ markupStamp: "ختم",
860
+ markupLine: "خط",
861
+ markupHighlight: "تمييز",
862
+ markupShow: "إظهار علامات المراجعة",
863
+ markupHide: "إخفاء علامات المراجعة",
864
+ markupClear: "مسح علامات المراجعة",
865
+ panelTitle: "مقارنة",
866
+ panelClose: "إغلاق اللوحة",
867
+ tabResults: "النتائج",
868
+ tabMarkups: "علامات المراجعة",
869
+ groupByType: "حسب نوع العنصر",
870
+ groupByKind: "حسب التغيير",
871
+ kindAdded: "مضاف",
872
+ kindDeleted: "محذوف",
873
+ kindModified: "معدّل",
874
+ diffDetails: "إظهار الاختلافات",
875
+ diffColProperty: "الخاصية",
876
+ diffColOld: "القديم",
877
+ diffColNew: "الجديد",
878
+ diffGeometryChanged: "تغيرت الهندسة",
879
+ diffVisible: "مرئي",
880
+ diffHidden: "مخفي",
881
+ fieldObjectId: "المقبض",
882
+ fieldLayer: "الطبقة",
883
+ fieldColor: "اللون",
884
+ fieldLineType: "نوع الخط",
885
+ fieldLineWeight: "سُمك الخط",
886
+ fieldLineTypeScale: "مقياس نوع الخط",
887
+ fieldTransparency: "الشفافية",
888
+ fieldThickness: "السماكة",
889
+ fieldVisibility: "الرؤية",
890
+ fieldStartPoint: "نقطة البداية",
891
+ fieldEndPoint: "نقطة النهاية",
892
+ fieldCenter: "المركز",
893
+ fieldRadius: "نصف القطر",
894
+ fieldStartAngle: "زاوية البداية",
895
+ fieldEndAngle: "زاوية النهاية",
896
+ fieldPosition: "الموضع",
897
+ fieldLocation: "الموقع",
898
+ fieldRotation: "الدوران",
899
+ fieldHeight: "الارتفاع",
900
+ fieldBlockName: "الكتلة",
901
+ fieldScale: "المقياس",
902
+ fieldText: "نص",
903
+ fieldMtext: "نص متعدد الأسطر",
904
+ fieldExtents: "الحدود",
905
+ fieldGeometry: "الهندسة",
906
+ noResults: "افتح رسمين للمقارنة",
907
+ noMarkups: "لا توجد علامات مراجعة بعد",
908
+ markupFromLeft: "اليسار",
909
+ markupFromRight: "اليمين",
910
+ comparing: "جارٍ المقارنة…",
911
+ settingsTitle: "الإعدادات",
912
+ settingsTabColors: "الألوان",
913
+ settingsTabObjects: "الكائنات",
914
+ settingsTabGeometry: "الهندسة",
915
+ settingsUnchanged: "كائنات دون تغيير",
916
+ settingsDeleted: "كائنات محذوفة",
917
+ settingsAdded: "كائنات مضافة",
918
+ settingsModified: "كائنات معدّلة",
919
+ settingsSectionColors: "الألوان",
920
+ settingsSectionObjects: "الكائنات",
921
+ settingsIncludeHatch: "تضمين كائنات التظليل",
922
+ settingsIncludeText: "تضمين كائنات النص",
923
+ settingsSectionProps: "خصائص الكائن",
924
+ settingsPropsHint: "لا تُحتسب تغييرات الخصائص غير المحددة (COMPAREPROPS). لا تُقارن تغيرات لون أو نوع خط جدول الطبقات.",
925
+ settingsPropColor: "اللون",
926
+ settingsPropLayer: "الطبقة",
927
+ settingsPropLinetype: "نوع الخط",
928
+ settingsPropLinetypeScale: "مقياس نوع الخط",
929
+ settingsPropLineweight: "سُمك الخط",
930
+ settingsPropTransparency: "الشفافية",
931
+ settingsPropThickness: "السماكة",
932
+ settingsSectionClouds: "غيوم المراجعة",
933
+ settingsRcMargin: "الهامش",
934
+ settingsSectionTolerance: "التسامح",
935
+ settingsTolerance: "المنازل العشرية",
936
+ settingsOk: "موافق",
937
+ settingsCancel: "إلغاء",
938
+ settingsReset: "إعادة تعيين",
939
+ settingsClose: "إغلاق"
940
+ }, j = "diffViewer";
941
+ let ye = !1;
942
+ function Rt() {
943
+ ye || (L.mergeLocaleMessage("en", { [j]: Pe }), L.mergeLocaleMessage("zh", { [j]: Tt }), L.mergeLocaleMessage("tr", { [j]: Mt }), L.mergeLocaleMessage("cs", { [j]: Lt }), L.mergeLocaleMessage("ar", { [j]: At }), ye = !0);
944
+ }
945
+ function m(a) {
946
+ return L.t(`${j}.${a}`, { fallback: Pe[a] });
947
+ }
948
+ const Dt = [
949
+ { role: "unchanged", labelKey: "settingsUnchanged" },
950
+ { role: "deleted", labelKey: "settingsDeleted" },
951
+ { role: "added", labelKey: "settingsAdded" },
952
+ { role: "modified", labelKey: "settingsModified" }
953
+ ], Ot = [
954
+ { bit: J, labelKey: "settingsPropColor" },
955
+ { bit: $, labelKey: "settingsPropLayer" },
956
+ { bit: Q, labelKey: "settingsPropLinetype" },
957
+ {
958
+ bit: ee,
959
+ labelKey: "settingsPropLinetypeScale"
960
+ },
961
+ { bit: te, labelKey: "settingsPropLineweight" },
962
+ { bit: ie, labelKey: "settingsPropTransparency" },
963
+ { bit: ne, labelKey: "settingsPropThickness" }
964
+ ];
965
+ function F(a) {
966
+ return `#${(a & 16777215).toString(16).padStart(6, "0")}`;
967
+ }
968
+ function Vt(a) {
969
+ const e = /^#?([0-9a-f]{6})$/i.exec(a.trim());
970
+ if (e)
971
+ return parseInt(e[1], 16);
972
+ }
973
+ const C = class C extends Te {
974
+ constructor(e) {
975
+ super({
976
+ host: e.host ?? document.body,
977
+ title: m("settingsTitle"),
978
+ closeLabel: m("settingsClose"),
979
+ titleId: "ml-diff-settings-title",
980
+ dialogClassName: "ml-diff-settings-dialog",
981
+ theme: e.theme
982
+ }), this.pickers = /* @__PURE__ */ new Map(), this.hexLabels = /* @__PURE__ */ new Map(), this.propChecks = /* @__PURE__ */ new Map(), this.tabButtons = [], this.tabPanels = [], this._confirmed = !1, this.initial = {
983
+ colors: { ...e.colors },
984
+ sysVars: { ...e.sysVars }
985
+ }, this.draft = {
986
+ colors: { ...e.colors },
987
+ sysVars: { ...e.sysVars }
988
+ }, this.onChange = e.onChange, C.ensureSettingsStyles(), this.buildContent();
989
+ }
990
+ /**
991
+ * Opens the settings dialog (replaces any already-open instance).
992
+ *
993
+ * @param options - Starting colors/sysvars and optional live-preview callback
994
+ * @returns Promise that resolves when the dialog is closed
995
+ */
996
+ static open(e) {
997
+ var i;
998
+ (i = C.openInstance) == null || i.close();
999
+ const t = new C(e);
1000
+ return C.openInstance = t, t.show().then(() => ({
1001
+ confirmed: t._confirmed,
1002
+ colors: t._confirmed ? { ...t.draft.colors } : { ...t.initial.colors },
1003
+ sysVars: t._confirmed ? { ...t.draft.sysVars } : { ...t.initial.sysVars }
1004
+ }));
1005
+ }
1006
+ /** Closes the open instance, if any. Treated as cancel. */
1007
+ static dismiss() {
1008
+ var e;
1009
+ (e = C.openInstance) == null || e.close();
1010
+ }
1011
+ close() {
1012
+ C.openInstance === this && (C.openInstance = null), super.close();
1013
+ }
1014
+ buildContent() {
1015
+ const e = [
1016
+ {
1017
+ id: "colors",
1018
+ label: m("settingsTabColors"),
1019
+ panel: this.buildColorsPanel()
1020
+ },
1021
+ {
1022
+ id: "objects",
1023
+ label: m("settingsTabObjects"),
1024
+ panel: this.buildObjectsPanel()
1025
+ },
1026
+ {
1027
+ id: "geometry",
1028
+ label: m("settingsTabGeometry"),
1029
+ panel: this.buildGeometryPanel()
1030
+ }
1031
+ ], t = document.createElement("div");
1032
+ t.className = "ml-diff-settings-tabs", t.setAttribute("role", "tablist"), t.setAttribute("aria-label", m("settingsTitle"));
1033
+ const i = document.createElement("div");
1034
+ i.className = "ml-diff-settings-panels", e.forEach((r, d) => {
1035
+ const c = `ml-diff-settings-tab-${r.id}`, l = `ml-diff-settings-panel-${r.id}`, f = document.createElement("button");
1036
+ f.type = "button", f.id = c, f.className = "ml-diff-settings-tab", f.setAttribute("role", "tab"), f.setAttribute("aria-controls", l), f.textContent = r.label, f.addEventListener("click", () => this.selectTab(d)), f.addEventListener(
1037
+ "keydown",
1038
+ (p) => this.onTabKeyDown(p, d)
1039
+ ), this.tabButtons.push(f), t.appendChild(f), r.panel.id = l, r.panel.classList.add("ml-diff-settings-panel"), r.panel.setAttribute("role", "tabpanel"), r.panel.setAttribute("aria-labelledby", c), this.tabPanels.push(r.panel), i.appendChild(r.panel);
1040
+ }), this.bodyEl.append(t, i), this.selectTab(0);
1041
+ const n = document.createElement("button");
1042
+ n.type = "button", n.className = "ml-ui-dialog-btn ml-diff-settings-btn-secondary ml-diff-settings-reset", n.textContent = m("settingsReset"), n.addEventListener("click", () => this.resetToDefaults());
1043
+ const o = document.createElement("button");
1044
+ o.type = "button", o.className = "ml-ui-dialog-btn ml-diff-settings-btn-secondary", o.textContent = m("settingsCancel"), o.addEventListener("click", () => this.close());
1045
+ const s = document.createElement("button");
1046
+ s.type = "button", s.className = "ml-ui-dialog-btn", s.textContent = m("settingsOk"), s.addEventListener("click", () => {
1047
+ this._confirmed = !0, this.close();
1048
+ }), this.footerEl.classList.add("ml-diff-settings-footer"), this.footerEl.append(n, o, s), this.focusAfterOpen(s);
1049
+ }
1050
+ buildColorsPanel() {
1051
+ const e = document.createElement("div");
1052
+ e.className = "ml-diff-settings-list";
1053
+ for (const t of Dt)
1054
+ e.appendChild(
1055
+ this.createColorRow(t.role, m(t.labelKey))
1056
+ );
1057
+ return e;
1058
+ }
1059
+ buildObjectsPanel() {
1060
+ const e = document.createElement("div"), t = document.createElement("div");
1061
+ t.className = "ml-diff-settings-check-grid", this.hatchCheck = this.createCheckRow(
1062
+ t,
1063
+ m("settingsIncludeHatch"),
1064
+ this.draft.sysVars.comparehatch !== 0,
1065
+ (s) => {
1066
+ this.draft.sysVars.comparehatch = s ? 1 : 0, this.emitChange();
1067
+ }
1068
+ ), this.textCheck = this.createCheckRow(
1069
+ t,
1070
+ m("settingsIncludeText"),
1071
+ this.draft.sysVars.comparetext !== 0,
1072
+ (s) => {
1073
+ this.draft.sysVars.comparetext = s ? 1 : 0, this.emitChange();
1074
+ }
1075
+ );
1076
+ const i = document.createElement("div"), n = document.createElement("p");
1077
+ n.className = "ml-diff-settings-hint", n.textContent = m("settingsPropsHint");
1078
+ const o = document.createElement("div");
1079
+ o.className = "ml-diff-settings-check-grid";
1080
+ for (const s of Ot) {
1081
+ const r = this.createCheckRow(
1082
+ o,
1083
+ m(s.labelKey),
1084
+ (this.draft.sysVars.compareprops & s.bit) !== 0,
1085
+ (d) => {
1086
+ d ? this.draft.sysVars.compareprops |= s.bit : this.draft.sysVars.compareprops &= ~s.bit, this.emitChange();
1087
+ }
1088
+ );
1089
+ this.propChecks.set(s.bit, r);
1090
+ }
1091
+ return i.append(n, o), e.append(
1092
+ t,
1093
+ this.createSection(m("settingsSectionProps"), () => i)
1094
+ ), e;
1095
+ }
1096
+ buildGeometryPanel() {
1097
+ const e = document.createElement("div"), t = this.createSliderRow(
1098
+ m("settingsTolerance"),
1099
+ this.draft.sysVars.comparetolerance,
1100
+ Ce,
1101
+ Se,
1102
+ (s) => {
1103
+ this.draft.sysVars.comparetolerance = s, this.emitChange();
1104
+ }
1105
+ );
1106
+ this.toleranceInput = t.input, this.toleranceValue = t.valueEl;
1107
+ const i = this.createSliderRow(
1108
+ m("settingsRcMargin"),
1109
+ this.draft.sysVars.comparercmargin,
1110
+ ft,
1111
+ mt,
1112
+ (s) => {
1113
+ this.draft.sysVars.comparercmargin = s, this.emitChange();
1114
+ }
1115
+ );
1116
+ this.marginInput = i.input, this.marginValue = i.valueEl;
1117
+ const n = document.createElement("div");
1118
+ n.appendChild(t.row);
1119
+ const o = document.createElement("div");
1120
+ return o.appendChild(i.row), e.append(
1121
+ this.createSection(
1122
+ m("settingsSectionTolerance"),
1123
+ () => n
1124
+ ),
1125
+ this.createSection(
1126
+ m("settingsSectionClouds"),
1127
+ () => o
1128
+ )
1129
+ ), e;
1130
+ }
1131
+ selectTab(e) {
1132
+ this.tabButtons.forEach((t, i) => {
1133
+ const n = i === e;
1134
+ t.classList.toggle("is-active", n), t.setAttribute("aria-selected", n ? "true" : "false"), t.tabIndex = n ? 0 : -1;
1135
+ const o = this.tabPanels[i];
1136
+ o && (o.hidden = !n);
1137
+ });
1138
+ }
1139
+ onTabKeyDown(e, t) {
1140
+ var o;
1141
+ const i = this.tabButtons.length - 1;
1142
+ let n = t;
1143
+ if (e.key === "ArrowRight" || e.key === "ArrowDown")
1144
+ n = t === i ? 0 : t + 1;
1145
+ else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
1146
+ n = t === 0 ? i : t - 1;
1147
+ else if (e.key === "Home")
1148
+ n = 0;
1149
+ else if (e.key === "End")
1150
+ n = i;
1151
+ else
1152
+ return;
1153
+ e.preventDefault(), this.selectTab(n), (o = this.tabButtons[n]) == null || o.focus();
1154
+ }
1155
+ createSection(e, t) {
1156
+ const i = document.createElement("section");
1157
+ i.className = "ml-diff-settings-section";
1158
+ const n = document.createElement("h3");
1159
+ return n.className = "ml-diff-settings-heading", n.textContent = e, i.append(n, t()), i;
1160
+ }
1161
+ createColorRow(e, t) {
1162
+ const i = document.createElement("label");
1163
+ i.className = "ml-diff-settings-row";
1164
+ const n = document.createElement("span");
1165
+ n.className = "ml-diff-settings-label", n.textContent = t;
1166
+ const o = document.createElement("span");
1167
+ o.className = "ml-diff-settings-control";
1168
+ const s = document.createElement("span");
1169
+ s.className = "ml-diff-settings-hex", s.textContent = F(this.draft.colors[e]), this.hexLabels.set(e, s);
1170
+ const r = document.createElement("input");
1171
+ return r.type = "color", r.className = "ml-diff-settings-color", r.value = F(this.draft.colors[e]), r.setAttribute("aria-label", t), r.addEventListener("input", () => {
1172
+ const d = Vt(r.value);
1173
+ d != null && (this.draft.colors[e] = d, s.textContent = F(d), this.emitChange());
1174
+ }), this.pickers.set(e, r), o.append(s, r), i.append(n, o), i;
1175
+ }
1176
+ createCheckRow(e, t, i, n) {
1177
+ const o = document.createElement("label");
1178
+ o.className = "ml-diff-settings-check-item";
1179
+ const s = document.createElement("input");
1180
+ s.type = "checkbox", s.className = "ml-diff-settings-check", s.checked = i, s.addEventListener("change", () => n(s.checked));
1181
+ const r = document.createElement("span");
1182
+ return r.className = "ml-diff-settings-label", r.textContent = t, o.append(s, r), e.appendChild(o), s;
1183
+ }
1184
+ createSliderRow(e, t, i, n, o) {
1185
+ const s = document.createElement("label");
1186
+ s.className = "ml-diff-settings-slider-row";
1187
+ const r = document.createElement("span");
1188
+ r.className = "ml-diff-settings-slider-head";
1189
+ const d = document.createElement("span");
1190
+ d.className = "ml-diff-settings-label", d.textContent = e;
1191
+ const c = document.createElement("span");
1192
+ c.className = "ml-diff-settings-slider-value", c.textContent = String(t), r.append(d, c);
1193
+ const l = document.createElement("input");
1194
+ return l.type = "range", l.className = "ml-diff-settings-slider", l.min = String(i), l.max = String(n), l.step = "1", l.value = String(t), l.setAttribute("aria-label", e), l.addEventListener("input", () => {
1195
+ const f = Number(l.value);
1196
+ c.textContent = String(f), o(f);
1197
+ }), s.append(r, l), { row: s, input: l, valueEl: c };
1198
+ }
1199
+ resetToDefaults() {
1200
+ Object.assign(this.draft.colors, we);
1201
+ const e = le();
1202
+ this.draft.sysVars.compareprops = e.compareprops ?? se, this.draft.sysVars.comparehatch = e.comparehatch ?? oe, this.draft.sysVars.comparercmargin = e.comparercmargin ?? re, this.draft.sysVars.comparetext = e.comparetext ?? ae, this.draft.sysVars.comparetolerance = e.comparetolerance ?? X;
1203
+ for (const t of this.pickers.keys()) {
1204
+ const i = F(this.draft.colors[t]), n = this.pickers.get(t), o = this.hexLabels.get(t);
1205
+ n && (n.value = i), o && (o.textContent = i);
1206
+ }
1207
+ this.hatchCheck && (this.hatchCheck.checked = this.draft.sysVars.comparehatch !== 0), this.textCheck && (this.textCheck.checked = this.draft.sysVars.comparetext !== 0);
1208
+ for (const [t, i] of this.propChecks)
1209
+ i.checked = (this.draft.sysVars.compareprops & t) !== 0;
1210
+ this.marginInput && this.marginValue && (this.marginInput.value = String(this.draft.sysVars.comparercmargin), this.marginValue.textContent = String(this.draft.sysVars.comparercmargin)), this.toleranceInput && this.toleranceValue && (this.toleranceInput.value = String(this.draft.sysVars.comparetolerance), this.toleranceValue.textContent = String(
1211
+ this.draft.sysVars.comparetolerance
1212
+ )), this.emitChange();
1213
+ }
1214
+ emitChange() {
1215
+ var e;
1216
+ (e = this.onChange) == null || e.call(this, {
1217
+ colors: { ...this.draft.colors },
1218
+ sysVars: { ...this.draft.sysVars }
1219
+ });
1220
+ }
1221
+ static ensureSettingsStyles() {
1222
+ if (C.settingsStylesInjected) return;
1223
+ if (document.getElementById(C.settingsStyleId)) {
1224
+ C.settingsStylesInjected = !0;
1225
+ return;
1226
+ }
1227
+ const e = document.createElement("style");
1228
+ e.id = C.settingsStyleId, e.textContent = `
1229
+ .ml-ui-dialog.ml-diff-settings-dialog {
1230
+ width: min(460px, calc(100vw - 32px));
1231
+ max-height: min(560px, calc(100vh - 32px));
1232
+ }
1233
+
1234
+ .ml-ui-dialog.ml-diff-settings-dialog .ml-ui-dialog-body {
1235
+ display: flex;
1236
+ flex-direction: column;
1237
+ overflow: hidden;
1238
+ max-height: min(400px, calc(100vh - 180px));
1239
+ padding-top: 0;
1240
+ }
1241
+
1242
+ .ml-diff-settings-tabs {
1243
+ flex: 0 0 auto;
1244
+ display: flex;
1245
+ gap: 2px;
1246
+ margin: 0 -4px 8px;
1247
+ border-bottom: 1px solid var(--ml-ui-border, #4c4d4f);
1248
+ }
1249
+
1250
+ .ml-diff-settings-tab {
1251
+ flex: 1 1 0;
1252
+ padding: 8px 6px 7px;
1253
+ border: none;
1254
+ border-radius: 0;
1255
+ background: transparent;
1256
+ color: var(--ml-ui-text-muted, #cfd3dc);
1257
+ font: inherit;
1258
+ font-size: 13px;
1259
+ cursor: pointer;
1260
+ }
1261
+
1262
+ .ml-diff-settings-tab.is-active {
1263
+ color: var(--ml-ui-text, #e5eaf3);
1264
+ font-weight: 600;
1265
+ box-shadow: inset 0 -2px 0 var(--ml-ui-accent, #409eff);
1266
+ }
1267
+
1268
+ .ml-diff-settings-panels {
1269
+ flex: 1 1 auto;
1270
+ min-height: 0;
1271
+ overflow-y: auto;
1272
+ }
1273
+
1274
+ .ml-diff-settings-panel[hidden] {
1275
+ display: none;
1276
+ }
1277
+
1278
+ .ml-diff-settings-section + .ml-diff-settings-section {
1279
+ margin-top: 14px;
1280
+ padding-top: 12px;
1281
+ border-top: 1px solid var(--ml-ui-border, #4c4d4f);
1282
+ }
1283
+
1284
+ .ml-diff-settings-list + .ml-diff-settings-section {
1285
+ margin-top: 14px;
1286
+ padding-top: 12px;
1287
+ border-top: 1px solid var(--ml-ui-border, #4c4d4f);
1288
+ }
1289
+
1290
+ .ml-diff-settings-heading {
1291
+ margin: 0 0 8px;
1292
+ font-size: 12px;
1293
+ font-weight: 600;
1294
+ letter-spacing: 0.02em;
1295
+ text-transform: uppercase;
1296
+ color: var(--ml-ui-text-muted, #cfd3dc);
1297
+ }
1298
+
1299
+ .ml-diff-settings-hint {
1300
+ margin: 0 0 8px;
1301
+ font-size: 12px;
1302
+ line-height: 1.4;
1303
+ color: var(--ml-ui-text-muted, #cfd3dc);
1304
+ }
1305
+
1306
+ .ml-diff-settings-list {
1307
+ display: flex;
1308
+ flex-direction: column;
1309
+ }
1310
+
1311
+ .ml-diff-settings-check-grid {
1312
+ display: grid;
1313
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
1314
+ column-gap: 12px;
1315
+ row-gap: 2px;
1316
+ }
1317
+
1318
+ .ml-diff-settings-check-item {
1319
+ display: flex;
1320
+ align-items: center;
1321
+ gap: 8px;
1322
+ min-width: 0;
1323
+ padding: 5px 0;
1324
+ cursor: pointer;
1325
+ }
1326
+
1327
+ .ml-diff-settings-check-item .ml-diff-settings-label {
1328
+ line-height: 1.3;
1329
+ }
1330
+
1331
+ .ml-diff-settings-row {
1332
+ display: flex;
1333
+ align-items: center;
1334
+ justify-content: space-between;
1335
+ gap: 12px;
1336
+ padding: 8px 0;
1337
+ cursor: pointer;
1338
+ }
1339
+
1340
+ .ml-diff-settings-row + .ml-diff-settings-row {
1341
+ border-top: 1px solid var(--ml-ui-border, #4c4d4f);
1342
+ }
1343
+
1344
+ .ml-diff-settings-label {
1345
+ font-size: 13px;
1346
+ color: var(--ml-ui-text, #e5eaf3);
1347
+ }
1348
+
1349
+ .ml-diff-settings-control {
1350
+ display: inline-flex;
1351
+ align-items: center;
1352
+ gap: 10px;
1353
+ }
1354
+
1355
+ .ml-diff-settings-hex {
1356
+ font-size: 12px;
1357
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
1358
+ color: var(--ml-ui-text-muted, #cfd3dc);
1359
+ min-width: 4.6em;
1360
+ text-align: right;
1361
+ }
1362
+
1363
+ .ml-diff-settings-color {
1364
+ width: 40px;
1365
+ height: 28px;
1366
+ padding: 0;
1367
+ border: 1px solid var(--ml-ui-border, #4c4d4f);
1368
+ border-radius: 4px;
1369
+ background: transparent;
1370
+ cursor: pointer;
1371
+ }
1372
+
1373
+ .ml-diff-settings-color::-webkit-color-swatch-wrapper {
1374
+ padding: 2px;
1375
+ }
1376
+
1377
+ .ml-diff-settings-color::-webkit-color-swatch {
1378
+ border: none;
1379
+ border-radius: 3px;
1380
+ }
1381
+
1382
+ .ml-diff-settings-color::-moz-color-swatch {
1383
+ border: none;
1384
+ border-radius: 3px;
1385
+ }
1386
+
1387
+ .ml-diff-settings-check {
1388
+ flex: 0 0 auto;
1389
+ width: 16px;
1390
+ height: 16px;
1391
+ accent-color: var(--ml-ui-accent, #409eff);
1392
+ cursor: pointer;
1393
+ }
1394
+
1395
+ .ml-diff-settings-slider-row {
1396
+ display: flex;
1397
+ flex-direction: column;
1398
+ gap: 8px;
1399
+ padding: 4px 0 8px;
1400
+ }
1401
+
1402
+ .ml-diff-settings-slider-head {
1403
+ display: flex;
1404
+ align-items: center;
1405
+ justify-content: space-between;
1406
+ gap: 12px;
1407
+ }
1408
+
1409
+ .ml-diff-settings-slider-value {
1410
+ font-size: 12px;
1411
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
1412
+ color: var(--ml-ui-text-muted, #cfd3dc);
1413
+ }
1414
+
1415
+ .ml-diff-settings-slider {
1416
+ width: 100%;
1417
+ accent-color: var(--ml-ui-accent, #409eff);
1418
+ }
1419
+
1420
+ .ml-diff-settings-footer {
1421
+ align-items: center;
1422
+ }
1423
+
1424
+ .ml-diff-settings-reset {
1425
+ margin-right: auto;
1426
+ }
1427
+
1428
+ .ml-ui-dialog-btn.ml-diff-settings-btn-secondary {
1429
+ background: transparent;
1430
+ color: var(--ml-ui-text, #e5eaf3);
1431
+ border-color: var(--ml-ui-border, #4c4d4f);
1432
+ }
1433
+ `.trim(), document.head.appendChild(e), C.settingsStylesInjected = !0;
1434
+ }
1435
+ };
1436
+ C.settingsStyleId = "ml-diff-settings-dialog-styles-v3", C.settingsStylesInjected = !1, C.openInstance = null;
1437
+ let G = C;
1438
+ const Nt = `
1439
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1440
+ <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776" />
1441
+ </svg>
1442
+ `.trim(), It = `
1443
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1444
+ <path stroke-linecap="round" stroke-linejoin="round" d="M9 4.5v15m6-15v15m-10.875 0h15.75c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125H4.125C3.504 4.5 3 5.004 3 5.625v12.75c0 .621.504 1.125 1.125 1.125Z" />
1445
+ </svg>
1446
+ `.trim(), Bt = `
1447
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1448
+ <path stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6" />
1449
+ </svg>
1450
+ `.trim(), Ft = `
1451
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1452
+ <path stroke-linecap="round" stroke-linejoin="round" d="M3 5.625C3 5.004 3.504 4.5 4.125 4.5h15.75c.621 0 1.125.504 1.125 1.125v12.75c0 .621-.504 1.125-1.125 1.125H4.125A1.125 1.125 0 013 18.375V5.625Z" />
1453
+ <path stroke-linecap="round" stroke-linejoin="round" d="M15 4.5v15" />
1454
+ </svg>
1455
+ `.trim(), _t = `
1456
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1457
+ <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
1458
+ </svg>
1459
+ `.trim(), Ht = `
1460
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1461
+ <path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z" />
1462
+ </svg>
1463
+ `.trim(), jt = `
1464
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1465
+ <path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 010 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 010-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.28Z" />
1466
+ <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0Z" />
1467
+ </svg>
1468
+ `.trim(), zt = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" aria-hidden="true"><path fill="currentColor" d="M512 704a192 192 0 1 0 0-384 192 192 0 0 0 0 384m0 64a256 256 0 1 1 0-512 256 256 0 0 1 0 512m0-704a32 32 0 0 1 32 32v64a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 768a32 32 0 0 1 32 32v64a32 32 0 1 1-64 0v-64a32 32 0 0 1 32-32m384-384a32 32 0 0 1-32 32h-64a32 32 0 0 1 0-64h64a32 32 0 0 1 32 32M96 512a32 32 0 0 1 32-32H192a32 32 0 1 1 0 64H128a32 32 0 0 1-32-32m741.056-266.944a32 32 0 0 1-45.248 45.248l-45.248-45.248a32 32 0 0 1 45.248-45.248zm-589.056 589.056a32 32 0 0 1-45.248 45.248l-45.248-45.248a32 32 0 0 1 45.248-45.248zm589.056 0-45.248 45.248a32 32 0 0 1-45.248-45.248l45.248-45.248a32 32 0 0 1 45.248 45.248M247.936 201.984a32 32 0 0 1-45.248 45.248l-45.248-45.248a32 32 0 0 1 45.248-45.248z"/></svg>', Ut = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" aria-hidden="true"><path fill="currentColor" d="M240.448 240.448a384 384 0 1 0 543.104 543.104 476.16 476.16 0 0 1-543.104-543.104"/></svg>', Kt = `
1469
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1470
+ <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 15a4.5 4.5 0 0 0 4.06 2.25h9.44a3.75 3.75 0 1 0-.3-7.49 5.25 5.25 0 0 0-10.12 1.5A4.5 4.5 0 0 0 2.25 15Z" />
1471
+ <path stroke-linecap="round" stroke-linejoin="round" d="M16.5 3.75 16.82 4.61 17.68 4.93 16.82 5.25 16.5 6.11 16.18 5.25 15.32 4.93 16.18 4.61 16.5 3.75Z" />
1472
+ <path stroke-linecap="round" stroke-linejoin="round" d="M20.25 7.5 20.5 8.16 21.16 8.41 20.5 8.66 20.25 9.32 20 8.66 19.34 8.41 20 8.16 20.25 7.5Z" />
1473
+ </svg>
1474
+ `.trim(), Gt = `
1475
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
1476
+ <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m.75 12l3 3m0 0l3-3m-3 3v-6m-1.5-9H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" />
1477
+ </svg>
1478
+ `.trim();
1479
+ function $t() {
1480
+ const a = document.createElement("span");
1481
+ return a.className = "ml-diff-icon", a.innerHTML = Nt, a;
1482
+ }
1483
+ function Xt() {
1484
+ const a = document.createElement("span");
1485
+ return a.className = "ml-diff-empty-icon", a.innerHTML = Gt, a;
1486
+ }
1487
+ const be = "ml-diff-viewer-styles-v2", Yt = `
1488
+ .ml-diff-root {
1489
+ --ml-diff-bg: var(--ml-ui-bg, #1d1e1f);
1490
+ --ml-diff-panel: var(--ml-ui-bg, #1d1e1f);
1491
+ --ml-diff-border: var(--ml-ui-border, #4c4d4f);
1492
+ --ml-diff-text: var(--ml-ui-text, #e5eaf3);
1493
+ --ml-diff-muted: var(--ml-ui-text-muted, #cfd3dc);
1494
+ --ml-diff-focus: var(--ml-ui-accent, #409eff);
1495
+ --ml-diff-hover: color-mix(in srgb, var(--ml-diff-text) 10%, transparent);
1496
+ --ml-diff-added: #22c55e;
1497
+ --ml-diff-deleted: #e11d48;
1498
+ --ml-diff-modified: #f59e0b;
1499
+ box-sizing: border-box;
1500
+ display: flex;
1501
+ flex-direction: column;
1502
+ width: 100%;
1503
+ height: 100%;
1504
+ min-height: 0;
1505
+ min-width: 0;
1506
+ overflow: hidden;
1507
+ color: var(--ml-diff-text);
1508
+ background: var(--ml-diff-bg);
1509
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
1510
+ }
1511
+
1512
+ .ml-diff-root *,
1513
+ .ml-diff-root *::before,
1514
+ .ml-diff-root *::after {
1515
+ box-sizing: border-box;
1516
+ }
1517
+
1518
+ .ml-diff-toolbar {
1519
+ position: relative;
1520
+ z-index: 5;
1521
+ flex: 0 0 auto;
1522
+ display: flex;
1523
+ flex-wrap: wrap;
1524
+ align-items: center;
1525
+ gap: 0.35rem;
1526
+ padding: 0.4rem 0.55rem;
1527
+ background: var(--ml-diff-panel);
1528
+ border-bottom: 1px solid var(--ml-diff-border);
1529
+ }
1530
+
1531
+ .ml-diff-toolbar-group {
1532
+ display: inline-flex;
1533
+ align-items: center;
1534
+ gap: 0.2rem;
1535
+ padding-right: 0.45rem;
1536
+ margin-right: 0.25rem;
1537
+ border-right: 1px solid var(--ml-diff-border);
1538
+ }
1539
+
1540
+ .ml-diff-toolbar-group:last-child {
1541
+ border-right: none;
1542
+ margin-right: 0;
1543
+ padding-right: 0;
1544
+ }
1545
+
1546
+ .ml-diff-toolbar-locale {
1547
+ margin-left: auto;
1548
+ gap: 0.35rem;
1549
+ }
1550
+
1551
+ .ml-diff-tool-btn {
1552
+ display: inline-flex;
1553
+ align-items: center;
1554
+ justify-content: center;
1555
+ gap: 0.3rem;
1556
+ min-height: 1.85rem;
1557
+ padding: 0.2rem 0.5rem;
1558
+ border: 1px solid transparent;
1559
+ border-radius: 6px;
1560
+ background: transparent;
1561
+ color: var(--ml-diff-muted);
1562
+ font-size: 0.75rem;
1563
+ cursor: pointer;
1564
+ }
1565
+
1566
+ .ml-diff-tool-btn.is-icon {
1567
+ width: 1.85rem;
1568
+ padding: 0.2rem;
1569
+ }
1570
+
1571
+ .ml-diff-root.is-overlay .ml-diff-sync-btn {
1572
+ display: none;
1573
+ }
1574
+
1575
+ .ml-diff-tool-btn:hover,
1576
+ .ml-diff-tool-btn:focus-visible {
1577
+ color: var(--ml-diff-text);
1578
+ background: var(--ml-diff-hover);
1579
+ outline: none;
1580
+ }
1581
+
1582
+ .ml-diff-tool-btn.is-active {
1583
+ color: var(--ml-diff-text);
1584
+ border-color: var(--ml-diff-focus);
1585
+ background: color-mix(in srgb, var(--ml-diff-focus) 18%, transparent);
1586
+ }
1587
+
1588
+ .ml-diff-tool-btn:disabled {
1589
+ opacity: 0.4;
1590
+ cursor: default;
1591
+ pointer-events: none;
1592
+ }
1593
+
1594
+ .ml-diff-tool-btn svg {
1595
+ width: 1rem;
1596
+ height: 1rem;
1597
+ display: block;
1598
+ }
1599
+
1600
+ .ml-diff-lang-select {
1601
+ position: relative;
1602
+ width: 110px;
1603
+ }
1604
+
1605
+ .ml-diff-lang-select__trigger {
1606
+ position: relative;
1607
+ display: inline-flex;
1608
+ align-items: center;
1609
+ width: 100%;
1610
+ height: 24px;
1611
+ padding: 0 22px 0 8px;
1612
+ border: 1px solid var(--ml-diff-border);
1613
+ border-radius: 4px;
1614
+ background: var(--ml-diff-bg);
1615
+ color: var(--ml-diff-text);
1616
+ font-size: 12px;
1617
+ font-family: inherit;
1618
+ line-height: 22px;
1619
+ text-align: left;
1620
+ cursor: pointer;
1621
+ }
1622
+
1623
+ .ml-diff-lang-select__trigger:hover,
1624
+ .ml-diff-lang-select.is-open .ml-diff-lang-select__trigger {
1625
+ border-color: var(--ml-diff-focus);
1626
+ }
1627
+
1628
+ .ml-diff-lang-select__trigger:focus-visible {
1629
+ outline: none;
1630
+ border-color: var(--ml-diff-focus);
1631
+ box-shadow: 0 0 0 1px var(--ml-diff-focus);
1632
+ }
1633
+
1634
+ .ml-diff-lang-select__label {
1635
+ flex: 1 1 auto;
1636
+ overflow: hidden;
1637
+ text-overflow: ellipsis;
1638
+ white-space: nowrap;
1639
+ }
1640
+
1641
+ .ml-diff-lang-select__caret {
1642
+ position: absolute;
1643
+ right: 6px;
1644
+ top: 50%;
1645
+ width: 10px;
1646
+ height: 10px;
1647
+ margin-top: -5px;
1648
+ color: var(--ml-diff-muted);
1649
+ pointer-events: none;
1650
+ transition: transform 0.15s ease;
1651
+ }
1652
+
1653
+ .ml-diff-lang-select.is-open .ml-diff-lang-select__caret {
1654
+ transform: rotate(180deg);
1655
+ }
1656
+
1657
+ .ml-diff-lang-select__menu {
1658
+ position: absolute;
1659
+ right: 0;
1660
+ top: calc(100% + 4px);
1661
+ z-index: 40;
1662
+ min-width: 100%;
1663
+ padding: 4px 0;
1664
+ border: 1px solid var(--ml-diff-border);
1665
+ border-radius: 4px;
1666
+ background: var(--ml-diff-panel);
1667
+ box-shadow: var(--ml-ui-shadow, 0 6px 16px rgba(0, 0, 0, 0.45));
1668
+ }
1669
+
1670
+ .ml-diff-lang-select__option {
1671
+ display: block;
1672
+ width: 100%;
1673
+ margin: 0;
1674
+ padding: 5px 12px;
1675
+ border: none;
1676
+ background: transparent;
1677
+ color: var(--ml-diff-text);
1678
+ font-size: 12px;
1679
+ font-family: inherit;
1680
+ text-align: left;
1681
+ cursor: pointer;
1682
+ }
1683
+
1684
+ .ml-diff-lang-select__option:hover {
1685
+ background: var(--ml-diff-hover);
1686
+ }
1687
+
1688
+ .ml-diff-lang-select__option.is-selected {
1689
+ color: var(--ml-diff-text);
1690
+ background: color-mix(in srgb, var(--ml-diff-focus) 22%, transparent);
1691
+ font-weight: 600;
1692
+ }
1693
+
1694
+ .ml-diff-body {
1695
+ flex: 1 1 auto;
1696
+ display: flex;
1697
+ min-height: 0;
1698
+ min-width: 0;
1699
+ }
1700
+
1701
+ .ml-diff-panes {
1702
+ flex: 1 1 auto;
1703
+ display: flex;
1704
+ min-width: 0;
1705
+ min-height: 0;
1706
+ }
1707
+
1708
+ .ml-diff-pane {
1709
+ flex: 1 1 50%;
1710
+ min-width: 0;
1711
+ min-height: 0;
1712
+ display: flex;
1713
+ flex-direction: column;
1714
+ border: 2px solid transparent;
1715
+ }
1716
+
1717
+ .ml-diff-pane.is-empty {
1718
+ cursor: pointer;
1719
+ }
1720
+
1721
+ .ml-diff-root.is-overlay .ml-diff-pane[data-side='right'] {
1722
+ display: none;
1723
+ }
1724
+
1725
+ .ml-diff-root.is-overlay .ml-diff-pane[data-side='left'] {
1726
+ flex: 1 1 100%;
1727
+ }
1728
+
1729
+ .ml-diff-pane.is-focused {
1730
+ position: relative;
1731
+ z-index: 1;
1732
+ border-color: var(--ml-diff-focus);
1733
+ }
1734
+
1735
+ .ml-diff-pane + .ml-diff-pane {
1736
+ border-left: 1px solid var(--ml-diff-border);
1737
+ }
1738
+
1739
+ /* Adjacent-sibling divider must not replace the focused pane's left edge. */
1740
+ .ml-diff-pane + .ml-diff-pane.is-focused {
1741
+ border-left: 2px solid var(--ml-diff-focus);
1742
+ }
1743
+
1744
+ .ml-diff-header {
1745
+ flex: 0 0 auto;
1746
+ display: flex;
1747
+ align-items: center;
1748
+ gap: 0.5rem;
1749
+ padding: 0.35rem 0.45rem 0.35rem 0.7rem;
1750
+ background: var(--ml-diff-panel);
1751
+ border-bottom: 1px solid var(--ml-diff-border);
1752
+ }
1753
+
1754
+ .ml-diff-title {
1755
+ flex: 1 1 auto;
1756
+ min-width: 0;
1757
+ overflow: hidden;
1758
+ text-overflow: ellipsis;
1759
+ white-space: nowrap;
1760
+ font-size: 0.85rem;
1761
+ }
1762
+
1763
+ .ml-diff-title.is-empty {
1764
+ color: var(--ml-diff-muted);
1765
+ }
1766
+
1767
+ .ml-diff-open {
1768
+ flex: 0 0 auto;
1769
+ display: inline-flex;
1770
+ align-items: center;
1771
+ justify-content: center;
1772
+ width: 1.85rem;
1773
+ height: 1.85rem;
1774
+ padding: 0;
1775
+ border: none;
1776
+ border-radius: 6px;
1777
+ background: transparent;
1778
+ color: var(--ml-diff-muted);
1779
+ cursor: pointer;
1780
+ }
1781
+
1782
+ .ml-diff-open:hover,
1783
+ .ml-diff-open:focus-visible {
1784
+ color: var(--ml-diff-text);
1785
+ background: var(--ml-diff-hover);
1786
+ outline: none;
1787
+ }
1788
+
1789
+ .ml-diff-open svg,
1790
+ .ml-diff-icon svg {
1791
+ display: block;
1792
+ width: 1.15rem;
1793
+ height: 1.15rem;
1794
+ }
1795
+
1796
+ .ml-diff-file-input {
1797
+ position: absolute;
1798
+ width: 1px;
1799
+ height: 1px;
1800
+ padding: 0;
1801
+ margin: -1px;
1802
+ overflow: hidden;
1803
+ clip: rect(0, 0, 0, 0);
1804
+ white-space: nowrap;
1805
+ border: 0;
1806
+ }
1807
+
1808
+ .ml-diff-canvas-slot {
1809
+ position: relative;
1810
+ flex: 1 1 auto;
1811
+ min-height: 0;
1812
+ background: #000;
1813
+ }
1814
+
1815
+ .ml-diff-canvas {
1816
+ position: absolute;
1817
+ inset: 0;
1818
+ overflow: hidden;
1819
+ z-index: 1;
1820
+ }
1821
+
1822
+ .ml-diff-empty {
1823
+ position: absolute;
1824
+ inset: 0;
1825
+ z-index: 2;
1826
+ display: flex;
1827
+ align-items: center;
1828
+ justify-content: center;
1829
+ padding: 1.25rem;
1830
+ color: var(--ml-diff-muted);
1831
+ cursor: pointer;
1832
+ }
1833
+
1834
+ .ml-diff-empty.is-hidden {
1835
+ display: none;
1836
+ }
1837
+
1838
+ .ml-diff-empty-card {
1839
+ display: flex;
1840
+ flex-direction: column;
1841
+ align-items: center;
1842
+ gap: 0.55rem;
1843
+ max-width: 18rem;
1844
+ padding: 1.75rem 1.5rem;
1845
+ border: 1px dashed var(--ml-diff-border);
1846
+ border-radius: 10px;
1847
+ text-align: center;
1848
+ background: color-mix(in srgb, var(--ml-diff-panel) 70%, transparent);
1849
+ }
1850
+
1851
+ .ml-diff-empty-icon {
1852
+ color: var(--ml-diff-muted);
1853
+ }
1854
+
1855
+ .ml-diff-empty-icon svg {
1856
+ display: block;
1857
+ width: 2.25rem;
1858
+ height: 2.25rem;
1859
+ }
1860
+
1861
+ .ml-diff-empty-title {
1862
+ font-size: 0.95rem;
1863
+ font-weight: 600;
1864
+ color: var(--ml-diff-text);
1865
+ }
1866
+
1867
+ .ml-diff-empty-hint {
1868
+ font-size: 0.8rem;
1869
+ line-height: 1.4;
1870
+ color: var(--ml-diff-muted);
1871
+ }
1872
+
1873
+ .ml-diff-empty-error {
1874
+ font-size: 0.8rem;
1875
+ color: #fca5a5;
1876
+ }
1877
+
1878
+ .ml-diff-empty-error.is-hidden,
1879
+ .ml-diff-banner.is-hidden {
1880
+ display: none;
1881
+ }
1882
+
1883
+ .ml-diff-banner {
1884
+ position: absolute;
1885
+ left: 50%;
1886
+ top: 0.7rem;
1887
+ z-index: 4;
1888
+ transform: translateX(-50%);
1889
+ max-width: calc(100% - 1.5rem);
1890
+ padding: 0.35rem 0.7rem;
1891
+ border-radius: 6px;
1892
+ background: #7f1d1d;
1893
+ color: #fecaca;
1894
+ font-size: 0.8rem;
1895
+ pointer-events: none;
1896
+ white-space: nowrap;
1897
+ overflow: hidden;
1898
+ text-overflow: ellipsis;
1899
+ }
1900
+
1901
+ .ml-diff-pane.is-dragover .ml-diff-canvas-slot::after {
1902
+ content: '';
1903
+ position: absolute;
1904
+ inset: 0.55rem;
1905
+ z-index: 3;
1906
+ pointer-events: none;
1907
+ border: 2px dashed var(--ml-diff-focus);
1908
+ border-radius: 8px;
1909
+ background: color-mix(in srgb, var(--ml-diff-focus) 12%, transparent);
1910
+ }
1911
+
1912
+ .ml-diff-pane.is-dragover .ml-diff-empty-card {
1913
+ border-color: var(--ml-diff-focus);
1914
+ background: color-mix(in srgb, var(--ml-diff-focus) 12%, transparent);
1915
+ }
1916
+
1917
+ .ml-diff-pane:not(.is-focused) canvas {
1918
+ pointer-events: none;
1919
+ }
1920
+
1921
+ .ml-diff-root.is-overlay .ml-diff-pane canvas {
1922
+ pointer-events: auto;
1923
+ }
1924
+
1925
+ .ml-diff-sidepanel {
1926
+ flex: 0 0 280px;
1927
+ max-width: 40%;
1928
+ min-width: 220px;
1929
+ display: flex;
1930
+ flex-direction: column;
1931
+ border-left: 1px solid var(--ml-diff-border);
1932
+ background: var(--ml-diff-panel);
1933
+ }
1934
+
1935
+ .ml-diff-sidepanel.is-collapsed {
1936
+ display: none;
1937
+ }
1938
+
1939
+ .ml-diff-sidepanel-header {
1940
+ flex: 0 0 auto;
1941
+ display: flex;
1942
+ align-items: center;
1943
+ gap: 0.5rem;
1944
+ padding: 0.45rem 0.6rem;
1945
+ border-bottom: 1px solid var(--ml-diff-border);
1946
+ }
1947
+
1948
+ .ml-diff-sidepanel-title {
1949
+ flex: 1 1 auto;
1950
+ font-size: 0.85rem;
1951
+ font-weight: 600;
1952
+ }
1953
+
1954
+ .ml-diff-sidepanel-tabs {
1955
+ flex: 0 0 auto;
1956
+ display: flex;
1957
+ border-bottom: 1px solid var(--ml-diff-border);
1958
+ }
1959
+
1960
+ .ml-diff-sidepanel-tab {
1961
+ flex: 1 1 50%;
1962
+ padding: 0.45rem;
1963
+ border: none;
1964
+ background: transparent;
1965
+ color: var(--ml-diff-muted);
1966
+ font-size: 0.8rem;
1967
+ cursor: pointer;
1968
+ }
1969
+
1970
+ .ml-diff-sidepanel-tab.is-active {
1971
+ color: var(--ml-diff-text);
1972
+ box-shadow: inset 0 -2px 0 var(--ml-diff-focus);
1973
+ }
1974
+
1975
+ .ml-diff-sidepanel-toolbar {
1976
+ flex: 0 0 auto;
1977
+ display: flex;
1978
+ gap: 0.35rem;
1979
+ padding: 0.4rem 0.55rem;
1980
+ border-bottom: 1px solid var(--ml-diff-border);
1981
+ }
1982
+
1983
+ .ml-diff-sidepanel-body {
1984
+ flex: 1 1 auto;
1985
+ min-height: 0;
1986
+ overflow: auto;
1987
+ padding: 0.4rem 0;
1988
+ }
1989
+
1990
+ .ml-diff-group {
1991
+ margin-bottom: 0.35rem;
1992
+ }
1993
+
1994
+ .ml-diff-group-title {
1995
+ display: flex;
1996
+ align-items: center;
1997
+ gap: 0.45rem;
1998
+ width: 100%;
1999
+ padding: 0.3rem 0.7rem;
2000
+ font-size: 0.72rem;
2001
+ font-weight: 700;
2002
+ letter-spacing: 0.03em;
2003
+ text-transform: uppercase;
2004
+ color: var(--ml-diff-muted);
2005
+ cursor: pointer;
2006
+ list-style: none;
2007
+ user-select: none;
2008
+ }
2009
+
2010
+ .ml-diff-group-title::-webkit-details-marker,
2011
+ .ml-diff-group-title::marker {
2012
+ display: none;
2013
+ content: none;
2014
+ }
2015
+
2016
+ .ml-diff-group-title::before {
2017
+ content: '';
2018
+ flex: 0 0 auto;
2019
+ width: 0.35rem;
2020
+ height: 0.35rem;
2021
+ border-right: 1.5px solid currentColor;
2022
+ border-bottom: 1.5px solid currentColor;
2023
+ transform: rotate(-45deg);
2024
+ transition: transform 0.15s ease;
2025
+ }
2026
+
2027
+ .ml-diff-group[open] .ml-diff-group-title::before {
2028
+ transform: rotate(45deg);
2029
+ }
2030
+
2031
+ .ml-diff-group-title:hover,
2032
+ .ml-diff-group-title:focus-visible {
2033
+ color: var(--ml-diff-text);
2034
+ background: var(--ml-diff-hover);
2035
+ outline: none;
2036
+ }
2037
+
2038
+ .ml-diff-result-row {
2039
+ display: flex;
2040
+ align-items: stretch;
2041
+ width: 100%;
2042
+ border-left: 3px solid transparent;
2043
+ }
2044
+
2045
+ .ml-diff-result-row[data-kind='added'] {
2046
+ border-left-color: var(--ml-diff-added);
2047
+ }
2048
+
2049
+ .ml-diff-result-row[data-kind='deleted'] {
2050
+ border-left-color: var(--ml-diff-deleted);
2051
+ }
2052
+
2053
+ .ml-diff-result-row[data-kind='modified'] {
2054
+ border-left-color: var(--ml-diff-modified);
2055
+ }
2056
+
2057
+ .ml-diff-result-item,
2058
+ .ml-diff-markup-item {
2059
+ display: block;
2060
+ width: 100%;
2061
+ padding: 0.4rem 0.7rem;
2062
+ border: none;
2063
+ border-left: 3px solid transparent;
2064
+ background: transparent;
2065
+ color: var(--ml-diff-text);
2066
+ text-align: left;
2067
+ font-size: 0.8rem;
2068
+ cursor: pointer;
2069
+ }
2070
+
2071
+ .ml-diff-result-row .ml-diff-result-item {
2072
+ flex: 1 1 auto;
2073
+ min-width: 0;
2074
+ border-left: none;
2075
+ padding-right: 0.35rem;
2076
+ }
2077
+
2078
+ .ml-diff-result-label {
2079
+ display: block;
2080
+ overflow: hidden;
2081
+ text-overflow: ellipsis;
2082
+ white-space: nowrap;
2083
+ }
2084
+
2085
+ .ml-diff-result-info {
2086
+ flex: 0 0 auto;
2087
+ display: inline-flex;
2088
+ align-items: center;
2089
+ justify-content: center;
2090
+ width: 1.7rem;
2091
+ margin: 0.2rem 0.35rem 0.2rem 0;
2092
+ padding: 0;
2093
+ border: none;
2094
+ border-radius: 4px;
2095
+ background: transparent;
2096
+ color: var(--ml-diff-muted);
2097
+ cursor: pointer;
2098
+ }
2099
+
2100
+ .ml-diff-result-info svg {
2101
+ width: 0.95rem;
2102
+ height: 0.95rem;
2103
+ display: block;
2104
+ }
2105
+
2106
+ .ml-diff-result-info:hover,
2107
+ .ml-diff-result-info:focus-visible,
2108
+ .ml-diff-result-info.is-open {
2109
+ color: var(--ml-diff-text);
2110
+ background: var(--ml-diff-hover);
2111
+ outline: none;
2112
+ }
2113
+
2114
+ .ml-diff-result-item:hover,
2115
+ .ml-diff-markup-item:hover,
2116
+ .ml-diff-result-item.is-active,
2117
+ .ml-diff-result-row:hover,
2118
+ .ml-diff-result-row.is-active {
2119
+ background: var(--ml-diff-hover);
2120
+ }
2121
+
2122
+ .ml-diff-result-row:hover .ml-diff-result-item,
2123
+ .ml-diff-result-row.is-active .ml-diff-result-item {
2124
+ background: transparent;
2125
+ }
2126
+
2127
+ .ml-diff-result-item[data-kind='added'] {
2128
+ border-left-color: var(--ml-diff-added);
2129
+ }
2130
+
2131
+ .ml-diff-result-item[data-kind='deleted'] {
2132
+ border-left-color: var(--ml-diff-deleted);
2133
+ }
2134
+
2135
+ .ml-diff-result-item[data-kind='modified'] {
2136
+ border-left-color: var(--ml-diff-modified);
2137
+ }
2138
+
2139
+ .ml-diff-result-meta,
2140
+ .ml-diff-markup-meta {
2141
+ display: block;
2142
+ margin-top: 0.15rem;
2143
+ font-size: 0.7rem;
2144
+ color: var(--ml-diff-muted);
2145
+ }
2146
+
2147
+ .ml-diff-empty-list {
2148
+ padding: 1rem 0.8rem;
2149
+ color: var(--ml-diff-muted);
2150
+ font-size: 0.8rem;
2151
+ text-align: center;
2152
+ }
2153
+
2154
+ .ml-diff-change-popover {
2155
+ position: fixed;
2156
+ z-index: 40;
2157
+ min-width: 220px;
2158
+ max-width: min(360px, calc(100vw - 16px));
2159
+ max-height: min(320px, 70vh);
2160
+ overflow: auto;
2161
+ padding: 0.45rem 0.5rem;
2162
+ border: 1px solid var(--ml-diff-border);
2163
+ border-radius: 6px;
2164
+ background: var(--ml-diff-panel);
2165
+ box-shadow: 0 8px 24px color-mix(in srgb, #000 35%, transparent);
2166
+ color: var(--ml-diff-text);
2167
+ font-size: 0.72rem;
2168
+ }
2169
+
2170
+ .ml-diff-change-note {
2171
+ padding: 0.2rem 0.15rem;
2172
+ color: var(--ml-diff-muted);
2173
+ }
2174
+
2175
+ .ml-diff-change-table {
2176
+ width: 100%;
2177
+ border-collapse: collapse;
2178
+ }
2179
+
2180
+ .ml-diff-change-table th,
2181
+ .ml-diff-change-table td {
2182
+ padding: 0.22rem 0.35rem;
2183
+ text-align: left;
2184
+ vertical-align: top;
2185
+ word-break: break-word;
2186
+ }
2187
+
2188
+ .ml-diff-change-table thead th {
2189
+ color: var(--ml-diff-muted);
2190
+ font-weight: 600;
2191
+ font-size: 0.68rem;
2192
+ letter-spacing: 0.02em;
2193
+ text-transform: uppercase;
2194
+ border-bottom: 1px solid var(--ml-diff-border);
2195
+ }
2196
+
2197
+ .ml-diff-change-table tbody th {
2198
+ width: 28%;
2199
+ font-weight: 600;
2200
+ color: var(--ml-diff-text);
2201
+ }
2202
+
2203
+ .ml-diff-change-old {
2204
+ color: var(--ml-diff-deleted);
2205
+ }
2206
+
2207
+ .ml-diff-change-new {
2208
+ color: var(--ml-diff-added);
2209
+ }
2210
+ `.trim();
2211
+ function Wt() {
2212
+ if (document.getElementById(be))
2213
+ return;
2214
+ const a = document.createElement("style");
2215
+ a.id = be, a.textContent = Yt, document.head.appendChild(a);
2216
+ }
2217
+ const ve = {
2218
+ minimumChunkSize: 1e3,
2219
+ mode: Me.Write,
2220
+ progressiveRendering: !1,
2221
+ sysVars: {
2222
+ lwdisplay: !1
2223
+ }
2224
+ }, qt = /\.(dwg|dxf)$/i, ke = "cad-diff-viewer:changeset", Zt = 200, Jt = [
2225
+ { command: "markupcloud", labelKey: "markupCloud", icon: De },
2226
+ { command: "markuprect", labelKey: "markupRect", icon: Oe },
2227
+ { command: "markupcircle", labelKey: "markupCircle", icon: Ve },
2228
+ { command: "markupcallout", labelKey: "markupCallout", icon: Ne },
2229
+ { command: "markuparrow", labelKey: "markupArrow", icon: Ie },
2230
+ { command: "markupline", labelKey: "markupLine", icon: Be },
2231
+ { command: "markuptext", labelKey: "markupText", icon: Fe },
2232
+ { command: "markupstamp", labelKey: "markupStamp", icon: _e }
2233
+ ], Ee = [
2234
+ { locale: "en", label: "English" },
2235
+ { locale: "zh", label: "简体中文" },
2236
+ { locale: "tr", label: "Türkçe" },
2237
+ { locale: "cs", label: "Čeština" },
2238
+ { locale: "ar", label: "العربية" }
2239
+ ], Qt = '<svg class="ml-diff-lang-select__caret" viewBox="0 0 12 12" aria-hidden="true"><path fill="currentColor" d="M2.4 4.2 6 8.1l3.6-3.9"/></svg>';
2240
+ function ei(a) {
2241
+ var e;
2242
+ return ((e = Ee.find((t) => t.locale === a)) == null ? void 0 : e.label) ?? "English";
2243
+ }
2244
+ const ti = {
2245
+ objectId: "fieldObjectId",
2246
+ layer: "fieldLayer",
2247
+ color: "fieldColor",
2248
+ lineType: "fieldLineType",
2249
+ lineWeight: "fieldLineWeight",
2250
+ lineTypeScale: "fieldLineTypeScale",
2251
+ transparency: "fieldTransparency",
2252
+ thickness: "fieldThickness",
2253
+ visibility: "fieldVisibility",
2254
+ startPoint: "fieldStartPoint",
2255
+ endPoint: "fieldEndPoint",
2256
+ center: "fieldCenter",
2257
+ radius: "fieldRadius",
2258
+ startAngle: "fieldStartAngle",
2259
+ endAngle: "fieldEndAngle",
2260
+ position: "fieldPosition",
2261
+ location: "fieldLocation",
2262
+ rotation: "fieldRotation",
2263
+ height: "fieldHeight",
2264
+ blockName: "fieldBlockName",
2265
+ scale: "fieldScale",
2266
+ text: "fieldText",
2267
+ mtext: "fieldMtext",
2268
+ extents: "fieldExtents",
2269
+ geometry: "fieldGeometry"
2270
+ };
2271
+ function ii(a) {
2272
+ const e = ti[a];
2273
+ return e ? m(e) : a;
2274
+ }
2275
+ function xe(a, e) {
2276
+ return e === "" ? "—" : a === "visibility" ? m(e === "true" ? "diffVisible" : "diffHidden") : e;
2277
+ }
2278
+ function w() {
2279
+ try {
2280
+ return K.instance;
2281
+ } catch {
2282
+ throw new Error("AcApDiffViewer is not initialized");
2283
+ }
2284
+ }
2285
+ function ni(a) {
2286
+ return qt.test(a);
2287
+ }
2288
+ function si(a) {
2289
+ return {
2290
+ ...we,
2291
+ ...a
2292
+ };
2293
+ }
2294
+ class li {
2295
+ /**
2296
+ * Creates the widget, injects styles, and constructs a dedicated
2297
+ * {@link AcApDocManager} bound to the left canvas (and a split view for the right).
2298
+ *
2299
+ * @param options - Host container, workers, colors, and optional callbacks.
2300
+ * @throws If an {@link AcApDocManager} already exists in this page.
2301
+ */
2302
+ constructor(e) {
2303
+ this.markupButtons = [], this.leftDragDepth = 0, this.rightDragDepth = 0, this.bannerTimers = /* @__PURE__ */ new Map(), this.resultGroupMode = "kind", this.collapsedResultGroups = /* @__PURE__ */ new Set(), this.activeTab = "results", this.navIndex = -1, this.disposed = !1, this.localeMenuOpen = !1, this.diffPopoverPinned = !1, this.diffPopoverHideTimer = 0, this.activateSeq = 0, this.activateTail = Promise.resolve(), this.compareSeq = 0, this.overlayRegisterSeq = 0, this.sysVarPreviewTimer = 0, this.lastPointerSide = "left", this.viewsSynced = !1, this.viewSyncLock = !1, this.viewSyncLeader = "left", this.viewSyncFollowOpen = !1, this.viewSyncFromUser = !1, this.handleLocaleChanged = () => {
2304
+ this.disposed || (this.setLocaleMenuOpen(!1), this.syncChrome(), this.syncViewModeUi(), this.syncPanelUi(), this.renderResultsList(), this.refreshMarkupsList());
2305
+ }, this.handleDocumentPointerDown = (s) => {
2306
+ var r;
2307
+ s.target instanceof Node && (this.localeMenuOpen && !this.localeSelectHost.contains(s.target) && this.setLocaleMenuOpen(!1), this.diffPopoverPinned && (this.diffPopover.contains(s.target) || (r = this.diffPopoverAnchor) != null && r.contains(s.target) || this.hideDiffPopover(!0)));
2308
+ }, this.handleDiffPopoverDismiss = () => {
2309
+ this.hideDiffPopover(!0);
2310
+ }, this.cancelDiffPopoverHide = () => {
2311
+ this.diffPopoverHideTimer && (window.clearTimeout(this.diffPopoverHideTimer), this.diffPopoverHideTimer = 0);
2312
+ }, this.scheduleDiffPopoverHide = () => {
2313
+ this.diffPopoverPinned || (this.cancelDiffPopoverHide(), this.diffPopoverHideTimer = window.setTimeout(() => {
2314
+ this.diffPopoverHideTimer = 0, this.hideDiffPopover(!1);
2315
+ }, 180));
2316
+ }, this.markViewSyncUserInput = () => {
2317
+ this.viewSyncFromUser = !0;
2318
+ }, this.handleLeftViewChanged = () => {
2319
+ this.onPaneViewChanged("left");
2320
+ }, this.handleRightViewChanged = () => {
2321
+ this.onPaneViewChanged("right");
2322
+ }, this.options = e, this.colors = si(e.compareColors), this.sessionSysVars = le(), this.uiTheme = e.theme ?? "dark", this.viewMode = e.viewMode ?? "side-by-side", this.sidePanelOpen = e.sidePanelOpen !== !1, Rt(), Wt();
2323
+ let t = !1;
2324
+ try {
2325
+ K.instance, t = !0;
2326
+ } catch {
2327
+ t = !1;
2328
+ }
2329
+ if (t)
2330
+ throw new Error(
2331
+ "AcApDiffViewer needs its own AcApDocManager. Create it on a page that does not already host a CAD viewer."
2332
+ );
2333
+ this.root = document.createElement("div"), this.root.className = "ml-diff-root", ce(this.uiTheme, this.root), this.toolbar = document.createElement("div"), this.toolbar.className = "ml-diff-toolbar", this.body = document.createElement("div"), this.body.className = "ml-diff-body", this.panesHost = document.createElement("div"), this.panesHost.className = "ml-diff-panes", this.leftUi = this.createPane("left"), this.rightUi = this.createPane("right"), this.panesHost.append(this.leftUi.pane, this.rightUi.pane);
2334
+ const i = this.createChrome();
2335
+ this.btnSideBySide = i.btnSideBySide, this.btnOverlay = i.btnOverlay, this.btnSyncViews = i.btnSyncViews, this.btnTogglePanel = i.btnTogglePanel, this.btnPrev = i.btnPrev, this.btnNext = i.btnNext, this.btnSettings = i.btnSettings, this.btnMarkupVis = i.btnMarkupVis, this.btnClearMarkups = i.btnClearMarkups, this.btnTheme = i.btnTheme, this.sidePanel = i.sidePanel, this.resultsBody = i.resultsBody, this.markupsBody = i.markupsBody, this.tabResults = i.tabResults, this.tabMarkups = i.tabMarkups, this.groupByKindBtn = i.groupByKindBtn, this.groupByTypeBtn = i.groupByTypeBtn, this.panelTitle = i.panelTitle, this.localeTrigger = i.localeTrigger, this.localeMenu = i.localeMenu, this.localeSelectHost = i.localeSelectHost, this.diffPopover = document.createElement("div"), this.diffPopover.className = "ml-diff-change-popover", this.diffPopover.hidden = !0, this.diffPopover.setAttribute("role", "tooltip"), this.diffPopover.addEventListener("mouseenter", this.cancelDiffPopoverHide), this.diffPopover.addEventListener("mouseleave", this.scheduleDiffPopoverHide), this.toolbar.append(...i.toolbarChildren), this.body.append(this.panesHost, this.sidePanel), this.root.append(this.toolbar, this.body, this.diffPopover), e.container.appendChild(this.root);
2336
+ const n = e.openDocumentDefaults ?? ve;
2337
+ K.createInstance({
2338
+ container: this.leftUi.canvas,
2339
+ busyIndicatorHost: this.leftUi.canvas,
2340
+ autoResize: !0,
2341
+ baseUrl: e.baseUrl,
2342
+ builtinOpenFileDialog: !1,
2343
+ openDocumentDefaults: n,
2344
+ webworkerFileUrls: e.webworkerFileUrls
2345
+ });
2346
+ const o = K.instance;
2347
+ this.disableEntitySelection(o.mainView), this.disableEntitySelection(o.ensureSplitView(this.rightUi.canvas)), this.bindViewSyncListeners(), L.events.localeChanged.addEventListener(this.handleLocaleChanged), document.addEventListener("pointerdown", this.handleDocumentPointerDown), this.resultsBody.addEventListener("scroll", this.handleDiffPopoverDismiss), window.addEventListener("resize", this.handleDiffPopoverDismiss), this.syncChrome(), this.syncViewModeUi(), this.syncPanelUi(), this.syncCompareColorVars();
2348
+ }
2349
+ /** Drawing currently shown in the left pane, if still live. */
2350
+ get leftDocument() {
2351
+ return this.liveDoc(this.leftDoc);
2352
+ }
2353
+ /** Drawing currently shown in the right pane, if still live. */
2354
+ get rightDocument() {
2355
+ return this.liveDoc(this.rightDoc);
2356
+ }
2357
+ /** Pane that currently owns commands (the active {@link AcApDocManager} document). */
2358
+ get activeSide() {
2359
+ return w().curDocument === this.rightDocument ? "right" : "left";
2360
+ }
2361
+ /** Last compare result, or `undefined` until both panes have drawings. */
2362
+ get compareResultSnapshot() {
2363
+ return this.compareResult;
2364
+ }
2365
+ /**
2366
+ * Opens a drawing into one pane from in-memory file content.
2367
+ *
2368
+ * @param side - Target pane.
2369
+ * @param fileName - File name used for format detection and the pane title.
2370
+ * @param content - DWG/DXF bytes.
2371
+ * @param options - Optional open options; falls back to construction defaults.
2372
+ * @returns `true` when the document opened successfully.
2373
+ */
2374
+ async openDocument(e, t, i, n) {
2375
+ var f, p, u, h;
2376
+ this.assertAlive();
2377
+ const o = w(), s = this.viewMode === "overlay";
2378
+ s && await this.exitOverlayMode();
2379
+ const r = e === "left" ? this.leftDoc : this.rightDoc, d = e === "left" ? this.rightDoc : this.leftDoc;
2380
+ if (r && o.sessionFor(r) && !r.isReusableUntitled && r !== d && await o.closeDocument(r), this.uiFor(e).empty.classList.add("is-hidden"), this.clearPaneError(e), !await o.openDocument(
2381
+ t,
2382
+ i,
2383
+ n ?? this.options.openDocumentDefaults ?? ve,
2384
+ this.viewFor(e)
2385
+ ))
2386
+ return (p = (f = this.options.events) == null ? void 0 : f.failed) == null || p.call(f, e, t), this.syncChrome(), s && (await this.enterOverlayMode(), this.syncViewModeUi()), !1;
2387
+ const l = o.curDocument;
2388
+ return e === "left" ? this.leftDoc = l : this.rightDoc = l, this.adoptCompareSysVarsAfterOpen(l, !!this.liveDoc(d)), this.syncChrome(), (h = (u = this.options.events) == null ? void 0 : u.opened) == null || h.call(u, e, l), this.syncFollowerAfterOpen(e), this.applyMarkupVisibility(Y()), await this.runCompareAndApply(), !0;
2389
+ }
2390
+ /**
2391
+ * Makes `side` the command target without changing which canvas shows which drawing.
2392
+ *
2393
+ * @param side - Pane to activate.
2394
+ * @returns `false` when that pane has no live document.
2395
+ */
2396
+ async activateSide(e) {
2397
+ this.assertAlive();
2398
+ const t = e === "left" ? this.leftDocument : this.rightDocument;
2399
+ if (!t) return !1;
2400
+ if (w().curDocument === t)
2401
+ return this.applyFocusClass(e), !0;
2402
+ const n = ++this.activateSeq, o = async () => {
2403
+ var l, f;
2404
+ if (this.disposed || n !== this.activateSeq) return !1;
2405
+ const r = e === "left" ? this.leftDocument : this.rightDocument;
2406
+ if (!r) return !1;
2407
+ const d = w();
2408
+ if (d.curDocument === r)
2409
+ return this.applyFocusClass(e), !0;
2410
+ const c = await d.activateDocument(r);
2411
+ return this.disposed || n !== this.activateSeq ? (this.disposed || this.syncFocusRings(), !1) : (this.applyFocusClass(e), this.refreshMarkupsList(), c && ((f = (l = this.options.events) == null ? void 0 : l.focus) == null || f.call(l, e)), c);
2412
+ }, s = this.activateTail.then(o, o);
2413
+ return this.activateTail = s.then(
2414
+ () => {
2415
+ },
2416
+ () => {
2417
+ }
2418
+ ), s;
2419
+ }
2420
+ /**
2421
+ * Switches between side-by-side canvases and a single overlay canvas.
2422
+ *
2423
+ * @param mode - Target view mode.
2424
+ */
2425
+ async setViewMode(e) {
2426
+ this.assertAlive(), e !== this.viewMode && (e === "overlay" ? await this.enterOverlayMode() : await this.exitOverlayMode(), this.viewMode = e, this.syncViewModeUi(), e === "side-by-side" && this.applyViewSyncFromLeader(), await this.applyCompareDisplay(), window.dispatchEvent(new Event("resize")));
2427
+ }
2428
+ /**
2429
+ * Expands or collapses the compare-results side panel.
2430
+ *
2431
+ * @param open - `true` to show the panel.
2432
+ */
2433
+ setSidePanelOpen(e) {
2434
+ this.sidePanelOpen = e, this.syncPanelUi(), window.dispatchEvent(new Event("resize"));
2435
+ }
2436
+ /**
2437
+ * Moves the current difference by `delta` entries in the navigation list.
2438
+ *
2439
+ * @param delta - Typically `-1` (previous) or `1` (next).
2440
+ */
2441
+ async goToDifference(e) {
2442
+ var o;
2443
+ const t = ((o = this.compareResult) == null ? void 0 : o.navigation) ?? [];
2444
+ if (t.length === 0) return;
2445
+ let i;
2446
+ if (this.navIndex < 0)
2447
+ if (e > 0) i = 0;
2448
+ else if (e < 0) i = t.length - 1;
2449
+ else return;
2450
+ else if (i = this.navIndex + e, i < 0 || i >= t.length) return;
2451
+ this.navIndex = i;
2452
+ const n = t[this.navIndex];
2453
+ this.collapsedResultGroups.delete(this.resultGroupStorageKeyForHit(n)), await this.focusHit(n), this.renderResultsList();
2454
+ }
2455
+ /**
2456
+ * Tears down the widget, document manager, and injected DOM.
2457
+ * Safe to call more than once.
2458
+ */
2459
+ async destroy() {
2460
+ if (!this.disposed) {
2461
+ this.disposed = !0, this.compareSeq++, this.overlayRegisterSeq++, this.clearSysVarPreviewTimer(), G.dismiss(), L.events.localeChanged.removeEventListener(this.handleLocaleChanged), document.removeEventListener("pointerdown", this.handleDocumentPointerDown), this.resultsBody.removeEventListener("scroll", this.handleDiffPopoverDismiss), window.removeEventListener("resize", this.handleDiffPopoverDismiss), this.hideDiffPopover(!0), this.unbindViewSyncListeners();
2462
+ for (const e of this.bannerTimers.values())
2463
+ window.clearTimeout(e);
2464
+ this.bannerTimers.clear();
2465
+ try {
2466
+ this.overlayId && w().removeOverlay(this.overlayId), await K.instance.destroy();
2467
+ } catch {
2468
+ }
2469
+ this.root.remove();
2470
+ }
2471
+ }
2472
+ /**
2473
+ * Builds the toolbar, side panel, and their event bindings.
2474
+ *
2475
+ * @returns Chrome nodes assigned onto class fields by the constructor.
2476
+ */
2477
+ createChrome() {
2478
+ const e = document.createElement("div");
2479
+ e.className = "ml-diff-toolbar-group";
2480
+ const t = document.createElement("button");
2481
+ t.type = "button", t.className = "ml-diff-tool-btn is-icon", t.innerHTML = It;
2482
+ const i = document.createElement("button");
2483
+ i.type = "button", i.className = "ml-diff-tool-btn is-icon", i.innerHTML = Bt;
2484
+ const n = document.createElement("button");
2485
+ n.type = "button", n.className = "ml-diff-tool-btn is-icon ml-diff-sync-btn", n.innerHTML = _t, e.append(t, i, n);
2486
+ const o = document.createElement("div");
2487
+ o.className = "ml-diff-toolbar-group";
2488
+ const s = document.createElement("button");
2489
+ s.type = "button", s.className = "ml-diff-tool-btn is-icon", s.innerHTML = Ft;
2490
+ const r = document.createElement("button");
2491
+ r.type = "button", r.className = "ml-diff-tool-btn", r.textContent = "◀", r.disabled = !0;
2492
+ const d = document.createElement("button");
2493
+ d.type = "button", d.className = "ml-diff-tool-btn", d.textContent = "▶", d.disabled = !0, o.append(s, r, d);
2494
+ const c = document.createElement("div");
2495
+ c.className = "ml-diff-toolbar-group";
2496
+ const l = document.createElement("button");
2497
+ l.type = "button", l.className = "ml-diff-tool-btn is-icon", l.dataset.labelKey = "markupGenerateClouds", l.disabled = !0, l.innerHTML = Kt, l.addEventListener("click", () => {
2498
+ this.generateCompareCloudMarkups();
2499
+ }), this.markupButtons.push(l), c.appendChild(l);
2500
+ for (const E of Jt) {
2501
+ const N = document.createElement("button");
2502
+ N.type = "button", N.className = "ml-diff-tool-btn is-icon", N.dataset.command = E.command, N.dataset.labelKey = E.labelKey, N.innerHTML = E.icon, N.addEventListener("click", () => {
2503
+ this.runMarkupCommand(E.command);
2504
+ }), this.markupButtons.push(N), c.appendChild(N);
2505
+ }
2506
+ const f = document.createElement("button");
2507
+ f.type = "button", f.className = "ml-diff-tool-btn is-icon", f.addEventListener("click", () => {
2508
+ this.toggleMarkupVisibility();
2509
+ }), c.appendChild(f);
2510
+ const p = document.createElement("button");
2511
+ p.type = "button", p.className = "ml-diff-tool-btn is-icon", p.dataset.labelKey = "markupClear", p.innerHTML = He, p.addEventListener("click", () => {
2512
+ this.clearAllMarkups();
2513
+ }), this.markupButtons.push(p), c.appendChild(p);
2514
+ const u = this.createLanguageSelect(), h = document.createElement("button");
2515
+ h.type = "button", h.className = "ml-diff-tool-btn is-icon", h.innerHTML = jt;
2516
+ const g = document.createElement("button");
2517
+ g.type = "button", g.className = "ml-diff-tool-btn is-icon", u.group.prepend(h, g), t.addEventListener("click", () => {
2518
+ this.setViewMode("side-by-side");
2519
+ }), i.addEventListener("click", () => {
2520
+ this.setViewMode("overlay");
2521
+ }), n.addEventListener("click", () => {
2522
+ this.setViewsSynced(!this.viewsSynced);
2523
+ }), s.addEventListener("click", () => {
2524
+ this.setSidePanelOpen(!this.sidePanelOpen);
2525
+ }), r.addEventListener("click", () => {
2526
+ this.goToDifference(-1);
2527
+ }), d.addEventListener("click", () => {
2528
+ this.goToDifference(1);
2529
+ }), h.addEventListener("click", () => {
2530
+ this.openSettings();
2531
+ }), g.addEventListener("click", () => {
2532
+ this.setUiTheme(this.uiTheme === "dark" ? "light" : "dark");
2533
+ });
2534
+ const b = document.createElement("aside");
2535
+ b.className = "ml-diff-sidepanel";
2536
+ const k = document.createElement("div");
2537
+ k.className = "ml-diff-sidepanel-header";
2538
+ const A = document.createElement("div");
2539
+ A.className = "ml-diff-sidepanel-title";
2540
+ const M = document.createElement("button");
2541
+ M.type = "button", M.className = "ml-diff-tool-btn", M.textContent = "×", M.addEventListener("click", () => this.setSidePanelOpen(!1)), k.append(A, M);
2542
+ const z = document.createElement("div");
2543
+ z.className = "ml-diff-sidepanel-tabs";
2544
+ const I = document.createElement("button");
2545
+ I.type = "button", I.className = "ml-diff-sidepanel-tab is-active";
2546
+ const V = document.createElement("button");
2547
+ V.type = "button", V.className = "ml-diff-sidepanel-tab", z.append(I, V), I.addEventListener("click", () => {
2548
+ this.activeTab = "results", this.syncPanelUi();
2549
+ }), V.addEventListener("click", () => {
2550
+ this.activeTab = "markups", this.syncPanelUi(), this.refreshMarkupsList();
2551
+ });
2552
+ const U = document.createElement("div");
2553
+ U.className = "ml-diff-sidepanel-toolbar";
2554
+ const _ = document.createElement("button");
2555
+ _.type = "button", _.className = "ml-diff-tool-btn is-active";
2556
+ const y = document.createElement("button");
2557
+ y.type = "button", y.className = "ml-diff-tool-btn", U.append(_, y), _.addEventListener("click", () => {
2558
+ this.resultGroupMode = "kind", this.renderResultsList(), this.syncPanelUi();
2559
+ }), y.addEventListener("click", () => {
2560
+ this.resultGroupMode = "type", this.renderResultsList(), this.syncPanelUi();
2561
+ });
2562
+ const x = document.createElement("div");
2563
+ x.className = "ml-diff-sidepanel-body";
2564
+ const T = document.createElement("div");
2565
+ return T.className = "ml-diff-sidepanel-body", T.hidden = !0, b.append(k, z, U, x, T), {
2566
+ toolbarChildren: [e, o, c, u.group],
2567
+ btnSideBySide: t,
2568
+ btnOverlay: i,
2569
+ btnSyncViews: n,
2570
+ btnTogglePanel: s,
2571
+ btnPrev: r,
2572
+ btnNext: d,
2573
+ btnSettings: h,
2574
+ btnGenerateClouds: l,
2575
+ btnMarkupVis: f,
2576
+ btnClearMarkups: p,
2577
+ btnTheme: g,
2578
+ sidePanel: b,
2579
+ resultsBody: x,
2580
+ markupsBody: T,
2581
+ tabResults: I,
2582
+ tabMarkups: V,
2583
+ groupByKindBtn: _,
2584
+ groupByTypeBtn: y,
2585
+ panelTitle: A,
2586
+ closeBtn: M,
2587
+ localeTrigger: u.trigger,
2588
+ localeMenu: u.menu,
2589
+ localeSelectHost: u.host
2590
+ };
2591
+ }
2592
+ /**
2593
+ * Builds the far-right language select (compact dropdown like cad-viewer ribbon).
2594
+ */
2595
+ createLanguageSelect() {
2596
+ const e = document.createElement("div");
2597
+ e.className = "ml-diff-toolbar-group ml-diff-toolbar-locale";
2598
+ const t = document.createElement("div");
2599
+ t.className = "ml-diff-lang-select";
2600
+ const i = document.createElement("button");
2601
+ i.type = "button", i.className = "ml-diff-lang-select__trigger", i.setAttribute("aria-haspopup", "listbox"), i.setAttribute("aria-expanded", "false");
2602
+ const n = document.createElement("span");
2603
+ n.className = "ml-diff-lang-select__label", i.append(n), i.insertAdjacentHTML("beforeend", Qt), i.addEventListener("click", (s) => {
2604
+ s.stopPropagation(), this.setLocaleMenuOpen(!this.localeMenuOpen);
2605
+ });
2606
+ const o = document.createElement("div");
2607
+ o.className = "ml-diff-lang-select__menu", o.setAttribute("role", "listbox"), o.hidden = !0;
2608
+ for (const s of Ee) {
2609
+ const r = document.createElement("button");
2610
+ r.type = "button", r.className = "ml-diff-lang-select__option", r.setAttribute("role", "option"), r.dataset.locale = s.locale, r.textContent = s.label, r.addEventListener("click", (d) => {
2611
+ d.stopPropagation(), this.setLocaleMenuOpen(!1), s.locale !== L.currentLocale && (L.setCurrentLocale(s.locale), document.documentElement.lang = s.locale);
2612
+ }), o.appendChild(r);
2613
+ }
2614
+ return t.append(i, o), e.appendChild(t), { group: e, host: t, trigger: i, menu: o };
2615
+ }
2616
+ /** Opens or closes the language dropdown. */
2617
+ setLocaleMenuOpen(e) {
2618
+ this.localeMenuOpen = e, this.localeMenu.hidden = !e, this.localeTrigger.setAttribute("aria-expanded", String(e)), this.localeSelectHost.classList.toggle("is-open", e);
2619
+ }
2620
+ /** Highlights the active locale and refreshes the trigger label. */
2621
+ syncLocaleSelect() {
2622
+ const e = L.currentLocale, t = this.localeTrigger.querySelector(".ml-diff-lang-select__label");
2623
+ t && (t.textContent = ei(e)), this.localeTrigger.title = m("toolbarLanguage"), this.localeTrigger.setAttribute(
2624
+ "aria-label",
2625
+ m("toolbarLanguage")
2626
+ ), this.localeMenu.querySelectorAll(".ml-diff-lang-select__option").forEach((i) => {
2627
+ const n = i.dataset.locale === e;
2628
+ i.classList.toggle("is-selected", n), i.setAttribute("aria-selected", String(n));
2629
+ });
2630
+ }
2631
+ /**
2632
+ * Builds one pane (header, canvas slot, empty state, drop target).
2633
+ *
2634
+ * @param side - Which pane to create.
2635
+ */
2636
+ createPane(e) {
2637
+ const t = document.createElement("section");
2638
+ t.className = "ml-diff-pane", t.dataset.side = e, e === "left" && t.classList.add("is-focused");
2639
+ const i = document.createElement("header");
2640
+ i.className = "ml-diff-header";
2641
+ const n = document.createElement("span");
2642
+ n.className = "ml-diff-title is-empty";
2643
+ const o = document.createElement("button");
2644
+ o.type = "button", o.className = "ml-diff-open", o.appendChild($t());
2645
+ const s = document.createElement("input");
2646
+ s.type = "file", s.className = "ml-diff-file-input", s.accept = ".dwg,.dxf,application/acad,application/dxf", s.tabIndex = -1, i.append(n, o, s);
2647
+ const r = document.createElement("div");
2648
+ r.className = "ml-diff-canvas-slot";
2649
+ const d = document.createElement("div");
2650
+ d.className = "ml-diff-canvas";
2651
+ const c = document.createElement("div");
2652
+ c.className = "ml-diff-empty";
2653
+ const l = document.createElement("div");
2654
+ l.className = "ml-diff-empty-card";
2655
+ const f = document.createElement("div");
2656
+ f.className = "ml-diff-empty-title";
2657
+ const p = document.createElement("div");
2658
+ p.className = "ml-diff-empty-hint";
2659
+ const u = document.createElement("div");
2660
+ u.className = "ml-diff-empty-error is-hidden", l.append(Xt(), f, p, u), c.appendChild(l);
2661
+ const h = document.createElement("div");
2662
+ return h.className = "ml-diff-banner is-hidden", r.append(d, c, h), t.append(i, r), t.addEventListener("pointerenter", () => {
2663
+ this.activateSideOnHover(e);
2664
+ }), t.addEventListener("pointerdown", () => {
2665
+ this.lastPointerSide = e, this.applyFocusClass(e), this.activateSideAndResumeMarkup(e);
2666
+ }), t.addEventListener("click", (g) => {
2667
+ if (this.documentFor(e)) return;
2668
+ const b = g.target;
2669
+ b != null && b.closest(".ml-diff-open") || this.pickFile(e);
2670
+ }), o.addEventListener("click", (g) => {
2671
+ g.preventDefault(), g.stopPropagation(), this.pickFile(e);
2672
+ }), s.addEventListener("change", () => {
2673
+ var b;
2674
+ const g = (b = s.files) == null ? void 0 : b[0];
2675
+ s.value = "", g && this.openLocalFile(e, g);
2676
+ }), t.addEventListener("dragenter", (g) => {
2677
+ g.preventDefault(), this.changeDragDepth(e, 1);
2678
+ }), t.addEventListener("dragover", (g) => {
2679
+ g.preventDefault(), g.dataTransfer && (g.dataTransfer.dropEffect = "copy");
2680
+ }), t.addEventListener("dragleave", (g) => {
2681
+ g.preventDefault(), this.changeDragDepth(e, -1);
2682
+ }), t.addEventListener("drop", (g) => {
2683
+ var k, A;
2684
+ g.preventDefault(), this.resetDragDepth(e);
2685
+ const b = (A = (k = g.dataTransfer) == null ? void 0 : k.files) == null ? void 0 : A[0];
2686
+ b && this.openLocalFile(e, b);
2687
+ }), {
2688
+ pane: t,
2689
+ canvas: d,
2690
+ title: n,
2691
+ empty: c,
2692
+ emptyTitle: f,
2693
+ emptyHint: p,
2694
+ emptyError: u,
2695
+ banner: h,
2696
+ openButton: o,
2697
+ fileInput: s
2698
+ };
2699
+ }
2700
+ /**
2701
+ * Activates `side` when the pointer enters the pane in side-by-side mode.
2702
+ *
2703
+ * If a markup command is already running on the other pane, it is cancelled
2704
+ * by document activation and restarted on this pane so the tool follows
2705
+ * the pointer.
2706
+ */
2707
+ activateSideOnHover(e) {
2708
+ this.disposed || this.viewMode === "side-by-side" && (this.lastPointerSide = e, this.applyFocusClass(e), this.activateSideAndResumeMarkup(e));
2709
+ }
2710
+ /**
2711
+ * Makes `side` the command target. When a markup tool is in progress on the
2712
+ * other document, re-issues it after the switch so drawing can continue here.
2713
+ */
2714
+ async activateSideAndResumeMarkup(e) {
2715
+ if (this.disposed || !this.documentFor(e)) return;
2716
+ let t;
2717
+ try {
2718
+ const n = w();
2719
+ n.commandManager.activeCommand && this.lastMarkupCommand && n.curDocument !== this.documentFor(e) && (t = this.lastMarkupCommand);
2720
+ } catch {
2721
+ return;
2722
+ }
2723
+ !await this.activateSide(e) || this.disposed || this.lastPointerSide === e && (this.applyFocusClass(e), t && w().sendStringToExecute(t));
2724
+ }
2725
+ /** Opens the hidden file picker for `side`. */
2726
+ pickFile(e) {
2727
+ this.uiFor(e).fileInput.click();
2728
+ }
2729
+ /**
2730
+ * Opens a local `File` into `side`, showing an error for non-drawing files.
2731
+ *
2732
+ * @param side - Target pane.
2733
+ * @param file - User-selected file.
2734
+ */
2735
+ async openLocalFile(e, t) {
2736
+ if (!ni(t.name)) {
2737
+ this.showPaneError(e, m("invalidFile"));
2738
+ return;
2739
+ }
2740
+ await this.openDocument(e, t.name, await t.arrayBuffer());
2741
+ }
2742
+ /**
2743
+ * Runs a markup command against the active pane's document.
2744
+ *
2745
+ * @param command - Registered command name (e.g. `markupcloud`).
2746
+ */
2747
+ async runMarkupCommand(e) {
2748
+ const t = w(), i = this.viewMode === "side-by-side" ? this.lastPointerSide : "left";
2749
+ !this.documentFor(i) || (this.lastMarkupCommand = e, !await this.activateSide(i)) || (this.applyFocusClass(i), t.sendStringToExecute(e));
2750
+ }
2751
+ /**
2752
+ * Creates built-in markup clouds around the current compare change sets.
2753
+ *
2754
+ * Overlay mode commits every set onto the left drawing. Side-by-side commits
2755
+ * left-hit sets on the left pane and right-hit sets on the right pane.
2756
+ * Clouds previously generated this way are replaced.
2757
+ */
2758
+ async generateCompareCloudMarkups() {
2759
+ var i;
2760
+ if (this.disposed) return;
2761
+ const e = (i = this.compareResult) == null ? void 0 : i.changeSets;
2762
+ if (!(e != null && e.length)) return;
2763
+ this.viewMode === "overlay" ? await this.commitChangeSetClouds("left", e) : (await this.commitChangeSetClouds(
2764
+ "left",
2765
+ e.filter((n) => n.hasLeft)
2766
+ ), await this.commitChangeSetClouds(
2767
+ "right",
2768
+ e.filter((n) => n.hasRight)
2769
+ )), this.disposed || this.refreshMarkupsList();
2770
+ }
2771
+ /**
2772
+ * Shows or hides markup overlays on every open pane.
2773
+ *
2774
+ * The session flag in cad-simple-viewer is global; both canvases are
2775
+ * updated so side-by-side views stay in sync.
2776
+ */
2777
+ toggleMarkupVisibility() {
2778
+ this.disposed || !this.leftDocument && !this.rightDocument || (this.applyMarkupVisibility(!Y()), this.syncMarkupVisibilityButton());
2779
+ }
2780
+ /**
2781
+ * Applies markup-layer visibility to each pane that currently has a drawing.
2782
+ *
2783
+ * @param visible - Whether committed and live markup overlays should show.
2784
+ */
2785
+ applyMarkupVisibility(e) {
2786
+ this.leftDocument && fe(this.viewFor("left"), e), this.rightDocument && fe(this.viewFor("right"), e);
2787
+ }
2788
+ /**
2789
+ * Clears Design Review markups on both open drawings (current layout).
2790
+ */
2791
+ async clearAllMarkups() {
2792
+ if (!this.disposed) {
2793
+ for (const e of ["left", "right"]) {
2794
+ if (!this.documentFor(e) || !await this.activateSide(e) || this.disposed) continue;
2795
+ const i = this.viewFor(e);
2796
+ me().clearLayout(i, i.activeLayoutBtrId, {
2797
+ clearStore: !0
2798
+ });
2799
+ }
2800
+ this.disposed || this.refreshMarkupsList();
2801
+ }
2802
+ }
2803
+ /**
2804
+ * Replaces previous compare-generated clouds on `side` with one markup
2805
+ * cloud per change set.
2806
+ *
2807
+ * @param side - Document session that receives the clouds.
2808
+ * @param sets - Change sets whose extents become cloud AABBs.
2809
+ */
2810
+ async commitChangeSetClouds(e, t) {
2811
+ if (!await this.activateSide(e) || this.disposed) return;
2812
+ const n = w(), o = this.viewFor(e), s = n.context;
2813
+ Le(o, "Create Markup", () => {
2814
+ const r = Ae(), d = me();
2815
+ for (const c of r.list())
2816
+ c.type !== "cloud" || c.comment !== ke || (d.unpublish(o, c.id, { keepInStore: !0 }), r.removeRecord(c.id));
2817
+ for (const c of t) {
2818
+ const l = c.extents;
2819
+ if (l.maxX <= l.minX && l.maxY <= l.minY) continue;
2820
+ const f = Re("cloud", o, s, {
2821
+ comment: ke
2822
+ }), p = F(
2823
+ this.colors[ot(c)]
2824
+ ), u = {
2825
+ ...f,
2826
+ type: "cloud",
2827
+ style: { ...f.style, color: p },
2828
+ geometry: {
2829
+ type: "cloud",
2830
+ corner1: { x: l.minX, y: l.minY },
2831
+ corner2: { x: l.maxX, y: l.maxY }
2832
+ }
2833
+ };
2834
+ r.upsert(u), d.publish(o, u);
2835
+ }
2836
+ });
2837
+ }
2838
+ /**
2839
+ * Opens the compare settings dialog. Edits preview live; Cancel restores
2840
+ * the colors and COMPARE sysvars that were in effect when the dialog opened.
2841
+ */
2842
+ async openSettings() {
2843
+ if (this.disposed) return;
2844
+ const e = { ...this.colors }, t = { ...this.sessionSysVars }, i = await G.open({
2845
+ host: document.body,
2846
+ theme: this.uiTheme,
2847
+ colors: this.colors,
2848
+ sysVars: this.sessionSysVars,
2849
+ onChange: (n) => {
2850
+ if (this.disposed) return;
2851
+ this.applyCompareColors(n.colors), JSON.stringify(n.sysVars) !== JSON.stringify(this.sessionSysVars) && this.scheduleCompareSysVars(n.sysVars);
2852
+ }
2853
+ });
2854
+ if (!this.disposed) {
2855
+ if (!i.confirmed) {
2856
+ this.applyCompareColors(e), this.flushCompareSysVars(t);
2857
+ return;
2858
+ }
2859
+ this.flushCompareSysVars(i.sysVars);
2860
+ }
2861
+ }
2862
+ /**
2863
+ * Adopts COMPARE sysvars after a pane opens a drawing.
2864
+ *
2865
+ * Drawing-saved variables are read from the new file when the other pane is
2866
+ * empty. When a comparison is already in progress, the current session is
2867
+ * written onto the new drawing so both panes stay in sync.
2868
+ *
2869
+ * @param doc - Newly opened document.
2870
+ * @param otherIsOpen - True when the opposite pane already has a drawing.
2871
+ */
2872
+ adoptCompareSysVarsAfterOpen(e, t) {
2873
+ t || (this.sessionSysVars = pt(e.database)), ue(this.sessionSysVars, [e.database]);
2874
+ }
2875
+ /** Cancels a pending Settings sysvar preview timer. */
2876
+ clearSysVarPreviewTimer() {
2877
+ this.sysVarPreviewTimer && (window.clearTimeout(this.sysVarPreviewTimer), this.sysVarPreviewTimer = 0);
2878
+ }
2879
+ /**
2880
+ * Debounces COMPARE sysvar live preview so slider drags do not re-compare
2881
+ * (and re-register the overlay) on every tick.
2882
+ *
2883
+ * @param sysVars - Draft values from the settings dialog.
2884
+ */
2885
+ scheduleCompareSysVars(e) {
2886
+ this.clearSysVarPreviewTimer();
2887
+ const t = { ...e };
2888
+ this.sysVarPreviewTimer = window.setTimeout(() => {
2889
+ this.sysVarPreviewTimer = 0, !this.disposed && this.applyCompareSysVars(t);
2890
+ }, Zt);
2891
+ }
2892
+ /**
2893
+ * Applies COMPARE sysvars immediately, dropping any pending preview timer.
2894
+ *
2895
+ * @param sysVars - Values to persist (OK flush or Cancel restore).
2896
+ */
2897
+ flushCompareSysVars(e) {
2898
+ this.clearSysVarPreviewTimer(), this.applyCompareSysVars(e);
2899
+ }
2900
+ /**
2901
+ * Persists COMPARE sysvars onto open drawings and re-runs the comparison.
2902
+ *
2903
+ * @param sysVars - Session values to apply.
2904
+ */
2905
+ applyCompareSysVars(e) {
2906
+ var n, o;
2907
+ const t = JSON.stringify(e) === JSON.stringify(this.sessionSysVars);
2908
+ this.sessionSysVars = { ...e };
2909
+ const i = [(n = this.leftDocument) == null ? void 0 : n.database, (o = this.rightDocument) == null ? void 0 : o.database].filter(
2910
+ (s) => s != null
2911
+ );
2912
+ ue(this.sessionSysVars, i), t || this.runCompareAndApply();
2913
+ }
2914
+ /**
2915
+ * Writes compare colors onto the widget and re-tints open drawings.
2916
+ *
2917
+ * @param colors - Full role-color set to apply.
2918
+ */
2919
+ applyCompareColors(e) {
2920
+ this.colors = { ...e }, this.syncCompareColorVars(), this.applyCompareDisplay();
2921
+ }
2922
+ /** Pushes role colors onto CSS custom properties used by the results list. */
2923
+ syncCompareColorVars() {
2924
+ this.root.style.setProperty(
2925
+ "--ml-diff-added",
2926
+ F(this.colors.added)
2927
+ ), this.root.style.setProperty(
2928
+ "--ml-diff-deleted",
2929
+ F(this.colors.deleted)
2930
+ ), this.root.style.setProperty(
2931
+ "--ml-diff-modified",
2932
+ F(this.colors.modified)
2933
+ );
2934
+ }
2935
+ /** Compares both panes when they have drawings, then applies display coloring. */
2936
+ async runCompareAndApply() {
2937
+ var o, s;
2938
+ const e = ++this.compareSeq, t = this.leftDocument, i = this.rightDocument;
2939
+ if (!t || !i) {
2940
+ if (this.compareResult = void 0, this.navIndex = -1, await this.clearCompareDisplay(), this.disposed || e !== this.compareSeq) return;
2941
+ this.renderResultsList(), this.syncToolbarButtons();
2942
+ return;
2943
+ }
2944
+ const n = Et(t.database, i.database, {
2945
+ compareProps: this.sessionSysVars.compareprops,
2946
+ compareHatch: this.sessionSysVars.comparehatch,
2947
+ compareText: this.sessionSysVars.comparetext,
2948
+ compareTolerance: this.sessionSysVars.comparetolerance,
2949
+ compareRcMargin: this.sessionSysVars.comparercmargin
2950
+ });
2951
+ this.disposed || e !== this.compareSeq || (this.compareResult = n, this.navIndex = -1, (s = (o = this.options.events) == null ? void 0 : o.compared) == null || s.call(o, this.compareResult), this.viewMode === "overlay" && await this.enterOverlayMode(), !(this.disposed || e !== this.compareSeq) && (await this.applyCompareDisplay(), !(this.disposed || e !== this.compareSeq) && (this.renderResultsList(), this.refreshMarkupsList(), this.syncToolbarButtons())));
2952
+ }
2953
+ /** Registers the right drawing as an overlay on the left canvas, hides the right pane, and focuses the left view. */
2954
+ async enterOverlayMode() {
2955
+ this.lastPointerSide = "left";
2956
+ const e = w(), t = this.rightDocument, i = ++this.overlayRegisterSeq;
2957
+ if (!t) {
2958
+ this.viewMode = "overlay", this.syncViewModeUi(), await this.activateSide("left");
2959
+ return;
2960
+ }
2961
+ this.overlayId && (e.removeOverlay(this.overlayId), this.overlayId = void 0);
2962
+ const n = await e.registerOverlayDatabase(t.database, {
2963
+ targetView: e.mainView
2964
+ });
2965
+ if (this.disposed || i !== this.overlayRegisterSeq) {
2966
+ try {
2967
+ e.removeOverlay(n);
2968
+ } catch {
2969
+ }
2970
+ return;
2971
+ }
2972
+ this.overlayId = n, this.rightUi.pane.style.display = "none", this.root.classList.add("is-overlay"), await this.activateSide("left");
2973
+ }
2974
+ /**
2975
+ * Removes the overlay and restores the right pane.
2976
+ * Does not change {@link viewMode}; callers that switch mode assign it themselves.
2977
+ */
2978
+ async exitOverlayMode() {
2979
+ this.overlayRegisterSeq++;
2980
+ const e = w();
2981
+ this.overlayId && (e.removeOverlay(this.overlayId), this.overlayId = void 0), this.rightUi.pane.style.display = "", this.root.classList.remove("is-overlay");
2982
+ }
2983
+ /**
2984
+ * Waits until left/right canvases finish entity conversion so compare
2985
+ * role overrides can bind to packed geometry slots.
2986
+ */
2987
+ async waitForCompareViewsIdle() {
2988
+ const e = w(), t = [e.mainView];
2989
+ e.splitView && t.push(e.splitView), await Promise.all(t.map((i) => i.waitUntilIdle()));
2990
+ }
2991
+ /** Turns off compare coloring on both canvases and any overlay. */
2992
+ async clearCompareDisplay() {
2993
+ const e = w();
2994
+ e.setCompareDisplay({ enabled: !1 }, e.mainView), e.splitView && e.setCompareDisplay({ enabled: !1 }, e.splitView), this.overlayId && e.setOverlayCompareDisplay(
2995
+ this.overlayId,
2996
+ { enabled: !1 },
2997
+ e.mainView
2998
+ );
2999
+ }
3000
+ /** Applies role-based compare colors for the current view mode. */
3001
+ async applyCompareDisplay() {
3002
+ const e = this.compareResult, t = w();
3003
+ if (!e || !this.leftDocument || !this.rightDocument) {
3004
+ await this.clearCompareDisplay();
3005
+ return;
3006
+ }
3007
+ if (await this.waitForCompareViewsIdle(), this.disposed || this.compareResult !== e || !this.leftDocument || !this.rightDocument)
3008
+ return;
3009
+ const i = {
3010
+ enabled: !0,
3011
+ baseColor: this.colors.unchanged,
3012
+ colors: {
3013
+ deleted: this.colors.deleted,
3014
+ added: this.colors.added,
3015
+ modified: this.colors.modified
3016
+ }
3017
+ }, n = e.deleted.filter((d) => d.side === "left").map((d) => d.objectId), o = e.added.filter((d) => d.side === "right").map((d) => d.objectId);
3018
+ if (this.viewMode === "overlay") {
3019
+ const d = [
3020
+ ...n.map((l) => ({
3021
+ objectId: l,
3022
+ role: "deleted"
3023
+ })),
3024
+ ...e.modified.filter((l) => l.side === "left").map((l) => ({ objectId: l.objectId, role: "deleted" }))
3025
+ ], c = [
3026
+ ...o.map((l) => ({
3027
+ objectId: l,
3028
+ role: "added"
3029
+ })),
3030
+ ...e.modified.filter((l) => l.side === "right").map((l) => ({ objectId: l.objectId, role: "added" }))
3031
+ ];
3032
+ t.setCompareDisplay({ enabled: !1 }, t.mainView), t.setCompareDisplay({ ...i, overrides: d }, t.mainView), this.overlayId && (t.setOverlayCompareDisplay(
3033
+ this.overlayId,
3034
+ { enabled: !1 },
3035
+ t.mainView
3036
+ ), t.setOverlayCompareDisplay(
3037
+ this.overlayId,
3038
+ { ...i, overrides: c },
3039
+ t.mainView
3040
+ ));
3041
+ return;
3042
+ }
3043
+ const s = [
3044
+ ...n.map((d) => ({
3045
+ objectId: d,
3046
+ role: "deleted"
3047
+ })),
3048
+ ...e.modified.filter((d) => d.side === "left").map((d) => ({
3049
+ objectId: d.objectId,
3050
+ role: "modified"
3051
+ }))
3052
+ ], r = [
3053
+ ...o.map((d) => ({
3054
+ objectId: d,
3055
+ role: "added"
3056
+ })),
3057
+ ...e.modified.filter((d) => d.side === "right").map((d) => ({
3058
+ objectId: d.objectId,
3059
+ role: "modified"
3060
+ }))
3061
+ ];
3062
+ t.setCompareDisplay({ enabled: !1 }, t.mainView), t.setCompareDisplay({ ...i, overrides: s }, t.mainView), t.splitView && (t.setCompareDisplay({ enabled: !1 }, t.splitView), t.setCompareDisplay(
3063
+ { ...i, overrides: r },
3064
+ t.splitView
3065
+ ));
3066
+ }
3067
+ /**
3068
+ * Zooms to a hit (and its pair, when modified).
3069
+ *
3070
+ * Drawing entities are not selected or highlighted; compare display
3071
+ * already tints deleted / added / modified geometry.
3072
+ *
3073
+ * @param hit - Navigation entry from {@link AcApDiffCompareResult}.
3074
+ */
3075
+ async focusHit(e) {
3076
+ const t = this.viewMode === "overlay" ? "left" : e.side;
3077
+ this.viewMode !== "overlay" && await this.activateSide(e.side);
3078
+ const i = this.viewFor(t);
3079
+ if (e.extents) {
3080
+ const n = new he();
3081
+ if (n.expandByPoint({ x: e.extents.minX, y: e.extents.minY }), n.expandByPoint({ x: e.extents.maxX, y: e.extents.maxY }), e.pairedId && e.kind === "modified" && this.compareResult) {
3082
+ const o = this.compareResult.modified.find(
3083
+ (s) => s.objectId === e.pairedId
3084
+ );
3085
+ o != null && o.extents && (n.expandByPoint({ x: o.extents.minX, y: o.extents.minY }), n.expandByPoint({ x: o.extents.maxX, y: o.extents.maxY }));
3086
+ }
3087
+ i.zoomTo(n, 1.5);
3088
+ }
3089
+ this.isViewSyncActive() && (this.viewSyncLeader = t, this.viewSyncFollowOpen = !1, this.copyVisibleView(t, t === "left" ? "right" : "left"));
3090
+ }
3091
+ /** Rebuilds the results list from {@link compareResult}. */
3092
+ renderResultsList() {
3093
+ this.hideDiffPopover(!0);
3094
+ const e = this.resultsBody;
3095
+ e.replaceChildren();
3096
+ const t = this.compareResult;
3097
+ if (!t || t.navigation.length === 0) {
3098
+ const s = document.createElement("div");
3099
+ s.className = "ml-diff-empty-list", s.textContent = m("noResults"), e.appendChild(s), this.syncToolbarButtons();
3100
+ return;
3101
+ }
3102
+ const i = /* @__PURE__ */ new Map(), n = (s, r) => {
3103
+ const d = i.get(s);
3104
+ d ? d.push(r) : i.set(s, [r]);
3105
+ };
3106
+ if (this.resultGroupMode === "kind") {
3107
+ for (const s of t.deleted) n("deleted", s);
3108
+ for (const s of t.modified.filter((r) => r.side === "left"))
3109
+ n("modified", s);
3110
+ for (const s of t.added) n("added", s);
3111
+ } else
3112
+ for (const s of t.navigation)
3113
+ n(s.dxfType || "UNKNOWN", s);
3114
+ const o = (s) => s === "added" ? m("kindAdded") : s === "deleted" ? m("kindDeleted") : s === "modified" ? m("kindModified") : s;
3115
+ for (const [s, r] of i) {
3116
+ const d = this.resultGroupStorageKey(s), c = document.createElement("details");
3117
+ c.className = "ml-diff-group", c.open = !this.collapsedResultGroups.has(d);
3118
+ const l = document.createElement("summary");
3119
+ l.className = "ml-diff-group-title", l.textContent = this.resultGroupMode === "kind" ? `${o(s)} (${r.length})` : `${s} (${r.length})`, c.appendChild(l), c.addEventListener("toggle", () => {
3120
+ c.open ? this.collapsedResultGroups.delete(d) : this.collapsedResultGroups.add(d), this.hideDiffPopover(!0);
3121
+ }), r.forEach((f) => {
3122
+ const p = document.createElement("div");
3123
+ p.className = "ml-diff-result-row", p.dataset.kind = f.kind;
3124
+ const u = t.navigation.indexOf(f);
3125
+ u === this.navIndex && p.classList.add("is-active");
3126
+ const h = document.createElement("button");
3127
+ h.type = "button", h.className = "ml-diff-result-item", h.dataset.kind = f.kind;
3128
+ const g = document.createElement("span");
3129
+ g.className = "ml-diff-result-label", g.textContent = `${f.dxfType} · ${f.objectId}`;
3130
+ const b = document.createElement("span");
3131
+ if (b.className = "ml-diff-result-meta", b.textContent = `${f.layer} · ${o(f.kind)}`, h.append(g, b), h.addEventListener("click", () => {
3132
+ this.navIndex = u >= 0 ? u : this.navIndex, this.focusHit(f), this.renderResultsList();
3133
+ }), p.appendChild(h), f.kind === "modified") {
3134
+ const k = document.createElement("button");
3135
+ k.type = "button", k.className = "ml-diff-result-info", k.innerHTML = Ht;
3136
+ const A = m("diffDetails");
3137
+ k.setAttribute("aria-label", A), k.setAttribute("aria-expanded", "false"), k.addEventListener("click", (M) => {
3138
+ M.preventDefault(), M.stopPropagation(), this.toggleDiffPopover(k, f);
3139
+ }), k.addEventListener("mouseenter", () => {
3140
+ this.showDiffPopover(k, f, !1);
3141
+ }), k.addEventListener("mouseleave", this.scheduleDiffPopoverHide), p.appendChild(k);
3142
+ }
3143
+ c.appendChild(p);
3144
+ }), e.appendChild(c);
3145
+ }
3146
+ this.syncToolbarButtons();
3147
+ }
3148
+ /** Pins or unpins the field-diff popover for a modified result row. */
3149
+ toggleDiffPopover(e, t) {
3150
+ if (this.diffPopoverAnchor === e && this.diffPopoverPinned) {
3151
+ this.hideDiffPopover(!0);
3152
+ return;
3153
+ }
3154
+ this.showDiffPopover(e, t, !0);
3155
+ }
3156
+ /**
3157
+ * Shows field-level old/new values next to `anchor`.
3158
+ *
3159
+ * @param pinned - When true, the popover stays until dismissed.
3160
+ */
3161
+ showDiffPopover(e, t, i) {
3162
+ var n;
3163
+ !i && this.diffPopoverPinned && this.diffPopoverAnchor !== e || (this.cancelDiffPopoverHide(), !(!i && this.diffPopoverPinned && this.diffPopoverAnchor === e && !this.diffPopover.hidden) && ((n = this.diffPopoverAnchor) == null || n.classList.remove("is-open"), this.diffPopoverAnchor = e, this.diffPopoverPinned = i, e.classList.toggle("is-open", i), e.setAttribute("aria-expanded", String(i)), this.renderDiffPopoverContent(t), this.positionDiffPopover(e), this.diffPopover.hidden = !1));
3164
+ }
3165
+ /** Hides the field-diff popover. Pass `true` to also clear a pinned state. */
3166
+ hideDiffPopover(e = !1) {
3167
+ var t, i;
3168
+ this.diffPopoverPinned && !e || (this.cancelDiffPopoverHide(), this.diffPopover.hidden = !0, this.diffPopoverPinned = !1, (t = this.diffPopoverAnchor) == null || t.classList.remove("is-open"), (i = this.diffPopoverAnchor) == null || i.setAttribute("aria-expanded", "false"), this.diffPopoverAnchor = void 0);
3169
+ }
3170
+ /** Fills {@link diffPopover} with a property / old / new table. */
3171
+ renderDiffPopoverContent(e) {
3172
+ const t = this.diffPopover;
3173
+ t.replaceChildren();
3174
+ const i = e.changes ?? [], n = i.filter(
3175
+ (l) => l.field !== "geometry" || l.oldValue || l.newValue
3176
+ );
3177
+ if (n.length === 0 && i.some((l) => l.field === "geometry") || n.length === 0) {
3178
+ const l = document.createElement("div");
3179
+ l.className = "ml-diff-change-note", l.textContent = m("diffGeometryChanged"), t.appendChild(l);
3180
+ return;
3181
+ }
3182
+ const s = document.createElement("table");
3183
+ s.className = "ml-diff-change-table";
3184
+ const r = document.createElement("thead"), d = document.createElement("tr");
3185
+ for (const l of ["diffColProperty", "diffColOld", "diffColNew"]) {
3186
+ const f = document.createElement("th");
3187
+ f.textContent = m(l), d.appendChild(f);
3188
+ }
3189
+ r.appendChild(d);
3190
+ const c = document.createElement("tbody");
3191
+ for (const l of n) {
3192
+ const f = document.createElement("tr"), p = document.createElement("th");
3193
+ p.scope = "row", p.textContent = ii(l.field);
3194
+ const u = document.createElement("td");
3195
+ u.className = "ml-diff-change-old", u.textContent = xe(l.field, l.oldValue);
3196
+ const h = document.createElement("td");
3197
+ h.className = "ml-diff-change-new", h.textContent = xe(l.field, l.newValue), f.append(p, u, h), c.appendChild(f);
3198
+ }
3199
+ s.append(r, c), t.appendChild(s);
3200
+ }
3201
+ /** Places the popover beside `anchor`, flipping when it would overflow. */
3202
+ positionDiffPopover(e) {
3203
+ const t = this.diffPopover;
3204
+ t.style.left = "0px", t.style.top = "0px", t.hidden = !1;
3205
+ const i = e.getBoundingClientRect(), n = t.getBoundingClientRect(), o = 8;
3206
+ let s = i.left - n.width - o, r = i.top;
3207
+ s < o && (s = Math.max(o, i.right - n.width), r = i.bottom + o), s + n.width > window.innerWidth - o && (s = Math.max(o, window.innerWidth - n.width - o)), r + n.height > window.innerHeight - o && (r = Math.max(o, window.innerHeight - n.height - o)), t.style.left = `${s}px`, t.style.top = `${r}px`;
3208
+ }
3209
+ /** Storage key for a results-list section in the current grouping mode. */
3210
+ resultGroupStorageKey(e) {
3211
+ return `${this.resultGroupMode}:${e}`;
3212
+ }
3213
+ /** Storage key of the section that contains `hit`. */
3214
+ resultGroupStorageKeyForHit(e) {
3215
+ const t = this.resultGroupMode === "kind" ? e.kind : e.dxfType || "UNKNOWN";
3216
+ return this.resultGroupStorageKey(t);
3217
+ }
3218
+ /** Rebuilds the markups list from both document sessions. */
3219
+ refreshMarkupsList() {
3220
+ const e = this.markupsBody;
3221
+ e.replaceChildren();
3222
+ const t = this.leftDocument, i = this.rightDocument, n = w(), o = [];
3223
+ if (t) {
3224
+ const s = n.sessionFor(t);
3225
+ if (s)
3226
+ for (const r of pe(s.id))
3227
+ o.push({ side: "left", record: r });
3228
+ }
3229
+ if (i) {
3230
+ const s = n.sessionFor(i);
3231
+ if (s)
3232
+ for (const r of pe(s.id))
3233
+ o.push({ side: "right", record: r });
3234
+ }
3235
+ if (o.length === 0) {
3236
+ const s = document.createElement("div");
3237
+ s.className = "ml-diff-empty-list", s.textContent = m("noMarkups"), e.appendChild(s);
3238
+ return;
3239
+ }
3240
+ for (const s of o) {
3241
+ const r = document.createElement("button");
3242
+ r.type = "button", r.className = "ml-diff-markup-item", r.textContent = s.record.type;
3243
+ const d = document.createElement("span");
3244
+ d.className = "ml-diff-markup-meta", d.textContent = s.side === "left" ? m("markupFromLeft") : m("markupFromRight"), r.appendChild(d), r.addEventListener("click", () => {
3245
+ this.activateSide(s.side);
3246
+ }), e.appendChild(r);
3247
+ }
3248
+ }
3249
+ /**
3250
+ * Shows a pane error in the empty card or a transient banner.
3251
+ *
3252
+ * @param side - Pane that owns the message.
3253
+ * @param message - Localized error text.
3254
+ */
3255
+ showPaneError(e, t) {
3256
+ const i = this.uiFor(e);
3257
+ if (this.documentFor(e)) {
3258
+ i.banner.textContent = t, i.banner.classList.remove("is-hidden");
3259
+ const n = this.bannerTimers.get(e);
3260
+ n && window.clearTimeout(n);
3261
+ const o = window.setTimeout(() => {
3262
+ i.banner.classList.add("is-hidden"), this.bannerTimers.delete(e);
3263
+ }, 3e3);
3264
+ this.bannerTimers.set(e, o);
3265
+ return;
3266
+ }
3267
+ i.emptyError.textContent = t, i.emptyError.classList.remove("is-hidden");
3268
+ }
3269
+ /** Hides empty-state and banner errors for `side`. */
3270
+ clearPaneError(e) {
3271
+ const t = this.uiFor(e);
3272
+ t.emptyError.textContent = "", t.emptyError.classList.add("is-hidden"), t.banner.textContent = "", t.banner.classList.add("is-hidden");
3273
+ const i = this.bannerTimers.get(e);
3274
+ i && (window.clearTimeout(i), this.bannerTimers.delete(e));
3275
+ }
3276
+ /**
3277
+ * Updates nested drag-over depth so the pane highlight survives child enter/leave.
3278
+ *
3279
+ * @param side - Pane receiving the drag event.
3280
+ * @param delta - `+1` on enter, `-1` on leave.
3281
+ */
3282
+ changeDragDepth(e, t) {
3283
+ e === "left" ? this.leftDragDepth = Math.max(0, this.leftDragDepth + t) : this.rightDragDepth = Math.max(0, this.rightDragDepth + t), this.uiFor(e).pane.classList.toggle(
3284
+ "is-dragover",
3285
+ (e === "left" ? this.leftDragDepth : this.rightDragDepth) > 0
3286
+ );
3287
+ }
3288
+ /** Clears drag-over state after a drop or cancelled drag. */
3289
+ resetDragDepth(e) {
3290
+ e === "left" ? this.leftDragDepth = 0 : this.rightDragDepth = 0, this.uiFor(e).pane.classList.remove("is-dragover");
3291
+ }
3292
+ /** Returns the pane UI for `side`. */
3293
+ uiFor(e) {
3294
+ return e === "left" ? this.leftUi : this.rightUi;
3295
+ }
3296
+ /** Live document for `side`, or `undefined` when that pane is empty. */
3297
+ documentFor(e) {
3298
+ return e === "left" ? this.leftDocument : this.rightDocument;
3299
+ }
3300
+ /**
3301
+ * Returns the canvas that should receive convert for `side`.
3302
+ *
3303
+ * Creates the split view on first use of the right pane.
3304
+ */
3305
+ viewFor(e) {
3306
+ const t = w(), i = e === "left" ? t.mainView : t.ensureSplitView(this.rightUi.canvas);
3307
+ return this.disableEntitySelection(i), i;
3308
+ }
3309
+ /** Turns off CAD entity pick, selection, and hover highlight on `view`. */
3310
+ disableEntitySelection(e) {
3311
+ e.entitySelectionEnabled = !1;
3312
+ }
3313
+ /** True when both panes should share the same camera. */
3314
+ isViewSyncActive() {
3315
+ return this.viewsSynced && this.viewMode === "side-by-side" && !!this.leftDocument && !!this.rightDocument;
3316
+ }
3317
+ /** Turns pan/zoom locking on or off. */
3318
+ setViewsSynced(e) {
3319
+ if (this.viewsSynced = e, this.viewSyncFollowOpen = !1, e) {
3320
+ const t = this.documentFor(this.lastPointerSide) ? this.lastPointerSide : "left";
3321
+ this.viewSyncLeader = t, this.applyViewSyncFromLeader();
3322
+ }
3323
+ this.syncViewModeUi();
3324
+ }
3325
+ /** Copies the leader pane's visible world box onto the follower. */
3326
+ applyViewSyncFromLeader() {
3327
+ if (!this.isViewSyncActive()) return;
3328
+ const e = this.documentFor(this.viewSyncLeader) ? this.viewSyncLeader : this.leftDocument ? "left" : "right";
3329
+ this.viewSyncLeader = e, this.copyVisibleView(e, e === "left" ? "right" : "left");
3330
+ }
3331
+ /**
3332
+ * After a pane opens, keep the already-open drawing's camera if sync is on.
3333
+ * Auto-fit on the new pane is ignored until the user pans or zooms.
3334
+ */
3335
+ syncFollowerAfterOpen(e) {
3336
+ const t = e === "left" ? "right" : "left";
3337
+ !this.isViewSyncActive() || !this.documentFor(t) || (this.viewSyncLeader = t, this.viewSyncFollowOpen = !0, this.copyVisibleView(t, e));
3338
+ }
3339
+ /** Subscribes to camera changes on both canvases. */
3340
+ bindViewSyncListeners() {
3341
+ try {
3342
+ const e = this.viewFor("left"), t = this.viewFor("right");
3343
+ e.events.viewChanged.addEventListener(this.handleLeftViewChanged), t.events.viewChanged.addEventListener(this.handleRightViewChanged);
3344
+ } catch {
3345
+ return;
3346
+ }
3347
+ for (const e of [this.leftUi.canvas, this.rightUi.canvas])
3348
+ e.addEventListener("pointerdown", this.markViewSyncUserInput, !0), e.addEventListener("wheel", this.markViewSyncUserInput, {
3349
+ capture: !0,
3350
+ passive: !0
3351
+ });
3352
+ }
3353
+ /** Drops camera-sync listeners. Safe if the manager is already gone. */
3354
+ unbindViewSyncListeners() {
3355
+ for (const e of [this.leftUi.canvas, this.rightUi.canvas])
3356
+ e.removeEventListener("pointerdown", this.markViewSyncUserInput, !0), e.removeEventListener("wheel", this.markViewSyncUserInput, !0);
3357
+ try {
3358
+ const e = this.viewFor("left"), t = this.viewFor("right");
3359
+ e.events.viewChanged.removeEventListener(this.handleLeftViewChanged), t.events.viewChanged.removeEventListener(this.handleRightViewChanged);
3360
+ } catch {
3361
+ }
3362
+ }
3363
+ /**
3364
+ * Copies `source` onto the other pane. Programmatic zoom-to-fit on a newly
3365
+ * opened follower is discarded so the already-open drawing keeps its camera.
3366
+ */
3367
+ onPaneViewChanged(e) {
3368
+ if (this.disposed || this.viewSyncLock || !this.isViewSyncActive()) return;
3369
+ const t = e === "left" ? "right" : "left";
3370
+ if (this.viewSyncFollowOpen && e !== this.viewSyncLeader && !this.viewSyncFromUser) {
3371
+ this.copyVisibleView(this.viewSyncLeader, e);
3372
+ return;
3373
+ }
3374
+ this.viewSyncFollowOpen = !1, this.viewSyncFromUser = !1, this.viewSyncLeader = e, this.copyVisibleView(e, t);
3375
+ }
3376
+ /**
3377
+ * Copies the visible world box of `from` onto `to` without echoing back
3378
+ * through {@link onPaneViewChanged}.
3379
+ */
3380
+ copyVisibleView(e, t) {
3381
+ if (e === t || this.viewSyncLock || !this.documentFor(e) || !this.documentFor(t)) return;
3382
+ let i, n;
3383
+ try {
3384
+ i = this.viewFor(e), n = this.viewFor(t);
3385
+ } catch {
3386
+ return;
3387
+ }
3388
+ const o = i.width, s = i.height;
3389
+ if (o < 2 || s < 2) return;
3390
+ let r;
3391
+ try {
3392
+ const d = i.screenToWorld({ x: 0, y: 0 }), c = i.screenToWorld({ x: o, y: s });
3393
+ r = new he(), r.expandByPoint(d), r.expandByPoint(c);
3394
+ } catch {
3395
+ return;
3396
+ }
3397
+ this.viewSyncLock = !0;
3398
+ try {
3399
+ n.zoomTo(r, 1);
3400
+ } catch {
3401
+ } finally {
3402
+ requestAnimationFrame(() => {
3403
+ this.viewSyncLock = !1;
3404
+ });
3405
+ }
3406
+ }
3407
+ /**
3408
+ * Returns `doc` only while it still has a live session.
3409
+ *
3410
+ * @param doc - Candidate document stored on this widget.
3411
+ */
3412
+ liveDoc(e) {
3413
+ if (e)
3414
+ try {
3415
+ return w().sessionFor(e) ? e : void 0;
3416
+ } catch {
3417
+ return;
3418
+ }
3419
+ }
3420
+ /** Display title for a pane header. */
3421
+ paneTitle(e) {
3422
+ return e ? e.docTitle || e.fileName || L.t("main.document.untitled") : m("noDrawing");
3423
+ }
3424
+ /** Syncs pane titles, empty states, and focus rings with live documents. */
3425
+ syncChrome() {
3426
+ const e = this.leftDocument, t = this.rightDocument;
3427
+ this.leftDoc = e, this.rightDoc = t, this.syncPaneChrome(this.leftUi, e), this.syncPaneChrome(this.rightUi, t), this.syncFocusRings(), this.syncToolbarButtons(), window.dispatchEvent(new Event("resize"));
3428
+ }
3429
+ /**
3430
+ * Sets `is-focused` immediately so the target pane's canvas receives
3431
+ * pointer events. Unfocused canvases use `pointer-events: none`.
3432
+ */
3433
+ applyFocusClass(e) {
3434
+ this.leftUi.pane.classList.toggle("is-focused", e === "left"), this.rightUi.pane.classList.toggle("is-focused", e === "right");
3435
+ }
3436
+ /** Updates pane focus rings from the active document. */
3437
+ syncFocusRings() {
3438
+ const e = this.rightDocument;
3439
+ let t;
3440
+ try {
3441
+ t = w().curDocument;
3442
+ } catch {
3443
+ t = void 0;
3444
+ }
3445
+ t === e && e ? this.applyFocusClass("right") : this.applyFocusClass("left");
3446
+ }
3447
+ /**
3448
+ * Updates one pane's header and empty-state copy.
3449
+ *
3450
+ * @param ui - Pane DOM.
3451
+ * @param doc - Live document, if any.
3452
+ */
3453
+ syncPaneChrome(e, t) {
3454
+ e.pane.classList.toggle("is-empty", !t), e.empty.classList.toggle("is-hidden", !!t), e.title.textContent = this.paneTitle(t), e.title.classList.toggle("is-empty", !t), e.openButton.setAttribute("aria-label", m("openFile")), e.openButton.title = m("openFile"), e.emptyTitle.textContent = m("emptyTitle"), e.emptyHint.textContent = m("emptyHint"), e.emptyError.classList.contains("is-hidden") || (e.emptyError.textContent = m("invalidFile")), e.banner.classList.contains("is-hidden") || (e.banner.textContent = m("invalidFile"));
3455
+ }
3456
+ /** Updates view-mode button labels and active states. */
3457
+ syncViewModeUi() {
3458
+ this.root.classList.toggle("is-overlay", this.viewMode === "overlay"), this.btnSideBySide.classList.toggle(
3459
+ "is-active",
3460
+ this.viewMode === "side-by-side"
3461
+ ), this.btnOverlay.classList.toggle("is-active", this.viewMode === "overlay");
3462
+ const e = m("toolbarSideBySide"), t = m("toolbarOverlay"), i = m("toolbarTogglePanel");
3463
+ this.btnSideBySide.title = e, this.btnSideBySide.setAttribute("aria-label", e), this.btnOverlay.title = t, this.btnOverlay.setAttribute("aria-label", t);
3464
+ const n = m("toolbarSyncViews");
3465
+ this.btnSyncViews.title = n, this.btnSyncViews.setAttribute("aria-label", n), this.btnSyncViews.setAttribute("aria-pressed", String(this.viewsSynced)), this.btnSyncViews.classList.toggle("is-active", this.viewsSynced), this.btnSyncViews.hidden = this.viewMode !== "side-by-side", this.btnTogglePanel.title = i, this.btnTogglePanel.setAttribute("aria-label", i), this.btnPrev.title = m("toolbarPrev"), this.btnNext.title = m("toolbarNext");
3466
+ const o = m("toolbarSettings");
3467
+ this.btnSettings.title = o, this.btnSettings.setAttribute("aria-label", o), this.syncToolbarButtons(), this.syncMarkupVisibilityButton(), this.syncThemeButton(), this.syncLocaleSelect();
3468
+ for (const s of this.markupButtons) {
3469
+ const r = s.dataset.labelKey, d = m(r);
3470
+ s.title = d, s.setAttribute("aria-label", d);
3471
+ }
3472
+ }
3473
+ /** Updates side-panel visibility, tabs, and grouping toggles. */
3474
+ syncPanelUi() {
3475
+ this.sidePanel.classList.toggle("is-collapsed", !this.sidePanelOpen), this.btnTogglePanel.classList.toggle("is-active", this.sidePanelOpen), this.panelTitle.textContent = m("panelTitle"), this.tabResults.textContent = m("tabResults"), this.tabMarkups.textContent = m("tabMarkups"), this.groupByKindBtn.textContent = m("groupByKind"), this.groupByTypeBtn.textContent = m("groupByType"), this.tabResults.classList.toggle("is-active", this.activeTab === "results"), this.tabMarkups.classList.toggle("is-active", this.activeTab === "markups"), this.resultsBody.hidden = this.activeTab !== "results", this.markupsBody.hidden = this.activeTab !== "markups", this.groupByKindBtn.classList.toggle(
3476
+ "is-active",
3477
+ this.resultGroupMode === "kind"
3478
+ ), this.groupByTypeBtn.classList.toggle(
3479
+ "is-active",
3480
+ this.resultGroupMode === "type"
3481
+ );
3482
+ const e = this.groupByKindBtn.parentElement;
3483
+ e && (e.hidden = this.activeTab !== "results"), (!this.sidePanelOpen || this.activeTab !== "results") && this.hideDiffPopover(!0);
3484
+ }
3485
+ /**
3486
+ * Updates toolbar markup and diff-navigation controls from open documents
3487
+ * and the latest compare result.
3488
+ */
3489
+ syncToolbarButtons() {
3490
+ var o, s;
3491
+ const e = !!(this.leftDocument || this.rightDocument), t = !!this.compareResult, i = ((o = this.compareResult) == null ? void 0 : o.navigation) ?? [], n = t && i.length > 0;
3492
+ this.btnMarkupVis.disabled = !e, this.btnClearMarkups.disabled = !e;
3493
+ for (const r of this.markupButtons)
3494
+ r.dataset.command || r.dataset.labelKey === "markupClear" ? r.disabled = !e : r.dataset.labelKey === "markupGenerateClouds" && (r.disabled = !t || (((s = this.compareResult) == null ? void 0 : s.changeSets.length) ?? 0) === 0);
3495
+ this.btnPrev.disabled = !n || this.navIndex <= 0, this.btnNext.disabled = !n || this.navIndex >= i.length - 1;
3496
+ }
3497
+ /**
3498
+ * Applies UI chrome theme tokens and refreshes the toolbar theme button.
3499
+ *
3500
+ * @param theme - Target light or dark chrome theme.
3501
+ */
3502
+ setUiTheme(e) {
3503
+ this.uiTheme = e, ce(e, this.root), this.syncThemeButton();
3504
+ }
3505
+ /**
3506
+ * Updates the markup visibility toggle icon and label (action: hide when
3507
+ * shown, show when hidden).
3508
+ */
3509
+ syncMarkupVisibilityButton() {
3510
+ const e = Y();
3511
+ this.btnMarkupVis.innerHTML = e ? je : ze;
3512
+ const t = m(e ? "markupHide" : "markupShow");
3513
+ this.btnMarkupVis.title = t, this.btnMarkupVis.setAttribute("aria-label", t), this.btnMarkupVis.setAttribute("aria-pressed", String(e)), this.btnMarkupVis.classList.toggle("is-active", e);
3514
+ }
3515
+ /**
3516
+ * Shows the opposite-theme icon (sun in dark, moon in light), matching
3517
+ * cad-viewer's status-bar theme button.
3518
+ */
3519
+ syncThemeButton() {
3520
+ const e = this.uiTheme === "dark";
3521
+ this.btnTheme.innerHTML = e ? zt : Ut;
3522
+ const t = m(e ? "toolbarThemeDark" : "toolbarThemeLight");
3523
+ this.btnTheme.title = t, this.btnTheme.setAttribute("aria-label", t);
3524
+ }
3525
+ /** Throws if {@link destroy} has already run. */
3526
+ assertAlive() {
3527
+ if (this.disposed)
3528
+ throw new Error("AcApDiffViewer has been destroyed");
3529
+ }
3530
+ }
3531
+ export {
3532
+ li as AcApDiffViewer,
3533
+ ct as acapBuildCompareChangeSets,
3534
+ ot as acapChangeSetCloudRole,
3535
+ Et as acapCompareDrawings,
3536
+ le as acapDefaultCompareSysVars,
3537
+ m as acapDiffViewerT,
3538
+ Wt as acapInjectDiffViewerStyles,
3539
+ pt as acapReadCompareSysVars,
3540
+ Rt as acapRegisterDiffViewerI18n,
3541
+ ht as acapToleranceFromCompareTolerance,
3542
+ ue as acapWriteCompareSysVars
3543
+ };