@eox/drawtools 0.6.0 → 0.6.1

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.
@@ -1,32 +1,32 @@
1
- var yt = Object.defineProperty;
2
- var gt = (r, t, e) => t in r ? yt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var A = (r, t, e) => (gt(r, typeof t != "symbol" ? t + "" : t, e), e), J = (r, t, e) => {
4
- if (!t.has(r))
1
+ var bt = Object.defineProperty;
2
+ var wt = (i, t, e) => t in i ? bt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var g = (i, t, e) => (wt(i, typeof t != "symbol" ? t + "" : t, e), e), Q = (i, t, e) => {
4
+ if (!t.has(i))
5
5
  throw TypeError("Cannot " + e);
6
6
  };
7
- var $ = (r, t, e) => (J(r, t, "read from private field"), e ? e.call(r) : t.get(r)), V = (r, t, e) => {
8
- if (t.has(r))
7
+ var m = (i, t, e) => (Q(i, t, "read from private field"), e ? e.call(i) : t.get(i)), H = (i, t, e) => {
8
+ if (t.has(i))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- t instanceof WeakSet ? t.add(r) : t.set(r, e);
11
- }, R = (r, t, e, s) => (J(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e);
10
+ t instanceof WeakSet ? t.add(i) : t.set(i, e);
11
+ }, M = (i, t, e, s) => (Q(i, t, "write to private field"), s ? s.call(i, e) : t.set(i, e), e);
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2019 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const T = globalThis, Z = T.ShadowRoot && (T.ShadyCSS === void 0 || T.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, nt = Symbol(), K = /* @__PURE__ */ new WeakMap();
18
- let ft = class {
17
+ const R = globalThis, J = R.ShadowRoot && (R.ShadyCSS === void 0 || R.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, dt = Symbol(), X = /* @__PURE__ */ new WeakMap();
18
+ let At = class {
19
19
  constructor(t, e, s) {
20
- if (this._$cssResult$ = !0, s !== nt)
20
+ if (this._$cssResult$ = !0, s !== dt)
21
21
  throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
22
22
  this.cssText = t, this.t = e;
23
23
  }
24
24
  get styleSheet() {
25
25
  let t = this.o;
26
26
  const e = this.t;
27
- if (Z && t === void 0) {
27
+ if (J && t === void 0) {
28
28
  const s = e !== void 0 && e.length === 1;
29
- s && (t = K.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && K.set(e, t));
29
+ s && (t = X.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && X.set(e, t));
30
30
  }
31
31
  return t;
32
32
  }
@@ -34,55 +34,55 @@ let ft = class {
34
34
  return this.cssText;
35
35
  }
36
36
  };
37
- const mt = (r) => new ft(typeof r == "string" ? r : r + "", void 0, nt), _t = (r, t) => {
38
- if (Z)
39
- r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
37
+ const vt = (i) => new At(typeof i == "string" ? i : i + "", void 0, dt), xt = (i, t) => {
38
+ if (J)
39
+ i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
40
40
  else
41
41
  for (const e of t) {
42
- const s = document.createElement("style"), i = T.litNonce;
43
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
42
+ const s = document.createElement("style"), r = R.litNonce;
43
+ r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s);
44
44
  }
45
- }, G = Z ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
45
+ }, Y = J ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
46
46
  let e = "";
47
47
  for (const s of t.cssRules)
48
48
  e += s.cssText;
49
- return mt(e);
50
- })(r) : r;
49
+ return vt(e);
50
+ })(i) : i;
51
51
  /**
52
52
  * @license
53
53
  * Copyright 2017 Google LLC
54
54
  * SPDX-License-Identifier: BSD-3-Clause
55
55
  */
56
- const { is: wt, defineProperty: bt, getOwnPropertyDescriptor: At, getOwnPropertyNames: vt, getOwnPropertySymbols: xt, getPrototypeOf: Et } = Object, m = globalThis, Q = m.trustedTypes, St = Q ? Q.emptyScript : "", B = m.reactiveElementPolyfillSupport, k = (r, t) => r, W = { toAttribute(r, t) {
56
+ const { is: St, defineProperty: Ct, getOwnPropertyDescriptor: Et, getOwnPropertyNames: Ht, getOwnPropertySymbols: Mt, getPrototypeOf: kt } = Object, f = globalThis, tt = f.trustedTypes, Ft = tt ? tt.emptyScript : "", j = f.reactiveElementPolyfillSupport, F = (i, t) => i, G = { toAttribute(i, t) {
57
57
  switch (t) {
58
58
  case Boolean:
59
- r = r ? St : null;
59
+ i = i ? Ft : null;
60
60
  break;
61
61
  case Object:
62
62
  case Array:
63
- r = r == null ? r : JSON.stringify(r);
63
+ i = i == null ? i : JSON.stringify(i);
64
64
  }
65
- return r;
66
- }, fromAttribute(r, t) {
67
- let e = r;
65
+ return i;
66
+ }, fromAttribute(i, t) {
67
+ let e = i;
68
68
  switch (t) {
69
69
  case Boolean:
70
- e = r !== null;
70
+ e = i !== null;
71
71
  break;
72
72
  case Number:
73
- e = r === null ? null : Number(r);
73
+ e = i === null ? null : Number(i);
74
74
  break;
75
75
  case Object:
76
76
  case Array:
77
77
  try {
78
- e = JSON.parse(r);
78
+ e = JSON.parse(i);
79
79
  } catch {
80
80
  e = null;
81
81
  }
82
82
  }
83
83
  return e;
84
- } }, at = (r, t) => !wt(r, t), X = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: at };
85
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), m.litPropertyMetadata ?? (m.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
84
+ } }, ct = (i, t) => !St(i, t), et = { attribute: !0, type: String, converter: G, reflect: !1, hasChanged: ct };
85
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), f.litPropertyMetadata ?? (f.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
86
86
  class v extends HTMLElement {
87
87
  static addInitializer(t) {
88
88
  this._$Ei(), (this.l ?? (this.l = [])).push(t);
@@ -90,53 +90,53 @@ class v extends HTMLElement {
90
90
  static get observedAttributes() {
91
91
  return this.finalize(), this._$Eh && [...this._$Eh.keys()];
92
92
  }
93
- static createProperty(t, e = X) {
93
+ static createProperty(t, e = et) {
94
94
  if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
95
- const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
96
- i !== void 0 && bt(this.prototype, t, i);
95
+ const s = Symbol(), r = this.getPropertyDescriptor(t, s, e);
96
+ r !== void 0 && Ct(this.prototype, t, r);
97
97
  }
98
98
  }
99
99
  static getPropertyDescriptor(t, e, s) {
100
- const { get: i, set: n } = At(this.prototype, t) ?? { get() {
100
+ const { get: r, set: n } = Et(this.prototype, t) ?? { get() {
101
101
  return this[e];
102
102
  }, set(o) {
103
103
  this[e] = o;
104
104
  } };
105
105
  return { get() {
106
- return i == null ? void 0 : i.call(this);
106
+ return r == null ? void 0 : r.call(this);
107
107
  }, set(o) {
108
- const d = i == null ? void 0 : i.call(this);
109
- n.call(this, o), this.requestUpdate(t, d, s);
108
+ const l = r == null ? void 0 : r.call(this);
109
+ n.call(this, o), this.requestUpdate(t, l, s);
110
110
  }, configurable: !0, enumerable: !0 };
111
111
  }
112
112
  static getPropertyOptions(t) {
113
- return this.elementProperties.get(t) ?? X;
113
+ return this.elementProperties.get(t) ?? et;
114
114
  }
115
115
  static _$Ei() {
116
- if (this.hasOwnProperty(k("elementProperties")))
116
+ if (this.hasOwnProperty(F("elementProperties")))
117
117
  return;
118
- const t = Et(this);
118
+ const t = kt(this);
119
119
  t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
120
120
  }
121
121
  static finalize() {
122
- if (this.hasOwnProperty(k("finalized")))
122
+ if (this.hasOwnProperty(F("finalized")))
123
123
  return;
124
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(k("properties"))) {
125
- const e = this.properties, s = [...vt(e), ...xt(e)];
126
- for (const i of s)
127
- this.createProperty(i, e[i]);
124
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(F("properties"))) {
125
+ const e = this.properties, s = [...Ht(e), ...Mt(e)];
126
+ for (const r of s)
127
+ this.createProperty(r, e[r]);
128
128
  }
129
129
  const t = this[Symbol.metadata];
130
130
  if (t !== null) {
131
131
  const e = litPropertyMetadata.get(t);
132
132
  if (e !== void 0)
133
- for (const [s, i] of e)
134
- this.elementProperties.set(s, i);
133
+ for (const [s, r] of e)
134
+ this.elementProperties.set(s, r);
135
135
  }
136
136
  this._$Eh = /* @__PURE__ */ new Map();
137
137
  for (const [e, s] of this.elementProperties) {
138
- const i = this._$Eu(e, s);
139
- i !== void 0 && this._$Eh.set(i, e);
138
+ const r = this._$Eu(e, s);
139
+ r !== void 0 && this._$Eh.set(r, e);
140
140
  }
141
141
  this.elementStyles = this.finalizeStyles(this.styles);
142
142
  }
@@ -144,10 +144,10 @@ class v extends HTMLElement {
144
144
  const e = [];
145
145
  if (Array.isArray(t)) {
146
146
  const s = new Set(t.flat(1 / 0).reverse());
147
- for (const i of s)
148
- e.unshift(G(i));
147
+ for (const r of s)
148
+ e.unshift(Y(r));
149
149
  } else
150
- t !== void 0 && e.push(G(t));
150
+ t !== void 0 && e.push(Y(t));
151
151
  return e;
152
152
  }
153
153
  static _$Eu(t, e) {
@@ -177,7 +177,7 @@ class v extends HTMLElement {
177
177
  }
178
178
  createRenderRoot() {
179
179
  const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
180
- return _t(t, this.constructor.elementStyles), t;
180
+ return xt(t, this.constructor.elementStyles), t;
181
181
  }
182
182
  connectedCallback() {
183
183
  var t;
@@ -200,23 +200,23 @@ class v extends HTMLElement {
200
200
  }
201
201
  _$EO(t, e) {
202
202
  var n;
203
- const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
204
- if (i !== void 0 && s.reflect === !0) {
205
- const o = (((n = s.converter) == null ? void 0 : n.toAttribute) !== void 0 ? s.converter : W).toAttribute(e, s.type);
206
- this._$Em = t, o == null ? this.removeAttribute(i) : this.setAttribute(i, o), this._$Em = null;
203
+ const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s);
204
+ if (r !== void 0 && s.reflect === !0) {
205
+ const o = (((n = s.converter) == null ? void 0 : n.toAttribute) !== void 0 ? s.converter : G).toAttribute(e, s.type);
206
+ this._$Em = t, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$Em = null;
207
207
  }
208
208
  }
209
209
  _$AK(t, e) {
210
210
  var n;
211
- const s = this.constructor, i = s._$Eh.get(t);
212
- if (i !== void 0 && this._$Em !== i) {
213
- const o = s.getPropertyOptions(i), d = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : W;
214
- this._$Em = i, this[i] = d.fromAttribute(e, o.type), this._$Em = null;
211
+ const s = this.constructor, r = s._$Eh.get(t);
212
+ if (r !== void 0 && this._$Em !== r) {
213
+ const o = s.getPropertyOptions(r), l = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : G;
214
+ this._$Em = r, this[r] = l.fromAttribute(e, o.type), this._$Em = null;
215
215
  }
216
216
  }
217
- requestUpdate(t, e, s, i = !1, n) {
217
+ requestUpdate(t, e, s, r = !1, n) {
218
218
  if (t !== void 0) {
219
- if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? at)(i ? n : this[t], e))
219
+ if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? ct)(r ? n : this[t], e))
220
220
  return;
221
221
  this.C(t, e, s);
222
222
  }
@@ -248,20 +248,20 @@ class v extends HTMLElement {
248
248
  this[n] = o;
249
249
  this._$Ep = void 0;
250
250
  }
251
- const i = this.constructor.elementProperties;
252
- if (i.size > 0)
253
- for (const [n, o] of i)
251
+ const r = this.constructor.elementProperties;
252
+ if (r.size > 0)
253
+ for (const [n, o] of r)
254
254
  o.wrapped !== !0 || this._$AL.has(n) || this[n] === void 0 || this.C(n, this[n], o);
255
255
  }
256
256
  let t = !1;
257
257
  const e = this._$AL;
258
258
  try {
259
- t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$ES) == null || s.forEach((i) => {
259
+ t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$ES) == null || s.forEach((r) => {
260
260
  var n;
261
- return (n = i.hostUpdate) == null ? void 0 : n.call(i);
261
+ return (n = r.hostUpdate) == null ? void 0 : n.call(r);
262
262
  }), this.update(e)) : this._$ET();
263
- } catch (i) {
264
- throw t = !1, this._$ET(), i;
263
+ } catch (r) {
264
+ throw t = !1, this._$ET(), r;
265
265
  }
266
266
  t && this._$AE(e);
267
267
  }
@@ -270,8 +270,8 @@ class v extends HTMLElement {
270
270
  _$AE(t) {
271
271
  var e;
272
272
  (e = this._$ES) == null || e.forEach((s) => {
273
- var i;
274
- return (i = s.hostUpdated) == null ? void 0 : i.call(s);
273
+ var r;
274
+ return (r = s.hostUpdated) == null ? void 0 : r.call(s);
275
275
  }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
276
276
  }
277
277
  _$ET() {
@@ -294,86 +294,86 @@ class v extends HTMLElement {
294
294
  firstUpdated(t) {
295
295
  }
296
296
  }
297
- v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[k("elementProperties")] = /* @__PURE__ */ new Map(), v[k("finalized")] = /* @__PURE__ */ new Map(), B == null || B({ ReactiveElement: v }), (m.reactiveElementVersions ?? (m.reactiveElementVersions = [])).push("2.0.1");
297
+ v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[F("elementProperties")] = /* @__PURE__ */ new Map(), v[F("finalized")] = /* @__PURE__ */ new Map(), j == null || j({ ReactiveElement: v }), (f.reactiveElementVersions ?? (f.reactiveElementVersions = [])).push("2.0.1");
298
298
  /**
299
299
  * @license
300
300
  * Copyright 2017 Google LLC
301
301
  * SPDX-License-Identifier: BSD-3-Clause
302
302
  */
303
- const M = globalThis, O = M.trustedTypes, Y = O ? O.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ht = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, lt = "?" + f, Ct = `<${lt}>`, b = document, U = () => b.createComment(""), P = (r) => r === null || typeof r != "object" && typeof r != "function", dt = Array.isArray, Ht = (r) => dt(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", z = `[
304
- \f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, tt = /-->/g, et = />/g, _ = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
305
- \f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, it = /"/g, ct = /^(?:script|style|textarea|title)$/i, kt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), F = kt(1), S = Symbol.for("lit-noChange"), l = Symbol.for("lit-nothing"), rt = /* @__PURE__ */ new WeakMap(), w = b.createTreeWalker(b, 129);
306
- function pt(r, t) {
307
- if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
303
+ const U = globalThis, z = U.trustedTypes, st = z ? z.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, ut = "$lit$", y = `lit$${(Math.random() + "").slice(9)}$`, pt = "?" + y, Ut = `<${pt}>`, A = document, P = () => A.createComment(""), I = (i) => i === null || typeof i != "object" && typeof i != "function", $t = Array.isArray, Pt = (i) => $t(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", T = `[
304
+ \f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, it = /-->/g, rt = />/g, _ = RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^
305
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), nt = /'/g, ot = /"/g, yt = /^(?:script|style|textarea|title)$/i, It = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), O = It(1), C = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), at = /* @__PURE__ */ new WeakMap(), b = A.createTreeWalker(A, 129);
306
+ function ft(i, t) {
307
+ if (!Array.isArray(i) || !i.hasOwnProperty("raw"))
308
308
  throw Error("invalid template strings array");
309
- return Y !== void 0 ? Y.createHTML(t) : t;
309
+ return st !== void 0 ? st.createHTML(t) : t;
310
310
  }
311
- const Mt = (r, t) => {
312
- const e = r.length - 1, s = [];
313
- let i, n = t === 2 ? "<svg>" : "", o = H;
314
- for (let d = 0; d < e; d++) {
315
- const a = r[d];
316
- let c, p, h = -1, y = 0;
317
- for (; y < a.length && (o.lastIndex = y, p = o.exec(a), p !== null); )
318
- y = o.lastIndex, o === H ? p[1] === "!--" ? o = tt : p[1] !== void 0 ? o = et : p[2] !== void 0 ? (ct.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = _) : p[3] !== void 0 && (o = _) : o === _ ? p[0] === ">" ? (o = i ?? H, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, c = p[1], o = p[3] === void 0 ? _ : p[3] === '"' ? it : st) : o === it || o === st ? o = _ : o === tt || o === et ? o = H : (o = _, i = void 0);
319
- const g = o === _ && r[d + 1].startsWith("/>") ? " " : "";
320
- n += o === H ? a + Ct : h >= 0 ? (s.push(c), a.slice(0, h) + ht + a.slice(h) + f + g) : a + f + (h === -2 ? d : g);
321
- }
322
- return [pt(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), s];
311
+ const Ot = (i, t) => {
312
+ const e = i.length - 1, s = [];
313
+ let r, n = t === 2 ? "<svg>" : "", o = k;
314
+ for (let l = 0; l < e; l++) {
315
+ const a = i[l];
316
+ let d, u, h = -1, p = 0;
317
+ for (; p < a.length && (o.lastIndex = p, u = o.exec(a), u !== null); )
318
+ p = o.lastIndex, o === k ? u[1] === "!--" ? o = it : u[1] !== void 0 ? o = rt : u[2] !== void 0 ? (yt.test(u[2]) && (r = RegExp("</" + u[2], "g")), o = _) : u[3] !== void 0 && (o = _) : o === _ ? u[0] === ">" ? (o = r ?? k, h = -1) : u[1] === void 0 ? h = -2 : (h = o.lastIndex - u[2].length, d = u[1], o = u[3] === void 0 ? _ : u[3] === '"' ? ot : nt) : o === ot || o === nt ? o = _ : o === it || o === rt ? o = k : (o = _, r = void 0);
319
+ const $ = o === _ && i[l + 1].startsWith("/>") ? " " : "";
320
+ n += o === k ? a + Ut : h >= 0 ? (s.push(d), a.slice(0, h) + ut + a.slice(h) + y + $) : a + y + (h === -2 ? l : $);
321
+ }
322
+ return [ft(i, n + (i[e] || "<?>") + (t === 2 ? "</svg>" : "")), s];
323
323
  };
324
- class I {
324
+ class L {
325
325
  constructor({ strings: t, _$litType$: e }, s) {
326
- let i;
326
+ let r;
327
327
  this.parts = [];
328
328
  let n = 0, o = 0;
329
- const d = t.length - 1, a = this.parts, [c, p] = Mt(t, e);
330
- if (this.el = I.createElement(c, s), w.currentNode = this.el.content, e === 2) {
329
+ const l = t.length - 1, a = this.parts, [d, u] = Ot(t, e);
330
+ if (this.el = L.createElement(d, s), b.currentNode = this.el.content, e === 2) {
331
331
  const h = this.el.content.firstChild;
332
332
  h.replaceWith(...h.childNodes);
333
333
  }
334
- for (; (i = w.nextNode()) !== null && a.length < d; ) {
335
- if (i.nodeType === 1) {
336
- if (i.hasAttributes())
337
- for (const h of i.getAttributeNames())
338
- if (h.endsWith(ht)) {
339
- const y = p[o++], g = i.getAttribute(h).split(f), D = /([.?@])?(.*)/.exec(y);
340
- a.push({ type: 1, index: n, name: D[2], strings: g, ctor: D[1] === "." ? Pt : D[1] === "?" ? It : D[1] === "@" ? Lt : N }), i.removeAttribute(h);
334
+ for (; (r = b.nextNode()) !== null && a.length < l; ) {
335
+ if (r.nodeType === 1) {
336
+ if (r.hasAttributes())
337
+ for (const h of r.getAttributeNames())
338
+ if (h.endsWith(ut)) {
339
+ const p = u[o++], $ = r.getAttribute(h).split(y), D = /([.?@])?(.*)/.exec(p);
340
+ a.push({ type: 1, index: n, name: D[2], strings: $, ctor: D[1] === "." ? Nt : D[1] === "?" ? Bt : D[1] === "@" ? Vt : q }), r.removeAttribute(h);
341
341
  } else
342
- h.startsWith(f) && (a.push({ type: 6, index: n }), i.removeAttribute(h));
343
- if (ct.test(i.tagName)) {
344
- const h = i.textContent.split(f), y = h.length - 1;
345
- if (y > 0) {
346
- i.textContent = O ? O.emptyScript : "";
347
- for (let g = 0; g < y; g++)
348
- i.append(h[g], U()), w.nextNode(), a.push({ type: 2, index: ++n });
349
- i.append(h[y], U());
342
+ h.startsWith(y) && (a.push({ type: 6, index: n }), r.removeAttribute(h));
343
+ if (yt.test(r.tagName)) {
344
+ const h = r.textContent.split(y), p = h.length - 1;
345
+ if (p > 0) {
346
+ r.textContent = z ? z.emptyScript : "";
347
+ for (let $ = 0; $ < p; $++)
348
+ r.append(h[$], P()), b.nextNode(), a.push({ type: 2, index: ++n });
349
+ r.append(h[p], P());
350
350
  }
351
351
  }
352
- } else if (i.nodeType === 8)
353
- if (i.data === lt)
352
+ } else if (r.nodeType === 8)
353
+ if (r.data === pt)
354
354
  a.push({ type: 2, index: n });
355
355
  else {
356
356
  let h = -1;
357
- for (; (h = i.data.indexOf(f, h + 1)) !== -1; )
358
- a.push({ type: 7, index: n }), h += f.length - 1;
357
+ for (; (h = r.data.indexOf(y, h + 1)) !== -1; )
358
+ a.push({ type: 7, index: n }), h += y.length - 1;
359
359
  }
360
360
  n++;
361
361
  }
362
362
  }
363
363
  static createElement(t, e) {
364
- const s = b.createElement("template");
364
+ const s = A.createElement("template");
365
365
  return s.innerHTML = t, s;
366
366
  }
367
367
  }
368
- function C(r, t, e = r, s) {
369
- var o, d;
370
- if (t === S)
368
+ function E(i, t, e = i, s) {
369
+ var o, l;
370
+ if (t === C)
371
371
  return t;
372
- let i = s !== void 0 ? (o = e._$Co) == null ? void 0 : o[s] : e._$Cl;
373
- const n = P(t) ? void 0 : t._$litDirective$;
374
- return (i == null ? void 0 : i.constructor) !== n && ((d = i == null ? void 0 : i._$AO) == null || d.call(i, !1), n === void 0 ? i = void 0 : (i = new n(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = C(r, i._$AS(r, t.values), i, s)), t;
372
+ let r = s !== void 0 ? (o = e._$Co) == null ? void 0 : o[s] : e._$Cl;
373
+ const n = I(t) ? void 0 : t._$litDirective$;
374
+ return (r == null ? void 0 : r.constructor) !== n && ((l = r == null ? void 0 : r._$AO) == null || l.call(r, !1), n === void 0 ? r = void 0 : (r = new n(i), r._$AT(i, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = r : e._$Cl = r), r !== void 0 && (t = E(i, r._$AS(i, t.values), r, s)), t;
375
375
  }
376
- class Ut {
376
+ class Lt {
377
377
  constructor(t, e) {
378
378
  this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
379
379
  }
@@ -384,17 +384,17 @@ class Ut {
384
384
  return this._$AM._$AU;
385
385
  }
386
386
  u(t) {
387
- const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? b).importNode(e, !0);
388
- w.currentNode = i;
389
- let n = w.nextNode(), o = 0, d = 0, a = s[0];
387
+ const { el: { content: e }, parts: s } = this._$AD, r = ((t == null ? void 0 : t.creationScope) ?? A).importNode(e, !0);
388
+ b.currentNode = r;
389
+ let n = b.nextNode(), o = 0, l = 0, a = s[0];
390
390
  for (; a !== void 0; ) {
391
391
  if (o === a.index) {
392
- let c;
393
- a.type === 2 ? c = new L(n, n.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (c = new Dt(n, this, t)), this._$AV.push(c), a = s[++d];
392
+ let d;
393
+ a.type === 2 ? d = new V(n, n.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (d = new Dt(n, this, t)), this._$AV.push(d), a = s[++l];
394
394
  }
395
- o !== (a == null ? void 0 : a.index) && (n = w.nextNode(), o++);
395
+ o !== (a == null ? void 0 : a.index) && (n = b.nextNode(), o++);
396
396
  }
397
- return w.currentNode = b, i;
397
+ return b.currentNode = A, r;
398
398
  }
399
399
  p(t) {
400
400
  let e = 0;
@@ -402,13 +402,13 @@ class Ut {
402
402
  s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
403
403
  }
404
404
  }
405
- class L {
405
+ class V {
406
406
  get _$AU() {
407
407
  var t;
408
408
  return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
409
409
  }
410
- constructor(t, e, s, i) {
411
- this.type = 2, this._$AH = l, 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;
410
+ constructor(t, e, s, r) {
411
+ this.type = 2, this._$AH = c, 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;
412
412
  }
413
413
  get parentNode() {
414
414
  let t = this._$AA.parentNode;
@@ -422,7 +422,7 @@ class L {
422
422
  return this._$AB;
423
423
  }
424
424
  _$AI(t, e = this) {
425
- t = C(this, t, e), P(t) ? t === l || t == null || t === "" ? (this._$AH !== l && this._$AR(), this._$AH = l) : t !== this._$AH && t !== S && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : Ht(t) ? this.T(t) : this._(t);
425
+ t = E(this, t, e), I(t) ? t === c || t == null || t === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : t !== this._$AH && t !== C && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : Pt(t) ? this.T(t) : this._(t);
426
426
  }
427
427
  k(t) {
428
428
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -431,35 +431,35 @@ class L {
431
431
  this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
432
432
  }
433
433
  _(t) {
434
- this._$AH !== l && P(this._$AH) ? this._$AA.nextSibling.data = t : this.$(b.createTextNode(t)), this._$AH = t;
434
+ this._$AH !== c && I(this._$AH) ? this._$AA.nextSibling.data = t : this.$(A.createTextNode(t)), this._$AH = t;
435
435
  }
436
436
  g(t) {
437
437
  var n;
438
- const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = I.createElement(pt(s.h, s.h[0]), this.options)), s);
439
- if (((n = this._$AH) == null ? void 0 : n._$AD) === i)
438
+ const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = L.createElement(ft(s.h, s.h[0]), this.options)), s);
439
+ if (((n = this._$AH) == null ? void 0 : n._$AD) === r)
440
440
  this._$AH.p(e);
441
441
  else {
442
- const o = new Ut(i, this), d = o.u(this.options);
443
- o.p(e), this.$(d), this._$AH = o;
442
+ const o = new Lt(r, this), l = o.u(this.options);
443
+ o.p(e), this.$(l), this._$AH = o;
444
444
  }
445
445
  }
446
446
  _$AC(t) {
447
- let e = rt.get(t.strings);
448
- return e === void 0 && rt.set(t.strings, e = new I(t)), e;
447
+ let e = at.get(t.strings);
448
+ return e === void 0 && at.set(t.strings, e = new L(t)), e;
449
449
  }
450
450
  T(t) {
451
- dt(this._$AH) || (this._$AH = [], this._$AR());
451
+ $t(this._$AH) || (this._$AH = [], this._$AR());
452
452
  const e = this._$AH;
453
- let s, i = 0;
453
+ let s, r = 0;
454
454
  for (const n of t)
455
- i === e.length ? e.push(s = new L(this.k(U()), this.k(U()), this, this.options)) : s = e[i], s._$AI(n), i++;
456
- i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
455
+ r === e.length ? e.push(s = new V(this.k(P()), this.k(P()), this, this.options)) : s = e[r], s._$AI(n), r++;
456
+ r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r);
457
457
  }
458
458
  _$AR(t = this._$AA.nextSibling, e) {
459
459
  var s;
460
460
  for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t && t !== this._$AB; ) {
461
- const i = t.nextSibling;
462
- t.remove(), t = i;
461
+ const r = t.nextSibling;
462
+ t.remove(), t = r;
463
463
  }
464
464
  }
465
465
  setConnected(t) {
@@ -467,58 +467,58 @@ class L {
467
467
  this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
468
468
  }
469
469
  }
470
- class N {
470
+ class q {
471
471
  get tagName() {
472
472
  return this.element.tagName;
473
473
  }
474
474
  get _$AU() {
475
475
  return this._$AM._$AU;
476
476
  }
477
- constructor(t, e, s, i, n) {
478
- this.type = 1, this._$AH = l, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = l;
477
+ constructor(t, e, s, r, n) {
478
+ this.type = 1, this._$AH = c, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = c;
479
479
  }
480
- _$AI(t, e = this, s, i) {
480
+ _$AI(t, e = this, s, r) {
481
481
  const n = this.strings;
482
482
  let o = !1;
483
483
  if (n === void 0)
484
- t = C(this, t, e, 0), o = !P(t) || t !== this._$AH && t !== S, o && (this._$AH = t);
484
+ t = E(this, t, e, 0), o = !I(t) || t !== this._$AH && t !== C, o && (this._$AH = t);
485
485
  else {
486
- const d = t;
487
- let a, c;
486
+ const l = t;
487
+ let a, d;
488
488
  for (t = n[0], a = 0; a < n.length - 1; a++)
489
- c = C(this, d[s + a], e, a), c === S && (c = this._$AH[a]), o || (o = !P(c) || c !== this._$AH[a]), c === l ? t = l : t !== l && (t += (c ?? "") + n[a + 1]), this._$AH[a] = c;
489
+ d = E(this, l[s + a], e, a), d === C && (d = this._$AH[a]), o || (o = !I(d) || d !== this._$AH[a]), d === c ? t = c : t !== c && (t += (d ?? "") + n[a + 1]), this._$AH[a] = d;
490
490
  }
491
- o && !i && this.O(t);
491
+ o && !r && this.O(t);
492
492
  }
493
493
  O(t) {
494
- t === l ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
494
+ t === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
495
495
  }
496
496
  }
497
- class Pt extends N {
497
+ class Nt extends q {
498
498
  constructor() {
499
499
  super(...arguments), this.type = 3;
500
500
  }
501
501
  O(t) {
502
- this.element[this.name] = t === l ? void 0 : t;
502
+ this.element[this.name] = t === c ? void 0 : t;
503
503
  }
504
504
  }
505
- class It extends N {
505
+ class Bt extends q {
506
506
  constructor() {
507
507
  super(...arguments), this.type = 4;
508
508
  }
509
509
  O(t) {
510
- this.element.toggleAttribute(this.name, !!t && t !== l);
510
+ this.element.toggleAttribute(this.name, !!t && t !== c);
511
511
  }
512
512
  }
513
- class Lt extends N {
514
- constructor(t, e, s, i, n) {
515
- super(t, e, s, i, n), this.type = 5;
513
+ class Vt extends q {
514
+ constructor(t, e, s, r, n) {
515
+ super(t, e, s, r, n), this.type = 5;
516
516
  }
517
517
  _$AI(t, e = this) {
518
- if ((t = C(this, t, e, 0) ?? l) === S)
518
+ if ((t = E(this, t, e, 0) ?? c) === C)
519
519
  return;
520
- const s = this._$AH, i = t === l && s !== l || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== l && (s === l || i);
521
- i && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
520
+ const s = this._$AH, r = t === c && s !== c || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== c && (s === c || r);
521
+ r && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
522
522
  }
523
523
  handleEvent(t) {
524
524
  var e;
@@ -533,26 +533,26 @@ class Dt {
533
533
  return this._$AM._$AU;
534
534
  }
535
535
  _$AI(t) {
536
- C(this, t);
536
+ E(this, t);
537
537
  }
538
538
  }
539
- const q = M.litHtmlPolyfillSupport;
540
- q == null || q(I, L), (M.litHtmlVersions ?? (M.litHtmlVersions = [])).push("3.1.0");
541
- const Tt = (r, t, e) => {
539
+ const W = U.litHtmlPolyfillSupport;
540
+ W == null || W(L, V), (U.litHtmlVersions ?? (U.litHtmlVersions = [])).push("3.1.0");
541
+ const Rt = (i, t, e) => {
542
542
  const s = (e == null ? void 0 : e.renderBefore) ?? t;
543
- let i = s._$litPart$;
544
- if (i === void 0) {
543
+ let r = s._$litPart$;
544
+ if (r === void 0) {
545
545
  const n = (e == null ? void 0 : e.renderBefore) ?? null;
546
- s._$litPart$ = i = new L(t.insertBefore(U(), n), n, void 0, e ?? {});
546
+ s._$litPart$ = r = new V(t.insertBefore(P(), n), n, void 0, e ?? {});
547
547
  }
548
- return i._$AI(r), i;
548
+ return r._$AI(i), r;
549
549
  };
550
550
  /**
551
551
  * @license
552
552
  * Copyright 2017 Google LLC
553
553
  * SPDX-License-Identifier: BSD-3-Clause
554
554
  */
555
- class x extends v {
555
+ class w extends v {
556
556
  constructor() {
557
557
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
558
558
  }
@@ -563,7 +563,7 @@ class x extends v {
563
563
  }
564
564
  update(t) {
565
565
  const e = this.render();
566
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Tt(e, this.renderRoot, this.renderOptions);
566
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Rt(e, this.renderRoot, this.renderOptions);
567
567
  }
568
568
  connectedCallback() {
569
569
  var t;
@@ -574,21 +574,21 @@ class x extends v {
574
574
  super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
575
575
  }
576
576
  render() {
577
- return S;
577
+ return C;
578
578
  }
579
579
  }
580
- var ot;
581
- x._$litElement$ = !0, x.finalized = !0, (ot = globalThis.litElementHydrateSupport) == null || ot.call(globalThis, { LitElement: x });
582
- const j = globalThis.litElementPolyfillSupport;
583
- j == null || j({ LitElement: x });
580
+ var ht;
581
+ w._$litElement$ = !0, w.finalized = !0, (ht = globalThis.litElementHydrateSupport) == null || ht.call(globalThis, { LitElement: w });
582
+ const Z = globalThis.litElementPolyfillSupport;
583
+ Z == null || Z({ LitElement: w });
584
584
  (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.1");
585
585
  /**
586
586
  * @license
587
587
  * Copyright 2017 Google LLC
588
588
  * SPDX-License-Identifier: BSD-3-Clause
589
589
  */
590
- const Ot = (r) => (...t) => ({ _$litDirective$: r, values: t });
591
- let Ft = class {
590
+ const zt = (i) => (...t) => ({ _$litDirective$: i, values: t });
591
+ let qt = class {
592
592
  constructor(t) {
593
593
  }
594
594
  get _$AU() {
@@ -609,23 +609,23 @@ let Ft = class {
609
609
  * Copyright 2020 Google LLC
610
610
  * SPDX-License-Identifier: BSD-3-Clause
611
611
  */
612
- const Nt = {}, Vt = (r, t = Nt) => r._$AH = t;
612
+ const jt = {}, Tt = (i, t = jt) => i._$AH = t;
613
613
  /**
614
614
  * @license
615
615
  * Copyright 2021 Google LLC
616
616
  * SPDX-License-Identifier: BSD-3-Clause
617
617
  */
618
- const Rt = Ot(class extends Ft {
618
+ const Wt = zt(class extends qt {
619
619
  constructor() {
620
- super(...arguments), this.key = l;
620
+ super(...arguments), this.key = c;
621
621
  }
622
- render(r, t) {
623
- return this.key = r, t;
622
+ render(i, t) {
623
+ return this.key = i, t;
624
624
  }
625
- update(r, [t, e]) {
626
- return t !== this.key && (Vt(r), this.key = t), e;
625
+ update(i, [t, e]) {
626
+ return t !== this.key && (Tt(i), this.key = t), e;
627
627
  }
628
- }), Bt = `
628
+ }), Zt = `
629
629
  button {
630
630
  /* TODO: why does this only work here and not from :root? */
631
631
  --primary-color: #004170;
@@ -714,12 +714,12 @@ button.small {
714
714
  padding: 12.4px;
715
715
  font-size: .75rem;
716
716
  }
717
- `, ut = `
717
+ `, K = `
718
718
  * {
719
719
  font-family: Roboto, sans-serif;
720
720
  }
721
721
 
722
- ${Bt}
722
+ ${Zt}
723
723
 
724
724
  button.discard:before {
725
725
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23FF5252' viewBox='0 0 24 24'%3E%3Ctitle%3Etrash-can-outline%3C/title%3E%3Cpath d='M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z' /%3E%3C/svg%3E")
@@ -793,91 +793,117 @@ button.small {
793
793
  font-size: small;
794
794
  flex-grow: 1;
795
795
  }
796
- `;
797
- class $t extends x {
796
+ `, Gt = (i) => {
797
+ i.hoverInteraction = i.eoxMap.selectInteractions.selectHover, i.clickInteraction = i.eoxMap.selectInteractions.selectClick;
798
+ const t = () => {
799
+ i.requestUpdate();
800
+ };
801
+ i.hoverInteraction.selectStyleLayer.on(
802
+ "change",
803
+ t
804
+ ), i.clickInteraction.selectStyleLayer.on(
805
+ "change",
806
+ t
807
+ );
808
+ }, Jt = (i, t, e) => {
809
+ if (i.clickId === t)
810
+ return;
811
+ const s = e ? [] : [t];
812
+ i.hoverInteraction.highlightById(s);
813
+ }, Kt = (i, t) => {
814
+ i.stopPropagation();
815
+ const e = Number(i.target.getAttribute("index")), s = t.drawnFeatures[e];
816
+ t.drawLayer.getSource().removeFeature(s), t.drawnFeatures.splice(e, 1), t.requestUpdate();
817
+ }, lt = { duration: 750 }, Qt = (i, t) => {
818
+ const e = i.get("id"), { clickId: s, drawLayer: r, olMap: n, clickInteraction: o } = t, l = s === e, a = i.getGeometry();
819
+ if (l) {
820
+ const d = r.getSource().getExtent();
821
+ n.getView().fit(d, lt), o.highlightById([]);
822
+ } else {
823
+ const d = a.getExtent();
824
+ o.highlightById([e]), n.getView().fit(d, lt);
825
+ }
826
+ t.requestUpdate();
827
+ };
828
+ class gt extends w {
798
829
  constructor() {
799
830
  super();
800
831
  /**
801
832
  * @type import("../../../map/src/select").EOxSelectInteraction
802
833
  */
803
- A(this, "hoverInteraction");
834
+ g(this, "hoverInteraction");
804
835
  /**
805
836
  * @type import("../../../map/src/select").EOxSelectInteraction
806
837
  */
807
- A(this, "clickInteraction");
838
+ g(this, "clickInteraction");
808
839
  /**
809
840
  * @type string | number
810
841
  */
811
- A(this, "hoverId");
842
+ g(this, "hoverId");
812
843
  /**
813
844
  * @type string | number
814
845
  */
815
- A(this, "clickId");
816
- this.eoxMap = null, this.olMap = null, this.draw = null, this.layer = "draw", this.drawLayer = null, this.drawnFeatures = [], this.modify = null, this.unstyled = !1;
846
+ g(this, "clickId");
847
+ this.eoxMap = null, this.olMap = null, this.draw = null, this.drawLayer = null, this.drawnFeatures = [], this.modify = null, this.unstyled = !1;
817
848
  }
818
849
  /**
819
- * Delete individual feature @param {any} evt
850
+ * Handles the deletion of an individual feature.
851
+ *
852
+ * @param {Event & { target: HTMLButtonElement }} evt - Event object containing button target.
820
853
  */
821
854
  _handleDelete(e) {
822
- e.stopPropagation();
823
- const s = e.target.getAttribute("index"), i = this.drawnFeatures[s];
824
- this.drawLayer.getSource().removeFeature(i), this.drawnFeatures.splice(s, 1), this.requestUpdate();
855
+ Kt(e, this);
825
856
  }
826
857
  /**
827
- * Select and Deselect feature from the list
858
+ * Handles the selection and deselection of a feature from the list.
828
859
  *
829
- * @param {import("ol").Feature} feature
860
+ * @param {import("ol").Feature} feature - The selected feature.
830
861
  */
831
862
  _handleFeatureSelectAndDeselect(e) {
832
- const s = e.get("id");
833
- if (this.clickId === s) {
834
- const i = this.drawLayer.getSource().getExtent();
835
- this.olMap.getView().fit(i, { duration: 750 }), this.clickInteraction.highlightById([]);
836
- } else
837
- this.clickInteraction.highlightById([s]), this.olMap.getView().fit(e.getGeometry().getExtent(), { duration: 750 });
838
- this.requestUpdate();
863
+ Qt(e, this);
864
+ }
865
+ /**
866
+ *
867
+ * @param {Number} featureId - The ID of the feature to hover.
868
+ * @param {Boolean} mouseOut - Flag indicating mouse out event.
869
+ */
870
+ _handleHoverFeature(e, s = !1) {
871
+ Jt(this, e, s);
839
872
  }
873
+ /**
874
+ * Initiates initial settings and event triggers upon the component's first update.
875
+ */
840
876
  firstUpdated() {
841
- this.hoverInteraction = this.eoxMap.selectInteractions.selectHover, this.clickInteraction = this.eoxMap.selectInteractions.selectClick, this.hoverInteraction.selectStyleLayer.on(
842
- "change",
843
- () => this.requestUpdate()
844
- ), this.clickInteraction.selectStyleLayer.on(
845
- "change",
846
- () => this.requestUpdate()
847
- );
877
+ Gt(this);
848
878
  }
849
879
  render() {
850
880
  var e, s;
851
- return this.hoverId = (e = this.hoverInteraction) == null ? void 0 : e.selectedFids[0], this.clickId = (s = this.clickInteraction) == null ? void 0 : s.selectedFids[0], F`
881
+ return this.hoverId = (e = this.hoverInteraction) == null ? void 0 : e.selectedFids[0], this.clickId = (s = this.clickInteraction) == null ? void 0 : s.selectedFids[0], O`
852
882
  <style>
853
- ${!this.unstyled && ut}
883
+ ${!this.unstyled && K}
854
884
  </style>
855
885
  <ul>
856
- ${this.drawnFeatures.map((i, n) => {
857
- const o = i.get("id"), d = this.hoverId === o || this.clickId === o;
858
- return Rt(
859
- n + 1,
860
- F`
886
+ ${this.drawnFeatures.map((r, n) => {
887
+ const o = n + 1, l = r.get("id"), a = this.hoverId === l, d = this.clickId === l;
888
+ return Wt(
889
+ o,
890
+ O`
861
891
  <li
862
- class="${d ? "selected" : l}"
863
- @mouseover=${() => {
864
- this.clickId !== o && this.hoverInteraction.highlightById([o]);
865
- }}
866
- @mouseout=${() => {
867
- this.clickId !== o && this.hoverInteraction.highlightById([]);
868
- }}
892
+ class="${a || d ? "selected" : c}"
893
+ @mouseover=${() => this._handleHoverFeature(l)}
894
+ @mouseout=${() => this._handleHoverFeature(l, !0)}
869
895
  >
870
896
  <div
871
897
  class="list"
872
- @click="${() => this._handleFeatureSelectAndDeselect(i)}"
898
+ @click="${() => this._handleFeatureSelectAndDeselect(r)}"
873
899
  >
874
- <span class="title">Feature #${n + 1}</span>
900
+ <span class="title">Feature #${o}</span>
875
901
  <button
876
902
  index=${n}
877
903
  class="icon small discard"
878
904
  @click="${this._handleDelete}"
879
905
  >
880
- ${this.unstyled ? "x" : l}
906
+ x
881
907
  </button>
882
908
  </div>
883
909
  </li>
@@ -888,36 +914,179 @@ class $t extends x {
888
914
  `;
889
915
  }
890
916
  }
891
- A($t, "properties", {
917
+ g(gt, "properties", {
892
918
  eoxMap: { attribute: !1, state: !0 },
893
919
  olMap: { attribute: !1, state: !0 },
894
920
  draw: { attribute: !1, state: !0 },
895
- layer: { type: String },
896
921
  drawLayer: { attribute: !1, state: !0 },
897
922
  drawnFeatures: { attribute: !1, state: !0, type: Array },
898
923
  modify: { attribute: !1, state: !0 },
899
924
  unstyled: { type: Boolean }
900
925
  });
901
- customElements.define("eox-drawtools-list", $t);
902
- const zt = `
926
+ customElements.define("eox-drawtools-list", gt);
927
+ const Xt = (i) => {
928
+ const { multipleFeatures: t, drawnFeatures: e, currentlyDrawing: s } = i, r = !t && (e == null ? void 0 : e.length) > 0 || s, n = !(e != null && e.length) && !s;
929
+ return { drawDisabled: r, discardDisabled: n };
930
+ };
931
+ var N, B;
932
+ class mt extends w {
933
+ constructor() {
934
+ super();
935
+ /**
936
+ * @type boolean | import("lit").nothing
937
+ */
938
+ H(this, N, !0);
939
+ /**
940
+ * @type boolean | import("lit").nothing
941
+ */
942
+ H(this, B, !0);
943
+ this.multipleFeatures = !1, this.drawnFeatures = [], this.currentlyDrawing = !1, this.drawFunc = null, this.unstyled = !1;
944
+ }
945
+ /**
946
+ * Updates button states based on conditions
947
+ */
948
+ updateButtonStates() {
949
+ const { drawDisabled: e, discardDisabled: s } = Xt(this);
950
+ M(this, N, e), M(this, B, s);
951
+ }
952
+ render() {
953
+ this.updateButtonStates();
954
+ const e = this.currentlyDrawing ? "drawing" : "draw";
955
+ return O`
956
+ <style>
957
+ ${!this.unstyled && K}
958
+ </style>
959
+ <div>
960
+ <slot></slot>
961
+
962
+ <!-- Draw Button -->
963
+ <button
964
+ data-cy="drawBtn"
965
+ class="polygon icon"
966
+ ?disabled="${m(this, N) || c}"
967
+ @click="${() => this.drawFunc.start()}"
968
+ >
969
+ ${e}
970
+ </button>
971
+
972
+ <!-- Discard Button -->
973
+ <button
974
+ data-cy="discardBtn"
975
+ class="discard icon"
976
+ ?disabled="${m(this, B) || c}"
977
+ @click="${() => this.drawFunc.discard()}"
978
+ >
979
+ discard
980
+ </button>
981
+ </div>
982
+ `;
983
+ }
984
+ }
985
+ N = new WeakMap(), B = new WeakMap(), // Define properties with default values and types
986
+ g(mt, "properties", {
987
+ multipleFeatures: { attribute: !1, type: Boolean },
988
+ drawnFeatures: { attribute: !1, state: !0, type: Array },
989
+ currentlyDrawing: { attribute: !1, state: !0, type: Boolean },
990
+ drawFunc: { attribute: !1, type: Object },
991
+ unstyled: { type: Boolean }
992
+ });
993
+ customElements.define("eox-drawtools-controller", mt);
994
+ const Yt = `
903
995
  :host {
904
996
  display: block;
905
997
  }
906
- `;
907
- var u, E;
908
- class qt extends x {
998
+ `, _t = (i) => {
999
+ (() => {
1000
+ i.emitDrawnFeatures(), i.draw.setActive(!1), i.currentlyDrawing = !1;
1001
+ })(), i.requestUpdate();
1002
+ }, te = (i) => {
1003
+ const t = () => {
1004
+ i.initDrawLayer(), i.draw.setActive(!0);
1005
+ }, e = () => {
1006
+ i.currentlyDrawing = !0, i.requestUpdate();
1007
+ };
1008
+ t(), e();
1009
+ }, ee = (i) => {
1010
+ var r, n;
1011
+ const e = document.querySelector(i.for), s = e.map;
1012
+ return i.drawLayer = e.addOrUpdateLayer({
1013
+ type: "Vector",
1014
+ properties: {
1015
+ id: "drawLayer",
1016
+ layerControlHide: !0
1017
+ },
1018
+ source: {
1019
+ type: "Vector"
1020
+ },
1021
+ interactions: [
1022
+ {
1023
+ type: "draw",
1024
+ options: {
1025
+ active: !1,
1026
+ id: "drawInteraction",
1027
+ type: i.type,
1028
+ modify: i.allowModify,
1029
+ stopClick: !0
1030
+ }
1031
+ },
1032
+ {
1033
+ type: "select",
1034
+ options: {
1035
+ id: "selectHover",
1036
+ condition: "pointermove",
1037
+ style: {
1038
+ "fill-color": "rgba(51, 153, 204,0.5)",
1039
+ "stroke-color": "#3399CC",
1040
+ "stroke-width": 2.5
1041
+ }
1042
+ }
1043
+ },
1044
+ {
1045
+ type: "select",
1046
+ options: {
1047
+ id: "selectClick",
1048
+ condition: "click",
1049
+ panIn: !0,
1050
+ style: {
1051
+ "fill-color": "rgba(51, 153, 204,0.5)",
1052
+ "stroke-color": "#3399CC",
1053
+ "stroke-width": 2.5
1054
+ }
1055
+ }
1056
+ }
1057
+ ]
1058
+ }), i.draw = /** @type {import("ol/interaction").Draw} */
1059
+ /** @type {unknown} */
1060
+ e.interactions.drawInteraction, i.modify = /** @type {import("ol/interaction").Modify} */
1061
+ /** @type {unknown} */
1062
+ e.interactions.drawInteractionmodify, (r = i.draw) == null || r.on("drawend", () => _t(i)), (n = i.modify) == null || n.on("modifyend", () => i.emitDrawnFeatures()), { EoxMap: e, OlMap: s };
1063
+ }, se = (i, t, e) => {
1064
+ const s = () => {
1065
+ i.drawnFeatures = [], i.draw.setActive(!1), i.drawLayer.getSource().clear(), t.removeInteraction("drawInteraction"), e.removeLayer(i.drawLayer);
1066
+ }, r = () => {
1067
+ i.emitDrawnFeatures(), i.currentlyDrawing = !1, i.requestUpdate();
1068
+ };
1069
+ s(), r();
1070
+ }, ie = (i, t) => {
1071
+ setTimeout(() => {
1072
+ i.drawnFeatures = i.drawLayer.getSource().getFeatures(), i.requestUpdate(), t();
1073
+ }, 0);
1074
+ };
1075
+ var x, S;
1076
+ class re extends w {
909
1077
  constructor() {
910
1078
  super();
911
1079
  /**
912
1080
  * @type import("../../map/main").EOxMap
913
1081
  */
914
- V(this, u, void 0);
1082
+ H(this, x, void 0);
915
1083
  /**
916
1084
  * @type import("ol").Map
917
1085
  */
918
- V(this, E, void 0);
1086
+ H(this, S, void 0);
919
1087
  this.allowModify = !1, this.for = "eox-map", this.currentlyDrawing = !1, this.draw = null, this.drawLayer = null, this.drawnFeatures = [], this.modify = null, this.multipleFeatures = !1, this.showList = !1, this.type = "Polygon", this.unstyled = !1;
920
1088
  }
1089
+ // Define properties with defaults and types
921
1090
  static get properties() {
922
1091
  return {
923
1092
  allowModify: { attribute: "allow-modify", type: Boolean },
@@ -933,139 +1102,85 @@ class qt extends x {
933
1102
  unstyled: { type: Boolean }
934
1103
  };
935
1104
  }
1105
+ /**
1106
+ * Initializes the drawing layer before starting to draw on the map.
1107
+ */
936
1108
  initDrawLayer() {
937
- var s, i;
938
- const e = document.querySelector(this.for);
939
- R(
940
- this,
941
- u,
942
- /** @type {import("@eox/map/main").EOxMap} */
943
- e
944
- ), R(
945
- this,
946
- E,
947
- /** @type {import("ol").Map} */
948
- $(this, u).map
949
- ), this.drawLayer = $(this, u).addOrUpdateLayer({
950
- type: "Vector",
951
- properties: {
952
- id: "drawLayer",
953
- layerControlHide: !0
954
- },
955
- source: {
956
- type: "Vector"
957
- },
958
- // check if the drawInteraction has already been added before adding again
959
- // TEMP/TODO: this should probably be done by the map in the addOrUpdateLayer method
960
- ...$(this, u).interactions.drawInteraction ? {} : {
961
- interactions: [
962
- {
963
- type: "draw",
964
- options: {
965
- active: !1,
966
- id: "drawInteraction",
967
- type: this.type,
968
- modify: this.allowModify,
969
- stopClick: !0
970
- }
971
- },
972
- {
973
- type: "select",
974
- options: {
975
- id: "selectHover",
976
- condition: "pointermove",
977
- style: {
978
- "fill-color": "rgba(51, 153, 204,0.5)",
979
- "stroke-color": "#3399CC",
980
- "stroke-width": 2.5
981
- }
982
- }
983
- },
984
- {
985
- type: "select",
986
- options: {
987
- id: "selectClick",
988
- condition: "click",
989
- panIn: !0,
990
- style: {
991
- "fill-color": "rgba(51, 153, 204,0.5)",
992
- "stroke-color": "#3399CC",
993
- "stroke-width": 2.5
994
- }
995
- }
996
- }
997
- ]
998
- }
999
- }), this.draw = /** @type {import("ol/interaction").Draw} */
1000
- /** @type {unknown} */
1001
- $(this, u).interactions.drawInteraction, this.modify = /** @type {import("ol/interaction").Modify} */
1002
- /** @type {unknown} */
1003
- $(this, u).interactions.drawInteractionmodify, (s = this.draw) == null || s.on("drawend", () => this.onDrawEnd()), (i = this.modify) == null || i.on("modifyend", () => this.onModifyEnd());
1109
+ const { EoxMap: e, OlMap: s } = ee(this);
1110
+ M(this, x, e), M(this, S, s);
1004
1111
  }
1005
- startDrawing() {
1006
- this.initDrawLayer(), this.draw.setActive(!0), this.currentlyDrawing = !0, this.requestUpdate();
1112
+ /**
1113
+ * @onClick Event handler triggered to start drawing on the map.
1114
+ */
1115
+ handleStartDrawing() {
1116
+ te(this);
1007
1117
  }
1008
- discardDrawing() {
1009
- this.drawnFeatures = [], this.draw.setActive(!1), this.drawLayer.getSource().clear(), $(this, u).removeInteraction("drawInteraction"), $(this, E).removeLayer(this.drawLayer), this.emitDrawnFeatures(), this.currentlyDrawing = !1, this.requestUpdate();
1118
+ /**
1119
+ * @onClick Event handler triggered to discard/stop drawing
1120
+ * on the map and delete the drawn shapes.
1121
+ */
1122
+ handleDiscardDrawing() {
1123
+ se(this, m(this, x), m(this, S));
1010
1124
  }
1125
+ /**
1126
+ * @event onDrawEnd triggered when the drawing of a shape is completed.
1127
+ */
1011
1128
  onDrawEnd() {
1012
- this.emitDrawnFeatures(), this.draw.setActive(!1), this.currentlyDrawing = !1, this.requestUpdate();
1129
+ _t(this);
1013
1130
  }
1131
+ /**
1132
+ * @event onModifyEnd triggered when the modification of a shape is completed.
1133
+ */
1014
1134
  onModifyEnd() {
1015
1135
  this.emitDrawnFeatures();
1016
1136
  }
1137
+ /**
1138
+ * Triggers different events when the drawing of a shape is completed.
1139
+ */
1017
1140
  emitDrawnFeatures() {
1018
- setTimeout(() => {
1019
- this.drawnFeatures = this.drawLayer.getSource().getFeatures(), this.requestUpdate(), this.dispatchEvent(
1020
- new CustomEvent("drawupdate", {
1021
- detail: this.drawnFeatures
1022
- })
1141
+ ie(this, () => {
1142
+ this.dispatchEvent(
1143
+ new CustomEvent("drawupdate", { detail: this.drawnFeatures })
1023
1144
  );
1024
- }, 0);
1145
+ });
1025
1146
  }
1147
+ // Render method for UI display
1026
1148
  render() {
1027
- var e, s, i;
1028
- return F`
1149
+ var e;
1150
+ return O`
1029
1151
  <style>
1030
- ${zt}
1031
- ${!this.unstyled && ut}
1152
+ ${Yt}
1153
+ ${!this.unstyled && K}
1032
1154
  </style>
1033
- <div>
1034
- <slot></slot>
1035
- <button
1036
- data-cy="drawBtn"
1037
- class="polygon icon"
1038
- disabled="${!this.multipleFeatures && ((e = this.drawnFeatures) == null ? void 0 : e.length) > 0 || this.currentlyDrawing || l}"
1039
- @click="${() => this.startDrawing()}"
1040
- >
1041
- ${this.currentlyDrawing ? "drawing" : "draw"}
1042
- </button>
1043
- <button
1044
- data-cy="discardBtn"
1045
- class="discard icon"
1046
- disabled="${!((s = this.drawnFeatures) != null && s.length) && !this.currentlyDrawing || l}"
1047
- @click="${() => this.discardDrawing()}"
1048
- >
1049
- discard
1050
- </button>
1051
- </div>
1052
- ${this.showList && ((i = this.drawnFeatures) != null && i.length) ? F`<eox-drawtools-list
1053
- .eoxMap=${$(this, u)}
1054
- .olMap=${$(this, E)}
1155
+
1156
+ <!-- Controller Component -->
1157
+ <eox-drawtools-controller
1158
+ .drawFunc=${{
1159
+ start: () => this.handleStartDrawing(),
1160
+ discard: () => this.handleDiscardDrawing()
1161
+ }}
1162
+ .unstyled=${this.unstyled}
1163
+ .drawnFeatures=${this.drawnFeatures}
1164
+ .currentlyDrawing=${this.currentlyDrawing}
1165
+ .multipleFeatures=${this.multipleFeatures}
1166
+ ></eox-drawtools-controller>
1167
+
1168
+ <!-- List Component -->
1169
+ ${this.showList && ((e = this.drawnFeatures) != null && e.length) ? O`<eox-drawtools-list
1170
+ .eoxMap=${m(this, x)}
1171
+ .olMap=${m(this, S)}
1055
1172
  .draw=${this.draw}
1056
- .layer=${this.layer}
1057
1173
  .drawLayer=${this.drawLayer}
1058
1174
  .drawnFeatures=${this.drawnFeatures}
1059
1175
  .modify=${this.modify}
1060
1176
  .unstyled=${this.unstyled}
1061
1177
  @changed=${() => this.requestUpdate()}
1062
- >
1063
- </eox-drawtools-list>` : l}
1178
+ ></eox-drawtools-list>` : c}
1064
1179
  `;
1065
1180
  }
1066
1181
  }
1067
- u = new WeakMap(), E = new WeakMap();
1068
- customElements.define("eox-drawtools", qt);
1182
+ x = new WeakMap(), S = new WeakMap();
1183
+ customElements.define("eox-drawtools", re);
1069
1184
  export {
1070
- qt as EOxDrawTools
1185
+ re as EOxDrawTools
1071
1186
  };