@eox/drawtools 0.5.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 gt = Object.defineProperty;
2
- var ft = (r, t, e) => t in r ? gt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var A = (r, t, e) => (ft(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, at = Symbol(), K = /* @__PURE__ */ new WeakMap();
18
- let _t = 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 !== at)
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 _t = class {
34
34
  return this.cssText;
35
35
  }
36
36
  };
37
- const mt = (r) => new _t(typeof r == "string" ? r : r + "", void 0, at), wt = (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: bt, defineProperty: At, getOwnPropertyDescriptor: vt, getOwnPropertyNames: xt, getOwnPropertySymbols: Et, getPrototypeOf: St } = Object, _ = globalThis, Q = _.trustedTypes, Ct = Q ? Q.emptyScript : "", B = _.reactiveElementPolyfillSupport, H = (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 ? Ct : 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
- } }, ht = (r, t) => !bt(r, t), X = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: ht };
85
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), _.litPropertyMetadata ?? (_.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 && At(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 } = vt(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 c = i == null ? void 0 : i.call(this);
109
- n.call(this, o), this.requestUpdate(t, c, 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(H("elementProperties")))
116
+ if (this.hasOwnProperty(F("elementProperties")))
117
117
  return;
118
- const t = St(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(H("finalized")))
122
+ if (this.hasOwnProperty(F("finalized")))
123
123
  return;
124
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(H("properties"))) {
125
- const e = this.properties, s = [...xt(e), ...Et(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 wt(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), c = 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] = c.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 ?? ht)(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[H("elementProperties")] = /* @__PURE__ */ new Map(), v[H("finalized")] = /* @__PURE__ */ new Map(), B == null || B({ ReactiveElement: v }), (_.reactiveElementVersions ?? (_.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 I = globalThis, O = I.trustedTypes, Y = O ? O.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, lt = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, ct = "?" + f, kt = `<${ct}>`, b = document, M = () => b.createComment(""), U = (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]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, tt = /-->/g, et = />/g, m = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
305
- \f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, it = /"/g, pt = /^(?:script|style|textarea|title)$/i, It = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), F = It(1), S = Symbol.for("lit-noChange"), l = Symbol.for("lit-nothing"), rt = /* @__PURE__ */ new WeakMap(), w = b.createTreeWalker(b, 129);
306
- function ut(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 = k;
314
- for (let c = 0; c < e; c++) {
315
- const a = r[c];
316
- let d, p, h = -1, y = 0;
317
- for (; y < a.length && (o.lastIndex = y, p = o.exec(a), p !== null); )
318
- y = o.lastIndex, o === k ? p[1] === "!--" ? o = tt : p[1] !== void 0 ? o = et : p[2] !== void 0 ? (pt.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = m) : p[3] !== void 0 && (o = m) : o === m ? p[0] === ">" ? (o = i ?? k, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, d = p[1], o = p[3] === void 0 ? m : p[3] === '"' ? it : st) : o === it || o === st ? o = m : o === tt || o === et ? o = k : (o = m, i = void 0);
319
- const g = o === m && r[c + 1].startsWith("/>") ? " " : "";
320
- n += o === k ? a + kt : h >= 0 ? (s.push(d), a.slice(0, h) + lt + a.slice(h) + f + g) : a + f + (h === -2 ? c : g);
321
- }
322
- return [ut(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 P {
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 c = t.length - 1, a = this.parts, [d, p] = Mt(t, e);
330
- if (this.el = P.createElement(d, 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 < c; ) {
335
- if (i.nodeType === 1) {
336
- if (i.hasAttributes())
337
- for (const h of i.getAttributeNames())
338
- if (h.endsWith(lt)) {
339
- const y = p[o++], g = i.getAttribute(h).split(f), L = /([.?@])?(.*)/.exec(y);
340
- a.push({ type: 1, index: n, name: L[2], strings: g, ctor: L[1] === "." ? Pt : L[1] === "?" ? Dt : L[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 (pt.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], M()), w.nextNode(), a.push({ type: 2, index: ++n });
349
- i.append(h[y], M());
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 === ct)
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, c;
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 = U(t) ? void 0 : t._$litDirective$;
374
- return (i == null ? void 0 : i.constructor) !== n && ((c = i == null ? void 0 : i._$AO) == null || c.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, c = 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
392
  let d;
393
- a.type === 2 ? d = new D(n, n.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (d = new Tt(n, this, t)), this._$AV.push(d), a = s[++c];
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 D {
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 D {
422
422
  return this._$AB;
423
423
  }
424
424
  _$AI(t, e = this) {
425
- t = C(this, t, e), U(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 D {
431
431
  this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
432
432
  }
433
433
  _(t) {
434
- this._$AH !== l && U(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 = P.createElement(ut(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), c = o.u(this.options);
443
- o.p(e), this.$(c), 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 P(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 D(this.k(M()), this.k(M()), 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,65 +467,65 @@ class D {
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 = !U(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 c = t;
486
+ const l = t;
487
487
  let a, d;
488
488
  for (t = n[0], a = 0; a < n.length - 1; a++)
489
- d = C(this, c[s + a], e, a), d === S && (d = this._$AH[a]), o || (o = !U(d) || d !== this._$AH[a]), d === l ? t = l : t !== l && (t += (d ?? "") + n[a + 1]), this._$AH[a] = d;
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 Dt 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;
525
525
  typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
526
526
  }
527
527
  }
528
- class Tt {
528
+ class Dt {
529
529
  constructor(t, e, s) {
530
530
  this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
531
531
  }
@@ -533,26 +533,26 @@ class Tt {
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 = I.litHtmlPolyfillSupport;
540
- q == null || q(P, D), (I.litHtmlVersions ?? (I.litHtmlVersions = [])).push("3.0.2");
541
- const Ot = (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 D(t.insertBefore(M(), 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 = Ot(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 Ft = (r) => (...t) => ({ _$litDirective$: r, values: t });
591
- let Nt = 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 Nt = class {
609
609
  * Copyright 2020 Google LLC
610
610
  * SPDX-License-Identifier: BSD-3-Clause
611
611
  */
612
- const Vt = {}, Rt = (r, t = Vt) => 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 Bt = Ft(class extends Nt {
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 && (Rt(r), this.key = t), e;
625
+ update(i, [t, e]) {
626
+ return t !== this.key && (Tt(i), this.key = t), e;
627
627
  }
628
- }), zt = `
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
- `, $t = `
717
+ `, K = `
718
718
  * {
719
719
  font-family: Roboto, sans-serif;
720
720
  }
721
721
 
722
- ${zt}
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,117 +793,117 @@ button.small {
793
793
  font-size: small;
794
794
  flex-grow: 1;
795
795
  }
796
- `, nt = (r, t, e = !1) => ({
797
- id: r,
798
- condition: t,
799
- panIn: e,
800
- layer: {
801
- type: "Vector",
802
- properties: {
803
- id: "selectLayer"
804
- },
805
- source: {
806
- type: "Vector"
807
- },
808
- style: {
809
- "fill-color": "rgba(51, 153, 204,0.5)",
810
- "stroke-color": "#3399CC",
811
- "stroke-width": 2.5
812
- }
813
- }
814
- });
815
- class yt 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 {
816
829
  constructor() {
817
830
  super();
818
831
  /**
819
832
  * @type import("../../../map/src/select").EOxSelectInteraction
820
833
  */
821
- A(this, "hoverInteraction");
834
+ g(this, "hoverInteraction");
822
835
  /**
823
836
  * @type import("../../../map/src/select").EOxSelectInteraction
824
837
  */
825
- A(this, "clickInteraction");
838
+ g(this, "clickInteraction");
826
839
  /**
827
840
  * @type string | number
828
841
  */
829
- A(this, "hoverId");
842
+ g(this, "hoverId");
830
843
  /**
831
844
  * @type string | number
832
845
  */
833
- A(this, "clickId");
834
- 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;
835
848
  }
836
849
  /**
837
- * 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.
838
853
  */
839
854
  _handleDelete(e) {
840
- e.stopPropagation();
841
- const s = e.target.getAttribute("index"), i = this.drawnFeatures[s];
842
- this.drawLayer.getSource().removeFeature(i), this.drawnFeatures.splice(s, 1), this.requestUpdate();
855
+ Kt(e, this);
843
856
  }
844
857
  /**
845
- * Select and Deselect feature from the list
858
+ * Handles the selection and deselection of a feature from the list.
846
859
  *
847
- * @param {import("ol").Feature} feature
860
+ * @param {import("ol").Feature} feature - The selected feature.
848
861
  */
849
862
  _handleFeatureSelectAndDeselect(e) {
850
- const s = e.get("id");
851
- if (this.clickId === s) {
852
- const i = this.drawLayer.getSource().getExtent();
853
- this.olMap.getView().fit(i, { duration: 750 }), this.clickInteraction.highlightById([]);
854
- } else
855
- this.clickInteraction.highlightById([s]), this.olMap.getView().fit(e.getGeometry().getExtent(), { duration: 750 });
856
- this.requestUpdate();
863
+ Qt(e, this);
857
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);
872
+ }
873
+ /**
874
+ * Initiates initial settings and event triggers upon the component's first update.
875
+ */
858
876
  firstUpdated() {
859
- var i, n;
860
- const e = (i = this.eoxMap) == null ? void 0 : i.selectInteractions["draw-hover"], s = (n = this.eoxMap) == null ? void 0 : n.selectInteractions["draw-click"];
861
- e || (this.hoverInteraction = this.eoxMap.addSelect(
862
- this.layer,
863
- nt("draw-hover", "pointermove")
864
- )), s || (this.clickInteraction = this.eoxMap.addSelect(
865
- this.layer,
866
- nt("draw-click", "click", !0)
867
- )), this.hoverInteraction.selectStyleLayer.on(
868
- "change",
869
- () => this.requestUpdate()
870
- ), this.clickInteraction.selectStyleLayer.on(
871
- "change",
872
- () => this.requestUpdate()
873
- );
877
+ Gt(this);
874
878
  }
875
879
  render() {
876
880
  var e, s;
877
- return this.hoverInteraction = this.eoxMap.selectInteractions["draw-hover"], this.clickInteraction = this.eoxMap.selectInteractions["draw-click"], 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`
878
882
  <style>
879
- ${!this.unstyled && $t}
883
+ ${!this.unstyled && K}
880
884
  </style>
881
885
  <ul>
882
- ${this.drawnFeatures.map((i, n) => {
883
- const o = i.get("id"), c = this.hoverId === o || this.clickId === o;
884
- return Bt(
885
- n + 1,
886
- 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`
887
891
  <li
888
- class="${c ? "selected" : l}"
889
- @mouseover=${() => {
890
- this.clickId !== o && this.hoverInteraction.highlightById([o]);
891
- }}
892
- @mouseout=${() => {
893
- this.clickId !== o && this.hoverInteraction.highlightById([]);
894
- }}
892
+ class="${a || d ? "selected" : c}"
893
+ @mouseover=${() => this._handleHoverFeature(l)}
894
+ @mouseout=${() => this._handleHoverFeature(l, !0)}
895
895
  >
896
896
  <div
897
897
  class="list"
898
- @click="${() => this._handleFeatureSelectAndDeselect(i)}"
898
+ @click="${() => this._handleFeatureSelectAndDeselect(r)}"
899
899
  >
900
- <span class="title">Feature #${n + 1}</span>
900
+ <span class="title">Feature #${o}</span>
901
901
  <button
902
902
  index=${n}
903
903
  class="icon small discard"
904
904
  @click="${this._handleDelete}"
905
905
  >
906
- ${this.unstyled ? "x" : l}
906
+ x
907
907
  </button>
908
908
  </div>
909
909
  </li>
@@ -914,143 +914,273 @@ class yt extends x {
914
914
  `;
915
915
  }
916
916
  }
917
- A(yt, "properties", {
917
+ g(gt, "properties", {
918
918
  eoxMap: { attribute: !1, state: !0 },
919
919
  olMap: { attribute: !1, state: !0 },
920
920
  draw: { attribute: !1, state: !0 },
921
- layer: { type: String },
922
921
  drawLayer: { attribute: !1, state: !0 },
923
922
  drawnFeatures: { attribute: !1, state: !0, type: Array },
924
923
  modify: { attribute: !1, state: !0 },
925
924
  unstyled: { type: Boolean }
926
925
  });
927
- customElements.define("eox-drawtools-list", yt);
928
- const qt = `
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 = `
929
995
  :host {
930
996
  display: block;
931
997
  }
932
- `;
933
- var u, E;
934
- class jt 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 {
935
1077
  constructor() {
936
1078
  super();
937
1079
  /**
938
1080
  * @type import("../../map/main").EOxMap
939
1081
  */
940
- V(this, u, void 0);
1082
+ H(this, x, void 0);
941
1083
  /**
942
1084
  * @type import("ol").Map
943
1085
  */
944
- V(this, E, void 0);
945
- this.for = "eox-map", this.currentlyDrawing = !1, this.draw = null, this.drawLayer = null, this.drawnFeatures = [], this.layer = "draw", this.modify = null, this.multipleFeatures = !1, this.showList = !1, this.unstyled = !1;
1086
+ H(this, S, void 0);
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;
946
1088
  }
1089
+ // Define properties with defaults and types
947
1090
  static get properties() {
948
1091
  return {
1092
+ allowModify: { attribute: "allow-modify", type: Boolean },
949
1093
  for: { type: String },
950
1094
  currentlyDrawing: { attribute: !1, state: !0, type: Boolean },
951
1095
  draw: { attribute: !1, state: !0 },
952
1096
  drawLayer: { attribute: !1, state: !0 },
953
1097
  drawnFeatures: { attribute: !1, state: !0, type: Array },
954
- layer: { type: String },
955
1098
  modify: { attribute: !1, state: !0 },
956
1099
  multipleFeatures: { attribute: "multiple-features", type: Boolean },
957
1100
  showList: { attribute: "show-list", type: Boolean },
1101
+ type: { type: String },
958
1102
  unstyled: { type: Boolean }
959
1103
  };
960
1104
  }
961
- startDrawing() {
962
- var e, s;
963
- $(this, u).addDraw(this.layer, {
964
- id: "drawInteraction",
965
- type: "Polygon",
966
- stopClick: !0
967
- }), this.draw = /** @type {import("ol/interaction").Draw} */
968
- /** @type {unknown} */
969
- $(this, u).interactions.drawInteraction, this.modify = /** @type {import("ol/interaction").Modify} */
970
- /** @type {unknown} */
971
- $(this, u).interactions.drawInteractionmodify, (e = this.draw) == null || e.on("drawend", (i) => this.onDrawEnd(i)), (s = this.modify) == null || s.on("modifyend", (i) => this.onModifyEnd(i)), this.currentlyDrawing = !0, this.requestUpdate();
972
- }
973
- discardDrawing() {
974
- this.drawnFeatures = [], $(this, u).removeInteraction("drawInteraction"), this.drawLayer.getSource().clear(), this.emitDrawnFeatures(), this.currentlyDrawing = !1, this.requestUpdate();
1105
+ /**
1106
+ * Initializes the drawing layer before starting to draw on the map.
1107
+ */
1108
+ initDrawLayer() {
1109
+ const { EoxMap: e, OlMap: s } = ee(this);
1110
+ M(this, x, e), M(this, S, s);
975
1111
  }
976
1112
  /**
977
- *
978
- * @param {import("ol/interaction/Draw").DrawEvent} evt
1113
+ * @onClick Event handler triggered to start drawing on the map.
1114
+ */
1115
+ handleStartDrawing() {
1116
+ te(this);
1117
+ }
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));
1124
+ }
1125
+ /**
1126
+ * @event onDrawEnd triggered when the drawing of a shape is completed.
979
1127
  */
980
1128
  onDrawEnd() {
981
- this.emitDrawnFeatures(), $(this, u).removeInteraction("drawInteraction"), this.currentlyDrawing = !1, this.requestUpdate();
1129
+ _t(this);
982
1130
  }
983
1131
  /**
984
- *
985
- * @param {import("ol/interaction/Modify").ModifyEvent} evt
1132
+ * @event onModifyEnd triggered when the modification of a shape is completed.
986
1133
  */
987
1134
  onModifyEnd() {
988
1135
  this.emitDrawnFeatures();
989
1136
  }
1137
+ /**
1138
+ * Triggers different events when the drawing of a shape is completed.
1139
+ */
990
1140
  emitDrawnFeatures() {
991
- setTimeout(() => {
992
- this.drawnFeatures = this.drawLayer.getSource().getFeatures(), this.requestUpdate(), this.dispatchEvent(
993
- new CustomEvent("drawupdate", {
994
- detail: this.drawnFeatures
995
- })
1141
+ ie(this, () => {
1142
+ this.dispatchEvent(
1143
+ new CustomEvent("drawupdate", { detail: this.drawnFeatures })
996
1144
  );
997
- }, 0);
1145
+ });
998
1146
  }
1147
+ // Render method for UI display
999
1148
  render() {
1000
- var s, i, n;
1001
- const e = document.querySelector(this.for);
1002
- return R(
1003
- this,
1004
- u,
1005
- /** @type {import("@eox/map/main").EOxMap} */
1006
- e
1007
- ), R(
1008
- this,
1009
- E,
1010
- /** @type {import("ol").Map} */
1011
- $(this, u).map
1012
- ), this.drawLayer = /** @type {import("ol/layer").Vector<import("ol/source").Vector>} */
1013
- $(this, E).getLayers().getArray().find((o) => o.get("id") === this.layer), this.requestUpdate(), F`
1149
+ var e;
1150
+ return O`
1014
1151
  <style>
1015
- ${qt}
1016
- ${!this.unstyled && $t}
1152
+ ${Yt}
1153
+ ${!this.unstyled && K}
1017
1154
  </style>
1018
- <div>
1019
- <slot></slot>
1020
- <button
1021
- data-cy="drawBtn"
1022
- class="polygon icon"
1023
- disabled="${!this.multipleFeatures && ((s = this.drawnFeatures) == null ? void 0 : s.length) > 0 || this.currentlyDrawing || l}"
1024
- @click="${() => this.startDrawing()}"
1025
- >
1026
- ${this.currentlyDrawing ? "drawing" : "draw"}
1027
- </button>
1028
- <button
1029
- data-cy="discardBtn"
1030
- class="discard icon"
1031
- disabled="${!((i = this.drawnFeatures) != null && i.length) && !this.currentlyDrawing || l}"
1032
- @click="${() => this.discardDrawing()}"
1033
- >
1034
- discard
1035
- </button>
1036
- </div>
1037
- ${this.showList && ((n = this.drawnFeatures) != null && n.length) ? F`<eox-drawtools-list
1038
- .eoxMap=${$(this, u)}
1039
- .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)}
1040
1172
  .draw=${this.draw}
1041
- .layer=${this.layer}
1042
1173
  .drawLayer=${this.drawLayer}
1043
1174
  .drawnFeatures=${this.drawnFeatures}
1044
1175
  .modify=${this.modify}
1045
1176
  .unstyled=${this.unstyled}
1046
1177
  @changed=${() => this.requestUpdate()}
1047
- >
1048
- </eox-drawtools-list>` : l}
1178
+ ></eox-drawtools-list>` : c}
1049
1179
  `;
1050
1180
  }
1051
1181
  }
1052
- u = new WeakMap(), E = new WeakMap();
1053
- customElements.define("eox-drawtools", jt);
1182
+ x = new WeakMap(), S = new WeakMap();
1183
+ customElements.define("eox-drawtools", re);
1054
1184
  export {
1055
- jt as EOxDrawTools
1185
+ re as EOxDrawTools
1056
1186
  };