drill-widgets 2.7.20 → 2.7.23

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.
@@ -23,10 +23,10 @@ let Fe = class {
23
23
  }
24
24
  };
25
25
  const Oe = (s) => new Fe(typeof s == "string" ? s : s + "", void 0, me), O = (s, ...e) => {
26
- const t = s.length === 1 ? s[0] : e.reduce((i, r, n) => i + ((o) => {
27
- if (o._$cssResult$ === !0) return o.cssText;
28
- if (typeof o == "number") return o;
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.");
26
+ const t = s.length === 1 ? s[0] : e.reduce((i, r, n) => i + ((a) => {
27
+ if (a._$cssResult$ === !0) return a.cssText;
28
+ if (typeof a == "number") return a;
29
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
30
30
  })(r) + s[n + 1], s[0]);
31
31
  return new Fe(t, s, me);
32
32
  }, Re = (s, e) => {
@@ -91,12 +91,12 @@ let P = class extends HTMLElement {
91
91
  static getPropertyDescriptor(e, t, i) {
92
92
  const { get: r, set: n } = We(this.prototype, e) ?? { get() {
93
93
  return this[t];
94
- }, set(o) {
95
- this[t] = o;
94
+ }, set(a) {
95
+ this[t] = a;
96
96
  } };
97
- return { get: r, set(o) {
98
- const a = r == null ? void 0 : r.call(this);
99
- n == null || n.call(this, o), this.requestUpdate(e, a, i);
97
+ return { get: r, set(a) {
98
+ const o = r == null ? void 0 : r.call(this);
99
+ n == null || n.call(this, a), this.requestUpdate(e, o, i);
100
100
  }, configurable: !0, enumerable: !0 };
101
101
  }
102
102
  static getPropertyOptions(e) {
@@ -184,29 +184,29 @@ let P = class extends HTMLElement {
184
184
  var n;
185
185
  const i = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, i);
186
186
  if (r !== void 0 && i.reflect === !0) {
187
- const o = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : J).toAttribute(t, i.type);
188
- this._$Em = e, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$Em = null;
187
+ const a = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : J).toAttribute(t, i.type);
188
+ this._$Em = e, a == null ? this.removeAttribute(r) : this.setAttribute(r, a), this._$Em = null;
189
189
  }
190
190
  }
191
191
  _$AK(e, t) {
192
- var n, o;
192
+ var n, a;
193
193
  const i = this.constructor, r = i._$Eh.get(e);
194
194
  if (r !== void 0 && this._$Em !== r) {
195
- const a = i.getPropertyOptions(r), d = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((n = a.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? a.converter : J;
196
- this._$Em = r, this[r] = d.fromAttribute(t, a.type) ?? ((o = this._$Ej) == null ? void 0 : o.get(r)) ?? null, this._$Em = null;
195
+ const o = i.getPropertyOptions(r), d = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((n = o.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? o.converter : J;
196
+ this._$Em = r, this[r] = d.fromAttribute(t, o.type) ?? ((a = this._$Ej) == null ? void 0 : a.get(r)) ?? null, this._$Em = null;
197
197
  }
198
198
  }
199
199
  requestUpdate(e, t, i) {
200
200
  var r;
201
201
  if (e !== void 0) {
202
- const n = this.constructor, o = this[e];
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;
202
+ const n = this.constructor, a = this[e];
203
+ if (i ?? (i = n.getPropertyOptions(e)), !((i.hasChanged ?? fe)(a, t) || i.useDefault && i.reflect && a === ((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());
207
207
  }
208
- C(e, t, { useDefault: i, reflect: r, wrapped: n }, o) {
209
- i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, o ?? t ?? this[e]), n !== !0 || o !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), r === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
208
+ C(e, t, { useDefault: i, reflect: r, wrapped: n }, a) {
209
+ i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), n !== !0 || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), r === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
210
210
  }
211
211
  async _$EP() {
212
212
  this.isUpdatePending = !0;
@@ -226,13 +226,13 @@ let P = class extends HTMLElement {
226
226
  if (!this.isUpdatePending) return;
227
227
  if (!this.hasUpdated) {
228
228
  if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
229
- for (const [n, o] of this._$Ep) this[n] = o;
229
+ for (const [n, a] of this._$Ep) this[n] = a;
230
230
  this._$Ep = void 0;
231
231
  }
232
232
  const r = this.constructor.elementProperties;
233
- if (r.size > 0) for (const [n, o] of r) {
234
- const { wrapped: a } = o, d = this[n];
235
- a !== !0 || this._$AL.has(n) || d === void 0 || this.C(n, void 0, o, d);
233
+ if (r.size > 0) for (const [n, a] of r) {
234
+ const { wrapped: o } = a, d = this[n];
235
+ o !== !0 || this._$AL.has(n) || d === void 0 || this.C(n, void 0, a, d);
236
236
  }
237
237
  }
238
238
  let e = !1;
@@ -291,13 +291,13 @@ function Pe(s, e) {
291
291
  }
292
292
  const Je = (s, e) => {
293
293
  const t = s.length - 1, i = [];
294
- let r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = R;
295
- for (let a = 0; a < t; a++) {
296
- const d = s[a];
294
+ let r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", a = R;
295
+ for (let o = 0; o < t; o++) {
296
+ const d = s[o];
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 = 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
- 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);
298
+ for (; h < d.length && (a.lastIndex = h, c = a.exec(d), c !== null); ) h = a.lastIndex, a === R ? c[1] === "!--" ? a = ke : c[1] !== void 0 ? a = $e : c[2] !== void 0 ? (Ue.test(c[2]) && (r = RegExp("</" + c[2], "g")), a = M) : c[3] !== void 0 && (a = M) : a === M ? c[0] === ">" ? (a = r ?? R, u = -1) : c[1] === void 0 ? u = -2 : (u = a.lastIndex - c[2].length, p = c[1], a = c[3] === void 0 ? M : c[3] === '"' ? Ce : De) : a === Ce || a === De ? a = M : a === ke || a === $e ? a = R : (a = M, r = void 0);
299
+ const g = a === M && s[o + 1].startsWith("/>") ? " " : "";
300
+ n += a === R ? d + Ye : u >= 0 ? (i.push(p), d.slice(0, u) + ze + d.slice(u) + E + g) : d + E + (u === -2 ? o : g);
301
301
  }
302
302
  return [Pe(s, n + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
303
303
  };
@@ -305,16 +305,16 @@ class Q {
305
305
  constructor({ strings: e, _$litType$: t }, i) {
306
306
  let r;
307
307
  this.parts = [];
308
- let n = 0, o = 0;
309
- const a = e.length - 1, d = this.parts, [p, c] = Je(e, t);
308
+ let n = 0, a = 0;
309
+ const o = e.length - 1, d = this.parts, [p, c] = Je(e, t);
310
310
  if (this.el = Q.createElement(p, i), F.currentNode = this.el.content, t === 2 || t === 3) {
311
311
  const u = this.el.content.firstChild;
312
312
  u.replaceWith(...u.childNodes);
313
313
  }
314
- for (; (r = F.nextNode()) !== null && d.length < a; ) {
314
+ for (; (r = F.nextNode()) !== null && d.length < o; ) {
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), x = /([.?@])?(.*)/.exec(h);
317
+ const h = c[a++], g = r.getAttribute(u).split(E), x = /([.?@])?(.*)/.exec(h);
318
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
320
  if (Ue.test(r.tagName)) {
@@ -339,11 +339,11 @@ class Q {
339
339
  }
340
340
  }
341
341
  function L(s, e, t = s, i) {
342
- var o, a;
342
+ var a, o;
343
343
  if (e === U) return e;
344
- let r = i !== void 0 ? (o = t._$Co) == null ? void 0 : o[i] : t._$Cl;
344
+ let r = i !== void 0 ? (a = t._$Co) == null ? void 0 : a[i] : t._$Cl;
345
345
  const n = B(e) ? void 0 : e._$litDirective$;
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;
346
+ return (r == null ? void 0 : r.constructor) !== n && ((o = r == null ? void 0 : r._$AO) == null || o.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;
347
347
  }
348
348
  class Xe {
349
349
  constructor(e, t) {
@@ -358,13 +358,13 @@ class Xe {
358
358
  u(e) {
359
359
  const { el: { content: t }, parts: i } = this._$AD, r = ((e == null ? void 0 : e.creationScope) ?? I).importNode(t, !0);
360
360
  F.currentNode = r;
361
- let n = F.nextNode(), o = 0, a = 0, d = i[0];
361
+ let n = F.nextNode(), a = 0, o = 0, d = i[0];
362
362
  for (; d !== void 0; ) {
363
- if (o === d.index) {
363
+ if (a === d.index) {
364
364
  let p;
365
- d.type === 2 ? p = new G(n, n.nextSibling, this, e) : d.type === 1 ? p = new d.ctor(n, d.name, d.strings, this, e) : d.type === 6 && (p = new it(n, this, e)), this._$AV.push(p), d = i[++a];
365
+ d.type === 2 ? p = new G(n, n.nextSibling, this, e) : d.type === 1 ? p = new d.ctor(n, d.name, d.strings, this, e) : d.type === 6 && (p = new it(n, this, e)), this._$AV.push(p), d = i[++o];
366
366
  }
367
- o !== (d == null ? void 0 : d.index) && (n = F.nextNode(), o++);
367
+ a !== (d == null ? void 0 : d.index) && (n = F.nextNode(), a++);
368
368
  }
369
369
  return F.currentNode = I, r;
370
370
  }
@@ -409,8 +409,8 @@ class G {
409
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
- const o = new Xe(r, this), a = o.u(this.options);
413
- o.p(t), this.T(a), this._$AH = o;
412
+ const a = new Xe(r, this), o = a.u(this.options);
413
+ a.p(t), this.T(o), this._$AH = a;
414
414
  }
415
415
  }
416
416
  _$AC(e) {
@@ -448,14 +448,14 @@ class se {
448
448
  }
449
449
  _$AI(e, t = this, i, r) {
450
450
  const n = this.strings;
451
- let o = !1;
452
- if (n === void 0) e = L(this, e, t, 0), o = !B(e) || e !== this._$AH && e !== U, o && (this._$AH = e);
451
+ let a = !1;
452
+ if (n === void 0) e = L(this, e, t, 0), a = !B(e) || e !== this._$AH && e !== U, a && (this._$AH = e);
453
453
  else {
454
- const a = e;
454
+ const o = 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 === 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;
456
+ for (e = n[0], d = 0; d < n.length - 1; d++) p = L(this, o[i + d], t, d), p === U && (p = this._$AH[d]), a || (a = !B(p) || p !== this._$AH[d]), p === w ? e = w : e !== w && (e += (p ?? "") + n[d + 1]), this._$AH[d] = p;
457
457
  }
458
- o && !r && this.j(e);
458
+ a && !r && this.j(e);
459
459
  }
460
460
  j(e) {
461
461
  e === w ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
@@ -502,8 +502,8 @@ class it {
502
502
  L(this, e);
503
503
  }
504
504
  }
505
- const oe = W.litHtmlPolyfillSupport;
506
- oe == null || oe(Q, G), (W.litHtmlVersions ?? (W.litHtmlVersions = [])).push("3.3.0");
505
+ const ae = W.litHtmlPolyfillSupport;
506
+ ae == null || ae(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$;
@@ -546,8 +546,8 @@ let N = class extends P {
546
546
  };
547
547
  var Me;
548
548
  N._$litElement$ = !0, N.finalized = !0, (Me = z.litElementHydrateSupport) == null || Me.call(z, { LitElement: N });
549
- const ae = z.litElementPolyfillSupport;
550
- ae == null || ae({ LitElement: N });
549
+ const oe = z.litElementPolyfillSupport;
550
+ oe == null || oe({ LitElement: N });
551
551
  (z.litElementVersions ?? (z.litElementVersions = [])).push("4.2.0");
552
552
  /**
553
553
  * @license
@@ -568,27 +568,27 @@ const rt = { attribute: !0, type: String, converter: J, reflect: !1, hasChanged:
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") {
571
- const { name: o } = t;
572
- return { set(a) {
571
+ const { name: a } = t;
572
+ return { set(o) {
573
573
  const d = e.get.call(this);
574
- e.set.call(this, a), this.requestUpdate(o, d, s);
575
- }, init(a) {
576
- return a !== void 0 && this.C(o, void 0, s, a), a;
574
+ e.set.call(this, o), this.requestUpdate(a, d, s);
575
+ }, init(o) {
576
+ return o !== void 0 && this.C(a, void 0, s, o), o;
577
577
  } };
578
578
  }
579
579
  if (i === "setter") {
580
- const { name: o } = t;
581
- return function(a) {
582
- const d = this[o];
583
- e.call(this, a), this.requestUpdate(o, d, s);
580
+ const { name: a } = t;
581
+ return function(o) {
582
+ const d = this[a];
583
+ e.call(this, o), this.requestUpdate(a, d, s);
584
584
  };
585
585
  }
586
586
  throw Error("Unsupported decorator location: " + i);
587
587
  };
588
588
  function $(s) {
589
589
  return (e, t) => typeof t == "object" ? nt(s, e, t) : ((i, r, n) => {
590
- const o = r.hasOwnProperty(n);
591
- return r.constructor.createProperty(n, i), o ? Object.getOwnPropertyDescriptor(r, n) : void 0;
590
+ const a = r.hasOwnProperty(n);
591
+ return r.constructor.createProperty(n, i), a ? Object.getOwnPropertyDescriptor(r, n) : void 0;
592
592
  })(s, e, t);
593
593
  }
594
594
  /**
@@ -602,18 +602,18 @@ function b(s) {
602
602
  const k = [];
603
603
  for (let s = 0; s < 256; ++s)
604
604
  k.push((s + 256).toString(16).slice(1));
605
- function ot(s, e = 0) {
605
+ function at(s, e = 0) {
606
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
- const at = new Uint8Array(16);
609
+ const ot = new Uint8Array(16);
610
610
  function dt() {
611
611
  if (!de) {
612
612
  if (typeof crypto > "u" || !crypto.getRandomValues)
613
613
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
614
614
  de = crypto.getRandomValues.bind(crypto);
615
615
  }
616
- return de(at);
616
+ return de(ot);
617
617
  }
618
618
  const lt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ee = { randomUUID: lt };
619
619
  function A(s, e, t) {
@@ -624,7 +624,7 @@ function A(s, e, t) {
624
624
  const i = s.random ?? ((r = s.rng) == null ? void 0 : r.call(s)) ?? dt();
625
625
  if (i.length < 16)
626
626
  throw new Error("Random bytes length must be >= 16");
627
- return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, ot(i);
627
+ return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, at(i);
628
628
  }
629
629
  const pt = O`
630
630
  :host {
@@ -3897,8 +3897,8 @@ const pt = O`
3897
3897
  }
3898
3898
  `;
3899
3899
  var gt = Object.defineProperty, mt = Object.getOwnPropertyDescriptor, _ = (s, e, t, i) => {
3900
- for (var r = i > 1 ? void 0 : i ? mt(e, t) : e, n = s.length - 1, o; n >= 0; n--)
3901
- (o = s[n]) && (r = (i ? o(e, t, r) : o(r)) || r);
3900
+ for (var r = i > 1 ? void 0 : i ? mt(e, t) : e, n = s.length - 1, a; n >= 0; n--)
3901
+ (a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
3902
3902
  return i && r && gt(e, t, r), r;
3903
3903
  };
3904
3904
  let v = class extends N {
@@ -3913,7 +3913,11 @@ let v = class extends N {
3913
3913
  }, this._draggedStepId = null, this._dragOverStepId = null, this._selectedStepId = null, this._questions = [], this._editingStepId = null, this._stepAssignmentCategory = "individual", this._stepAssignmentType = "subject", this._stepAssignmentTarget = "", this._stepAssignmentFirstName = "", this._stepAssignmentLastName = "", this._openMenuStepId = null;
3914
3914
  }
3915
3915
  connectedCallback() {
3916
- super.connectedCallback(), this.workflow ? (this._templateData = { ...this.workflow }, this.workflow.steps && this.workflow.steps.length > 0 && (this._selectedStepId = this.workflow.steps[0].id), console.log("Builder loaded with existing workflow:", this.workflow.name)) : this._templateData = this._getDefaultWorkflowData(), this._clickOutsideHandler = () => this._closeStepMenu(), document.addEventListener("click", this._clickOutsideHandler);
3916
+ var s;
3917
+ super.connectedCallback(), this.workflow ? (this._templateData = { ...this.workflow }, this.workflow.steps && this.workflow.steps.length > 0 && (this._selectedStepId = this.workflow.steps[0].id), console.log("Builder loaded with existing workflow:", this.workflow.name)) : (this._templateData = this._getDefaultWorkflowData(), this.subjectTypes && this.subjectTypes.length > 0 && ((s = this.subjectTypes[0]) != null && s.name) && (this._templateData = {
3918
+ ...this._templateData,
3919
+ subjectType: this.subjectTypes[0].name
3920
+ })), this._clickOutsideHandler = () => this._closeStepMenu(), document.addEventListener("click", this._clickOutsideHandler);
3917
3921
  }
3918
3922
  disconnectedCallback() {
3919
3923
  super.disconnectedCallback(), this._clickOutsideHandler && document.removeEventListener("click", this._clickOutsideHandler);
@@ -4016,15 +4020,15 @@ let v = class extends N {
4016
4020
  }
4017
4021
  _duplicateStep(s) {
4018
4022
  var r, n;
4019
- const e = (r = this._templateData.steps) == null ? void 0 : r.find((o) => o.id === s);
4023
+ const e = (r = this._templateData.steps) == null ? void 0 : r.find((a) => a.id === s);
4020
4024
  if (!e) return;
4021
4025
  const t = this._templateData.steps || [], i = {
4022
4026
  ...e,
4023
4027
  id: A(),
4024
4028
  title: `${e.title} (Copy)`,
4025
4029
  order: t.length + 1,
4026
- elements: ((n = e.elements) == null ? void 0 : n.map((o) => ({
4027
- ...o,
4030
+ elements: ((n = e.elements) == null ? void 0 : n.map((a) => ({
4031
+ ...a,
4028
4032
  id: A()
4029
4033
  }))) || []
4030
4034
  };
@@ -4054,11 +4058,11 @@ let v = class extends N {
4054
4058
  };
4055
4059
  if (this._stepAssignmentType === "specific_user" && this._stepAssignmentTarget ? (e.email = this._stepAssignmentTarget, this._stepAssignmentFirstName || this._stepAssignmentLastName ? e.targetName = `${this._stepAssignmentFirstName} ${this._stepAssignmentLastName}`.trim() : e.targetName = this._stepAssignmentTarget) : this._stepAssignmentType === "instance_role_assignee_select" && this._stepAssignmentTarget && (e.targetId = this._stepAssignmentTarget), this._editingStepId) {
4056
4060
  const r = s.map((n) => {
4057
- var o;
4061
+ var a;
4058
4062
  return n.id === this._editingStepId ? {
4059
4063
  ...n,
4060
4064
  title: this._stepFormData.title.trim(),
4061
- description: ((o = this._stepFormData.description) == null ? void 0 : o.trim()) || "",
4065
+ description: ((a = this._stepFormData.description) == null ? void 0 : a.trim()) || "",
4062
4066
  assignment: e
4063
4067
  } : n;
4064
4068
  });
@@ -4109,21 +4113,21 @@ let v = class extends N {
4109
4113
  this._draggedStepId = null, this._dragOverStepId = null;
4110
4114
  return;
4111
4115
  }
4112
- const t = this._templateData.steps || [], i = t.findIndex((a) => a.id === this._draggedStepId), r = t.findIndex((a) => a.id === e);
4116
+ const t = this._templateData.steps || [], i = t.findIndex((o) => o.id === this._draggedStepId), r = t.findIndex((o) => o.id === e);
4113
4117
  if (i === -1 || r === -1) {
4114
4118
  console.error("Could not find step indices for reordering");
4115
4119
  return;
4116
4120
  }
4117
4121
  console.log(
4118
4122
  "🔄 Before reorder:",
4119
- t.map((a, d) => `${d + 1}: ${a.title}`)
4123
+ t.map((o, d) => `${d + 1}: ${o.title}`)
4120
4124
  );
4121
- const n = [...t], [o] = n.splice(i, 1);
4122
- n.splice(r, 0, o), n.forEach((a, d) => {
4123
- a.order = d + 1;
4125
+ const n = [...t], [a] = n.splice(i, 1);
4126
+ n.splice(r, 0, a), n.forEach((o, d) => {
4127
+ o.order = d + 1;
4124
4128
  }), console.log(
4125
4129
  "🔄 After reorder:",
4126
- n.map((a, d) => `${d + 1}: ${a.title}`)
4130
+ n.map((o, d) => `${d + 1}: ${o.title}`)
4127
4131
  ), this._templateData = {
4128
4132
  ...this._templateData,
4129
4133
  steps: n
@@ -4168,13 +4172,13 @@ let v = class extends N {
4168
4172
  Use **bold** and *italic* text.`;
4169
4173
  break;
4170
4174
  }
4171
- const o = this._templateData.steps.map((a) => a.id === this._selectedStepId ? {
4172
- ...a,
4173
- elements: [...a.elements || [], n]
4174
- } : a);
4175
+ const a = this._templateData.steps.map((o) => o.id === this._selectedStepId ? {
4176
+ ...o,
4177
+ elements: [...o.elements || [], n]
4178
+ } : o);
4175
4179
  this._templateData = {
4176
4180
  ...this._templateData,
4177
- steps: o
4181
+ steps: a
4178
4182
  }, console.log("✅ Content element added to step:", this._selectedStepId);
4179
4183
  } else {
4180
4184
  const n = {
@@ -4187,13 +4191,13 @@ Use **bold** and *italic* text.`;
4187
4191
  required: !1
4188
4192
  };
4189
4193
  ["select", "radio", "checkbox"].includes(s) && (n.options = ["Option 1", "Option 2"]);
4190
- const o = this._templateData.steps.map((a) => a.id === this._selectedStepId ? {
4191
- ...a,
4192
- elements: [...a.elements || [], n]
4193
- } : a);
4194
+ const a = this._templateData.steps.map((o) => o.id === this._selectedStepId ? {
4195
+ ...o,
4196
+ elements: [...o.elements || [], n]
4197
+ } : o);
4194
4198
  this._templateData = {
4195
4199
  ...this._templateData,
4196
- steps: o
4200
+ steps: a
4197
4201
  }, console.log("✅ Question added to step:", this._selectedStepId);
4198
4202
  }
4199
4203
  }
@@ -4255,7 +4259,7 @@ Use **bold** and *italic* text.`;
4255
4259
  return r.id === this._selectedStepId ? {
4256
4260
  ...r,
4257
4261
  elements: ((n = r.elements) == null ? void 0 : n.map(
4258
- (o) => o.id === s ? { ...o, ...e } : o
4262
+ (a) => a.id === s ? { ...a, ...e } : a
4259
4263
  )) || []
4260
4264
  } : r;
4261
4265
  });
@@ -4272,7 +4276,7 @@ Use **bold** and *italic* text.`;
4272
4276
  return r.id === this._selectedStepId ? {
4273
4277
  ...r,
4274
4278
  elements: ((n = r.elements) == null ? void 0 : n.map(
4275
- (o) => o.id === s ? { ...o, ...e } : o
4279
+ (a) => a.id === s ? { ...a, ...e } : a
4276
4280
  )) || []
4277
4281
  } : r;
4278
4282
  });
@@ -4874,7 +4878,12 @@ Use **bold** and *italic* text.`;
4874
4878
  <label for="subject-type-select">Subject Type</label>
4875
4879
  <select id="subject-type-select" @change=${this._handleSubjectTypeChange}>
4876
4880
  ${this.subjectTypes.map(
4877
- (t) => l`<option value=${t.name}>${t.name}</option>`
4881
+ (t) => l`<option
4882
+ value=${t.name}
4883
+ ?selected=${this._templateData.subjectType === t.name}
4884
+ >
4885
+ ${t.name}
4886
+ </option>`
4878
4887
  )}
4879
4888
  </select>
4880
4889
  </div>` : l``}
@@ -5077,13 +5086,13 @@ Use **bold** and *italic* text.`;
5077
5086
  class="assignment-select"
5078
5087
  .value=${this._stepAssignmentTarget}
5079
5088
  @change=${(t) => {
5080
- var n, o;
5089
+ var n, a;
5081
5090
  const i = t.target;
5082
5091
  this._stepAssignmentTarget = i.value;
5083
5092
  const r = (n = this._templateData.steps) == null ? void 0 : n.findIndex(
5084
- (a) => a.id === this._editingStepId
5093
+ (o) => o.id === this._editingStepId
5085
5094
  );
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());
5095
+ r !== void 0 && r > -1 && (this._templateData.steps[r].assignment.targetName = (a = this.groups.find((o) => o.id === i.value)) == null ? void 0 : a.name, this._templateData.steps[r].assignment.targetId = i.value, this.requestUpdate());
5087
5096
  }}
5088
5097
  >
5089
5098
  <!-- Groups -->
@@ -5301,8 +5310,8 @@ Use **bold** and *italic* text.`;
5301
5310
  <select
5302
5311
  class="question-type-select"
5303
5312
  .value=${n.type || "text_input"}
5304
- @change=${(o) => {
5305
- const d = o.target.value;
5313
+ @change=${(a) => {
5314
+ const d = a.target.value;
5306
5315
  if ([
5307
5316
  "text",
5308
5317
  "html",
@@ -5370,10 +5379,10 @@ Use **bold** and *italic* text.`;
5370
5379
  class="question-label-input"
5371
5380
  placeholder="Question label"
5372
5381
  .value=${n.label || ""}
5373
- @input=${(o) => {
5374
- const a = o.target;
5382
+ @input=${(a) => {
5383
+ const o = a.target;
5375
5384
  this._updateQuestion(n.id, {
5376
- label: a.value
5385
+ label: o.value
5377
5386
  });
5378
5387
  }}
5379
5388
  />
@@ -5384,10 +5393,10 @@ Use **bold** and *italic* text.`;
5384
5393
  <input
5385
5394
  type="checkbox"
5386
5395
  .checked=${n.required || !1}
5387
- @change=${(o) => {
5388
- const a = o.target;
5396
+ @change=${(a) => {
5397
+ const o = a.target;
5389
5398
  this._updateQuestion(n.id, {
5390
- required: a.checked
5399
+ required: o.checked
5391
5400
  });
5392
5401
  }}
5393
5402
  />
@@ -5407,8 +5416,8 @@ Use **bold** and *italic* text.`;
5407
5416
  <select
5408
5417
  class="question-type-select"
5409
5418
  .value=${t.type || "text"}
5410
- @change=${(o) => {
5411
- const d = o.target.value;
5419
+ @change=${(a) => {
5420
+ const d = a.target.value;
5412
5421
  if (![
5413
5422
  "text",
5414
5423
  "html",
@@ -5587,25 +5596,26 @@ class ft {
5587
5596
  return { isValid: !1, errors: {} };
5588
5597
  let r = !0;
5589
5598
  const n = {};
5590
- for (const o of e.elements)
5591
- if (this.isQuestionElement(o)) {
5592
- const a = o;
5593
- if (a.required) {
5599
+ for (const a of e.elements)
5600
+ if (this.isQuestionElement(a)) {
5601
+ const o = a;
5602
+ if (o.required) {
5594
5603
  const d = this.validateQuestion(
5595
- a,
5596
- t[a.id]
5604
+ o,
5605
+ t[o.id],
5606
+ t
5597
5607
  );
5598
- d && (r = !1, n[a.id] = d.message);
5608
+ d && (r = !1, n[o.id] = d.message);
5599
5609
  }
5600
5610
  }
5601
5611
  return { isValid: r, errors: n };
5602
5612
  }
5603
- validateQuestion(e, t) {
5613
+ validateQuestion(e, t, i) {
5604
5614
  switch (e.type) {
5605
5615
  case "checkbox":
5606
5616
  return this.validateCheckbox(e, t);
5607
5617
  case "signature":
5608
- return this.validateSignature(e, t);
5618
+ return this.validateSignature(e, t, i);
5609
5619
  case "file_upload":
5610
5620
  return this.validateFileUpload(e, t);
5611
5621
  default:
@@ -5626,9 +5636,11 @@ class ft {
5626
5636
  };
5627
5637
  return null;
5628
5638
  }
5629
- validateSignature(e, t) {
5630
- const i = this.signaturePads.get(e.id);
5631
- return !i || i.isEmpty() ? {
5639
+ validateSignature(e, t, i) {
5640
+ if (i && i[e.id])
5641
+ return null;
5642
+ const r = this.signaturePads.get(e.id);
5643
+ return !r || r.isEmpty() ? {
5632
5644
  questionId: e.id,
5633
5645
  message: `${e.label} is required.`
5634
5646
  } : this.savedSignatures.has(e.id) ? null : {
@@ -5666,13 +5678,13 @@ class bt {
5666
5678
  getStorageKey(e) {
5667
5679
  return `runner-form-data-${e || "default"}`;
5668
5680
  }
5669
- saveFormData(e, t, i, r, n, o) {
5681
+ saveFormData(e, t, i, r, n, a) {
5670
5682
  var c, u, h;
5671
- const a = this.getStorageKey(e), d = o ? {
5672
- ...o,
5673
- currentStepId: (u = (c = o.steps) == null ? void 0 : c[i]) == null ? void 0 : u.id,
5683
+ const o = this.getStorageKey(e), d = a ? {
5684
+ ...a,
5685
+ currentStepId: (u = (c = a.steps) == null ? void 0 : c[i]) == null ? void 0 : u.id,
5674
5686
  completedSteps: Array.from(n),
5675
- steps: (h = o.steps) == null ? void 0 : h.map((g) => ({
5687
+ steps: (h = a.steps) == null ? void 0 : h.map((g) => ({
5676
5688
  ...g,
5677
5689
  responses: g.responses || []
5678
5690
  }))
@@ -5685,7 +5697,7 @@ class bt {
5685
5697
  instance: d
5686
5698
  };
5687
5699
  try {
5688
- localStorage.setItem(a, JSON.stringify(p));
5700
+ localStorage.setItem(o, JSON.stringify(p));
5689
5701
  } catch (g) {
5690
5702
  console.warn("Failed to save form data to localStorage:", g);
5691
5703
  }
@@ -5746,24 +5758,24 @@ class ve {
5746
5758
  return new ve(e[1], i, r, e[2], t.start, t.end);
5747
5759
  }
5748
5760
  static calculateControlPoints(e, t, i) {
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;
5761
+ const r = e.x - t.x, n = e.y - t.y, a = t.x - i.x, o = 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(a * a + o * o), 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;
5750
5762
  return {
5751
5763
  c1: new Z(d.x + Y, d.y + q),
5752
5764
  c2: new Z(p.x + Y, p.y + q)
5753
5765
  };
5754
5766
  }
5755
- constructor(e, t, i, r, n, o) {
5756
- this.startPoint = e, this.control2 = t, this.control1 = i, this.endPoint = r, this.startWidth = n, this.endWidth = o;
5767
+ constructor(e, t, i, r, n, a) {
5768
+ this.startPoint = e, this.control2 = t, this.control1 = i, this.endPoint = r, this.startWidth = n, this.endWidth = a;
5757
5769
  }
5758
5770
  length() {
5759
5771
  let t = 0, i, r;
5760
5772
  for (let n = 0; n <= 10; n += 1) {
5761
- const o = n / 10, a = this.point(o, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x), d = this.point(o, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);
5773
+ const a = n / 10, o = this.point(a, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x), d = this.point(a, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);
5762
5774
  if (n > 0) {
5763
- const p = a - i, c = d - r;
5775
+ const p = o - i, c = d - r;
5764
5776
  t += Math.sqrt(p * p + c * c);
5765
5777
  }
5766
- i = a, r = d;
5778
+ i = o, r = d;
5767
5779
  }
5768
5780
  return t;
5769
5781
  }
@@ -5790,13 +5802,13 @@ class vt {
5790
5802
  }
5791
5803
  }
5792
5804
  function xt(s, e = 250) {
5793
- let t = 0, i = null, r, n, o;
5794
- const a = () => {
5795
- t = Date.now(), i = null, r = s.apply(n, o), i || (n = null, o = []);
5805
+ let t = 0, i = null, r, n, a;
5806
+ const o = () => {
5807
+ t = Date.now(), i = null, r = s.apply(n, a), i || (n = null, a = []);
5796
5808
  };
5797
5809
  return function(...p) {
5798
5810
  const c = Date.now(), u = e - (c - t);
5799
- return n = this, o = p, u <= 0 || u > e ? (i && (clearTimeout(i), i = null), t = c, r = s.apply(n, o), i || (n = null, o = [])) : i || (i = window.setTimeout(a, u)), r;
5811
+ return n = this, a = p, u <= 0 || u > e ? (i && (clearTimeout(i), i = null), t = c, r = s.apply(n, a), i || (n = null, a = [])) : i || (i = window.setTimeout(o, u)), r;
5800
5812
  };
5801
5813
  }
5802
5814
  class ee extends vt {
@@ -5810,9 +5822,9 @@ class ee extends vt {
5810
5822
  }
5811
5823
  fromDataURL(e, t = {}) {
5812
5824
  return new Promise((i, r) => {
5813
- const n = new Image(), o = t.ratio || window.devicePixelRatio || 1, a = t.width || this.canvas.width / o, d = t.height || this.canvas.height / o, p = t.xOffset || 0, c = t.yOffset || 0;
5825
+ const n = new Image(), a = t.ratio || window.devicePixelRatio || 1, o = t.width || this.canvas.width / a, d = t.height || this.canvas.height / a, p = t.xOffset || 0, c = t.yOffset || 0;
5814
5826
  this._reset(this._getPointGroupOptions()), n.onload = () => {
5815
- this._ctx.drawImage(n, p, c, a, d), i();
5827
+ this._ctx.drawImage(n, p, c, o, d), i();
5816
5828
  }, n.onerror = (u) => {
5817
5829
  r(u);
5818
5830
  }, n.crossOrigin = "anonymous", n.src = e, this._isEmpty = !1;
@@ -5971,10 +5983,10 @@ class ee extends vt {
5971
5983
  return;
5972
5984
  }
5973
5985
  this.dispatchEvent(new CustomEvent("beforeUpdateStroke", { detail: e }));
5974
- const t = this._createPoint(e.x, e.y, e.pressure), i = this._data[this._data.length - 1], r = i.points, n = r.length > 0 && r[r.length - 1], o = n ? t.distanceTo(n) <= this.minDistance : !1, a = this._getPointGroupOptions(i);
5975
- if (!n || !(n && o)) {
5976
- const d = this._addPoint(t, a);
5977
- n ? d && this._drawCurve(d, a) : this._drawDot(t, a), r.push({
5986
+ const t = this._createPoint(e.x, e.y, e.pressure), i = this._data[this._data.length - 1], r = i.points, n = r.length > 0 && r[r.length - 1], a = n ? t.distanceTo(n) <= this.minDistance : !1, o = this._getPointGroupOptions(i);
5987
+ if (!n || !(n && a)) {
5988
+ const d = this._addPoint(t, o);
5989
+ n ? d && this._drawCurve(d, o) : this._drawDot(t, o), r.push({
5978
5990
  time: t.time,
5979
5991
  x: t.x,
5980
5992
  y: t.y,
@@ -6018,11 +6030,11 @@ class ee extends vt {
6018
6030
  return null;
6019
6031
  }
6020
6032
  _calculateCurveWidths(e, t, i) {
6021
- const r = i.velocityFilterWeight * t.velocityFrom(e) + (1 - i.velocityFilterWeight) * this._lastVelocity, n = this._strokeWidth(r, i), o = {
6033
+ const r = i.velocityFilterWeight * t.velocityFrom(e) + (1 - i.velocityFilterWeight) * this._lastVelocity, n = this._strokeWidth(r, i), a = {
6022
6034
  end: n,
6023
6035
  start: this._lastWidth
6024
6036
  };
6025
- return this._lastVelocity = r, this._lastWidth = n, o;
6037
+ return this._lastVelocity = r, this._lastWidth = n, a;
6026
6038
  }
6027
6039
  _strokeWidth(e, t) {
6028
6040
  return Math.max(t.maxWidth / (e + 1), t.minWidth);
@@ -6034,12 +6046,12 @@ class ee extends vt {
6034
6046
  _drawCurve(e, t) {
6035
6047
  const i = this._ctx, r = e.endWidth - e.startWidth, n = Math.ceil(e.length()) * 2;
6036
6048
  i.beginPath(), i.fillStyle = t.penColor;
6037
- for (let o = 0; o < n; o += 1) {
6038
- const a = o / n, d = a * a, p = d * a, c = 1 - a, u = c * c, h = u * c;
6049
+ for (let a = 0; a < n; a += 1) {
6050
+ const o = a / n, d = o * o, p = d * o, c = 1 - o, u = c * c, h = u * c;
6039
6051
  let g = h * e.startPoint.x;
6040
- g += 3 * u * a * e.control1.x, g += 3 * c * d * e.control2.x, g += p * e.endPoint.x;
6052
+ g += 3 * u * o * e.control1.x, g += 3 * c * d * e.control2.x, g += p * e.endPoint.x;
6041
6053
  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;
6054
+ x += 3 * u * o * e.control1.y, x += 3 * c * d * e.control2.y, x += p * e.endPoint.y;
6043
6055
  const S = Math.min(e.startWidth + p * r, t.maxWidth);
6044
6056
  this._drawCurveSegment(g, x, S);
6045
6057
  }
@@ -6051,21 +6063,21 @@ class ee extends vt {
6051
6063
  }
6052
6064
  _fromData(e, t, i) {
6053
6065
  for (const r of e) {
6054
- const { points: n } = r, o = this._getPointGroupOptions(r);
6066
+ const { points: n } = r, a = this._getPointGroupOptions(r);
6055
6067
  if (n.length > 1)
6056
- for (let a = 0; a < n.length; a += 1) {
6057
- const d = n[a], p = new Z(d.x, d.y, d.pressure, d.time);
6058
- a === 0 && this._reset(o);
6059
- const c = this._addPoint(p, o);
6060
- c && t(c, o);
6068
+ for (let o = 0; o < n.length; o += 1) {
6069
+ const d = n[o], p = new Z(d.x, d.y, d.pressure, d.time);
6070
+ o === 0 && this._reset(a);
6071
+ const c = this._addPoint(p, a);
6072
+ c && t(c, a);
6061
6073
  }
6062
6074
  else
6063
- this._reset(o), i(n[0], o);
6075
+ this._reset(a), i(n[0], a);
6064
6076
  }
6065
6077
  }
6066
6078
  toSVG({ includeBackgroundColor: e = !1 } = {}) {
6067
- const t = this._data, i = Math.max(window.devicePixelRatio || 1, 1), r = 0, n = 0, o = this.canvas.width / i, a = this.canvas.height / i, d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
6068
- if (d.setAttribute("xmlns", "http://www.w3.org/2000/svg"), d.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), d.setAttribute("viewBox", `${r} ${n} ${o} ${a}`), d.setAttribute("width", o.toString()), d.setAttribute("height", a.toString()), e && this.backgroundColor) {
6079
+ const t = this._data, i = Math.max(window.devicePixelRatio || 1, 1), r = 0, n = 0, a = this.canvas.width / i, o = this.canvas.height / i, d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
6080
+ if (d.setAttribute("xmlns", "http://www.w3.org/2000/svg"), d.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), d.setAttribute("viewBox", `${r} ${n} ${a} ${o}`), d.setAttribute("width", a.toString()), d.setAttribute("height", o.toString()), e && this.backgroundColor) {
6069
6081
  const p = document.createElement("rect");
6070
6082
  p.setAttribute("width", "100%"), p.setAttribute("height", "100%"), p.setAttribute("fill", this.backgroundColor), d.appendChild(p);
6071
6083
  }
@@ -6146,8 +6158,8 @@ class _t {
6146
6158
  resizeCanvas(e) {
6147
6159
  const t = Math.max(window.devicePixelRatio || 1, 1), i = window.getComputedStyle(e), r = parseFloat(i.width), n = parseFloat(i.height);
6148
6160
  e.width = r * t, e.height = n * t;
6149
- const o = e.getContext("2d");
6150
- o && o.scale(t, t);
6161
+ const a = e.getContext("2d");
6162
+ a && a.scale(t, t);
6151
6163
  }
6152
6164
  clearSignaturePad(e) {
6153
6165
  var t;
@@ -6173,7 +6185,7 @@ class yt {
6173
6185
  if (!e) return;
6174
6186
  e.responses || (e.responses = []);
6175
6187
  const r = e.responses.findIndex(
6176
- (o) => o.elementId === t
6188
+ (a) => a.elementId === t
6177
6189
  ), n = {
6178
6190
  elementId: t,
6179
6191
  value: i,
@@ -6187,12 +6199,12 @@ class yt {
6187
6199
  if (this.isQuestionElement(r.type)) {
6188
6200
  const n = t[r.id];
6189
6201
  if (n !== void 0 && i.responses) {
6190
- let o = i.responses.find((a) => a.elementId === r.id);
6191
- o ? (o.value = n, o.answeredAt = /* @__PURE__ */ new Date()) : (o = {
6202
+ let a = i.responses.find((o) => o.elementId === r.id);
6203
+ a ? (a.value = n, a.answeredAt = /* @__PURE__ */ new Date()) : (a = {
6192
6204
  elementId: r.id,
6193
6205
  value: n,
6194
6206
  answeredAt: /* @__PURE__ */ new Date()
6195
- }, i.responses.push(o));
6207
+ }, i.responses.push(a));
6196
6208
  }
6197
6209
  }
6198
6210
  });
@@ -6210,7 +6222,7 @@ class yt {
6210
6222
  if (!(i != null && i.steps)) return !0;
6211
6223
  for (const r of i.steps)
6212
6224
  if (r.responses) {
6213
- const n = r.responses.find((o) => o.elementId === e);
6225
+ const n = r.responses.find((a) => a.elementId === e);
6214
6226
  if (n)
6215
6227
  return n.value !== t;
6216
6228
  }
@@ -6266,8 +6278,8 @@ class wt {
6266
6278
  }
6267
6279
  return this.findNextAssignedStep(e, t) === -1;
6268
6280
  }
6269
- canNavigateToStep(e, t, i, r, n, o) {
6270
- if ((n || o) && this.mode !== "admin" && this.mode !== "view-only" && this.mode !== "print")
6281
+ canNavigateToStep(e, t, i, r, n, a) {
6282
+ if ((n || a) && this.mode !== "admin" && this.mode !== "view-only" && this.mode !== "print")
6271
6283
  return {
6272
6284
  canNavigate: !1,
6273
6285
  newStepIndex: t,
@@ -6284,14 +6296,14 @@ class wt {
6284
6296
  newStepIndex: e
6285
6297
  };
6286
6298
  }
6287
- const a = i.steps;
6288
- if (!a || e < 0 || e >= a.length)
6299
+ const o = i.steps;
6300
+ if (!o || e < 0 || e >= o.length)
6289
6301
  return {
6290
6302
  canNavigate: !1,
6291
6303
  newStepIndex: t,
6292
6304
  reason: "Invalid step index"
6293
6305
  };
6294
- const d = a[e];
6306
+ const d = o[e];
6295
6307
  if (this.isStepAssignedToUser(d)) {
6296
6308
  const p = r.has(d.id), c = this.isStepWithinAllowedRange(
6297
6309
  e,
@@ -6315,18 +6327,18 @@ class wt {
6315
6327
  isStepWithinAllowedRange(e, t, i) {
6316
6328
  if (!(t != null && t.steps)) return !1;
6317
6329
  const n = this.getAssignedSteps(t).map((d) => t.steps.findIndex((p) => p.id === d.id)).sort((d, p) => d - p);
6318
- let o = -1;
6330
+ let a = -1;
6319
6331
  for (const d of n) {
6320
6332
  const p = t.steps[d];
6321
- i.has(p.id) && (o = d);
6333
+ i.has(p.id) && (a = d);
6322
6334
  }
6323
- let a = -1;
6335
+ let o = -1;
6324
6336
  for (const d of n)
6325
- if (d > o) {
6326
- a = d;
6337
+ if (d > a) {
6338
+ o = d;
6327
6339
  break;
6328
6340
  }
6329
- return a !== -1 ? e <= a && this.isStepAssignedToUser(t.steps[e]) : this.isStepAssignedToUser(t.steps[e]);
6341
+ return o !== -1 ? e <= o && this.isStepAssignedToUser(t.steps[e]) : this.isStepAssignedToUser(t.steps[e]);
6330
6342
  }
6331
6343
  }
6332
6344
  const te = class te {
@@ -6455,8 +6467,8 @@ const te = class te {
6455
6467
  const t = {};
6456
6468
  return (i = e.elements) == null || i.forEach((r) => {
6457
6469
  if (this.isQuestionElement(r)) {
6458
- const n = r, o = this.formData[n.id];
6459
- o !== void 0 && (t[n.id] = o);
6470
+ const n = r, a = this.formData[n.id];
6471
+ a !== void 0 && (t[n.id] = a);
6460
6472
  }
6461
6473
  }), t;
6462
6474
  }
@@ -6506,16 +6518,16 @@ const ie = class ie {
6506
6518
  this.clearFile(e), (c = i.onRequestUpdate) == null || c.call(i);
6507
6519
  return;
6508
6520
  }
6509
- const o = this.validateFileSize(n);
6510
- if (o) {
6511
- this.handleFileValidationError(e, o, r), (u = i.onRequestUpdate) == null || u.call(i);
6521
+ const a = this.validateFileSize(n);
6522
+ if (a) {
6523
+ this.handleFileValidationError(e, a, r), (u = i.onRequestUpdate) == null || u.call(i);
6512
6524
  return;
6513
6525
  }
6514
6526
  this.formStateManager.clearValidationError(e);
6515
- const a = this.createFileInfo(n);
6516
- this.formStateManager.setFormField(e, a);
6517
- const d = this.hasFileChanged(e, a, i.savedInstance);
6518
- d && i.mode !== "preview" ? this.executeFileUploadCallback(e, n, a, i) : this.logSkippedCallback(e, i.mode, d), (h = i.onRequestUpdate) == null || h.call(i), i.mode !== "admin" && ((g = i.onFormDataSave) == null || g.call(i));
6527
+ const o = this.createFileInfo(n);
6528
+ this.formStateManager.setFormField(e, o);
6529
+ const d = this.hasFileChanged(e, o, i.savedInstance);
6530
+ d && i.mode !== "preview" ? this.executeFileUploadCallback(e, n, o, i) : this.logSkippedCallback(e, i.mode, d), (h = i.onRequestUpdate) == null || h.call(i), i.mode !== "admin" && ((g = i.onFormDataSave) == null || g.call(i));
6519
6531
  }
6520
6532
  /**
6521
6533
  * Clears file data for a question
@@ -6553,10 +6565,10 @@ const ie = class ie {
6553
6565
  if (!(i != null && i.steps)) return !0;
6554
6566
  for (const r of i.steps)
6555
6567
  if (r.responses) {
6556
- const n = r.responses.find((o) => o.elementId === e);
6568
+ const n = r.responses.find((a) => a.elementId === e);
6557
6569
  if (n && n.value && typeof n.value == "object") {
6558
- const o = n.value;
6559
- return o.name !== t.name || o.size !== t.size || o.type !== t.type || o.lastModified !== t.lastModified;
6570
+ const a = n.value;
6571
+ return a.name !== t.name || a.size !== t.size || a.type !== t.type || a.lastModified !== t.lastModified;
6560
6572
  }
6561
6573
  }
6562
6574
  return !0;
@@ -6565,10 +6577,10 @@ const ie = class ie {
6565
6577
  * Executes the file upload callback with proper context
6566
6578
  */
6567
6579
  executeFileUploadCallback(e, t, i, r) {
6568
- var n, o;
6580
+ var n, a;
6569
6581
  console.log("File changed, calling callback for:", e), console.log("Callback function exists:", !!r.onFileUploaded), r.onFileUploaded && r.onFileUploaded({
6570
6582
  instanceId: (n = r.instance) == null ? void 0 : n.id,
6571
- stepId: (o = r.currentStep) == null ? void 0 : o.id,
6583
+ stepId: (a = r.currentStep) == null ? void 0 : a.id,
6572
6584
  questionId: e,
6573
6585
  file: t,
6574
6586
  fileName: i.name,
@@ -6664,51 +6676,51 @@ class D {
6664
6676
  </select>`;
6665
6677
  }
6666
6678
  static renderRadio(e, t, i) {
6667
- var o;
6679
+ var a;
6668
6680
  const r = this._isInputDisabled(i), n = i.mode === "print";
6669
6681
  return n ? l`<div class="print-response-value radio-response">
6670
6682
  ${t || l`<span class="print-no-response">No selection made</span>`}
6671
6683
  </div>` : l`<div class="radio-group ${n ? "print-mode" : ""}">
6672
- ${(o = e.options) == null ? void 0 : o.map(
6673
- (a) => l`
6684
+ ${(a = e.options) == null ? void 0 : a.map(
6685
+ (o) => l`
6674
6686
  <label class="radio-option">
6675
6687
  <input
6676
6688
  type="radio"
6677
6689
  name=${e.id}
6678
- value=${a}
6679
- .checked=${t === a}
6690
+ value=${o}
6691
+ .checked=${t === o}
6680
6692
  ?disabled=${r}
6681
6693
  @change=${n ? null : (d) => i.handlers.handleInputChange(e.id, d)}
6682
6694
  />
6683
- <span class="radio-label">${a}</span>
6695
+ <span class="radio-label">${o}</span>
6684
6696
  </label>
6685
6697
  `
6686
6698
  )}
6687
6699
  </div>`;
6688
6700
  }
6689
6701
  static renderCheckbox(e, t, i) {
6690
- var o;
6702
+ var a;
6691
6703
  const r = this._isInputDisabled(i), n = i.mode === "print";
6692
6704
  if (e.options && e.options.length > 0) {
6693
6705
  if (n) {
6694
- const a = Array.isArray(t) ? t : [];
6706
+ const o = Array.isArray(t) ? t : [];
6695
6707
  return l`<div class="print-response-value checkbox-response">
6696
- ${a.length > 0 ? a.map((d) => l`<div>• ${d}</div>`) : l`<span class="print-no-response">No selections made</span>`}
6708
+ ${o.length > 0 ? o.map((d) => l`<div>• ${d}</div>`) : l`<span class="print-no-response">No selections made</span>`}
6697
6709
  </div>`;
6698
6710
  }
6699
6711
  return l`<div class="checkbox-group ${n ? "print-mode" : ""}">
6700
- ${(o = e.options) == null ? void 0 : o.map(
6701
- (a) => l`
6712
+ ${(a = e.options) == null ? void 0 : a.map(
6713
+ (o) => l`
6702
6714
  <label class="checkbox-option">
6703
6715
  <input
6704
6716
  type="checkbox"
6705
6717
  name=${e.id}
6706
- value=${a}
6707
- .checked=${Array.isArray(t) ? t.includes(a) : !1}
6718
+ value=${o}
6719
+ .checked=${Array.isArray(t) ? t.includes(o) : !1}
6708
6720
  ?disabled=${r}
6709
- @change=${n ? null : (d) => i.handlers.handleCheckboxGroupChange(e.id, a, d)}
6721
+ @change=${n ? null : (d) => i.handlers.handleCheckboxGroupChange(e.id, o, d)}
6710
6722
  />
6711
- <span class="checkbox-label">${a}</span>
6723
+ <span class="checkbox-label">${o}</span>
6712
6724
  </label>
6713
6725
  `
6714
6726
  )}
@@ -6722,13 +6734,13 @@ class D {
6722
6734
  id=${e.id}
6723
6735
  .checked=${!!t}
6724
6736
  ?disabled=${r}
6725
- @change=${n ? null : (a) => i.handlers.handleCheckboxChange(e.id, a)}
6737
+ @change=${n ? null : (o) => i.handlers.handleCheckboxChange(e.id, o)}
6726
6738
  />
6727
6739
  <span class="checkbox-label">${e.label}</span>
6728
6740
  </label>`;
6729
6741
  }
6730
6742
  static renderSignature(e, t, i) {
6731
- const r = i.formData[e.id], n = !!i.formData[e.id], o = i.savedSignatures.has(e.id), a = i.replacingSignatures.has(e.id);
6743
+ const r = i.formData[e.id], n = !!i.formData[e.id], a = i.savedSignatures.has(e.id), o = i.replacingSignatures.has(e.id);
6732
6744
  if (i.mode === "print")
6733
6745
  return r && typeof r == "string" ? l`
6734
6746
  <div class="print-response-value signature-response">
@@ -6775,7 +6787,31 @@ class D {
6775
6787
  <span class="no-signature">No signature captured</span>
6776
6788
  </div>
6777
6789
  `;
6778
- if (i.mode === "admin" && r && typeof r == "string" && !a) {
6790
+ if (i.mode === "default" && !i.handlers.isCurrentStepAssigned())
6791
+ return r && typeof r == "string" ? l`
6792
+ <div class="signature-view-only">
6793
+ <img
6794
+ src="${r}"
6795
+ alt="Digital Signature"
6796
+ class="signature-image"
6797
+ @error=${(d) => {
6798
+ var u;
6799
+ const p = d.target;
6800
+ p.style.display = "none";
6801
+ const c = (u = p.parentElement) == null ? void 0 : u.querySelector(".signature-fallback");
6802
+ c && c.classList.remove("hidden");
6803
+ }}
6804
+ />
6805
+ <div class="signature-fallback hidden">
6806
+ <span class="signature-error">Unable to display signature</span>
6807
+ </div>
6808
+ </div>
6809
+ ` : l`
6810
+ <div class="signature-view-only">
6811
+ <span class="no-signature">No signature captured</span>
6812
+ </div>
6813
+ `;
6814
+ if (i.mode === "admin" && r && typeof r == "string" && !o) {
6779
6815
  const d = r.trim().startsWith("<svg");
6780
6816
  return l`
6781
6817
  <div class="signature-admin-display">
@@ -6822,7 +6858,7 @@ class D {
6822
6858
  >
6823
6859
  Clear
6824
6860
  </button>
6825
- ${n && !o ? l`
6861
+ ${n && !a ? l`
6826
6862
  <button
6827
6863
  type="button"
6828
6864
  class="signature-save-btn"
@@ -6832,8 +6868,8 @@ class D {
6832
6868
  Save
6833
6869
  </button>
6834
6870
  ` : ""}
6835
- ${o ? l` <span class="signature-saved">✓ Saved</span> ` : ""}
6836
- ${i.mode === "admin" && a ? l`
6871
+ ${a ? l` <span class="signature-saved">✓ Saved</span> ` : ""}
6872
+ ${i.mode === "admin" && o ? l`
6837
6873
  <button
6838
6874
  type="button"
6839
6875
  class="signature-cancel-btn"
@@ -6850,9 +6886,9 @@ class D {
6850
6886
  const r = i.formData[e.id];
6851
6887
  if (i.mode === "view-only" || i.mode === "print")
6852
6888
  if (r) {
6853
- const n = typeof r == "string", o = typeof r == "object" && r.name;
6889
+ const n = typeof r == "string", a = typeof r == "object" && r.name;
6854
6890
  if (i.mode === "print") {
6855
- if (o)
6891
+ if (a)
6856
6892
  return l`
6857
6893
  <div class="print-response-value file-response">
6858
6894
  📎 ${r.name}
@@ -6862,16 +6898,16 @@ class D {
6862
6898
  </div>
6863
6899
  `;
6864
6900
  if (n) {
6865
- const a = D._extractFilenameFromUrl(r);
6866
- return l` <div class="print-response-value file-response">📎 ${a}</div> `;
6901
+ const o = D._extractFilenameFromUrl(r);
6902
+ return l` <div class="print-response-value file-response">📎 ${o}</div> `;
6867
6903
  } else
6868
6904
  return l` <div class="print-response-value file-response">📎 ${r}</div> `;
6869
6905
  } else {
6870
- const a = n ? r : "#", d = o ? r.name : n ? D._extractFilenameFromUrl(r) : "View File";
6906
+ const o = n ? r : "#", d = a ? r.name : n ? D._extractFilenameFromUrl(r) : "View File";
6871
6907
  return l`
6872
6908
  <div class="file-upload-view-only">
6873
- <a href="${a}" target="_blank" class="file-link"> 📎 ${d} </a>
6874
- ${o && r.size ? l`
6909
+ <a href="${o}" target="_blank" class="file-link"> 📎 ${d} </a>
6910
+ ${a && r.size ? l`
6875
6911
  <span class="file-size-info"
6876
6912
  >(${D._formatFileSize(r.size)})</span
6877
6913
  >
@@ -6952,16 +6988,16 @@ class D {
6952
6988
  default:
6953
6989
  return D.renderDefaultInput(e, i, t);
6954
6990
  }
6955
- }, o = e.type === "checkbox" && (!e.options || e.options.length === 0);
6991
+ }, a = e.type === "checkbox" && (!e.options || e.options.length === 0);
6956
6992
  return t.mode === "print" ? l`
6957
6993
  <div class="question-print">
6958
- ${o ? "" : l` <div class="print-question-title">${e.label}:</div> `}
6994
+ ${a ? "" : l` <div class="print-question-title">${e.label}:</div> `}
6959
6995
  ${n()}
6960
6996
  <hr class="print-question-separator" />
6961
6997
  </div>
6962
6998
  ` : l`
6963
6999
  <div class="question ${r ? "error" : ""}">
6964
- ${o ? "" : l`
7000
+ ${a ? "" : l`
6965
7001
  <div class="runner-question-title">
6966
7002
  ${e.label}${e.required ? l`<span class="runner-question-required">*</span>` : ""}
6967
7003
  </div>
@@ -7125,15 +7161,15 @@ class le {
7125
7161
  <nav aria-label="Workflow steps">
7126
7162
  <div class="runner-mobile-steps-container">
7127
7163
  ${t == null ? void 0 : t.map((r) => {
7128
- const n = e.isStepAssignedToUser(r), o = e.completedSteps.has(r.id);
7164
+ const n = e.isStepAssignedToUser(r), a = e.completedSteps.has(r.id);
7129
7165
  return l`
7130
7166
  <div
7131
- class="runner-mobile-step-tab ${o ? "completed" : ""} ${n ? "" : "unassigned"} ${i ? "disabled" : ""}"
7167
+ class="runner-mobile-step-tab ${a ? "completed" : ""} ${n ? "" : "unassigned"} ${i ? "disabled" : ""}"
7132
7168
  style="cursor: not-allowed; opacity: ${i ? "0.6" : n ? "1" : "0.6"};"
7133
7169
  >
7134
7170
  <span class="runner-mobile-step-title">${r.title}</span>
7135
7171
  <span class="runner-mobile-step-badge">
7136
- ${o ? "Completed" : n ? "Your Step" : "Other User"}
7172
+ ${a ? "Completed" : n ? "Your Step" : "Other User"}
7137
7173
  </span>
7138
7174
  </div>
7139
7175
  `;
@@ -7170,7 +7206,7 @@ class le {
7170
7206
  `;
7171
7207
  }
7172
7208
  static renderSubmissionErrorView(e) {
7173
- var r, n, o;
7209
+ var r, n, a;
7174
7210
  const { submissionError: t, onRetry: i } = e;
7175
7211
  return l`
7176
7212
  <div class="runner-layout">
@@ -7187,14 +7223,14 @@ class le {
7187
7223
  <div class="runner-sidebar-header">Steps</div>
7188
7224
  <nav aria-label="Workflow steps">
7189
7225
  <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);
7226
+ ${(a = (n = e.instance) == null ? void 0 : n.steps) == null ? void 0 : a.map((o) => {
7227
+ const d = e.isStepAssignedToUser(o), p = e.completedSteps.has(o.id);
7192
7228
  return l`
7193
7229
  <li
7194
7230
  class="runner-step-item ${p ? "completed" : ""} ${d ? "" : "unassigned"}"
7195
7231
  style="opacity: ${d ? "1" : "0.6"}; cursor: not-allowed;"
7196
7232
  >
7197
- <span class="runner-step-title">${a.title}</span>
7233
+ <span class="runner-step-title">${o.title}</span>
7198
7234
  <span class="runner-step-badge ${!p && d ? "error" : ""}">
7199
7235
  ${p ? "Submitted" : d ? "Failed" : "Other User"}
7200
7236
  </span>
@@ -7252,15 +7288,15 @@ class le {
7252
7288
  <nav aria-label="Workflow steps">
7253
7289
  <ul class="runner-steps-list">
7254
7290
  ${(r = (i = e.instance) == null ? void 0 : i.steps) == null ? void 0 : r.map((n) => {
7255
- const o = e.isStepAssignedToUser(n), a = e.completedSteps.has(n.id);
7291
+ const a = e.isStepAssignedToUser(n), o = e.completedSteps.has(n.id);
7256
7292
  return l`
7257
7293
  <li
7258
- class="runner-step-item ${a ? "completed" : ""} ${o ? "" : "unassigned"}"
7259
- style="opacity: ${o ? "1" : "0.6"}; cursor: not-allowed;"
7294
+ class="runner-step-item ${o ? "completed" : ""} ${a ? "" : "unassigned"}"
7295
+ style="opacity: ${a ? "1" : "0.6"}; cursor: not-allowed;"
7260
7296
  >
7261
7297
  <span class="runner-step-title">${n.title}</span>
7262
7298
  <span class="runner-step-badge">
7263
- ${a ? "Submitted" : o ? "Your Step" : "Other User"}
7299
+ ${o ? "Submitted" : a ? "Your Step" : "Other User"}
7264
7300
  </span>
7265
7301
  </li>
7266
7302
  `;
@@ -7312,16 +7348,16 @@ class j {
7312
7348
  <nav aria-label="Workflow steps">
7313
7349
  <ul class="runner-steps-list">
7314
7350
  ${t == null ? void 0 : t.map((i, r) => {
7315
- const n = e.mode === "preview" || e.mode === "admin" || e.mode === "view-only" || e.mode === "print" || e.isStepAssignedToUser(i), o = r === e.currentStepIndex, a = this.isStepCompleted(i, e, n), d = (e.isSubmitted || e.userStepsSubmitted) && e.mode !== "preview" && e.mode !== "admin" && e.mode !== "view-only" && e.mode !== "print", p = e.isLoading;
7351
+ const n = e.mode === "preview" || e.mode === "admin" || e.mode === "view-only" || e.mode === "print" || e.isStepAssignedToUser(i), a = r === e.currentStepIndex, o = this.isStepCompleted(i, e, n), d = (e.isSubmitted || e.userStepsSubmitted) && e.mode !== "preview" && e.mode !== "admin" && e.mode !== "view-only" && e.mode !== "print", p = e.isLoading;
7316
7352
  return l`
7317
7353
  <li
7318
- class="runner-step-item ${o ? "active" : ""} ${a ? "completed" : ""} ${n ? "" : "unassigned"} ${d ? "disabled" : ""} ${p ? "loading-disabled" : ""}"
7354
+ class="runner-step-item ${a ? "active" : ""} ${o ? "completed" : ""} ${n ? "" : "unassigned"} ${d ? "disabled" : ""} ${p ? "loading-disabled" : ""}"
7319
7355
  @click=${() => !p && e.goToStep(r)}
7320
7356
  style="${d ? "opacity: 0.5; cursor: not-allowed;" : ""}"
7321
7357
  >
7322
7358
  <span class="runner-step-title">${i.title}</span>
7323
7359
  <span class="runner-step-badge">
7324
- ${e.mode === "preview" ? "Preview" : e.mode === "admin" ? "Admin" : e.mode === "view-only" ? "View Only" : e.mode === "print" ? "Print" : d ? "Submitted" : a ? "Completed" : n ? "Assigned" : "Not Assigned"}
7360
+ ${e.mode === "preview" ? "Preview" : e.mode === "admin" ? "Admin" : e.mode === "view-only" ? "View Only" : e.mode === "print" ? "Print" : d ? "Submitted" : o ? "Completed" : n ? "Assigned" : "Not Assigned"}
7325
7361
  </span>
7326
7362
  </li>
7327
7363
  `;
@@ -7338,17 +7374,17 @@ class j {
7338
7374
  <nav aria-label="Workflow steps">
7339
7375
  <div class="runner-mobile-steps-container">
7340
7376
  ${t == null ? void 0 : t.map((i, r) => {
7341
- const n = e.mode === "preview" || e.mode === "admin" || e.mode === "view-only" || e.mode === "print" || e.isStepAssignedToUser(i), o = r === e.currentStepIndex, a = this.isStepCompleted(i, e, n), d = (e.isSubmitted || e.userStepsSubmitted) && e.mode !== "preview" && e.mode !== "admin" && e.mode !== "view-only" && e.mode !== "print", p = e.isLoading;
7377
+ const n = e.mode === "preview" || e.mode === "admin" || e.mode === "view-only" || e.mode === "print" || e.isStepAssignedToUser(i), a = r === e.currentStepIndex, o = this.isStepCompleted(i, e, n), d = (e.isSubmitted || e.userStepsSubmitted) && e.mode !== "preview" && e.mode !== "admin" && e.mode !== "view-only" && e.mode !== "print", p = e.isLoading;
7342
7378
  return l`
7343
7379
  <button
7344
- class="runner-mobile-step-tab ${o ? "active" : ""} ${a ? "completed" : ""} ${n ? "" : "unassigned"} ${d ? "disabled" : ""} ${p ? "loading-disabled" : ""}"
7380
+ class="runner-mobile-step-tab ${a ? "active" : ""} ${o ? "completed" : ""} ${n ? "" : "unassigned"} ${d ? "disabled" : ""} ${p ? "loading-disabled" : ""}"
7345
7381
  @click=${() => !p && e.goToStep(r)}
7346
7382
  ?disabled=${d || p}
7347
- aria-current=${o ? "step" : "false"}
7383
+ aria-current=${a ? "step" : "false"}
7348
7384
  >
7349
7385
  <span class="runner-mobile-step-title">${i.title}</span>
7350
7386
  <span class="runner-mobile-step-badge">
7351
- ${e.mode === "preview" ? "Preview" : e.mode === "admin" ? "Admin" : e.mode === "view-only" ? "View Only" : e.mode === "print" ? "Print" : d ? "Submitted" : a ? "Completed" : n ? "Assigned" : "Not Assigned"}
7387
+ ${e.mode === "preview" ? "Preview" : e.mode === "admin" ? "Admin" : e.mode === "view-only" ? "View Only" : e.mode === "print" ? "Print" : d ? "Submitted" : o ? "Completed" : n ? "Assigned" : "Not Assigned"}
7352
7388
  </span>
7353
7389
  </button>
7354
7390
  `;
@@ -7394,30 +7430,30 @@ class pe {
7394
7430
  /**
7395
7431
  * Handles change events for basic text inputs, textareas, selects, numbers, dates
7396
7432
  */
7397
- static handleInputChange(e, t, i, r, n, o) {
7398
- const a = t.target;
7433
+ static handleInputChange(e, t, i, r, n, a) {
7434
+ const o = t.target;
7399
7435
  let d;
7400
- a.type === "radio" ? d = a.value : a.type === "checkbox" ? d = a.checked : d = a.value;
7436
+ o.type === "radio" ? d = o.value : o.type === "checkbox" ? d = o.checked : d = o.value;
7401
7437
  const p = {
7402
7438
  ...i,
7403
7439
  [e]: d
7404
7440
  };
7405
- r(p), o !== "preview" && n(e, d);
7441
+ r(p), a !== "preview" && n(e, d);
7406
7442
  }
7407
7443
  /**
7408
7444
  * Handles change events for single checkboxes
7409
7445
  */
7410
- static handleCheckboxChange(e, t, i, r, n, o) {
7446
+ static handleCheckboxChange(e, t, i, r, n, a) {
7411
7447
  const d = t.target.checked, p = {
7412
7448
  ...i,
7413
7449
  [e]: d
7414
7450
  };
7415
- r(p), o !== "preview" && n(e, d);
7451
+ r(p), a !== "preview" && n(e, d);
7416
7452
  }
7417
7453
  /**
7418
7454
  * Handles change events for checkbox groups (multiple checkboxes with same name)
7419
7455
  */
7420
- static handleCheckboxGroupChange(e, t, i, r, n, o, a) {
7456
+ static handleCheckboxGroupChange(e, t, i, r, n, a, o) {
7421
7457
  const d = i.target, p = r[e];
7422
7458
  let c = Array.isArray(p) ? [...p] : [];
7423
7459
  d.checked ? c.includes(t) || c.push(t) : c = c.filter((h) => h !== t);
@@ -7425,12 +7461,12 @@ class pe {
7425
7461
  ...r,
7426
7462
  [e]: c
7427
7463
  };
7428
- n(u), a !== "preview" && o(e, c);
7464
+ n(u), o !== "preview" && a(e, c);
7429
7465
  }
7430
7466
  }
7431
7467
  var Ct = Object.defineProperty, At = Object.getOwnPropertyDescriptor, y = (s, e, t, i) => {
7432
- for (var r = i > 1 ? void 0 : i ? At(e, t) : e, n = s.length - 1, o; n >= 0; n--)
7433
- (o = s[n]) && (r = (i ? o(e, t, r) : o(r)) || r);
7468
+ for (var r = i > 1 ? void 0 : i ? At(e, t) : e, n = s.length - 1, a; n >= 0; n--)
7469
+ (a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
7434
7470
  return i && r && Ct(e, t, r), r;
7435
7471
  };
7436
7472
  let f = class extends N {
@@ -7519,8 +7555,8 @@ let f = class extends N {
7519
7555
  if ((s = this.formStateManager) == null || s.reset(), this._validationErrors = {}, this._formData = {}, this._formRestorationComplete = !1, this._savedSignatures = /* @__PURE__ */ new Set(), this._replacingSignatures = /* @__PURE__ */ new Set(), this._savedInstance = void 0, this._justSaved = !1, this._isSubmitted = ((e = this.instance) == null ? void 0 : e.status) === "completed" || !1, this.instance && this.instance.status !== "completed") {
7520
7556
  const i = this._getAssignedSteps(), r = i.filter(
7521
7557
  (n) => {
7522
- var o;
7523
- return (o = this.instance.completedSteps) == null ? void 0 : o.includes(n.id);
7558
+ var a;
7559
+ return (a = this.instance.completedSteps) == null ? void 0 : a.includes(n.id);
7524
7560
  }
7525
7561
  );
7526
7562
  this._userStepsSubmitted = i.length > 0 && r.length === i.length;
@@ -7540,7 +7576,7 @@ let f = class extends N {
7540
7576
  var s;
7541
7577
  !((s = this.instance) != null && s.steps) || this.instance.steps.length === 0 || (this.instance.completedSteps ? this._internalCompletedSteps = new Set(this.instance.completedSteps) : this._internalCompletedSteps = new Set(
7542
7578
  this.instance.steps.filter((e) => e.status === "completed").map((e) => e.id)
7543
- ), this.formStateManager.initializeFromResponses(this.instance.steps), this._formData = this.formStateManager.getFormData(), this._currentStepIndex = this.instance.steps.findIndex(
7579
+ ), this.formStateManager.initializeFromResponses(this.instance.steps), this._formData = this.formStateManager.getFormData(), this._markExistingSignaturesAsSaved(), this._currentStepIndex = this.instance.steps.findIndex(
7544
7580
  (e) => {
7545
7581
  var t;
7546
7582
  return e.id === ((t = this.instance) == null ? void 0 : t.currentStepId);
@@ -7551,19 +7587,30 @@ let f = class extends N {
7551
7587
  }
7552
7588
  _initializeViewOnlyMode() {
7553
7589
  var s;
7554
- !((s = this.instance) != null && s.steps) || this.instance.steps.length === 0 || (this.formStateManager.initializeFromResponses(this.instance.steps), this._formData = this.formStateManager.getFormData(), this._currentStepIndex = 0, this.instance.steps.forEach((e) => {
7590
+ !((s = this.instance) != null && s.steps) || this.instance.steps.length === 0 || (this.formStateManager.initializeFromResponses(this.instance.steps), this._formData = this.formStateManager.getFormData(), this._markExistingSignaturesAsSaved(), this._currentStepIndex = 0, this.instance.steps.forEach((e) => {
7555
7591
  e.responses && e.responses.length > 0 ? (e.status = "completed", this._internalCompletedSteps.add(e.id)) : e.status = "pending";
7556
7592
  }), console.log("View-only mode initialized with existing responses:", this._formData));
7557
7593
  }
7558
7594
  _initializePrintMode() {
7559
7595
  var s;
7560
- !((s = this.instance) != null && s.steps) || this.instance.steps.length === 0 || (this.formStateManager.initializeFromResponses(this.instance.steps), this._formData = this.formStateManager.getFormData(), this._currentStepIndex = 0, this.instance.steps.forEach((e) => {
7596
+ !((s = this.instance) != null && s.steps) || this.instance.steps.length === 0 || (this.formStateManager.initializeFromResponses(this.instance.steps), this._formData = this.formStateManager.getFormData(), this._markExistingSignaturesAsSaved(), this._currentStepIndex = 0, this.instance.steps.forEach((e) => {
7561
7597
  e.responses && e.responses.length > 0 ? (e.status = "completed", this._internalCompletedSteps.add(e.id)) : e.status = "pending";
7562
7598
  }), console.log("Print mode initialized with existing responses:", this._formData));
7563
7599
  }
7564
7600
  _isStepAssignedToUser(s) {
7565
7601
  return this.navigationService.isStepAssignedToUser(s);
7566
7602
  }
7603
+ _markExistingSignaturesAsSaved() {
7604
+ var s;
7605
+ (s = this.instance) != null && s.steps && this.instance.steps.forEach((e) => {
7606
+ e.elements.forEach((t) => {
7607
+ if (t.type === "signature") {
7608
+ const i = t.id;
7609
+ this._formData[i] && this._savedSignatures.add(i);
7610
+ }
7611
+ });
7612
+ });
7613
+ }
7567
7614
  _getAssignedSteps() {
7568
7615
  return this.instance ? this.navigationService.getAssignedSteps(this.instance) : [];
7569
7616
  }
@@ -7642,7 +7689,7 @@ let f = class extends N {
7642
7689
  if (!e) return;
7643
7690
  const t = this._hasSignatureChanged(s, e.svgData);
7644
7691
  this._savedSignatures = /* @__PURE__ */ new Set([...this._savedSignatures, s]), this._replacingSignatures.has(s) && (this._replacingSignatures = new Set(
7645
- [...this._replacingSignatures].filter((o) => o !== s)
7692
+ [...this._replacingSignatures].filter((a) => a !== s)
7646
7693
  )), this._trackQuestionResponse(s, e.svgData), t && this.mode !== "preview" ? (console.log("Signature changed, calling callback for:", s), console.log("Callback function exists:", !!this.onSignatureCaptured), (n = this.onSignatureCaptured) == null || n.call(this, {
7647
7694
  instanceId: (i = this.instance) == null ? void 0 : i.id,
7648
7695
  stepId: (r = this._currentStep) == null ? void 0 : r.id,
@@ -7738,15 +7785,25 @@ let f = class extends N {
7738
7785
  const s = this._currentStep;
7739
7786
  s && this._captureSignaturesFromStep(s);
7740
7787
  const e = this._findNextAssignedStep(this._currentStepIndex);
7788
+ if (e === -1) {
7789
+ await this._submitUserSteps();
7790
+ return;
7791
+ }
7792
+ if (e > this._currentStepIndex + 1) {
7793
+ console.log(
7794
+ `Next assigned step (${e}) is not consecutive. Steps in between are assigned to other users.`
7795
+ ), await this._submitUserSteps();
7796
+ return;
7797
+ }
7741
7798
  if (e !== -1) {
7742
- const o = (t = this._currentStep) == null ? void 0 : t.id;
7743
- if (this._currentStepIndex = e, (await this._updateInstanceData(o, "step_navigation", {
7799
+ const a = (t = this._currentStep) == null ? void 0 : t.id;
7800
+ if (this._currentStepIndex = e, (await this._updateInstanceData(a, "step_navigation", {
7744
7801
  direction: "next",
7745
7802
  fromStepIndex: this._currentStepIndex - 1,
7746
7803
  toStepIndex: this._currentStepIndex,
7747
- completedStepId: o
7748
- })).success && o && (i = this.instance) != null && i.steps) {
7749
- const p = this.instance.steps.find((c) => c.id === o);
7804
+ completedStepId: a
7805
+ })).success && a && (i = this.instance) != null && i.steps) {
7806
+ const p = this.instance.steps.find((c) => c.id === a);
7750
7807
  p && (p.status = "completed");
7751
7808
  }
7752
7809
  const d = (n = (r = this.instance) == null ? void 0 : r.steps) == null ? void 0 : n[this._currentStepIndex];
@@ -7850,10 +7907,10 @@ let f = class extends N {
7850
7907
  const S = Array.from(this._internalCompletedSteps), Y = S[S.length - 1];
7851
7908
  i = (u = (c = this.instance) == null ? void 0 : c.steps) == null ? void 0 : u.find((q) => q.id === Y);
7852
7909
  }
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 ? {
7910
+ const r = e === "submission", n = ((h = this.instance) == null ? void 0 : h.steps) && this._internalCompletedSteps.size >= this.instance.steps.length, a = r || n ? null : this._currentStep ? {
7854
7911
  id: this._currentStep.id,
7855
7912
  title: this._currentStep.title
7856
- } : null, a = {
7913
+ } : null, o = {
7857
7914
  instanceId: (g = this.instance) == null ? void 0 : g.id,
7858
7915
  workflowId: (x = this.instance) == null ? void 0 : x.workflowId,
7859
7916
  completedStepId: s || (i ? i.id : void 0),
@@ -7863,13 +7920,13 @@ let f = class extends N {
7863
7920
  responses: i.responses || []
7864
7921
  } : void 0,
7865
7922
  completedSteps: Array.from(this._internalCompletedSteps),
7866
- currentStep: o,
7923
+ currentStep: a,
7867
7924
  mode: this.mode
7868
7925
  };
7869
7926
  if (this.onInstanceUpdated)
7870
7927
  try {
7871
7928
  this._submissionError = null, this.requestUpdate();
7872
- const S = await this.onInstanceUpdated(a);
7929
+ const S = await this.onInstanceUpdated(o);
7873
7930
  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
7931
  } catch (S) {
7875
7932
  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 };
@@ -7900,19 +7957,19 @@ let f = class extends N {
7900
7957
  this.updateComplete.then(() => {
7901
7958
  var e, t;
7902
7959
  (e = this.shadowRoot) != null && e.querySelector(".runner-step-form") && (Object.entries(this._formData).forEach(([i, r]) => {
7903
- var o;
7960
+ var a;
7904
7961
  if (i.endsWith("_signatureData")) return;
7905
- const n = (o = this.shadowRoot) == null ? void 0 : o.getElementById(i);
7962
+ const n = (a = this.shadowRoot) == null ? void 0 : a.getElementById(i);
7906
7963
  if (n) {
7907
7964
  if (n.type === "checkbox") {
7908
- const a = n;
7909
- typeof r == "boolean" ? a.checked = r : Array.isArray(r) && (a.checked = r.includes(a.value));
7965
+ const o = n;
7966
+ typeof r == "boolean" ? o.checked = r : Array.isArray(r) && (o.checked = r.includes(o.value));
7910
7967
  } else if (n.type === "radio") {
7911
- const a = n;
7912
- a.checked = a.value === r;
7968
+ const o = n;
7969
+ o.checked = o.value === r;
7913
7970
  } else if (n.type === "file") {
7914
- const a = n;
7915
- a.value = "";
7971
+ const o = n;
7972
+ o.value = "";
7916
7973
  } else
7917
7974
  n.value = String(r || "");
7918
7975
  console.log(`Restored value for ${i}:`, r);
@@ -7926,7 +7983,7 @@ let f = class extends N {
7926
7983
  if (t.type === "text_input" || t.type === "textarea" || t.type === "select" || t.type === "number" || t.type === "radio" || t.type === "checkbox" || t.type === "date" || t.type === "file_upload" || t.type === "signature") {
7927
7984
  const i = t, r = this._formData[i.id];
7928
7985
  if (r !== void 0 && e.responses) {
7929
- let n = e.responses.find((o) => o.elementId === i.id);
7986
+ let n = e.responses.find((a) => a.elementId === i.id);
7930
7987
  n ? (n.value = r, n.answeredAt = /* @__PURE__ */ new Date()) : (n = {
7931
7988
  elementId: i.id,
7932
7989
  value: r,
@@ -7968,15 +8025,15 @@ let f = class extends N {
7968
8025
  for (let r = 0; r < t.length; r++) {
7969
8026
  const n = t[r];
7970
8027
  if (n.name || n.id) {
7971
- const o = n.id || n.name;
8028
+ const a = n.id || n.name;
7972
8029
  if (n.type === "checkbox") {
7973
- const a = n;
7974
- a.name && a.name === o ? (s[o] || (s[o] = []), a.checked && s[o].push(a.value)) : s[o] = a.checked;
8030
+ const o = n;
8031
+ o.name && o.name === a ? (s[a] || (s[a] = []), o.checked && s[a].push(o.value)) : s[a] = o.checked;
7975
8032
  } else if (n.type === "radio") {
7976
- const a = n;
7977
- a.checked && (s[o] = a.value);
8033
+ const o = n;
8034
+ o.checked && (s[a] = o.value);
7978
8035
  } else
7979
- s[o] = n.value;
8036
+ s[a] = n.value;
7980
8037
  }
7981
8038
  }
7982
8039
  return s;
@@ -7986,14 +8043,14 @@ let f = class extends N {
7986
8043
  Object.keys(e).length > 0 ? (this.formStateManager.mergeFormData(e), this._formData = this.formStateManager.getFormData(), this.instance && this.instance.steps && this.instance.steps.forEach((i) => {
7987
8044
  i.responses || (i.responses = []), i.elements.forEach((r) => {
7988
8045
  if (r.type === "text_input" || r.type === "textarea" || r.type === "select" || r.type === "number" || r.type === "radio" || r.type === "checkbox" || r.type === "date" || r.type === "file_upload" || r.type === "signature") {
7989
- const n = r, o = this._formData[n.id];
7990
- if (o !== void 0 && i.responses) {
7991
- let a = i.responses.find((d) => d.elementId === n.id);
7992
- a ? (a.value = o, a.answeredAt = /* @__PURE__ */ new Date()) : (a = {
8046
+ const n = r, a = this._formData[n.id];
8047
+ if (a !== void 0 && i.responses) {
8048
+ let o = i.responses.find((d) => d.elementId === n.id);
8049
+ o ? (o.value = a, o.answeredAt = /* @__PURE__ */ new Date()) : (o = {
7993
8050
  elementId: n.id,
7994
- value: o,
8051
+ value: a,
7995
8052
  answeredAt: /* @__PURE__ */ new Date()
7996
- }, i.responses.push(a));
8053
+ }, i.responses.push(o));
7997
8054
  }
7998
8055
  }
7999
8056
  });
@@ -8167,8 +8224,8 @@ let f = class extends N {
8167
8224
  mode: this.mode
8168
8225
  })}
8169
8226
  </div>`}
8170
- <form class="runner-step-form" @submit=${(o) => o.preventDefault()}>
8171
- ${s.elements.map((o) => this._renderStepElement(o))}
8227
+ <form class="runner-step-form" @submit=${(a) => a.preventDefault()}>
8228
+ ${s.elements.map((a) => this._renderStepElement(a))}
8172
8229
  ${Dt.renderFormActions({
8173
8230
  mode: this.mode || "default",
8174
8231
  isLastStep: e,
@@ -8309,7 +8366,7 @@ function Jt(s, e = {}) {
8309
8366
  includeStyles: i = !0,
8310
8367
  customCSS: r = "",
8311
8368
  showTimestamps: n = !1
8312
- } = e, o = /* @__PURE__ */ new Date();
8369
+ } = e, a = /* @__PURE__ */ new Date();
8313
8370
  if (!(s != null && s.steps) || s.steps.length === 0)
8314
8371
  throw new Error("Instance must have at least one step to generate HTML");
8315
8372
  return {
@@ -8330,14 +8387,14 @@ function Jt(s, e = {}) {
8330
8387
  </div>
8331
8388
  <hr class="print-question-separator" />
8332
8389
 
8333
- ${n ? Wt(s, o) : ""}
8390
+ ${n ? Wt(s, a) : ""}
8334
8391
  ${s.steps.map((d) => Et(d)).join(`
8335
8392
  `)}
8336
8393
  </div>
8337
8394
  </body>
8338
8395
  </html>`,
8339
8396
  title: t,
8340
- generatedAt: o
8397
+ generatedAt: a
8341
8398
  };
8342
8399
  }
8343
8400
  function Et(s) {
@@ -8369,30 +8426,30 @@ function Ft(s, e) {
8369
8426
  <div class="print-question-title">
8370
8427
  ${m(s.label)}:
8371
8428
  </div>
8372
- `, o = '<hr class="print-question-separator" />';
8429
+ `, a = '<hr class="print-question-separator" />';
8373
8430
  switch (s.type) {
8374
8431
  case "text_input":
8375
8432
  case "number":
8376
8433
  case "date":
8377
- return n + It(s, i) + o;
8434
+ return n + It(s, i) + a;
8378
8435
  case "textarea":
8379
- return n + Ut(s, i) + o;
8436
+ return n + Ut(s, i) + a;
8380
8437
  case "select":
8381
- return n + Pt(s, i) + o;
8438
+ return n + Pt(s, i) + a;
8382
8439
  case "radio":
8383
- return n + Nt(s, i) + o;
8440
+ return n + Nt(s, i) + a;
8384
8441
  case "checkbox":
8385
- return n + Lt(s, i) + o;
8442
+ return n + Lt(s, i) + a;
8386
8443
  case "file_upload":
8387
- return n + Ot(s, i) + o;
8444
+ return n + Ot(s, i) + a;
8388
8445
  case "signature":
8389
- return n + Rt(s, i) + o;
8446
+ return n + Rt(s, i) + a;
8390
8447
  default:
8391
8448
  return n + `
8392
8449
  <div class="unknown-element">
8393
8450
  <p>⚠️ Unknown question type: ${m(s.type)}</p>
8394
8451
  </div>
8395
- ` + o;
8452
+ ` + a;
8396
8453
  }
8397
8454
  }
8398
8455
  function zt(s) {
@@ -9154,7 +9211,6 @@ function Gt() {
9154
9211
  `;
9155
9212
  }
9156
9213
  function Xt(s, e = {}) {
9157
- var r;
9158
9214
  if (!customElements.get("builder-widget"))
9159
9215
  return console.error("Error: <builder-widget> is not defined. Make sure it was imported."), null;
9160
9216
  const t = document.getElementById(s);
@@ -9162,7 +9218,7 @@ function Xt(s, e = {}) {
9162
9218
  return console.error(`Error: Target element with ID '${s}' not found.`), null;
9163
9219
  t.innerHTML = "";
9164
9220
  const i = document.createElement("builder-widget");
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;
9221
+ 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), 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;
9166
9222
  }
9167
9223
  function Zt(s, e) {
9168
9224
  if (!customElements.get("runner-widget"))
@@ -9190,14 +9246,14 @@ function ei(s, e) {
9190
9246
  return i.steps && i.steps.forEach((r) => {
9191
9247
  r.responses || (r.responses = []), r.elements.forEach((n) => {
9192
9248
  if (n.type === "text_input" || n.type === "textarea" || n.type === "select" || n.type === "number" || n.type === "radio" || n.type === "checkbox" || n.type === "date" || n.type === "file_upload" || n.type === "signature") {
9193
- const o = t[n.id];
9194
- if (o !== void 0) {
9195
- let a = r.responses.find((d) => d.elementId === n.id);
9196
- a ? (a.value = o, a.answeredAt = /* @__PURE__ */ new Date()) : (a = {
9249
+ const a = t[n.id];
9250
+ if (a !== void 0) {
9251
+ let o = r.responses.find((d) => d.elementId === n.id);
9252
+ o ? (o.value = a, o.answeredAt = /* @__PURE__ */ new Date()) : (o = {
9197
9253
  elementId: n.id,
9198
- value: o,
9254
+ value: a,
9199
9255
  answeredAt: /* @__PURE__ */ new Date()
9200
- }, r.responses.push(a));
9256
+ }, r.responses.push(o));
9201
9257
  }
9202
9258
  }
9203
9259
  });