@verbb/formie-web-components 1.0.13 → 1.0.14

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