@eox/drawtools 0.3.1 → 0.4.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,24 +1,30 @@
1
- var _t = Object.defineProperty;
2
- var $t = (r, t, e) => t in r ? _t(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var p = (r, t, e) => ($t(r, typeof t != "symbol" ? t + "" : t, e), e);
1
+ var K = (r, t, e) => {
2
+ if (!t.has(r))
3
+ throw TypeError("Cannot " + e);
4
+ };
5
+ var g = (r, t, e) => (K(r, t, "read from private field"), e ? e.call(r) : t.get(r)), L = (r, t, e) => {
6
+ if (t.has(r))
7
+ throw TypeError("Cannot add the same private member more than once");
8
+ t instanceof WeakSet ? t.add(r) : t.set(r, e);
9
+ }, R = (r, t, e, i) => (K(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e);
4
10
  /**
5
11
  * @license
6
12
  * Copyright 2019 Google LLC
7
13
  * SPDX-License-Identifier: BSD-3-Clause
8
14
  */
9
- const k = window, Q = k.ShadowRoot && (k.ShadyCSS === void 0 || k.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ht = Symbol(), X = /* @__PURE__ */ new WeakMap();
15
+ const D = window, J = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, at = Symbol(), Q = /* @__PURE__ */ new WeakMap();
10
16
  let vt = class {
11
17
  constructor(t, e, i) {
12
- if (this._$cssResult$ = !0, i !== ht)
18
+ if (this._$cssResult$ = !0, i !== at)
13
19
  throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
14
20
  this.cssText = t, this.t = e;
15
21
  }
16
22
  get styleSheet() {
17
23
  let t = this.o;
18
24
  const e = this.t;
19
- if (Q && t === void 0) {
25
+ if (J && t === void 0) {
20
26
  const i = e !== void 0 && e.length === 1;
21
- i && (t = X.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && X.set(e, t));
27
+ i && (t = Q.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && Q.set(e, t));
22
28
  }
23
29
  return t;
24
30
  }
@@ -26,27 +32,27 @@ let vt = class {
26
32
  return this.cssText;
27
33
  }
28
34
  };
29
- const yt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, ht), ft = (r, t) => {
30
- Q ? r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
31
- const i = document.createElement("style"), s = k.litNonce;
35
+ const gt = (r) => new vt(typeof r == "string" ? r : r + "", void 0, at), yt = (r, t) => {
36
+ J ? r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
37
+ const i = document.createElement("style"), s = D.litNonce;
32
38
  s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, r.appendChild(i);
33
39
  });
34
- }, G = Q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
40
+ }, X = J ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
35
41
  let e = "";
36
42
  for (const i of t.cssRules)
37
43
  e += i.cssText;
38
- return yt(e);
44
+ return gt(e);
39
45
  })(r) : r;
40
46
  /**
41
47
  * @license
42
48
  * Copyright 2017 Google LLC
43
49
  * SPDX-License-Identifier: BSD-3-Clause
44
50
  */
45
- var j;
46
- const R = window, Y = R.trustedTypes, gt = Y ? Y.emptyScript : "", tt = R.reactiveElementPolyfillSupport, K = { toAttribute(r, t) {
51
+ var B;
52
+ const T = window, G = T.trustedTypes, _t = G ? G.emptyScript : "", Y = T.reactiveElementPolyfillSupport, q = { toAttribute(r, t) {
47
53
  switch (t) {
48
54
  case Boolean:
49
- r = r ? gt : null;
55
+ r = r ? _t : null;
50
56
  break;
51
57
  case Object:
52
58
  case Array:
@@ -71,8 +77,8 @@ const R = window, Y = R.trustedTypes, gt = Y ? Y.emptyScript : "", tt = R.reacti
71
77
  }
72
78
  }
73
79
  return e;
74
- } }, dt = (r, t) => t !== r && (t == t || r == r), z = { attribute: !0, type: String, converter: K, reflect: !1, hasChanged: dt }, J = "finalized";
75
- let w = class extends HTMLElement {
80
+ } }, ht = (r, t) => t !== r && (t == t || r == r), I = { attribute: !0, type: String, converter: q, reflect: !1, hasChanged: ht }, W = "finalized";
81
+ let A = class extends HTMLElement {
76
82
  constructor() {
77
83
  super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u();
78
84
  }
@@ -88,7 +94,7 @@ let w = class extends HTMLElement {
88
94
  s !== void 0 && (this._$Ev.set(s, i), t.push(s));
89
95
  }), t;
90
96
  }
91
- static createProperty(t, e = z) {
97
+ static createProperty(t, e = I) {
92
98
  if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
93
99
  const i = typeof t == "symbol" ? Symbol() : "__" + t, s = this.getPropertyDescriptor(t, i, e);
94
100
  s !== void 0 && Object.defineProperty(this.prototype, t, s);
@@ -98,17 +104,17 @@ let w = class extends HTMLElement {
98
104
  return { get() {
99
105
  return this[e];
100
106
  }, set(s) {
101
- const o = this[t];
102
- this[e] = s, this.requestUpdate(t, o, i);
107
+ const n = this[t];
108
+ this[e] = s, this.requestUpdate(t, n, i);
103
109
  }, configurable: !0, enumerable: !0 };
104
110
  }
105
111
  static getPropertyOptions(t) {
106
- return this.elementProperties.get(t) || z;
112
+ return this.elementProperties.get(t) || I;
107
113
  }
108
114
  static finalize() {
109
- if (this.hasOwnProperty(J))
115
+ if (this.hasOwnProperty(W))
110
116
  return !1;
111
- this[J] = !0;
117
+ this[W] = !0;
112
118
  const t = Object.getPrototypeOf(this);
113
119
  if (t.finalize(), t.h !== void 0 && (this.h = [...t.h]), this.elementProperties = new Map(t.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
114
120
  const e = this.properties, i = [...Object.getOwnPropertyNames(e), ...Object.getOwnPropertySymbols(e)];
@@ -122,9 +128,9 @@ let w = class extends HTMLElement {
122
128
  if (Array.isArray(t)) {
123
129
  const i = new Set(t.flat(1 / 0).reverse());
124
130
  for (const s of i)
125
- e.unshift(G(s));
131
+ e.unshift(X(s));
126
132
  } else
127
- t !== void 0 && e.push(G(t));
133
+ t !== void 0 && e.push(X(t));
128
134
  return e;
129
135
  }
130
136
  static _$Ep(t, e) {
@@ -151,7 +157,7 @@ let w = class extends HTMLElement {
151
157
  createRenderRoot() {
152
158
  var t;
153
159
  const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
154
- return ft(e, this.constructor.elementStyles), e;
160
+ return yt(e, this.constructor.elementStyles), e;
155
161
  }
156
162
  connectedCallback() {
157
163
  var t;
@@ -172,25 +178,25 @@ let w = class extends HTMLElement {
172
178
  attributeChangedCallback(t, e, i) {
173
179
  this._$AK(t, i);
174
180
  }
175
- _$EO(t, e, i = z) {
181
+ _$EO(t, e, i = I) {
176
182
  var s;
177
- const o = this.constructor._$Ep(t, i);
178
- if (o !== void 0 && i.reflect === !0) {
179
- const n = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter : K).toAttribute(e, i.type);
180
- this._$El = t, n == null ? this.removeAttribute(o) : this.setAttribute(o, n), this._$El = null;
183
+ const n = this.constructor._$Ep(t, i);
184
+ if (n !== void 0 && i.reflect === !0) {
185
+ const o = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter : q).toAttribute(e, i.type);
186
+ this._$El = t, o == null ? this.removeAttribute(n) : this.setAttribute(n, o), this._$El = null;
181
187
  }
182
188
  }
183
189
  _$AK(t, e) {
184
190
  var i;
185
- const s = this.constructor, o = s._$Ev.get(t);
186
- if (o !== void 0 && this._$El !== o) {
187
- const n = s.getPropertyOptions(o), d = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((i = n.converter) === null || i === void 0 ? void 0 : i.fromAttribute) !== void 0 ? n.converter : K;
188
- this._$El = o, this[o] = d.fromAttribute(e, n.type), this._$El = null;
191
+ const s = this.constructor, n = s._$Ev.get(t);
192
+ if (n !== void 0 && this._$El !== n) {
193
+ const o = s.getPropertyOptions(n), h = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((i = o.converter) === null || i === void 0 ? void 0 : i.fromAttribute) !== void 0 ? o.converter : q;
194
+ this._$El = n, this[n] = h.fromAttribute(e, o.type), this._$El = null;
189
195
  }
190
196
  }
191
197
  requestUpdate(t, e, i) {
192
198
  let s = !0;
193
- t !== void 0 && (((i = i || this.constructor.getPropertyOptions(t)).hasChanged || dt)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), i.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, i))) : s = !1), !this.isUpdatePending && s && (this._$E_ = this._$Ej());
199
+ t !== void 0 && (((i = i || this.constructor.getPropertyOptions(t)).hasChanged || ht)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), i.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, i))) : s = !1), !this.isUpdatePending && s && (this._$E_ = this._$Ej());
194
200
  }
195
201
  async _$Ej() {
196
202
  this.isUpdatePending = !0;
@@ -209,13 +215,13 @@ let w = class extends HTMLElement {
209
215
  var t;
210
216
  if (!this.isUpdatePending)
211
217
  return;
212
- this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, o) => this[o] = s), this._$Ei = void 0);
218
+ this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, n) => this[n] = s), this._$Ei = void 0);
213
219
  let e = !1;
214
220
  const i = this._$AL;
215
221
  try {
216
222
  e = this.shouldUpdate(i), e ? (this.willUpdate(i), (t = this._$ES) === null || t === void 0 || t.forEach((s) => {
217
- var o;
218
- return (o = s.hostUpdate) === null || o === void 0 ? void 0 : o.call(s);
223
+ var n;
224
+ return (n = s.hostUpdate) === null || n === void 0 ? void 0 : n.call(s);
219
225
  }), this.update(i)) : this._$Ek();
220
226
  } catch (s) {
221
227
  throw e = !1, this._$Ek(), s;
@@ -251,75 +257,78 @@ let w = class extends HTMLElement {
251
257
  firstUpdated(t) {
252
258
  }
253
259
  };
254
- w[J] = !0, w.elementProperties = /* @__PURE__ */ new Map(), w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, tt == null || tt({ ReactiveElement: w }), ((j = R.reactiveElementVersions) !== null && j !== void 0 ? j : R.reactiveElementVersions = []).push("1.6.2");
260
+ A[W] = !0, A.elementProperties = /* @__PURE__ */ new Map(), A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, Y == null || Y({ ReactiveElement: A }), ((B = T.reactiveElementVersions) !== null && B !== void 0 ? B : T.reactiveElementVersions = []).push("1.6.2");
255
261
  /**
256
262
  * @license
257
263
  * Copyright 2017 Google LLC
258
264
  * SPDX-License-Identifier: BSD-3-Clause
259
265
  */
260
- var B;
261
- const I = window, E = I.trustedTypes, et = E ? E.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Z = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, ct = "?" + f, At = `<${ct}>`, m = document, U = () => m.createComment(""), M = (r) => r === null || typeof r != "object" && typeof r != "function", ut = Array.isArray, mt = (r) => ut(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", F = `[
262
- \f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, it = /-->/g, st = />/g, g = RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^
263
- \f\r"'\`<>=]|("|')|))|$)`, "g"), rt = /'/g, nt = /"/g, pt = /^(?:script|style|textarea|title)$/i, wt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), Et = wt(1), S = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ot = /* @__PURE__ */ new WeakMap(), A = m.createTreeWalker(m, 129, null, !1), St = (r, t) => {
264
- const e = r.length - 1, i = [];
265
- let s, o = t === 2 ? "<svg>" : "", n = x;
266
- for (let l = 0; l < e; l++) {
267
- const a = r[l];
268
- let y, h, c = -1, $ = 0;
269
- for (; $ < a.length && (n.lastIndex = $, h = n.exec(a), h !== null); )
270
- $ = n.lastIndex, n === x ? h[1] === "!--" ? n = it : h[1] !== void 0 ? n = st : h[2] !== void 0 ? (pt.test(h[2]) && (s = RegExp("</" + h[2], "g")), n = g) : h[3] !== void 0 && (n = g) : n === g ? h[0] === ">" ? (n = s ?? x, c = -1) : h[1] === void 0 ? c = -2 : (c = n.lastIndex - h[2].length, y = h[1], n = h[3] === void 0 ? g : h[3] === '"' ? nt : rt) : n === nt || n === rt ? n = g : n === it || n === st ? n = x : (n = g, s = void 0);
271
- const T = n === g && r[l + 1].startsWith("/>") ? " " : "";
272
- o += n === x ? a + At : c >= 0 ? (i.push(y), a.slice(0, c) + Z + a.slice(c) + f + T) : a + f + (c === -2 ? (i.push(void 0), l) : T);
273
- }
274
- const d = o + (r[e] || "<?>") + (t === 2 ? "</svg>" : "");
266
+ var V;
267
+ const M = window, b = M.trustedTypes, tt = b ? b.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, Z = "$lit$", y = `lit$${(Math.random() + "").slice(9)}$`, dt = "?" + y, ft = `<${dt}>`, m = document, C = () => m.createComment(""), H = (r) => r === null || typeof r != "object" && typeof r != "function", ct = Array.isArray, mt = (r) => ct(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", z = `[
268
+ \f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, it = />/g, _ = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
269
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, rt = /"/g, ut = /^(?:script|style|textarea|title)$/i, At = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), bt = At(1), w = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), f = m.createTreeWalker(m, 129, null, !1);
270
+ function pt(r, t) {
275
271
  if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
276
272
  throw Error("invalid template strings array");
277
- return [et !== void 0 ? et.createHTML(d) : d, i];
273
+ return tt !== void 0 ? tt.createHTML(t) : t;
274
+ }
275
+ const wt = (r, t) => {
276
+ const e = r.length - 1, i = [];
277
+ let s, n = t === 2 ? "<svg>" : "", o = E;
278
+ for (let h = 0; h < e; h++) {
279
+ const l = r[h];
280
+ let a, d, c = -1, p = 0;
281
+ for (; p < l.length && (o.lastIndex = p, d = o.exec(l), d !== null); )
282
+ p = o.lastIndex, o === E ? d[1] === "!--" ? o = et : d[1] !== void 0 ? o = it : d[2] !== void 0 ? (ut.test(d[2]) && (s = RegExp("</" + d[2], "g")), o = _) : d[3] !== void 0 && (o = _) : o === _ ? d[0] === ">" ? (o = s ?? E, c = -1) : d[1] === void 0 ? c = -2 : (c = o.lastIndex - d[2].length, a = d[1], o = d[3] === void 0 ? _ : d[3] === '"' ? rt : st) : o === rt || o === st ? o = _ : o === et || o === it ? o = E : (o = _, s = void 0);
283
+ const $ = o === _ && r[h + 1].startsWith("/>") ? " " : "";
284
+ n += o === E ? l + ft : c >= 0 ? (i.push(a), l.slice(0, c) + Z + l.slice(c) + y + $) : l + y + (c === -2 ? (i.push(void 0), h) : $);
285
+ }
286
+ return [pt(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), i];
278
287
  };
279
- class H {
288
+ class U {
280
289
  constructor({ strings: t, _$litType$: e }, i) {
281
290
  let s;
282
291
  this.parts = [];
283
- let o = 0, n = 0;
284
- const d = t.length - 1, l = this.parts, [a, y] = St(t, e);
285
- if (this.el = H.createElement(a, i), A.currentNode = this.el.content, e === 2) {
286
- const h = this.el.content, c = h.firstChild;
287
- c.remove(), h.append(...c.childNodes);
292
+ let n = 0, o = 0;
293
+ const h = t.length - 1, l = this.parts, [a, d] = wt(t, e);
294
+ if (this.el = U.createElement(a, i), f.currentNode = this.el.content, e === 2) {
295
+ const c = this.el.content, p = c.firstChild;
296
+ p.remove(), c.append(...p.childNodes);
288
297
  }
289
- for (; (s = A.nextNode()) !== null && l.length < d; ) {
298
+ for (; (s = f.nextNode()) !== null && l.length < h; ) {
290
299
  if (s.nodeType === 1) {
291
300
  if (s.hasAttributes()) {
292
- const h = [];
293
- for (const c of s.getAttributeNames())
294
- if (c.endsWith(Z) || c.startsWith(f)) {
295
- const $ = y[n++];
296
- if (h.push(c), $ !== void 0) {
297
- const T = s.getAttribute($.toLowerCase() + Z).split(f), D = /([.?@])?(.*)/.exec($);
298
- l.push({ type: 1, index: o, name: D[2], strings: T, ctor: D[1] === "." ? Ct : D[1] === "?" ? Pt : D[1] === "@" ? Ut : L });
301
+ const c = [];
302
+ for (const p of s.getAttributeNames())
303
+ if (p.endsWith(Z) || p.startsWith(y)) {
304
+ const $ = d[o++];
305
+ if (c.push(p), $ !== void 0) {
306
+ const $t = s.getAttribute($.toLowerCase() + Z).split(y), O = /([.?@])?(.*)/.exec($);
307
+ l.push({ type: 1, index: n, name: O[2], strings: $t, ctor: O[1] === "." ? Et : O[1] === "?" ? Ct : O[1] === "@" ? Ht : N });
299
308
  } else
300
- l.push({ type: 6, index: o });
309
+ l.push({ type: 6, index: n });
301
310
  }
302
- for (const c of h)
303
- s.removeAttribute(c);
311
+ for (const p of c)
312
+ s.removeAttribute(p);
304
313
  }
305
- if (pt.test(s.tagName)) {
306
- const h = s.textContent.split(f), c = h.length - 1;
307
- if (c > 0) {
308
- s.textContent = E ? E.emptyScript : "";
309
- for (let $ = 0; $ < c; $++)
310
- s.append(h[$], U()), A.nextNode(), l.push({ type: 2, index: ++o });
311
- s.append(h[c], U());
314
+ if (ut.test(s.tagName)) {
315
+ const c = s.textContent.split(y), p = c.length - 1;
316
+ if (p > 0) {
317
+ s.textContent = b ? b.emptyScript : "";
318
+ for (let $ = 0; $ < p; $++)
319
+ s.append(c[$], C()), f.nextNode(), l.push({ type: 2, index: ++n });
320
+ s.append(c[p], C());
312
321
  }
313
322
  }
314
323
  } else if (s.nodeType === 8)
315
- if (s.data === ct)
316
- l.push({ type: 2, index: o });
324
+ if (s.data === dt)
325
+ l.push({ type: 2, index: n });
317
326
  else {
318
- let h = -1;
319
- for (; (h = s.data.indexOf(f, h + 1)) !== -1; )
320
- l.push({ type: 7, index: o }), h += f.length - 1;
327
+ let c = -1;
328
+ for (; (c = s.data.indexOf(y, c + 1)) !== -1; )
329
+ l.push({ type: 7, index: n }), c += y.length - 1;
321
330
  }
322
- o++;
331
+ n++;
323
332
  }
324
333
  }
325
334
  static createElement(t, e) {
@@ -327,15 +336,15 @@ class H {
327
336
  return i.innerHTML = t, i;
328
337
  }
329
338
  }
330
- function b(r, t, e = r, i) {
331
- var s, o, n, d;
332
- if (t === S)
339
+ function x(r, t, e = r, i) {
340
+ var s, n, o, h;
341
+ if (t === w)
333
342
  return t;
334
343
  let l = i !== void 0 ? (s = e._$Co) === null || s === void 0 ? void 0 : s[i] : e._$Cl;
335
- const a = M(t) ? void 0 : t._$litDirective$;
336
- return (l == null ? void 0 : l.constructor) !== a && ((o = l == null ? void 0 : l._$AO) === null || o === void 0 || o.call(l, !1), a === void 0 ? l = void 0 : (l = new a(r), l._$AT(r, e, i)), i !== void 0 ? ((n = (d = e)._$Co) !== null && n !== void 0 ? n : d._$Co = [])[i] = l : e._$Cl = l), l !== void 0 && (t = b(r, l._$AS(r, t.values), l, i)), t;
344
+ const a = H(t) ? void 0 : t._$litDirective$;
345
+ return (l == null ? void 0 : l.constructor) !== a && ((n = l == null ? void 0 : l._$AO) === null || n === void 0 || n.call(l, !1), a === void 0 ? l = void 0 : (l = new a(r), l._$AT(r, e, i)), i !== void 0 ? ((o = (h = e)._$Co) !== null && o !== void 0 ? o : h._$Co = [])[i] = l : e._$Cl = l), l !== void 0 && (t = x(r, l._$AS(r, t.values), l, i)), t;
337
346
  }
338
- class bt {
347
+ class xt {
339
348
  constructor(t, e) {
340
349
  this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
341
350
  }
@@ -347,17 +356,17 @@ class bt {
347
356
  }
348
357
  u(t) {
349
358
  var e;
350
- const { el: { content: i }, parts: s } = this._$AD, o = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : m).importNode(i, !0);
351
- A.currentNode = o;
352
- let n = A.nextNode(), d = 0, l = 0, a = s[0];
359
+ const { el: { content: i }, parts: s } = this._$AD, n = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : m).importNode(i, !0);
360
+ f.currentNode = n;
361
+ let o = f.nextNode(), h = 0, l = 0, a = s[0];
353
362
  for (; a !== void 0; ) {
354
- if (d === a.index) {
355
- let y;
356
- a.type === 2 ? y = new N(n, n.nextSibling, this, t) : a.type === 1 ? y = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (y = new Mt(n, this, t)), this._$AV.push(y), a = s[++l];
363
+ if (h === a.index) {
364
+ let d;
365
+ a.type === 2 ? d = new k(o, o.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (d = new Ut(o, this, t)), this._$AV.push(d), a = s[++l];
357
366
  }
358
- d !== (a == null ? void 0 : a.index) && (n = A.nextNode(), d++);
367
+ h !== (a == null ? void 0 : a.index) && (o = f.nextNode(), h++);
359
368
  }
360
- return A.currentNode = m, o;
369
+ return f.currentNode = m, n;
361
370
  }
362
371
  v(t) {
363
372
  let e = 0;
@@ -365,10 +374,10 @@ class bt {
365
374
  i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
366
375
  }
367
376
  }
368
- class N {
377
+ class k {
369
378
  constructor(t, e, i, s) {
370
- var o;
371
- this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$Cp = (o = s == null ? void 0 : s.isConnected) === null || o === void 0 || o;
379
+ var n;
380
+ this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$Cp = (n = s == null ? void 0 : s.isConnected) === null || n === void 0 || n;
372
381
  }
373
382
  get _$AU() {
374
383
  var t, e;
@@ -386,7 +395,7 @@ class N {
386
395
  return this._$AB;
387
396
  }
388
397
  _$AI(t, e = this) {
389
- t = b(this, t, e), M(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== S && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : mt(t) ? this.T(t) : this._(t);
398
+ t = x(this, t, e), H(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== w && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : mt(t) ? this.T(t) : this._(t);
390
399
  }
391
400
  k(t) {
392
401
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -395,28 +404,28 @@ class N {
395
404
  this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
396
405
  }
397
406
  _(t) {
398
- this._$AH !== u && M(this._$AH) ? this._$AA.nextSibling.data = t : this.$(m.createTextNode(t)), this._$AH = t;
407
+ this._$AH !== u && H(this._$AH) ? this._$AA.nextSibling.data = t : this.$(m.createTextNode(t)), this._$AH = t;
399
408
  }
400
409
  g(t) {
401
410
  var e;
402
- const { values: i, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = H.createElement(s.h, this.options)), s);
403
- if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === o)
411
+ const { values: i, _$litType$: s } = t, n = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = U.createElement(pt(s.h, s.h[0]), this.options)), s);
412
+ if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === n)
404
413
  this._$AH.v(i);
405
414
  else {
406
- const n = new bt(o, this), d = n.u(this.options);
407
- n.v(i), this.$(d), this._$AH = n;
415
+ const o = new xt(n, this), h = o.u(this.options);
416
+ o.v(i), this.$(h), this._$AH = o;
408
417
  }
409
418
  }
410
419
  _$AC(t) {
411
- let e = ot.get(t.strings);
412
- return e === void 0 && ot.set(t.strings, e = new H(t)), e;
420
+ let e = nt.get(t.strings);
421
+ return e === void 0 && nt.set(t.strings, e = new U(t)), e;
413
422
  }
414
423
  T(t) {
415
- ut(this._$AH) || (this._$AH = [], this._$AR());
424
+ ct(this._$AH) || (this._$AH = [], this._$AR());
416
425
  const e = this._$AH;
417
426
  let i, s = 0;
418
- for (const o of t)
419
- s === e.length ? e.push(i = new N(this.k(U()), this.k(U()), this, this.options)) : i = e[s], i._$AI(o), s++;
427
+ for (const n of t)
428
+ s === e.length ? e.push(i = new k(this.k(C()), this.k(C()), this, this.options)) : i = e[s], i._$AI(n), s++;
420
429
  s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
421
430
  }
422
431
  _$AR(t = this._$AA.nextSibling, e) {
@@ -431,9 +440,9 @@ class N {
431
440
  this._$AM === void 0 && (this._$Cp = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
432
441
  }
433
442
  }
434
- class L {
435
- constructor(t, e, i, s, o) {
436
- this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
443
+ class N {
444
+ constructor(t, e, i, s, n) {
445
+ this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = n, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
437
446
  }
438
447
  get tagName() {
439
448
  return this.element.tagName;
@@ -442,23 +451,23 @@ class L {
442
451
  return this._$AM._$AU;
443
452
  }
444
453
  _$AI(t, e = this, i, s) {
445
- const o = this.strings;
446
- let n = !1;
447
- if (o === void 0)
448
- t = b(this, t, e, 0), n = !M(t) || t !== this._$AH && t !== S, n && (this._$AH = t);
454
+ const n = this.strings;
455
+ let o = !1;
456
+ if (n === void 0)
457
+ t = x(this, t, e, 0), o = !H(t) || t !== this._$AH && t !== w, o && (this._$AH = t);
449
458
  else {
450
- const d = t;
459
+ const h = t;
451
460
  let l, a;
452
- for (t = o[0], l = 0; l < o.length - 1; l++)
453
- a = b(this, d[i + l], e, l), a === S && (a = this._$AH[l]), n || (n = !M(a) || a !== this._$AH[l]), a === u ? t = u : t !== u && (t += (a ?? "") + o[l + 1]), this._$AH[l] = a;
461
+ for (t = n[0], l = 0; l < n.length - 1; l++)
462
+ a = x(this, h[i + l], e, l), a === w && (a = this._$AH[l]), o || (o = !H(a) || a !== this._$AH[l]), a === u ? t = u : t !== u && (t += (a ?? "") + n[l + 1]), this._$AH[l] = a;
454
463
  }
455
- n && !s && this.j(t);
464
+ o && !s && this.j(t);
456
465
  }
457
466
  j(t) {
458
467
  t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
459
468
  }
460
469
  }
461
- class Ct extends L {
470
+ class Et extends N {
462
471
  constructor() {
463
472
  super(...arguments), this.type = 3;
464
473
  }
@@ -466,32 +475,32 @@ class Ct extends L {
466
475
  this.element[this.name] = t === u ? void 0 : t;
467
476
  }
468
477
  }
469
- const xt = E ? E.emptyScript : "";
470
- class Pt extends L {
478
+ const St = b ? b.emptyScript : "";
479
+ class Ct extends N {
471
480
  constructor() {
472
481
  super(...arguments), this.type = 4;
473
482
  }
474
483
  j(t) {
475
- t && t !== u ? this.element.setAttribute(this.name, xt) : this.element.removeAttribute(this.name);
484
+ t && t !== u ? this.element.setAttribute(this.name, St) : this.element.removeAttribute(this.name);
476
485
  }
477
486
  }
478
- class Ut extends L {
479
- constructor(t, e, i, s, o) {
480
- super(t, e, i, s, o), this.type = 5;
487
+ class Ht extends N {
488
+ constructor(t, e, i, s, n) {
489
+ super(t, e, i, s, n), this.type = 5;
481
490
  }
482
491
  _$AI(t, e = this) {
483
492
  var i;
484
- if ((t = (i = b(this, t, e, 0)) !== null && i !== void 0 ? i : u) === S)
493
+ if ((t = (i = x(this, t, e, 0)) !== null && i !== void 0 ? i : u) === w)
485
494
  return;
486
- const s = this._$AH, o = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== u && (s === u || o);
487
- o && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
495
+ const s = this._$AH, n = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== u && (s === u || n);
496
+ n && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
488
497
  }
489
498
  handleEvent(t) {
490
499
  var e, i;
491
500
  typeof this._$AH == "function" ? this._$AH.call((i = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && i !== void 0 ? i : this.element, t) : this._$AH.handleEvent(t);
492
501
  }
493
502
  }
494
- class Mt {
503
+ class Ut {
495
504
  constructor(t, e, i) {
496
505
  this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
497
506
  }
@@ -499,28 +508,28 @@ class Mt {
499
508
  return this._$AM._$AU;
500
509
  }
501
510
  _$AI(t) {
502
- b(this, t);
511
+ x(this, t);
503
512
  }
504
513
  }
505
- const lt = I.litHtmlPolyfillSupport;
506
- lt == null || lt(H, N), ((B = I.litHtmlVersions) !== null && B !== void 0 ? B : I.litHtmlVersions = []).push("2.7.4");
507
- const Ht = (r, t, e) => {
514
+ const ot = M.litHtmlPolyfillSupport;
515
+ ot == null || ot(U, k), ((V = M.litHtmlVersions) !== null && V !== void 0 ? V : M.litHtmlVersions = []).push("2.8.0");
516
+ const Pt = (r, t, e) => {
508
517
  var i, s;
509
- const o = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t;
510
- let n = o._$litPart$;
511
- if (n === void 0) {
512
- const d = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null;
513
- o._$litPart$ = n = new N(t.insertBefore(U(), d), d, void 0, e ?? {});
518
+ const n = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t;
519
+ let o = n._$litPart$;
520
+ if (o === void 0) {
521
+ const h = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null;
522
+ n._$litPart$ = o = new k(t.insertBefore(C(), h), h, void 0, e ?? {});
514
523
  }
515
- return n._$AI(r), n;
524
+ return o._$AI(r), o;
516
525
  };
517
526
  /**
518
527
  * @license
519
528
  * Copyright 2017 Google LLC
520
529
  * SPDX-License-Identifier: BSD-3-Clause
521
530
  */
522
- var q, V;
523
- class P extends w {
531
+ var F, j;
532
+ class S extends A {
524
533
  constructor() {
525
534
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
526
535
  }
@@ -531,7 +540,7 @@ class P extends w {
531
540
  }
532
541
  update(t) {
533
542
  const e = this.render();
534
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ht(e, this.renderRoot, this.renderOptions);
543
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Pt(e, this.renderRoot, this.renderOptions);
535
544
  }
536
545
  connectedCallback() {
537
546
  var t;
@@ -542,165 +551,228 @@ class P extends w {
542
551
  super.disconnectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!1);
543
552
  }
544
553
  render() {
545
- return S;
554
+ return w;
546
555
  }
547
556
  }
548
- P.finalized = !0, P._$litElement$ = !0, (q = globalThis.litElementHydrateSupport) === null || q === void 0 || q.call(globalThis, { LitElement: P });
549
- const at = globalThis.litElementPolyfillSupport;
550
- at == null || at({ LitElement: P });
551
- ((V = globalThis.litElementVersions) !== null && V !== void 0 ? V : globalThis.litElementVersions = []).push("3.3.2");
552
- /**
553
- * @license
554
- * Copyright 2017 Google LLC
555
- * SPDX-License-Identifier: BSD-3-Clause
556
- */
557
- const Nt = (r) => (t) => typeof t == "function" ? ((e, i) => (customElements.define(e, i), i))(r, t) : ((e, i) => {
558
- const { kind: s, elements: o } = i;
559
- return { kind: s, elements: o, finisher(n) {
560
- customElements.define(e, n);
561
- } };
562
- })(r, t);
563
- /**
564
- * @license
565
- * Copyright 2017 Google LLC
566
- * SPDX-License-Identifier: BSD-3-Clause
567
- */
568
- const Ot = (r, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) {
569
- e.createProperty(t.key, r);
570
- } } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
571
- typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
572
- }, finisher(e) {
573
- e.createProperty(t.key, r);
574
- } }, Tt = (r, t, e) => {
575
- t.constructor.createProperty(e, r);
576
- };
577
- function O(r) {
578
- return (t, e) => e !== void 0 ? Tt(r, t, e) : Ot(r, t);
579
- }
580
- /**
581
- * @license
582
- * Copyright 2017 Google LLC
583
- * SPDX-License-Identifier: BSD-3-Clause
584
- */
585
- function C(r) {
586
- return O({ ...r, state: !0 });
587
- }
588
- /**
589
- * @license
590
- * Copyright 2021 Google LLC
591
- * SPDX-License-Identifier: BSD-3-Clause
592
- */
593
- var W;
594
- ((W = window.HTMLSlotElement) === null || W === void 0 ? void 0 : W.prototype.assignedElements) != null;
595
- const Dt = `
557
+ S.finalized = !0, S._$litElement$ = !0, (F = globalThis.litElementHydrateSupport) === null || F === void 0 || F.call(globalThis, { LitElement: S });
558
+ const lt = globalThis.litElementPolyfillSupport;
559
+ lt == null || lt({ LitElement: S });
560
+ ((j = globalThis.litElementVersions) !== null && j !== void 0 ? j : globalThis.litElementVersions = []).push("3.3.2");
561
+ const kt = `
596
562
  :host {
597
563
  display: block;
598
564
  }
599
- `, kt = `
565
+ `, Ot = `
566
+ button {
567
+ /* TODO: why does this only work here and not from :root? */
568
+ --primary-color: #004170;
569
+ --primary-color-hover: #004170CC;
570
+ --error-color: #FF5252;
571
+
572
+ display: inline-flex;
573
+ position: relative;
574
+ align-items: center;
575
+ color: #fff;
576
+ border-width: 0;
577
+ outline: none;
578
+ border-radius: 4px;
579
+ padding: 16px;
580
+ height: 36px;
581
+ cursor: pointer;
582
+ font-family: inherit;
583
+ font-size: 0.875rem;
584
+ text-transform: uppercase;
585
+ letter-spacing: 1.25px;
586
+ font-weight: 500;
587
+ box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
588
+ transition-property: box-shadow, transform, opacity, background;
589
+ transition-duration: 0.28s;
590
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
591
+ }
592
+
593
+ button:hover:not([disabled]) {
594
+ box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
595
+ background: var(--primary-color-hover);
596
+ }
597
+
598
+ button, button:active {
599
+ background: var(--primary-color);
600
+ }
601
+
602
+ button[disabled] {
603
+ opacity: 0.5;
604
+ }
605
+
606
+ button.outline {
607
+ background: transparent;
608
+ box-shadow: none;
609
+ color: var(--primary-color);
610
+ outline: 1px solid var(--primary-color);
611
+ }
612
+
613
+ button.outline:hover {
614
+ background: transparent;
615
+ }
616
+
617
+ button.icon {
618
+ background: transparent;
619
+ border: none;
620
+ box-shadow: none;
621
+ padding: 0;
622
+ border-radius: 50%;
623
+ width: 24px;
624
+ text-indent: -9999px;
625
+ }
626
+
627
+ button.icon-text {
628
+ text-indent: 26px;
629
+ }
630
+
631
+ button.icon:before, button.icon-text:before {
632
+ position: absolute;
633
+ text-indent: 0;
634
+ line-height: initial;
635
+ }
636
+
637
+ button.icon:before {
638
+ width: 24px;
639
+ height: 24px;
640
+ margin-right: 0;
641
+ }
642
+
643
+ button.icon-text:before {
644
+ width: 18px;
645
+ height: 18px;
646
+ }
647
+
648
+ button.small {
649
+ height: 28px;
650
+ padding: 12.4px;
651
+ font-size: .75rem;
652
+ }
653
+ `, Dt = `
654
+ * {
655
+ font-family: Roboto, sans-serif;
656
+ }
657
+
658
+ ${Ot}
659
+
660
+ button.discard {
661
+ background: var(--error-color);
662
+ }
663
+
664
+ button.polygon:before {
665
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 24 24'%3E%3Ctitle%3Eshape-polygon-plus%3C/title%3E%3Cpath d='M17,15.7V13H19V17L10,21L3,14L7,5H11V7H8.3L5.4,13.6L10.4,18.6L17,15.7M22,5V7H19V10H17V7H14V5H17V2H19V5H22Z' /%3E%3C/svg%3E");
666
+ }
600
667
  `;
601
- var Rt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, v = (r, t, e, i) => {
602
- for (var s = i > 1 ? void 0 : i ? It(t, e) : t, o = r.length - 1, n; o >= 0; o--)
603
- (n = r[o]) && (s = (i ? n(t, e, s) : n(s)) || s);
604
- return i && s && Rt(t, e, s), s;
605
- };
606
- let _ = class extends P {
668
+ var v, P;
669
+ class Tt extends S {
607
670
  constructor() {
608
- super(...arguments);
609
- p(this, "_layerId");
610
- p(this, "_eoxMap");
611
- p(this, "_olMap");
612
- p(this, "_drawLayer");
613
- p(this, "_drawnFeatures", []);
614
- p(this, "_currentlyDrawing");
615
- p(this, "multipleFeatures");
616
- p(this, "for");
617
- p(this, "layer");
618
- p(this, "unstyled");
619
- p(this, "_draw");
620
- p(this, "_modify");
621
- }
622
- _startDrawing() {
623
- this._eoxMap.addDraw(this._layerId, {
671
+ super();
672
+ /**
673
+ * @type import("../../map/main").EOxMap
674
+ */
675
+ L(this, v, void 0);
676
+ /**
677
+ * @type import("ol").Map
678
+ */
679
+ L(this, P, void 0);
680
+ 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.unstyled = !1;
681
+ }
682
+ static get properties() {
683
+ return {
684
+ for: { type: String },
685
+ currentlyDrawing: { attribute: !1, state: !0, type: Boolean },
686
+ draw: { attribute: !1, state: !0 },
687
+ drawLayer: { attribute: !1, state: !0 },
688
+ drawnFeatures: { attribute: !1, state: !0, type: Array },
689
+ layer: { type: String },
690
+ modify: { attribute: !1, state: !0 },
691
+ multipleFeatures: { attribute: "multiple-features", type: Boolean },
692
+ unstyled: { type: Boolean }
693
+ };
694
+ }
695
+ startDrawing() {
696
+ var e, i;
697
+ g(this, v).addDraw(this.layer, {
624
698
  id: "drawInteraction",
625
- type: "Polygon"
626
- }), this._draw = this._eoxMap.interactions.drawInteraction, this._modify = this._eoxMap.interactions.drawInteraction_modify, this._draw.on("drawend", (t) => this._onDrawEnd(t)), this._modify.on("modifyend", (t) => this._onModifyEnd(t)), this._currentlyDrawing = !0, this.requestUpdate();
627
- }
628
- _discardDrawing() {
629
- this._drawnFeatures = [], this._eoxMap.removeInteraction("drawInteraction"), this._drawLayer.getSource().clear(), this._currentlyDrawing = !1, this.requestUpdate();
630
- }
631
- _onDrawEnd(t) {
632
- console.log(t), this._emitDrawnFeatures(), this._eoxMap.removeInteraction("drawInteraction"), this._currentlyDrawing = !1, this.requestUpdate();
633
- }
634
- _onModifyEnd(t) {
635
- console.log(t), this._emitDrawnFeatures();
636
- }
637
- _emitDrawnFeatures() {
699
+ type: "Polygon",
700
+ stopClick: !0
701
+ }), this.draw = /** @type {import("ol/interaction").Draw} */
702
+ /** @type {unknown} */
703
+ g(this, v).interactions.drawInteraction, this.modify = /** @type {import("ol/interaction").Modify} */
704
+ /** @type {unknown} */
705
+ g(this, v).interactions.drawInteractionmodify, (e = this.draw) == null || e.on("drawend", (s) => this.onDrawEnd(s)), (i = this.modify) == null || i.on("modifyend", (s) => this.onModifyEnd(s)), this.currentlyDrawing = !0, this.requestUpdate();
706
+ }
707
+ discardDrawing() {
708
+ this.drawnFeatures = [], g(this, v).removeInteraction("drawInteraction"), this.drawLayer.getSource().clear(), this.currentlyDrawing = !1, this.requestUpdate();
709
+ }
710
+ /**
711
+ *
712
+ * @param {import("ol/interaction/Draw").DrawEvent} evt
713
+ */
714
+ onDrawEnd(e) {
715
+ console.log(e.target), this.emitDrawnFeatures(), g(this, v).removeInteraction("drawInteraction"), this.currentlyDrawing = !1, this.requestUpdate();
716
+ }
717
+ /**
718
+ *
719
+ * @param {import("ol/interaction/Modify").ModifyEvent} evt
720
+ */
721
+ onModifyEnd(e) {
722
+ console.log(e), this.emitDrawnFeatures();
723
+ }
724
+ emitDrawnFeatures() {
638
725
  setTimeout(() => {
639
- this._drawnFeatures = this._drawLayer.getSource().getFeatures(), this.requestUpdate();
640
- const t = new CustomEvent("drawupdate", {
641
- detail: this._drawnFeatures
726
+ this.drawnFeatures = this.drawLayer.getSource().getFeatures(), this.requestUpdate();
727
+ const e = new CustomEvent("drawupdate", {
728
+ detail: this.drawnFeatures
642
729
  });
643
- this.dispatchEvent(t);
730
+ this.dispatchEvent(e);
644
731
  }, 0);
645
732
  }
646
733
  render() {
647
- const t = document.querySelector(this.for);
648
- return this._eoxMap = t, this._olMap = t.map, this._layerId = this.layer, this._drawLayer = this._olMap.getLayers().getArray().find((e) => e.get("id") === this._layerId), this.requestUpdate(), Et`
734
+ var i, s;
735
+ const e = document.querySelector(this.for);
736
+ return R(
737
+ this,
738
+ v,
739
+ /** @type {import("@eox/map/main").EOxMap} */
740
+ e
741
+ ), R(
742
+ this,
743
+ P,
744
+ /** @type {import("ol").Map} */
745
+ g(this, v).map
746
+ ), this.drawLayer = /** @type {import("ol/layer").Vector<import("ol/source").Vector>} */
747
+ g(this, P).getLayers().getArray().find((n) => n.get("id") === this.layer), this.requestUpdate(), bt`
649
748
  <style>
650
- ${Dt}
651
- ${!this.unstyled && kt}
749
+ ${kt}
750
+ ${!this.unstyled && Dt}
652
751
  </style>
653
752
  <div>
654
753
  <slot></slot>
655
754
  <button
656
- disabled="${!this.multipleFeatures && this._drawnFeatures.length || this._currentlyDrawing || u}"
657
- @click="${() => this._startDrawing()}"
755
+ data-cy="drawBtn"
756
+ class="icon-text polygon"
757
+ disabled="${!this.multipleFeatures && ((i = this.drawnFeatures) == null ? void 0 : i.length) > 0 || this.currentlyDrawing || u}"
758
+ @click="${() => this.startDrawing()}"
658
759
  >
659
- ${this._currentlyDrawing ? "drawing" : "draw"}
760
+ ${this.currentlyDrawing ? "drawing" : "draw"}
660
761
  </button>
661
762
  <button
662
- disabled="${!this._drawnFeatures.length && !this._currentlyDrawing || u}"
663
- @click="${() => this._discardDrawing()}"
763
+ data-cy="discardBtn"
764
+ class="discard"
765
+ disabled="${!((s = this.drawnFeatures) != null && s.length) && !this.currentlyDrawing || u}"
766
+ @click="${() => this.discardDrawing()}"
664
767
  >
665
768
  discard
666
769
  </button>
667
770
  </div>
668
771
  `;
669
772
  }
670
- };
671
- v([
672
- C()
673
- ], _.prototype, "_layerId", 2);
674
- v([
675
- C()
676
- ], _.prototype, "_eoxMap", 2);
677
- v([
678
- C()
679
- ], _.prototype, "_olMap", 2);
680
- v([
681
- C()
682
- ], _.prototype, "_drawLayer", 2);
683
- v([
684
- C()
685
- ], _.prototype, "_drawnFeatures", 2);
686
- v([
687
- C()
688
- ], _.prototype, "_currentlyDrawing", 2);
689
- v([
690
- O({ type: Boolean })
691
- ], _.prototype, "multipleFeatures", 2);
692
- v([
693
- O()
694
- ], _.prototype, "for", 2);
695
- v([
696
- O()
697
- ], _.prototype, "layer", 2);
698
- v([
699
- O({ type: Boolean })
700
- ], _.prototype, "unstyled", 2);
701
- _ = v([
702
- Nt("eox-drawtools")
703
- ], _);
773
+ }
774
+ v = new WeakMap(), P = new WeakMap();
775
+ customElements.define("eox-drawtools", Tt);
704
776
  export {
705
- _ as EOxDrawTools
777
+ Tt as EOxDrawTools
706
778
  };