@eox/drawtools 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,32 @@
1
- var yt = Object.defineProperty;
2
- var gt = (r, t, e) => t in r ? yt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var A = (r, t, e) => (gt(r, typeof t != "symbol" ? t + "" : t, e), e), J = (r, t, e) => {
1
+ var _t = Object.defineProperty;
2
+ var xt = (r, t, e) => t in r ? _t(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var b = (r, t, e) => (xt(r, typeof t != "symbol" ? t + "" : t, e), e), Q = (r, t, e) => {
4
4
  if (!t.has(r))
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) => {
7
+ var g = (r, t, e) => (Q(r, t, "read from private field"), e ? e.call(r) : t.get(r)), S = (r, t, e) => {
8
8
  if (t.has(r))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
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);
11
+ }, E = (r, t, e, i) => (Q(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e);
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2019 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const T = globalThis, Z = T.ShadowRoot && (T.ShadyCSS === void 0 || T.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, nt = Symbol(), K = /* @__PURE__ */ new WeakMap();
18
- let ft = class {
19
- constructor(t, e, s) {
20
- if (this._$cssResult$ = !0, s !== nt)
17
+ const D = globalThis, K = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, pt = Symbol(), X = /* @__PURE__ */ new WeakMap();
18
+ let At = class {
19
+ constructor(t, e, i) {
20
+ if (this._$cssResult$ = !0, i !== pt)
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) {
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));
27
+ if (K && t === void 0) {
28
+ const i = e !== void 0 && e.length === 1;
29
+ i && (t = X.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && X.set(e, t));
30
30
  }
31
31
  return t;
32
32
  }
@@ -34,29 +34,29 @@ let ft = class {
34
34
  return this.cssText;
35
35
  }
36
36
  };
37
- const mt = (r) => new ft(typeof r == "string" ? r : r + "", void 0, nt), _t = (r, t) => {
38
- if (Z)
37
+ const St = (r) => new At(typeof r == "string" ? r : r + "", void 0, pt), Et = (r, t) => {
38
+ if (K)
39
39
  r.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 i = document.createElement("style"), s = D.litNonce;
43
+ s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, r.appendChild(i);
44
44
  }
45
- }, G = Z ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
45
+ }, Y = K ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
46
46
  let e = "";
47
- for (const s of t.cssRules)
48
- e += s.cssText;
49
- return mt(e);
47
+ for (const i of t.cssRules)
48
+ e += i.cssText;
49
+ return St(e);
50
50
  })(r) : r;
51
51
  /**
52
52
  * @license
53
53
  * Copyright 2017 Google LLC
54
54
  * SPDX-License-Identifier: BSD-3-Clause
55
55
  */
56
- const { is: wt, defineProperty: bt, getOwnPropertyDescriptor: At, getOwnPropertyNames: vt, getOwnPropertySymbols: xt, getPrototypeOf: Et } = Object, m = globalThis, Q = m.trustedTypes, St = Q ? Q.emptyScript : "", B = m.reactiveElementPolyfillSupport, k = (r, t) => r, W = { toAttribute(r, t) {
56
+ const { is: Ct, defineProperty: Ft, getOwnPropertyDescriptor: Ht, getOwnPropertyNames: kt, getOwnPropertySymbols: Mt, getPrototypeOf: Ut } = Object, $ = globalThis, tt = $.trustedTypes, Pt = tt ? tt.emptyScript : "", q = $.reactiveElementPolyfillSupport, M = (r, t) => r, Z = { toAttribute(r, t) {
57
57
  switch (t) {
58
58
  case Boolean:
59
- r = r ? St : null;
59
+ r = r ? Pt : null;
60
60
  break;
61
61
  case Object:
62
62
  case Array:
@@ -81,154 +81,154 @@ const { is: wt, defineProperty: bt, getOwnPropertyDescriptor: At, getOwnProperty
81
81
  }
82
82
  }
83
83
  return e;
84
- } }, at = (r, t) => !wt(r, t), X = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: at };
85
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), m.litPropertyMetadata ?? (m.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
86
- class v extends HTMLElement {
84
+ } }, ut = (r, t) => !Ct(r, t), et = { attribute: !0, type: String, converter: Z, reflect: !1, hasChanged: ut };
85
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), $.litPropertyMetadata ?? ($.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
86
+ class C extends HTMLElement {
87
87
  static addInitializer(t) {
88
88
  this._$Ei(), (this.l ?? (this.l = [])).push(t);
89
89
  }
90
90
  static get observedAttributes() {
91
91
  return this.finalize(), this._$Eh && [...this._$Eh.keys()];
92
92
  }
93
- static createProperty(t, e = X) {
93
+ static createProperty(t, e = et) {
94
94
  if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
95
- const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
96
- i !== void 0 && bt(this.prototype, t, i);
95
+ const i = Symbol(), s = this.getPropertyDescriptor(t, i, e);
96
+ s !== void 0 && Ft(this.prototype, t, s);
97
97
  }
98
98
  }
99
- static getPropertyDescriptor(t, e, s) {
100
- const { get: i, set: n } = At(this.prototype, t) ?? { get() {
99
+ static getPropertyDescriptor(t, e, i) {
100
+ const { get: s, set: n } = Ht(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 s == null ? void 0 : s.call(this);
107
107
  }, set(o) {
108
- const d = i == null ? void 0 : i.call(this);
109
- n.call(this, o), this.requestUpdate(t, d, s);
108
+ const l = s == null ? void 0 : s.call(this);
109
+ n.call(this, o), this.requestUpdate(t, l, i);
110
110
  }, configurable: !0, enumerable: !0 };
111
111
  }
112
112
  static getPropertyOptions(t) {
113
- return this.elementProperties.get(t) ?? X;
113
+ return this.elementProperties.get(t) ?? et;
114
114
  }
115
115
  static _$Ei() {
116
- if (this.hasOwnProperty(k("elementProperties")))
116
+ if (this.hasOwnProperty(M("elementProperties")))
117
117
  return;
118
- const t = Et(this);
118
+ const t = Ut(this);
119
119
  t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
120
120
  }
121
121
  static finalize() {
122
- if (this.hasOwnProperty(k("finalized")))
122
+ if (this.hasOwnProperty(M("finalized")))
123
123
  return;
124
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(k("properties"))) {
125
- const e = this.properties, s = [...vt(e), ...xt(e)];
126
- for (const i of s)
127
- this.createProperty(i, e[i]);
124
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(M("properties"))) {
125
+ const e = this.properties, i = [...kt(e), ...Mt(e)];
126
+ for (const s of i)
127
+ this.createProperty(s, e[s]);
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 [i, s] of e)
134
+ this.elementProperties.set(i, s);
135
135
  }
136
136
  this._$Eh = /* @__PURE__ */ new Map();
137
- for (const [e, s] of this.elementProperties) {
138
- const i = this._$Eu(e, s);
139
- i !== void 0 && this._$Eh.set(i, e);
137
+ for (const [e, i] of this.elementProperties) {
138
+ const s = this._$Eu(e, i);
139
+ s !== void 0 && this._$Eh.set(s, e);
140
140
  }
141
141
  this.elementStyles = this.finalizeStyles(this.styles);
142
142
  }
143
143
  static finalizeStyles(t) {
144
144
  const e = [];
145
145
  if (Array.isArray(t)) {
146
- const s = new Set(t.flat(1 / 0).reverse());
147
- for (const i of s)
148
- e.unshift(G(i));
146
+ const i = new Set(t.flat(1 / 0).reverse());
147
+ for (const s of i)
148
+ e.unshift(Y(s));
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) {
154
- const s = e.attribute;
155
- return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
154
+ const i = e.attribute;
155
+ return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0;
156
156
  }
157
157
  constructor() {
158
158
  super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
159
159
  }
160
160
  _$Ev() {
161
161
  var t;
162
- this._$Eg = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
162
+ this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
163
163
  }
164
164
  addController(t) {
165
165
  var e;
166
- (this._$ES ?? (this._$ES = [])).push(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
166
+ (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
167
167
  }
168
168
  removeController(t) {
169
169
  var e;
170
- (e = this._$ES) == null || e.splice(this._$ES.indexOf(t) >>> 0, 1);
170
+ (e = this._$EO) == null || e.delete(t);
171
171
  }
172
172
  _$E_() {
173
173
  const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
174
- for (const s of e.keys())
175
- this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
174
+ for (const i of e.keys())
175
+ this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
176
176
  t.size > 0 && (this._$Ep = t);
177
177
  }
178
178
  createRenderRoot() {
179
179
  const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
180
- return _t(t, this.constructor.elementStyles), t;
180
+ return Et(t, this.constructor.elementStyles), t;
181
181
  }
182
182
  connectedCallback() {
183
183
  var t;
184
- this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$ES) == null || t.forEach((e) => {
185
- var s;
186
- return (s = e.hostConnected) == null ? void 0 : s.call(e);
184
+ this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((e) => {
185
+ var i;
186
+ return (i = e.hostConnected) == null ? void 0 : i.call(e);
187
187
  });
188
188
  }
189
189
  enableUpdating(t) {
190
190
  }
191
191
  disconnectedCallback() {
192
192
  var t;
193
- (t = this._$ES) == null || t.forEach((e) => {
194
- var s;
195
- return (s = e.hostDisconnected) == null ? void 0 : s.call(e);
193
+ (t = this._$EO) == null || t.forEach((e) => {
194
+ var i;
195
+ return (i = e.hostDisconnected) == null ? void 0 : i.call(e);
196
196
  });
197
197
  }
198
- attributeChangedCallback(t, e, s) {
199
- this._$AK(t, s);
198
+ attributeChangedCallback(t, e, i) {
199
+ this._$AK(t, i);
200
200
  }
201
- _$EO(t, e) {
201
+ _$EC(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 i = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, i);
204
+ if (s !== void 0 && i.reflect === !0) {
205
+ const o = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : Z).toAttribute(e, i.type);
206
+ this._$Em = t, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
207
207
  }
208
208
  }
209
209
  _$AK(t, e) {
210
210
  var n;
211
- const s = this.constructor, i = s._$Eh.get(t);
212
- if (i !== void 0 && this._$Em !== i) {
213
- const o = s.getPropertyOptions(i), d = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : W;
214
- this._$Em = i, this[i] = d.fromAttribute(e, o.type), this._$Em = null;
211
+ const i = this.constructor, s = i._$Eh.get(t);
212
+ if (s !== void 0 && this._$Em !== s) {
213
+ const o = i.getPropertyOptions(s), l = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : Z;
214
+ this._$Em = s, this[s] = l.fromAttribute(e, o.type), this._$Em = null;
215
215
  }
216
216
  }
217
- requestUpdate(t, e, s, i = !1, n) {
217
+ requestUpdate(t, e, i) {
218
218
  if (t !== void 0) {
219
- if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? at)(i ? n : this[t], e))
219
+ if (i ?? (i = this.constructor.getPropertyOptions(t)), !(i.hasChanged ?? ut)(this[t], e))
220
220
  return;
221
- this.C(t, e, s);
221
+ this.P(t, e, i);
222
222
  }
223
- this.isUpdatePending === !1 && (this._$Eg = this._$EP());
223
+ this.isUpdatePending === !1 && (this._$ES = this._$ET());
224
224
  }
225
- C(t, e, s) {
226
- this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$Em !== t && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t);
225
+ P(t, e, i) {
226
+ this._$AL.has(t) || this._$AL.set(t, e), i.reflect === !0 && this._$Em !== t && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t);
227
227
  }
228
- async _$EP() {
228
+ async _$ET() {
229
229
  this.isUpdatePending = !0;
230
230
  try {
231
- await this._$Eg;
231
+ await this._$ES;
232
232
  } catch (e) {
233
233
  Promise.reject(e);
234
234
  }
@@ -239,29 +239,29 @@ class v extends HTMLElement {
239
239
  return this.performUpdate();
240
240
  }
241
241
  performUpdate() {
242
- var s;
242
+ var i;
243
243
  if (!this.isUpdatePending)
244
244
  return;
245
245
  if (!this.hasUpdated) {
246
- if (this._$Ep) {
246
+ if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
247
247
  for (const [n, o] of this._$Ep)
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)
254
- o.wrapped !== !0 || this._$AL.has(n) || this[n] === void 0 || this.C(n, this[n], o);
251
+ const s = this.constructor.elementProperties;
252
+ if (s.size > 0)
253
+ for (const [n, o] of s)
254
+ o.wrapped !== !0 || this._$AL.has(n) || this[n] === void 0 || this.P(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), (i = this._$EO) == null || i.forEach((s) => {
260
260
  var n;
261
- return (n = i.hostUpdate) == null ? void 0 : n.call(i);
262
- }), this.update(e)) : this._$ET();
263
- } catch (i) {
264
- throw t = !1, this._$ET(), i;
261
+ return (n = s.hostUpdate) == null ? void 0 : n.call(s);
262
+ }), this.update(e)) : this._$EU();
263
+ } catch (s) {
264
+ throw t = !1, this._$EU(), s;
265
265
  }
266
266
  t && this._$AE(e);
267
267
  }
@@ -269,111 +269,111 @@ class v extends HTMLElement {
269
269
  }
270
270
  _$AE(t) {
271
271
  var e;
272
- (e = this._$ES) == null || e.forEach((s) => {
273
- var i;
274
- return (i = s.hostUpdated) == null ? void 0 : i.call(s);
272
+ (e = this._$EO) == null || e.forEach((i) => {
273
+ var s;
274
+ return (s = i.hostUpdated) == null ? void 0 : s.call(i);
275
275
  }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
276
276
  }
277
- _$ET() {
277
+ _$EU() {
278
278
  this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
279
279
  }
280
280
  get updateComplete() {
281
281
  return this.getUpdateComplete();
282
282
  }
283
283
  getUpdateComplete() {
284
- return this._$Eg;
284
+ return this._$ES;
285
285
  }
286
286
  shouldUpdate(t) {
287
287
  return !0;
288
288
  }
289
289
  update(t) {
290
- this._$Ej && (this._$Ej = this._$Ej.forEach((e) => this._$EO(e, this[e]))), this._$ET();
290
+ this._$Ej && (this._$Ej = this._$Ej.forEach((e) => this._$EC(e, this[e]))), this._$EU();
291
291
  }
292
292
  updated(t) {
293
293
  }
294
294
  firstUpdated(t) {
295
295
  }
296
296
  }
297
- v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[k("elementProperties")] = /* @__PURE__ */ new Map(), v[k("finalized")] = /* @__PURE__ */ new Map(), B == null || B({ ReactiveElement: v }), (m.reactiveElementVersions ?? (m.reactiveElementVersions = [])).push("2.0.1");
297
+ C.elementStyles = [], C.shadowRootOptions = { mode: "open" }, C[M("elementProperties")] = /* @__PURE__ */ new Map(), C[M("finalized")] = /* @__PURE__ */ new Map(), q == null || q({ ReactiveElement: C }), ($.reactiveElementVersions ?? ($.reactiveElementVersions = [])).push("2.0.4");
298
298
  /**
299
299
  * @license
300
300
  * Copyright 2017 Google LLC
301
301
  * SPDX-License-Identifier: BSD-3-Clause
302
302
  */
303
- const M = globalThis, O = M.trustedTypes, Y = O ? O.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ht = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, lt = "?" + f, Ct = `<${lt}>`, b = document, U = () => b.createComment(""), P = (r) => r === null || typeof r != "object" && typeof r != "function", dt = Array.isArray, Ht = (r) => dt(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", z = `[
304
- \f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, tt = /-->/g, et = />/g, _ = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
305
- \f\r"'\`<>=]|("|')|))|$)`, "g"), st = /'/g, it = /"/g, ct = /^(?:script|style|textarea|title)$/i, kt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), F = kt(1), S = Symbol.for("lit-noChange"), l = Symbol.for("lit-nothing"), rt = /* @__PURE__ */ new WeakMap(), w = b.createTreeWalker(b, 129);
306
- function pt(r, t) {
303
+ const U = globalThis, j = U.trustedTypes, rt = j ? j.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, gt = "$lit$", f = `lit$${(Math.random() + "").slice(9)}$`, yt = "?" + f, Ot = `<${yt}>`, A = document, P = () => A.createComment(""), O = (r) => r === null || typeof r != "object" && typeof r != "function", ft = Array.isArray, Nt = (r) => ft(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", T = `[
304
+ \f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, it = /-->/g, st = />/g, v = RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^
305
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), nt = /'/g, ot = /"/g, mt = /^(?:script|style|textarea|title)$/i, It = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), _ = It(1), F = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), at = /* @__PURE__ */ new WeakMap(), w = A.createTreeWalker(A, 129);
306
+ function $t(r, t) {
307
307
  if (!Array.isArray(r) || !r.hasOwnProperty("raw"))
308
308
  throw Error("invalid template strings array");
309
- return Y !== void 0 ? Y.createHTML(t) : t;
309
+ return rt !== void 0 ? rt.createHTML(t) : t;
310
310
  }
311
- const Mt = (r, t) => {
312
- const e = r.length - 1, s = [];
313
- let i, n = t === 2 ? "<svg>" : "", o = H;
314
- for (let d = 0; d < e; d++) {
315
- const a = r[d];
316
- let c, p, h = -1, y = 0;
317
- for (; y < a.length && (o.lastIndex = y, p = o.exec(a), p !== null); )
318
- y = o.lastIndex, o === H ? p[1] === "!--" ? o = tt : p[1] !== void 0 ? o = et : p[2] !== void 0 ? (ct.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = _) : p[3] !== void 0 && (o = _) : o === _ ? p[0] === ">" ? (o = i ?? H, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, c = p[1], o = p[3] === void 0 ? _ : p[3] === '"' ? it : st) : o === it || o === st ? o = _ : o === tt || o === et ? o = H : (o = _, i = void 0);
319
- const g = o === _ && r[d + 1].startsWith("/>") ? " " : "";
320
- n += o === H ? a + Ct : h >= 0 ? (s.push(c), a.slice(0, h) + ht + a.slice(h) + f + g) : a + f + (h === -2 ? d : g);
321
- }
322
- return [pt(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), s];
311
+ const Bt = (r, t) => {
312
+ const e = r.length - 1, i = [];
313
+ let s, n = t === 2 ? "<svg>" : "", o = k;
314
+ for (let l = 0; l < e; l++) {
315
+ const a = r[l];
316
+ let h, p, c = -1, u = 0;
317
+ for (; u < a.length && (o.lastIndex = u, p = o.exec(a), p !== null); )
318
+ u = o.lastIndex, o === k ? p[1] === "!--" ? o = it : p[1] !== void 0 ? o = st : p[2] !== void 0 ? (mt.test(p[2]) && (s = RegExp("</" + p[2], "g")), o = v) : p[3] !== void 0 && (o = v) : o === v ? p[0] === ">" ? (o = s ?? k, c = -1) : p[1] === void 0 ? c = -2 : (c = o.lastIndex - p[2].length, h = p[1], o = p[3] === void 0 ? v : p[3] === '"' ? ot : nt) : o === ot || o === nt ? o = v : o === it || o === st ? o = k : (o = v, s = void 0);
319
+ const y = o === v && r[l + 1].startsWith("/>") ? " " : "";
320
+ n += o === k ? a + Ot : c >= 0 ? (i.push(h), a.slice(0, c) + gt + a.slice(c) + f + y) : a + f + (c === -2 ? l : y);
321
+ }
322
+ return [$t(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), i];
323
323
  };
324
- class I {
325
- constructor({ strings: t, _$litType$: e }, s) {
326
- let i;
324
+ class N {
325
+ constructor({ strings: t, _$litType$: e }, i) {
326
+ let s;
327
327
  this.parts = [];
328
328
  let n = 0, o = 0;
329
- const d = t.length - 1, a = this.parts, [c, p] = Mt(t, e);
330
- if (this.el = I.createElement(c, s), w.currentNode = this.el.content, e === 2) {
331
- const h = this.el.content.firstChild;
332
- h.replaceWith(...h.childNodes);
329
+ const l = t.length - 1, a = this.parts, [h, p] = Bt(t, e);
330
+ if (this.el = N.createElement(h, i), w.currentNode = this.el.content, e === 2) {
331
+ const c = this.el.content.firstChild;
332
+ c.replaceWith(...c.childNodes);
333
333
  }
334
- for (; (i = w.nextNode()) !== null && a.length < d; ) {
335
- if (i.nodeType === 1) {
336
- if (i.hasAttributes())
337
- for (const h of i.getAttributeNames())
338
- if (h.endsWith(ht)) {
339
- const y = p[o++], g = i.getAttribute(h).split(f), D = /([.?@])?(.*)/.exec(y);
340
- a.push({ type: 1, index: n, name: D[2], strings: g, ctor: D[1] === "." ? Pt : D[1] === "?" ? It : D[1] === "@" ? Lt : N }), i.removeAttribute(h);
334
+ for (; (s = w.nextNode()) !== null && a.length < l; ) {
335
+ if (s.nodeType === 1) {
336
+ if (s.hasAttributes())
337
+ for (const c of s.getAttributeNames())
338
+ if (c.endsWith(gt)) {
339
+ const u = p[o++], y = s.getAttribute(c).split(f), z = /([.?@])?(.*)/.exec(u);
340
+ a.push({ type: 1, index: n, name: z[2], strings: y, ctor: z[1] === "." ? Rt : z[1] === "?" ? Vt : z[1] === "@" ? zt : J }), s.removeAttribute(c);
341
341
  } else
342
- h.startsWith(f) && (a.push({ type: 6, index: n }), i.removeAttribute(h));
343
- if (ct.test(i.tagName)) {
344
- const h = i.textContent.split(f), y = h.length - 1;
345
- if (y > 0) {
346
- i.textContent = O ? O.emptyScript : "";
347
- for (let g = 0; g < y; g++)
348
- i.append(h[g], U()), w.nextNode(), a.push({ type: 2, index: ++n });
349
- i.append(h[y], U());
342
+ c.startsWith(f) && (a.push({ type: 6, index: n }), s.removeAttribute(c));
343
+ if (mt.test(s.tagName)) {
344
+ const c = s.textContent.split(f), u = c.length - 1;
345
+ if (u > 0) {
346
+ s.textContent = j ? j.emptyScript : "";
347
+ for (let y = 0; y < u; y++)
348
+ s.append(c[y], P()), w.nextNode(), a.push({ type: 2, index: ++n });
349
+ s.append(c[u], P());
350
350
  }
351
351
  }
352
- } else if (i.nodeType === 8)
353
- if (i.data === lt)
352
+ } else if (s.nodeType === 8)
353
+ if (s.data === yt)
354
354
  a.push({ type: 2, index: n });
355
355
  else {
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;
356
+ let c = -1;
357
+ for (; (c = s.data.indexOf(f, c + 1)) !== -1; )
358
+ a.push({ type: 7, index: n }), c += f.length - 1;
359
359
  }
360
360
  n++;
361
361
  }
362
362
  }
363
363
  static createElement(t, e) {
364
- const s = b.createElement("template");
365
- return s.innerHTML = t, s;
364
+ const i = A.createElement("template");
365
+ return i.innerHTML = t, i;
366
366
  }
367
367
  }
368
- function C(r, t, e = r, s) {
369
- var o, d;
370
- if (t === S)
368
+ function H(r, t, e = r, i) {
369
+ var o, l;
370
+ if (t === F)
371
371
  return t;
372
- let i = s !== void 0 ? (o = e._$Co) == null ? void 0 : o[s] : e._$Cl;
373
- const n = P(t) ? void 0 : t._$litDirective$;
374
- return (i == null ? void 0 : i.constructor) !== n && ((d = i == null ? void 0 : i._$AO) == null || d.call(i, !1), n === void 0 ? i = void 0 : (i = new n(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = C(r, i._$AS(r, t.values), i, s)), t;
372
+ let s = i !== void 0 ? (o = e._$Co) == null ? void 0 : o[i] : e._$Cl;
373
+ const n = O(t) ? void 0 : t._$litDirective$;
374
+ return (s == null ? void 0 : s.constructor) !== n && ((l = s == null ? void 0 : s._$AO) == null || l.call(s, !1), n === void 0 ? s = void 0 : (s = new n(r), s._$AT(r, e, i)), i !== void 0 ? (e._$Co ?? (e._$Co = []))[i] = s : e._$Cl = s), s !== void 0 && (t = H(r, s._$AS(r, t.values), s, i)), 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,31 +384,31 @@ class Ut {
384
384
  return this._$AM._$AU;
385
385
  }
386
386
  u(t) {
387
- const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? b).importNode(e, !0);
388
- w.currentNode = i;
389
- let n = w.nextNode(), o = 0, d = 0, a = s[0];
387
+ const { el: { content: e }, parts: i } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? A).importNode(e, !0);
388
+ w.currentNode = s;
389
+ let n = w.nextNode(), o = 0, l = 0, a = i[0];
390
390
  for (; a !== void 0; ) {
391
391
  if (o === a.index) {
392
- let c;
393
- a.type === 2 ? c = new L(n, n.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (c = new Dt(n, this, t)), this._$AV.push(c), a = s[++d];
392
+ let h;
393
+ a.type === 2 ? h = new V(n, n.nextSibling, this, t) : a.type === 1 ? h = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (h = new Dt(n, this, t)), this._$AV.push(h), a = i[++l];
394
394
  }
395
395
  o !== (a == null ? void 0 : a.index) && (n = w.nextNode(), o++);
396
396
  }
397
- return w.currentNode = b, i;
397
+ return w.currentNode = A, s;
398
398
  }
399
399
  p(t) {
400
400
  let e = 0;
401
- for (const s of this._$AV)
402
- s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
401
+ for (const i of this._$AV)
402
+ i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
403
403
  }
404
404
  }
405
- class L {
405
+ class V {
406
406
  get _$AU() {
407
407
  var t;
408
408
  return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
409
409
  }
410
- constructor(t, e, s, i) {
411
- this.type = 2, this._$AH = l, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
410
+ constructor(t, e, i, s) {
411
+ this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
412
412
  }
413
413
  get parentNode() {
414
414
  let t = this._$AA.parentNode;
@@ -422,44 +422,44 @@ class L {
422
422
  return this._$AB;
423
423
  }
424
424
  _$AI(t, e = this) {
425
- t = C(this, t, e), P(t) ? t === l || t == null || t === "" ? (this._$AH !== l && this._$AR(), this._$AH = l) : t !== this._$AH && t !== S && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : Ht(t) ? this.T(t) : this._(t);
425
+ t = H(this, t, e), O(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== F && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Nt(t) ? this.k(t) : this._(t);
426
426
  }
427
- k(t) {
427
+ S(t) {
428
428
  return this._$AA.parentNode.insertBefore(t, this._$AB);
429
429
  }
430
- $(t) {
431
- this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
430
+ T(t) {
431
+ this._$AH !== t && (this._$AR(), this._$AH = this.S(t));
432
432
  }
433
433
  _(t) {
434
- this._$AH !== l && P(this._$AH) ? this._$AA.nextSibling.data = t : this.$(b.createTextNode(t)), this._$AH = t;
434
+ this._$AH !== d && O(this._$AH) ? this._$AA.nextSibling.data = t : this.T(A.createTextNode(t)), this._$AH = t;
435
435
  }
436
- g(t) {
436
+ $(t) {
437
437
  var n;
438
- const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = I.createElement(pt(s.h, s.h[0]), this.options)), s);
439
- if (((n = this._$AH) == null ? void 0 : n._$AD) === i)
438
+ const { values: e, _$litType$: i } = t, s = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = N.createElement($t(i.h, i.h[0]), this.options)), i);
439
+ if (((n = this._$AH) == null ? void 0 : n._$AD) === s)
440
440
  this._$AH.p(e);
441
441
  else {
442
- const o = new Ut(i, this), d = o.u(this.options);
443
- o.p(e), this.$(d), this._$AH = o;
442
+ const o = new Lt(s, this), l = o.u(this.options);
443
+ o.p(e), this.T(l), this._$AH = o;
444
444
  }
445
445
  }
446
446
  _$AC(t) {
447
- let e = rt.get(t.strings);
448
- return e === void 0 && rt.set(t.strings, e = new I(t)), e;
447
+ let e = at.get(t.strings);
448
+ return e === void 0 && at.set(t.strings, e = new N(t)), e;
449
449
  }
450
- T(t) {
451
- dt(this._$AH) || (this._$AH = [], this._$AR());
450
+ k(t) {
451
+ ft(this._$AH) || (this._$AH = [], this._$AR());
452
452
  const e = this._$AH;
453
- let s, i = 0;
453
+ let i, s = 0;
454
454
  for (const n of t)
455
- i === e.length ? e.push(s = new L(this.k(U()), this.k(U()), this, this.options)) : s = e[i], s._$AI(n), i++;
456
- i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
455
+ s === e.length ? e.push(i = new V(this.S(P()), this.S(P()), this, this.options)) : i = e[s], i._$AI(n), s++;
456
+ s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
457
457
  }
458
458
  _$AR(t = this._$AA.nextSibling, e) {
459
- var s;
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;
459
+ var i;
460
+ for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, e); t && t !== this._$AB; ) {
461
+ const s = t.nextSibling;
462
+ t.remove(), t = s;
463
463
  }
464
464
  }
465
465
  setConnected(t) {
@@ -467,58 +467,58 @@ class L {
467
467
  this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
468
468
  }
469
469
  }
470
- class N {
470
+ class J {
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, i, s, n) {
478
+ this.type = 1, this._$AH = d, 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 = d;
479
479
  }
480
- _$AI(t, e = this, s, i) {
480
+ _$AI(t, e = this, i, s) {
481
481
  const n = this.strings;
482
482
  let o = !1;
483
483
  if (n === void 0)
484
- t = C(this, t, e, 0), o = !P(t) || t !== this._$AH && t !== S, o && (this._$AH = t);
484
+ t = H(this, t, e, 0), o = !O(t) || t !== this._$AH && t !== F, o && (this._$AH = t);
485
485
  else {
486
- const d = t;
487
- let a, c;
486
+ const l = t;
487
+ let a, h;
488
488
  for (t = n[0], a = 0; a < n.length - 1; a++)
489
- c = C(this, d[s + a], e, a), c === S && (c = this._$AH[a]), o || (o = !P(c) || c !== this._$AH[a]), c === l ? t = l : t !== l && (t += (c ?? "") + n[a + 1]), this._$AH[a] = c;
489
+ h = H(this, l[i + a], e, a), h === F && (h = this._$AH[a]), o || (o = !O(h) || h !== this._$AH[a]), h === d ? t = d : t !== d && (t += (h ?? "") + n[a + 1]), this._$AH[a] = h;
490
490
  }
491
- o && !i && this.O(t);
491
+ o && !s && this.j(t);
492
492
  }
493
- O(t) {
494
- t === l ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
493
+ j(t) {
494
+ t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
495
495
  }
496
496
  }
497
- class Pt extends N {
497
+ class Rt extends J {
498
498
  constructor() {
499
499
  super(...arguments), this.type = 3;
500
500
  }
501
- O(t) {
502
- this.element[this.name] = t === l ? void 0 : t;
501
+ j(t) {
502
+ this.element[this.name] = t === d ? void 0 : t;
503
503
  }
504
504
  }
505
- class It extends N {
505
+ class Vt extends J {
506
506
  constructor() {
507
507
  super(...arguments), this.type = 4;
508
508
  }
509
- O(t) {
510
- this.element.toggleAttribute(this.name, !!t && t !== l);
509
+ j(t) {
510
+ this.element.toggleAttribute(this.name, !!t && t !== d);
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 zt extends J {
514
+ constructor(t, e, i, s, n) {
515
+ super(t, e, i, s, 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 = H(this, t, e, 0) ?? d) === F)
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 i = this._$AH, s = t === d && i !== d || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, n = t !== d && (i === d || s);
521
+ s && this.element.removeEventListener(this.name, this, i), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
522
522
  }
523
523
  handleEvent(t) {
524
524
  var e;
@@ -526,33 +526,33 @@ class Lt extends N {
526
526
  }
527
527
  }
528
528
  class Dt {
529
- constructor(t, e, s) {
530
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
529
+ constructor(t, e, i) {
530
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
531
531
  }
532
532
  get _$AU() {
533
533
  return this._$AM._$AU;
534
534
  }
535
535
  _$AI(t) {
536
- C(this, t);
536
+ H(this, t);
537
537
  }
538
538
  }
539
- const q = M.litHtmlPolyfillSupport;
540
- q == null || q(I, L), (M.litHtmlVersions ?? (M.litHtmlVersions = [])).push("3.1.0");
541
- const Tt = (r, t, e) => {
542
- const s = (e == null ? void 0 : e.renderBefore) ?? t;
543
- let i = s._$litPart$;
544
- if (i === void 0) {
539
+ const G = U.litHtmlPolyfillSupport;
540
+ G == null || G(N, V), (U.litHtmlVersions ?? (U.litHtmlVersions = [])).push("3.1.2");
541
+ const jt = (r, t, e) => {
542
+ const i = (e == null ? void 0 : e.renderBefore) ?? t;
543
+ let s = i._$litPart$;
544
+ if (s === void 0) {
545
545
  const n = (e == null ? void 0 : e.renderBefore) ?? null;
546
- s._$litPart$ = i = new L(t.insertBefore(U(), n), n, void 0, e ?? {});
546
+ i._$litPart$ = s = new V(t.insertBefore(P(), n), n, void 0, e ?? {});
547
547
  }
548
- return i._$AI(r), i;
548
+ return s._$AI(r), s;
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 x extends C {
556
556
  constructor() {
557
557
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
558
558
  }
@@ -563,7 +563,7 @@ class x extends v {
563
563
  }
564
564
  update(t) {
565
565
  const e = this.render();
566
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Tt(e, this.renderRoot, this.renderOptions);
566
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = jt(e, this.renderRoot, this.renderOptions);
567
567
  }
568
568
  connectedCallback() {
569
569
  var t;
@@ -574,28 +574,28 @@ 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 F;
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 });
584
- (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.1");
580
+ var dt;
581
+ x._$litElement$ = !0, x.finalized = !0, (dt = globalThis.litElementHydrateSupport) == null || dt.call(globalThis, { LitElement: x });
582
+ const W = globalThis.litElementPolyfillSupport;
583
+ W == null || W({ LitElement: x });
584
+ (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.4");
585
585
  /**
586
586
  * @license
587
587
  * Copyright 2017 Google LLC
588
588
  * SPDX-License-Identifier: BSD-3-Clause
589
589
  */
590
- const Ot = (r) => (...t) => ({ _$litDirective$: r, values: t });
591
- let Ft = class {
590
+ const Jt = (r) => (...t) => ({ _$litDirective$: r, values: t });
591
+ let qt = class {
592
592
  constructor(t) {
593
593
  }
594
594
  get _$AU() {
595
595
  return this._$AM._$AU;
596
596
  }
597
- _$AT(t, e, s) {
598
- this._$Ct = t, this._$AM = e, this._$Ci = s;
597
+ _$AT(t, e, i) {
598
+ this._$Ct = t, this._$AM = e, this._$Ci = i;
599
599
  }
600
600
  _$AS(t, e) {
601
601
  return this.update(t, e);
@@ -609,275 +609,142 @@ let Ft = class {
609
609
  * Copyright 2020 Google LLC
610
610
  * SPDX-License-Identifier: BSD-3-Clause
611
611
  */
612
- const Nt = {}, Vt = (r, t = Nt) => r._$AH = t;
612
+ const Tt = {}, Gt = (r, t = Tt) => r._$AH = t;
613
613
  /**
614
614
  * @license
615
615
  * Copyright 2021 Google LLC
616
616
  * SPDX-License-Identifier: BSD-3-Clause
617
617
  */
618
- const Rt = Ot(class extends Ft {
618
+ const Wt = Jt(class extends qt {
619
619
  constructor() {
620
- super(...arguments), this.key = l;
620
+ super(...arguments), this.key = d;
621
621
  }
622
622
  render(r, t) {
623
623
  return this.key = r, t;
624
624
  }
625
625
  update(r, [t, e]) {
626
- return t !== this.key && (Vt(r), this.key = t), e;
627
- }
628
- }), Bt = `
629
- button {
630
- /* TODO: why does this only work here and not from :root? */
631
- --primary-color: #004170;
632
- --primary-color-hover: #004170CC;
633
- --error-color: #FF5252;
634
-
635
- display: inline-flex;
636
- position: relative;
637
- align-items: center;
638
- color: #fff;
639
- border-width: 0;
640
- outline: none;
641
- border-radius: 4px;
642
- padding: 16px;
643
- height: 36px;
644
- cursor: pointer;
645
- font-family: inherit;
646
- font-size: 0.875rem;
647
- text-transform: uppercase;
648
- letter-spacing: 1.25px;
649
- font-weight: 500;
650
- 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);
651
- transition-property: box-shadow, transform, opacity, background;
652
- transition-duration: 0.28s;
653
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
654
- }
655
-
656
- button:hover:not([disabled]):not(.icon) {
657
- 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);
658
- background: var(--primary-color-hover);
659
- }
660
-
661
- button, button:active {
662
- background: var(--primary-color);
663
- }
664
-
665
- button[disabled] {
666
- opacity: 0.5;
667
- }
668
-
669
- button.outline {
670
- background: transparent;
671
- box-shadow: none;
672
- color: var(--primary-color);
673
- outline: 1px solid var(--primary-color);
674
- }
675
-
676
- button.outline:hover {
677
- background: transparent;
678
- }
679
-
680
- button.icon {
681
- background: transparent;
682
- border: none;
683
- box-shadow: none;
684
- padding: 0;
685
- border-radius: 50%;
686
- width: 24px;
687
- height: 24px;
688
- text-indent: -9999px;
689
- }
690
-
691
- button.icon-text {
692
- text-indent: 26px;
693
- }
694
-
695
- button.icon:before, button.icon-text:before {
696
- position: absolute;
697
- text-indent: 0;
698
- line-height: initial;
699
- }
700
-
701
- button.icon:before {
702
- width: 24px;
703
- height: 24px;
704
- margin-right: 0;
705
- }
706
-
707
- button.icon-text:before {
708
- width: 18px;
709
- height: 18px;
710
- }
711
-
712
- button.small {
713
- height: 28px;
714
- padding: 12.4px;
715
- font-size: .75rem;
716
- }
717
- `, ut = `
718
- * {
719
- font-family: Roboto, sans-serif;
720
- }
721
-
722
- ${Bt}
723
-
724
- button.discard:before {
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")
726
- }
727
-
728
- button.polygon:before {
729
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' 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");
730
- }
731
- ul {
732
- padding: 0;
733
- }
734
- ul ul {
735
- padding-left: 48px;
736
- }
737
- li:hover {
738
- background: #f0f5f9;
739
- }
740
- li.selected {
741
- background: #f0f5f9;
742
- }
743
- li {
744
- list-style: none;
745
- padding: 4px;
746
- }
747
- li {
748
- border-bottom: 1px solid #0041703a;
749
- }
750
- li:first-child {
751
- border-top: 1px solid #0041703a;
752
- }
753
- li.sortable-chosen {
754
- background: #eeea;
755
- }
756
- li.sortable-drag {
757
- opacity: 0;
758
- }
759
- li.sortable-ghost {
760
- }
761
- button.small.icon, button.small.icon::before {
762
- height: 16px;
763
- width: 16px;
764
- padding: 0px;
765
- }
766
- button.discard.icon {
767
- opacity: .7;
768
- }
769
- button.discard.icon:hover {
770
- opacity: 1;
771
- }
772
- eox-drawtools-list {
773
- width: 100%;
774
- }
775
- .list {
776
- width: 100%;
777
- align-items: center;
778
- justify-content: space-between;
779
- display: flex;
780
- align-items: center;
781
- cursor: pointer;
782
- font-size: small;
783
- gap: 10px;
784
-
785
- }
786
- label {
787
- gap: 10px;
788
- }
789
- label, span {
790
- display: flex;
791
- align-items: center;
792
- cursor: pointer;
793
- font-size: small;
794
- flex-grow: 1;
795
- }
796
- `;
797
- class $t extends x {
626
+ return t !== this.key && (Gt(r), this.key = t), e;
627
+ }
628
+ }), Zt = (r) => {
629
+ r.hoverInteraction = r.eoxMap.selectInteractions.selectHover, r.clickInteraction = r.eoxMap.selectInteractions.selectClick;
630
+ const t = () => {
631
+ r.requestUpdate();
632
+ };
633
+ r.hoverInteraction.selectStyleLayer.on(
634
+ "change",
635
+ t
636
+ ), r.clickInteraction.selectStyleLayer.on(
637
+ "change",
638
+ t
639
+ );
640
+ }, Kt = (r, t, e) => {
641
+ if (r.clickId === t)
642
+ return;
643
+ const i = e ? [] : [t];
644
+ r.hoverInteraction.highlightById(i);
645
+ }, Qt = (r, t) => {
646
+ r.stopPropagation();
647
+ const e = Number(r.target.getAttribute("index")), i = t.drawnFeatures[e];
648
+ t.drawLayer.getSource().removeFeature(i), t.drawnFeatures.splice(e, 1), t.requestUpdate();
649
+ }, lt = { duration: 750 }, ct = {
650
+ type: "FeatureCollection",
651
+ features: []
652
+ }, Xt = (r, t) => {
653
+ const e = r.get("id"), { clickId: i, drawLayer: s, olMap: n, clickInteraction: o } = t, l = i === e, a = r.getGeometry();
654
+ if (l) {
655
+ const h = s.getSource().getExtent();
656
+ n.getView().fit(h, lt), o.highlightById([]);
657
+ } else {
658
+ const h = a.getExtent();
659
+ o.highlightById([e]), n.getView().fit(h, lt);
660
+ }
661
+ t.requestUpdate();
662
+ }, Yt = "ul.list-wrap { padding: 0;}ul.list-wrap li:hover,ul.list-wrap li.selected { background: var(--secondary-bg-color-hover);}ul.list-wrap li { list-style: none; padding: 4px;}ul.list-wrap li { border-bottom: 1.2px solid var(--secondary-color);}ul.list-wrap li:first-child { border-top: 1.2px solid var(--secondary-color);}ul.list-wrap li .list { width: 100%; align-items: center; justify-content: space-between; display: flex; align-items: center; cursor: pointer; font-size: small; gap: 10px;}ul.list-wrap li .list span { display: flex; align-items: center; cursor: pointer; font-size: small; flex-grow: 1;}";
663
+ class bt extends x {
798
664
  constructor() {
799
665
  super();
800
666
  /**
801
667
  * @type import("../../../map/src/select").EOxSelectInteraction
802
668
  */
803
- A(this, "hoverInteraction");
669
+ b(this, "hoverInteraction");
804
670
  /**
805
671
  * @type import("../../../map/src/select").EOxSelectInteraction
806
672
  */
807
- A(this, "clickInteraction");
673
+ b(this, "clickInteraction");
808
674
  /**
809
675
  * @type string | number
810
676
  */
811
- A(this, "hoverId");
677
+ b(this, "hoverId");
812
678
  /**
813
679
  * @type string | number
814
680
  */
815
- A(this, "clickId");
816
- this.eoxMap = null, this.olMap = null, this.draw = null, this.layer = "draw", this.drawLayer = null, this.drawnFeatures = [], this.modify = null, this.unstyled = !1;
681
+ b(this, "clickId");
682
+ this.eoxMap = null, this.olMap = null, this.draw = null, this.drawLayer = null, this.drawnFeatures = [], this.modify = null, this.unstyled = !1;
817
683
  }
818
684
  /**
819
- * Delete individual feature @param {any} evt
685
+ * Handles the deletion of an individual feature.
686
+ *
687
+ * @param {Event & { target: HTMLButtonElement }} evt - Event object containing button target.
820
688
  */
821
689
  _handleDelete(e) {
822
- e.stopPropagation();
823
- const s = e.target.getAttribute("index"), i = this.drawnFeatures[s];
824
- this.drawLayer.getSource().removeFeature(i), this.drawnFeatures.splice(s, 1), this.requestUpdate();
690
+ Qt(e, this), this.dispatchEvent(new CustomEvent("changed", { bubbles: !0 }));
825
691
  }
826
692
  /**
827
- * Select and Deselect feature from the list
693
+ * Handles the selection and deselection of a feature from the list.
828
694
  *
829
- * @param {import("ol").Feature} feature
695
+ * @param {import("ol").Feature} feature - The selected feature.
830
696
  */
831
697
  _handleFeatureSelectAndDeselect(e) {
832
- const s = e.get("id");
833
- if (this.clickId === s) {
834
- const i = this.drawLayer.getSource().getExtent();
835
- this.olMap.getView().fit(i, { duration: 750 }), this.clickInteraction.highlightById([]);
836
- } else
837
- this.clickInteraction.highlightById([s]), this.olMap.getView().fit(e.getGeometry().getExtent(), { duration: 750 });
838
- this.requestUpdate();
698
+ Xt(e, this);
699
+ }
700
+ /**
701
+ *
702
+ * @param {Number} featureId - The ID of the feature to hover.
703
+ * @param {Boolean} mouseOut - Flag indicating mouse out event.
704
+ */
705
+ _handleHoverFeature(e, i = !1) {
706
+ Kt(this, e, i);
839
707
  }
708
+ /**
709
+ * Initiates initial settings and event triggers upon the component's first update.
710
+ */
840
711
  firstUpdated() {
841
- this.hoverInteraction = this.eoxMap.selectInteractions.selectHover, this.clickInteraction = this.eoxMap.selectInteractions.selectClick, this.hoverInteraction.selectStyleLayer.on(
842
- "change",
843
- () => this.requestUpdate()
844
- ), this.clickInteraction.selectStyleLayer.on(
845
- "change",
846
- () => this.requestUpdate()
847
- );
712
+ Zt(this);
713
+ }
714
+ /**
715
+ * Overrides createRenderRoot to handle shadow DOM.
716
+ */
717
+ createRenderRoot() {
718
+ return this;
848
719
  }
849
720
  render() {
850
- var e, s;
851
- return this.hoverId = (e = this.hoverInteraction) == null ? void 0 : e.selectedFids[0], this.clickId = (s = this.clickInteraction) == null ? void 0 : s.selectedFids[0], F`
721
+ var e, i;
722
+ return this.hoverId = (e = this.hoverInteraction) == null ? void 0 : e.selectedFids[0], this.clickId = (i = this.clickInteraction) == null ? void 0 : i.selectedFids[0], _`
852
723
  <style>
853
- ${!this.unstyled && ut}
724
+ ${!this.unstyled && Yt}
854
725
  </style>
855
- <ul>
856
- ${this.drawnFeatures.map((i, n) => {
857
- const o = i.get("id"), d = this.hoverId === o || this.clickId === o;
858
- return Rt(
859
- n + 1,
860
- F`
726
+ <ul class="list-wrap">
727
+ ${this.drawnFeatures.map((s, n) => {
728
+ const o = n + 1, l = s.get("id"), a = this.hoverId === l, h = this.clickId === l;
729
+ return Wt(
730
+ o,
731
+ _`
861
732
  <li
862
- class="${d ? "selected" : l}"
863
- @mouseover=${() => {
864
- this.clickId !== o && this.hoverInteraction.highlightById([o]);
865
- }}
866
- @mouseout=${() => {
867
- this.clickId !== o && this.hoverInteraction.highlightById([]);
868
- }}
733
+ class="${a || h ? "selected" : d}"
734
+ @mouseover=${() => this._handleHoverFeature(l)}
735
+ @mouseout=${() => this._handleHoverFeature(l, !0)}
869
736
  >
870
737
  <div
871
738
  class="list"
872
- @click="${() => this._handleFeatureSelectAndDeselect(i)}"
739
+ @click="${() => this._handleFeatureSelectAndDeselect(s)}"
873
740
  >
874
- <span class="title">Feature #${n + 1}</span>
741
+ <span class="title">Feature #${o}</span>
875
742
  <button
876
743
  index=${n}
877
- class="icon small discard"
744
+ class="icon smallest discard"
878
745
  @click="${this._handleDelete}"
879
746
  >
880
- ${this.unstyled ? "x" : l}
747
+ x
881
748
  </button>
882
749
  </div>
883
750
  </li>
@@ -888,36 +755,326 @@ class $t extends x {
888
755
  `;
889
756
  }
890
757
  }
891
- A($t, "properties", {
758
+ b(bt, "properties", {
892
759
  eoxMap: { attribute: !1, state: !0 },
893
760
  olMap: { attribute: !1, state: !0 },
894
761
  draw: { attribute: !1, state: !0 },
895
- layer: { type: String },
896
762
  drawLayer: { attribute: !1, state: !0 },
897
763
  drawnFeatures: { attribute: !1, state: !0, type: Array },
898
764
  modify: { attribute: !1, state: !0 },
899
765
  unstyled: { type: Boolean }
900
766
  });
901
- customElements.define("eox-drawtools-list", $t);
902
- const zt = `
903
- :host {
904
- display: block;
767
+ customElements.define("eox-drawtools-list", bt);
768
+ const te = (r) => {
769
+ const { multipleFeatures: t, drawnFeatures: e, currentlyDrawing: i } = r, s = !t && (e == null ? void 0 : e.length) > 0 || i, n = !(e != null && e.length) && !i;
770
+ return { drawDisabled: s, discardDisabled: n };
771
+ }, ee = "button,.button { display: inline-flex; position: relative; align-items: center; color: #fff; border-width: 0; outline: none; border-radius: 4px; padding: 16px; height: 36px; cursor: pointer; font-family: inherit; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 1.25px; font-weight: 500; 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); transition-property: box-shadow, transform, opacity, background; transition-duration: 0.28s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);}button:hover:not([disabled]):not(.icon),.button:hover:not([disabled]):not(.icon) { 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); background: var(--primary-btn-color-hover);}button,button:active,.button,.button:active { background: var(--primary-color);}button[disabled],.button[disabled] { opacity: 0.5; cursor: not-allowed;}button.outline,.button.outline { background: transparent; box-shadow: none; color: var(--primary-color); outline: 1px solid var(--primary-color);}button.outline:hover,.button.outline:hover { background: transparent;}button.icon,.button.icon { background: transparent; border: none; box-shadow: none; padding: 0; border-radius: 50%; width: 24px; height: 24px; text-indent: -9999px;}button.icon-text,.button.icon-text { text-indent: 26px;}button.icon:before,button.icon-text:before,.button.icon:before,.button.icon-text:before { position: absolute; text-indent: 0; line-height: initial;}button.icon:before,.button.icon:before { width: 24px; height: 24px; margin-right: 0;}button.icon-text:before,.button.icon-text:before { width: 18px; height: 18px;}button.small,.button.small { height: 28px; padding: 12.4px; font-size: 0.75rem;}button.smallest.icon,button.smallest.icon::before { height: 16px; width: 16px; padding: 0px;}", re = "textarea { height: 90px; resize: none; border-radius: 4px; box-sizing: border-box !important; width: 100%; padding: 5px 7px; border: 1px solid var(--secondary-color); font-size: smaller; background: var(--background-color);}";
772
+ function ie(r) {
773
+ navigator.clipboard.writeText(r).then(
774
+ function() {
775
+ },
776
+ function(t) {
777
+ console.error("Could not copy text: ", t);
778
+ }
779
+ );
780
+ }
781
+ /**
782
+ * @license
783
+ * Copyright 2021 Google LLC
784
+ * SPDX-License-Identifier: BSD-3-Clause
785
+ */
786
+ function ht(r, t, e) {
787
+ return r ? t(r) : e == null ? void 0 : e(r);
788
+ }
789
+ var I, B;
790
+ class vt extends x {
791
+ constructor() {
792
+ super();
793
+ /**
794
+ * @type boolean | import("lit").nothing
795
+ */
796
+ S(this, I, !0);
797
+ /**
798
+ * @type boolean | import("lit").nothing
799
+ */
800
+ S(this, B, !0);
801
+ this.multipleFeatures = !1, this.drawnFeatures = [], this.importFeatures = !1, this.showEditor = !1, this.currentlyDrawing = !1, this.drawFunc = null, this.geoJSON = "", this.unstyled = !1;
802
+ }
803
+ /**
804
+ * Updates button states based on conditions
805
+ */
806
+ updateButtonStates() {
807
+ const { drawDisabled: e, discardDisabled: i } = te(this);
808
+ E(this, I, e), E(this, B, i);
809
+ }
810
+ /**
811
+ * Overrides createRenderRoot to handle shadow DOM
812
+ */
813
+ createRenderRoot() {
814
+ return this;
815
+ }
816
+ render() {
817
+ this.updateButtonStates();
818
+ const e = this.currentlyDrawing ? "drawing" : "draw";
819
+ return _`
820
+ <style>
821
+ ${!this.unstyled && ee}
822
+ ${!this.unstyled && re}
823
+ </style>
824
+ <div class="wrap-btn">
825
+ <slot></slot>
826
+ <div>
827
+ <!-- Draw Button -->
828
+ <button
829
+ data-cy="drawBtn"
830
+ class="polygon icon"
831
+ ?disabled="${g(this, I) || d}"
832
+ @click="${() => this.drawFunc.start()}"
833
+ >
834
+ ${e}
835
+ </button>
836
+
837
+ <!-- Discard Button -->
838
+ <button
839
+ data-cy="discardBtn"
840
+ class="discard icon"
841
+ ?disabled="${g(this, B) || d}"
842
+ @click="${() => this.drawFunc.discard()}"
843
+ >
844
+ discard
845
+ </button>
846
+ </div>
847
+
848
+ <!-- Import Button -->
849
+ ${ht(
850
+ this.importFeatures,
851
+ () => _`
852
+ <!-- Import Input Field : Hidden -->
853
+ <input
854
+ type="file"
855
+ id="import-file"
856
+ style="display: none;"
857
+ @change=${this.drawFunc.import}
858
+ />
859
+
860
+ <!-- Main Import Button -->
861
+ <button
862
+ data-cy="importBtn"
863
+ class="import icon"
864
+ @click=${() => this.querySelector("#import-file").click()}
865
+ >
866
+ import
867
+ </button>
868
+ `
869
+ )}
870
+ </div>
871
+
872
+ <!-- Geo JSON Wrapper -->
873
+ ${ht(
874
+ this.showEditor,
875
+ () => _`
876
+ <div class="json-wrapper">
877
+ <!-- Geo JSON Editor -->
878
+ <textarea
879
+ @drop=${this.drawFunc.import}
880
+ @input=${this.drawFunc.editor}
881
+ .value=${this.geoJSON}
882
+ ></textarea>
883
+
884
+ <!-- Geo JSON Copy Button -->
885
+ <button
886
+ data-cy="copyBtn"
887
+ class="icon-copy"
888
+ @click=${() => ie(this.geoJSON)}
889
+ >
890
+ ${this.unstyled ? "copy" : d}
891
+ </button>
892
+ </div>
893
+ `
894
+ )}
895
+ `;
896
+ }
897
+ }
898
+ I = new WeakMap(), B = new WeakMap(), // Define properties with default values and types
899
+ b(vt, "properties", {
900
+ multipleFeatures: { attribute: !1, type: Boolean },
901
+ drawnFeatures: { attribute: !1, state: !0, type: Array },
902
+ currentlyDrawing: { attribute: !1, state: !0, type: Boolean },
903
+ drawFunc: { attribute: !1, type: Object },
904
+ importFeatures: { attribute: "import-features", type: Boolean },
905
+ showEditor: { attribute: "show-editor", type: Boolean },
906
+ geoJSON: { attribute: "geo-json", type: String },
907
+ unstyled: { type: Boolean }
908
+ });
909
+ customElements.define("eox-drawtools-controller", vt);
910
+ const se = `
911
+ button.discard:before {
912
+ 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")
913
+ }
914
+ button.polygon:before {
915
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' 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");
916
+ }
917
+ button.import:before {
918
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3Eupload%3C/title%3E%3Cpath fill='%23004170' d='M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z' /%3E%3C/svg%3E");
919
+ }
920
+ .wrap-btn {
921
+ display: flex;
922
+ justify-content: space-between;
923
+ }
924
+ eox-drawtools-list {
925
+ width: 100%;
926
+ }
927
+ .json-wrapper {
928
+ margin: 0.4rem 0rem;
929
+ padding: 0.75rem;
930
+ background: var(--secondary-color-hover);
931
+ position: relative;
932
+ }
933
+ .json-wrapper textarea {
934
+ height: 200px;
935
+ }
936
+ .icon-copy {
937
+ position: absolute;
938
+ bottom: 26px;
939
+ right: 26px;
940
+ border-radius: 4px;
941
+ height: 26px;
942
+ padding: 4px 6px;
943
+ }
944
+ .icon-copy:before {
945
+ width: 14px;
946
+ min-width: 14px;
947
+ height: 14px;
948
+ display: flex margin-right: 6px;
949
+ color: white;
950
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3Econtent-copy%3C/title%3E%3Cpath d='M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z' fill='white' /%3E%3C/svg%3E")
951
+ }
952
+ `, ne = (r) => {
953
+ (() => {
954
+ r.emitDrawnFeatures(), r.multipleFeatures || (r.draw.setActive(!1), r.currentlyDrawing = !1);
955
+ })(), r.requestUpdate();
956
+ }, oe = (r) => {
957
+ const t = () => {
958
+ r.drawLayer.set("isDrawingEnabled", !0), r.draw.setActive(!0);
959
+ }, e = () => {
960
+ r.currentlyDrawing = !0, r.requestUpdate();
961
+ };
962
+ t(), e();
963
+ }, ae = (r, t) => {
964
+ var n;
965
+ const i = document.querySelector(r.for), s = i.map;
966
+ return r.drawLayer = i.addOrUpdateLayer({
967
+ type: "Vector",
968
+ properties: {
969
+ id: "drawLayer",
970
+ layerControlHide: !0,
971
+ isDrawingEnabled: !1,
972
+ multipleFeatures: t
973
+ },
974
+ source: {
975
+ type: "Vector"
976
+ },
977
+ interactions: [
978
+ {
979
+ type: "draw",
980
+ options: {
981
+ active: !1,
982
+ id: "drawInteraction",
983
+ type: r.type,
984
+ modify: r.allowModify,
985
+ stopClick: !0
986
+ }
987
+ },
988
+ {
989
+ type: "select",
990
+ options: {
991
+ id: "selectHover",
992
+ condition: "pointermove",
993
+ style: {
994
+ "fill-color": "rgba(51, 153, 204,0.5)",
995
+ "stroke-color": "#3399CC",
996
+ "stroke-width": 2.5
997
+ }
998
+ }
999
+ },
1000
+ {
1001
+ type: "select",
1002
+ options: {
1003
+ id: "selectClick",
1004
+ condition: "click",
1005
+ panIn: !0,
1006
+ style: {
1007
+ "fill-color": "rgba(51, 153, 204,0.5)",
1008
+ "stroke-color": "#3399CC",
1009
+ "stroke-width": 2.5
1010
+ }
1011
+ }
1012
+ }
1013
+ ]
1014
+ }), r.draw = /** @type {import("ol/interaction").Draw} */
1015
+ /** @type {unknown} */
1016
+ i.interactions.drawInteraction, r.modify = /** @type {import("ol/interaction").Modify} */
1017
+ /** @type {unknown} */
1018
+ i.interactions.drawInteractionmodify, (n = r.modify) == null || n.on("modifyend", () => r.onModifyEnd()), i.addEventListener("addfeatures", () => ne(r)), { EoxMap: i, OlMap: s };
1019
+ }, le = (r) => {
1020
+ const t = () => {
1021
+ r.drawnFeatures = [], r.draw.setActive(!1), r.drawLayer.getSource().clear(), r.geoJSON = null;
1022
+ }, e = () => {
1023
+ r.emitDrawnFeatures(), r.currentlyDrawing = !1, r.requestUpdate();
1024
+ };
1025
+ t(), e();
1026
+ }, ce = (r, t) => {
1027
+ setTimeout(() => {
1028
+ r.drawnFeatures = r.drawLayer.getSource().getFeatures(), r.updateGeoJSON(), r.requestUpdate(), t();
1029
+ }, 0);
1030
+ }, he = ':root,:host { --spacing: 1rem; --block-spacing-vertical: calc(var(--spacing) * 2); --block-spacing-horizontal: var(--spacing); --background-color: var(--eox-background-color, white); --color: var(--eox-color, #2c3d49); --h-color: var(--eox-h-color, var(--color)); --hover-transparency: var(--eox-hover-transparency, 20%); --bg-hover-transparency: var(--eox-bg-hover-transparency, 40%); --btn-hover-transparency: var(--eox-btn-hover-transparency, 80%); --primary-color: var(--eox-primary-color, #004170); --primary-color-hover: color-mix( in srgb, var(--primary-color) var(--hover-transparency), transparent ); --primary-bg-color-hover: color-mix( in srgb, var(--primary-color) var(--bg-hover-transparency), transparent ); --primary-btn-color-hover: color-mix( in srgb, var(--primary-color) var(--btn-hover-transparency), transparent ); --secondary-color: var(--eox-secondary-color, #c6d4df); --secondary-color-hover: color-mix( in srgb, var(--secondary-color) var(--hover-transparency), transparent ); --secondary-bg-color-hover: color-mix( in srgb, var(--secondary-color) var(--bg-hover-transparency), transparent ); --secondary-btn-color-hover: color-mix( in srgb, var(--secondary-color) var(--btn-hover-transparency), transparent ); --success: var(--eox-success, #26cc0f); --warning: var(--eox-warning, #f18e32); --error: var(--eox-error, #ff5252); --header-font-family: var(--eox-header-font-family, "Roboto", sans-serif); --body-font-family: var(--eox-body-font-family, "Roboto", sans-serif);}* { font-family: var(--body-font-family); color: var(--eox-color);}h1,h2,h3,h4,h5,h6 { font-family: var(--header-font-family);}span,p,div,main,label { font-family: var(--body-font-family);}@media (min-width: 576px) { .container { max-width: 510px; padding-right: 0; padding-left: 0; --block-spacing-vertical: calc(var(--spacing) * 2.5); }}@media (min-width: 768px) { .container { max-width: 700px; --block-spacing-vertical: calc(var(--spacing) * 3); }}@media (min-width: 992px) { .container { max-width: 920px; --block-spacing-vertical: calc(var(--spacing) * 3.5); }}@media (min-width: 1200px) { .container { max-width: 1130px; --block-spacing-vertical: calc(var(--spacing) * 4); }}.container { width: 100%; margin-right: auto; margin-left: auto; display: block; padding: var(--block-spacing-vertical) var(--block-spacing-horizontal);}h1,h2,h3 { line-height: 120%; margin-top: 0.8rem; margin-bottom: 0.8rem;}p { font-weight: 400; line-height: 170%; margin-top: 0.8rem; margin-bottom: 1.6rem;}body { padding: 0; margin: 0;}.sb-show-main.sb-main-padded { padding: 0;}h1,h2,h3,h4,h5,h6 { --font-weight: 700;}h1 { --font-size: 3rem; --typography-spacing-vertical: 0.5rem;}h2 { --font-size: 2rem; --typography-spacing-vertical: 0.5rem;}h3 { --font-size: 1.75rem; --typography-spacing-vertical: 0.5rem;}h4 { --font-size: 1.5rem; --typography-spacing-vertical: 0.5rem;}h5 { --font-size: 1.25rem; --typography-spacing-vertical: 0.5rem;}h1,h2,h3,h4,h5,h6 { margin-top: 0; margin-bottom: var(--typography-spacing-vertical); color: var(--h-color); font-weight: var(--font-weight); font-size: var(--font-size); font-family: var(--header-font-family);}';
1031
+ function de(r, t) {
1032
+ function e(n) {
1033
+ n.preventDefault(), n.stopPropagation();
1034
+ }
1035
+ function i(n) {
1036
+ n.srcElement.style.opacity = "0.4";
1037
+ }
1038
+ function s(n) {
1039
+ n.srcElement.style.opacity = "1";
1040
+ }
1041
+ ["dragenter", "dragover", "dragleave", "drop"].forEach((n) => {
1042
+ t.addEventListener(n, e, !1), ["dragenter", "dragover"].includes(n) ? t.addEventListener(n, i, !1) : t.addEventListener(n, s, !1);
1043
+ }), t.addEventListener("drop", (n) => wt(n, r), !1);
905
1044
  }
906
- `;
907
- var u, E;
908
- class qt extends x {
1045
+ function pe(r) {
1046
+ r.preventDefault(), r.stopPropagation();
1047
+ }
1048
+ function wt(r, t) {
1049
+ pe(r);
1050
+ const e = r.dataTransfer ? r.dataTransfer.files : r.target.files;
1051
+ Array.from(e).forEach((i) => ue(i, t));
1052
+ }
1053
+ function ue(r, t) {
1054
+ const e = new FileReader();
1055
+ e.readAsText(r), e.onloadend = function() {
1056
+ typeof e.result == "string" && t.handleFeatureChange(e.result);
1057
+ };
1058
+ }
1059
+ var m, L, R;
1060
+ class ge extends x {
909
1061
  constructor() {
910
1062
  super();
911
1063
  /**
912
1064
  * @type import("../../map/main").EOxMap
913
1065
  */
914
- V(this, u, void 0);
1066
+ S(this, m, void 0);
915
1067
  /**
916
1068
  * @type import("ol").Map
917
1069
  */
918
- V(this, E, void 0);
919
- 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;
1070
+ S(this, L, void 0);
1071
+ /**
1072
+ * @type string
1073
+ */
1074
+ S(this, R, void 0);
1075
+ 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.importFeatures = !1, this.showEditor = !1, this.showList = !1, this.type = "Polygon", this.unstyled = !1, this.noShadow = !1;
920
1076
  }
1077
+ // Define properties with defaults and types
921
1078
  static get properties() {
922
1079
  return {
923
1080
  allowModify: { attribute: "allow-modify", type: Boolean },
@@ -928,144 +1085,130 @@ class qt extends x {
928
1085
  drawnFeatures: { attribute: !1, state: !0, type: Array },
929
1086
  modify: { attribute: !1, state: !0 },
930
1087
  multipleFeatures: { attribute: "multiple-features", type: Boolean },
1088
+ importFeatures: { attribute: "import-features", type: Boolean },
1089
+ showEditor: { attribute: "show-editor", type: Boolean },
931
1090
  showList: { attribute: "show-list", type: Boolean },
1091
+ noShadow: { type: Boolean },
932
1092
  type: { type: String },
933
1093
  unstyled: { type: Boolean }
934
1094
  };
935
1095
  }
936
- initDrawLayer() {
937
- var s, i;
938
- const e = document.querySelector(this.for);
939
- R(
940
- this,
941
- u,
942
- /** @type {import("@eox/map/main").EOxMap} */
943
- e
944
- ), R(
945
- this,
946
- E,
947
- /** @type {import("ol").Map} */
948
- $(this, u).map
949
- ), this.drawLayer = $(this, u).addOrUpdateLayer({
950
- type: "Vector",
951
- properties: {
952
- id: "drawLayer",
953
- layerControlHide: !0
954
- },
955
- source: {
956
- type: "Vector"
957
- },
958
- // check if the drawInteraction has already been added before adding again
959
- // TEMP/TODO: this should probably be done by the map in the addOrUpdateLayer method
960
- ...$(this, u).interactions.drawInteraction ? {} : {
961
- interactions: [
962
- {
963
- type: "draw",
964
- options: {
965
- active: !1,
966
- id: "drawInteraction",
967
- type: this.type,
968
- modify: this.allowModify,
969
- stopClick: !0
970
- }
971
- },
972
- {
973
- type: "select",
974
- options: {
975
- id: "selectHover",
976
- condition: "pointermove",
977
- style: {
978
- "fill-color": "rgba(51, 153, 204,0.5)",
979
- "stroke-color": "#3399CC",
980
- "stroke-width": 2.5
981
- }
982
- }
983
- },
984
- {
985
- type: "select",
986
- options: {
987
- id: "selectClick",
988
- condition: "click",
989
- panIn: !0,
990
- style: {
991
- "fill-color": "rgba(51, 153, 204,0.5)",
992
- "stroke-color": "#3399CC",
993
- "stroke-width": 2.5
994
- }
995
- }
996
- }
997
- ]
998
- }
999
- }), this.draw = /** @type {import("ol/interaction").Draw} */
1000
- /** @type {unknown} */
1001
- $(this, u).interactions.drawInteraction, this.modify = /** @type {import("ol/interaction").Modify} */
1002
- /** @type {unknown} */
1003
- $(this, u).interactions.drawInteractionmodify, (s = this.draw) == null || s.on("drawend", () => this.onDrawEnd()), (i = this.modify) == null || i.on("modifyend", () => this.onModifyEnd());
1096
+ /**
1097
+ * @onClick Event handler triggered to start drawing on the map.
1098
+ */
1099
+ handleStartDrawing() {
1100
+ oe(this);
1004
1101
  }
1005
- startDrawing() {
1006
- this.initDrawLayer(), this.draw.setActive(!0), this.currentlyDrawing = !0, this.requestUpdate();
1102
+ /**
1103
+ * @onClick Event handler triggered to discard/stop drawing
1104
+ * on the map and delete the drawn shapes.
1105
+ */
1106
+ handleDiscardDrawing() {
1107
+ le(this);
1007
1108
  }
1008
- discardDrawing() {
1009
- this.drawnFeatures = [], this.draw.setActive(!1), this.drawLayer.getSource().clear(), $(this, u).removeInteraction("drawInteraction"), $(this, E).removeLayer(this.drawLayer), this.emitDrawnFeatures(), this.currentlyDrawing = !1, this.requestUpdate();
1109
+ /**
1110
+ * @param {string} text - The string representation of the features to be parsed.
1111
+ * @param {boolean} replaceFeatures - A boolean flag indicating whether to replace the existing features.
1112
+ */
1113
+ handleFeatureChange(e, i = !1) {
1114
+ g(this, m).parseTextToFeature(
1115
+ e || JSON.stringify(ct),
1116
+ this.drawLayer,
1117
+ i
1118
+ );
1010
1119
  }
1011
- onDrawEnd() {
1012
- this.emitDrawnFeatures(), this.draw.setActive(!1), this.currentlyDrawing = !1, this.requestUpdate();
1120
+ /**
1121
+ * @param {DragEvent | Event} evt - The event object from the file input interaction.
1122
+ */
1123
+ handleFilesChange(e) {
1124
+ wt(e, this);
1013
1125
  }
1126
+ /**
1127
+ * @event onModifyEnd triggered when the modification of a shape is completed.
1128
+ */
1014
1129
  onModifyEnd() {
1015
1130
  this.emitDrawnFeatures();
1016
1131
  }
1132
+ /**
1133
+ * Update #geoJSON with stringify feature.
1134
+ */
1135
+ updateGeoJSON() {
1136
+ E(this, R, JSON.stringify(
1137
+ g(this, m).parseFeature(this.drawnFeatures) || ct,
1138
+ void 0,
1139
+ 2
1140
+ ));
1141
+ }
1142
+ /**
1143
+ * Triggers different events when the drawing of a shape is completed.
1144
+ */
1017
1145
  emitDrawnFeatures() {
1018
- setTimeout(() => {
1019
- this.drawnFeatures = this.drawLayer.getSource().getFeatures(), this.requestUpdate(), this.dispatchEvent(
1020
- new CustomEvent("drawupdate", {
1021
- detail: this.drawnFeatures
1022
- })
1146
+ ce(this, () => {
1147
+ this.dispatchEvent(
1148
+ new CustomEvent("drawupdate", { detail: this.drawnFeatures })
1023
1149
  );
1024
- }, 0);
1150
+ });
1025
1151
  }
1152
+ /**
1153
+ * Overrides createRenderRoot to handle shadow DOM creation based on the noShadow property.
1154
+ */
1155
+ createRenderRoot() {
1156
+ return this.noShadow ? this : super.createRenderRoot();
1157
+ }
1158
+ /**
1159
+ * initializes the EOxMap and OlMap instances
1160
+ * And stores them in the private properties #eoxMap and #olMap, respectively.
1161
+ * It then calls requestUpdate to trigger a re-render.
1162
+ */
1163
+ firstUpdated() {
1164
+ const { EoxMap: e, OlMap: i } = ae(this, this.multipleFeatures);
1165
+ E(this, m, e), E(this, L, i), this.importFeatures && de(this, g(this, m)), this.updateGeoJSON(), this.requestUpdate();
1166
+ }
1167
+ // Render method for UI display
1026
1168
  render() {
1027
- var e, s, i;
1028
- return F`
1169
+ var e;
1170
+ return _`
1029
1171
  <style>
1030
- ${zt}
1031
- ${!this.unstyled && ut}
1172
+ :host { display: block; }
1173
+ ${!this.unstyled && he}
1174
+ ${!this.unstyled && se}
1032
1175
  </style>
1033
- <div>
1034
- <slot></slot>
1035
- <button
1036
- data-cy="drawBtn"
1037
- class="polygon icon"
1038
- disabled="${!this.multipleFeatures && ((e = this.drawnFeatures) == null ? void 0 : e.length) > 0 || this.currentlyDrawing || l}"
1039
- @click="${() => this.startDrawing()}"
1040
- >
1041
- ${this.currentlyDrawing ? "drawing" : "draw"}
1042
- </button>
1043
- <button
1044
- data-cy="discardBtn"
1045
- class="discard icon"
1046
- disabled="${!((s = this.drawnFeatures) != null && s.length) && !this.currentlyDrawing || l}"
1047
- @click="${() => this.discardDrawing()}"
1048
- >
1049
- discard
1050
- </button>
1051
- </div>
1052
- ${this.showList && ((i = this.drawnFeatures) != null && i.length) ? F`<eox-drawtools-list
1053
- .eoxMap=${$(this, u)}
1054
- .olMap=${$(this, E)}
1176
+
1177
+ <!-- Controller Component -->
1178
+ <eox-drawtools-controller
1179
+ .drawFunc=${{
1180
+ start: () => this.handleStartDrawing(),
1181
+ discard: () => this.handleDiscardDrawing(),
1182
+ editor: (i) => this.handleFeatureChange(i.target.value, !0),
1183
+ import: (i) => this.handleFilesChange(i)
1184
+ }}
1185
+ .unstyled=${this.unstyled}
1186
+ .drawnFeatures=${this.drawnFeatures}
1187
+ .currentlyDrawing=${this.currentlyDrawing}
1188
+ .multipleFeatures=${this.multipleFeatures}
1189
+ .importFeatures=${this.importFeatures}
1190
+ .showEditor=${this.showEditor}
1191
+ .geoJSON=${g(this, R)}
1192
+ ></eox-drawtools-controller>
1193
+
1194
+ <!-- List Component -->
1195
+ ${this.showList && ((e = this.drawnFeatures) != null && e.length) ? _`<eox-drawtools-list
1196
+ .eoxMap=${g(this, m)}
1197
+ .olMap=${g(this, L)}
1055
1198
  .draw=${this.draw}
1056
- .layer=${this.layer}
1057
1199
  .drawLayer=${this.drawLayer}
1058
1200
  .drawnFeatures=${this.drawnFeatures}
1059
1201
  .modify=${this.modify}
1060
1202
  .unstyled=${this.unstyled}
1061
- @changed=${() => this.requestUpdate()}
1062
- >
1063
- </eox-drawtools-list>` : l}
1203
+ @changed=${() => {
1204
+ this.updateGeoJSON(), this.requestUpdate();
1205
+ }}
1206
+ ></eox-drawtools-list>` : d}
1064
1207
  `;
1065
1208
  }
1066
1209
  }
1067
- u = new WeakMap(), E = new WeakMap();
1068
- customElements.define("eox-drawtools", qt);
1210
+ m = new WeakMap(), L = new WeakMap(), R = new WeakMap();
1211
+ customElements.define("eox-drawtools", ge);
1069
1212
  export {
1070
- qt as EOxDrawTools
1213
+ ge as EOxDrawTools
1071
1214
  };