@docling/docling-components 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,20 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ const v = (i) => (t, e) => {
7
+ e !== void 0 ? e.addInitializer(() => {
8
+ customElements.define(i, t);
9
+ }) : customElements.define(i, t);
10
+ };
1
11
  /**
2
12
  * @license
3
13
  * Copyright 2019 Google LLC
4
14
  * SPDX-License-Identifier: BSD-3-Clause
5
15
  */
6
- const z = globalThis, Q = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, X = Symbol(), et = /* @__PURE__ */ new WeakMap();
7
- let dt = class {
16
+ const it = globalThis, Pt = it.ShadowRoot && (it.ShadyCSS === void 0 || it.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, xt = Symbol(), Tt = /* @__PURE__ */ new WeakMap();
17
+ let Wt = class {
8
18
  constructor(t, e, s) {
9
- if (this._$cssResult$ = !0, s !== X) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
19
+ if (this._$cssResult$ = !0, s !== xt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
10
20
  this.cssText = t, this.t = e;
11
21
  }
12
22
  get styleSheet() {
13
23
  let t = this.o;
14
24
  const e = this.t;
15
- if (Q && t === void 0) {
25
+ if (Pt && t === void 0) {
16
26
  const s = e !== void 0 && e.length === 1;
17
- s && (t = et.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && et.set(e, t));
27
+ s && (t = Tt.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && Tt.set(e, t));
18
28
  }
19
29
  return t;
20
30
  }
@@ -22,108 +32,106 @@ let dt = class {
22
32
  return this.cssText;
23
33
  }
24
34
  };
25
- const _t = (r) => new dt(typeof r == "string" ? r : r + "", void 0, X), ut = (r, ...t) => {
26
- const e = r.length === 1 ? r[0] : t.reduce((s, i, o) => s + ((n) => {
35
+ const ie = (i) => new Wt(typeof i == "string" ? i : i + "", void 0, xt), O = (i, ...t) => {
36
+ const e = i.length === 1 ? i[0] : t.reduce((s, r, o) => s + ((n) => {
27
37
  if (n._$cssResult$ === !0) return n.cssText;
28
38
  if (typeof n == "number") return n;
29
39
  throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
30
- })(i) + r[o + 1], r[0]);
31
- return new dt(e, r, X);
32
- }, yt = (r, t) => {
33
- if (Q) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
40
+ })(r) + i[o + 1], i[0]);
41
+ return new Wt(e, i, xt);
42
+ }, oe = (i, t) => {
43
+ if (Pt) i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
34
44
  else for (const e of t) {
35
- const s = document.createElement("style"), i = z.litNonce;
36
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
45
+ const s = document.createElement("style"), r = it.litNonce;
46
+ r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s);
37
47
  }
38
- }, st = Q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
48
+ }, jt = Pt ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
39
49
  let e = "";
40
50
  for (const s of t.cssRules) e += s.cssText;
41
- return _t(e);
42
- })(r) : r;
51
+ return ie(e);
52
+ })(i) : i;
43
53
  /**
44
54
  * @license
45
55
  * Copyright 2017 Google LLC
46
56
  * SPDX-License-Identifier: BSD-3-Clause
47
57
  */
48
- const { is: vt, defineProperty: At, getOwnPropertyDescriptor: bt, getOwnPropertyNames: wt, getOwnPropertySymbols: Et, getPrototypeOf: St } = Object, w = globalThis, it = w.trustedTypes, Pt = it ? it.emptyScript : "", F = w.reactiveElementPolyfillSupport, H = (r, t) => r, L = { toAttribute(r, t) {
58
+ const { is: ne, defineProperty: ae, getOwnPropertyDescriptor: he, getOwnPropertyNames: le, getOwnPropertySymbols: ce, getPrototypeOf: pe } = Object, j = globalThis, kt = j.trustedTypes, de = kt ? kt.emptyScript : "", ut = j.reactiveElementPolyfillSupport, J = (i, t) => i, ot = { toAttribute(i, t) {
49
59
  switch (t) {
50
60
  case Boolean:
51
- r = r ? Pt : null;
61
+ i = i ? de : null;
52
62
  break;
53
63
  case Object:
54
64
  case Array:
55
- r = r == null ? r : JSON.stringify(r);
65
+ i = i == null ? i : JSON.stringify(i);
56
66
  }
57
- return r;
58
- }, fromAttribute(r, t) {
59
- let e = r;
67
+ return i;
68
+ }, fromAttribute(i, t) {
69
+ let e = i;
60
70
  switch (t) {
61
71
  case Boolean:
62
- e = r !== null;
72
+ e = i !== null;
63
73
  break;
64
74
  case Number:
65
- e = r === null ? null : Number(r);
75
+ e = i === null ? null : Number(i);
66
76
  break;
67
77
  case Object:
68
78
  case Array:
69
79
  try {
70
- e = JSON.parse(r);
80
+ e = JSON.parse(i);
71
81
  } catch {
72
82
  e = null;
73
83
  }
74
84
  }
75
85
  return e;
76
- } }, B = (r, t) => !vt(r, t), rt = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: B };
77
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), w.litPropertyMetadata ?? (w.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
78
- class C extends HTMLElement {
86
+ } }, ct = (i, t) => !ne(i, t), Ut = { attribute: !0, type: String, converter: ot, reflect: !1, useDefault: !1, hasChanged: ct };
87
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), j.litPropertyMetadata ?? (j.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
88
+ let L = class extends HTMLElement {
79
89
  static addInitializer(t) {
80
90
  this._$Ei(), (this.l ?? (this.l = [])).push(t);
81
91
  }
82
92
  static get observedAttributes() {
83
93
  return this.finalize(), this._$Eh && [...this._$Eh.keys()];
84
94
  }
85
- static createProperty(t, e = rt) {
86
- if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
87
- const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
88
- i !== void 0 && At(this.prototype, t, i);
95
+ static createProperty(t, e = Ut) {
96
+ if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
97
+ const s = Symbol(), r = this.getPropertyDescriptor(t, s, e);
98
+ r !== void 0 && ae(this.prototype, t, r);
89
99
  }
90
100
  }
91
101
  static getPropertyDescriptor(t, e, s) {
92
- const { get: i, set: o } = bt(this.prototype, t) ?? { get() {
102
+ const { get: r, set: o } = he(this.prototype, t) ?? { get() {
93
103
  return this[e];
94
104
  }, set(n) {
95
105
  this[e] = n;
96
106
  } };
97
- return { get() {
98
- return i == null ? void 0 : i.call(this);
99
- }, set(n) {
100
- const c = i == null ? void 0 : i.call(this);
101
- o.call(this, n), this.requestUpdate(t, c, s);
107
+ return { get: r, set(n) {
108
+ const h = r == null ? void 0 : r.call(this);
109
+ o == null || o.call(this, n), this.requestUpdate(t, h, s);
102
110
  }, configurable: !0, enumerable: !0 };
103
111
  }
104
112
  static getPropertyOptions(t) {
105
- return this.elementProperties.get(t) ?? rt;
113
+ return this.elementProperties.get(t) ?? Ut;
106
114
  }
107
115
  static _$Ei() {
108
- if (this.hasOwnProperty(H("elementProperties"))) return;
109
- const t = St(this);
116
+ if (this.hasOwnProperty(J("elementProperties"))) return;
117
+ const t = pe(this);
110
118
  t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
111
119
  }
112
120
  static finalize() {
113
- if (this.hasOwnProperty(H("finalized"))) return;
114
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(H("properties"))) {
115
- const e = this.properties, s = [...wt(e), ...Et(e)];
116
- for (const i of s) this.createProperty(i, e[i]);
121
+ if (this.hasOwnProperty(J("finalized"))) return;
122
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(J("properties"))) {
123
+ const e = this.properties, s = [...le(e), ...ce(e)];
124
+ for (const r of s) this.createProperty(r, e[r]);
117
125
  }
118
126
  const t = this[Symbol.metadata];
119
127
  if (t !== null) {
120
128
  const e = litPropertyMetadata.get(t);
121
- if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i);
129
+ if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r);
122
130
  }
123
131
  this._$Eh = /* @__PURE__ */ new Map();
124
132
  for (const [e, s] of this.elementProperties) {
125
- const i = this._$Eu(e, s);
126
- i !== void 0 && this._$Eh.set(i, e);
133
+ const r = this._$Eu(e, s);
134
+ r !== void 0 && this._$Eh.set(r, e);
127
135
  }
128
136
  this.elementStyles = this.finalizeStyles(this.styles);
129
137
  }
@@ -131,8 +139,8 @@ class C extends HTMLElement {
131
139
  const e = [];
132
140
  if (Array.isArray(t)) {
133
141
  const s = new Set(t.flat(1 / 0).reverse());
134
- for (const i of s) e.unshift(st(i));
135
- } else t !== void 0 && e.push(st(t));
142
+ for (const r of s) e.unshift(jt(r));
143
+ } else t !== void 0 && e.push(jt(t));
136
144
  return e;
137
145
  }
138
146
  static _$Eu(t, e) {
@@ -161,7 +169,7 @@ class C extends HTMLElement {
161
169
  }
162
170
  createRenderRoot() {
163
171
  const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
164
- return yt(t, this.constructor.elementStyles), t;
172
+ return oe(t, this.constructor.elementStyles), t;
165
173
  }
166
174
  connectedCallback() {
167
175
  var t;
@@ -182,33 +190,35 @@ class C extends HTMLElement {
182
190
  attributeChangedCallback(t, e, s) {
183
191
  this._$AK(t, s);
184
192
  }
185
- _$EC(t, e) {
193
+ _$ET(t, e) {
186
194
  var o;
187
- const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
188
- if (i !== void 0 && s.reflect === !0) {
189
- const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter : L).toAttribute(e, s.type);
190
- this._$Em = t, n == null ? this.removeAttribute(i) : this.setAttribute(i, n), this._$Em = null;
195
+ const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s);
196
+ if (r !== void 0 && s.reflect === !0) {
197
+ const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter : ot).toAttribute(e, s.type);
198
+ this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null;
191
199
  }
192
200
  }
193
201
  _$AK(t, e) {
194
- var o;
195
- const s = this.constructor, i = s._$Eh.get(t);
196
- if (i !== void 0 && this._$Em !== i) {
197
- const n = s.getPropertyOptions(i), c = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((o = n.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? n.converter : L;
198
- this._$Em = i, this[i] = c.fromAttribute(e, n.type), this._$Em = null;
202
+ var o, n;
203
+ const s = this.constructor, r = s._$Eh.get(t);
204
+ if (r !== void 0 && this._$Em !== r) {
205
+ const h = s.getPropertyOptions(r), a = typeof h.converter == "function" ? { fromAttribute: h.converter } : ((o = h.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? h.converter : ot;
206
+ this._$Em = r, this[r] = a.fromAttribute(e, h.type) ?? ((n = this._$Ej) == null ? void 0 : n.get(r)) ?? null, this._$Em = null;
199
207
  }
200
208
  }
201
209
  requestUpdate(t, e, s) {
210
+ var r;
202
211
  if (t !== void 0) {
203
- if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? B)(this[t], e)) return;
204
- this.P(t, e, s);
212
+ const o = this.constructor, n = this[t];
213
+ if (s ?? (s = o.getPropertyOptions(t)), !((s.hasChanged ?? ct)(n, e) || s.useDefault && s.reflect && n === ((r = this._$Ej) == null ? void 0 : r.get(t)) && !this.hasAttribute(o._$Eu(t, s)))) return;
214
+ this.C(t, e, s);
205
215
  }
206
- this.isUpdatePending === !1 && (this._$ES = this._$ET());
216
+ this.isUpdatePending === !1 && (this._$ES = this._$EP());
207
217
  }
208
- P(t, e, s) {
209
- this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$Em !== t && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t);
218
+ C(t, e, { useDefault: s, reflect: r, wrapped: o }, n) {
219
+ s && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, n ?? e ?? this[t]), o !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), r === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
210
220
  }
211
- async _$ET() {
221
+ async _$EP() {
212
222
  this.isUpdatePending = !0;
213
223
  try {
214
224
  await this._$ES;
@@ -229,18 +239,21 @@ class C extends HTMLElement {
229
239
  for (const [o, n] of this._$Ep) this[o] = n;
230
240
  this._$Ep = void 0;
231
241
  }
232
- const i = this.constructor.elementProperties;
233
- if (i.size > 0) for (const [o, n] of i) n.wrapped !== !0 || this._$AL.has(o) || this[o] === void 0 || this.P(o, this[o], n);
242
+ const r = this.constructor.elementProperties;
243
+ if (r.size > 0) for (const [o, n] of r) {
244
+ const { wrapped: h } = n, a = this[o];
245
+ h !== !0 || this._$AL.has(o) || a === void 0 || this.C(o, void 0, n, a);
246
+ }
234
247
  }
235
248
  let t = !1;
236
249
  const e = this._$AL;
237
250
  try {
238
- t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((i) => {
251
+ t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((r) => {
239
252
  var o;
240
- return (o = i.hostUpdate) == null ? void 0 : o.call(i);
241
- }), this.update(e)) : this._$EU();
242
- } catch (i) {
243
- throw t = !1, this._$EU(), i;
253
+ return (o = r.hostUpdate) == null ? void 0 : o.call(r);
254
+ }), this.update(e)) : this._$EM();
255
+ } catch (r) {
256
+ throw t = !1, this._$EM(), r;
244
257
  }
245
258
  t && this._$AE(e);
246
259
  }
@@ -249,11 +262,11 @@ class C extends HTMLElement {
249
262
  _$AE(t) {
250
263
  var e;
251
264
  (e = this._$EO) == null || e.forEach((s) => {
252
- var i;
253
- return (i = s.hostUpdated) == null ? void 0 : i.call(s);
265
+ var r;
266
+ return (r = s.hostUpdated) == null ? void 0 : r.call(s);
254
267
  }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
255
268
  }
256
- _$EU() {
269
+ _$EM() {
257
270
  this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
258
271
  }
259
272
  get updateComplete() {
@@ -266,83 +279,124 @@ class C extends HTMLElement {
266
279
  return !0;
267
280
  }
268
281
  update(t) {
269
- this._$Ej && (this._$Ej = this._$Ej.forEach((e) => this._$EC(e, this[e]))), this._$EU();
282
+ this._$Eq && (this._$Eq = this._$Eq.forEach((e) => this._$ET(e, this[e]))), this._$EM();
270
283
  }
271
284
  updated(t) {
272
285
  }
273
286
  firstUpdated(t) {
274
287
  }
288
+ };
289
+ L.elementStyles = [], L.shadowRootOptions = { mode: "open" }, L[J("elementProperties")] = /* @__PURE__ */ new Map(), L[J("finalized")] = /* @__PURE__ */ new Map(), ut == null || ut({ ReactiveElement: L }), (j.reactiveElementVersions ?? (j.reactiveElementVersions = [])).push("2.1.0");
290
+ /**
291
+ * @license
292
+ * Copyright 2017 Google LLC
293
+ * SPDX-License-Identifier: BSD-3-Clause
294
+ */
295
+ const ue = { attribute: !0, type: String, converter: ot, reflect: !1, hasChanged: ct }, me = (i = ue, t, e) => {
296
+ const { kind: s, metadata: r } = e;
297
+ let o = globalThis.litPropertyMetadata.get(r);
298
+ if (o === void 0 && globalThis.litPropertyMetadata.set(r, o = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), o.set(e.name, i), s === "accessor") {
299
+ const { name: n } = e;
300
+ return { set(h) {
301
+ const a = t.get.call(this);
302
+ t.set.call(this, h), this.requestUpdate(n, a, i);
303
+ }, init(h) {
304
+ return h !== void 0 && this.C(n, void 0, i, h), h;
305
+ } };
306
+ }
307
+ if (s === "setter") {
308
+ const { name: n } = e;
309
+ return function(h) {
310
+ const a = this[n];
311
+ t.call(this, h), this.requestUpdate(n, a, i);
312
+ };
313
+ }
314
+ throw Error("Unsupported decorator location: " + s);
315
+ };
316
+ function d(i) {
317
+ return (t, e) => typeof e == "object" ? me(i, t, e) : ((s, r, o) => {
318
+ const n = r.hasOwnProperty(o);
319
+ return r.constructor.createProperty(o, s), n ? Object.getOwnPropertyDescriptor(r, o) : void 0;
320
+ })(i, t, e);
321
+ }
322
+ const $t = [];
323
+ function Vt(i) {
324
+ const t = v(i);
325
+ return function(e, s) {
326
+ return $t.push(
327
+ e
328
+ ), t(e, s);
329
+ };
275
330
  }
276
- C.elementStyles = [], C.shadowRootOptions = { mode: "open" }, C[H("elementProperties")] = /* @__PURE__ */ new Map(), C[H("finalized")] = /* @__PURE__ */ new Map(), F == null || F({ ReactiveElement: C }), (w.reactiveElementVersions ?? (w.reactiveElementVersions = [])).push("2.0.4");
277
331
  /**
278
332
  * @license
279
333
  * Copyright 2017 Google LLC
280
334
  * SPDX-License-Identifier: BSD-3-Clause
281
335
  */
282
- const N = globalThis, q = N.trustedTypes, ot = q ? q.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ft = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + b, xt = `<${$t}>`, P = document, k = () => P.createComment(""), M = (r) => r === null || typeof r != "object" && typeof r != "function", Y = Array.isArray, Ct = (r) => Y(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", J = `[
283
- \f\r]`, I = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, nt = /-->/g, ht = />/g, E = RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
284
- \f\r"'\`<>=]|("|')|))|$)`, "g"), at = /'/g, ct = /"/g, mt = /^(?:script|style|textarea|title)$/i, Ut = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), A = Ut(1), U = Symbol.for("lit-noChange"), $ = Symbol.for("lit-nothing"), lt = /* @__PURE__ */ new WeakMap(), S = P.createTreeWalker(P, 129);
285
- function gt(r, t) {
286
- if (!Y(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
287
- return ot !== void 0 ? ot.createHTML(t) : t;
336
+ const Z = globalThis, nt = Z.trustedTypes, Mt = nt ? nt.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Ft = "$lit$", T = `lit$${Math.random().toFixed(9).slice(2)}$`, Gt = "?" + T, fe = `<${Gt}>`, R = document, X = () => R.createComment(""), Y = (i) => i === null || typeof i != "object" && typeof i != "function", Ct = Array.isArray, ge = (i) => Ct(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", mt = `[
337
+ \f\r]`, K = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Nt = /-->/g, Ht = />/g, M = RegExp(`>|${mt}(?:([^\\s"'>=/]+)(${mt}*=${mt}*(?:[^
338
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), Rt = /'/g, zt = /"/g, Kt = /^(?:script|style|textarea|title)$/i, Jt = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), m = Jt(1), st = Jt(2), W = Symbol.for("lit-noChange"), f = Symbol.for("lit-nothing"), Bt = /* @__PURE__ */ new WeakMap(), N = R.createTreeWalker(R, 129);
339
+ function Zt(i, t) {
340
+ if (!Ct(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
341
+ return Mt !== void 0 ? Mt.createHTML(t) : t;
288
342
  }
289
- const Tt = (r, t) => {
290
- const e = r.length - 1, s = [];
291
- let i, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = I;
292
- for (let c = 0; c < e; c++) {
293
- const a = r[c];
294
- let p, d, h = -1, l = 0;
295
- for (; l < a.length && (n.lastIndex = l, d = n.exec(a), d !== null); ) l = n.lastIndex, n === I ? d[1] === "!--" ? n = nt : d[1] !== void 0 ? n = ht : d[2] !== void 0 ? (mt.test(d[2]) && (i = RegExp("</" + d[2], "g")), n = E) : d[3] !== void 0 && (n = E) : n === E ? d[0] === ">" ? (n = i ?? I, h = -1) : d[1] === void 0 ? h = -2 : (h = n.lastIndex - d[2].length, p = d[1], n = d[3] === void 0 ? E : d[3] === '"' ? ct : at) : n === ct || n === at ? n = E : n === nt || n === ht ? n = I : (n = E, i = void 0);
296
- const u = n === E && r[c + 1].startsWith("/>") ? " " : "";
297
- o += n === I ? a + xt : h >= 0 ? (s.push(p), a.slice(0, h) + ft + a.slice(h) + b + u) : a + b + (h === -2 ? c : u);
298
- }
299
- return [gt(r, o + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
300
- };
301
- class D {
343
+ const $e = (i, t) => {
344
+ const e = i.length - 1, s = [];
345
+ let r, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = K;
346
+ for (let h = 0; h < e; h++) {
347
+ const a = i[h];
348
+ let l, p, c = -1, u = 0;
349
+ for (; u < a.length && (n.lastIndex = u, p = n.exec(a), p !== null); ) u = n.lastIndex, n === K ? p[1] === "!--" ? n = Nt : p[1] !== void 0 ? n = Ht : p[2] !== void 0 ? (Kt.test(p[2]) && (r = RegExp("</" + p[2], "g")), n = M) : p[3] !== void 0 && (n = M) : n === M ? p[0] === ">" ? (n = r ?? K, c = -1) : p[1] === void 0 ? c = -2 : (c = n.lastIndex - p[2].length, l = p[1], n = p[3] === void 0 ? M : p[3] === '"' ? zt : Rt) : n === zt || n === Rt ? n = M : n === Nt || n === Ht ? n = K : (n = M, r = void 0);
350
+ const g = n === M && i[h + 1].startsWith("/>") ? " " : "";
351
+ o += n === K ? a + fe : c >= 0 ? (s.push(l), a.slice(0, c) + Ft + a.slice(c) + T + g) : a + T + (c === -2 ? h : g);
352
+ }
353
+ return [Zt(i, o + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
354
+ };
355
+ class Q {
302
356
  constructor({ strings: t, _$litType$: e }, s) {
303
- let i;
357
+ let r;
304
358
  this.parts = [];
305
359
  let o = 0, n = 0;
306
- const c = t.length - 1, a = this.parts, [p, d] = Tt(t, e);
307
- if (this.el = D.createElement(p, s), S.currentNode = this.el.content, e === 2 || e === 3) {
308
- const h = this.el.content.firstChild;
309
- h.replaceWith(...h.childNodes);
310
- }
311
- for (; (i = S.nextNode()) !== null && a.length < c; ) {
312
- if (i.nodeType === 1) {
313
- if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(ft)) {
314
- const l = d[n++], u = i.getAttribute(h).split(b), m = /([.?@])?(.*)/.exec(l);
315
- a.push({ type: 1, index: o, name: m[2], strings: u, ctor: m[1] === "." ? It : m[1] === "?" ? Ht : m[1] === "@" ? Nt : W }), i.removeAttribute(h);
316
- } else h.startsWith(b) && (a.push({ type: 6, index: o }), i.removeAttribute(h));
317
- if (mt.test(i.tagName)) {
318
- const h = i.textContent.split(b), l = h.length - 1;
319
- if (l > 0) {
320
- i.textContent = q ? q.emptyScript : "";
321
- for (let u = 0; u < l; u++) i.append(h[u], k()), S.nextNode(), a.push({ type: 2, index: ++o });
322
- i.append(h[l], k());
360
+ const h = t.length - 1, a = this.parts, [l, p] = $e(t, e);
361
+ if (this.el = Q.createElement(l, s), N.currentNode = this.el.content, e === 2 || e === 3) {
362
+ const c = this.el.content.firstChild;
363
+ c.replaceWith(...c.childNodes);
364
+ }
365
+ for (; (r = N.nextNode()) !== null && a.length < h; ) {
366
+ if (r.nodeType === 1) {
367
+ if (r.hasAttributes()) for (const c of r.getAttributeNames()) if (c.endsWith(Ft)) {
368
+ const u = p[n++], g = r.getAttribute(c).split(T), _ = /([.?@])?(.*)/.exec(u);
369
+ a.push({ type: 1, index: o, name: _[2], strings: g, ctor: _[1] === "." ? ye : _[1] === "?" ? ve : _[1] === "@" ? be : pt }), r.removeAttribute(c);
370
+ } else c.startsWith(T) && (a.push({ type: 6, index: o }), r.removeAttribute(c));
371
+ if (Kt.test(r.tagName)) {
372
+ const c = r.textContent.split(T), u = c.length - 1;
373
+ if (u > 0) {
374
+ r.textContent = nt ? nt.emptyScript : "";
375
+ for (let g = 0; g < u; g++) r.append(c[g], X()), N.nextNode(), a.push({ type: 2, index: ++o });
376
+ r.append(c[u], X());
323
377
  }
324
378
  }
325
- } else if (i.nodeType === 8) if (i.data === $t) a.push({ type: 2, index: o });
379
+ } else if (r.nodeType === 8) if (r.data === Gt) a.push({ type: 2, index: o });
326
380
  else {
327
- let h = -1;
328
- for (; (h = i.data.indexOf(b, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += b.length - 1;
381
+ let c = -1;
382
+ for (; (c = r.data.indexOf(T, c + 1)) !== -1; ) a.push({ type: 7, index: o }), c += T.length - 1;
329
383
  }
330
384
  o++;
331
385
  }
332
386
  }
333
387
  static createElement(t, e) {
334
- const s = P.createElement("template");
388
+ const s = R.createElement("template");
335
389
  return s.innerHTML = t, s;
336
390
  }
337
391
  }
338
- function T(r, t, e = r, s) {
339
- var n, c;
340
- if (t === U) return t;
341
- let i = s !== void 0 ? (n = e._$Co) == null ? void 0 : n[s] : e._$Cl;
342
- const o = M(t) ? void 0 : t._$litDirective$;
343
- return (i == null ? void 0 : i.constructor) !== o && ((c = i == null ? void 0 : i._$AO) == null || c.call(i, !1), o === void 0 ? i = void 0 : (i = new o(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = T(r, i._$AS(r, t.values), i, s)), t;
392
+ function V(i, t, e = i, s) {
393
+ var n, h;
394
+ if (t === W) return t;
395
+ let r = s !== void 0 ? (n = e._$Co) == null ? void 0 : n[s] : e._$Cl;
396
+ const o = Y(t) ? void 0 : t._$litDirective$;
397
+ return (r == null ? void 0 : r.constructor) !== o && ((h = r == null ? void 0 : r._$AO) == null || h.call(r, !1), o === void 0 ? r = void 0 : (r = new o(i), r._$AT(i, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = r : e._$Cl = r), r !== void 0 && (t = V(i, r._$AS(i, t.values), r, s)), t;
344
398
  }
345
- class Ot {
399
+ class _e {
346
400
  constructor(t, e) {
347
401
  this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
348
402
  }
@@ -353,30 +407,30 @@ class Ot {
353
407
  return this._$AM._$AU;
354
408
  }
355
409
  u(t) {
356
- const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? P).importNode(e, !0);
357
- S.currentNode = i;
358
- let o = S.nextNode(), n = 0, c = 0, a = s[0];
410
+ const { el: { content: e }, parts: s } = this._$AD, r = ((t == null ? void 0 : t.creationScope) ?? R).importNode(e, !0);
411
+ N.currentNode = r;
412
+ let o = N.nextNode(), n = 0, h = 0, a = s[0];
359
413
  for (; a !== void 0; ) {
360
414
  if (n === a.index) {
361
- let p;
362
- a.type === 2 ? p = new j(o, o.nextSibling, this, t) : a.type === 1 ? p = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (p = new Rt(o, this, t)), this._$AV.push(p), a = s[++c];
415
+ let l;
416
+ a.type === 2 ? l = new et(o, o.nextSibling, this, t) : a.type === 1 ? l = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (l = new we(o, this, t)), this._$AV.push(l), a = s[++h];
363
417
  }
364
- n !== (a == null ? void 0 : a.index) && (o = S.nextNode(), n++);
418
+ n !== (a == null ? void 0 : a.index) && (o = N.nextNode(), n++);
365
419
  }
366
- return S.currentNode = P, i;
420
+ return N.currentNode = R, r;
367
421
  }
368
422
  p(t) {
369
423
  let e = 0;
370
424
  for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
371
425
  }
372
426
  }
373
- class j {
427
+ class et {
374
428
  get _$AU() {
375
429
  var t;
376
430
  return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
377
431
  }
378
- constructor(t, e, s, i) {
379
- this.type = 2, this._$AH = $, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
432
+ constructor(t, e, s, r) {
433
+ this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = r, this._$Cv = (r == null ? void 0 : r.isConnected) ?? !0;
380
434
  }
381
435
  get parentNode() {
382
436
  let t = this._$AA.parentNode;
@@ -390,7 +444,7 @@ class j {
390
444
  return this._$AB;
391
445
  }
392
446
  _$AI(t, e = this) {
393
- t = T(this, t, e), M(t) ? t === $ || t == null || t === "" ? (this._$AH !== $ && this._$AR(), this._$AH = $) : t !== this._$AH && t !== U && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ct(t) ? this.k(t) : this._(t);
447
+ t = V(this, t, e), Y(t) ? t === f || t == null || t === "" ? (this._$AH !== f && this._$AR(), this._$AH = f) : t !== this._$AH && t !== W && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : ge(t) ? this.k(t) : this._(t);
394
448
  }
395
449
  O(t) {
396
450
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -399,33 +453,33 @@ class j {
399
453
  this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
400
454
  }
401
455
  _(t) {
402
- this._$AH !== $ && M(this._$AH) ? this._$AA.nextSibling.data = t : this.T(P.createTextNode(t)), this._$AH = t;
456
+ this._$AH !== f && Y(this._$AH) ? this._$AA.nextSibling.data = t : this.T(R.createTextNode(t)), this._$AH = t;
403
457
  }
404
458
  $(t) {
405
459
  var o;
406
- const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = D.createElement(gt(s.h, s.h[0]), this.options)), s);
407
- if (((o = this._$AH) == null ? void 0 : o._$AD) === i) this._$AH.p(e);
460
+ const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = Q.createElement(Zt(s.h, s.h[0]), this.options)), s);
461
+ if (((o = this._$AH) == null ? void 0 : o._$AD) === r) this._$AH.p(e);
408
462
  else {
409
- const n = new Ot(i, this), c = n.u(this.options);
410
- n.p(e), this.T(c), this._$AH = n;
463
+ const n = new _e(r, this), h = n.u(this.options);
464
+ n.p(e), this.T(h), this._$AH = n;
411
465
  }
412
466
  }
413
467
  _$AC(t) {
414
- let e = lt.get(t.strings);
415
- return e === void 0 && lt.set(t.strings, e = new D(t)), e;
468
+ let e = Bt.get(t.strings);
469
+ return e === void 0 && Bt.set(t.strings, e = new Q(t)), e;
416
470
  }
417
471
  k(t) {
418
- Y(this._$AH) || (this._$AH = [], this._$AR());
472
+ Ct(this._$AH) || (this._$AH = [], this._$AR());
419
473
  const e = this._$AH;
420
- let s, i = 0;
421
- for (const o of t) i === e.length ? e.push(s = new j(this.O(k()), this.O(k()), this, this.options)) : s = e[i], s._$AI(o), i++;
422
- i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
474
+ let s, r = 0;
475
+ for (const o of t) r === e.length ? e.push(s = new et(this.O(X()), this.O(X()), this, this.options)) : s = e[r], s._$AI(o), r++;
476
+ r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r);
423
477
  }
424
478
  _$AR(t = this._$AA.nextSibling, e) {
425
479
  var s;
426
480
  for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t && t !== this._$AB; ) {
427
- const i = t.nextSibling;
428
- t.remove(), t = i;
481
+ const r = t.nextSibling;
482
+ t.remove(), t = r;
429
483
  }
430
484
  }
431
485
  setConnected(t) {
@@ -433,62 +487,62 @@ class j {
433
487
  this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
434
488
  }
435
489
  }
436
- class W {
490
+ class pt {
437
491
  get tagName() {
438
492
  return this.element.tagName;
439
493
  }
440
494
  get _$AU() {
441
495
  return this._$AM._$AU;
442
496
  }
443
- constructor(t, e, s, i, o) {
444
- this.type = 1, this._$AH = $, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = $;
497
+ constructor(t, e, s, r, o) {
498
+ this.type = 1, this._$AH = f, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = f;
445
499
  }
446
- _$AI(t, e = this, s, i) {
500
+ _$AI(t, e = this, s, r) {
447
501
  const o = this.strings;
448
502
  let n = !1;
449
- if (o === void 0) t = T(this, t, e, 0), n = !M(t) || t !== this._$AH && t !== U, n && (this._$AH = t);
503
+ if (o === void 0) t = V(this, t, e, 0), n = !Y(t) || t !== this._$AH && t !== W, n && (this._$AH = t);
450
504
  else {
451
- const c = t;
452
- let a, p;
453
- for (t = o[0], a = 0; a < o.length - 1; a++) p = T(this, c[s + a], e, a), p === U && (p = this._$AH[a]), n || (n = !M(p) || p !== this._$AH[a]), p === $ ? t = $ : t !== $ && (t += (p ?? "") + o[a + 1]), this._$AH[a] = p;
505
+ const h = t;
506
+ let a, l;
507
+ for (t = o[0], a = 0; a < o.length - 1; a++) l = V(this, h[s + a], e, a), l === W && (l = this._$AH[a]), n || (n = !Y(l) || l !== this._$AH[a]), l === f ? t = f : t !== f && (t += (l ?? "") + o[a + 1]), this._$AH[a] = l;
454
508
  }
455
- n && !i && this.j(t);
509
+ n && !r && this.j(t);
456
510
  }
457
511
  j(t) {
458
- t === $ ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
512
+ t === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
459
513
  }
460
514
  }
461
- class It extends W {
515
+ class ye extends pt {
462
516
  constructor() {
463
517
  super(...arguments), this.type = 3;
464
518
  }
465
519
  j(t) {
466
- this.element[this.name] = t === $ ? void 0 : t;
520
+ this.element[this.name] = t === f ? void 0 : t;
467
521
  }
468
522
  }
469
- class Ht extends W {
523
+ class ve extends pt {
470
524
  constructor() {
471
525
  super(...arguments), this.type = 4;
472
526
  }
473
527
  j(t) {
474
- this.element.toggleAttribute(this.name, !!t && t !== $);
528
+ this.element.toggleAttribute(this.name, !!t && t !== f);
475
529
  }
476
530
  }
477
- class Nt extends W {
478
- constructor(t, e, s, i, o) {
479
- super(t, e, s, i, o), this.type = 5;
531
+ class be extends pt {
532
+ constructor(t, e, s, r, o) {
533
+ super(t, e, s, r, o), this.type = 5;
480
534
  }
481
535
  _$AI(t, e = this) {
482
- if ((t = T(this, t, e, 0) ?? $) === U) return;
483
- const s = this._$AH, i = t === $ && s !== $ || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== $ && (s === $ || i);
484
- i && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
536
+ if ((t = V(this, t, e, 0) ?? f) === W) return;
537
+ const s = this._$AH, r = t === f && s !== f || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== f && (s === f || r);
538
+ r && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
485
539
  }
486
540
  handleEvent(t) {
487
541
  var e;
488
542
  typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
489
543
  }
490
544
  }
491
- class Rt {
545
+ class we {
492
546
  constructor(t, e, s) {
493
547
  this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
494
548
  }
@@ -496,26 +550,27 @@ class Rt {
496
550
  return this._$AM._$AU;
497
551
  }
498
552
  _$AI(t) {
499
- T(this, t);
553
+ V(this, t);
500
554
  }
501
555
  }
502
- const K = N.litHtmlPolyfillSupport;
503
- K == null || K(D, j), (N.litHtmlVersions ?? (N.litHtmlVersions = [])).push("3.2.1");
504
- const kt = (r, t, e) => {
556
+ const ft = Z.litHtmlPolyfillSupport;
557
+ ft == null || ft(Q, et), (Z.litHtmlVersions ?? (Z.litHtmlVersions = [])).push("3.3.0");
558
+ const Ae = (i, t, e) => {
505
559
  const s = (e == null ? void 0 : e.renderBefore) ?? t;
506
- let i = s._$litPart$;
507
- if (i === void 0) {
560
+ let r = s._$litPart$;
561
+ if (r === void 0) {
508
562
  const o = (e == null ? void 0 : e.renderBefore) ?? null;
509
- s._$litPart$ = i = new j(t.insertBefore(k(), o), o, void 0, e ?? {});
563
+ s._$litPart$ = r = new et(t.insertBefore(X(), o), o, void 0, e ?? {});
510
564
  }
511
- return i._$AI(r), i;
565
+ return r._$AI(i), r;
512
566
  };
513
567
  /**
514
568
  * @license
515
569
  * Copyright 2017 Google LLC
516
570
  * SPDX-License-Identifier: BSD-3-Clause
517
571
  */
518
- let R = class extends C {
572
+ const H = globalThis;
573
+ let A = class extends L {
519
574
  constructor() {
520
575
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
521
576
  }
@@ -526,7 +581,7 @@ let R = class extends C {
526
581
  }
527
582
  update(t) {
528
583
  const e = this.render();
529
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = kt(e, this.renderRoot, this.renderOptions);
584
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ae(e, this.renderRoot, this.renderOptions);
530
585
  }
531
586
  connectedCallback() {
532
587
  var t;
@@ -537,63 +592,775 @@ let R = class extends C {
537
592
  super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
538
593
  }
539
594
  render() {
540
- return U;
595
+ return W;
541
596
  }
542
597
  };
543
- var pt;
544
- R._$litElement$ = !0, R.finalized = !0, (pt = globalThis.litElementHydrateSupport) == null || pt.call(globalThis, { LitElement: R });
545
- const Z = globalThis.litElementPolyfillSupport;
546
- Z == null || Z({ LitElement: R });
547
- (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
548
- /**
549
- * @license
550
- * Copyright 2017 Google LLC
551
- * SPDX-License-Identifier: BSD-3-Clause
552
- */
553
- const Mt = (r) => (t, e) => {
554
- e !== void 0 ? e.addInitializer(() => {
555
- customElements.define(r, t);
556
- }) : customElements.define(r, t);
598
+ var qt;
599
+ A._$litElement$ = !0, A.finalized = !0, (qt = H.litElementHydrateSupport) == null || qt.call(H, { LitElement: A });
600
+ const gt = H.litElementPolyfillSupport;
601
+ gt == null || gt({ LitElement: A });
602
+ (H.litElementVersions ?? (H.litElementVersions = [])).push("4.2.0");
603
+ var Pe = Object.defineProperty, dt = (i, t, e, s) => {
604
+ for (var r = void 0, o = i.length - 1, n; o >= 0; o--)
605
+ (n = i[o]) && (r = n(t, e, r) || r);
606
+ return r && Pe(t, e, r), r;
557
607
  };
558
- /**
559
- * @license
560
- * Copyright 2017 Google LLC
561
- * SPDX-License-Identifier: BSD-3-Clause
562
- */
563
- const Dt = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: B }, jt = (r = Dt, t, e) => {
564
- const { kind: s, metadata: i } = e;
565
- let o = globalThis.litPropertyMetadata.get(i);
566
- if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), o.set(e.name, r), s === "accessor") {
567
- const { name: n } = e;
568
- return { set(c) {
569
- const a = t.get.call(this);
570
- t.set.call(this, c), this.requestUpdate(n, a, r);
571
- }, init(c) {
572
- return c !== void 0 && this.P(n, void 0, r), c;
573
- } };
608
+ class z extends A {
609
+ render() {
610
+ if (this.annotation && this.item && this.page && this.canDrawAnnotation(this.annotation) && this.canDrawItem(this.item))
611
+ return this.renderAnnotation(
612
+ this.annotation,
613
+ this.item,
614
+ this.page,
615
+ this.prov
616
+ );
574
617
  }
575
- if (s === "setter") {
576
- const { name: n } = e;
577
- return function(c) {
578
- const a = this[n];
579
- t.call(this, c), this.requestUpdate(n, a, r);
580
- };
618
+ }
619
+ dt([
620
+ d({ attribute: !1 })
621
+ ], z.prototype, "annotation");
622
+ dt([
623
+ d({ attribute: !1 })
624
+ ], z.prototype, "item");
625
+ dt([
626
+ d({ attribute: !1 })
627
+ ], z.prototype, "page");
628
+ dt([
629
+ d({ attribute: !1 })
630
+ ], z.prototype, "prov");
631
+ function B(...i) {
632
+ return function(t) {
633
+ return b.DocItem(t) && i.includes(t.label);
634
+ };
635
+ }
636
+ var I = {
637
+ CodeItem: B("code"),
638
+ ListItem: B("list_item"),
639
+ PictureItem: B("chart", "picture"),
640
+ SectionHeaderItem: B("section_header"),
641
+ TableItem: B("document_index", "table"),
642
+ TextItem: B(
643
+ "caption",
644
+ "checkbox_selected",
645
+ "checkbox_unselected",
646
+ "footnote",
647
+ "page_footer",
648
+ "page_header",
649
+ "paragraph",
650
+ "reference",
651
+ "text"
652
+ )
653
+ };
654
+ function S(...i) {
655
+ return function(t) {
656
+ return i.includes(t.kind);
657
+ };
658
+ }
659
+ var Ot = {
660
+ PictureBarChart: S("bar_chart_data"),
661
+ PictureClassification: S("classification"),
662
+ PictureDescription: S("description"),
663
+ PictureMisc: S("misc"),
664
+ PictureMolecule: S("molecule_data"),
665
+ PictureLineChart: S("line_chart_data"),
666
+ PicturePieChart: S("pie_chart_data"),
667
+ PictureScatterChart: S("scatter_chart_data"),
668
+ PictureStackedBarChart: S(
669
+ "stacked_bar_chart_data"
670
+ )
671
+ }, b = {
672
+ DocItem(i) {
673
+ return b.NodeItem(i) && !b.GroupItem(i);
674
+ },
675
+ Document(i) {
676
+ return "schema_name" in i && i.schema_name === "DoclingDocument";
677
+ },
678
+ GroupItem(i) {
679
+ return b.NodeItem(i) && (i.self_ref.startsWith("#/groups/") || i.self_ref === "#/body");
680
+ },
681
+ NodeItem(i) {
682
+ return "self_ref" in i;
683
+ },
684
+ ...Ot,
685
+ ...I
686
+ };
687
+ function* xe(i, t = {}) {
688
+ i && (yield* e(t.root ?? i.body));
689
+ function* e(s, r = 0) {
690
+ var o;
691
+ if ((!b.GroupItem(s) || t.withGroups) && (b.DocItem(s) ? (t.pageNo === void 0 || (o = s.prov) != null && o.some((n) => n.page_no === t.pageNo)) && (yield [s, r]) : yield [s, r]), !(b.PictureItem(s) && !t.traversePictures))
692
+ for (const n of s.children ?? []) {
693
+ const h = Ce(i, n);
694
+ b.NodeItem(h) && (yield* e(h, r + 1));
695
+ }
696
+ }
697
+ }
698
+ function Ce(i, t) {
699
+ return t.$ref.split("/").slice(1).reduce(
700
+ (s, r) => s[r],
701
+ i
702
+ );
703
+ }
704
+ var Oe = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, Xt = (i, t, e, s) => {
705
+ for (var r = s > 1 ? void 0 : s ? Ee(t, e) : t, o = i.length - 1, n; o >= 0; o--)
706
+ (n = i[o]) && (r = (s ? n(t, e, r) : n(r)) || r);
707
+ return s && r && Oe(t, e, r), r;
708
+ };
709
+ let at = class extends z {
710
+ constructor() {
711
+ super(...arguments), this.precision = 2;
712
+ }
713
+ renderAnnotation(i, t, e, s) {
714
+ const r = i.predicted_classes ?? [], o = Math.pow(10, -1 * this.precision), n = r.filter((l) => o < l.confidence), h = r.filter((l) => l.confidence < o), a = (l) => l.toLocaleString(void 0, {
715
+ maximumFractionDigits: this.precision
716
+ });
717
+ return m`<table>
718
+ <thead>
719
+ <tr>
720
+ <th>Class</th>
721
+ <th>Confidence</th>
722
+ </tr>
723
+ </thead>
724
+ <tbody>
725
+ ${n.map(
726
+ ({ class_name: l, confidence: p }) => m`<tr>
727
+ <td>${l}</td>
728
+ <td>${a(p)}</td>
729
+ </tr>`
730
+ )}
731
+ ${h.length === 0 ? f : m`<tr
732
+ class="more"
733
+ title=${h.map((l) => `${l.class_name} ${l.confidence}`).join(`
734
+ `)}
735
+ >
736
+ <td>${h.length} more</td>
737
+ <td>< ${a(o)}</td>
738
+ </tr>`}
739
+ </tbody>
740
+ </table>`;
741
+ }
742
+ canDrawAnnotation(i) {
743
+ return Ot.PictureClassification(i);
744
+ }
745
+ canDrawItem(i) {
746
+ return I.PictureItem(i);
747
+ }
748
+ };
749
+ at.styles = O`
750
+ table {
751
+ margin: 0.5rem;
752
+ font-size: inherit;
753
+ line-height: 1.25;
754
+ }
755
+
756
+ td,
757
+ th {
758
+ padding: 0 1rem 0 0;
759
+ }
760
+
761
+ th {
762
+ font-weight: bold;
763
+ text-align: left;
764
+ }
765
+
766
+ tr.more td {
767
+ padding-top: 0.25rem;
768
+ color: gray;
769
+ }
770
+ `;
771
+ Xt([
772
+ d()
773
+ ], at.prototype, "precision", 2);
774
+ at = Xt([
775
+ Vt("docling-picture-classification")
776
+ ], at);
777
+ var Se = Object.getOwnPropertyDescriptor, Ie = (i, t, e, s) => {
778
+ for (var r = s > 1 ? void 0 : s ? Se(t, e) : t, o = i.length - 1, n; o >= 0; o--)
779
+ (n = i[o]) && (r = n(r) || r);
780
+ return r;
781
+ };
782
+ let _t = class extends z {
783
+ renderAnnotation(i, t, e, s) {
784
+ return m`<p><span>Description</span>${i.text}</p>`;
785
+ }
786
+ canDrawAnnotation(i) {
787
+ return Ot.PictureDescription(i);
788
+ }
789
+ canDrawItem(i) {
790
+ return I.PictureItem(i);
791
+ }
792
+ };
793
+ _t.styles = O`
794
+ p {
795
+ margin: 0.5rem;
796
+ font-size: inherit;
797
+ line-height: 1.25;
798
+ white-space: pre-line;
799
+ }
800
+
801
+ span {
802
+ padding-right: 0.5rem;
803
+ font-weight: bold;
804
+ }
805
+ `;
806
+ _t = Ie([
807
+ Vt("docling-picture-description")
808
+ ], _t);
809
+ const yt = [];
810
+ function Yt(i) {
811
+ const t = v(i);
812
+ return function(e, s) {
813
+ return yt.push(e), t(e, s);
814
+ };
815
+ }
816
+ var De = Object.defineProperty, Et = (i, t, e, s) => {
817
+ for (var r = void 0, o = i.length - 1, n; o >= 0; o--)
818
+ (n = i[o]) && (r = n(t, e, r) || r);
819
+ return r && De(t, e, r), r;
820
+ };
821
+ class D extends A {
822
+ render() {
823
+ if (this.item && this.page && this.canDrawItem(this.item))
824
+ return this.renderItem(this.item, this.page, this.prov);
825
+ }
826
+ }
827
+ Et([
828
+ d({ attribute: !1 })
829
+ ], D.prototype, "item");
830
+ Et([
831
+ d({ attribute: !1 })
832
+ ], D.prototype, "page");
833
+ Et([
834
+ d({ attribute: !1 })
835
+ ], D.prototype, "prov");
836
+ var Te = Object.getOwnPropertyDescriptor, je = (i, t, e, s) => {
837
+ for (var r = s > 1 ? void 0 : s ? Te(t, e) : t, o = i.length - 1, n; o >= 0; o--)
838
+ (n = i[o]) && (r = n(r) || r);
839
+ return r;
840
+ };
841
+ let ht = class extends D {
842
+ renderItem(i, t) {
843
+ var r;
844
+ const { image: e } = t, s = (r = i.prov) == null ? void 0 : r.find((o) => {
845
+ var n;
846
+ return o.page_no === ((n = this.page) == null ? void 0 : n.page_no);
847
+ });
848
+ if (e && s) {
849
+ const { width: o = 1, height: n = 1 } = this.page.size, { l: h, r: a, t: l, b: p } = q(s.bbox, t);
850
+ return m`
851
+ <svg
852
+ width=${(a - h) * ((e.size.width ?? 1) / o)}
853
+ viewBox="${h} ${l} ${a - h} ${p - l}"
854
+ >
855
+ <image href=${e.uri} width=${o} height=${n} />
856
+ </svg>
857
+ `;
858
+ } else
859
+ return m`<span>Invalid provenance.</span>`;
860
+ }
861
+ canDrawItem(i) {
862
+ return b.DocItem(i);
863
+ }
864
+ };
865
+ ht.styles = O`
866
+ svg {
867
+ max-width: 100%;
868
+ }
869
+ `;
870
+ ht = je([
871
+ v("docling-item-provenance")
872
+ ], ht);
873
+ var ke = Object.getOwnPropertyDescriptor, Ue = (i, t, e, s) => {
874
+ for (var r = s > 1 ? void 0 : s ? ke(t, e) : t, o = i.length - 1, n; o >= 0; o--)
875
+ (n = i[o]) && (r = n(r) || r);
876
+ return r;
877
+ };
878
+ let vt = class extends D {
879
+ renderItem(i) {
880
+ const t = /* @__PURE__ */ new Set();
881
+ return m`
882
+ <div class="container">
883
+ <table>
884
+ <tbody>
885
+ ${i.data.grid.map(
886
+ (s) => m`<tr>
887
+ ${s.map((r) => {
888
+ if (!e(r))
889
+ return m`<td
890
+ class=${r.column_header || r.row_header ? "header" : ""}
891
+ colspan=${r.col_span ?? 1}
892
+ rowspan=${r.row_span ?? 1}
893
+ >
894
+ ${r.text}
895
+ </td>`;
896
+ })}
897
+ </tr>`
898
+ )}
899
+ </tbody>
900
+ </table>
901
+ </div>
902
+ `;
903
+ function e(s) {
904
+ const r = t.has(
905
+ [s.start_col_offset_idx, s.start_row_offset_idx].join()
906
+ );
907
+ if (!r)
908
+ for (let o = s.start_col_offset_idx; o < s.end_col_offset_idx; o++)
909
+ for (let n = s.start_row_offset_idx; n < s.end_row_offset_idx; n++)
910
+ t.add([o, n].join());
911
+ return r;
912
+ }
913
+ }
914
+ canDrawItem(i) {
915
+ return I.TableItem(i);
916
+ }
917
+ };
918
+ vt.styles = O`
919
+ .container {
920
+ position: relative;
921
+ min-width: 0;
922
+ max-width: 100%;
923
+ min-height: 0;
924
+ overflow: auto;
925
+ }
926
+
927
+ table {
928
+ border-collapse: collapse;
929
+ font-size: 75%;
930
+ line-height: 1.25;
931
+ }
932
+
933
+ td {
934
+ padding: 0.125rem 0.25rem;
935
+ background-color: var(--cds-layer);
936
+ border: 1px solid rgb(220, 220, 220);
937
+
938
+ color: black;
939
+ text-decoration: none;
940
+ word-break: normal;
941
+ text-align: left;
942
+ }
943
+
944
+ td.header {
945
+ font-weight: bold;
946
+ }
947
+
948
+ td:hover {
949
+ filter: brightness(95%);
950
+ }
951
+
952
+ td:target {
953
+ outline: 3px solid blue;
954
+ }
955
+ `;
956
+ vt = Ue([
957
+ Yt("docling-item-table")
958
+ ], vt);
959
+ var Me = Object.getOwnPropertyDescriptor, Ne = (i, t, e, s) => {
960
+ for (var r = s > 1 ? void 0 : s ? Me(t, e) : t, o = i.length - 1, n; o >= 0; o--)
961
+ (n = i[o]) && (r = n(r) || r);
962
+ return r;
963
+ };
964
+ let Lt = class extends D {
965
+ constructor() {
966
+ super(...arguments), this.renderItem = Function(
967
+ "item",
968
+ "page",
969
+ `"use strict"; return this.html\`${this.innerHTML}\`;`
970
+ ).bind({ html: m });
971
+ }
972
+ canDrawItem(i) {
973
+ return b.DocItem(i);
974
+ }
975
+ };
976
+ Lt = Ne([
977
+ v("docling-item-template")
978
+ ], Lt);
979
+ var He = Object.getOwnPropertyDescriptor, Re = (i, t, e, s) => {
980
+ for (var r = s > 1 ? void 0 : s ? He(t, e) : t, o = i.length - 1, n; o >= 0; o--)
981
+ (n = i[o]) && (r = n(r) || r);
982
+ return r;
983
+ };
984
+ let bt = class extends D {
985
+ renderItem(i, t, e) {
986
+ const s = I.SectionHeaderItem(i) ? "header" : "";
987
+ if (e) {
988
+ const { l: r, r: o, t: n, b: h } = q(e.bbox, t), a = Math.sqrt((o - r) * (h - n) / i.text.length), l = Math.min(Math.floor(1.25 * a), (h - n) / 1.25), [p, c] = e.charspan ?? [
989
+ 0,
990
+ i.text.length
991
+ ], u = i.text.substring(p, c);
992
+ return m`<p
993
+ class=${s}
994
+ style="font-size: ${l}px; line-height: ${1.25 * l}px"
995
+ >
996
+ ${u}
997
+ </p>`;
998
+ } else
999
+ return m`<p class=${s}>${i.text}</p>`;
1000
+ }
1001
+ canDrawItem(i) {
1002
+ return I.TextItem(i) || I.SectionHeaderItem(i) || I.ListItem(i);
1003
+ }
1004
+ };
1005
+ bt.styles = O`
1006
+ p {
1007
+ margin: 0;
1008
+ overflow-wrap: anywhere;
1009
+ font-size: 1rem;
1010
+ line-height: 1.25rem;
1011
+ }
1012
+
1013
+ .header {
1014
+ font-weight: bold;
1015
+ }
1016
+ `;
1017
+ bt = Re([
1018
+ Yt("docling-item-text")
1019
+ ], bt);
1020
+ var ze = Object.getOwnPropertyDescriptor, St = (i, t, e, s) => {
1021
+ for (var r = s > 1 ? void 0 : s ? ze(t, e) : t, o = i.length - 1, n; o >= 0; o--)
1022
+ (n = i[o]) && (r = n(r) || r);
1023
+ return r;
1024
+ };
1025
+ let tt = class extends D {
1026
+ get itemChildren() {
1027
+ return Array.from(this.childNodes ?? []).filter(
1028
+ (i) => i instanceof D
1029
+ );
1030
+ }
1031
+ get annotationChildren() {
1032
+ return Array.from(this.childNodes).filter(
1033
+ (i) => i instanceof z
1034
+ );
1035
+ }
1036
+ get isCustomized() {
1037
+ return this.itemChildren.length > 0 || this.annotationChildren.length > 0;
1038
+ }
1039
+ renderItem(i, t, e) {
1040
+ const s = [], r = this.isCustomized;
1041
+ r ? this.itemChildren.filter((n) => n.canDrawItem(i)).forEach((n) => s.push(n)) : yt.filter((n) => n.prototype.canDrawItem(i)).forEach((n) => s.push(new n()));
1042
+ const o = i.annotations ?? [];
1043
+ for (const n of o) {
1044
+ const h = [];
1045
+ r ? this.annotationChildren.filter((a) => a.canDrawItem(a) && a.canDrawAnnotation(n)).forEach(
1046
+ (a) => h.push(a.cloneNode(!0))
1047
+ ) : $t.filter(
1048
+ (a) => a.prototype.canDrawItem(i) && a.prototype.canDrawAnnotation(n)
1049
+ ).forEach((a) => h.push(new a()));
1050
+ for (const a of h)
1051
+ a.annotation = n;
1052
+ s.push(...h);
1053
+ }
1054
+ for (const n of s)
1055
+ n.item = i, n.page = t, n.prov = e;
1056
+ return m`${s}`;
1057
+ }
1058
+ canDrawItem(i) {
1059
+ return b.DocItem(i) && this.isCustomized ? this.itemChildren.some((t) => t.canDrawItem(i)) || this.annotationChildren.some(
1060
+ (t) => {
1061
+ var e;
1062
+ return t.canDrawItem(i) && ((e = i.annotations) == null ? void 0 : e.some((s) => t.canDrawAnnotation(s)));
1063
+ }
1064
+ ) : yt.some((t) => t.prototype.canDrawItem(i)) || $t.some(
1065
+ (t) => {
1066
+ var e;
1067
+ return t.prototype.canDrawItem(i) && ((e = i.annotations) == null ? void 0 : e.some(
1068
+ (s) => t.prototype.canDrawAnnotation(s)
1069
+ ));
1070
+ }
1071
+ );
1072
+ }
1073
+ };
1074
+ tt = St([
1075
+ v("docling-view")
1076
+ ], tt);
1077
+ let wt = class extends tt {
1078
+ constructor() {
1079
+ super(...arguments), this.type = "overlay";
581
1080
  }
582
- throw Error("Unsupported decorator location: " + s);
583
1081
  };
584
- function v(r) {
585
- return (t, e) => typeof e == "object" ? jt(r, t, e) : ((s, i, o) => {
586
- const n = i.hasOwnProperty(o);
587
- return i.constructor.createProperty(o, n ? { ...s, wrapped: !0 } : s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
588
- })(r, t, e);
1082
+ wt = St([
1083
+ v("docling-overlay")
1084
+ ], wt);
1085
+ let At = class extends tt {
1086
+ constructor() {
1087
+ super(...arguments), this.type = "tooltip";
1088
+ }
1089
+ };
1090
+ At = St([
1091
+ v("docling-tooltip")
1092
+ ], At);
1093
+ function q(i, t) {
1094
+ const { height: e = 1 } = t.size;
1095
+ return i.coord_origin === "TOPLEFT" ? i : { ...i, t: e - i.t, b: e - i.b };
589
1096
  }
1097
+ var Be = Object.defineProperty, Le = Object.getOwnPropertyDescriptor, P = (i, t, e, s) => {
1098
+ for (var r = s > 1 ? void 0 : s ? Le(t, e) : t, o = i.length - 1, n; o >= 0; o--)
1099
+ (n = i[o]) && (r = (s ? n(t, e, r) : n(r)) || r);
1100
+ return s && r && Be(t, e, r), r;
1101
+ };
1102
+ let y = class extends A {
1103
+ constructor() {
1104
+ super(...arguments), this.pagenumbers = !1;
1105
+ }
1106
+ render() {
1107
+ var i, t, e;
1108
+ if ((i = this.page) != null && i.image) {
1109
+ const { image: s, size: r, page_no: o } = this.page, { width: n = 1, height: h = 1 } = r, a = this.onClickItem && this.page ? (l, p) => {
1110
+ var c;
1111
+ return (c = this.onClickItem) == null ? void 0 : c.call(this, l, this.page, p);
1112
+ } : void 0;
1113
+ return m`
1114
+ <div class="page" @onclick=${(l) => a == null ? void 0 : a(l)}>
1115
+ <svg
1116
+ class="base"
1117
+ width=${s.size.width}
1118
+ viewBox="0 0 ${n} ${h}"
1119
+ >
1120
+ ${this.backdrop ? st`
1121
+ <image
1122
+ class="backdrop"
1123
+ href=${s.uri}
1124
+ width=${n}
1125
+ height=${h}
1126
+ />
1127
+
1128
+ <clippath id="clip-page-${o}">
1129
+ ${(t = this.items) == null ? void 0 : t.map((l) => {
1130
+ var c;
1131
+ const p = (c = l.prov) == null ? void 0 : c.find((u) => u.page_no === o);
1132
+ if (p) {
1133
+ const { l: u, r: g, t: _, b: $ } = q(p.bbox, this.page);
1134
+ return st`<rect
1135
+ x=${u}
1136
+ y=${_}
1137
+ width=${g - u}
1138
+ height=${$ - _}
1139
+ />`;
1140
+ }
1141
+ })}
1142
+ </clippath>
1143
+ ` : f}
1144
+
1145
+ <image
1146
+ id="image"
1147
+ href=${s.uri}
1148
+ clip-path="url(#clip-page-${o})"
1149
+ width=${n}
1150
+ height=${h}
1151
+ />
1152
+
1153
+ ${(e = this.items) == null ? void 0 : e.flatMap(
1154
+ (l) => (l.prov ?? []).filter((p) => p.page_no === o).map((p) => {
1155
+ var $;
1156
+ const { l: c, r: u, t: g, b: _ } = q(p.bbox, this.page);
1157
+ return st`
1158
+ ${this.layOver(l, p)}
1159
+
1160
+ <rect
1161
+ part=${"item" + (this.itemPart ? " " + this.itemPart(this.page, l) : "")}
1162
+ style=${($ = this.itemStyle) == null ? void 0 : $.call(this, this.page, l)}
1163
+ x=${c}
1164
+ y=${g}
1165
+ width=${u - c}
1166
+ height=${_ - g}
1167
+ vector-effect="non-scaling-stroke"
1168
+ @click=${(rt) => {
1169
+ rt.stopPropagation(), a == null || a(rt, l);
1170
+ }}
1171
+ @mouseenter=${(rt) => {
1172
+ const G = rt.currentTarget.getBoundingClientRect(), Dt = [
1173
+ G.top * window.innerWidth,
1174
+ (window.innerWidth - G.right) * window.innerHeight,
1175
+ (window.innerHeight - G.bottom) * window.innerWidth,
1176
+ G.left * window.innerHeight
1177
+ ], ee = Math.max(...Dt), re = Dt.findIndex((se) => se === ee);
1178
+ this.attachTooltip(l, p, G, re);
1179
+ }}
1180
+ @mouseleave=${() => this.removeTooltip()}
1181
+ />
1182
+ `;
1183
+ })
1184
+ )}
1185
+ </svg>
1186
+
1187
+ ${this.renderTrace()}
1188
+ ${this.pagenumbers ? m`<header
1189
+ part="page-number-top"
1190
+ class="page-number-top"
1191
+ title="Page ${o}"
1192
+ >
1193
+ ${o}
1194
+ </header>
1195
+
1196
+ <header
1197
+ part="page-number-bottom"
1198
+ class="page-number-bottom"
1199
+ title="Page ${o}"
1200
+ >
1201
+ ${o}
1202
+ </header>` : f}
1203
+ </div>
1204
+ `;
1205
+ } else
1206
+ return m`Invalid page image.`;
1207
+ }
1208
+ layOver(i, t) {
1209
+ var e;
1210
+ if ((e = this.overlay) != null && e.canDrawItem(i)) {
1211
+ const s = this.overlay.cloneNode(!0);
1212
+ s.item = i, s.page = this.page, s.prov = t;
1213
+ const { l: r, r: o, t: n, b: h } = q(t.bbox, this.page), a = I.PictureItem(i) ? "softOverlay" : "hardOverlay";
1214
+ return st`<foreignObject part="overlay" class=${a} x=${r} y=${n} width=${o - r} height=${h - n}>${s}</foreignObject>`;
1215
+ }
1216
+ }
1217
+ attachTooltip(i, t, e, s) {
1218
+ var r;
1219
+ if ((r = this.tooltip) != null && r.canDrawItem(i)) {
1220
+ const o = this.tooltip.cloneNode(!0);
1221
+ o.id = "tooltip", o.setAttribute("part", "tooltip"), o.className = "tooltip", o.setAttribute(
1222
+ "style",
1223
+ `
1224
+ ${s === 1 ? `left: ${e.right}px` : s === 3 ? `right: ${window.outerWidth - e.left}px` : `left: calc(${e.left}px - 2rem)`};
1225
+ ${s === 0 ? `bottom: ${window.innerHeight - e.top}px` : s === 2 ? `top: ${e.bottom}px` : `top: calc(${e.top}px - 2rem)`};
1226
+ max-width: ${2 * Math.max(t.bbox.r - t.bbox.l, 200)}px;
1227
+ `
1228
+ ), o.item = i, o.page = this.page, this.renderRoot.appendChild(o);
1229
+ }
1230
+ }
1231
+ removeTooltip() {
1232
+ var i;
1233
+ (i = this.renderRoot.querySelector("#tooltip")) == null || i.remove();
1234
+ }
1235
+ renderTrace() {
1236
+ if (this.trace) {
1237
+ const i = this.trace.cloneNode(!0);
1238
+ return i.page = this.page, i.items = this.items, i;
1239
+ }
1240
+ }
1241
+ };
1242
+ y.styles = O`
1243
+ .page {
1244
+ position: relative;
1245
+ width: fit-content;
1246
+ color: black;
1247
+ }
1248
+
1249
+ .base {
1250
+ max-width: 100%;
1251
+ }
1252
+
1253
+ svg:not(.base) {
1254
+ position: absolute;
1255
+ inset: 0;
1256
+ }
1257
+
1258
+ .backdrop {
1259
+ opacity: 0.3;
1260
+ }
1261
+
1262
+ .page-number-top,
1263
+ .page-number-bottom {
1264
+ position: absolute;
1265
+ left: 0;
1266
+ width: fit-content;
1267
+ padding: 0 0.25rem;
1268
+
1269
+ font-size: 0.75rem;
1270
+ line-height: 1rem;
1271
+ color: rgb(120, 120, 120);
1272
+ mix-blend-mode: difference;
1273
+ }
1274
+
1275
+ .page-number-top {
1276
+ top: 0;
1277
+ }
1278
+
1279
+ .page-number-bottom {
1280
+ bottom: 0;
1281
+ }
1282
+
1283
+ rect {
1284
+ fill: blue;
1285
+ fill-opacity: 0.0001; /* To activate hover. */
1286
+ stroke: grey;
1287
+ stroke-width: 1px;
1288
+ stroke-dasharray: 1;
1289
+ cursor: pointer;
1290
+ }
1291
+
1292
+ rect:hover {
1293
+ fill-opacity: 0.1;
1294
+ stroke: blue;
1295
+ }
1296
+
1297
+ rect:target {
1298
+ stroke: blue;
1299
+ stroke-width: 3px;
1300
+ stroke-dasharray: none;
1301
+ }
1302
+
1303
+ .hardOverlay,
1304
+ .softOverlay {
1305
+ font-size: 62.5%;
1306
+ background-color: white;
1307
+ }
1308
+
1309
+ .softOverlay {
1310
+ opacity: 0.9;
1311
+ }
1312
+
1313
+ .tooltip {
1314
+ position: fixed;
1315
+ z-index: 100;
1316
+ padding: 1rem;
1317
+ margin: 1rem;
1318
+
1319
+ background: white;
1320
+ border: 1px solid rgb(230, 230, 230);
1321
+ box-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.2);
1322
+ }
1323
+ `;
1324
+ P([
1325
+ d({ type: Object })
1326
+ ], y.prototype, "page", 2);
1327
+ P([
1328
+ d({ type: Array })
1329
+ ], y.prototype, "items", 2);
1330
+ P([
1331
+ d({ type: Boolean })
1332
+ ], y.prototype, "pagenumbers", 2);
1333
+ P([
1334
+ d()
1335
+ ], y.prototype, "itemPart", 2);
1336
+ P([
1337
+ d()
1338
+ ], y.prototype, "itemStyle", 2);
1339
+ P([
1340
+ d()
1341
+ ], y.prototype, "onClickItem", 2);
1342
+ P([
1343
+ d({ type: Boolean })
1344
+ ], y.prototype, "backdrop", 2);
1345
+ P([
1346
+ d({ type: Object })
1347
+ ], y.prototype, "overlay", 2);
1348
+ P([
1349
+ d({ type: Object })
1350
+ ], y.prototype, "tooltip", 2);
1351
+ P([
1352
+ d({ type: Object })
1353
+ ], y.prototype, "trace", 2);
1354
+ y = P([
1355
+ v("docling-img-page")
1356
+ ], y);
590
1357
  /**
591
1358
  * @license
592
1359
  * Copyright 2017 Google LLC
593
1360
  * SPDX-License-Identifier: BSD-3-Clause
594
1361
  */
595
- const zt = Symbol();
596
- class Lt {
1362
+ const qe = Symbol();
1363
+ class Qt {
597
1364
  get taskComplete() {
598
1365
  return this.t || (this.i === 1 ? this.t = new Promise((t, e) => {
599
1366
  this.o = t, this.h = e;
@@ -602,8 +1369,8 @@ class Lt {
602
1369
  constructor(t, e, s) {
603
1370
  var o;
604
1371
  this.p = 0, this.i = 0, (this._ = t).addController(this);
605
- const i = typeof e == "object" ? e : { task: e, args: s };
606
- this.v = i.task, this.j = i.args, this.m = i.argsEqual ?? qt, this.k = i.onComplete, this.A = i.onError, this.autoRun = i.autoRun ?? !0, "initialValue" in i && (this.u = i.initialValue, this.i = 2, this.O = (o = this.T) == null ? void 0 : o.call(this));
1372
+ const r = typeof e == "object" ? e : { task: e, args: s };
1373
+ this.v = r.task, this.j = r.args, this.m = r.argsEqual ?? We, this.k = r.onComplete, this.A = r.onError, this.autoRun = r.autoRun ?? !0, "initialValue" in r && (this.u = r.initialValue, this.i = 2, this.O = (o = this.T) == null ? void 0 : o.call(this));
607
1374
  }
608
1375
  hostUpdate() {
609
1376
  this.autoRun === !0 && this.S();
@@ -622,32 +1389,32 @@ class Lt {
622
1389
  this.O = t, t === e || t === void 0 || e !== void 0 && this.m(e, t) || await this.run(t);
623
1390
  }
624
1391
  async run(t) {
625
- var n, c, a, p, d;
1392
+ var n, h, a, l, p;
626
1393
  let e, s;
627
1394
  t ?? (t = this.T()), this.O = t, this.i === 1 ? (n = this.q) == null || n.abort() : (this.t = void 0, this.o = void 0, this.h = void 0), this.i = 1, this.autoRun === "afterUpdate" ? queueMicrotask(() => this._.requestUpdate()) : this._.requestUpdate();
628
- const i = ++this.p;
1395
+ const r = ++this.p;
629
1396
  this.q = new AbortController();
630
1397
  let o = !1;
631
1398
  try {
632
1399
  e = await this.v(t, { signal: this.q.signal });
633
- } catch (h) {
634
- o = !0, s = h;
1400
+ } catch (c) {
1401
+ o = !0, s = c;
635
1402
  }
636
- if (this.p === i) {
637
- if (e === zt) this.i = 0;
1403
+ if (this.p === r) {
1404
+ if (e === qe) this.i = 0;
638
1405
  else {
639
1406
  if (o === !1) {
640
1407
  try {
641
- (c = this.k) == null || c.call(this, e);
1408
+ (h = this.k) == null || h.call(this, e);
642
1409
  } catch {
643
1410
  }
644
1411
  this.i = 2, (a = this.o) == null || a.call(this, e);
645
1412
  } else {
646
1413
  try {
647
- (p = this.A) == null || p.call(this, s);
1414
+ (l = this.A) == null || l.call(this, s);
648
1415
  } catch {
649
1416
  }
650
- this.i = 3, (d = this.h) == null || d.call(this, s);
1417
+ this.i = 3, (p = this.h) == null || p.call(this, s);
651
1418
  }
652
1419
  this.u = e, this.l = s;
653
1420
  }
@@ -668,14 +1435,14 @@ class Lt {
668
1435
  return this.i;
669
1436
  }
670
1437
  render(t) {
671
- var e, s, i, o;
1438
+ var e, s, r, o;
672
1439
  switch (this.i) {
673
1440
  case 0:
674
1441
  return (e = t.initial) == null ? void 0 : e.call(t);
675
1442
  case 1:
676
1443
  return (s = t.pending) == null ? void 0 : s.call(t);
677
1444
  case 2:
678
- return (i = t.complete) == null ? void 0 : i.call(t, this.value);
1445
+ return (r = t.complete) == null ? void 0 : r.call(t, this.value);
679
1446
  case 3:
680
1447
  return (o = t.error) == null ? void 0 : o.call(t, this.error);
681
1448
  default:
@@ -683,314 +1450,436 @@ class Lt {
683
1450
  }
684
1451
  }
685
1452
  }
686
- const qt = (r, t) => r === t || r.length === t.length && r.every((e, s) => !B(e, t[s]));
687
- function x(...r) {
688
- return function(t) {
689
- return y.DocItem(t) && r.includes(t.label);
690
- };
691
- }
692
- var Bt = {
693
- CodeItem: x("code"),
694
- ListItem: x("list_item"),
695
- PictureItem: x("picture"),
696
- SectionHeaderItem: x("section_header"),
697
- TableItem: x("document_index", "table"),
698
- TextItem: x(
699
- "caption",
700
- "checkbox_selected",
701
- "checkbox_unselected",
702
- "footnote",
703
- "page_footer",
704
- "page_header",
705
- "paragraph",
706
- "reference",
707
- "text"
708
- )
709
- }, y = {
710
- Document(r) {
711
- return "schema_name" in r && r.schema_name === "DoclingDocument";
712
- },
713
- NodeItem(r) {
714
- return "self_ref" in r;
715
- },
716
- GroupItem(r) {
717
- return y.NodeItem(r) && (r.self_ref.startsWith("#/groups/") || r.self_ref === "#/body");
718
- },
719
- DocItem(r) {
720
- return y.NodeItem(r) && !y.GroupItem(r);
721
- },
722
- ...Bt
723
- };
724
- function* Wt(r, t = {}) {
725
- r && (yield* e(t.root ?? r.body));
726
- function* e(s, i = 0) {
727
- var o;
728
- if ((!y.GroupItem(s) || t.withGroups) && (y.DocItem(s) ? (t.pageNo === void 0 || (o = s.prov) != null && o.some((n) => n.page_no === t.pageNo)) && (yield [s, i]) : yield [s, i]), !(y.PictureItem(s) && !t.traversePictures))
729
- for (const n of s.children ?? []) {
730
- const c = Vt(r, n);
731
- y.NodeItem(c) && (yield* e(c, i + 1));
732
- }
733
- }
734
- }
735
- function Vt(r, t) {
736
- return t.$ref.split("/").slice(1).reduce(
737
- (s, i) => s[i],
738
- r
739
- );
740
- }
741
- function Gt(r) {
742
- return Object.values((r == null ? void 0 : r.pages) ?? {}).sort(
1453
+ const We = (i, t) => i === t || i.length === t.length && i.every((e, s) => !ct(e, t[s]));
1454
+ function Ve(i) {
1455
+ return Object.values((i == null ? void 0 : i.pages) ?? {}).sort(
743
1456
  (t, e) => t.page_no - e.page_no
744
1457
  );
745
1458
  }
746
- async function Ft(r, t = {}) {
747
- var a, p, d;
1459
+ async function te(i, t = {}) {
1460
+ var a, l, p;
748
1461
  let e;
749
- typeof r == "string" ? e = await (await fetch(r)).json() : typeof r == "object" && y.Document(r) && (e = r);
750
- const s = Gt(e), i = Array.from(Wt(e)).map(
751
- ([h]) => h
752
- );
753
- let o = i;
1462
+ typeof i == "string" ? e = await (await fetch(i)).json() : typeof i == "object" && b.Document(i) && (e = i);
1463
+ const s = Ve(e), r = Array.from(
1464
+ xe(e, { traversePictures: !0 })
1465
+ ).map(([c]) => c);
1466
+ let o = r;
754
1467
  const n = /* @__PURE__ */ new Set();
755
1468
  if (typeof t.items == "string") {
756
- const h = new Set(
757
- t.items.split(",").map((l) => l.trim()).filter((l) => l.length > 0)
1469
+ const c = new Set(
1470
+ t.items.split(",").map((u) => u.trim()).filter((u) => u.length > 0)
758
1471
  );
759
- if (h.size > 0) {
1472
+ if (c.size > 0) {
760
1473
  o = [];
761
- for (const l of i) {
762
- const u = l.self_ref.split("/"), m = [];
763
- for (let f = 2; f < u.length + 1; f++)
764
- m.push(u.slice(0, f).join("/"));
765
- (a = l.prov) == null || a.forEach((f) => m.push(`#/pages/${f.page_no}`)), m.some((f) => h.has(f)) ? o.push(l) : (p = l.prov) == null || p.forEach((f) => n.add(f.page_no));
1474
+ for (const u of r) {
1475
+ const g = u.self_ref.split("/"), _ = [];
1476
+ for (let $ = 2; $ < g.length + 1; $++)
1477
+ _.push(g.slice(0, $).join("/"));
1478
+ (a = u.prov) == null || a.forEach(($) => _.push(`#/pages/${$.page_no}`)), _.some(($) => c.has($)) ? o.push(u) : (l = u.prov) == null || l.forEach(($) => n.add($.page_no));
766
1479
  }
767
1480
  }
768
1481
  } else if (Array.isArray(t.items)) {
769
1482
  o = [];
770
- const h = new Set(t.items);
771
- for (const l of i)
772
- h.has(l) ? o.push(l) : (d = l.prov) == null || d.forEach((u) => n.add(u.page_no));
773
- }
774
- const c = {};
775
- for (const h of s)
776
- c[h.page_no] = [];
777
- for (const h of o)
778
- for (const l of h.prov ?? [])
779
- c[l.page_no].push(h);
780
- return s.map((h) => ({
781
- page: h,
782
- items: c[h.page_no],
783
- trimmed: n.has(h.page_no)
1483
+ const c = new Set(t.items);
1484
+ for (const u of r)
1485
+ c.has(u) ? o.push(u) : (p = u.prov) == null || p.forEach((g) => n.add(g.page_no));
1486
+ }
1487
+ const h = {};
1488
+ for (const c of s)
1489
+ h[c.page_no] = [];
1490
+ for (const c of o)
1491
+ for (const u of c.prov ?? [])
1492
+ h[u.page_no].at(-1) !== c && h[u.page_no].push(c);
1493
+ return s.map((c) => ({
1494
+ page: c,
1495
+ items: h[c.page_no],
1496
+ trimmed: n.has(c.page_no)
784
1497
  }));
785
1498
  }
786
- function Jt({
787
- page: r,
788
- items: t = [],
789
- pagenumbers: e,
790
- backdrop: s,
791
- // tooltip,
792
- itemPart: i,
793
- itemStyle: o,
794
- onclickitem: n
795
- }) {
796
- if (r.image) {
797
- const { size: a } = r, { width: p = 1, height: d = 1 } = a, h = n ? (l, u) => n(l, r, u) : void 0;
798
- return A`
799
- <div part="page" class="page" @onclick=${(l) => h == null ? void 0 : h(l)} role="tab">
800
- <svg width=${r.image.size.width} viewBox="0 0 ${p} ${d}">
801
- <!-- Suppressed backdrop image. -->
802
- ${s ? A`
803
- <image
804
- class="backdrop"
805
- href=${r.image.uri}
806
- width=${p}
807
- height=${d}
808
- />
809
-
810
- <clippath id="clip-page-${r.page_no}">
811
- ${t.map((l) => {
812
- var m;
813
- const u = (m = l.prov) == null ? void 0 : m.find((f) => f.page_no === r.page_no);
814
- if (u) {
815
- const { l: f, r: V, t: O, b: G } = u.bbox;
816
- return A`<rect
817
- x=${f}
818
- y=${d - O}
819
- width=${V - f}
820
- height=${O - G}
821
- />`;
822
- }
823
- })}
824
- </clippath>
825
- ` : ""}
826
-
827
- <!-- Foreground image. -->
828
- <image
829
- id="image"
830
- href=${r.image.uri}
831
- clip-path="url(#clip-page-${r.page_no})"
832
- width=${p}
833
- height${d}
834
- />
835
-
836
- ${t.map((l) => {
837
- var m;
838
- const u = (m = l.prov) == null ? void 0 : m.find((f) => f.page_no === r.page_no);
839
- if (u) {
840
- const { l: f, r: V, t: O, b: G } = u.bbox;
841
- return A`<rect
842
- part=${"item" + (i ? " " + i(r, l) : "")}
843
- style=${o == null ? void 0 : o(r, l)}
844
- x=${f}
845
- y=${d - O}
846
- width=${V - f}
847
- height=${O - G}
848
- vector-effect="non-scaling-stroke"
849
- @onclick=${(tt) => {
850
- tt.stopPropagation(), h == null || h(tt, l);
851
- }}
852
- @onmouseenter={(e: MouseEvent) => {
853
- const bounds = e.currentTarget.getBoundingClientRect();
854
-
855
- // Sizes of surrounding areas: Top, right, bottom, left.
856
- const areas = [
857
- bounds.top * window.innerWidth,
858
- (window.innerWidth - bounds.right) * window.innerHeight,
859
- (window.innerHeight - bounds.bottom) * window.innerWidth,
860
- bounds.left * window.innerHeight,
861
- ];
862
- const maxArea = Math.max(...areas);
863
- const quadrant = areas.findIndex(a => a === maxArea);
864
-
865
- hovered = {
866
- item,
867
- bounds,
868
- quadrant,
869
- };
870
- }}
871
- />`;
872
- }
873
- })}
874
- </svg>
875
-
876
- ${e ? A`<header
877
- part="page-number-top"
878
- class="page-number-top"
879
- title="Page ${r.page_no}"
880
- >
881
- ${r.page_no}
882
- </header>
1499
+ var Fe = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, It = (i, t, e, s) => {
1500
+ for (var r = s > 1 ? void 0 : s ? Ge(t, e) : t, o = i.length - 1, n; o >= 0; o--)
1501
+ (n = i[o]) && (r = (s ? n(t, e, r) : n(r)) || r);
1502
+ return s && r && Fe(t, e, r), r;
1503
+ };
1504
+ let F = class extends A {
1505
+ render() {
1506
+ if (this.page && this.items && this.items.length > 0) {
1507
+ const { page_no: i, size: t } = this.page, { width: e = 1, height: s = 1 } = t, r = this.items.map((n) => {
1508
+ var a, l;
1509
+ const h = q((l = (a = n.prov) == null ? void 0 : a.find((p) => p.page_no === i)) == null ? void 0 : l.bbox, this.page);
1510
+ return [
1511
+ (h.l + h.r) / 2,
1512
+ (h.t + h.b) / 2
1513
+ ];
1514
+ }), o = `M${r[0][0]} 0 ${r.slice(0).map((n) => `L${n[0]} ${n[1]}`)} L${r.at(-1)[0]} ${s}`;
1515
+ return m`<svg viewBox="0 0 ${e} ${s}">
1516
+ <marker
1517
+ id="arrow"
1518
+ viewBox="0 0 10 10"
1519
+ refX="0"
1520
+ refY="5"
1521
+ markerWidth="4"
1522
+ markerHeight="4"
1523
+ orient="auto"
1524
+ >
1525
+ <path d="M 0 0 L 10 5 L 0 10" />
1526
+ </marker>
883
1527
 
884
- <header
885
- part="page-number-bottom"
886
- class="page-number-bottom"
887
- title="Page ${r.page_no}"
888
- >
889
- ${r.page_no}
890
- </header>` : ""}
1528
+ <path
1529
+ class="halo"
1530
+ vector-effect="non-scaling-stroke"
1531
+ d=${o}
1532
+ marker-start="url(#arrow)"
1533
+ />
891
1534
 
892
- <!-- Tooltip. -->
893
- ${c()}
894
- </div>
895
- `;
896
- } else
897
- return A`Invalid page image.`;
898
- function c() {
899
- return "";
1535
+ <path
1536
+ class="trace"
1537
+ vector-effect="non-scaling-stroke"
1538
+ d=${o}
1539
+ marker-start="url(#arrow)"
1540
+ />
1541
+ </svg>`;
1542
+ }
900
1543
  }
901
- }
902
- const Kt = ut`
903
- .page {
904
- width: fit-content;
905
- max-width: 100%;
1544
+ };
1545
+ F.styles = O`
1546
+ svg {
1547
+ position: absolute;
1548
+ inset: 0;
1549
+ pointer-events: none;
1550
+ }
906
1551
 
907
- display: flex;
908
- flex-direction: column;
909
- align-items: center;
910
- gap: 2px;
1552
+ .halo {
1553
+ fill: none;
1554
+ stroke-width: 5px;
1555
+ stroke: white;
1556
+ stroke-linejoin: round;
1557
+ }
911
1558
 
912
- color: black;
913
- }
914
- `;
915
- var Zt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, _ = (r, t, e, s) => {
916
- for (var i = s > 1 ? void 0 : s ? Qt(t, e) : t, o = r.length - 1, n; o >= 0; o--)
917
- (n = r[o]) && (i = (s ? n(t, e, i) : n(i)) || i);
918
- return s && i && Zt(t, e, i), i;
1559
+ .trace {
1560
+ fill: none;
1561
+ stroke-width: 3px;
1562
+ stroke: rgba(0, 0, 255);
1563
+ stroke-linejoin: round;
1564
+ }
1565
+
1566
+ marker > path {
1567
+ fill: rgba(0, 0, 255);
1568
+ stroke: none;
1569
+ }
1570
+ `;
1571
+ It([
1572
+ d({ type: Object })
1573
+ ], F.prototype, "page", 2);
1574
+ It([
1575
+ d({ type: Array })
1576
+ ], F.prototype, "items", 2);
1577
+ F = It([
1578
+ v("docling-trace")
1579
+ ], F);
1580
+ var Ke = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, E = (i, t, e, s) => {
1581
+ for (var r = s > 1 ? void 0 : s ? Je(t, e) : t, o = i.length - 1, n; o >= 0; o--)
1582
+ (n = i[o]) && (r = (s ? n(t, e, r) : n(r)) || r);
1583
+ return s && r && Ke(t, e, r), r;
919
1584
  };
920
- let g = class extends R {
1585
+ let w = class extends A {
921
1586
  constructor() {
922
- super(...arguments), this.src = "", this.trim = "pages", this._fetchTask = new Lt(this, {
923
- task: async ([r, t]) => Ft(r, { items: t }),
1587
+ super(...arguments), this.src = "", this.trim = "pages", this.fetchTask = new Qt(this, {
1588
+ task: async ([i, t]) => te(i, { items: t }),
924
1589
  args: () => [this.src, this.items]
925
1590
  });
926
1591
  }
927
1592
  render() {
928
- return this._fetchTask.render({
929
- pending: () => A`<p>...</p>`,
930
- complete: (r) => A`
931
- <div part="paged">
932
- ${r.filter((t) => !this.trim || t.items.length > 0).map(
933
- ({ page: t, items: e }) => Jt({
934
- page: t,
935
- items: e,
936
- pagenumbers: this.pagenumbers !== void 0,
937
- backdrop: this.backdrop !== void 0,
938
- itemPart: this.itemPart,
939
- itemStyle: this.itemStyle,
940
- onclickitem: this.onclickitem
941
- })
1593
+ const i = Array.from(this.childNodes);
1594
+ return this.fetchTask.render({
1595
+ pending: () => m`<p>...</p>`,
1596
+ complete: (t) => m`
1597
+ ${t.filter((e) => !this.trim || e.items.length > 0).map(
1598
+ ({ page: e, items: s }) => m`<docling-img-page
1599
+ part="page"
1600
+ .page=${e}
1601
+ .items=${s}
1602
+ .pagenumbers=${this.pagenumbers !== void 0}
1603
+ .itemPart=${this.itemPart}
1604
+ .itemStyle=${this.itemStyle}
1605
+ .onClickItem=${this.onClickItem}
1606
+ .backdrop=${this.backdrop !== void 0}
1607
+ .overlay=${i.find((r) => r instanceof wt)}
1608
+ .tooltip=${i.find((r) => r instanceof At)}
1609
+ .trace=${i.find((r) => r instanceof F)}
1610
+ />`
942
1611
  )}
943
- </div>
944
1612
  `
945
1613
  });
946
1614
  }
947
1615
  };
948
- g.styles = [
949
- ut`
950
- div {
951
- width: fit-content;
952
- max-width: 100%;
1616
+ w.styles = O`
1617
+ :host {
1618
+ width: fit-content;
953
1619
 
954
- display: flex;
955
- flex-direction: column;
956
- align-items: center;
957
- gap: 2px;
1620
+ display: flex;
1621
+ flex-direction: column;
1622
+ align-items: center;
1623
+ gap: 2px;
958
1624
 
959
- color: black;
1625
+ color: black;
1626
+ }
1627
+ `;
1628
+ E([
1629
+ d()
1630
+ ], w.prototype, "alt", 2);
1631
+ E([
1632
+ d()
1633
+ ], w.prototype, "backdrop", 2);
1634
+ E([
1635
+ d()
1636
+ ], w.prototype, "items", 2);
1637
+ E([
1638
+ d({ type: Boolean })
1639
+ ], w.prototype, "pagenumbers", 2);
1640
+ E([
1641
+ d()
1642
+ ], w.prototype, "src", 2);
1643
+ E([
1644
+ d()
1645
+ ], w.prototype, "trim", 2);
1646
+ E([
1647
+ d()
1648
+ ], w.prototype, "itemPart", 2);
1649
+ E([
1650
+ d()
1651
+ ], w.prototype, "itemStyle", 2);
1652
+ E([
1653
+ d()
1654
+ ], w.prototype, "onClickItem", 2);
1655
+ w = E([
1656
+ v("docling-img")
1657
+ ], w);
1658
+ /**
1659
+ * @license
1660
+ * Copyright 2018 Google LLC
1661
+ * SPDX-License-Identifier: BSD-3-Clause
1662
+ */
1663
+ const Ze = (i) => i ?? f;
1664
+ var Xe = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, k = (i, t, e, s) => {
1665
+ for (var r = s > 1 ? void 0 : s ? Ye(t, e) : t, o = i.length - 1, n; o >= 0; o--)
1666
+ (n = i[o]) && (r = (s ? n(t, e, r) : n(r)) || r);
1667
+ return s && r && Xe(t, e, r), r;
1668
+ };
1669
+ let x = class extends A {
1670
+ constructor() {
1671
+ super(...arguments), this.columns = [];
1672
+ }
1673
+ render() {
1674
+ var i, t, e, s, r, o, n;
1675
+ return m`
1676
+ ${this.pagenumbers ? m`
1677
+ <tr>
1678
+ <td
1679
+ part="page-number-top"
1680
+ class="page-number"
1681
+ title="Page ${(i = this.page) == null ? void 0 : i.page_no}"
1682
+ colspan=${((t = this.columns) == null ? void 0 : t.length) ?? 1}
1683
+ >
1684
+ ${(e = this.page) == null ? void 0 : e.page_no}
1685
+ </td>
1686
+ </tr>
1687
+ ` : f}
1688
+ ${(s = this.items) == null ? void 0 : s.map(
1689
+ (h) => {
1690
+ var a;
1691
+ return m`<tr
1692
+ part=${"item" + (this.itemPart ? " " + this.itemPart(this.page, h) : "")}
1693
+ style=${Ze((a = this.itemStyle) == null ? void 0 : a.call(this, this.page, h))}
1694
+ >
1695
+ ${this.columns.map((l) => {
1696
+ const p = l.cloneNode(!0);
1697
+ return p.item = h, p.page = this.page, m`
1698
+ <td
1699
+ @onclick=${(c) => {
1700
+ var u;
1701
+ return (u = this.onClickItem) == null ? void 0 : u.call(this, c, this.page, h);
1702
+ }}
1703
+ >
1704
+ ${p}
1705
+ </td>
1706
+ `;
1707
+ })}
1708
+ </tr>`;
960
1709
  }
961
- `,
962
- Kt
963
- ];
964
- _([
965
- v()
966
- ], g.prototype, "alt", 2);
967
- _([
968
- v()
969
- ], g.prototype, "backdrop", 2);
970
- _([
971
- v()
972
- ], g.prototype, "items", 2);
973
- _([
974
- v()
975
- ], g.prototype, "pagenumbers", 2);
976
- _([
977
- v()
978
- ], g.prototype, "src", 2);
979
- _([
980
- v()
981
- ], g.prototype, "trim", 2);
982
- _([
983
- v()
984
- ], g.prototype, "itemPart", 2);
985
- _([
986
- v()
987
- ], g.prototype, "itemStyle", 2);
988
- _([
989
- v()
990
- ], g.prototype, "onclickitem", 2);
991
- g = _([
992
- Mt("docling-img")
993
- ], g);
1710
+ )}
1711
+ ${this.pagenumbers ? m`<tr>
1712
+ <td
1713
+ part="page-number-bottom"
1714
+ class="page-number"
1715
+ title="Page ${(r = this.page) == null ? void 0 : r.page_no}"
1716
+ colspan=${((o = this.columns) == null ? void 0 : o.length) ?? 1}
1717
+ >
1718
+ ${(n = this.page) == null ? void 0 : n.page_no}
1719
+ </td>
1720
+ </tr>` : f}
1721
+ `;
1722
+ }
1723
+ };
1724
+ x.styles = O`
1725
+ :host {
1726
+ display: table-row-group;
1727
+ }
1728
+
1729
+ tbody {
1730
+ border-bottom: 1px solid rgb(220, 220, 220);
1731
+ }
1732
+
1733
+ .page-number {
1734
+ padding: 0.25rem;
1735
+
1736
+ background-color: white;
1737
+ color: rgb(120, 120, 120);
1738
+ font-size: 0.75rem;
1739
+ line-height: 1rem;
1740
+ }
1741
+
1742
+ tr {
1743
+ cursor: pointer;
1744
+ }
1745
+
1746
+ tr:not(:nth-last-child(2)) {
1747
+ border-bottom: 1px dotted rgb(220, 220, 220);
1748
+ }
1749
+
1750
+ td {
1751
+ padding: 1rem;
1752
+ background-color: white;
1753
+ vertical-align: top;
1754
+ }
1755
+
1756
+ tr:hover td {
1757
+ filter: brightness(95%);
1758
+ }
1759
+ `;
1760
+ k([
1761
+ d({ type: Object })
1762
+ ], x.prototype, "page", 2);
1763
+ k([
1764
+ d({ type: Array })
1765
+ ], x.prototype, "items", 2);
1766
+ k([
1767
+ d({ type: Array })
1768
+ ], x.prototype, "columns", 2);
1769
+ k([
1770
+ d({ type: Boolean })
1771
+ ], x.prototype, "pagenumbers", 2);
1772
+ k([
1773
+ d()
1774
+ ], x.prototype, "itemPart", 2);
1775
+ k([
1776
+ d()
1777
+ ], x.prototype, "itemStyle", 2);
1778
+ k([
1779
+ d()
1780
+ ], x.prototype, "onClickItem", 2);
1781
+ x = k([
1782
+ v("docling-table-page")
1783
+ ], x);
1784
+ var Qe = Object.getOwnPropertyDescriptor, tr = (i, t, e, s) => {
1785
+ for (var r = s > 1 ? void 0 : s ? Qe(t, e) : t, o = i.length - 1, n; o >= 0; o--)
1786
+ (n = i[o]) && (r = n(r) || r);
1787
+ return r;
1788
+ };
1789
+ let lt = class extends tt {
1790
+ constructor() {
1791
+ super(...arguments), this.type = "column";
1792
+ }
1793
+ };
1794
+ lt = tr([
1795
+ v("docling-column")
1796
+ ], lt);
1797
+ var er = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, U = (i, t, e, s) => {
1798
+ for (var r = s > 1 ? void 0 : s ? rr(t, e) : t, o = i.length - 1, n; o >= 0; o--)
1799
+ (n = i[o]) && (r = (s ? n(t, e, r) : n(r)) || r);
1800
+ return s && r && er(t, e, r), r;
1801
+ };
1802
+ let C = class extends A {
1803
+ constructor() {
1804
+ super(...arguments), this.src = "", this.fetchTask = new Qt(this, {
1805
+ task: async ([i, t]) => te(i, { items: t }),
1806
+ args: () => [this.src, this.items]
1807
+ });
1808
+ }
1809
+ render() {
1810
+ const i = Array.from(this.childNodes).filter(
1811
+ (e) => e.nodeName.toLowerCase().startsWith("docling-column")
1812
+ ), t = i.length > 0 ? i : [new lt(), new lt()];
1813
+ return i.length === 0 && t[1].appendChild(new ht()), this.fetchTask.render({
1814
+ pending: () => m`<p>...</p>`,
1815
+ complete: (e) => m`
1816
+ <table part="pages">
1817
+ ${e.filter((s) => s.items.length > 0).map(
1818
+ ({ page: s, items: r }) => m`<docling-table-page
1819
+ .page=${s}
1820
+ .items=${r}
1821
+ .columns=${t}
1822
+ .pagenumbers=${this.pagenumbers !== void 0}
1823
+ .itemPart=${this.itemPart}
1824
+ .itemStyle=${this.itemStyle}
1825
+ .onClickItem=${this.onClickItem}
1826
+ />`
1827
+ )}
1828
+ </table>
1829
+ `
1830
+ });
1831
+ }
1832
+ };
1833
+ C.styles = O`
1834
+ table {
1835
+ width: 100%;
1836
+ border-collapse: collapse;
1837
+ table-layout: fixed;
1838
+ background-color: white;
1839
+ }
1840
+ `;
1841
+ U([
1842
+ d()
1843
+ ], C.prototype, "alt", 2);
1844
+ U([
1845
+ d()
1846
+ ], C.prototype, "items", 2);
1847
+ U([
1848
+ d({ type: Boolean })
1849
+ ], C.prototype, "pagenumbers", 2);
1850
+ U([
1851
+ d()
1852
+ ], C.prototype, "src", 2);
1853
+ U([
1854
+ d()
1855
+ ], C.prototype, "itemPart", 2);
1856
+ U([
1857
+ d()
1858
+ ], C.prototype, "itemStyle", 2);
1859
+ U([
1860
+ d()
1861
+ ], C.prototype, "onClickItem", 2);
1862
+ C = U([
1863
+ v("docling-table")
1864
+ ], C);
994
1865
  export {
995
- g as ImgPages
1866
+ at as AnnotationPictureClassification,
1867
+ _t as AnnotationPictureDescription,
1868
+ z as DoclingAnnotationElement,
1869
+ D as DoclingItemElement,
1870
+ y as ImgPage,
1871
+ w as ImgPages,
1872
+ F as ImgTrace,
1873
+ wt as ItemOverlay,
1874
+ ht as ItemProvenance,
1875
+ vt as ItemTable,
1876
+ Lt as ItemTemplate,
1877
+ bt as ItemText,
1878
+ At as ItemTooltip,
1879
+ tt as ItemView,
1880
+ x as TablePage,
1881
+ C as TablePages,
1882
+ Vt as customDoclingAnnotationElement,
1883
+ Yt as customDoclingItemElement,
1884
+ q as normalBbox
996
1885
  };