drill-widgets 2.7.16 → 2.7.18

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.
@@ -3,18 +3,18 @@
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- const K = globalThis, he = K.ShadowRoot && (K.ShadyCSS === void 0 || K.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ge = Symbol(), ve = /* @__PURE__ */ new WeakMap();
6
+ const K = globalThis, ge = K.ShadowRoot && (K.ShadyCSS === void 0 || K.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, me = Symbol(), xe = /* @__PURE__ */ new WeakMap();
7
7
  let Fe = class {
8
8
  constructor(e, t, i) {
9
- if (this._$cssResult$ = !0, i !== ge) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
9
+ if (this._$cssResult$ = !0, i !== me) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
10
10
  this.cssText = e, this.t = t;
11
11
  }
12
12
  get styleSheet() {
13
13
  let e = this.o;
14
14
  const t = this.t;
15
- if (he && e === void 0) {
15
+ if (ge && e === void 0) {
16
16
  const i = t !== void 0 && t.length === 1;
17
- i && (e = ve.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && ve.set(t, e));
17
+ i && (e = xe.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && xe.set(t, e));
18
18
  }
19
19
  return e;
20
20
  }
@@ -22,20 +22,20 @@ let Fe = class {
22
22
  return this.cssText;
23
23
  }
24
24
  };
25
- const Oe = (s) => new Fe(typeof s == "string" ? s : s + "", void 0, ge), O = (s, ...e) => {
25
+ const Oe = (s) => new Fe(typeof s == "string" ? s : s + "", void 0, me), O = (s, ...e) => {
26
26
  const t = s.length === 1 ? s[0] : e.reduce((i, r, n) => i + ((o) => {
27
27
  if (o._$cssResult$ === !0) return o.cssText;
28
28
  if (typeof o == "number") return o;
29
29
  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.");
30
30
  })(r) + s[n + 1], s[0]);
31
- return new Fe(t, s, ge);
31
+ return new Fe(t, s, me);
32
32
  }, Re = (s, e) => {
33
- if (he) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
33
+ if (ge) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
34
34
  else for (const t of e) {
35
35
  const i = document.createElement("style"), r = K.litNonce;
36
36
  r !== void 0 && i.setAttribute("nonce", r), i.textContent = t.cssText, s.appendChild(i);
37
37
  }
38
- }, xe = he ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
38
+ }, _e = ge ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
39
39
  let t = "";
40
40
  for (const i of e.cssRules) t += i.cssText;
41
41
  return Oe(t);
@@ -45,7 +45,7 @@ const Oe = (s) => new Fe(typeof s == "string" ? s : s + "", void 0, ge), O = (s,
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
47
  */
48
- const { is: We, defineProperty: He, getOwnPropertyDescriptor: Ve, getOwnPropertyNames: je, getOwnPropertySymbols: Be, getPrototypeOf: Qe } = Object, M = globalThis, _e = M.trustedTypes, Ge = _e ? _e.emptyScript : "", re = M.reactiveElementPolyfillSupport, H = (s, e) => s, J = { toAttribute(s, e) {
48
+ const { is: je, defineProperty: Ve, getOwnPropertyDescriptor: We, getOwnPropertyNames: He, getOwnPropertySymbols: Be, getPrototypeOf: Qe } = Object, T = globalThis, ye = T.trustedTypes, Ge = ye ? ye.emptyScript : "", re = T.reactiveElementPolyfillSupport, V = (s, e) => s, J = { toAttribute(s, e) {
49
49
  switch (e) {
50
50
  case Boolean:
51
51
  s = s ? Ge : null;
@@ -73,23 +73,23 @@ const { is: We, defineProperty: He, getOwnPropertyDescriptor: Ve, getOwnProperty
73
73
  }
74
74
  }
75
75
  return t;
76
- } }, me = (s, e) => !We(s, e), ye = { attribute: !0, type: String, converter: J, reflect: !1, useDefault: !1, hasChanged: me };
77
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), M.litPropertyMetadata ?? (M.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
78
- let U = class extends HTMLElement {
76
+ } }, fe = (s, e) => !je(s, e), we = { attribute: !0, type: String, converter: J, reflect: !1, useDefault: !1, hasChanged: fe };
77
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), T.litPropertyMetadata ?? (T.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
78
+ let P = class extends HTMLElement {
79
79
  static addInitializer(e) {
80
80
  this._$Ei(), (this.l ?? (this.l = [])).push(e);
81
81
  }
82
82
  static get observedAttributes() {
83
83
  return this.finalize(), this._$Eh && [...this._$Eh.keys()];
84
84
  }
85
- static createProperty(e, t = ye) {
85
+ static createProperty(e, t = we) {
86
86
  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) {
87
87
  const i = Symbol(), r = this.getPropertyDescriptor(e, i, t);
88
- r !== void 0 && He(this.prototype, e, r);
88
+ r !== void 0 && Ve(this.prototype, e, r);
89
89
  }
90
90
  }
91
91
  static getPropertyDescriptor(e, t, i) {
92
- const { get: r, set: n } = Ve(this.prototype, e) ?? { get() {
92
+ const { get: r, set: n } = We(this.prototype, e) ?? { get() {
93
93
  return this[t];
94
94
  }, set(o) {
95
95
  this[t] = o;
@@ -100,17 +100,17 @@ let U = class extends HTMLElement {
100
100
  }, configurable: !0, enumerable: !0 };
101
101
  }
102
102
  static getPropertyOptions(e) {
103
- return this.elementProperties.get(e) ?? ye;
103
+ return this.elementProperties.get(e) ?? we;
104
104
  }
105
105
  static _$Ei() {
106
- if (this.hasOwnProperty(H("elementProperties"))) return;
106
+ if (this.hasOwnProperty(V("elementProperties"))) return;
107
107
  const e = Qe(this);
108
108
  e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
109
109
  }
110
110
  static finalize() {
111
- if (this.hasOwnProperty(H("finalized"))) return;
112
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(H("properties"))) {
113
- const t = this.properties, i = [...je(t), ...Be(t)];
111
+ if (this.hasOwnProperty(V("finalized"))) return;
112
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(V("properties"))) {
113
+ const t = this.properties, i = [...He(t), ...Be(t)];
114
114
  for (const r of i) this.createProperty(r, t[r]);
115
115
  }
116
116
  const e = this[Symbol.metadata];
@@ -129,8 +129,8 @@ let U = class extends HTMLElement {
129
129
  const t = [];
130
130
  if (Array.isArray(e)) {
131
131
  const i = new Set(e.flat(1 / 0).reverse());
132
- for (const r of i) t.unshift(xe(r));
133
- } else e !== void 0 && t.push(xe(e));
132
+ for (const r of i) t.unshift(_e(r));
133
+ } else e !== void 0 && t.push(_e(e));
134
134
  return t;
135
135
  }
136
136
  static _$Eu(e, t) {
@@ -200,7 +200,7 @@ let U = class extends HTMLElement {
200
200
  var r;
201
201
  if (e !== void 0) {
202
202
  const n = this.constructor, o = this[e];
203
- if (i ?? (i = n.getPropertyOptions(e)), !((i.hasChanged ?? me)(o, t) || i.useDefault && i.reflect && o === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(n._$Eu(e, i)))) return;
203
+ if (i ?? (i = n.getPropertyOptions(e)), !((i.hasChanged ?? fe)(o, t) || i.useDefault && i.reflect && o === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(n._$Eu(e, i)))) return;
204
204
  this.C(e, t, i);
205
205
  }
206
206
  this.isUpdatePending === !1 && (this._$ES = this._$EP());
@@ -276,18 +276,18 @@ let U = class extends HTMLElement {
276
276
  firstUpdated(e) {
277
277
  }
278
278
  };
279
- U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[H("elementProperties")] = /* @__PURE__ */ new Map(), U[H("finalized")] = /* @__PURE__ */ new Map(), re == null || re({ ReactiveElement: U }), (M.reactiveElementVersions ?? (M.reactiveElementVersions = [])).push("2.1.0");
279
+ P.elementStyles = [], P.shadowRootOptions = { mode: "open" }, P[V("elementProperties")] = /* @__PURE__ */ new Map(), P[V("finalized")] = /* @__PURE__ */ new Map(), re == null || re({ ReactiveElement: P }), (T.reactiveElementVersions ?? (T.reactiveElementVersions = [])).push("2.1.0");
280
280
  /**
281
281
  * @license
282
282
  * Copyright 2017 Google LLC
283
283
  * SPDX-License-Identifier: BSD-3-Clause
284
284
  */
285
- const V = globalThis, X = V.trustedTypes, we = X ? X.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ze = "$lit$", E = `lit$${Math.random().toFixed(9).slice(2)}$`, Ie = "?" + E, Ye = `<${Ie}>`, I = document, j = () => I.createComment(""), B = (s) => s === null || typeof s != "object" && typeof s != "function", fe = Array.isArray, qe = (s) => fe(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", ne = `[
286
- \f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Se = /-->/g, ke = />/g, T = RegExp(`>|${ne}(?:([^\\s"'>=/]+)(${ne}*=${ne}*(?:[^
287
- \f\r"'\`<>=]|("|')|))|$)`, "g"), $e = /'/g, De = /"/g, Pe = /^(?:script|style|textarea|title)$/i, Ke = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), l = Ke(1), P = Symbol.for("lit-noChange"), x = Symbol.for("lit-nothing"), Ce = /* @__PURE__ */ new WeakMap(), F = I.createTreeWalker(I, 129);
288
- function Ue(s, e) {
289
- if (!fe(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
290
- return we !== void 0 ? we.createHTML(e) : e;
285
+ const W = globalThis, X = W.trustedTypes, Se = X ? X.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ze = "$lit$", E = `lit$${Math.random().toFixed(9).slice(2)}$`, Ie = "?" + E, Ye = `<${Ie}>`, I = document, H = () => I.createComment(""), B = (s) => s === null || typeof s != "object" && typeof s != "function", be = Array.isArray, qe = (s) => be(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", ne = `[
286
+ \f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ke = /-->/g, $e = />/g, M = RegExp(`>|${ne}(?:([^\\s"'>=/]+)(${ne}*=${ne}*(?:[^
287
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), De = /'/g, Ce = /"/g, Ue = /^(?:script|style|textarea|title)$/i, Ke = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), l = Ke(1), U = Symbol.for("lit-noChange"), w = Symbol.for("lit-nothing"), Ae = /* @__PURE__ */ new WeakMap(), F = I.createTreeWalker(I, 129);
288
+ function Pe(s, e) {
289
+ if (!be(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
290
+ return Se !== void 0 ? Se.createHTML(e) : e;
291
291
  }
292
292
  const Je = (s, e) => {
293
293
  const t = s.length - 1, i = [];
@@ -295,11 +295,11 @@ const Je = (s, e) => {
295
295
  for (let a = 0; a < t; a++) {
296
296
  const d = s[a];
297
297
  let p, c, u = -1, h = 0;
298
- for (; h < d.length && (o.lastIndex = h, c = o.exec(d), c !== null); ) h = o.lastIndex, o === R ? c[1] === "!--" ? o = Se : c[1] !== void 0 ? o = ke : c[2] !== void 0 ? (Pe.test(c[2]) && (r = RegExp("</" + c[2], "g")), o = T) : c[3] !== void 0 && (o = T) : o === T ? c[0] === ">" ? (o = r ?? R, u = -1) : c[1] === void 0 ? u = -2 : (u = o.lastIndex - c[2].length, p = c[1], o = c[3] === void 0 ? T : c[3] === '"' ? De : $e) : o === De || o === $e ? o = T : o === Se || o === ke ? o = R : (o = T, r = void 0);
299
- const g = o === T && s[a + 1].startsWith("/>") ? " " : "";
298
+ for (; h < d.length && (o.lastIndex = h, c = o.exec(d), c !== null); ) h = o.lastIndex, o === R ? c[1] === "!--" ? o = ke : c[1] !== void 0 ? o = $e : c[2] !== void 0 ? (Ue.test(c[2]) && (r = RegExp("</" + c[2], "g")), o = M) : c[3] !== void 0 && (o = M) : o === M ? c[0] === ">" ? (o = r ?? R, u = -1) : c[1] === void 0 ? u = -2 : (u = o.lastIndex - c[2].length, p = c[1], o = c[3] === void 0 ? M : c[3] === '"' ? Ce : De) : o === Ce || o === De ? o = M : o === ke || o === $e ? o = R : (o = M, r = void 0);
299
+ const g = o === M && s[a + 1].startsWith("/>") ? " " : "";
300
300
  n += o === R ? d + Ye : u >= 0 ? (i.push(p), d.slice(0, u) + ze + d.slice(u) + E + g) : d + E + (u === -2 ? a : g);
301
301
  }
302
- return [Ue(s, n + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
302
+ return [Pe(s, n + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
303
303
  };
304
304
  class Q {
305
305
  constructor({ strings: e, _$litType$: t }, i) {
@@ -314,15 +314,15 @@ class Q {
314
314
  for (; (r = F.nextNode()) !== null && d.length < a; ) {
315
315
  if (r.nodeType === 1) {
316
316
  if (r.hasAttributes()) for (const u of r.getAttributeNames()) if (u.endsWith(ze)) {
317
- const h = c[o++], g = r.getAttribute(u).split(E), v = /([.?@])?(.*)/.exec(h);
318
- d.push({ type: 1, index: n, name: v[2], strings: g, ctor: v[1] === "." ? Ze : v[1] === "?" ? et : v[1] === "@" ? tt : se }), r.removeAttribute(u);
317
+ const h = c[o++], g = r.getAttribute(u).split(E), x = /([.?@])?(.*)/.exec(h);
318
+ d.push({ type: 1, index: n, name: x[2], strings: g, ctor: x[1] === "." ? Ze : x[1] === "?" ? et : x[1] === "@" ? tt : se }), r.removeAttribute(u);
319
319
  } else u.startsWith(E) && (d.push({ type: 6, index: n }), r.removeAttribute(u));
320
- if (Pe.test(r.tagName)) {
320
+ if (Ue.test(r.tagName)) {
321
321
  const u = r.textContent.split(E), h = u.length - 1;
322
322
  if (h > 0) {
323
323
  r.textContent = X ? X.emptyScript : "";
324
- for (let g = 0; g < h; g++) r.append(u[g], j()), F.nextNode(), d.push({ type: 2, index: ++n });
325
- r.append(u[h], j());
324
+ for (let g = 0; g < h; g++) r.append(u[g], H()), F.nextNode(), d.push({ type: 2, index: ++n });
325
+ r.append(u[h], H());
326
326
  }
327
327
  }
328
328
  } else if (r.nodeType === 8) if (r.data === Ie) d.push({ type: 2, index: n });
@@ -340,7 +340,7 @@ class Q {
340
340
  }
341
341
  function L(s, e, t = s, i) {
342
342
  var o, a;
343
- if (e === P) return e;
343
+ if (e === U) return e;
344
344
  let r = i !== void 0 ? (o = t._$Co) == null ? void 0 : o[i] : t._$Cl;
345
345
  const n = B(e) ? void 0 : e._$litDirective$;
346
346
  return (r == null ? void 0 : r.constructor) !== n && ((a = r == null ? void 0 : r._$AO) == null || a.call(r, !1), n === void 0 ? r = void 0 : (r = new n(s), r._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = r : t._$Cl = r), r !== void 0 && (e = L(s, r._$AS(s, e.values), r, i)), e;
@@ -379,7 +379,7 @@ class G {
379
379
  return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
380
380
  }
381
381
  constructor(e, t, i, r) {
382
- this.type = 2, this._$AH = x, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = r, this._$Cv = (r == null ? void 0 : r.isConnected) ?? !0;
382
+ this.type = 2, this._$AH = w, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = r, this._$Cv = (r == null ? void 0 : r.isConnected) ?? !0;
383
383
  }
384
384
  get parentNode() {
385
385
  let e = this._$AA.parentNode;
@@ -393,7 +393,7 @@ class G {
393
393
  return this._$AB;
394
394
  }
395
395
  _$AI(e, t = this) {
396
- e = L(this, e, t), B(e) ? e === x || e == null || e === "" ? (this._$AH !== x && this._$AR(), this._$AH = x) : e !== this._$AH && e !== P && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : qe(e) ? this.k(e) : this._(e);
396
+ e = L(this, e, t), B(e) ? e === w || e == null || e === "" ? (this._$AH !== w && this._$AR(), this._$AH = w) : e !== this._$AH && e !== U && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : qe(e) ? this.k(e) : this._(e);
397
397
  }
398
398
  O(e) {
399
399
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -402,11 +402,11 @@ class G {
402
402
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
403
403
  }
404
404
  _(e) {
405
- this._$AH !== x && B(this._$AH) ? this._$AA.nextSibling.data = e : this.T(I.createTextNode(e)), this._$AH = e;
405
+ this._$AH !== w && B(this._$AH) ? this._$AA.nextSibling.data = e : this.T(I.createTextNode(e)), this._$AH = e;
406
406
  }
407
407
  $(e) {
408
408
  var n;
409
- const { values: t, _$litType$: i } = e, r = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = Q.createElement(Ue(i.h, i.h[0]), this.options)), i);
409
+ const { values: t, _$litType$: i } = e, r = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = Q.createElement(Pe(i.h, i.h[0]), this.options)), i);
410
410
  if (((n = this._$AH) == null ? void 0 : n._$AD) === r) this._$AH.p(t);
411
411
  else {
412
412
  const o = new Xe(r, this), a = o.u(this.options);
@@ -414,14 +414,14 @@ class G {
414
414
  }
415
415
  }
416
416
  _$AC(e) {
417
- let t = Ce.get(e.strings);
418
- return t === void 0 && Ce.set(e.strings, t = new Q(e)), t;
417
+ let t = Ae.get(e.strings);
418
+ return t === void 0 && Ae.set(e.strings, t = new Q(e)), t;
419
419
  }
420
420
  k(e) {
421
- fe(this._$AH) || (this._$AH = [], this._$AR());
421
+ be(this._$AH) || (this._$AH = [], this._$AR());
422
422
  const t = this._$AH;
423
423
  let i, r = 0;
424
- for (const n of e) r === t.length ? t.push(i = new G(this.O(j()), this.O(j()), this, this.options)) : i = t[r], i._$AI(n), r++;
424
+ for (const n of e) r === t.length ? t.push(i = new G(this.O(H()), this.O(H()), this, this.options)) : i = t[r], i._$AI(n), r++;
425
425
  r < t.length && (this._$AR(i && i._$AB.nextSibling, r), t.length = r);
426
426
  }
427
427
  _$AR(e = this._$AA.nextSibling, t) {
@@ -444,21 +444,21 @@ class se {
444
444
  return this._$AM._$AU;
445
445
  }
446
446
  constructor(e, t, i, r, n) {
447
- this.type = 1, this._$AH = x, this._$AN = void 0, this.element = e, this.name = t, 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 = x;
447
+ this.type = 1, this._$AH = w, this._$AN = void 0, this.element = e, this.name = t, 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 = w;
448
448
  }
449
449
  _$AI(e, t = this, i, r) {
450
450
  const n = this.strings;
451
451
  let o = !1;
452
- if (n === void 0) e = L(this, e, t, 0), o = !B(e) || e !== this._$AH && e !== P, o && (this._$AH = e);
452
+ if (n === void 0) e = L(this, e, t, 0), o = !B(e) || e !== this._$AH && e !== U, o && (this._$AH = e);
453
453
  else {
454
454
  const a = e;
455
455
  let d, p;
456
- for (e = n[0], d = 0; d < n.length - 1; d++) p = L(this, a[i + d], t, d), p === P && (p = this._$AH[d]), o || (o = !B(p) || p !== this._$AH[d]), p === x ? e = x : e !== x && (e += (p ?? "") + n[d + 1]), this._$AH[d] = p;
456
+ for (e = n[0], d = 0; d < n.length - 1; d++) p = L(this, a[i + d], t, d), p === U && (p = this._$AH[d]), o || (o = !B(p) || p !== this._$AH[d]), p === w ? e = w : e !== w && (e += (p ?? "") + n[d + 1]), this._$AH[d] = p;
457
457
  }
458
458
  o && !r && this.j(e);
459
459
  }
460
460
  j(e) {
461
- e === x ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
461
+ e === w ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
462
462
  }
463
463
  }
464
464
  class Ze extends se {
@@ -466,7 +466,7 @@ class Ze extends se {
466
466
  super(...arguments), this.type = 3;
467
467
  }
468
468
  j(e) {
469
- this.element[this.name] = e === x ? void 0 : e;
469
+ this.element[this.name] = e === w ? void 0 : e;
470
470
  }
471
471
  }
472
472
  class et extends se {
@@ -474,7 +474,7 @@ class et extends se {
474
474
  super(...arguments), this.type = 4;
475
475
  }
476
476
  j(e) {
477
- this.element.toggleAttribute(this.name, !!e && e !== x);
477
+ this.element.toggleAttribute(this.name, !!e && e !== w);
478
478
  }
479
479
  }
480
480
  class tt extends se {
@@ -482,8 +482,8 @@ class tt extends se {
482
482
  super(e, t, i, r, n), this.type = 5;
483
483
  }
484
484
  _$AI(e, t = this) {
485
- if ((e = L(this, e, t, 0) ?? x) === P) return;
486
- const i = this._$AH, r = e === x && i !== x || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, n = e !== x && (i === x || r);
485
+ if ((e = L(this, e, t, 0) ?? w) === U) return;
486
+ const i = this._$AH, r = e === w && i !== w || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, n = e !== w && (i === w || r);
487
487
  r && this.element.removeEventListener(this.name, this, i), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
488
488
  }
489
489
  handleEvent(e) {
@@ -502,14 +502,14 @@ class it {
502
502
  L(this, e);
503
503
  }
504
504
  }
505
- const oe = V.litHtmlPolyfillSupport;
506
- oe == null || oe(Q, G), (V.litHtmlVersions ?? (V.litHtmlVersions = [])).push("3.3.0");
505
+ const oe = W.litHtmlPolyfillSupport;
506
+ oe == null || oe(Q, G), (W.litHtmlVersions ?? (W.litHtmlVersions = [])).push("3.3.0");
507
507
  const st = (s, e, t) => {
508
508
  const i = (t == null ? void 0 : t.renderBefore) ?? e;
509
509
  let r = i._$litPart$;
510
510
  if (r === void 0) {
511
511
  const n = (t == null ? void 0 : t.renderBefore) ?? null;
512
- i._$litPart$ = r = new G(e.insertBefore(j(), n), n, void 0, t ?? {});
512
+ i._$litPart$ = r = new G(e.insertBefore(H(), n), n, void 0, t ?? {});
513
513
  }
514
514
  return r._$AI(s), r;
515
515
  };
@@ -519,7 +519,7 @@ const st = (s, e, t) => {
519
519
  * SPDX-License-Identifier: BSD-3-Clause
520
520
  */
521
521
  const z = globalThis;
522
- let N = class extends U {
522
+ let N = class extends P {
523
523
  constructor() {
524
524
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
525
525
  }
@@ -541,11 +541,11 @@ let N = class extends U {
541
541
  super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1);
542
542
  }
543
543
  render() {
544
- return P;
544
+ return U;
545
545
  }
546
546
  };
547
- var Te;
548
- N._$litElement$ = !0, N.finalized = !0, (Te = z.litElementHydrateSupport) == null || Te.call(z, { LitElement: N });
547
+ var Me;
548
+ N._$litElement$ = !0, N.finalized = !0, (Me = z.litElementHydrateSupport) == null || Me.call(z, { LitElement: N });
549
549
  const ae = z.litElementPolyfillSupport;
550
550
  ae == null || ae({ LitElement: N });
551
551
  (z.litElementVersions ?? (z.litElementVersions = [])).push("4.2.0");
@@ -564,7 +564,7 @@ const Ne = (s) => (e, t) => {
564
564
  * Copyright 2017 Google LLC
565
565
  * SPDX-License-Identifier: BSD-3-Clause
566
566
  */
567
- const rt = { attribute: !0, type: String, converter: J, reflect: !1, hasChanged: me }, nt = (s = rt, e, t) => {
567
+ const rt = { attribute: !0, type: String, converter: J, reflect: !1, hasChanged: fe }, nt = (s = rt, e, t) => {
568
568
  const { kind: i, metadata: r } = t;
569
569
  let n = globalThis.litPropertyMetadata.get(r);
570
570
  if (n === void 0 && globalThis.litPropertyMetadata.set(r, n = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), n.set(t.name, s), i === "accessor") {
@@ -585,7 +585,7 @@ const rt = { attribute: !0, type: String, converter: J, reflect: !1, hasChanged:
585
585
  }
586
586
  throw Error("Unsupported decorator location: " + i);
587
587
  };
588
- function C(s) {
588
+ function $(s) {
589
589
  return (e, t) => typeof t == "object" ? nt(s, e, t) : ((i, r, n) => {
590
590
  const o = r.hasOwnProperty(n);
591
591
  return r.constructor.createProperty(n, i), o ? Object.getOwnPropertyDescriptor(r, n) : void 0;
@@ -597,13 +597,13 @@ function C(s) {
597
597
  * SPDX-License-Identifier: BSD-3-Clause
598
598
  */
599
599
  function b(s) {
600
- return C({ ...s, state: !0, attribute: !1 });
600
+ return $({ ...s, state: !0, attribute: !1 });
601
601
  }
602
- const w = [];
602
+ const k = [];
603
603
  for (let s = 0; s < 256; ++s)
604
- w.push((s + 256).toString(16).slice(1));
604
+ k.push((s + 256).toString(16).slice(1));
605
605
  function ot(s, e = 0) {
606
- return (w[s[e + 0]] + w[s[e + 1]] + w[s[e + 2]] + w[s[e + 3]] + "-" + w[s[e + 4]] + w[s[e + 5]] + "-" + w[s[e + 6]] + w[s[e + 7]] + "-" + w[s[e + 8]] + w[s[e + 9]] + "-" + w[s[e + 10]] + w[s[e + 11]] + w[s[e + 12]] + w[s[e + 13]] + w[s[e + 14]] + w[s[e + 15]]).toLowerCase();
606
+ return (k[s[e + 0]] + k[s[e + 1]] + k[s[e + 2]] + k[s[e + 3]] + "-" + k[s[e + 4]] + k[s[e + 5]] + "-" + k[s[e + 6]] + k[s[e + 7]] + "-" + k[s[e + 8]] + k[s[e + 9]] + "-" + k[s[e + 10]] + k[s[e + 11]] + k[s[e + 12]] + k[s[e + 13]] + k[s[e + 14]] + k[s[e + 15]]).toLowerCase();
607
607
  }
608
608
  let de;
609
609
  const at = new Uint8Array(16);
@@ -615,11 +615,11 @@ function dt() {
615
615
  }
616
616
  return de(at);
617
617
  }
618
- const lt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ae = { randomUUID: lt };
618
+ const lt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ee = { randomUUID: lt };
619
619
  function A(s, e, t) {
620
620
  var r;
621
- if (Ae.randomUUID && !s)
622
- return Ae.randomUUID();
621
+ if (Ee.randomUUID && !s)
622
+ return Ee.randomUUID();
623
623
  s = s || {};
624
624
  const i = s.random ?? ((r = s.rng) == null ? void 0 : r.call(s)) ?? dt();
625
625
  if (i.length < 16)
@@ -880,7 +880,8 @@ const pt = O`
880
880
  }
881
881
 
882
882
  .form-group input,
883
- .form-group textarea {
883
+ .form-group textarea,
884
+ .form-group select {
884
885
  padding: 12px;
885
886
  border: 1px solid var(--input-border);
886
887
  border-radius: var(--input-radius);
@@ -890,12 +891,22 @@ const pt = O`
890
891
  color: inherit;
891
892
  }
892
893
 
894
+ .form-group select {
895
+ cursor: pointer;
896
+ appearance: none;
897
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
898
+ background-repeat: no-repeat;
899
+ background-position: right 12px center;
900
+ padding-right: 40px;
901
+ }
902
+
893
903
  .form-group input:focus,
894
- .form-group textarea:focus {
904
+ .form-group textarea:focus,
905
+ .form-group select:focus {
895
906
  outline: none;
896
907
  border-color: var(--input-border-focus);
897
908
  box-shadow: 0 0 0 3px var(--input-focus-ring);
898
- background: var(--input-bg);
909
+ background-color: var(--input-bg);
899
910
  }
900
911
 
901
912
  .form-group input::placeholder,
@@ -3337,6 +3348,44 @@ const pt = O`
3337
3348
  width: 100%;
3338
3349
  }
3339
3350
 
3351
+ /* Submission Error Icon */
3352
+ .submission-error-icon {
3353
+ color: #ef4444;
3354
+ margin-bottom: 16px;
3355
+ }
3356
+
3357
+ .submission-error-icon svg {
3358
+ stroke: #ef4444;
3359
+ }
3360
+
3361
+ /* Error badge in sidebar */
3362
+ .runner-step-badge.error {
3363
+ background: #fee2e2;
3364
+ color: #dc2626;
3365
+ }
3366
+
3367
+ /* Retry Button */
3368
+ .retry-button {
3369
+ background: #3b82f6;
3370
+ color: white;
3371
+ border: none;
3372
+ border-radius: 8px;
3373
+ padding: 12px 24px;
3374
+ font-size: 16px;
3375
+ font-weight: 500;
3376
+ cursor: pointer;
3377
+ transition: background 0.2s ease;
3378
+ margin-top: 24px;
3379
+ }
3380
+
3381
+ .retry-button:hover {
3382
+ background: #2563eb;
3383
+ }
3384
+
3385
+ .retry-button:active {
3386
+ background: #1d4ed8;
3387
+ }
3388
+
3340
3389
  /* Clean styling for checkbox lists in print */
3341
3390
  .print-response-value.checkbox-response div {
3342
3391
  margin: 2px 0;
@@ -3847,14 +3896,14 @@ const pt = O`
3847
3896
  }
3848
3897
  }
3849
3898
  `;
3850
- var gt = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, S = (s, e, t, i) => {
3899
+ var gt = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, _ = (s, e, t, i) => {
3851
3900
  for (var r = i > 1 ? void 0 : i ? mt(e, t) : e, n = s.length - 1, o; n >= 0; n--)
3852
3901
  (o = s[n]) && (r = (i ? o(e, t, r) : o(r)) || r);
3853
3902
  return i && r && gt(e, t, r), r;
3854
3903
  };
3855
- let _ = class extends N {
3904
+ let v = class extends N {
3856
3905
  constructor() {
3857
- super(...arguments), this._templateData = {
3906
+ super(...arguments), this.labelForDrill = "Drill", this.labelForGroup = "Group", this.subjectTypes = [], this.groups = [], this._templateData = {
3858
3907
  name: "",
3859
3908
  description: "",
3860
3909
  steps: []
@@ -3918,7 +3967,8 @@ let _ = class extends N {
3918
3967
  id: this._templateData.id || A(),
3919
3968
  name: this._templateData.name,
3920
3969
  description: this._templateData.description || "",
3921
- steps: this._templateData.steps || []
3970
+ steps: this._templateData.steps || [],
3971
+ subjectType: this._templateData.subjectType
3922
3972
  };
3923
3973
  console.log("💾 Builder Widget: Save button clicked"), console.log("📄 Workflow Template:", JSON.stringify(i, null, 2)), this.workflow ? (console.log("Calling onWorkflowUpdated callback"), (e = this.onWorkflowUpdated) == null || e.call(this, i)) : (console.log("Calling onWorkflowCreated callback"), (t = this.onWorkflowCreated) == null || t.call(this, i));
3924
3974
  } else
@@ -4079,6 +4129,12 @@ let _ = class extends N {
4079
4129
  steps: n
4080
4130
  }, console.log("📝 Template updated with new step order"), this._draggedStepId = null, this._dragOverStepId = null;
4081
4131
  }
4132
+ _handleSubjectTypeChange(s) {
4133
+ this._templateData = {
4134
+ ...this._templateData,
4135
+ subjectType: s.target.value
4136
+ };
4137
+ }
4082
4138
  _addQuestion(s = "text_input") {
4083
4139
  var i, r;
4084
4140
  if (!this._templateData.steps || this._templateData.steps.length === 0 || !this._selectedStepId) {
@@ -4780,7 +4836,7 @@ Use **bold** and *italic* text.`;
4780
4836
  case "role":
4781
4837
  switch (s.type) {
4782
4838
  case "instance_role_assignee_select":
4783
- return s.targetId ? `Assigned to: ${s.targetId} role` : "Assigned to: Role";
4839
+ return s.targetId ? `Assigned to: ${s.targetName} role` : "Assigned to: Role";
4784
4840
  default:
4785
4841
  return "Assigned to: Role";
4786
4842
  }
@@ -4793,7 +4849,7 @@ Use **bold** and *italic* text.`;
4793
4849
  const s = this._getSelectedStep();
4794
4850
  return l`
4795
4851
  <div class="header">
4796
- <div class="header-inputs">
4852
+ <div class="header-inputs flex items-center">
4797
4853
  <div class="form-group">
4798
4854
  <label for="template-title">Title</label>
4799
4855
  <input
@@ -4814,6 +4870,14 @@ Use **bold** and *italic* text.`;
4814
4870
  @input=${this._handleDescriptionChange}
4815
4871
  />
4816
4872
  </div>
4873
+ ${this.subjectTypes.length > 0 ? l`<div class="form-group">
4874
+ <label for="subject-type-select">Subject Type</label>
4875
+ <select id="subject-type-select" @change=${this._handleSubjectTypeChange}>
4876
+ ${this.subjectTypes.map(
4877
+ (t) => l`<option value=${t.name}>${t.name}</option>`
4878
+ )}
4879
+ </select>
4880
+ </div>` : l``}
4817
4881
  </div>
4818
4882
  <div class="header-actions">
4819
4883
  <button class="save-button" @click=${this._handleSave}>Save template</button>
@@ -4878,9 +4942,10 @@ Use **bold** and *italic* text.`;
4878
4942
  >
4879
4943
  <div class="assignment-card-radio"></div>
4880
4944
  <div class="assignment-card-content">
4881
- <div class="assignment-card-title">Groups</div>
4945
+ <div class="assignment-card-title">${this.labelForGroup}</div>
4882
4946
  <div class="assignment-card-description">
4883
- Assignment is based on individuals within a certain group.
4947
+ Assignment is based on individuals within a certain
4948
+ ${this.labelForGroup}.
4884
4949
  </div>
4885
4950
  </div>
4886
4951
  </div>
@@ -4899,9 +4964,12 @@ Use **bold** and *italic* text.`;
4899
4964
  }}
4900
4965
  />
4901
4966
  <div class="assignment-radio-label">
4902
- <div class="assignment-radio-title">Drill subject</div>
4967
+ <div class="assignment-radio-title">
4968
+ ${this.labelForDrill} subject
4969
+ </div>
4903
4970
  <div class="assignment-radio-description">
4904
- The step will be assigned to the subject of this drill.
4971
+ The step will be assigned to the subject of this
4972
+ ${this.labelForDrill}.
4905
4973
  </div>
4906
4974
  </div>
4907
4975
  </label>
@@ -4918,9 +4986,12 @@ Use **bold** and *italic* text.`;
4918
4986
  />
4919
4987
 
4920
4988
  <div class="assignment-radio-label">
4921
- <div class="assignment-radio-title">Drill creator</div>
4989
+ <div class="assignment-radio-title">
4990
+ ${this.labelForDrill} creator
4991
+ </div>
4922
4992
  <div class="assignment-radio-description">
4923
- The step will be assigned to the creator of this drill.
4993
+ The step will be assigned to the creator of this
4994
+ ${this.labelForDrill}.
4924
4995
  </div>
4925
4996
  </div>
4926
4997
  </label>
@@ -4937,11 +5008,11 @@ Use **bold** and *italic* text.`;
4937
5008
  />
4938
5009
  <div class="assignment-radio-label">
4939
5010
  <div class="assignment-radio-title">
4940
- Assign at start of the Drill
5011
+ Assign at start of the ${this.labelForDrill}
4941
5012
  </div>
4942
5013
  <div class="assignment-radio-description">
4943
- At the start of this Drill, the initiator will be able to choose
4944
- an individual recipient.
5014
+ At the start of this ${this.labelForDrill}, the initiator will
5015
+ be able to choose an individual recipient.
4945
5016
  </div>
4946
5017
  </div>
4947
5018
  </label>
@@ -5000,35 +5071,28 @@ Use **bold** and *italic* text.`;
5000
5071
  />
5001
5072
  ` : ""}
5002
5073
  ` : l`
5003
- <div class="assignment-radio-group">
5004
- <label class="assignment-radio-option">
5005
- <input
5006
- type="radio"
5007
- name="assignment-type"
5008
- value="instance_role_assignee_select"
5009
- checked
5010
- />
5011
- <div class="assignment-radio-label">
5012
- <div class="assignment-radio-title">Select a group</div>
5013
- <div class="assignment-radio-description">
5014
- Members of the selected group will be eligible for assignment.
5015
- </div>
5016
- </div>
5017
- </label>
5018
- </div>
5074
+ <label for="group-select">Select a ${this.labelForGroup}</label>
5019
5075
 
5020
5076
  <select
5021
5077
  class="assignment-select"
5022
5078
  .value=${this._stepAssignmentTarget}
5023
5079
  @change=${(t) => {
5080
+ var n, o;
5024
5081
  const i = t.target;
5025
5082
  this._stepAssignmentTarget = i.value;
5083
+ const r = (n = this._templateData.steps) == null ? void 0 : n.findIndex(
5084
+ (a) => a.id === this._editingStepId
5085
+ );
5086
+ r !== void 0 && r > -1 && (this._templateData.steps[r].assignment.targetName = (o = this.groups.find((a) => a.id === i.value)) == null ? void 0 : o.name, this._templateData.steps[r].assignment.targetId = i.value, this.requestUpdate());
5026
5087
  }}
5027
5088
  >
5028
- <option value="">Select group</option>
5029
- <option value="manager">Manager</option>
5030
- <option value="hr">HR</option>
5031
- <option value="admin">Admin</option>
5089
+ <!-- Groups -->
5090
+ <option value="" disabled selected>
5091
+ Select a ${this.labelForGroup}
5092
+ </option>
5093
+ ${this.groups.map(
5094
+ (t) => l` <option value=${t.id}>${t.name}</option> `
5095
+ )}
5032
5096
  </select>
5033
5097
  `}
5034
5098
  </div>
@@ -5442,64 +5506,76 @@ Use **bold** and *italic* text.`;
5442
5506
  `;
5443
5507
  }
5444
5508
  };
5445
- _.styles = O`
5509
+ v.styles = O`
5446
5510
  ${pt}
5447
5511
  ${ct}
5448
5512
  ${ut}
5449
5513
  ${Le}
5450
5514
  ${ht}
5451
5515
  `;
5452
- S([
5516
+ _([
5517
+ $({ attribute: !1 })
5518
+ ], v.prototype, "labelForDrill", 2);
5519
+ _([
5520
+ $({ attribute: !1 })
5521
+ ], v.prototype, "labelForGroup", 2);
5522
+ _([
5523
+ $({ attribute: !1 })
5524
+ ], v.prototype, "subjectTypes", 2);
5525
+ _([
5526
+ $({ attribute: !1 })
5527
+ ], v.prototype, "groups", 2);
5528
+ _([
5453
5529
  b()
5454
- ], _.prototype, "_templateData", 2);
5455
- S([
5530
+ ], v.prototype, "_templateData", 2);
5531
+ _([
5456
5532
  b()
5457
- ], _.prototype, "_showStepModal", 2);
5458
- S([
5533
+ ], v.prototype, "_showStepModal", 2);
5534
+ _([
5459
5535
  b()
5460
- ], _.prototype, "_stepFormData", 2);
5461
- S([
5536
+ ], v.prototype, "_stepFormData", 2);
5537
+ _([
5462
5538
  b()
5463
- ], _.prototype, "_draggedStepId", 2);
5464
- S([
5539
+ ], v.prototype, "_draggedStepId", 2);
5540
+ _([
5465
5541
  b()
5466
- ], _.prototype, "_dragOverStepId", 2);
5467
- S([
5542
+ ], v.prototype, "_dragOverStepId", 2);
5543
+ _([
5468
5544
  b()
5469
- ], _.prototype, "_selectedStepId", 2);
5470
- S([
5545
+ ], v.prototype, "_selectedStepId", 2);
5546
+ _([
5471
5547
  b()
5472
- ], _.prototype, "_questions", 2);
5473
- S([
5548
+ ], v.prototype, "_questions", 2);
5549
+ _([
5474
5550
  b()
5475
- ], _.prototype, "_editingStepId", 2);
5476
- S([
5551
+ ], v.prototype, "_editingStepId", 2);
5552
+ _([
5477
5553
  b()
5478
- ], _.prototype, "_stepAssignmentCategory", 2);
5479
- S([
5554
+ ], v.prototype, "_stepAssignmentCategory", 2);
5555
+ _([
5480
5556
  b()
5481
- ], _.prototype, "_stepAssignmentType", 2);
5482
- S([
5557
+ ], v.prototype, "_stepAssignmentType", 2);
5558
+ _([
5483
5559
  b()
5484
- ], _.prototype, "_stepAssignmentTarget", 2);
5485
- S([
5560
+ ], v.prototype, "_stepAssignmentTarget", 2);
5561
+ _([
5486
5562
  b()
5487
- ], _.prototype, "_stepAssignmentFirstName", 2);
5488
- S([
5563
+ ], v.prototype, "_stepAssignmentFirstName", 2);
5564
+ _([
5489
5565
  b()
5490
- ], _.prototype, "_stepAssignmentLastName", 2);
5491
- S([
5492
- C({ attribute: !1 })
5493
- ], _.prototype, "onCancel", 2);
5494
- S([
5495
- C({ attribute: !1 })
5496
- ], _.prototype, "workflow", 2);
5497
- S([
5566
+ ], v.prototype, "_stepAssignmentLastName", 2);
5567
+ _([
5568
+ $({ attribute: !1 })
5569
+ ], v.prototype, "onCancel", 2);
5570
+ _([
5571
+ $({ attribute: !1 })
5572
+ ], v.prototype, "workflow", 2);
5573
+ _([
5498
5574
  b()
5499
- ], _.prototype, "_openMenuStepId", 2);
5500
- _ = S([
5575
+ ], v.prototype, "_openMenuStepId", 2);
5576
+ v = _([
5501
5577
  Ne("builder-widget")
5502
- ], _);
5578
+ ], v);
5503
5579
  class ft {
5504
5580
  constructor(e, t) {
5505
5581
  this.signaturePads = e, this.savedSignatures = t;
@@ -5664,13 +5740,13 @@ class Z {
5664
5740
  return this.time !== e.time ? this.distanceTo(e) / (this.time - e.time) : 0;
5665
5741
  }
5666
5742
  }
5667
- class be {
5743
+ class ve {
5668
5744
  static fromPoints(e, t) {
5669
5745
  const i = this.calculateControlPoints(e[0], e[1], e[2]).c2, r = this.calculateControlPoints(e[1], e[2], e[3]).c1;
5670
- return new be(e[1], i, r, e[2], t.start, t.end);
5746
+ return new ve(e[1], i, r, e[2], t.start, t.end);
5671
5747
  }
5672
5748
  static calculateControlPoints(e, t, i) {
5673
- const r = e.x - t.x, n = e.y - t.y, o = t.x - i.x, a = t.y - i.y, d = { x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }, p = { x: (t.x + i.x) / 2, y: (t.y + i.y) / 2 }, c = Math.sqrt(r * r + n * n), u = Math.sqrt(o * o + a * a), h = d.x - p.x, g = d.y - p.y, v = c + u == 0 ? 0 : u / (c + u), $ = { x: p.x + h * v, y: p.y + g * v }, Y = t.x - $.x, q = t.y - $.y;
5749
+ const r = e.x - t.x, n = e.y - t.y, o = t.x - i.x, a = t.y - i.y, d = { x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }, p = { x: (t.x + i.x) / 2, y: (t.y + i.y) / 2 }, c = Math.sqrt(r * r + n * n), u = Math.sqrt(o * o + a * a), h = d.x - p.x, g = d.y - p.y, x = c + u == 0 ? 0 : u / (c + u), S = { x: p.x + h * x, y: p.y + g * x }, Y = t.x - S.x, q = t.y - S.y;
5674
5750
  return {
5675
5751
  c1: new Z(d.x + Y, d.y + q),
5676
5752
  c2: new Z(p.x + Y, p.y + q)
@@ -5936,7 +6012,7 @@ class ee extends vt {
5936
6012
  const { _lastPoints: i } = this;
5937
6013
  if (i.push(e), i.length > 2) {
5938
6014
  i.length === 3 && i.unshift(i[0]);
5939
- const r = this._calculateCurveWidths(i[1], i[2], t), n = be.fromPoints(i, r);
6015
+ const r = this._calculateCurveWidths(i[1], i[2], t), n = ve.fromPoints(i, r);
5940
6016
  return i.shift(), n;
5941
6017
  }
5942
6018
  return null;
@@ -5962,10 +6038,10 @@ class ee extends vt {
5962
6038
  const a = o / n, d = a * a, p = d * a, c = 1 - a, u = c * c, h = u * c;
5963
6039
  let g = h * e.startPoint.x;
5964
6040
  g += 3 * u * a * e.control1.x, g += 3 * c * d * e.control2.x, g += p * e.endPoint.x;
5965
- let v = h * e.startPoint.y;
5966
- v += 3 * u * a * e.control1.y, v += 3 * c * d * e.control2.y, v += p * e.endPoint.y;
5967
- const $ = Math.min(e.startWidth + p * r, t.maxWidth);
5968
- this._drawCurveSegment(g, v, $);
6041
+ let x = h * e.startPoint.y;
6042
+ x += 3 * u * a * e.control1.y, x += 3 * c * d * e.control2.y, x += p * e.endPoint.y;
6043
+ const S = Math.min(e.startWidth + p * r, t.maxWidth);
6044
+ this._drawCurveSegment(g, x, S);
5969
6045
  }
5970
6046
  i.closePath(), i.fill();
5971
6047
  }
@@ -6000,8 +6076,8 @@ class ee extends vt {
6000
6076
  u.setAttribute("d", h), u.setAttribute("stroke-width", (p.endWidth * 2.25).toFixed(3)), u.setAttribute("stroke", c), u.setAttribute("fill", "none"), u.setAttribute("stroke-linecap", "round"), d.appendChild(u);
6001
6077
  }
6002
6078
  }, (p, { penColor: c, dotSize: u, minWidth: h, maxWidth: g }) => {
6003
- const v = document.createElement("circle"), $ = u > 0 ? u : (h + g) / 2;
6004
- v.setAttribute("r", $.toString()), v.setAttribute("cx", p.x.toString()), v.setAttribute("cy", p.y.toString()), v.setAttribute("fill", c), d.appendChild(v);
6079
+ const x = document.createElement("circle"), S = u > 0 ? u : (h + g) / 2;
6080
+ x.setAttribute("r", S.toString()), x.setAttribute("cx", p.x.toString()), x.setAttribute("cy", p.y.toString()), x.setAttribute("fill", c), d.appendChild(x);
6005
6081
  }), d.outerHTML;
6006
6082
  }
6007
6083
  }
@@ -6414,7 +6490,7 @@ te.QUESTION_ELEMENT_TYPES = [
6414
6490
  "file_upload",
6415
6491
  "signature"
6416
6492
  ];
6417
- let pe = te;
6493
+ let ce = te;
6418
6494
  const ie = class ie {
6419
6495
  // 5MB in bytes
6420
6496
  constructor(e, t) {
@@ -6508,8 +6584,8 @@ const ie = class ie {
6508
6584
  }
6509
6585
  };
6510
6586
  ie.MAX_FILE_SIZE = 5 * 1024 * 1024;
6511
- let ce = ie;
6512
- class k {
6587
+ let ue = ie;
6588
+ class D {
6513
6589
  /**
6514
6590
  * Determines if a form element should be disabled based on context
6515
6591
  * Centralizes the disabled logic for consistency across all input types
@@ -6540,7 +6616,7 @@ class k {
6540
6616
  // Extract file extension and guess type
6541
6617
  static _guessFileTypeFromUrl(e) {
6542
6618
  var n;
6543
- const i = (n = k._extractFilenameFromUrl(e).split(".").pop()) == null ? void 0 : n.toLowerCase();
6619
+ const i = (n = D._extractFilenameFromUrl(e).split(".").pop()) == null ? void 0 : n.toLowerCase();
6544
6620
  return i ? {
6545
6621
  pdf: "PDF Document",
6546
6622
  doc: "Word Document",
@@ -6781,23 +6857,23 @@ class k {
6781
6857
  <div class="print-response-value file-response">
6782
6858
  📎 ${r.name}
6783
6859
  ${r.size ? l` <span class="file-size"
6784
- >(${k._formatFileSize(r.size)})</span
6860
+ >(${D._formatFileSize(r.size)})</span
6785
6861
  >` : ""}
6786
6862
  </div>
6787
6863
  `;
6788
6864
  if (n) {
6789
- const a = k._extractFilenameFromUrl(r);
6865
+ const a = D._extractFilenameFromUrl(r);
6790
6866
  return l` <div class="print-response-value file-response">📎 ${a}</div> `;
6791
6867
  } else
6792
6868
  return l` <div class="print-response-value file-response">📎 ${r}</div> `;
6793
6869
  } else {
6794
- const a = n ? r : "#", d = o ? r.name : n ? k._extractFilenameFromUrl(r) : "View File";
6870
+ const a = n ? r : "#", d = o ? r.name : n ? D._extractFilenameFromUrl(r) : "View File";
6795
6871
  return l`
6796
6872
  <div class="file-upload-view-only">
6797
6873
  <a href="${a}" target="_blank" class="file-link"> 📎 ${d} </a>
6798
6874
  ${o && r.size ? l`
6799
6875
  <span class="file-size-info"
6800
- >(${k._formatFileSize(r.size)})</span
6876
+ >(${D._formatFileSize(r.size)})</span
6801
6877
  >
6802
6878
  ` : ""}
6803
6879
  </div>
@@ -6862,19 +6938,19 @@ class k {
6862
6938
  const i = t.formData[e.id] ?? "", r = t.validationErrors[e.id], n = () => {
6863
6939
  switch (e.type) {
6864
6940
  case "textarea":
6865
- return k.renderTextArea(e, i, t);
6941
+ return D.renderTextArea(e, i, t);
6866
6942
  case "select":
6867
- return k.renderSelect(e, i, t);
6943
+ return D.renderSelect(e, i, t);
6868
6944
  case "radio":
6869
- return k.renderRadio(e, i, t);
6945
+ return D.renderRadio(e, i, t);
6870
6946
  case "checkbox":
6871
- return k.renderCheckbox(e, i, t);
6947
+ return D.renderCheckbox(e, i, t);
6872
6948
  case "signature":
6873
- return k.renderSignature(e, i, t);
6949
+ return D.renderSignature(e, i, t);
6874
6950
  case "file_upload":
6875
- return k.renderFileUpload(e, i, t);
6951
+ return D.renderFileUpload(e, i, t);
6876
6952
  default:
6877
- return k.renderDefaultInput(e, i, t);
6953
+ return D.renderDefaultInput(e, i, t);
6878
6954
  }
6879
6955
  }, o = e.type === "checkbox" && (!e.options || e.options.length === 0);
6880
6956
  return t.mode === "print" ? l`
@@ -6924,13 +7000,13 @@ class $t {
6924
7000
  * Copyright 2017 Google LLC
6925
7001
  * SPDX-License-Identifier: BSD-3-Clause
6926
7002
  */
6927
- class ue extends $t {
7003
+ class he extends $t {
6928
7004
  constructor(e) {
6929
- if (super(e), this.it = x, e.type !== St.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
7005
+ if (super(e), this.it = w, e.type !== St.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
6930
7006
  }
6931
7007
  render(e) {
6932
- if (e === x || e == null) return this._t = void 0, this.it = e;
6933
- if (e === P) return e;
7008
+ if (e === w || e == null) return this._t = void 0, this.it = e;
7009
+ if (e === U) return e;
6934
7010
  if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
6935
7011
  if (e === this.it) return this._t;
6936
7012
  this.it = e;
@@ -6938,9 +7014,9 @@ class ue extends $t {
6938
7014
  return t.raw = t, this._t = { _$litType$: this.constructor.resultType, strings: t, values: [] };
6939
7015
  }
6940
7016
  }
6941
- ue.directiveName = "unsafeHTML", ue.resultType = 1;
6942
- const Ee = kt(ue);
6943
- class D {
7017
+ he.directiveName = "unsafeHTML", he.resultType = 1;
7018
+ const Te = kt(he);
7019
+ class C {
6944
7020
  static renderMarkdown(e) {
6945
7021
  return e.replace(/^### (.*$)/gim, "<h3>$1</h3>").replace(/^## (.*$)/gim, "<h2>$1</h2>").replace(/^# (.*$)/gim, "<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim, "<strong>$1</strong>").replace(/\*(.*?)\*/gim, "<em>$1</em>").replace(/`(.*?)`/gim, "<code>$1</code>").replace(/^> (.*$)/gim, "<blockquote>$1</blockquote>").replace(/\n/gim, "<br>");
6946
7022
  }
@@ -6955,7 +7031,7 @@ class D {
6955
7031
  return l`
6956
7032
  <div class="content-element markdown-content">
6957
7033
  <div class="markdown-text">
6958
- ${Ee(D.renderMarkdown(e.content))}
7034
+ ${Te(C.renderMarkdown(e.content))}
6959
7035
  </div>
6960
7036
  </div>
6961
7037
  `;
@@ -6971,7 +7047,7 @@ class D {
6971
7047
  static renderHtml(e) {
6972
7048
  return l`
6973
7049
  <div class="content-element html-content">
6974
- <div class="html-content-wrapper">${Ee(e.content)}</div>
7050
+ <div class="html-content-wrapper">${Te(e.content)}</div>
6975
7051
  </div>
6976
7052
  `;
6977
7053
  }
@@ -7016,21 +7092,21 @@ class D {
7016
7092
  const i = () => {
7017
7093
  switch (e.type) {
7018
7094
  case "text":
7019
- return D.renderText(e);
7095
+ return C.renderText(e);
7020
7096
  case "markdown":
7021
- return D.renderMarkdownElement(e);
7097
+ return C.renderMarkdownElement(e);
7022
7098
  case "divider":
7023
- return D.renderDivider(e);
7099
+ return C.renderDivider(e);
7024
7100
  case "html":
7025
- return D.renderHtml(e);
7101
+ return C.renderHtml(e);
7026
7102
  case "image":
7027
- return D.renderImage(e);
7103
+ return C.renderImage(e);
7028
7104
  case "video":
7029
- return D.renderVideo(e);
7105
+ return C.renderVideo(e);
7030
7106
  case "file":
7031
- return D.renderFile(e);
7107
+ return C.renderFile(e);
7032
7108
  default:
7033
- return D.renderUnknown(e);
7109
+ return C.renderUnknown(e);
7034
7110
  }
7035
7111
  };
7036
7112
  return (t == null ? void 0 : t.mode) === "print" ? l`
@@ -7041,7 +7117,7 @@ class D {
7041
7117
  ` : i();
7042
7118
  }
7043
7119
  }
7044
- class Me {
7120
+ class le {
7045
7121
  static renderMobileStepsForStatus(e) {
7046
7122
  const { steps: t, disabled: i = !1 } = e;
7047
7123
  return l`
@@ -7093,6 +7169,71 @@ class Me {
7093
7169
  </div>
7094
7170
  `;
7095
7171
  }
7172
+ static renderSubmissionErrorView(e) {
7173
+ var r, n, o;
7174
+ const { submissionError: t, onRetry: i } = e;
7175
+ return l`
7176
+ <div class="runner-layout">
7177
+ <!-- Mobile Steps Navigation (visible only on mobile) -->
7178
+ ${this.renderMobileStepsForStatus({
7179
+ steps: (r = e.instance) == null ? void 0 : r.steps,
7180
+ isStepAssignedToUser: e.isStepAssignedToUser,
7181
+ completedSteps: e.completedSteps,
7182
+ disabled: !0
7183
+ })}
7184
+
7185
+ <!-- Sidebar: Steps List (read-only, hidden on mobile) -->
7186
+ <aside class="runner-sidebar">
7187
+ <div class="runner-sidebar-header">Steps</div>
7188
+ <nav aria-label="Workflow steps">
7189
+ <ul class="runner-steps-list">
7190
+ ${(o = (n = e.instance) == null ? void 0 : n.steps) == null ? void 0 : o.map((a) => {
7191
+ const d = e.isStepAssignedToUser(a), p = e.completedSteps.has(a.id);
7192
+ return l`
7193
+ <li
7194
+ class="runner-step-item ${p ? "completed" : ""} ${d ? "" : "unassigned"}"
7195
+ style="opacity: ${d ? "1" : "0.6"}; cursor: not-allowed;"
7196
+ >
7197
+ <span class="runner-step-title">${a.title}</span>
7198
+ <span class="runner-step-badge ${!p && d ? "error" : ""}">
7199
+ ${p ? "Submitted" : d ? "Failed" : "Other User"}
7200
+ </span>
7201
+ </li>
7202
+ `;
7203
+ })}
7204
+ </ul>
7205
+ </nav>
7206
+ </aside>
7207
+
7208
+ <!-- Main Content: Error View -->
7209
+ <main class="runner-main-content">
7210
+ <div class="submission-container">
7211
+ <div class="submission-error-icon">
7212
+ <svg
7213
+ width="64"
7214
+ height="64"
7215
+ viewBox="0 0 24 24"
7216
+ fill="none"
7217
+ stroke="currentColor"
7218
+ stroke-width="2"
7219
+ stroke-linecap="round"
7220
+ stroke-linejoin="round"
7221
+ >
7222
+ <circle cx="12" cy="12" r="10" />
7223
+ <path d="M12 8v4" />
7224
+ <circle cx="12" cy="16" r="1" fill="currentColor" />
7225
+ </svg>
7226
+ </div>
7227
+ <h2 class="submission-title">Submission Failed</h2>
7228
+ <p class="submission-message">
7229
+ ${t || "Unable to save your response. Please try again."}
7230
+ </p>
7231
+ ${i ? l` <button class="retry-button" @click=${i}>Try Again</button> ` : ""}
7232
+ </div>
7233
+ </main>
7234
+ </div>
7235
+ `;
7236
+ }
7096
7237
  static renderUnifiedSubmissionView(e) {
7097
7238
  var t, i, r;
7098
7239
  return l`
@@ -7155,7 +7296,7 @@ class Me {
7155
7296
  `;
7156
7297
  }
7157
7298
  }
7158
- class W {
7299
+ class j {
7159
7300
  /**
7160
7301
  * Determines if a step should show as completed in the badge.
7161
7302
  * If completion screen is showing, all assigned steps are considered completed.
@@ -7249,7 +7390,7 @@ class Dt {
7249
7390
  `;
7250
7391
  }
7251
7392
  }
7252
- class le {
7393
+ class pe {
7253
7394
  /**
7254
7395
  * Handles change events for basic text inputs, textareas, selects, numbers, dates
7255
7396
  */
@@ -7294,7 +7435,7 @@ var Ct = Object.defineProperty, At = Object.getOwnPropertyDescriptor, y = (s, e,
7294
7435
  };
7295
7436
  let f = class extends N {
7296
7437
  constructor() {
7297
- super(...arguments), this.mode = "default", this.isLoading = !1, this._currentStepIndex = 0, this._formData = {}, this._validationErrors = {}, this._internalCompletedSteps = /* @__PURE__ */ new Set(), this._formRestorationComplete = !1, this._savedSignatures = /* @__PURE__ */ new Set(), this._replacingSignatures = /* @__PURE__ */ new Set(), this._isSubmitted = !1, this._userStepsSubmitted = !1, this._justSaved = !1;
7438
+ super(...arguments), this.mode = "default", this.isLoading = !1, this._currentStepIndex = 0, this._formData = {}, this._validationErrors = {}, this._internalCompletedSteps = /* @__PURE__ */ new Set(), this._formRestorationComplete = !1, this._savedSignatures = /* @__PURE__ */ new Set(), this._replacingSignatures = /* @__PURE__ */ new Set(), this._isSubmitted = !1, this._userStepsSubmitted = !1, this._justSaved = !1, this._submissionError = null;
7298
7439
  }
7299
7440
  willUpdate(s) {
7300
7441
  (s.has("mode") || s.has("currentUser")) && this._updateNavigationService(), (s.has("instance") || s.has("workflow") || s.has("mode")) && (this._initializeState(), this._updateValidationService());
@@ -7307,9 +7448,9 @@ let f = class extends N {
7307
7448
  super.disconnectedCallback(), window.removeEventListener("resize", this._handleResize.bind(this)), (s = this.signatureManager) == null || s.destroy();
7308
7449
  }
7309
7450
  _initializeServices() {
7310
- this.persistenceManager = new bt(), this.responseTracker = new yt(), this.formStateManager = new pe(), this.signatureManager = new _t(
7451
+ this.persistenceManager = new bt(), this.responseTracker = new yt(), this.formStateManager = new ce(), this.signatureManager = new _t(
7311
7452
  (s) => this._handleSignatureChange(s)
7312
- ), this.fileUploadManager = new ce(this.formStateManager, this.responseTracker), this._updateNavigationService(), this._updateValidationService();
7453
+ ), this.fileUploadManager = new ue(this.formStateManager, this.responseTracker), this._updateNavigationService(), this._updateValidationService();
7313
7454
  }
7314
7455
  _updateNavigationService() {
7315
7456
  this.navigationService = new wt(this.mode || "default", this.currentUser);
@@ -7431,7 +7572,7 @@ let f = class extends N {
7431
7572
  return !s || this.mode !== "default" ? !0 : this._isStepAssignedToUser(s);
7432
7573
  }
7433
7574
  _renderNotAssignedView() {
7434
- return Me.renderNotAssignedView();
7575
+ return le.renderNotAssignedView();
7435
7576
  }
7436
7577
  get _currentStep() {
7437
7578
  var s, e, t;
@@ -7448,7 +7589,7 @@ let f = class extends N {
7448
7589
  return this.formStateManager.setValidationErrors(e.errors), this._validationErrors = this.formStateManager.getValidationErrors(), e.isValid;
7449
7590
  }
7450
7591
  _handleInputChange(s, e) {
7451
- le.handleInputChange(
7592
+ pe.handleInputChange(
7452
7593
  s,
7453
7594
  e,
7454
7595
  this._formData,
@@ -7458,7 +7599,7 @@ let f = class extends N {
7458
7599
  ), this._handleFormDataUpdate(s);
7459
7600
  }
7460
7601
  _handleCheckboxChange(s, e) {
7461
- le.handleCheckboxChange(
7602
+ pe.handleCheckboxChange(
7462
7603
  s,
7463
7604
  e,
7464
7605
  this._formData,
@@ -7468,7 +7609,7 @@ let f = class extends N {
7468
7609
  ), this._handleFormDataUpdate(s);
7469
7610
  }
7470
7611
  _handleCheckboxGroupChange(s, e, t) {
7471
- le.handleCheckboxGroupChange(
7612
+ pe.handleCheckboxGroupChange(
7472
7613
  s,
7473
7614
  e,
7474
7615
  t,
@@ -7546,10 +7687,10 @@ let f = class extends N {
7546
7687
  this.responseTracker.trackQuestionResponse(this._currentStep, s, e);
7547
7688
  }
7548
7689
  _renderQuestion(s) {
7549
- return k.render(s, this._getRenderContext());
7690
+ return D.render(s, this._getRenderContext());
7550
7691
  }
7551
7692
  _renderContentElement(s) {
7552
- return D.render(s, this._getRenderContext());
7693
+ return C.render(s, this._getRenderContext());
7553
7694
  }
7554
7695
  _isQuestionElement(s) {
7555
7696
  return f.QUESTION_ELEMENT_TYPES.includes(s.type);
@@ -7570,7 +7711,7 @@ let f = class extends N {
7570
7711
  return l`
7571
7712
  <div class="print-step">
7572
7713
  <!-- Step Header -->
7573
- ${W.renderStepHeader({ step: s, mode: "print" })}
7714
+ ${j.renderStepHeader({ step: s, mode: "print" })}
7574
7715
 
7575
7716
  <!-- Step Elements -->
7576
7717
  ${s.elements.map((e) => this._renderStepElement(e))}
@@ -7591,7 +7732,7 @@ let f = class extends N {
7591
7732
  </div>
7592
7733
  `;
7593
7734
  }
7594
- _nextStep() {
7735
+ async _nextStep() {
7595
7736
  var t, i, r, n;
7596
7737
  if (!this._validateStep()) return;
7597
7738
  const s = this._currentStep;
@@ -7599,17 +7740,17 @@ let f = class extends N {
7599
7740
  const e = this._findNextAssignedStep(this._currentStepIndex);
7600
7741
  if (e !== -1) {
7601
7742
  const o = (t = this._currentStep) == null ? void 0 : t.id;
7602
- if (this._currentStepIndex = e, o && ((i = this.instance) != null && i.steps)) {
7603
- const d = this.instance.steps.find((p) => p.id === o);
7604
- d && (d.status = "completed");
7605
- }
7606
- const a = (n = (r = this.instance) == null ? void 0 : r.steps) == null ? void 0 : n[this._currentStepIndex];
7607
- a && (a.status = "active"), this._updateInstanceData(o, "step_navigation", {
7743
+ if (this._currentStepIndex = e, (await this._updateInstanceData(o, "step_navigation", {
7608
7744
  direction: "next",
7609
7745
  fromStepIndex: this._currentStepIndex - 1,
7610
7746
  toStepIndex: this._currentStepIndex,
7611
7747
  completedStepId: o
7612
- }), this.mode !== "admin" && this._saveFormDataToHistory(), this._scrollToTop();
7748
+ })).success && o && (i = this.instance) != null && i.steps) {
7749
+ const p = this.instance.steps.find((c) => c.id === o);
7750
+ p && (p.status = "completed");
7751
+ }
7752
+ const d = (n = (r = this.instance) == null ? void 0 : r.steps) == null ? void 0 : n[this._currentStepIndex];
7753
+ d && (d.status = "active"), this.mode !== "admin" && this._saveFormDataToHistory(), this._scrollToTop();
7613
7754
  }
7614
7755
  }
7615
7756
  _findNextAssignedStep(s) {
@@ -7643,47 +7784,49 @@ let f = class extends N {
7643
7784
  );
7644
7785
  console.log("🚦 Navigation result:", t), t.canNavigate ? (this._currentStepIndex = t.newStepIndex, console.log(`✅ Navigated to step ${t.newStepIndex}`), this._scrollToTop()) : console.log("❌ Navigation blocked:", t.reason);
7645
7786
  }
7646
- _submitUserSteps() {
7647
- var t;
7787
+ async _submitUserSteps() {
7788
+ var i;
7648
7789
  if (!this._validateStep()) return;
7649
7790
  const s = this._currentStep;
7650
7791
  if (s && this._captureSignaturesFromStep(s), !this.instance) {
7651
7792
  console.error("Cannot submit, instance data is missing.");
7652
7793
  return;
7653
7794
  }
7654
- const e = (t = this._currentStep) == null ? void 0 : t.id;
7655
- e && this._internalCompletedSteps.add(e), console.log("User completing their assigned steps:", this.instance.id), console.log("Form data:", this._formData), this._userStepsSubmitted = !0, this._clearSavedFormData("user steps submission"), this._updateInstanceData(e, "user_steps_submission"), this._scrollToTop();
7795
+ const e = (i = this._currentStep) == null ? void 0 : i.id;
7796
+ e && this._internalCompletedSteps.add(e), (await this._updateInstanceData(e, "user_steps_submission")).success && e && this._internalCompletedSteps.add(e), this._userStepsSubmitted = !0, this._clearSavedFormData("user steps submission"), this._scrollToTop();
7656
7797
  }
7657
- _submit() {
7658
- var t;
7798
+ async _submit() {
7799
+ var i;
7659
7800
  if (!this._validateStep()) return;
7660
7801
  const s = this._currentStep;
7661
7802
  if (s && this._captureSignaturesFromStep(s), !this.instance) {
7662
7803
  console.error("Cannot submit, instance data is missing.");
7663
7804
  return;
7664
7805
  }
7665
- const e = (t = this._currentStep) == null ? void 0 : t.id;
7666
- e && this._internalCompletedSteps.add(e), console.log("Submitting entire workflow:", this.instance.id), console.log("Final form data:", this._formData), this.instance && (this.instance.status = "completed", this.instance.currentStepId = void 0, this.instance.completedSteps = Array.from(this._internalCompletedSteps)), this._isSubmitted = !0, this._clearSavedFormData("full workflow submission"), this._scrollToTop(), this._updateInstanceData(e, "submission");
7806
+ const e = (i = this._currentStep) == null ? void 0 : i.id;
7807
+ console.log("Submitting entire workflow:", this.instance.id), console.log("Final form data:", this._formData), (await this._updateInstanceData(e, "submission")).success && (e && this._internalCompletedSteps.add(e), this.instance && (this.instance.status = "completed", this.instance.currentStepId = void 0, this.instance.completedSteps = Array.from(this._internalCompletedSteps)), this._isSubmitted = !0, this._clearSavedFormData("full workflow submission"), this._scrollToTop());
7667
7808
  }
7668
- _saveStep() {
7669
- var t;
7809
+ async _saveStep() {
7810
+ var i;
7670
7811
  if (!this._validateStep()) return;
7671
7812
  const s = this._currentStep;
7672
7813
  if (s && this._captureSignaturesFromStep(s), !this.instance) {
7673
7814
  console.error("Cannot save, instance data is missing.");
7674
7815
  return;
7675
7816
  }
7676
- const e = (t = this._currentStep) == null ? void 0 : t.id;
7677
- if (e && (this._internalCompletedSteps.add(e), this.instance.steps)) {
7678
- const i = this.instance.steps.find((r) => r.id === e);
7679
- i && (i.status = "completed");
7680
- }
7681
- this._updateInstanceData(e, "admin_save", {
7817
+ const e = (i = this._currentStep) == null ? void 0 : i.id;
7818
+ if ((await this._updateInstanceData(e, "admin_save", {
7682
7819
  stepId: e,
7683
7820
  adminMode: !0
7684
- }), this._justSaved = !0, this.requestUpdate(), setTimeout(() => {
7685
- this._justSaved = !1, this.requestUpdate();
7686
- }, 2e3);
7821
+ })).success) {
7822
+ if (e && (this._internalCompletedSteps.add(e), this.instance.steps)) {
7823
+ const r = this.instance.steps.find((n) => n.id === e);
7824
+ r && (r.status = "completed");
7825
+ }
7826
+ this._justSaved = !0, this.requestUpdate(), setTimeout(() => {
7827
+ this._justSaved = !1, this.requestUpdate();
7828
+ }, 2e3);
7829
+ }
7687
7830
  }
7688
7831
  _clearSavedFormData(s) {
7689
7832
  var e;
@@ -7699,12 +7842,12 @@ let f = class extends N {
7699
7842
  e && e.scrollTo({ top: 0, behavior: "smooth" });
7700
7843
  });
7701
7844
  }
7702
- _updateInstanceData(s, e, t) {
7703
- var d, p, c, u, h, g, v;
7845
+ async _updateInstanceData(s, e, t) {
7846
+ var d, p, c, u, h, g, x;
7704
7847
  s && this._internalCompletedSteps.add(s);
7705
- let i = (p = (d = this.instance) == null ? void 0 : d.steps) == null ? void 0 : p.find(($) => $.id === s);
7848
+ let i = (p = (d = this.instance) == null ? void 0 : d.steps) == null ? void 0 : p.find((S) => S.id === s);
7706
7849
  if (!i && this._internalCompletedSteps.size > 0) {
7707
- const $ = Array.from(this._internalCompletedSteps), Y = $[$.length - 1];
7850
+ const S = Array.from(this._internalCompletedSteps), Y = S[S.length - 1];
7708
7851
  i = (u = (c = this.instance) == null ? void 0 : c.steps) == null ? void 0 : u.find((q) => q.id === Y);
7709
7852
  }
7710
7853
  const r = e === "submission", n = ((h = this.instance) == null ? void 0 : h.steps) && this._internalCompletedSteps.size >= this.instance.steps.length, o = r || n ? null : this._currentStep ? {
@@ -7712,24 +7855,26 @@ let f = class extends N {
7712
7855
  title: this._currentStep.title
7713
7856
  } : null, a = {
7714
7857
  instanceId: (g = this.instance) == null ? void 0 : g.id,
7715
- workflowId: (v = this.instance) == null ? void 0 : v.workflowId,
7716
- completedStepId: s || (i ? i.id : null),
7858
+ workflowId: (x = this.instance) == null ? void 0 : x.workflowId,
7859
+ completedStepId: s || (i ? i.id : void 0),
7717
7860
  completedStepData: i ? {
7718
7861
  id: i.id,
7719
7862
  title: i.title,
7720
7863
  responses: i.responses || []
7721
- } : null,
7864
+ } : void 0,
7722
7865
  completedSteps: Array.from(this._internalCompletedSteps),
7723
7866
  currentStep: o,
7724
7867
  mode: this.mode
7725
7868
  };
7726
- this.dispatchEvent(
7727
- new CustomEvent("instance-updated", {
7728
- detail: a,
7729
- bubbles: !0,
7730
- composed: !0
7731
- })
7732
- );
7869
+ if (this.onInstanceUpdated)
7870
+ try {
7871
+ this._submissionError = null, this.requestUpdate();
7872
+ const S = await this.onInstanceUpdated(a);
7873
+ return S.success ? this._submissionError = null : (this._submissionError = S.error || "Unable to save response. Please try again.", s && this._internalCompletedSteps.delete(s)), this.requestUpdate(), S;
7874
+ } catch (S) {
7875
+ return this._submissionError = S instanceof Error ? S.message : "Unable to save response. Please try again.", s && this._internalCompletedSteps.delete(s), this.requestUpdate(), { success: !1, error: this._submissionError };
7876
+ }
7877
+ return { success: !0 };
7733
7878
  }
7734
7879
  _restoreFormData() {
7735
7880
  var e;
@@ -7893,7 +8038,7 @@ let f = class extends N {
7893
8038
  completedSteps: this._internalCompletedSteps,
7894
8039
  isStepAssignedToUser: this._isStepAssignedToUser.bind(this)
7895
8040
  };
7896
- return Me.renderUnifiedSubmissionView(s);
8041
+ return le.renderUnifiedSubmissionView(s);
7897
8042
  }
7898
8043
  /**
7899
8044
  * Check if the instance status indicates the workflow is completed
@@ -7928,12 +8073,28 @@ let f = class extends N {
7928
8073
  var s;
7929
8074
  return this.mode !== "default" ? !1 : !!(this._isCurrentStepCompleted() || this._isInstanceCompleted() || ((s = this.instance) == null ? void 0 : s.status) === "active" && this._areUserStepsCompleted());
7930
8075
  }
8076
+ // Render the submission error view
8077
+ _renderSubmissionErrorView() {
8078
+ const s = {
8079
+ instance: this.instance,
8080
+ assignedSteps: this._getAssignedSteps(),
8081
+ completedSteps: this._internalCompletedSteps,
8082
+ isStepAssignedToUser: this._isStepAssignedToUser.bind(this),
8083
+ submissionError: this._submissionError,
8084
+ onRetry: () => {
8085
+ this._submissionError = null, this._isSubmitted = !1, this._userStepsSubmitted = !1, this.requestUpdate();
8086
+ }
8087
+ };
8088
+ return le.renderSubmissionErrorView(s);
8089
+ }
7931
8090
  /**
7932
8091
  * Handles mode-based content routing and basic validation
7933
8092
  * Returns content for special modes or null to continue with normal rendering
7934
8093
  */
7935
8094
  _renderModeBasedContent() {
7936
8095
  var e, t;
8096
+ if (this._submissionError)
8097
+ return this._renderSubmissionErrorView();
7937
8098
  if (this._shouldShowCompletionView())
7938
8099
  return this._renderUnifiedSubmissionView();
7939
8100
  if (this.mode === "print")
@@ -7973,7 +8134,7 @@ let f = class extends N {
7973
8134
  const e = this._isLastAssignedStep(), t = this._isLastStepInWorkflow(), i = this.mode === "preview" ? (r = this.workflow) == null ? void 0 : r.steps : (n = this.instance) == null ? void 0 : n.steps;
7974
8135
  return l`
7975
8136
  <!-- Mobile Steps Navigation (visible only on mobile) -->
7976
- ${W.renderMobileSteps({
8137
+ ${j.renderMobileSteps({
7977
8138
  steps: i,
7978
8139
  currentStepIndex: this._currentStepIndex,
7979
8140
  mode: this.mode || "default",
@@ -7986,7 +8147,7 @@ let f = class extends N {
7986
8147
  })}
7987
8148
 
7988
8149
  <!-- Sidebar: Steps List (hidden on mobile) -->
7989
- ${W.renderSidebar({
8150
+ ${j.renderSidebar({
7990
8151
  steps: i,
7991
8152
  currentStepIndex: this._currentStepIndex,
7992
8153
  mode: this.mode || "default",
@@ -8000,8 +8161,8 @@ let f = class extends N {
8000
8161
 
8001
8162
  <!-- Main Content: Step Details and Questions -->
8002
8163
  <main class="runner-main-content">
8003
- ${this.mode === "print" ? W.renderStepHeader({ step: s, mode: this.mode }) : l`<div class="runner-card">
8004
- ${W.renderStepHeader({
8164
+ ${this.mode === "print" ? j.renderStepHeader({ step: s, mode: this.mode }) : l`<div class="runner-card">
8165
+ ${j.renderStepHeader({
8005
8166
  step: s,
8006
8167
  mode: this.mode
8007
8168
  })}
@@ -8015,10 +8176,18 @@ let f = class extends N {
8015
8176
  justSaved: this._justSaved,
8016
8177
  isCurrentStepAssigned: this._isCurrentStepAssigned(),
8017
8178
  handlers: {
8018
- saveStep: this._saveStep.bind(this),
8019
- nextStep: this._nextStep.bind(this),
8020
- submitUserSteps: this._submitUserSteps.bind(this),
8021
- submit: this._submit.bind(this)
8179
+ saveStep: () => {
8180
+ this._saveStep();
8181
+ },
8182
+ nextStep: () => {
8183
+ this._nextStep();
8184
+ },
8185
+ submitUserSteps: () => {
8186
+ this._submitUserSteps();
8187
+ },
8188
+ submit: () => {
8189
+ this._submit();
8190
+ }
8022
8191
  }
8023
8192
  })}
8024
8193
  </form>
@@ -8072,26 +8241,29 @@ f.CONTENT_ELEMENT_TYPES = [
8072
8241
  "markdown"
8073
8242
  ];
8074
8243
  y([
8075
- C({ type: Object })
8244
+ $({ type: Object })
8076
8245
  ], f.prototype, "instance", 2);
8077
8246
  y([
8078
- C({ type: Object })
8247
+ $({ type: Object })
8079
8248
  ], f.prototype, "workflow", 2);
8080
8249
  y([
8081
- C({ type: String })
8250
+ $({ type: String })
8082
8251
  ], f.prototype, "mode", 2);
8083
8252
  y([
8084
- C({ type: Boolean })
8253
+ $({ type: Boolean })
8085
8254
  ], f.prototype, "isLoading", 2);
8086
8255
  y([
8087
- C({ type: Object })
8256
+ $({ type: Object })
8088
8257
  ], f.prototype, "currentUser", 2);
8089
8258
  y([
8090
- C({ type: Function })
8259
+ $({ type: Function })
8091
8260
  ], f.prototype, "onSignatureCaptured", 2);
8092
8261
  y([
8093
- C({ type: Function })
8262
+ $({ type: Function })
8094
8263
  ], f.prototype, "onFileUploaded", 2);
8264
+ y([
8265
+ $({ type: Function })
8266
+ ], f.prototype, "onInstanceUpdated", 2);
8095
8267
  y([
8096
8268
  b()
8097
8269
  ], f.prototype, "_currentStepIndex", 2);
@@ -8125,6 +8297,9 @@ y([
8125
8297
  y([
8126
8298
  b()
8127
8299
  ], f.prototype, "_justSaved", 2);
8300
+ y([
8301
+ b()
8302
+ ], f.prototype, "_submissionError", 2);
8128
8303
  f = y([
8129
8304
  Ne("runner-widget")
8130
8305
  ], f);
@@ -8155,7 +8330,7 @@ function Jt(s, e = {}) {
8155
8330
  </div>
8156
8331
  <hr class="print-question-separator" />
8157
8332
 
8158
- ${n ? Vt(s, o) : ""}
8333
+ ${n ? Wt(s, o) : ""}
8159
8334
  ${s.steps.map((d) => Et(d)).join(`
8160
8335
  `)}
8161
8336
  </div>
@@ -8169,15 +8344,15 @@ function Et(s) {
8169
8344
  return `
8170
8345
  <div class="print-step">
8171
8346
  <!-- Step Header -->
8172
- ${Mt(s)}
8347
+ ${Tt(s)}
8173
8348
 
8174
8349
  <!-- Step Elements -->
8175
- ${s.elements.map((e) => Tt(e, s)).join(`
8350
+ ${s.elements.map((e) => Mt(e, s)).join(`
8176
8351
  `)}
8177
8352
  </div>
8178
8353
  `;
8179
8354
  }
8180
- function Mt(s) {
8355
+ function Tt(s) {
8181
8356
  return `
8182
8357
  <div class="step-print-header">
8183
8358
  <div class="print-step-title">${m(s.title)}</div>
@@ -8186,11 +8361,11 @@ function Mt(s) {
8186
8361
  </div>
8187
8362
  `;
8188
8363
  }
8189
- function Tt(s, e) {
8190
- return Wt(s) ? Ft(s, e) : zt(s);
8364
+ function Mt(s, e) {
8365
+ return jt(s) ? Ft(s, e) : zt(s);
8191
8366
  }
8192
8367
  function Ft(s, e) {
8193
- const t = Ht(s.id, e.responses), i = t == null ? void 0 : t.value, n = s.type === "checkbox" && (!s.options || s.options.length === 0) ? "" : `
8368
+ const t = Vt(s.id, e.responses), i = t == null ? void 0 : t.value, n = s.type === "checkbox" && (!s.options || s.options.length === 0) ? "" : `
8194
8369
  <div class="print-question-title">
8195
8370
  ${m(s.label)}:
8196
8371
  </div>
@@ -8201,9 +8376,9 @@ function Ft(s, e) {
8201
8376
  case "date":
8202
8377
  return n + It(s, i) + o;
8203
8378
  case "textarea":
8204
- return n + Pt(s, i) + o;
8205
- case "select":
8206
8379
  return n + Ut(s, i) + o;
8380
+ case "select":
8381
+ return n + Pt(s, i) + o;
8207
8382
  case "radio":
8208
8383
  return n + Nt(s, i) + o;
8209
8384
  case "checkbox":
@@ -8324,14 +8499,14 @@ function It(s, e) {
8324
8499
  </div>
8325
8500
  `;
8326
8501
  }
8327
- function Pt(s, e) {
8502
+ function Ut(s, e) {
8328
8503
  return `
8329
8504
  <div class="print-response-value textarea-response">
8330
8505
  ${(e != null ? m(String(e)) : "") || '<span class="print-no-response">No response</span>'}
8331
8506
  </div>
8332
8507
  `;
8333
8508
  }
8334
- function Ut(s, e) {
8509
+ function Pt(s, e) {
8335
8510
  const t = e != null ? String(e) : "";
8336
8511
  return `
8337
8512
  <div class="print-response-value select-response">
@@ -8371,7 +8546,7 @@ function Ot(s, e) {
8371
8546
  return `
8372
8547
  <div class="print-response-value file-response">
8373
8548
  📎 ${m(e.name)}
8374
- ${e.size ? ` <span class="file-size">(${jt(e.size)})</span>` : ""}
8549
+ ${e.size ? ` <span class="file-size">(${Ht(e.size)})</span>` : ""}
8375
8550
  </div>
8376
8551
  `;
8377
8552
  if (t) {
@@ -8406,7 +8581,7 @@ function Rt(s, e) {
8406
8581
  </div>
8407
8582
  `;
8408
8583
  }
8409
- function Wt(s) {
8584
+ function jt(s) {
8410
8585
  return [
8411
8586
  "text_input",
8412
8587
  "textarea",
@@ -8419,10 +8594,10 @@ function Wt(s) {
8419
8594
  "signature"
8420
8595
  ].includes(s.type);
8421
8596
  }
8422
- function Ht(s, e) {
8597
+ function Vt(s, e) {
8423
8598
  return e == null ? void 0 : e.find((t) => t.elementId === s);
8424
8599
  }
8425
- function Vt(s, e) {
8600
+ function Wt(s, e) {
8426
8601
  return `
8427
8602
  <div class="runner-card" style="margin-bottom: 40px; border-left: 4px solid #3b82f6;">
8428
8603
  <div style="display: flex; justify-content: between; align-items: center; gap: 20px;">
@@ -8454,7 +8629,7 @@ function m(s) {
8454
8629
  "'": "&#39;"
8455
8630
  })[i]);
8456
8631
  }
8457
- function jt(s) {
8632
+ function Ht(s) {
8458
8633
  if (s === 0) return "0 Bytes";
8459
8634
  const e = 1024, t = ["Bytes", "KB", "MB", "GB"], i = Math.floor(Math.log(s) / Math.log(e));
8460
8635
  return parseFloat((s / Math.pow(e, i)).toFixed(2)) + " " + t[i];
@@ -8979,6 +9154,7 @@ function Gt() {
8979
9154
  `;
8980
9155
  }
8981
9156
  function Xt(s, e = {}) {
9157
+ var r;
8982
9158
  if (!customElements.get("builder-widget"))
8983
9159
  return console.error("Error: <builder-widget> is not defined. Make sure it was imported."), null;
8984
9160
  const t = document.getElementById(s);
@@ -8986,7 +9162,7 @@ function Xt(s, e = {}) {
8986
9162
  return console.error(`Error: Target element with ID '${s}' not found.`), null;
8987
9163
  t.innerHTML = "";
8988
9164
  const i = document.createElement("builder-widget");
8989
- return e.workflow && (i.workflow = e.workflow), e.onWorkflowCreated && (i.onWorkflowCreated = e.onWorkflowCreated), e.onWorkflowDeleted && (i.onWorkflowDeleted = e.onWorkflowDeleted), e.onWorkflowUpdated && (i.onWorkflowUpdated = e.onWorkflowUpdated), t.appendChild(i), console.log(`Drill Builder mounted on #${s}`), i;
9165
+ return e.workflow && (i.workflow = e.workflow, e.subjectTypes && e.subjectTypes.length > 0 && ((r = e.subjectTypes[0]) != null && r.name) && (console.log("Setting default subject type to:", e.subjectTypes[0].name), i.workflow.subjectType = e.subjectTypes[0].name)), e.onWorkflowCreated && (i.onWorkflowCreated = e.onWorkflowCreated), e.onWorkflowDeleted && (i.onWorkflowDeleted = e.onWorkflowDeleted), e.onWorkflowUpdated && (i.onWorkflowUpdated = e.onWorkflowUpdated), i.labelForDrill = e.labelForDrill || "Drill", i.labelForGroup = e.labelForGroup || "Group", i.subjectTypes = e.subjectTypes || [], i.groups = e.groups || [], t.appendChild(i), console.log(`Drill Builder mounted on #${s}`), i;
8990
9166
  }
8991
9167
  function Zt(s, e) {
8992
9168
  if (!customElements.get("runner-widget"))
@@ -9007,14 +9183,7 @@ function Zt(s, e) {
9007
9183
  }
9008
9184
  t.innerHTML = "";
9009
9185
  const i = document.createElement("runner-widget");
9010
- return e.mode === "preview" ? (i.workflow = e.workflow, i.mode = "preview") : (i.instance = e.instance, i.mode = e.mode || "default"), e.mode && (i.mode = e.mode), e.isLoading !== void 0 && (i.isLoading = e.isLoading), e.onSignatureCaptured && (i.onSignatureCaptured = e.onSignatureCaptured), e.onFileUploaded && (i.onFileUploaded = e.onFileUploaded), e.currentUser && (i.currentUser = e.currentUser), e.onInstanceUpdated && i.addEventListener("instance-updated", (r) => {
9011
- const n = r;
9012
- try {
9013
- e.onInstanceUpdated(n.detail);
9014
- } catch (o) {
9015
- console.error("Error executing onInstanceUpdated callback:", o);
9016
- }
9017
- }), t.appendChild(i), console.log(`Drill Runner mounted on #${s}`), i;
9186
+ return e.mode === "preview" ? (i.workflow = e.workflow, i.mode = "preview") : (i.instance = e.instance, i.mode = e.mode || "default"), e.mode && (i.mode = e.mode), e.isLoading !== void 0 && (i.isLoading = e.isLoading), e.onSignatureCaptured && (i.onSignatureCaptured = e.onSignatureCaptured), e.onFileUploaded && (i.onFileUploaded = e.onFileUploaded), e.currentUser && (i.currentUser = e.currentUser), e.onInstanceUpdated && (i.onInstanceUpdated = e.onInstanceUpdated), t.appendChild(i), console.log(`Drill Runner mounted on #${s}`), i;
9018
9187
  }
9019
9188
  function ei(s, e) {
9020
9189
  const t = s.getFormData(), i = JSON.parse(JSON.stringify(e));