@verbb/formie-web-components 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,968 +1,993 @@
1
- import { isKnownFrontendFieldType as xt, isCompositeField as Wt, isRepeatableField as qt, isFileField as Gt, compositePartDefinitions as Bt, repeaterRowDefinitions as Kt, createRepeaterRowValue as Zt, loadGraphqlFrontendEnvelope as Jt, loadFrontendEnvelope as Qt, createGraphqlFrontendTransport as Xt, createRestFrontendTransport as Yt, createFrontendFormInstance as te, FRONTEND_CLIENT_EVENT_NAMES as ee } from "@verbb/formie-core";
2
- import { createFormieClient as se, FORMIE_HTML_EVENT_NAMES as ie } from "@verbb/formie-browser";
3
- import { createFormieClient as gs } from "@verbb/formie-browser";
4
- const F = globalThis, et = F.ShadowRoot && (F.ShadyCSS === void 0 || F.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, st = /* @__PURE__ */ Symbol(), ut = /* @__PURE__ */ new WeakMap();
5
- let Rt = class {
6
- constructor(t, e, i) {
7
- if (this._$cssResult$ = !0, i !== st) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
8
- this.cssText = t, this.t = e;
9
- }
10
- get styleSheet() {
11
- let t = this.o;
12
- const e = this.t;
13
- if (et && t === void 0) {
14
- const i = e !== void 0 && e.length === 1;
15
- i && (t = ut.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && ut.set(e, t));
16
- }
17
- return t;
18
- }
19
- toString() {
20
- return this.cssText;
21
- }
1
+ import { FRONTEND_CLIENT_EVENT_NAMES as e, compositePartDefinitions as t, createFrontendFormInstance as n, createGraphqlFrontendTransport as r, createRepeaterRowValue as i, createRestFrontendTransport as a, isCompositeField as o, isFileField as s, isKnownFrontendFieldType as c, isRepeatableField as l, loadFrontendEnvelope as u, loadGraphqlFrontendEnvelope as d, repeaterRowDefinitions as f } from "@verbb/formie-core";
2
+ import { FORMIE_HTML_EVENT_NAMES as p, createFormieClient as ee, createFormieClient as te } from "@verbb/formie-browser";
3
+ //#region ../../node_modules/@lit/reactive-element/css-tag.js
4
+ var m = globalThis, h = m.ShadowRoot && (m.ShadyCSS === void 0 || m.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, g = Symbol(), ne = /* @__PURE__ */ new WeakMap(), re = class {
5
+ constructor(e, t, n) {
6
+ if (this._$cssResult$ = !0, n !== g) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
7
+ this.cssText = e, this.t = t;
8
+ }
9
+ get styleSheet() {
10
+ let e = this.o, t = this.t;
11
+ if (h && e === void 0) {
12
+ let n = t !== void 0 && t.length === 1;
13
+ n && (e = ne.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && ne.set(t, e));
14
+ }
15
+ return e;
16
+ }
17
+ toString() {
18
+ return this.cssText;
19
+ }
20
+ }, ie = (e) => new re(typeof e == "string" ? e : e + "", void 0, g), ae = (e, ...t) => new re(e.length === 1 ? e[0] : t.reduce((t, n, r) => t + ((e) => {
21
+ if (!0 === e._$cssResult$) return e.cssText;
22
+ if (typeof e == "number") return e;
23
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + e + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
24
+ })(n) + e[r + 1], e[0]), e, g), oe = (e, t) => {
25
+ if (h) e.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
26
+ else for (let n of t) {
27
+ let t = document.createElement("style"), r = m.litNonce;
28
+ r !== void 0 && t.setAttribute("nonce", r), t.textContent = n.cssText, e.appendChild(t);
29
+ }
30
+ }, se = h ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
31
+ let t = "";
32
+ for (let n of e.cssRules) t += n.cssText;
33
+ return ie(t);
34
+ })(e) : e, { is: ce, defineProperty: le, getOwnPropertyDescriptor: ue, getOwnPropertyNames: de, getOwnPropertySymbols: fe, getPrototypeOf: pe } = Object, _ = globalThis, me = _.trustedTypes, he = me ? me.emptyScript : "", ge = _.reactiveElementPolyfillSupport, v = (e, t) => e, y = {
35
+ toAttribute(e, t) {
36
+ switch (t) {
37
+ case Boolean:
38
+ e = e ? he : null;
39
+ break;
40
+ case Object:
41
+ case Array: e = e == null ? e : JSON.stringify(e);
42
+ }
43
+ return e;
44
+ },
45
+ fromAttribute(e, t) {
46
+ let n = e;
47
+ switch (t) {
48
+ case Boolean:
49
+ n = e !== null;
50
+ break;
51
+ case Number:
52
+ n = e === null ? null : Number(e);
53
+ break;
54
+ case Object:
55
+ case Array: try {
56
+ n = JSON.parse(e);
57
+ } catch {
58
+ n = null;
59
+ }
60
+ }
61
+ return n;
62
+ }
63
+ }, b = (e, t) => !ce(e, t), _e = {
64
+ attribute: !0,
65
+ type: String,
66
+ converter: y,
67
+ reflect: !1,
68
+ useDefault: !1,
69
+ hasChanged: b
22
70
  };
23
- const re = (s) => new Rt(typeof s == "string" ? s : s + "", void 0, st), ne = (s, ...t) => {
24
- const e = s.length === 1 ? s[0] : t.reduce((i, r, n) => i + ((o) => {
25
- if (o._$cssResult$ === !0) return o.cssText;
26
- if (typeof o == "number") return o;
27
- throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
28
- })(r) + s[n + 1], s[0]);
29
- return new Rt(e, s, st);
30
- }, oe = (s, t) => {
31
- if (et) s.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
32
- else for (const e of t) {
33
- const i = document.createElement("style"), r = F.litNonce;
34
- r !== void 0 && i.setAttribute("nonce", r), i.textContent = e.cssText, s.appendChild(i);
35
- }
36
- }, pt = et ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
37
- let e = "";
38
- for (const i of t.cssRules) e += i.cssText;
39
- return re(e);
40
- })(s) : s;
41
- const { is: ae, defineProperty: le, getOwnPropertyDescriptor: de, getOwnPropertyNames: he, getOwnPropertySymbols: ce, getPrototypeOf: ue } = Object, G = globalThis, ft = G.trustedTypes, pe = ft ? ft.emptyScript : "", fe = G.reactiveElementPolyfillSupport, U = (s, t) => s, j = { toAttribute(s, t) {
42
- switch (t) {
43
- case Boolean:
44
- s = s ? pe : null;
45
- break;
46
- case Object:
47
- case Array:
48
- s = s == null ? s : JSON.stringify(s);
49
- }
50
- return s;
51
- }, fromAttribute(s, t) {
52
- let e = s;
53
- switch (t) {
54
- case Boolean:
55
- e = s !== null;
56
- break;
57
- case Number:
58
- e = s === null ? null : Number(s);
59
- break;
60
- case Object:
61
- case Array:
62
- try {
63
- e = JSON.parse(s);
64
- } catch {
65
- e = null;
66
- }
67
- }
68
- return e;
69
- } }, it = (s, t) => !ae(s, t), mt = { attribute: !0, type: String, converter: j, reflect: !1, useDefault: !1, hasChanged: it };
70
- Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), G.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
71
- let R = class extends HTMLElement {
72
- static addInitializer(t) {
73
- this._$Ei(), (this.l ??= []).push(t);
74
- }
75
- static get observedAttributes() {
76
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
77
- }
78
- static createProperty(t, e = mt) {
79
- if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
80
- const i = /* @__PURE__ */ Symbol(), r = this.getPropertyDescriptor(t, i, e);
81
- r !== void 0 && le(this.prototype, t, r);
82
- }
83
- }
84
- static getPropertyDescriptor(t, e, i) {
85
- const { get: r, set: n } = de(this.prototype, t) ?? { get() {
86
- return this[e];
87
- }, set(o) {
88
- this[e] = o;
89
- } };
90
- return { get: r, set(o) {
91
- const l = r?.call(this);
92
- n?.call(this, o), this.requestUpdate(t, l, i);
93
- }, configurable: !0, enumerable: !0 };
94
- }
95
- static getPropertyOptions(t) {
96
- return this.elementProperties.get(t) ?? mt;
97
- }
98
- static _$Ei() {
99
- if (this.hasOwnProperty(U("elementProperties"))) return;
100
- const t = ue(this);
101
- t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
102
- }
103
- static finalize() {
104
- if (this.hasOwnProperty(U("finalized"))) return;
105
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(U("properties"))) {
106
- const e = this.properties, i = [...he(e), ...ce(e)];
107
- for (const r of i) this.createProperty(r, e[r]);
108
- }
109
- const t = this[Symbol.metadata];
110
- if (t !== null) {
111
- const e = litPropertyMetadata.get(t);
112
- if (e !== void 0) for (const [i, r] of e) this.elementProperties.set(i, r);
113
- }
114
- this._$Eh = /* @__PURE__ */ new Map();
115
- for (const [e, i] of this.elementProperties) {
116
- const r = this._$Eu(e, i);
117
- r !== void 0 && this._$Eh.set(r, e);
118
- }
119
- this.elementStyles = this.finalizeStyles(this.styles);
120
- }
121
- static finalizeStyles(t) {
122
- const e = [];
123
- if (Array.isArray(t)) {
124
- const i = new Set(t.flat(1 / 0).reverse());
125
- for (const r of i) e.unshift(pt(r));
126
- } else t !== void 0 && e.push(pt(t));
127
- return e;
128
- }
129
- static _$Eu(t, e) {
130
- const i = e.attribute;
131
- return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0;
132
- }
133
- constructor() {
134
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
135
- }
136
- _$Ev() {
137
- this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t) => t(this));
138
- }
139
- addController(t) {
140
- (this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
141
- }
142
- removeController(t) {
143
- this._$EO?.delete(t);
144
- }
145
- _$E_() {
146
- const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
147
- for (const i of e.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
148
- t.size > 0 && (this._$Ep = t);
149
- }
150
- createRenderRoot() {
151
- const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
152
- return oe(t, this.constructor.elementStyles), t;
153
- }
154
- connectedCallback() {
155
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((t) => t.hostConnected?.());
156
- }
157
- enableUpdating(t) {
158
- }
159
- disconnectedCallback() {
160
- this._$EO?.forEach((t) => t.hostDisconnected?.());
161
- }
162
- attributeChangedCallback(t, e, i) {
163
- this._$AK(t, i);
164
- }
165
- _$ET(t, e) {
166
- const i = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, i);
167
- if (r !== void 0 && i.reflect === !0) {
168
- const n = (i.converter?.toAttribute !== void 0 ? i.converter : j).toAttribute(e, i.type);
169
- this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null;
170
- }
171
- }
172
- _$AK(t, e) {
173
- const i = this.constructor, r = i._$Eh.get(t);
174
- if (r !== void 0 && this._$Em !== r) {
175
- const n = i.getPropertyOptions(r), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute !== void 0 ? n.converter : j;
176
- this._$Em = r;
177
- const l = o.fromAttribute(e, n.type);
178
- this[r] = l ?? this._$Ej?.get(r) ?? l, this._$Em = null;
179
- }
180
- }
181
- requestUpdate(t, e, i, r = !1, n) {
182
- if (t !== void 0) {
183
- const o = this.constructor;
184
- if (r === !1 && (n = this[t]), i ??= o.getPropertyOptions(t), !((i.hasChanged ?? it)(n, e) || i.useDefault && i.reflect && n === this._$Ej?.get(t) && !this.hasAttribute(o._$Eu(t, i)))) return;
185
- this.C(t, e, i);
186
- }
187
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
188
- }
189
- C(t, e, { useDefault: i, reflect: r, wrapped: n }, o) {
190
- i && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), n !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (e = void 0), this._$AL.set(t, e)), r === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
191
- }
192
- async _$EP() {
193
- this.isUpdatePending = !0;
194
- try {
195
- await this._$ES;
196
- } catch (e) {
197
- Promise.reject(e);
198
- }
199
- const t = this.scheduleUpdate();
200
- return t != null && await t, !this.isUpdatePending;
201
- }
202
- scheduleUpdate() {
203
- return this.performUpdate();
204
- }
205
- performUpdate() {
206
- if (!this.isUpdatePending) return;
207
- if (!this.hasUpdated) {
208
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
209
- for (const [r, n] of this._$Ep) this[r] = n;
210
- this._$Ep = void 0;
211
- }
212
- const i = this.constructor.elementProperties;
213
- if (i.size > 0) for (const [r, n] of i) {
214
- const { wrapped: o } = n, l = this[r];
215
- o !== !0 || this._$AL.has(r) || l === void 0 || this.C(r, void 0, n, l);
216
- }
217
- }
218
- let t = !1;
219
- const e = this._$AL;
220
- try {
221
- t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach((i) => i.hostUpdate?.()), this.update(e)) : this._$EM();
222
- } catch (i) {
223
- throw t = !1, this._$EM(), i;
224
- }
225
- t && this._$AE(e);
226
- }
227
- willUpdate(t) {
228
- }
229
- _$AE(t) {
230
- this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
231
- }
232
- _$EM() {
233
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
234
- }
235
- get updateComplete() {
236
- return this.getUpdateComplete();
237
- }
238
- getUpdateComplete() {
239
- return this._$ES;
240
- }
241
- shouldUpdate(t) {
242
- return !0;
243
- }
244
- update(t) {
245
- this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM();
246
- }
247
- updated(t) {
248
- }
249
- firstUpdated(t) {
250
- }
71
+ Symbol.metadata ??= Symbol("metadata"), _.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
72
+ var x = class extends HTMLElement {
73
+ static addInitializer(e) {
74
+ this._$Ei(), (this.l ??= []).push(e);
75
+ }
76
+ static get observedAttributes() {
77
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
78
+ }
79
+ static createProperty(e, t = _e) {
80
+ if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
81
+ let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
82
+ r !== void 0 && le(this.prototype, e, r);
83
+ }
84
+ }
85
+ static getPropertyDescriptor(e, t, n) {
86
+ let { get: r, set: i } = ue(this.prototype, e) ?? {
87
+ get() {
88
+ return this[t];
89
+ },
90
+ set(e) {
91
+ this[t] = e;
92
+ }
93
+ };
94
+ return {
95
+ get: r,
96
+ set(t) {
97
+ let a = r?.call(this);
98
+ i?.call(this, t), this.requestUpdate(e, a, n);
99
+ },
100
+ configurable: !0,
101
+ enumerable: !0
102
+ };
103
+ }
104
+ static getPropertyOptions(e) {
105
+ return this.elementProperties.get(e) ?? _e;
106
+ }
107
+ static _$Ei() {
108
+ if (this.hasOwnProperty(v("elementProperties"))) return;
109
+ let e = pe(this);
110
+ e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
111
+ }
112
+ static finalize() {
113
+ if (this.hasOwnProperty(v("finalized"))) return;
114
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(v("properties"))) {
115
+ let e = this.properties, t = [...de(e), ...fe(e)];
116
+ for (let n of t) this.createProperty(n, e[n]);
117
+ }
118
+ let e = this[Symbol.metadata];
119
+ if (e !== null) {
120
+ let t = litPropertyMetadata.get(e);
121
+ if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n);
122
+ }
123
+ this._$Eh = /* @__PURE__ */ new Map();
124
+ for (let [e, t] of this.elementProperties) {
125
+ let n = this._$Eu(e, t);
126
+ n !== void 0 && this._$Eh.set(n, e);
127
+ }
128
+ this.elementStyles = this.finalizeStyles(this.styles);
129
+ }
130
+ static finalizeStyles(e) {
131
+ let t = [];
132
+ if (Array.isArray(e)) {
133
+ let n = new Set(e.flat(Infinity).reverse());
134
+ for (let e of n) t.unshift(se(e));
135
+ } else e !== void 0 && t.push(se(e));
136
+ return t;
137
+ }
138
+ static _$Eu(e, t) {
139
+ let n = t.attribute;
140
+ return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
141
+ }
142
+ constructor() {
143
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
144
+ }
145
+ _$Ev() {
146
+ this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
147
+ }
148
+ addController(e) {
149
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
150
+ }
151
+ removeController(e) {
152
+ this._$EO?.delete(e);
153
+ }
154
+ _$E_() {
155
+ let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
156
+ for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
157
+ e.size > 0 && (this._$Ep = e);
158
+ }
159
+ createRenderRoot() {
160
+ let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
161
+ return oe(e, this.constructor.elementStyles), e;
162
+ }
163
+ connectedCallback() {
164
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
165
+ }
166
+ enableUpdating(e) {}
167
+ disconnectedCallback() {
168
+ this._$EO?.forEach((e) => e.hostDisconnected?.());
169
+ }
170
+ attributeChangedCallback(e, t, n) {
171
+ this._$AK(e, n);
172
+ }
173
+ _$ET(e, t) {
174
+ let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
175
+ if (r !== void 0 && !0 === n.reflect) {
176
+ let i = (n.converter?.toAttribute === void 0 ? y : n.converter).toAttribute(t, n.type);
177
+ this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
178
+ }
179
+ }
180
+ _$AK(e, t) {
181
+ let n = this.constructor, r = n._$Eh.get(e);
182
+ if (r !== void 0 && this._$Em !== r) {
183
+ let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? y : e.converter;
184
+ this._$Em = r;
185
+ let a = i.fromAttribute(t, e.type);
186
+ this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
187
+ }
188
+ }
189
+ requestUpdate(e, t, n, r = !1, i) {
190
+ if (e !== void 0) {
191
+ let a = this.constructor;
192
+ if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? b)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return;
193
+ this.C(e, t, n);
194
+ }
195
+ !1 === this.isUpdatePending && (this._$ES = this._$EP());
196
+ }
197
+ C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) {
198
+ n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
199
+ }
200
+ async _$EP() {
201
+ this.isUpdatePending = !0;
202
+ try {
203
+ await this._$ES;
204
+ } catch (e) {
205
+ Promise.reject(e);
206
+ }
207
+ let e = this.scheduleUpdate();
208
+ return e != null && await e, !this.isUpdatePending;
209
+ }
210
+ scheduleUpdate() {
211
+ return this.performUpdate();
212
+ }
213
+ performUpdate() {
214
+ if (!this.isUpdatePending) return;
215
+ if (!this.hasUpdated) {
216
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
217
+ for (let [e, t] of this._$Ep) this[e] = t;
218
+ this._$Ep = void 0;
219
+ }
220
+ let e = this.constructor.elementProperties;
221
+ if (e.size > 0) for (let [t, n] of e) {
222
+ let { wrapped: e } = n, r = this[t];
223
+ !0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r);
224
+ }
225
+ }
226
+ let e = !1, t = this._$AL;
227
+ try {
228
+ e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM();
229
+ } catch (t) {
230
+ throw e = !1, this._$EM(), t;
231
+ }
232
+ e && this._$AE(t);
233
+ }
234
+ willUpdate(e) {}
235
+ _$AE(e) {
236
+ this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
237
+ }
238
+ _$EM() {
239
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
240
+ }
241
+ get updateComplete() {
242
+ return this.getUpdateComplete();
243
+ }
244
+ getUpdateComplete() {
245
+ return this._$ES;
246
+ }
247
+ shouldUpdate(e) {
248
+ return !0;
249
+ }
250
+ update(e) {
251
+ this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM();
252
+ }
253
+ updated(e) {}
254
+ firstUpdated(e) {}
251
255
  };
252
- R.elementStyles = [], R.shadowRootOptions = { mode: "open" }, R[U("elementProperties")] = /* @__PURE__ */ new Map(), R[U("finalized")] = /* @__PURE__ */ new Map(), fe?.({ ReactiveElement: R }), (G.reactiveElementVersions ??= []).push("2.1.2");
253
- const rt = globalThis, $t = (s) => s, W = rt.trustedTypes, gt = W ? W.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, Mt = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, Tt = "?" + _, me = `<${Tt}>`, C = document, H = () => C.createComment(""), I = (s) => s === null || typeof s != "object" && typeof s != "function", nt = Array.isArray, $e = (s) => nt(s) || typeof s?.[Symbol.iterator] == "function", J = `[
254
- \f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, bt = /-->/g, vt = />/g, E = RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
255
- \f\r"'\`<>=]|("|')|))|$)`, "g"), yt = /'/g, _t = /"/g, kt = /^(?:script|style|textarea|title)$/i, ge = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), h = ge(1), w = /* @__PURE__ */ Symbol.for("lit-noChange"), p = /* @__PURE__ */ Symbol.for("lit-nothing"), At = /* @__PURE__ */ new WeakMap(), S = C.createTreeWalker(C, 129);
256
- function Ut(s, t) {
257
- if (!nt(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
258
- return gt !== void 0 ? gt.createHTML(t) : t;
256
+ x.elementStyles = [], x.shadowRootOptions = { mode: "open" }, x[v("elementProperties")] = /* @__PURE__ */ new Map(), x[v("finalized")] = /* @__PURE__ */ new Map(), ge?.({ ReactiveElement: x }), (_.reactiveElementVersions ??= []).push("2.1.2");
257
+ //#endregion
258
+ //#region ../../node_modules/lit-html/lit-html.js
259
+ var ve = globalThis, ye = (e) => e, S = ve.trustedTypes, be = S ? S.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, xe = "$lit$", C = `lit$${Math.random().toFixed(9).slice(2)}$`, Se = "?" + C, Ce = `<${Se}>`, w = document, T = () => w.createComment(""), E = (e) => e === null || typeof e != "object" && typeof e != "function", D = Array.isArray, we = (e) => D(e) || typeof e?.[Symbol.iterator] == "function", O = "[ \n\f\r]", k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Te = /-->/g, Ee = />/g, A = RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), De = /'/g, Oe = /"/g, ke = /^(?:script|style|textarea|title)$/i, j = ((e) => (t, ...n) => ({
260
+ _$litType$: e,
261
+ strings: t,
262
+ values: n
263
+ }))(1), M = Symbol.for("lit-noChange"), N = Symbol.for("lit-nothing"), Ae = /* @__PURE__ */ new WeakMap(), P = w.createTreeWalker(w, 129);
264
+ function je(e, t) {
265
+ if (!D(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
266
+ return be === void 0 ? t : be.createHTML(t);
259
267
  }
260
- const be = (s, t) => {
261
- const e = s.length - 1, i = [];
262
- let r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = k;
263
- for (let l = 0; l < e; l++) {
264
- const a = s[l];
265
- let d, u, c = -1, f = 0;
266
- for (; f < a.length && (o.lastIndex = f, u = o.exec(a), u !== null); ) f = o.lastIndex, o === k ? u[1] === "!--" ? o = bt : u[1] !== void 0 ? o = vt : u[2] !== void 0 ? (kt.test(u[2]) && (r = RegExp("</" + u[2], "g")), o = E) : u[3] !== void 0 && (o = E) : o === E ? u[0] === ">" ? (o = r ?? k, c = -1) : u[1] === void 0 ? c = -2 : (c = o.lastIndex - u[2].length, d = u[1], o = u[3] === void 0 ? E : u[3] === '"' ? _t : yt) : o === _t || o === yt ? o = E : o === bt || o === vt ? o = k : (o = E, r = void 0);
267
- const m = o === E && s[l + 1].startsWith("/>") ? " " : "";
268
- n += o === k ? a + me : c >= 0 ? (i.push(d), a.slice(0, c) + Mt + a.slice(c) + _ + m) : a + _ + (c === -2 ? l : m);
269
- }
270
- return [Ut(s, n + (s[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
268
+ var Me = (e, t) => {
269
+ let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = k;
270
+ for (let t = 0; t < n; t++) {
271
+ let n = e[t], s, c, l = -1, u = 0;
272
+ for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === k ? c[1] === "!--" ? o = Te : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = A) : (ke.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = A) : o = Ee : o === A ? c[0] === ">" ? (o = i ?? k, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? A : c[3] === "\"" ? Oe : De) : o === Oe || o === De ? o = A : o === Te || o === Ee ? o = k : (o = A, i = void 0);
273
+ let d = o === A && e[t + 1].startsWith("/>") ? " " : "";
274
+ a += o === k ? n + Ce : l >= 0 ? (r.push(s), n.slice(0, l) + xe + n.slice(l) + C + d) : n + C + (l === -2 ? t : d);
275
+ }
276
+ return [je(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
277
+ }, F = class e {
278
+ constructor({ strings: t, _$litType$: n }, r) {
279
+ let i;
280
+ this.parts = [];
281
+ let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = Me(t, n);
282
+ if (this.el = e.createElement(l, r), P.currentNode = this.el.content, n === 2 || n === 3) {
283
+ let e = this.el.content.firstChild;
284
+ e.replaceWith(...e.childNodes);
285
+ }
286
+ for (; (i = P.nextNode()) !== null && c.length < s;) {
287
+ if (i.nodeType === 1) {
288
+ if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(xe)) {
289
+ let t = u[o++], n = i.getAttribute(e).split(C), r = /([.?@])?(.*)/.exec(t);
290
+ c.push({
291
+ type: 1,
292
+ index: a,
293
+ name: r[2],
294
+ strings: n,
295
+ ctor: r[1] === "." ? Pe : r[1] === "?" ? Fe : r[1] === "@" ? Ie : R
296
+ }), i.removeAttribute(e);
297
+ } else e.startsWith(C) && (c.push({
298
+ type: 6,
299
+ index: a
300
+ }), i.removeAttribute(e));
301
+ if (ke.test(i.tagName)) {
302
+ let e = i.textContent.split(C), t = e.length - 1;
303
+ if (t > 0) {
304
+ i.textContent = S ? S.emptyScript : "";
305
+ for (let n = 0; n < t; n++) i.append(e[n], T()), P.nextNode(), c.push({
306
+ type: 2,
307
+ index: ++a
308
+ });
309
+ i.append(e[t], T());
310
+ }
311
+ }
312
+ } else if (i.nodeType === 8) if (i.data === Se) c.push({
313
+ type: 2,
314
+ index: a
315
+ });
316
+ else {
317
+ let e = -1;
318
+ for (; (e = i.data.indexOf(C, e + 1)) !== -1;) c.push({
319
+ type: 7,
320
+ index: a
321
+ }), e += C.length - 1;
322
+ }
323
+ a++;
324
+ }
325
+ }
326
+ static createElement(e, t) {
327
+ let n = w.createElement("template");
328
+ return n.innerHTML = e, n;
329
+ }
271
330
  };
272
- class O {
273
- constructor({ strings: t, _$litType$: e }, i) {
274
- let r;
275
- this.parts = [];
276
- let n = 0, o = 0;
277
- const l = t.length - 1, a = this.parts, [d, u] = be(t, e);
278
- if (this.el = O.createElement(d, i), S.currentNode = this.el.content, e === 2 || e === 3) {
279
- const c = this.el.content.firstChild;
280
- c.replaceWith(...c.childNodes);
281
- }
282
- for (; (r = S.nextNode()) !== null && a.length < l; ) {
283
- if (r.nodeType === 1) {
284
- if (r.hasAttributes()) for (const c of r.getAttributeNames()) if (c.endsWith(Mt)) {
285
- const f = u[o++], m = r.getAttribute(c).split(_), g = /([.?@])?(.*)/.exec(f);
286
- a.push({ type: 1, index: n, name: g[2], strings: m, ctor: g[1] === "." ? ye : g[1] === "?" ? _e : g[1] === "@" ? Ae : B }), r.removeAttribute(c);
287
- } else c.startsWith(_) && (a.push({ type: 6, index: n }), r.removeAttribute(c));
288
- if (kt.test(r.tagName)) {
289
- const c = r.textContent.split(_), f = c.length - 1;
290
- if (f > 0) {
291
- r.textContent = W ? W.emptyScript : "";
292
- for (let m = 0; m < f; m++) r.append(c[m], H()), S.nextNode(), a.push({ type: 2, index: ++n });
293
- r.append(c[f], H());
294
- }
295
- }
296
- } else if (r.nodeType === 8) if (r.data === Tt) a.push({ type: 2, index: n });
297
- else {
298
- let c = -1;
299
- for (; (c = r.data.indexOf(_, c + 1)) !== -1; ) a.push({ type: 7, index: n }), c += _.length - 1;
300
- }
301
- n++;
302
- }
303
- }
304
- static createElement(t, e) {
305
- const i = C.createElement("template");
306
- return i.innerHTML = t, i;
307
- }
308
- }
309
- function T(s, t, e = s, i) {
310
- if (t === w) return t;
311
- let r = i !== void 0 ? e._$Co?.[i] : e._$Cl;
312
- const n = I(t) ? void 0 : t._$litDirective$;
313
- return r?.constructor !== n && (r?._$AO?.(!1), n === void 0 ? r = void 0 : (r = new n(s), r._$AT(s, e, i)), i !== void 0 ? (e._$Co ??= [])[i] = r : e._$Cl = r), r !== void 0 && (t = T(s, r._$AS(s, t.values), r, i)), t;
314
- }
315
- class ve {
316
- constructor(t, e) {
317
- this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
318
- }
319
- get parentNode() {
320
- return this._$AM.parentNode;
321
- }
322
- get _$AU() {
323
- return this._$AM._$AU;
324
- }
325
- u(t) {
326
- const { el: { content: e }, parts: i } = this._$AD, r = (t?.creationScope ?? C).importNode(e, !0);
327
- S.currentNode = r;
328
- let n = S.nextNode(), o = 0, l = 0, a = i[0];
329
- for (; a !== void 0; ) {
330
- if (o === a.index) {
331
- let d;
332
- a.type === 2 ? d = new V(n, n.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (d = new Ee(n, this, t)), this._$AV.push(d), a = i[++l];
333
- }
334
- o !== a?.index && (n = S.nextNode(), o++);
335
- }
336
- return S.currentNode = C, r;
337
- }
338
- p(t) {
339
- let e = 0;
340
- for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
341
- }
342
- }
343
- class V {
344
- get _$AU() {
345
- return this._$AM?._$AU ?? this._$Cv;
346
- }
347
- constructor(t, e, i, r) {
348
- this.type = 2, this._$AH = p, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = r, this._$Cv = r?.isConnected ?? !0;
349
- }
350
- get parentNode() {
351
- let t = this._$AA.parentNode;
352
- const e = this._$AM;
353
- return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t;
354
- }
355
- get startNode() {
356
- return this._$AA;
357
- }
358
- get endNode() {
359
- return this._$AB;
360
- }
361
- _$AI(t, e = this) {
362
- t = T(this, t, e), I(t) ? t === p || t == null || t === "" ? (this._$AH !== p && this._$AR(), this._$AH = p) : t !== this._$AH && t !== w && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : $e(t) ? this.k(t) : this._(t);
363
- }
364
- O(t) {
365
- return this._$AA.parentNode.insertBefore(t, this._$AB);
366
- }
367
- T(t) {
368
- this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
369
- }
370
- _(t) {
371
- this._$AH !== p && I(this._$AH) ? this._$AA.nextSibling.data = t : this.T(C.createTextNode(t)), this._$AH = t;
372
- }
373
- $(t) {
374
- const { values: e, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = O.createElement(Ut(i.h, i.h[0]), this.options)), i);
375
- if (this._$AH?._$AD === r) this._$AH.p(e);
376
- else {
377
- const n = new ve(r, this), o = n.u(this.options);
378
- n.p(e), this.T(o), this._$AH = n;
379
- }
380
- }
381
- _$AC(t) {
382
- let e = At.get(t.strings);
383
- return e === void 0 && At.set(t.strings, e = new O(t)), e;
384
- }
385
- k(t) {
386
- nt(this._$AH) || (this._$AH = [], this._$AR());
387
- const e = this._$AH;
388
- let i, r = 0;
389
- for (const n of t) r === e.length ? e.push(i = new V(this.O(H()), this.O(H()), this, this.options)) : i = e[r], i._$AI(n), r++;
390
- r < e.length && (this._$AR(i && i._$AB.nextSibling, r), e.length = r);
391
- }
392
- _$AR(t = this._$AA.nextSibling, e) {
393
- for (this._$AP?.(!1, !0, e); t !== this._$AB; ) {
394
- const i = $t(t).nextSibling;
395
- $t(t).remove(), t = i;
396
- }
397
- }
398
- setConnected(t) {
399
- this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
400
- }
401
- }
402
- class B {
403
- get tagName() {
404
- return this.element.tagName;
405
- }
406
- get _$AU() {
407
- return this._$AM._$AU;
408
- }
409
- constructor(t, e, i, r, n) {
410
- this.type = 1, this._$AH = p, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, this.options = n, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = p;
411
- }
412
- _$AI(t, e = this, i, r) {
413
- const n = this.strings;
414
- let o = !1;
415
- if (n === void 0) t = T(this, t, e, 0), o = !I(t) || t !== this._$AH && t !== w, o && (this._$AH = t);
416
- else {
417
- const l = t;
418
- let a, d;
419
- for (t = n[0], a = 0; a < n.length - 1; a++) d = T(this, l[i + a], e, a), d === w && (d = this._$AH[a]), o ||= !I(d) || d !== this._$AH[a], d === p ? t = p : t !== p && (t += (d ?? "") + n[a + 1]), this._$AH[a] = d;
420
- }
421
- o && !r && this.j(t);
422
- }
423
- j(t) {
424
- t === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
425
- }
426
- }
427
- class ye extends B {
428
- constructor() {
429
- super(...arguments), this.type = 3;
430
- }
431
- j(t) {
432
- this.element[this.name] = t === p ? void 0 : t;
433
- }
434
- }
435
- class _e extends B {
436
- constructor() {
437
- super(...arguments), this.type = 4;
438
- }
439
- j(t) {
440
- this.element.toggleAttribute(this.name, !!t && t !== p);
441
- }
442
- }
443
- class Ae extends B {
444
- constructor(t, e, i, r, n) {
445
- super(t, e, i, r, n), this.type = 5;
446
- }
447
- _$AI(t, e = this) {
448
- if ((t = T(this, t, e, 0) ?? p) === w) return;
449
- const i = this._$AH, r = t === p && i !== p || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, n = t !== p && (i === p || r);
450
- r && this.element.removeEventListener(this.name, this, i), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
451
- }
452
- handleEvent(t) {
453
- typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
454
- }
455
- }
456
- class Ee {
457
- constructor(t, e, i) {
458
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
459
- }
460
- get _$AU() {
461
- return this._$AM._$AU;
462
- }
463
- _$AI(t) {
464
- T(this, t);
465
- }
331
+ function I(e, t, n = e, r) {
332
+ if (t === M) return t;
333
+ let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = E(t) ? void 0 : t._$litDirective$;
334
+ return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = I(e, i._$AS(e, t.values), i, r)), t;
466
335
  }
467
- const Se = rt.litHtmlPolyfillSupport;
468
- Se?.(O, V), (rt.litHtmlVersions ??= []).push("3.3.2");
469
- const Ce = (s, t, e) => {
470
- const i = e?.renderBefore ?? t;
471
- let r = i._$litPart$;
472
- if (r === void 0) {
473
- const n = e?.renderBefore ?? null;
474
- i._$litPart$ = r = new V(t.insertBefore(H(), n), n, void 0, e ?? {});
475
- }
476
- return r._$AI(s), r;
336
+ var Ne = class {
337
+ constructor(e, t) {
338
+ this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
339
+ }
340
+ get parentNode() {
341
+ return this._$AM.parentNode;
342
+ }
343
+ get _$AU() {
344
+ return this._$AM._$AU;
345
+ }
346
+ u(e) {
347
+ let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? w).importNode(t, !0);
348
+ P.currentNode = r;
349
+ let i = P.nextNode(), a = 0, o = 0, s = n[0];
350
+ for (; s !== void 0;) {
351
+ if (a === s.index) {
352
+ let t;
353
+ s.type === 2 ? t = new L(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new Le(i, this, e)), this._$AV.push(t), s = n[++o];
354
+ }
355
+ a !== s?.index && (i = P.nextNode(), a++);
356
+ }
357
+ return P.currentNode = w, r;
358
+ }
359
+ p(e) {
360
+ let t = 0;
361
+ for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
362
+ }
363
+ }, L = class e {
364
+ get _$AU() {
365
+ return this._$AM?._$AU ?? this._$Cv;
366
+ }
367
+ constructor(e, t, n, r) {
368
+ this.type = 2, this._$AH = N, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
369
+ }
370
+ get parentNode() {
371
+ let e = this._$AA.parentNode, t = this._$AM;
372
+ return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
373
+ }
374
+ get startNode() {
375
+ return this._$AA;
376
+ }
377
+ get endNode() {
378
+ return this._$AB;
379
+ }
380
+ _$AI(e, t = this) {
381
+ e = I(this, e, t), E(e) ? e === N || e == null || e === "" ? (this._$AH !== N && this._$AR(), this._$AH = N) : e !== this._$AH && e !== M && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? we(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
382
+ }
383
+ O(e) {
384
+ return this._$AA.parentNode.insertBefore(e, this._$AB);
385
+ }
386
+ T(e) {
387
+ this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
388
+ }
389
+ _(e) {
390
+ this._$AH !== N && E(this._$AH) ? this._$AA.nextSibling.data = e : this.T(w.createTextNode(e)), this._$AH = e;
391
+ }
392
+ $(e) {
393
+ let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = F.createElement(je(n.h, n.h[0]), this.options)), n);
394
+ if (this._$AH?._$AD === r) this._$AH.p(t);
395
+ else {
396
+ let e = new Ne(r, this), n = e.u(this.options);
397
+ e.p(t), this.T(n), this._$AH = e;
398
+ }
399
+ }
400
+ _$AC(e) {
401
+ let t = Ae.get(e.strings);
402
+ return t === void 0 && Ae.set(e.strings, t = new F(e)), t;
403
+ }
404
+ k(t) {
405
+ D(this._$AH) || (this._$AH = [], this._$AR());
406
+ let n = this._$AH, r, i = 0;
407
+ for (let a of t) i === n.length ? n.push(r = new e(this.O(T()), this.O(T()), this, this.options)) : r = n[i], r._$AI(a), i++;
408
+ i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
409
+ }
410
+ _$AR(e = this._$AA.nextSibling, t) {
411
+ for (this._$AP?.(!1, !0, t); e !== this._$AB;) {
412
+ let t = ye(e).nextSibling;
413
+ ye(e).remove(), e = t;
414
+ }
415
+ }
416
+ setConnected(e) {
417
+ this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
418
+ }
419
+ }, R = class {
420
+ get tagName() {
421
+ return this.element.tagName;
422
+ }
423
+ get _$AU() {
424
+ return this._$AM._$AU;
425
+ }
426
+ constructor(e, t, n, r, i) {
427
+ this.type = 1, this._$AH = N, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = N;
428
+ }
429
+ _$AI(e, t = this, n, r) {
430
+ let i = this.strings, a = !1;
431
+ if (i === void 0) e = I(this, e, t, 0), a = !E(e) || e !== this._$AH && e !== M, a && (this._$AH = e);
432
+ else {
433
+ let r = e, o, s;
434
+ for (e = i[0], o = 0; o < i.length - 1; o++) s = I(this, r[n + o], t, o), s === M && (s = this._$AH[o]), a ||= !E(s) || s !== this._$AH[o], s === N ? e = N : e !== N && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
435
+ }
436
+ a && !r && this.j(e);
437
+ }
438
+ j(e) {
439
+ e === N ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
440
+ }
441
+ }, Pe = class extends R {
442
+ constructor() {
443
+ super(...arguments), this.type = 3;
444
+ }
445
+ j(e) {
446
+ this.element[this.name] = e === N ? void 0 : e;
447
+ }
448
+ }, Fe = class extends R {
449
+ constructor() {
450
+ super(...arguments), this.type = 4;
451
+ }
452
+ j(e) {
453
+ this.element.toggleAttribute(this.name, !!e && e !== N);
454
+ }
455
+ }, Ie = class extends R {
456
+ constructor(e, t, n, r, i) {
457
+ super(e, t, n, r, i), this.type = 5;
458
+ }
459
+ _$AI(e, t = this) {
460
+ if ((e = I(this, e, t, 0) ?? N) === M) return;
461
+ let n = this._$AH, r = e === N && n !== N || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== N && (n === N || r);
462
+ r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
463
+ }
464
+ handleEvent(e) {
465
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
466
+ }
467
+ }, Le = class {
468
+ constructor(e, t, n) {
469
+ this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
470
+ }
471
+ get _$AU() {
472
+ return this._$AM._$AU;
473
+ }
474
+ _$AI(e) {
475
+ I(this, e);
476
+ }
477
+ }, Re = {
478
+ M: xe,
479
+ P: C,
480
+ A: Se,
481
+ C: 1,
482
+ L: Me,
483
+ R: Ne,
484
+ D: we,
485
+ V: I,
486
+ I: L,
487
+ H: R,
488
+ N: Fe,
489
+ U: Ie,
490
+ B: Pe,
491
+ F: Le
492
+ }, ze = ve.litHtmlPolyfillSupport;
493
+ ze?.(F, L), (ve.litHtmlVersions ??= []).push("3.3.2");
494
+ var Be = (e, t, n) => {
495
+ let r = n?.renderBefore ?? t, i = r._$litPart$;
496
+ if (i === void 0) {
497
+ let e = n?.renderBefore ?? null;
498
+ r._$litPart$ = i = new L(t.insertBefore(T(), e), e, void 0, n ?? {});
499
+ }
500
+ return i._$AI(e), i;
501
+ }, z = globalThis, B = class extends x {
502
+ constructor() {
503
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
504
+ }
505
+ createRenderRoot() {
506
+ let e = super.createRenderRoot();
507
+ return this.renderOptions.renderBefore ??= e.firstChild, e;
508
+ }
509
+ update(e) {
510
+ let t = this.render();
511
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Be(t, this.renderRoot, this.renderOptions);
512
+ }
513
+ connectedCallback() {
514
+ super.connectedCallback(), this._$Do?.setConnected(!0);
515
+ }
516
+ disconnectedCallback() {
517
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
518
+ }
519
+ render() {
520
+ return M;
521
+ }
477
522
  };
478
- const ot = globalThis;
479
- let M = class extends R {
480
- constructor() {
481
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
482
- }
483
- createRenderRoot() {
484
- const t = super.createRenderRoot();
485
- return this.renderOptions.renderBefore ??= t.firstChild, t;
486
- }
487
- update(t) {
488
- const e = this.render();
489
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ce(e, this.renderRoot, this.renderOptions);
490
- }
491
- connectedCallback() {
492
- super.connectedCallback(), this._$Do?.setConnected(!0);
493
- }
494
- disconnectedCallback() {
495
- super.disconnectedCallback(), this._$Do?.setConnected(!1);
496
- }
497
- render() {
498
- return w;
499
- }
523
+ B._$litElement$ = !0, B.finalized = !0, z.litElementHydrateSupport?.({ LitElement: B });
524
+ var Ve = z.litElementPolyfillSupport;
525
+ Ve?.({ LitElement: B }), (z.litElementVersions ??= []).push("4.2.2");
526
+ //#endregion
527
+ //#region ../../node_modules/lit-html/static.js
528
+ var He = Symbol.for(""), Ue = (e) => {
529
+ if (e?.r === He) return e?._$litStatic$;
530
+ }, We = (e) => ({
531
+ _$litStatic$: e,
532
+ r: He
533
+ }), Ge = /* @__PURE__ */ new Map(), V = ((e) => (t, ...n) => {
534
+ let r = n.length, i, a, o = [], s = [], c, l = 0, u = !1;
535
+ for (; l < r;) {
536
+ for (c = t[l]; l < r && (a = n[l], i = Ue(a)) !== void 0;) c += i + t[++l], u = !0;
537
+ l !== r && s.push(a), o.push(c), l++;
538
+ }
539
+ if (l === r && o.push(t[r]), u) {
540
+ let e = o.join("$$lit$$");
541
+ (t = Ge.get(e)) === void 0 && (o.raw = o, Ge.set(e, t = o)), n = s;
542
+ }
543
+ return e(t, ...n);
544
+ })(j), Ke = {
545
+ attribute: !0,
546
+ type: String,
547
+ converter: y,
548
+ reflect: !1,
549
+ hasChanged: b
550
+ }, qe = (e = Ke, t, n) => {
551
+ let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i);
552
+ if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") {
553
+ let { name: r } = n;
554
+ return {
555
+ set(n) {
556
+ let i = t.get.call(this);
557
+ t.set.call(this, n), this.requestUpdate(r, i, e, !0, n);
558
+ },
559
+ init(t) {
560
+ return t !== void 0 && this.C(r, void 0, e, t), t;
561
+ }
562
+ };
563
+ }
564
+ if (r === "setter") {
565
+ let { name: r } = n;
566
+ return function(n) {
567
+ let i = this[r];
568
+ t.call(this, n), this.requestUpdate(r, i, e, !0, n);
569
+ };
570
+ }
571
+ throw Error("Unsupported decorator location: " + r);
500
572
  };
501
- M._$litElement$ = !0, M.finalized = !0, ot.litElementHydrateSupport?.({ LitElement: M });
502
- const we = ot.litElementPolyfillSupport;
503
- we?.({ LitElement: M });
504
- (ot.litElementVersions ??= []).push("4.2.2");
505
- const Pt = /* @__PURE__ */ Symbol.for(""), xe = (s) => {
506
- if (s?.r === Pt) return s?._$litStatic$;
507
- }, Nt = (s) => ({ _$litStatic$: s, r: Pt }), Et = /* @__PURE__ */ new Map(), Re = (s) => (t, ...e) => {
508
- const i = e.length;
509
- let r, n;
510
- const o = [], l = [];
511
- let a, d = 0, u = !1;
512
- for (; d < i; ) {
513
- for (a = t[d]; d < i && (n = e[d], (r = xe(n)) !== void 0); ) a += r + t[++d], u = !0;
514
- d !== i && l.push(n), o.push(a), d++;
515
- }
516
- if (d === i && o.push(t[i]), u) {
517
- const c = o.join("$$lit$$");
518
- (t = Et.get(c)) === void 0 && (o.raw = o, Et.set(c, t = o)), e = l;
519
- }
520
- return s(t, ...e);
521
- }, L = Re(h);
522
- const Me = { attribute: !0, type: String, converter: j, reflect: !1, hasChanged: it }, Te = (s = Me, t, e) => {
523
- const { kind: i, metadata: r } = e;
524
- let n = globalThis.litPropertyMetadata.get(r);
525
- if (n === void 0 && globalThis.litPropertyMetadata.set(r, n = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), n.set(e.name, s), i === "accessor") {
526
- const { name: o } = e;
527
- return { set(l) {
528
- const a = t.get.call(this);
529
- t.set.call(this, l), this.requestUpdate(o, a, s, !0, l);
530
- }, init(l) {
531
- return l !== void 0 && this.C(o, void 0, s, l), l;
532
- } };
533
- }
534
- if (i === "setter") {
535
- const { name: o } = e;
536
- return function(l) {
537
- const a = this[o];
538
- t.call(this, l), this.requestUpdate(o, a, s, !0, l);
539
- };
540
- }
541
- throw Error("Unsupported decorator location: " + i);
542
- };
543
- function $(s) {
544
- return (t, e) => typeof e == "object" ? Te(s, t, e) : ((i, r, n) => {
545
- const o = r.hasOwnProperty(n);
546
- return r.constructor.createProperty(n, i), o ? Object.getOwnPropertyDescriptor(r, n) : void 0;
547
- })(s, t, e);
548
- }
549
- function K(s) {
550
- return $({ ...s, state: !0, attribute: !1 });
551
- }
552
- const ke = /^[a-z][a-z0-9]*(-[a-z0-9]+)+$/;
553
- function P(s) {
554
- if (!ke.test(s))
555
- throw new Error(
556
- `[Formie WC] Invalid custom element tag "${s}". Use lowercase hyphenated names (e.g. my-text-field).`
557
- );
573
+ function H(e) {
574
+ return (t, n) => typeof n == "object" ? qe(e, t, n) : ((e, t, n) => {
575
+ let r = t.hasOwnProperty(n);
576
+ return t.constructor.createProperty(n, e), r ? Object.getOwnPropertyDescriptor(t, n) : void 0;
577
+ })(e, t, n);
558
578
  }
559
- class Z {
560
- constructor() {
561
- this.fieldControls = {}, this.fieldTag = null, this.regions = {};
562
- }
563
- registerFieldControl(t, e) {
564
- return P(e), this.fieldControls[t] = e, this;
565
- }
566
- /** Register a custom element used as the **field** host for every question. */
567
- registerField(t) {
568
- return P(t), this.fieldTag = t, this;
569
- }
570
- registerRegion(t, e) {
571
- return P(e), this.regions[t] = e, this;
572
- }
573
- clone() {
574
- const t = new Z();
575
- return t.fieldControls = { ...this.fieldControls }, t.fieldTag = this.fieldTag, t.regions = { ...this.regions }, t;
576
- }
579
+ //#endregion
580
+ //#region ../../node_modules/@lit/reactive-element/decorators/state.js
581
+ function U(e) {
582
+ return H({
583
+ ...e,
584
+ state: !0,
585
+ attribute: !1
586
+ });
577
587
  }
578
- const Ue = new Z();
579
- function Pe() {
580
- return Ue;
588
+ //#endregion
589
+ //#region src/registry.ts
590
+ var Je = /^[a-z][a-z0-9]*(-[a-z0-9]+)+$/;
591
+ function W(e) {
592
+ if (!Je.test(e)) throw Error(`[Formie WC] Invalid custom element tag "${e}". Use lowercase hyphenated names (e.g. my-text-field).`);
581
593
  }
582
- function us() {
583
- return new Z();
594
+ var G = class e {
595
+ constructor() {
596
+ this.fieldControls = {}, this.fieldTag = null, this.regions = {};
597
+ }
598
+ registerFieldControl(e, t) {
599
+ return W(t), this.fieldControls[e] = t, this;
600
+ }
601
+ registerField(e) {
602
+ return W(e), this.fieldTag = e, this;
603
+ }
604
+ registerRegion(e, t) {
605
+ return W(t), this.regions[e] = t, this;
606
+ }
607
+ clone() {
608
+ let t = new e();
609
+ return t.fieldControls = { ...this.fieldControls }, t.fieldTag = this.fieldTag, t.regions = { ...this.regions }, t;
610
+ }
611
+ }, Ye = new G();
612
+ function Xe() {
613
+ return Ye;
584
614
  }
585
- const Ne = (s) => s.strings === void 0;
586
- const Ht = { CHILD: 2 }, It = (s) => (...t) => ({ _$litDirective$: s, values: t });
587
- class Ot {
588
- constructor(t) {
589
- }
590
- get _$AU() {
591
- return this._$AM._$AU;
592
- }
593
- _$AT(t, e, i) {
594
- this._$Ct = t, this._$AM = e, this._$Ci = i;
595
- }
596
- _$AS(t, e) {
597
- return this.update(t, e);
598
- }
599
- update(t, e) {
600
- return this.render(...e);
601
- }
615
+ function Ze() {
616
+ return new G();
602
617
  }
603
- const N = (s, t) => {
604
- const e = s._$AN;
605
- if (e === void 0) return !1;
606
- for (const i of e) i._$AO?.(t, !1), N(i, t);
607
- return !0;
608
- }, q = (s) => {
609
- let t, e;
610
- do {
611
- if ((t = s._$AM) === void 0) break;
612
- e = t._$AN, e.delete(s), s = t;
613
- } while (e?.size === 0);
614
- }, Lt = (s) => {
615
- for (let t; t = s._$AM; s = t) {
616
- let e = t._$AN;
617
- if (e === void 0) t._$AN = e = /* @__PURE__ */ new Set();
618
- else if (e.has(s)) break;
619
- e.add(s), Oe(t);
620
- }
618
+ //#endregion
619
+ //#region ../../node_modules/lit-html/directive-helpers.js
620
+ var { I: Qe } = Re, $e = (e) => e.strings === void 0, et = {
621
+ ATTRIBUTE: 1,
622
+ CHILD: 2,
623
+ PROPERTY: 3,
624
+ BOOLEAN_ATTRIBUTE: 4,
625
+ EVENT: 5,
626
+ ELEMENT: 6
627
+ }, tt = (e) => (...t) => ({
628
+ _$litDirective$: e,
629
+ values: t
630
+ }), nt = class {
631
+ constructor(e) {}
632
+ get _$AU() {
633
+ return this._$AM._$AU;
634
+ }
635
+ _$AT(e, t, n) {
636
+ this._$Ct = e, this._$AM = t, this._$Ci = n;
637
+ }
638
+ _$AS(e, t) {
639
+ return this.update(e, t);
640
+ }
641
+ update(e, t) {
642
+ return this.render(...t);
643
+ }
644
+ }, K = (e, t) => {
645
+ let n = e._$AN;
646
+ if (n === void 0) return !1;
647
+ for (let e of n) e._$AO?.(t, !1), K(e, t);
648
+ return !0;
649
+ }, q = (e) => {
650
+ let t, n;
651
+ do {
652
+ if ((t = e._$AM) === void 0) break;
653
+ n = t._$AN, n.delete(e), e = t;
654
+ } while (n?.size === 0);
655
+ }, rt = (e) => {
656
+ for (let t; t = e._$AM; e = t) {
657
+ let n = t._$AN;
658
+ if (n === void 0) t._$AN = n = /* @__PURE__ */ new Set();
659
+ else if (n.has(e)) break;
660
+ n.add(e), ot(t);
661
+ }
621
662
  };
622
- function He(s) {
623
- this._$AN !== void 0 ? (q(this), this._$AM = s, Lt(this)) : this._$AM = s;
663
+ function it(e) {
664
+ this._$AN === void 0 ? this._$AM = e : (q(this), this._$AM = e, rt(this));
624
665
  }
625
- function Ie(s, t = !1, e = 0) {
626
- const i = this._$AH, r = this._$AN;
627
- if (r !== void 0 && r.size !== 0) if (t) if (Array.isArray(i)) for (let n = e; n < i.length; n++) N(i[n], !1), q(i[n]);
628
- else i != null && (N(i, !1), q(i));
629
- else N(this, s);
666
+ function at(e, t = !1, n = 0) {
667
+ let r = this._$AH, i = this._$AN;
668
+ if (i !== void 0 && i.size !== 0) if (t) if (Array.isArray(r)) for (let e = n; e < r.length; e++) K(r[e], !1), q(r[e]);
669
+ else r != null && (K(r, !1), q(r));
670
+ else K(this, e);
630
671
  }
631
- const Oe = (s) => {
632
- s.type == Ht.CHILD && (s._$AP ??= Ie, s._$AQ ??= He);
672
+ var ot = (e) => {
673
+ e.type == et.CHILD && (e._$AP ??= at, e._$AQ ??= it);
674
+ }, st = class extends nt {
675
+ constructor() {
676
+ super(...arguments), this._$AN = void 0;
677
+ }
678
+ _$AT(e, t, n) {
679
+ super._$AT(e, t, n), rt(this), this.isConnected = e._$AU;
680
+ }
681
+ _$AO(e, t = !0) {
682
+ e !== this.isConnected && (this.isConnected = e, e ? this.reconnected?.() : this.disconnected?.()), t && (K(this, e), q(this));
683
+ }
684
+ setValue(e) {
685
+ if ($e(this._$Ct)) this._$Ct._$AI(e, this);
686
+ else {
687
+ let t = [...this._$Ct._$AH];
688
+ t[this._$Ci] = e, this._$Ct._$AI(t, this, 0);
689
+ }
690
+ }
691
+ disconnected() {}
692
+ reconnected() {}
693
+ }, ct = /* @__PURE__ */ new WeakMap(), lt = tt(class extends st {
694
+ render(e) {
695
+ return N;
696
+ }
697
+ update(e, [t]) {
698
+ let n = t !== this.G;
699
+ return n && this.G !== void 0 && this.rt(void 0), (n || this.lt !== this.ct) && (this.G = t, this.ht = e.options?.host, this.rt(this.ct = e.element)), N;
700
+ }
701
+ rt(e) {
702
+ if (this.isConnected || (e = void 0), typeof this.G == "function") {
703
+ let t = this.ht ?? globalThis, n = ct.get(t);
704
+ n === void 0 && (n = /* @__PURE__ */ new WeakMap(), ct.set(t, n)), n.get(this.G) !== void 0 && this.G.call(this.ht, void 0), n.set(this.G, e), e !== void 0 && this.G.call(this.ht, e);
705
+ } else this.G.value = e;
706
+ }
707
+ get lt() {
708
+ return typeof this.G == "function" ? ct.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
709
+ }
710
+ disconnected() {
711
+ this.lt === this.ct && this.rt(void 0);
712
+ }
713
+ reconnected() {
714
+ this.rt(this.ct);
715
+ }
716
+ }), ut = class extends nt {
717
+ constructor(e) {
718
+ if (super(e), this.it = N, e.type !== et.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
719
+ }
720
+ render(e) {
721
+ if (e === N || e == null) return this._t = void 0, this.it = e;
722
+ if (e === M) return e;
723
+ if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
724
+ if (e === this.it) return this._t;
725
+ this.it = e;
726
+ let t = [e];
727
+ return t.raw = t, this._t = {
728
+ _$litType$: this.constructor.resultType,
729
+ strings: t,
730
+ values: []
731
+ };
732
+ }
633
733
  };
634
- class Le extends Ot {
635
- constructor() {
636
- super(...arguments), this._$AN = void 0;
637
- }
638
- _$AT(t, e, i) {
639
- super._$AT(t, e, i), Lt(this), this.isConnected = t._$AU;
640
- }
641
- _$AO(t, e = !0) {
642
- t !== this.isConnected && (this.isConnected = t, t ? this.reconnected?.() : this.disconnected?.()), e && (N(this, t), q(this));
643
- }
644
- setValue(t) {
645
- if (Ne(this._$Ct)) this._$Ct._$AI(t, this);
646
- else {
647
- const e = [...this._$Ct._$AH];
648
- e[this._$Ci] = t, this._$Ct._$AI(e, this, 0);
649
- }
650
- }
651
- disconnected() {
652
- }
653
- reconnected() {
654
- }
655
- }
656
- const Q = /* @__PURE__ */ new WeakMap(), Ve = It(class extends Le {
657
- render(s) {
658
- return p;
659
- }
660
- update(s, [t]) {
661
- const e = t !== this.G;
662
- return e && this.G !== void 0 && this.rt(void 0), (e || this.lt !== this.ct) && (this.G = t, this.ht = s.options?.host, this.rt(this.ct = s.element)), p;
663
- }
664
- rt(s) {
665
- if (this.isConnected || (s = void 0), typeof this.G == "function") {
666
- const t = this.ht ?? globalThis;
667
- let e = Q.get(t);
668
- e === void 0 && (e = /* @__PURE__ */ new WeakMap(), Q.set(t, e)), e.get(this.G) !== void 0 && this.G.call(this.ht, void 0), e.set(this.G, s), s !== void 0 && this.G.call(this.ht, s);
669
- } else this.G.value = s;
670
- }
671
- get lt() {
672
- return typeof this.G == "function" ? Q.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
673
- }
674
- disconnected() {
675
- this.lt === this.ct && this.rt(void 0);
676
- }
677
- reconnected() {
678
- this.rt(this.ct);
679
- }
680
- });
681
- class tt extends Ot {
682
- constructor(t) {
683
- if (super(t), this.it = p, t.type !== Ht.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
684
- }
685
- render(t) {
686
- if (t === p || t == null) return this._t = void 0, this.it = t;
687
- if (t === w) return t;
688
- if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
689
- if (t === this.it) return this._t;
690
- this.it = t;
691
- const e = [t];
692
- return e.raw = e, this._t = { _$litType$: this.constructor.resultType, strings: e, values: [] };
693
- }
694
- }
695
- tt.directiveName = "unsafeHTML", tt.resultType = 1;
696
- const ze = It(tt);
697
- function ps(s) {
698
- return !!s && typeof s == "object" && "id" in s && "handle" in s && "type" in s;
734
+ ut.directiveName = "unsafeHTML", ut.resultType = 1;
735
+ var dt = tt(ut);
736
+ //#endregion
737
+ //#region src/field-utils.ts
738
+ function ft(e) {
739
+ return !!e && typeof e == "object" && "id" in e && "handle" in e && "type" in e;
699
740
  }
700
- function Vt(s) {
701
- if (xt(s.type))
702
- return s.type;
703
- const t = s.input && typeof s.input == "object" ? s.input : {}, e = typeof t.fieldKind == "string" ? t.fieldKind : null;
704
- return e === "text" ? "single-line-text" : e === "textarea" ? "multi-line-text" : e === "boolean" ? "agree" : e === "file" ? "file" : s.type;
741
+ function pt(e) {
742
+ if (c(e.type)) return e.type;
743
+ let t = e.input && typeof e.input == "object" ? e.input : {}, n = typeof t.fieldKind == "string" ? t.fieldKind : null;
744
+ return n === "text" ? "single-line-text" : n === "textarea" ? "multi-line-text" : n === "boolean" ? "agree" : n === "file" ? "file" : e.type;
705
745
  }
706
- const D = "formie-control-value-change";
707
- function at(s) {
708
- return P(s), Nt(s);
746
+ //#endregion
747
+ //#region src/types.ts
748
+ var J = "formie-control-value-change";
749
+ //#endregion
750
+ //#region src/render-view.ts
751
+ function mt(e) {
752
+ return W(e), We(e);
709
753
  }
710
- function Fe(s, t, e, i, r, n, o, l) {
711
- if (!s || !(s instanceof HTMLElement))
712
- return;
713
- const a = t.toLowerCase();
714
- let d = s.firstElementChild;
715
- (!d || d.tagName.toLowerCase() !== a) && (s.replaceChildren(), d = document.createElement(t), d.addEventListener(D, (u) => {
716
- l(u.detail);
717
- }), s.append(d)), d.field = e, d.value = i, d.errorKey = r, d.disabled = n, d.hidden = o;
754
+ function ht(e, t, n, r, i, a, o, s) {
755
+ if (!e || !(e instanceof HTMLElement)) return;
756
+ let c = t.toLowerCase(), l = e.firstElementChild;
757
+ (!l || l.tagName.toLowerCase() !== c) && (e.replaceChildren(), l = document.createElement(t), l.addEventListener(J, (e) => {
758
+ s(e.detail);
759
+ }), e.append(l)), l.field = n, l.value = r, l.errorKey = i, l.disabled = a, l.hidden = o;
718
760
  }
719
- function De(s, t, e, i, r, n, o, l) {
720
- return h`<div
761
+ function gt(e, t, n, r, i, a, o, s) {
762
+ return j`<div
721
763
  class="starter-core-registry-host min-w-0"
722
- ${Ve((a) => {
723
- Fe(a, t, e, i, r, n, o, l);
724
- })}
764
+ ${lt((e) => {
765
+ ht(e, t, n, r, i, a, o, s);
766
+ })}
725
767
  ></div>`;
726
768
  }
727
- function je(s, t, e, i, r = "default") {
728
- if (r === "compositePart")
729
- return We(t, e, i);
730
- const n = s.registry.fieldTag;
731
- if (!n)
732
- return qe(t, e, i);
733
- const o = at(n);
734
- return L`<${o} .field=${t} .errors=${e}>${i}</${o}>`;
769
+ function _t(e, t, n, r, i = "default") {
770
+ if (i === "compositePart") return vt(t, n, r);
771
+ let a = e.registry.fieldTag;
772
+ if (!a) return yt(t, n, r);
773
+ let o = mt(a);
774
+ return V`<${o} .field=${t} .errors=${n}>${r}</${o}>`;
735
775
  }
736
- function We(s, t, e) {
737
- return h`
738
- <div class="starter-component-subfield" data-formie-field-type=${s.type}>
739
- ${s.label ? h`<label class="starter-component-subfield-label">${s.label}</label>` : p}
740
- <div class="starter-component-injected-control grid gap-2 text-slate-900">${e}</div>
741
- ${t.length > 0 ? h`<ul class="grid gap-1 text-sm text-red-600">
742
- ${t.map((i) => h`<li>${i}</li>`)}
743
- </ul>` : p}
776
+ function vt(e, t, n) {
777
+ return j`
778
+ <div class="starter-component-subfield" data-formie-field-type=${e.type}>
779
+ ${e.label ? j`<label class="starter-component-subfield-label">${e.label}</label>` : N}
780
+ <div class="starter-component-injected-control grid gap-2 text-slate-900">${n}</div>
781
+ ${t.length > 0 ? j`<ul class="grid gap-1 text-sm text-red-600">
782
+ ${t.map((e) => j`<li>${e}</li>`)}
783
+ </ul>` : N}
744
784
  </div>
745
785
  `;
746
786
  }
747
- function qe(s, t, e) {
748
- return h`
749
- <div class="starter-component-card" data-formie-field-type=${s.type}>
750
- ${s.label ? h`<label class="starter-component-label">${s.label}</label>` : p}
751
- ${s.instructions ? h`<p class="starter-component-help">${s.instructions}</p>` : p}
752
- <div class="starter-component-injected-control grid gap-2 text-slate-900">${e}</div>
753
- ${t.length > 0 ? h`<ul class="grid gap-1 text-sm text-red-600">
754
- ${t.map((i) => h`<li>${i}</li>`)}
755
- </ul>` : p}
787
+ function yt(e, t, n) {
788
+ return j`
789
+ <div class="starter-component-card" data-formie-field-type=${e.type}>
790
+ ${e.label ? j`<label class="starter-component-label">${e.label}</label>` : N}
791
+ ${e.instructions ? j`<div class="starter-component-help">${dt(e.instructions)}</div>` : N}
792
+ <div class="starter-component-injected-control grid gap-2 text-slate-900">${n}</div>
793
+ ${t.length > 0 ? j`<ul class="grid gap-1 text-sm text-red-600">
794
+ ${t.map((e) => j`<li>${e}</li>`)}
795
+ </ul>` : N}
756
796
  </div>
757
797
  `;
758
798
  }
759
- function St(s, t, e, i) {
760
- const r = s.input;
761
- if (s.type === "multi-line-text")
762
- return h`
799
+ function bt(e, t, n, r) {
800
+ let i = e.input;
801
+ if (e.type === "multi-line-text") return j`
763
802
  <textarea
764
803
  class="starter-component-control"
765
804
  .value=${typeof t == "string" ? t : ""}
766
- ?disabled=${e}
767
- placeholder=${typeof r.placeholder == "string" ? r.placeholder : ""}
768
- @input=${(o) => {
769
- i(o.target.value);
770
- }}
805
+ ?disabled=${n}
806
+ placeholder=${typeof i.placeholder == "string" ? i.placeholder : ""}
807
+ @input=${(e) => {
808
+ r(e.target.value);
809
+ }}
771
810
  ></textarea>
772
811
  `;
773
- if (s.type === "dropdown") {
774
- const o = Array.isArray(r.options) ? r.options : [], l = r.multiple === !0;
775
- return h`
812
+ if (e.type === "dropdown") {
813
+ let e = Array.isArray(i.options) ? i.options : [], a = i.multiple === !0;
814
+ return j`
776
815
  <select
777
816
  class="starter-component-control"
778
- ?disabled=${e}
779
- multiple=${l}
780
- .value=${l ? void 0 : typeof t == "string" ? t : ""}
781
- @change=${(a) => {
782
- const d = a.target;
783
- i(l ? Array.from(d.selectedOptions).map((u) => u.value) : d.value);
784
- }}
817
+ ?disabled=${n}
818
+ multiple=${a}
819
+ .value=${a ? void 0 : typeof t == "string" ? t : ""}
820
+ @change=${(e) => {
821
+ let t = e.target;
822
+ r(a ? Array.from(t.selectedOptions).map((e) => e.value) : t.value);
823
+ }}
785
824
  >
786
- ${o.map(
787
- (a) => h`
825
+ ${e.map((e) => j`
788
826
  <option
789
- value=${String(a.value ?? "")}
790
- ?disabled=${a.disabled === !0}
827
+ value=${String(e.value ?? "")}
828
+ ?disabled=${e.disabled === !0}
791
829
  >
792
- ${String(a.label ?? a.value ?? "")}
830
+ ${String(e.label ?? e.value ?? "")}
793
831
  </option>
794
- `
795
- )}
832
+ `)}
796
833
  </select>
797
834
  `;
798
- }
799
- const n = typeof r.inputType == "string" ? r.inputType : s.type === "email" ? "email" : s.type === "phone" ? "tel" : s.type === "number" ? "number" : "text";
800
- return h`
835
+ }
836
+ return j`
801
837
  <input
802
838
  class="starter-component-control"
803
- type=${n}
839
+ type=${typeof i.inputType == "string" ? i.inputType : e.type === "email" ? "email" : e.type === "phone" ? "tel" : e.type === "number" ? "number" : "text"}
804
840
  .value=${typeof t == "string" ? t : ""}
805
- ?disabled=${e}
806
- placeholder=${typeof r.placeholder == "string" ? r.placeholder : ""}
807
- @input=${(o) => {
808
- i(o.target.value);
809
- }}
841
+ ?disabled=${n}
842
+ placeholder=${typeof i.placeholder == "string" ? i.placeholder : ""}
843
+ @input=${(e) => {
844
+ r(e.target.value);
845
+ }}
810
846
  />
811
847
  `;
812
848
  }
813
- function Ge(s, t) {
814
- const { field: e, value: i, errorKey: r, disabled: n, setValue: o } = t, l = e.input, a = Vt(e);
815
- if (Wt(e))
816
- return Ke(s, t);
817
- if (qt(e))
818
- return Ze(s, t);
819
- if (Gt(e))
820
- return Be(e, i, n, o);
821
- if (a === "signature")
822
- return h`<formie-internal-signature
823
- .field=${e}
824
- .modules=${s.state.definition.modules}
825
- .value=${typeof i == "string" ? i : ""}
826
- ?disabled=${n}
827
- @formie-control-value-change=${(d) => {
828
- o(d.detail);
829
- }}
849
+ function xt(e, t) {
850
+ let { field: n, value: r, errorKey: i, disabled: a, setValue: u } = t, d = n.input, f = pt(n);
851
+ if (o(n)) return Ct(e, t);
852
+ if (l(n)) return wt(e, t);
853
+ if (s(n)) return St(n, r, a, u);
854
+ if (f === "signature") return j`<formie-internal-signature
855
+ .field=${n}
856
+ .modules=${e.state.definition.modules}
857
+ .value=${typeof r == "string" ? r : ""}
858
+ ?disabled=${a}
859
+ @formie-control-value-change=${(e) => {
860
+ u(e.detail);
861
+ }}
830
862
  ></formie-internal-signature>`;
831
- if (a === "multi-line-text" || a === "dropdown")
832
- return St(e, i, n, o);
833
- if (a === "radio") {
834
- const d = Array.isArray(l.options) ? l.options : [];
835
- return h`
863
+ if (f === "multi-line-text" || f === "dropdown") return bt(n, r, a, u);
864
+ if (f === "radio") return j`
836
865
  <div class="flex flex-col gap-2">
837
- ${d.map((u) => {
838
- const c = String(u.value ?? "");
839
- return h`
866
+ ${(Array.isArray(d.options) ? d.options : []).map((e) => {
867
+ let t = String(e.value ?? ""), i = a || e.disabled === !0;
868
+ return j`
840
869
  <label class="flex items-center gap-2 text-sm text-slate-800">
841
870
  <input
842
871
  type="radio"
843
- name=${`${e.id}-radio`}
844
- .checked=${i === c}
845
- ?disabled=${n}
872
+ name=${`${n.id}-radio`}
873
+ .checked=${r === t}
874
+ ?disabled=${i}
846
875
  @change=${() => {
847
- o(c);
848
- }}
876
+ u(t);
877
+ }}
849
878
  />
850
- <span>${String(u.label ?? c)}</span>
879
+ <span>${String(e.label ?? t)}</span>
851
880
  </label>
852
881
  `;
853
- })}
882
+ })}
854
883
  </div>
855
884
  `;
856
- }
857
- if (a === "checkboxes") {
858
- const d = Array.isArray(l.options) ? l.options : [], u = Array.isArray(i) ? i.map((c) => String(c)) : [];
859
- return h`
885
+ if (f === "checkboxes") {
886
+ let e = Array.isArray(d.options) ? d.options : [], t = Array.isArray(r) ? r.map((e) => String(e)) : [];
887
+ return j`
860
888
  <div class="flex flex-col gap-2">
861
- ${d.map((c) => {
862
- const f = String(c.value ?? ""), m = u.includes(f);
863
- return h`
889
+ ${e.map((e) => {
890
+ let n = String(e.value ?? ""), r = t.includes(n);
891
+ return j`
864
892
  <label class="flex items-center gap-2 text-sm text-slate-800">
865
893
  <input
866
894
  type="checkbox"
867
- .checked=${m}
868
- ?disabled=${n}
895
+ .checked=${r}
896
+ ?disabled=${a || e.disabled === !0}
869
897
  @change=${() => {
870
- const g = m ? u.filter((x) => x !== f) : [...u, f];
871
- o(g);
872
- }}
898
+ u(r ? t.filter((e) => e !== n) : [...t, n]);
899
+ }}
873
900
  />
874
- <span>${String(c.label ?? f)}</span>
901
+ <span>${String(e.label ?? n)}</span>
875
902
  </label>
876
903
  `;
877
- })}
904
+ })}
878
905
  </div>
879
906
  `;
880
- }
881
- if (a === "agree") {
882
- const d = typeof l.descriptionHtml == "string" ? l.descriptionHtml : null;
883
- return h`
907
+ }
908
+ if (f === "agree") {
909
+ let e = typeof d.descriptionHtml == "string" ? d.descriptionHtml : null;
910
+ return j`
884
911
  <label class="flex items-start gap-2 text-sm text-slate-800">
885
912
  <input
886
913
  type="checkbox"
887
- .checked=${i === !0}
888
- ?disabled=${n}
889
- @change=${(u) => {
890
- o(u.target.checked);
891
- }}
914
+ .checked=${r === !0}
915
+ ?disabled=${a}
916
+ @change=${(e) => {
917
+ u(e.target.checked);
918
+ }}
892
919
  />
893
- <span>${d ? ze(d) : e.label ?? ""}</span>
920
+ <span>${e ? dt(e) : n.label ?? ""}</span>
894
921
  </label>
895
922
  `;
896
- }
897
- return xt(a) ? St(e, i, n, o) : h`<div class="rounded-xl border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900">
923
+ }
924
+ return c(f) ? bt(n, r, a, u) : j`<div class="rounded-xl border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900">
898
925
  Unknown field type:
899
- ${String(e.meta?.fieldType ?? e.type)}
926
+ ${String(n.meta?.fieldType ?? n.type)}
900
927
  </div>`;
901
928
  }
902
- function Be(s, t, e, i) {
903
- const r = s.input, n = Array.isArray(t) ? t : [], o = r.multiple === !0, l = n.map((a, d) => a && typeof a == "object" && "name" in a && typeof a.name == "string" ? a.name : a && typeof a == "object" && "filename" in a && typeof a.filename == "string" ? a.filename : a && typeof a == "object" && "assetId" in a && typeof a.assetId == "number" ? `Asset #${a.assetId}` : `File ${d + 1}`);
904
- return h`
929
+ function St(e, t, n, r) {
930
+ let i = e.input, a = Array.isArray(t) ? t : [], o = i.multiple === !0, s = a.map((e, t) => e && typeof e == "object" && "name" in e && typeof e.name == "string" ? e.name : e && typeof e == "object" && "filename" in e && typeof e.filename == "string" ? e.filename : e && typeof e == "object" && "assetId" in e && typeof e.assetId == "number" ? `Asset #${e.assetId}` : `File ${t + 1}`);
931
+ return j`
905
932
  <div class="grid gap-2">
906
933
  <input
907
934
  type="file"
908
935
  class="starter-component-control"
909
- ?disabled=${e}
936
+ ?disabled=${n}
910
937
  multiple=${o}
911
- @change=${(a) => {
912
- const d = a.target;
913
- i(Array.from(d.files || []));
914
- }}
938
+ @change=${(e) => {
939
+ let t = e.target;
940
+ r(Array.from(t.files || []));
941
+ }}
915
942
  />
916
- ${l.length > 0 ? h`<ul class="grid gap-1 text-sm text-slate-600">
917
- ${l.map((a) => h`<li>${a}</li>`)}
918
- </ul>` : p}
943
+ ${s.length > 0 ? j`<ul class="grid gap-1 text-sm text-slate-600">
944
+ ${s.map((e) => j`<li>${e}</li>`)}
945
+ </ul>` : N}
919
946
  </div>
920
947
  `;
921
948
  }
922
- function Ke(s, t) {
923
- const { field: e, value: i, errorKey: r, disabled: n, setValue: o } = t, l = Bt(e), a = i && typeof i == "object" ? i : {};
924
- return l.length === 0 ? h`<div class="text-sm text-amber-800">Composite field has no parts.</div>` : h`
949
+ function Ct(e, n) {
950
+ let { field: r, value: i, errorKey: a, disabled: o, setValue: s } = n, c = t(r), l = i && typeof i == "object" ? i : {};
951
+ return c.length === 0 ? j`<div class="text-sm text-amber-800">Composite field has no parts.</div>` : j`
925
952
  <div class="starter-component-name-grid">
926
- ${l.filter((d) => d.meta?.hidden !== !0).map((d) => {
927
- const u = `${r}.${d.handle}`;
928
- return lt(
929
- s,
930
- {
931
- field: d,
932
- value: a[d.handle],
933
- errors: s.state.errors.fields[u] || [],
934
- errorKey: u,
935
- disabled: n || d.meta?.disabled === !0,
936
- setValue(c) {
937
- o({
938
- ...a,
939
- [d.handle]: c
940
- });
941
- }
942
- },
943
- "compositePart"
944
- );
945
- })}
953
+ ${c.filter((e) => e.meta?.hidden !== !0).map((t) => {
954
+ let n = `${a}.${t.handle}`;
955
+ return Tt(e, {
956
+ field: t,
957
+ value: l[t.handle],
958
+ errors: e.state.errors.fields[n] || [],
959
+ errorKey: n,
960
+ disabled: o || t.meta?.disabled === !0,
961
+ setValue(e) {
962
+ s({
963
+ ...l,
964
+ [t.handle]: e
965
+ });
966
+ }
967
+ }, "compositePart");
968
+ })}
946
969
  </div>
947
970
  `;
948
971
  }
949
- function Ze(s, t) {
950
- const { field: e, value: i, errorKey: r, disabled: n, setValue: o } = t, l = Kt(e), a = Array.isArray(i) ? i : [], d = e.input, u = Number(d.minRows ?? 0) || 0, c = Number(d.maxRows ?? 0) || 0, f = !n && (c <= 0 || a.length < c);
951
- return l.length === 0 ? h`<div class="text-sm text-amber-800">Repeater has no row layout.</div>` : h`
972
+ function wt(e, t) {
973
+ let { field: n, value: r, errorKey: a, disabled: o, setValue: s } = t, c = f(n), l = Array.isArray(r) ? r : [], u = n.input, d = Number(u.minRows ?? 0) || 0, p = Number(u.maxRows ?? 0) || 0, ee = !o && (p <= 0 || l.length < p);
974
+ return c.length === 0 ? j`<div class="text-sm text-amber-800">Repeater has no row layout.</div>` : j`
952
975
  <div class="grid gap-4" data-formie-repeater-container>
953
- ${a.map((m, g) => h`
976
+ ${l.map((t, n) => j`
954
977
  <div class="rounded-xl border border-slate-200 p-4" data-formie-repeater-item>
955
- ${l.map((x, ht) => Je(s, x, m, `${r}.${g}`, n, (zt, Ft) => {
956
- const Dt = a.map((ct, jt) => jt !== g ? ct : { ...ct, [zt.handle]: Ft });
957
- o(Dt);
958
- }))}
978
+ ${c.map((r, i) => Et(e, r, t, `${a}.${n}`, o, (e, t) => {
979
+ s(l.map((r, i) => i === n ? {
980
+ ...r,
981
+ [e.handle]: t
982
+ } : r));
983
+ }))}
959
984
  <button
960
985
  type="button"
961
986
  class="mt-2 rounded-lg border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-700"
962
- ?disabled=${n || u > 0 && a.length <= u}
987
+ ?disabled=${o || d > 0 && l.length <= d}
963
988
  @click=${() => {
964
- o(a.filter((x, ht) => ht !== g));
965
- }}
989
+ s(l.filter((e, t) => t !== n));
990
+ }}
966
991
  >
967
992
  Remove
968
993
  </button>
@@ -971,606 +996,486 @@ function Ze(s, t) {
971
996
  <button
972
997
  type="button"
973
998
  class="rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-semibold text-slate-700 shadow-sm"
974
- ?disabled=${!f}
999
+ ?disabled=${!ee}
975
1000
  @click=${() => {
976
- o([...a, Zt(e)]);
977
- }}
1001
+ s([...l, i(n)]);
1002
+ }}
978
1003
  >
979
- ${String(d.addLabel ?? "Add another row")}
1004
+ ${String(u.addLabel ?? "Add another row")}
980
1005
  </button>
981
1006
  </div>
982
1007
  `;
983
1008
  }
984
- function lt(s, t, e = "default") {
985
- const { field: i, value: r, errors: n, errorKey: o, disabled: l, setValue: a } = t, u = s.state.fieldStates[i.id]?.hidden === !0;
986
- if (u)
987
- return h``;
988
- const c = Vt(i), f = s.registry.fieldControls[i.type] || s.registry.fieldControls[c] || null, m = (x) => {
989
- a(x), s.host.requestUpdate();
990
- }, g = f ? De(s, f, i, r, o, l, u, m) : Ge(s, { ...t, setValue: m });
991
- return je(s, i, n, g, e);
1009
+ function Tt(e, t, n = "default") {
1010
+ let { field: r, value: i, errors: a, errorKey: o, disabled: s, setValue: c } = t, l = e.state.fieldStates[r.id]?.hidden === !0;
1011
+ if (l) return j``;
1012
+ let u = pt(r), d = e.registry.fieldControls[r.type] || e.registry.fieldControls[u] || null, f = (t) => {
1013
+ c(t), e.host.requestUpdate();
1014
+ };
1015
+ return _t(e, r, a, d ? gt(e, d, r, i, o, s, l, f) : xt(e, {
1016
+ ...t,
1017
+ setValue: f
1018
+ }), n);
992
1019
  }
993
- function Je(s, t, e, i, r, n) {
994
- return h`
1020
+ function Et(e, t, n, r, i, a) {
1021
+ return j`
995
1022
  <div class="starter-core-row grid gap-4">
996
- ${t.fields.map((o) => {
997
- const l = `${i}.${o.handle}`;
998
- return lt(s, {
999
- field: o,
1000
- value: e[o.handle],
1001
- errors: s.state.errors.fields[l] || [],
1002
- errorKey: l,
1003
- disabled: r === !0 || s.state.fieldStates[o.id]?.disabled === !0,
1004
- setValue(a) {
1005
- n(o, a);
1006
- }
1007
- });
1008
- })}
1023
+ ${t.fields.map((t) => {
1024
+ let o = `${r}.${t.handle}`;
1025
+ return Tt(e, {
1026
+ field: t,
1027
+ value: n[t.handle],
1028
+ errors: e.state.errors.fields[o] || [],
1029
+ errorKey: o,
1030
+ disabled: i === !0 || e.state.fieldStates[t.id]?.disabled === !0,
1031
+ setValue(e) {
1032
+ a(t, e);
1033
+ }
1034
+ });
1035
+ })}
1009
1036
  </div>
1010
1037
  `;
1011
1038
  }
1012
- function Qe(s, t) {
1013
- return h`
1039
+ function Dt(e, t) {
1040
+ return j`
1014
1041
  <div class="starter-core-row grid gap-4">
1015
- ${t.fields.map((e) => lt(s, {
1016
- field: e,
1017
- value: s.state.values[e.id],
1018
- errors: s.state.errors.fields[e.id] || [],
1019
- errorKey: e.id,
1020
- disabled: s.state.fieldStates[e.id]?.disabled === !0,
1021
- setValue(i) {
1022
- s.instance.setValue(e.id, i);
1023
- }
1024
- }))}
1042
+ ${t.fields.map((t) => Tt(e, {
1043
+ field: t,
1044
+ value: e.state.values[t.id],
1045
+ errors: e.state.errors.fields[t.id] || [],
1046
+ errorKey: t.id,
1047
+ disabled: e.state.fieldStates[t.id]?.disabled === !0,
1048
+ setValue(n) {
1049
+ e.instance.setValue(t.id, n);
1050
+ }
1051
+ }))}
1025
1052
  </div>
1026
1053
  `;
1027
1054
  }
1028
- function Xe(s) {
1029
- const t = s.state.definition.pages.find((r) => r.id === s.state.currentPageId);
1030
- if (!t)
1031
- return h``;
1032
- const e = s.registry.regions.pageActions;
1033
- if (e) {
1034
- const r = at(e);
1035
- return L`<${r}
1055
+ function Ot(e) {
1056
+ let t = e.state.definition.pages.find((t) => t.id === e.state.currentPageId);
1057
+ if (!t) return j``;
1058
+ let n = e.registry.regions.pageActions;
1059
+ if (n) {
1060
+ let r = mt(n);
1061
+ return V`<${r}
1036
1062
  .page=${t}
1037
- .state=${s.state}
1038
- .instance=${s.instance}
1063
+ .state=${e.state}
1064
+ .instance=${e.instance}
1039
1065
  ></${r}>`;
1040
- }
1041
- const i = t.actions.secondary.map(
1042
- (r) => h`
1066
+ }
1067
+ return j`
1068
+ <div class="formie-page-actions">
1069
+ ${t.actions.secondary.map((t) => j`
1043
1070
  <button
1044
1071
  type="button"
1045
1072
  @click=${() => {
1046
- s.instance.submit(r.type);
1047
- }}
1073
+ e.instance.submit(t.type);
1074
+ }}
1048
1075
  >
1049
- ${r.label}
1076
+ ${t.label}
1050
1077
  </button>
1051
- `
1052
- );
1053
- return h`
1054
- <div class="formie-page-actions">
1055
- ${i}
1078
+ `)}
1056
1079
  <button type="submit">${t.actions.primary.label}</button>
1057
1080
  </div>
1058
1081
  `;
1059
1082
  }
1060
- function Ye(s) {
1061
- const t = s.state.definition.pages.find((l) => l.id === s.state.currentPageId && s.state.pageStates[l.id]?.hidden !== !0) || s.state.definition.pages.find((l) => s.state.pageStates[l.id]?.hidden !== !0) || s.state.definition.pages[0];
1062
- if (!t)
1063
- return h``;
1064
- const e = s.state.errors.form, i = s.state.lastSubmitResult?.messages.error, r = !!i && !e.includes(i), n = h`
1065
- ${e.length > 0 ? h`<div class="starter-core-msg starter-core-msg-error mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">
1083
+ function kt(e) {
1084
+ let t = e.state.definition.pages.find((t) => t.id === e.state.currentPageId && e.state.pageStates[t.id]?.hidden !== !0) || e.state.definition.pages.find((t) => e.state.pageStates[t.id]?.hidden !== !0) || e.state.definition.pages[0];
1085
+ if (!t) return j``;
1086
+ let n = e.state.errors.form, r = e.state.lastSubmitResult?.messages.error, i = !!r && !n.includes(r), a = j`
1087
+ ${n.length > 0 ? j`<div class="starter-core-msg starter-core-msg-error mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">
1066
1088
  <ul class="list-inside list-disc">
1067
- ${e.map((l) => h`<li>${l}</li>`)}
1089
+ ${n.map((e) => j`<li>${e}</li>`)}
1068
1090
  </ul>
1069
- </div>` : p}
1070
- ${s.state.lastSubmitResult?.messages.notice ? h`<div class="mb-4 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800">
1071
- ${s.state.lastSubmitResult.messages.notice}
1072
- </div>` : p}
1073
- ${r ? h`<div class="mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">${i}</div>` : p}
1074
- ${ts(s, t)}
1075
- `, o = s.state.session.tokens.render ?? "";
1076
- return h`
1091
+ </div>` : N}
1092
+ ${e.state.lastSubmitResult?.messages.notice ? j`<div class="mb-4 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800">
1093
+ ${e.state.lastSubmitResult.messages.notice}
1094
+ </div>` : N}
1095
+ ${i ? j`<div class="mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">${r}</div>` : N}
1096
+ ${At(e, t)}
1097
+ `, o = e.state.session.tokens.render ?? "";
1098
+ return j`
1077
1099
  <form
1078
- class=${s.formClass || "starter-component-form starter-core-preview text-slate-900"}
1079
- data-formie-definition=${s.state.definition.handle}
1100
+ class=${e.formClass || "starter-component-form starter-core-preview text-slate-900"}
1101
+ data-formie-definition=${e.state.definition.handle}
1080
1102
  data-formie-render-id=${o}
1081
- @submit=${(l) => {
1082
- l.preventDefault(), s.instance.submit();
1083
- }}
1103
+ @submit=${(t) => {
1104
+ t.preventDefault(), e.instance.submit();
1105
+ }}
1084
1106
  >
1085
- ${n}
1107
+ ${a}
1086
1108
  </form>
1087
1109
  `;
1088
1110
  }
1089
- function ts(s, t) {
1090
- const e = s.registry.regions.page, i = h`
1111
+ function At(e, t) {
1112
+ let n = e.registry.regions.page, r = j`
1091
1113
  <div class="starter-core-fields grid gap-4">
1092
- ${t.rows.map((r) => Qe(s, r))}
1114
+ ${t.rows.map((t) => Dt(e, t))}
1093
1115
  </div>
1094
- ${Xe(s)}
1116
+ ${Ot(e)}
1095
1117
  `;
1096
- if (e) {
1097
- const r = at(e);
1098
- return L`<${r} .page=${t} .state=${s.state}>${i}</${r}>`;
1099
- }
1100
- return h`
1118
+ if (n) {
1119
+ let i = mt(n);
1120
+ return V`<${i} .page=${t} .state=${e.state}>${r}</${i}>`;
1121
+ }
1122
+ return j`
1101
1123
  <section data-page-id=${t.id} class="starter-core-page space-y-4">
1102
- ${i}
1124
+ ${r}
1103
1125
  </section>
1104
1126
  `;
1105
1127
  }
1106
- function es(s = "Loading form…") {
1107
- return h`<div class="mt-3 text-sm text-slate-500">${s}</div>`;
1108
- }
1109
- function ss(s) {
1110
- return h`<div class="mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">${s}</div>`;
1128
+ function jt(e = "Loading form…") {
1129
+ return j`<div class="mt-3 text-sm text-slate-500">${e}</div>`;
1111
1130
  }
1112
- var is = Object.defineProperty, v = (s, t, e, i) => {
1113
- for (var r = void 0, n = s.length - 1, o; n >= 0; n--)
1114
- (o = s[n]) && (r = o(t, e, r) || r);
1115
- return r && is(t, e, r), r;
1116
- };
1117
- function Ct(s) {
1118
- return P(s), Nt(s);
1131
+ function Mt(e) {
1132
+ return j`<div class="mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">${e}</div>`;
1119
1133
  }
1120
- class b extends M {
1121
- constructor() {
1122
- super(...arguments), this.endpoint = "", this.formHandle = "", this.transport = "rest", this.fetchCredentials = "same-origin", this.formClass = "", this.loadingMessage = "Loading form…", this.loadError = null, this.booting = !1, this.snapshot = null, this.instance = null, this.unsubscribers = [], this.loadGeneration = 0;
1123
- }
1124
- createRenderRoot() {
1125
- return this;
1126
- }
1127
- disconnectedCallback() {
1128
- super.disconnectedCallback(), this.teardown();
1129
- }
1130
- connectedCallback() {
1131
- super.connectedCallback(), this.bootstrap(!1);
1132
- }
1133
- willUpdate(t) {
1134
- if (super.willUpdate(t), !this.hasUpdated)
1135
- return;
1136
- ["endpoint", "formHandle", "siteId", "transport", "fetchCredentials"].some((i) => t.has(i)) && this.bootstrap(!0);
1137
- }
1138
- /** Form instance after a successful load; `null` while loading or after teardown. */
1139
- getFormieInstance() {
1140
- return this.instance;
1141
- }
1142
- /** Reload envelope + form instance from the server. */
1143
- async reload() {
1144
- await this.bootstrap(!0);
1145
- }
1146
- get resolvedRegistry() {
1147
- return this.registry ?? Pe();
1148
- }
1149
- teardown() {
1150
- for (const t of this.unsubscribers)
1151
- t();
1152
- this.unsubscribers = [], this.instance?.destroy(), this.instance = null, this.snapshot = null;
1153
- }
1154
- async bootstrap(t) {
1155
- const e = ++this.loadGeneration, i = this.formHandle.trim(), r = this.endpoint.trim();
1156
- if (!i) {
1157
- this.teardown(), this.booting = !1, this.loadError = "Set `form-handle` on <formie-core-form>.";
1158
- return;
1159
- }
1160
- if (t)
1161
- this.teardown();
1162
- else if (this.instance)
1163
- return;
1164
- this.booting = !0, this.loadError = null;
1165
- const n = this.fetchCredentials, o = this.siteId;
1166
- try {
1167
- const l = {
1168
- endpoint: r,
1169
- formHandle: i,
1170
- ...o !== void 0 ? { siteId: o } : {},
1171
- credentials: n
1172
- }, a = this.transport === "graphql" ? await Jt(l) : await Qt(l);
1173
- if (e !== this.loadGeneration)
1174
- return;
1175
- const d = this.transport === "graphql" ? Xt(l) : Yt(l), u = te({ envelope: a, transport: d });
1176
- this.instance = u;
1177
- for (const c of ee) {
1178
- const f = u.on(c, (m) => {
1179
- this.dispatchEvent(
1180
- new CustomEvent(c, {
1181
- detail: m,
1182
- bubbles: !0,
1183
- composed: !0
1184
- })
1185
- );
1186
- });
1187
- this.unsubscribers.push(f);
1188
- }
1189
- this.unsubscribers.push(
1190
- u.subscribe((c) => {
1191
- this.snapshot = c, this.requestUpdate();
1192
- })
1193
- ), this.booting = !1;
1194
- } catch (l) {
1195
- if (e !== this.loadGeneration)
1196
- return;
1197
- this.teardown(), this.booting = !1, this.loadError = l instanceof Error ? l.message : "Unable to load the form.";
1198
- }
1199
- }
1200
- render() {
1201
- const t = this.resolvedRegistry;
1202
- if (this.loadError) {
1203
- const e = t.regions.errorSummary;
1204
- if (e) {
1205
- const i = Ct(e);
1206
- return L`<${i} .errors=${[this.loadError]} .kind=${"load"}></${i}>`;
1207
- }
1208
- return ss(this.loadError);
1209
- }
1210
- if (this.booting || !this.snapshot || !this.instance) {
1211
- const e = t.regions.loading;
1212
- if (e) {
1213
- const i = Ct(e);
1214
- return L`<${i} .message=${this.loadingMessage}></${i}>`;
1215
- }
1216
- return es(this.loadingMessage);
1217
- }
1218
- return Ye({
1219
- registry: t,
1220
- state: this.snapshot,
1221
- instance: this.instance,
1222
- host: this,
1223
- formClass: this.formClass || ""
1224
- });
1225
- }
1134
+ //#endregion
1135
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
1136
+ function Y(e, t, n, r) {
1137
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
1138
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
1139
+ else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
1140
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
1226
1141
  }
1227
- v([
1228
- $({ type: String })
1229
- ], b.prototype, "endpoint");
1230
- v([
1231
- $({ type: String, attribute: "form-handle" })
1232
- ], b.prototype, "formHandle");
1233
- v([
1234
- $({
1235
- type: Number,
1236
- attribute: "site-id",
1237
- converter: {
1238
- fromAttribute(s) {
1239
- if (s == null || s === "")
1240
- return;
1241
- const t = Number(s);
1242
- return Number.isFinite(t) ? t : void 0;
1243
- }
1244
- }
1245
- })
1246
- ], b.prototype, "siteId");
1247
- v([
1248
- $({
1249
- attribute: "transport",
1250
- converter: {
1251
- fromAttribute(s) {
1252
- return (s ?? "rest").toLowerCase() === "graphql" ? "graphql" : "rest";
1253
- }
1254
- }
1255
- })
1256
- ], b.prototype, "transport");
1257
- v([
1258
- $({
1259
- attribute: "fetch-credentials",
1260
- converter: {
1261
- fromAttribute(s) {
1262
- return s === "omit" || s === "same-origin" || s === "include" ? s : "same-origin";
1263
- }
1264
- }
1265
- })
1266
- ], b.prototype, "fetchCredentials");
1267
- v([
1268
- $({ type: String, attribute: "form-class" })
1269
- ], b.prototype, "formClass");
1270
- v([
1271
- $({ type: String, attribute: "loading-message" })
1272
- ], b.prototype, "loadingMessage");
1273
- v([
1274
- $({ attribute: !1 })
1275
- ], b.prototype, "registry");
1276
- v([
1277
- K()
1278
- ], b.prototype, "loadError");
1279
- v([
1280
- K()
1281
- ], b.prototype, "booting");
1282
- v([
1283
- K()
1284
- ], b.prototype, "snapshot");
1285
- function X(s) {
1286
- if (s == null || s === "")
1287
- return !1;
1288
- const t = s.toLowerCase();
1289
- return t === "true" || t === "1";
1142
+ //#endregion
1143
+ //#region src/formie-core-form.ts
1144
+ function Nt(e) {
1145
+ return W(e), We(e);
1290
1146
  }
1291
- function y(s, t, e) {
1292
- typeof e == "string" && e.length > 0 ? s.setAttribute(t, e) : s.removeAttribute(t);
1147
+ var X = class extends B {
1148
+ constructor(...e) {
1149
+ super(...e), this.endpoint = "", this.formHandle = "", this.transport = "rest", this.fetchCredentials = "same-origin", this.formClass = "", this.loadingMessage = "Loading form…", this.loadError = null, this.booting = !1, this.snapshot = null, this.instance = null, this.unsubscribers = [], this.loadGeneration = 0;
1150
+ }
1151
+ createRenderRoot() {
1152
+ return this;
1153
+ }
1154
+ disconnectedCallback() {
1155
+ super.disconnectedCallback(), this.teardown();
1156
+ }
1157
+ connectedCallback() {
1158
+ super.connectedCallback(), this.bootstrap(!1);
1159
+ }
1160
+ willUpdate(e) {
1161
+ super.willUpdate(e), this.hasUpdated && [
1162
+ "endpoint",
1163
+ "formHandle",
1164
+ "siteId",
1165
+ "transport",
1166
+ "fetchCredentials"
1167
+ ].some((t) => e.has(t)) && this.bootstrap(!0);
1168
+ }
1169
+ getFormieInstance() {
1170
+ return this.instance;
1171
+ }
1172
+ async reload() {
1173
+ await this.bootstrap(!0);
1174
+ }
1175
+ get resolvedRegistry() {
1176
+ return this.registry ?? Xe();
1177
+ }
1178
+ teardown() {
1179
+ for (let e of this.unsubscribers) e();
1180
+ this.unsubscribers = [], this.instance?.destroy(), this.instance = null, this.snapshot = null;
1181
+ }
1182
+ async bootstrap(t) {
1183
+ let i = ++this.loadGeneration, o = this.formHandle.trim(), s = this.endpoint.trim();
1184
+ if (!o) {
1185
+ this.teardown(), this.booting = !1, this.loadError = "Set `form-handle` on <formie-core-form>.";
1186
+ return;
1187
+ }
1188
+ if (t) this.teardown();
1189
+ else if (this.instance) return;
1190
+ this.booting = !0, this.loadError = null;
1191
+ let c = this.fetchCredentials, l = this.siteId;
1192
+ try {
1193
+ let t = {
1194
+ endpoint: s,
1195
+ formHandle: o,
1196
+ ...l === void 0 ? {} : { siteId: l },
1197
+ credentials: c
1198
+ }, f = this.transport === "graphql" ? await d(t) : await u(t);
1199
+ if (i !== this.loadGeneration) return;
1200
+ let p = n({
1201
+ envelope: f,
1202
+ transport: this.transport === "graphql" ? r(t) : a(t)
1203
+ });
1204
+ this.instance = p;
1205
+ for (let t of e) {
1206
+ let e = p.on(t, (e) => {
1207
+ this.dispatchEvent(new CustomEvent(t, {
1208
+ detail: e,
1209
+ bubbles: !0,
1210
+ composed: !0
1211
+ }));
1212
+ });
1213
+ this.unsubscribers.push(e);
1214
+ }
1215
+ this.unsubscribers.push(p.subscribe((e) => {
1216
+ this.snapshot = e, this.requestUpdate();
1217
+ })), this.booting = !1;
1218
+ } catch (e) {
1219
+ if (i !== this.loadGeneration) return;
1220
+ this.teardown(), this.booting = !1, this.loadError = e instanceof Error ? e.message : "Unable to load the form.";
1221
+ }
1222
+ }
1223
+ render() {
1224
+ let e = this.resolvedRegistry;
1225
+ if (this.loadError) {
1226
+ let t = e.regions.errorSummary;
1227
+ if (t) {
1228
+ let e = Nt(t);
1229
+ return V`<${e} .errors=${[this.loadError]} .kind=${"load"}></${e}>`;
1230
+ }
1231
+ return Mt(this.loadError);
1232
+ }
1233
+ if (this.booting || !this.snapshot || !this.instance) {
1234
+ let t = e.regions.loading;
1235
+ if (t) {
1236
+ let e = Nt(t);
1237
+ return V`<${e} .message=${this.loadingMessage}></${e}>`;
1238
+ }
1239
+ return jt(this.loadingMessage);
1240
+ }
1241
+ return kt({
1242
+ registry: e,
1243
+ state: this.snapshot,
1244
+ instance: this.instance,
1245
+ host: this,
1246
+ formClass: this.formClass || ""
1247
+ });
1248
+ }
1249
+ };
1250
+ Y([H({ type: String })], X.prototype, "endpoint", void 0), Y([H({
1251
+ type: String,
1252
+ attribute: "form-handle"
1253
+ })], X.prototype, "formHandle", void 0), Y([H({
1254
+ type: Number,
1255
+ attribute: "site-id",
1256
+ converter: { fromAttribute(e) {
1257
+ if (e == null || e === "") return;
1258
+ let t = Number(e);
1259
+ return Number.isFinite(t) ? t : void 0;
1260
+ } }
1261
+ })], X.prototype, "siteId", void 0), Y([H({
1262
+ attribute: "transport",
1263
+ converter: { fromAttribute(e) {
1264
+ return (e ?? "rest").toLowerCase() === "graphql" ? "graphql" : "rest";
1265
+ } }
1266
+ })], X.prototype, "transport", void 0), Y([H({
1267
+ attribute: "fetch-credentials",
1268
+ converter: { fromAttribute(e) {
1269
+ return e === "omit" || e === "same-origin" || e === "include" ? e : "same-origin";
1270
+ } }
1271
+ })], X.prototype, "fetchCredentials", void 0), Y([H({
1272
+ type: String,
1273
+ attribute: "form-class"
1274
+ })], X.prototype, "formClass", void 0), Y([H({
1275
+ type: String,
1276
+ attribute: "loading-message"
1277
+ })], X.prototype, "loadingMessage", void 0), Y([H({ attribute: !1 })], X.prototype, "registry", void 0), Y([U()], X.prototype, "loadError", void 0), Y([U()], X.prototype, "booting", void 0), Y([U()], X.prototype, "snapshot", void 0);
1278
+ //#endregion
1279
+ //#region src/form-element.ts
1280
+ function Pt(e) {
1281
+ if (e == null || e === "") return !1;
1282
+ let t = e.toLowerCase();
1283
+ return t === "true" || t === "1";
1293
1284
  }
1294
- function Y(s, t, e) {
1295
- e === !0 ? s.setAttribute(t, "true") : s.removeAttribute(t);
1285
+ function Z(e, t, n) {
1286
+ typeof n == "string" && n.length > 0 ? e.setAttribute(t, n) : e.removeAttribute(t);
1296
1287
  }
1297
- function rs(s, t) {
1298
- return t.startsWith("http") ? t : `${s}${t}`;
1288
+ function Q(e, t, n) {
1289
+ n === !0 ? e.setAttribute(t, "true") : e.removeAttribute(t);
1299
1290
  }
1300
- class ns extends HTMLElement {
1301
- constructor() {
1302
- super(), this.mountedInstance = null, this.optionState = {}, this.mountScheduled = null, this.eventUnsubs = [];
1303
- }
1304
- static get observedAttributes() {
1305
- return [
1306
- "mode",
1307
- "transport",
1308
- "theme",
1309
- "form-handle",
1310
- "endpoint",
1311
- "refresh-tokens",
1312
- "static-cache",
1313
- "locale",
1314
- "site-id",
1315
- "auto-visible",
1316
- "base-url"
1317
- ];
1318
- }
1319
- /** Lazily create client + mount container (not in the constructor). */
1320
- ensureInitialized() {
1321
- this.mountRoot || (this.client = se(), this.mountRoot = document.createElement("div"));
1322
- }
1323
- connectedCallback() {
1324
- this.ensureInitialized(), this.style.display = "block", this.contains(this.mountRoot) || this.append(this.mountRoot), this.scheduleMount();
1325
- }
1326
- disconnectedCallback() {
1327
- this.unmount();
1328
- }
1329
- attributeChangedCallback(t, e, i) {
1330
- e === i || !this.isConnected || t === "refresh-tokens" && this.optionState.refreshTokens !== void 0 || t === "static-cache" && this.optionState.staticCache !== void 0 || this.scheduleMount();
1331
- }
1332
- get baseUrl() {
1333
- const t = this.getAttribute("base-url");
1334
- return this.optionState.baseUrl ?? t ?? void 0;
1335
- }
1336
- set baseUrl(t) {
1337
- this.optionState.baseUrl = t, y(this, "base-url", t), this.scheduleMount();
1338
- }
1339
- get transport() {
1340
- const t = this.getAttribute("transport");
1341
- return this.optionState.transport ?? t ?? void 0;
1342
- }
1343
- set transport(t) {
1344
- this.optionState.transport = t, y(this, "transport", t), this.scheduleMount();
1345
- }
1346
- get theme() {
1347
- const t = this.getAttribute("theme");
1348
- return this.optionState.theme ?? t ?? void 0;
1349
- }
1350
- set theme(t) {
1351
- this.optionState.theme = t, y(this, "theme", t), this.scheduleMount();
1352
- }
1353
- get themeConfig() {
1354
- return this.optionState.themeConfig;
1355
- }
1356
- set themeConfig(t) {
1357
- this.optionState.themeConfig = t, this.scheduleMount();
1358
- }
1359
- get payload() {
1360
- return this.optionState.payload;
1361
- }
1362
- set payload(t) {
1363
- this.optionState.payload = t, this.scheduleMount();
1364
- }
1365
- get formHandle() {
1366
- const t = this.getAttribute("form-handle");
1367
- return this.optionState.formHandle ?? t ?? void 0;
1368
- }
1369
- set formHandle(t) {
1370
- this.optionState.formHandle = t, y(this, "form-handle", t), this.scheduleMount();
1371
- }
1372
- get endpoint() {
1373
- const t = this.getAttribute("endpoint");
1374
- return this.optionState.endpoint ?? t ?? void 0;
1375
- }
1376
- set endpoint(t) {
1377
- this.optionState.endpoint = t, y(this, "endpoint", t), this.scheduleMount();
1378
- }
1379
- get staticCache() {
1380
- return this.optionState.staticCache ?? (this.hasAttribute("static-cache") ? X(this.getAttribute("static-cache")) : void 0);
1381
- }
1382
- set staticCache(t) {
1383
- this.optionState.staticCache = t, Y(this, "static-cache", t), this.scheduleMount();
1384
- }
1385
- get refreshTokens() {
1386
- return this.optionState.refreshTokens ?? (this.hasAttribute("refresh-tokens") ? X(this.getAttribute("refresh-tokens")) : void 0);
1387
- }
1388
- set refreshTokens(t) {
1389
- this.optionState.refreshTokens = t, Y(this, "refresh-tokens", t), this.scheduleMount();
1390
- }
1391
- get locale() {
1392
- const t = this.getAttribute("locale");
1393
- return this.optionState.locale ?? t ?? void 0;
1394
- }
1395
- set locale(t) {
1396
- this.optionState.locale = t, y(this, "locale", t), this.scheduleMount();
1397
- }
1398
- get siteId() {
1399
- return this.optionState.siteId ?? (this.getAttribute("site-id") ? Number(this.getAttribute("site-id")) : void 0);
1400
- }
1401
- set siteId(t) {
1402
- this.optionState.siteId = t, y(this, "site-id", typeof t == "number" ? String(t) : void 0), this.scheduleMount();
1403
- }
1404
- get autoVisible() {
1405
- return this.optionState.autoVisible ?? (this.hasAttribute("auto-visible") ? X(this.getAttribute("auto-visible")) : void 0);
1406
- }
1407
- set autoVisible(t) {
1408
- this.optionState.autoVisible = t, Y(this, "auto-visible", t), this.scheduleMount();
1409
- }
1410
- get mode() {
1411
- const t = this.getAttribute("mode");
1412
- return this.optionState.mode ?? t ?? "server-rendered";
1413
- }
1414
- set mode(t) {
1415
- this.optionState.mode = t, y(this, "mode", t), this.scheduleMount();
1416
- }
1417
- getInstance() {
1418
- return this.ensureInitialized(), this.mountedInstance;
1419
- }
1420
- async submit(t = "submit") {
1421
- return this.ensureInitialized(), this.mountedInstance ? this.mountedInstance.submit(t) : null;
1422
- }
1423
- buildOptions() {
1424
- const t = this.baseUrl || "", e = this.transport, i = e === "graphql" ? "/api" : "/actions/formie/server/forms/render", r = rs(t, this.endpoint || i), n = this.staticCache, o = this.refreshTokens;
1425
- return {
1426
- mode: this.mode,
1427
- transport: e,
1428
- theme: this.theme,
1429
- themeConfig: this.themeConfig,
1430
- formHandle: this.formHandle,
1431
- endpoint: r,
1432
- payload: this.payload,
1433
- staticCache: n,
1434
- refreshTokens: o,
1435
- locale: this.locale,
1436
- siteId: this.siteId,
1437
- autoVisible: this.autoVisible ?? !1
1438
- };
1439
- }
1440
- bindInstanceEvents(t) {
1441
- this.eventUnsubs.forEach((e) => e()), this.eventUnsubs = ie.map((e) => t.on(e, (i) => {
1442
- this.dispatchEvent(new CustomEvent(e, {
1443
- detail: i,
1444
- bubbles: !0,
1445
- composed: !0
1446
- }));
1447
- }));
1448
- }
1449
- async scheduleMount() {
1450
- return this.ensureInitialized(), this.mountScheduled ? this.mountScheduled : (this.mountScheduled = Promise.resolve().then(async () => {
1451
- this.mountScheduled = null, this.isConnected && await this.mount();
1452
- }), this.mountScheduled);
1453
- }
1454
- async mount() {
1455
- await this.unmount();
1456
- const t = await this.client.mount(this.mountRoot, this.buildOptions());
1457
- this.mountedInstance = t, this.bindInstanceEvents(t), this.dispatchEvent(new CustomEvent("formie-mounted", {
1458
- detail: {
1459
- id: t.id,
1460
- instance: t
1461
- },
1462
- bubbles: !0,
1463
- composed: !0
1464
- }));
1465
- }
1466
- async unmount() {
1467
- if (this.eventUnsubs.forEach((e) => e()), this.eventUnsubs = [], !this.mountRoot || !this.mountedInstance)
1468
- return;
1469
- const t = this.mountedInstance;
1470
- await this.client.unmount(this.mountRoot), this.mountedInstance = null, this.dispatchEvent(new CustomEvent("formie-unmounted", {
1471
- detail: {
1472
- id: t.id
1473
- },
1474
- bubbles: !0,
1475
- composed: !0
1476
- }));
1477
- }
1291
+ function Ft(e, t) {
1292
+ if (t) return t.startsWith("http") ? t : `${e}${t}`;
1478
1293
  }
1479
- var os = Object.defineProperty, z = (s, t, e, i) => {
1480
- for (var r = void 0, n = s.length - 1, o; n >= 0; n--)
1481
- (o = s[n]) && (r = o(t, e, r) || r);
1482
- return r && os(t, e, r), r;
1483
- };
1484
- const dt = class dt extends M {
1485
- constructor() {
1486
- super(...arguments), this.modules = [], this.value = "", this.disabled = !1, this.loadError = null, this.pad = null, this.strokeListener = () => {
1487
- this.emitValue();
1488
- }, this.onWinResize = () => {
1489
- const t = this.shadowRoot?.querySelector("canvas");
1490
- t instanceof HTMLCanvasElement && this.resizeCanvas(t);
1491
- };
1492
- }
1493
- async firstUpdated() {
1494
- const t = this.shadowRoot?.querySelector("canvas");
1495
- if (!(!t || !(t instanceof HTMLCanvasElement)))
1496
- try {
1497
- const { default: e } = await import("./signature_pad-CKGlHEaq.js"), i = this.resolveDrawModuleConfig(), r = typeof i?.options == "object" && i.options && typeof i.options.backgroundColor == "string" ? String(i.options.backgroundColor) : "#ffffff", n = typeof i?.options == "object" && i.options && typeof i.options.penColor == "string" ? String(i.options.penColor) : "#000000", o = typeof i?.options == "object" && i.options && Number(i.options.penWeight ?? 2) || 2, l = new e(t, {
1498
- backgroundColor: r,
1499
- penColor: n,
1500
- minWidth: o,
1501
- maxWidth: o
1502
- });
1503
- this.pad = l, l.addEventListener?.("endStroke", this.strokeListener), this.resizeCanvas(t), window.addEventListener("resize", this.onWinResize), this.applySerializedValue();
1504
- } catch (e) {
1505
- this.loadError = e instanceof Error ? e.message : "Signature pad failed to load.";
1506
- }
1507
- }
1508
- disconnectedCallback() {
1509
- super.disconnectedCallback(), window.removeEventListener("resize", this.onWinResize), this.pad?.removeEventListener && this.pad.removeEventListener("endStroke", this.strokeListener), this.pad = null;
1510
- }
1511
- resolveDrawModuleConfig() {
1512
- const t = new Set(this.field.moduleRefs || []), e = this.modules.find((i) => t.has(i.id) && i.capability === "draw-signature");
1513
- return e && typeof e.config == "object" && e.config ? e.config : null;
1514
- }
1515
- resizeCanvas(t) {
1516
- const e = Math.max(window.devicePixelRatio || 1, 1), i = Math.max(1, Math.floor(t.clientWidth || 480)), r = 192, n = t.getContext("2d");
1517
- t.width = i * e, t.height = r * e, n?.scale(e, e), t.style.width = `${i}px`, t.style.height = `${r}px`, this.pad?.fromDataURL?.(this.value || "data:,");
1518
- }
1519
- updated(t) {
1520
- if (t.has("value") && this.pad && this.applySerializedValue(), t.has("disabled") && this.pad) {
1521
- const e = this.shadowRoot?.querySelector("canvas");
1522
- e instanceof HTMLElement && (e.style.pointerEvents = this.disabled ? "none" : "");
1523
- }
1524
- }
1525
- applySerializedValue() {
1526
- if (this.pad) {
1527
- if (!this.value) {
1528
- this.pad.isEmpty() || this.pad.clear();
1529
- return;
1530
- }
1531
- try {
1532
- this.pad.fromDataURL(this.value);
1533
- } catch {
1534
- }
1535
- }
1536
- }
1537
- emitValue() {
1538
- if (!this.pad || this.pad.isEmpty()) {
1539
- this.dispatchEvent(
1540
- new CustomEvent(D, {
1541
- detail: "",
1542
- bubbles: !0,
1543
- composed: !0
1544
- })
1545
- );
1546
- return;
1547
- }
1548
- this.dispatchEvent(
1549
- new CustomEvent(D, {
1550
- detail: this.pad.toDataURL(),
1551
- bubbles: !0,
1552
- composed: !0
1553
- })
1554
- );
1555
- }
1556
- render() {
1557
- return this.loadError ? h`<div class="err">${this.loadError}</div>` : h`
1558
- <div class="wrap">
1559
- <canvas></canvas>
1560
- <button type="button" ?disabled=${this.disabled} @click=${() => {
1561
- this.pad?.clear(), this.dispatchEvent(
1562
- new CustomEvent(D, {
1563
- detail: "",
1564
- bubbles: !0,
1565
- composed: !0
1566
- })
1567
- );
1568
- }}>Clear</button>
1569
- </div>
1570
- `;
1571
- }
1572
- };
1573
- dt.styles = ne`
1294
+ var It = class extends HTMLElement {
1295
+ static get observedAttributes() {
1296
+ return [
1297
+ "mode",
1298
+ "transport",
1299
+ "theme",
1300
+ "form-handle",
1301
+ "endpoint",
1302
+ "refresh-tokens",
1303
+ "static-cache",
1304
+ "locale",
1305
+ "site-id",
1306
+ "auto-visible",
1307
+ "base-url"
1308
+ ];
1309
+ }
1310
+ constructor() {
1311
+ super(), this.mountedInstance = null, this.optionState = {}, this.mountScheduled = null, this.eventUnsubs = [];
1312
+ }
1313
+ ensureInitialized() {
1314
+ this.mountRoot ||= (this.client = te(), document.createElement("div"));
1315
+ }
1316
+ connectedCallback() {
1317
+ this.ensureInitialized(), this.style.display = "block", this.contains(this.mountRoot) || this.append(this.mountRoot), this.scheduleMount();
1318
+ }
1319
+ disconnectedCallback() {
1320
+ this.unmount();
1321
+ }
1322
+ attributeChangedCallback(e, t, n) {
1323
+ t === n || !this.isConnected || e === "refresh-tokens" && this.optionState.refreshTokens !== void 0 || e === "static-cache" && this.optionState.staticCache !== void 0 || this.scheduleMount();
1324
+ }
1325
+ get baseUrl() {
1326
+ let e = this.getAttribute("base-url");
1327
+ return this.optionState.baseUrl ?? e ?? void 0;
1328
+ }
1329
+ set baseUrl(e) {
1330
+ this.optionState.baseUrl = e, Z(this, "base-url", e), this.scheduleMount();
1331
+ }
1332
+ get transport() {
1333
+ let e = this.getAttribute("transport");
1334
+ return this.optionState.transport ?? e ?? void 0;
1335
+ }
1336
+ set transport(e) {
1337
+ this.optionState.transport = e, Z(this, "transport", e), this.scheduleMount();
1338
+ }
1339
+ get theme() {
1340
+ let e = this.getAttribute("theme");
1341
+ return this.optionState.theme ?? e ?? void 0;
1342
+ }
1343
+ set theme(e) {
1344
+ this.optionState.theme = e, Z(this, "theme", e), this.scheduleMount();
1345
+ }
1346
+ get themeConfig() {
1347
+ return this.optionState.themeConfig;
1348
+ }
1349
+ set themeConfig(e) {
1350
+ this.optionState.themeConfig = e, this.scheduleMount();
1351
+ }
1352
+ get payload() {
1353
+ return this.optionState.payload;
1354
+ }
1355
+ set payload(e) {
1356
+ this.optionState.payload = e, this.scheduleMount();
1357
+ }
1358
+ get formHandle() {
1359
+ let e = this.getAttribute("form-handle");
1360
+ return this.optionState.formHandle ?? e ?? void 0;
1361
+ }
1362
+ set formHandle(e) {
1363
+ this.optionState.formHandle = e, Z(this, "form-handle", e), this.scheduleMount();
1364
+ }
1365
+ get endpoint() {
1366
+ let e = this.getAttribute("endpoint");
1367
+ return this.optionState.endpoint ?? e ?? void 0;
1368
+ }
1369
+ set endpoint(e) {
1370
+ this.optionState.endpoint = e, Z(this, "endpoint", e), this.scheduleMount();
1371
+ }
1372
+ get staticCache() {
1373
+ return this.optionState.staticCache ?? (this.hasAttribute("static-cache") ? Pt(this.getAttribute("static-cache")) : void 0);
1374
+ }
1375
+ set staticCache(e) {
1376
+ this.optionState.staticCache = e, Q(this, "static-cache", e), this.scheduleMount();
1377
+ }
1378
+ get refreshTokens() {
1379
+ return this.optionState.refreshTokens ?? (this.hasAttribute("refresh-tokens") ? Pt(this.getAttribute("refresh-tokens")) : void 0);
1380
+ }
1381
+ set refreshTokens(e) {
1382
+ this.optionState.refreshTokens = e, Q(this, "refresh-tokens", e), this.scheduleMount();
1383
+ }
1384
+ get locale() {
1385
+ let e = this.getAttribute("locale");
1386
+ return this.optionState.locale ?? e ?? void 0;
1387
+ }
1388
+ set locale(e) {
1389
+ this.optionState.locale = e, Z(this, "locale", e), this.scheduleMount();
1390
+ }
1391
+ get siteId() {
1392
+ return this.optionState.siteId ?? (this.getAttribute("site-id") ? Number(this.getAttribute("site-id")) : void 0);
1393
+ }
1394
+ set siteId(e) {
1395
+ this.optionState.siteId = e, Z(this, "site-id", typeof e == "number" ? String(e) : void 0), this.scheduleMount();
1396
+ }
1397
+ get autoVisible() {
1398
+ return this.optionState.autoVisible ?? (this.hasAttribute("auto-visible") ? Pt(this.getAttribute("auto-visible")) : void 0);
1399
+ }
1400
+ set autoVisible(e) {
1401
+ this.optionState.autoVisible = e, Q(this, "auto-visible", e), this.scheduleMount();
1402
+ }
1403
+ get mode() {
1404
+ let e = this.getAttribute("mode");
1405
+ return this.optionState.mode ?? e ?? "server-rendered";
1406
+ }
1407
+ set mode(e) {
1408
+ this.optionState.mode = e, Z(this, "mode", e), this.scheduleMount();
1409
+ }
1410
+ getInstance() {
1411
+ return this.ensureInitialized(), this.mountedInstance;
1412
+ }
1413
+ async submit(e = "submit") {
1414
+ return this.ensureInitialized(), this.mountedInstance ? this.mountedInstance.submit(e) : null;
1415
+ }
1416
+ buildOptions() {
1417
+ let e = this.baseUrl || "", t = this.transport, n = t === "graphql" ? "/api" : "/actions/formie/server/forms/render", r = Ft(e, this.endpoint || n), i = this.staticCache, a = this.refreshTokens;
1418
+ return {
1419
+ mode: this.mode,
1420
+ transport: t,
1421
+ theme: this.theme,
1422
+ themeConfig: this.themeConfig,
1423
+ formHandle: this.formHandle,
1424
+ endpoint: r,
1425
+ payload: this.payload,
1426
+ staticCache: i,
1427
+ refreshTokens: a,
1428
+ locale: this.locale,
1429
+ siteId: this.siteId,
1430
+ autoVisible: this.autoVisible ?? !1
1431
+ };
1432
+ }
1433
+ bindInstanceEvents(e) {
1434
+ this.eventUnsubs.forEach((e) => e()), this.eventUnsubs = p.map((t) => e.on(t, (e) => {
1435
+ this.dispatchEvent(new CustomEvent(t, {
1436
+ detail: e,
1437
+ bubbles: !0,
1438
+ composed: !0
1439
+ }));
1440
+ }));
1441
+ }
1442
+ async scheduleMount() {
1443
+ return this.ensureInitialized(), this.mountScheduled ||= Promise.resolve().then(async () => {
1444
+ this.mountScheduled = null, this.isConnected && await this.mount();
1445
+ }), this.mountScheduled;
1446
+ }
1447
+ async mount() {
1448
+ await this.unmount();
1449
+ let e = await this.client.mount(this.mountRoot, this.buildOptions());
1450
+ this.mountedInstance = e, this.bindInstanceEvents(e), this.dispatchEvent(new CustomEvent("formie-mounted", {
1451
+ detail: {
1452
+ id: e.id,
1453
+ instance: e
1454
+ },
1455
+ bubbles: !0,
1456
+ composed: !0
1457
+ }));
1458
+ }
1459
+ async unmount() {
1460
+ if (this.eventUnsubs.forEach((e) => e()), this.eventUnsubs = [], !this.mountRoot || !this.mountedInstance) return;
1461
+ let e = this.mountedInstance;
1462
+ await this.client.unmount(this.mountRoot), this.mountedInstance = null, this.dispatchEvent(new CustomEvent("formie-unmounted", {
1463
+ detail: { id: e.id },
1464
+ bubbles: !0,
1465
+ composed: !0
1466
+ }));
1467
+ }
1468
+ }, $ = class extends B {
1469
+ constructor(...e) {
1470
+ super(...e), this.modules = [], this.value = "", this.disabled = !1, this.loadError = null, this.pad = null, this.strokeListener = () => {
1471
+ this.emitValue();
1472
+ }, this.onWinResize = () => {
1473
+ let e = this.shadowRoot?.querySelector("canvas");
1474
+ e instanceof HTMLCanvasElement && this.resizeCanvas(e);
1475
+ };
1476
+ }
1477
+ static {
1478
+ this.styles = ae`
1574
1479
  :host {
1575
1480
  display: block;
1576
1481
  }
@@ -1605,40 +1510,85 @@ dt.styles = ne`
1605
1510
  color: #b91c1c;
1606
1511
  }
1607
1512
  `;
1608
- let A = dt;
1609
- z([
1610
- $({ attribute: !1 })
1611
- ], A.prototype, "field");
1612
- z([
1613
- $({ attribute: !1 })
1614
- ], A.prototype, "modules");
1615
- z([
1616
- $({ type: String })
1617
- ], A.prototype, "value");
1618
- z([
1619
- $({ type: Boolean })
1620
- ], A.prototype, "disabled");
1621
- z([
1622
- K()
1623
- ], A.prototype, "loadError");
1624
- let wt = !1;
1625
- function fs() {
1626
- wt || (wt = !0, customElements.get("formie-form") || customElements.define("formie-form", ns), customElements.get("formie-internal-signature") || customElements.define("formie-internal-signature", A), customElements.get("formie-core-form") || customElements.define("formie-core-form", b));
1627
- }
1628
- export {
1629
- D as FORMIE_CONTROL_VALUE_EVENT,
1630
- b as FormieCoreForm,
1631
- ns as FormieFormElement,
1632
- A as FormieInternalSignature,
1633
- Z as FormieRegistry,
1634
- P as assertValidCustomElementName,
1635
- gs as createFormieClient,
1636
- us as createFormieRegistry,
1637
- Pe as getFormieRegistry,
1638
- ps as isFieldDefinition,
1639
- fs as registerFormieWebComponents,
1640
- ss as renderErrorView,
1641
- Ye as renderFormView,
1642
- es as renderLoadingView,
1643
- Vt as resolveFieldRendererType
1513
+ }
1514
+ async firstUpdated() {
1515
+ let e = this.shadowRoot?.querySelector("canvas");
1516
+ if (!(!e || !(e instanceof HTMLCanvasElement))) try {
1517
+ let { default: t } = await import("./signature_pad-D-mX46zR.js"), n = this.resolveDrawModuleConfig(), r = typeof n?.options == "object" && n.options && typeof n.options.backgroundColor == "string" ? String(n.options.backgroundColor) : "#ffffff", i = typeof n?.options == "object" && n.options && typeof n.options.penColor == "string" ? String(n.options.penColor) : "#000000", a = typeof n?.options == "object" && n.options && Number(n.options.penWeight ?? 2) || 2, o = new t(e, {
1518
+ backgroundColor: r,
1519
+ penColor: i,
1520
+ minWidth: a,
1521
+ maxWidth: a
1522
+ });
1523
+ this.pad = o, o.addEventListener?.("endStroke", this.strokeListener), this.resizeCanvas(e), window.addEventListener("resize", this.onWinResize), this.applySerializedValue();
1524
+ } catch (e) {
1525
+ this.loadError = e instanceof Error ? e.message : "Signature pad failed to load.";
1526
+ }
1527
+ }
1528
+ disconnectedCallback() {
1529
+ super.disconnectedCallback(), window.removeEventListener("resize", this.onWinResize), this.pad?.removeEventListener && this.pad.removeEventListener("endStroke", this.strokeListener), this.pad = null;
1530
+ }
1531
+ resolveDrawModuleConfig() {
1532
+ let e = new Set(this.field.moduleRefs || []), t = this.modules.find((t) => e.has(t.id) && t.capability === "draw-signature");
1533
+ return t && typeof t.config == "object" && t.config ? t.config : null;
1534
+ }
1535
+ resizeCanvas(e) {
1536
+ let t = Math.max(window.devicePixelRatio || 1, 1), n = Math.max(1, Math.floor(e.clientWidth || 480)), r = e.getContext("2d");
1537
+ e.width = n * t, e.height = 192 * t, r?.scale(t, t), e.style.width = `${n}px`, e.style.height = "192px", this.pad?.fromDataURL?.(this.value || "data:,");
1538
+ }
1539
+ updated(e) {
1540
+ if (e.has("value") && this.pad && this.applySerializedValue(), e.has("disabled") && this.pad) {
1541
+ let e = this.shadowRoot?.querySelector("canvas");
1542
+ e instanceof HTMLElement && (e.style.pointerEvents = this.disabled ? "none" : "");
1543
+ }
1544
+ }
1545
+ applySerializedValue() {
1546
+ if (this.pad) {
1547
+ if (!this.value) {
1548
+ this.pad.isEmpty() || this.pad.clear();
1549
+ return;
1550
+ }
1551
+ try {
1552
+ this.pad.fromDataURL(this.value);
1553
+ } catch {}
1554
+ }
1555
+ }
1556
+ emitValue() {
1557
+ if (!this.pad || this.pad.isEmpty()) {
1558
+ this.dispatchEvent(new CustomEvent(J, {
1559
+ detail: "",
1560
+ bubbles: !0,
1561
+ composed: !0
1562
+ }));
1563
+ return;
1564
+ }
1565
+ this.dispatchEvent(new CustomEvent(J, {
1566
+ detail: this.pad.toDataURL(),
1567
+ bubbles: !0,
1568
+ composed: !0
1569
+ }));
1570
+ }
1571
+ render() {
1572
+ return this.loadError ? j`<div class="err">${this.loadError}</div>` : j`
1573
+ <div class="wrap">
1574
+ <canvas></canvas>
1575
+ <button type="button" ?disabled=${this.disabled} @click=${() => {
1576
+ this.pad?.clear(), this.dispatchEvent(new CustomEvent(J, {
1577
+ detail: "",
1578
+ bubbles: !0,
1579
+ composed: !0
1580
+ }));
1581
+ }}>Clear</button>
1582
+ </div>
1583
+ `;
1584
+ }
1644
1585
  };
1586
+ Y([H({ attribute: !1 })], $.prototype, "field", void 0), Y([H({ attribute: !1 })], $.prototype, "modules", void 0), Y([H({ type: String })], $.prototype, "value", void 0), Y([H({ type: Boolean })], $.prototype, "disabled", void 0), Y([U()], $.prototype, "loadError", void 0);
1587
+ //#endregion
1588
+ //#region src/index.ts
1589
+ var Lt = !1;
1590
+ function Rt() {
1591
+ Lt || (Lt = !0, customElements.get("formie-form") || customElements.define("formie-form", It), customElements.get("formie-internal-signature") || customElements.define("formie-internal-signature", $), customElements.get("formie-core-form") || customElements.define("formie-core-form", X));
1592
+ }
1593
+ //#endregion
1594
+ export { J as FORMIE_CONTROL_VALUE_EVENT, X as FormieCoreForm, It as FormieFormElement, $ as FormieInternalSignature, G as FormieRegistry, W as assertValidCustomElementName, ee as createFormieClient, Ze as createFormieRegistry, Xe as getFormieRegistry, ft as isFieldDefinition, Rt as registerFormieWebComponents, Mt as renderErrorView, kt as renderFormView, jt as renderLoadingView, pt as resolveFieldRendererType };