drill-widgets 2.7.19 → 2.7.22

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 {
@@ -4016,15 +4016,15 @@ let v = class extends N {
4016
4016
  }
4017
4017
  _duplicateStep(s) {
4018
4018
  var r, n;
4019
- const e = (r = this._templateData.steps) == null ? void 0 : r.find((o) => o.id === s);
4019
+ const e = (r = this._templateData.steps) == null ? void 0 : r.find((a) => a.id === s);
4020
4020
  if (!e) return;
4021
4021
  const t = this._templateData.steps || [], i = {
4022
4022
  ...e,
4023
4023
  id: A(),
4024
4024
  title: `${e.title} (Copy)`,
4025
4025
  order: t.length + 1,
4026
- elements: ((n = e.elements) == null ? void 0 : n.map((o) => ({
4027
- ...o,
4026
+ elements: ((n = e.elements) == null ? void 0 : n.map((a) => ({
4027
+ ...a,
4028
4028
  id: A()
4029
4029
  }))) || []
4030
4030
  };
@@ -4054,11 +4054,11 @@ let v = class extends N {
4054
4054
  };
4055
4055
  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
4056
  const r = s.map((n) => {
4057
- var o;
4057
+ var a;
4058
4058
  return n.id === this._editingStepId ? {
4059
4059
  ...n,
4060
4060
  title: this._stepFormData.title.trim(),
4061
- description: ((o = this._stepFormData.description) == null ? void 0 : o.trim()) || "",
4061
+ description: ((a = this._stepFormData.description) == null ? void 0 : a.trim()) || "",
4062
4062
  assignment: e
4063
4063
  } : n;
4064
4064
  });
@@ -4109,21 +4109,21 @@ let v = class extends N {
4109
4109
  this._draggedStepId = null, this._dragOverStepId = null;
4110
4110
  return;
4111
4111
  }
4112
- const t = this._templateData.steps || [], i = t.findIndex((a) => a.id === this._draggedStepId), r = t.findIndex((a) => a.id === e);
4112
+ const t = this._templateData.steps || [], i = t.findIndex((o) => o.id === this._draggedStepId), r = t.findIndex((o) => o.id === e);
4113
4113
  if (i === -1 || r === -1) {
4114
4114
  console.error("Could not find step indices for reordering");
4115
4115
  return;
4116
4116
  }
4117
4117
  console.log(
4118
4118
  "🔄 Before reorder:",
4119
- t.map((a, d) => `${d + 1}: ${a.title}`)
4119
+ t.map((o, d) => `${d + 1}: ${o.title}`)
4120
4120
  );
4121
- const n = [...t], [o] = n.splice(i, 1);
4122
- n.splice(r, 0, o), n.forEach((a, d) => {
4123
- a.order = d + 1;
4121
+ const n = [...t], [a] = n.splice(i, 1);
4122
+ n.splice(r, 0, a), n.forEach((o, d) => {
4123
+ o.order = d + 1;
4124
4124
  }), console.log(
4125
4125
  "🔄 After reorder:",
4126
- n.map((a, d) => `${d + 1}: ${a.title}`)
4126
+ n.map((o, d) => `${d + 1}: ${o.title}`)
4127
4127
  ), this._templateData = {
4128
4128
  ...this._templateData,
4129
4129
  steps: n
@@ -4168,13 +4168,13 @@ let v = class extends N {
4168
4168
  Use **bold** and *italic* text.`;
4169
4169
  break;
4170
4170
  }
4171
- const o = this._templateData.steps.map((a) => a.id === this._selectedStepId ? {
4172
- ...a,
4173
- elements: [...a.elements || [], n]
4174
- } : a);
4171
+ const a = this._templateData.steps.map((o) => o.id === this._selectedStepId ? {
4172
+ ...o,
4173
+ elements: [...o.elements || [], n]
4174
+ } : o);
4175
4175
  this._templateData = {
4176
4176
  ...this._templateData,
4177
- steps: o
4177
+ steps: a
4178
4178
  }, console.log("✅ Content element added to step:", this._selectedStepId);
4179
4179
  } else {
4180
4180
  const n = {
@@ -4187,13 +4187,13 @@ Use **bold** and *italic* text.`;
4187
4187
  required: !1
4188
4188
  };
4189
4189
  ["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);
4190
+ const a = this._templateData.steps.map((o) => o.id === this._selectedStepId ? {
4191
+ ...o,
4192
+ elements: [...o.elements || [], n]
4193
+ } : o);
4194
4194
  this._templateData = {
4195
4195
  ...this._templateData,
4196
- steps: o
4196
+ steps: a
4197
4197
  }, console.log("✅ Question added to step:", this._selectedStepId);
4198
4198
  }
4199
4199
  }
@@ -4255,7 +4255,7 @@ Use **bold** and *italic* text.`;
4255
4255
  return r.id === this._selectedStepId ? {
4256
4256
  ...r,
4257
4257
  elements: ((n = r.elements) == null ? void 0 : n.map(
4258
- (o) => o.id === s ? { ...o, ...e } : o
4258
+ (a) => a.id === s ? { ...a, ...e } : a
4259
4259
  )) || []
4260
4260
  } : r;
4261
4261
  });
@@ -4272,7 +4272,7 @@ Use **bold** and *italic* text.`;
4272
4272
  return r.id === this._selectedStepId ? {
4273
4273
  ...r,
4274
4274
  elements: ((n = r.elements) == null ? void 0 : n.map(
4275
- (o) => o.id === s ? { ...o, ...e } : o
4275
+ (a) => a.id === s ? { ...a, ...e } : a
4276
4276
  )) || []
4277
4277
  } : r;
4278
4278
  });
@@ -5077,13 +5077,13 @@ Use **bold** and *italic* text.`;
5077
5077
  class="assignment-select"
5078
5078
  .value=${this._stepAssignmentTarget}
5079
5079
  @change=${(t) => {
5080
- var n, o;
5080
+ var n, a;
5081
5081
  const i = t.target;
5082
5082
  this._stepAssignmentTarget = i.value;
5083
5083
  const r = (n = this._templateData.steps) == null ? void 0 : n.findIndex(
5084
- (a) => a.id === this._editingStepId
5084
+ (o) => o.id === this._editingStepId
5085
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());
5086
+ 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
5087
  }}
5088
5088
  >
5089
5089
  <!-- Groups -->
@@ -5301,8 +5301,8 @@ Use **bold** and *italic* text.`;
5301
5301
  <select
5302
5302
  class="question-type-select"
5303
5303
  .value=${n.type || "text_input"}
5304
- @change=${(o) => {
5305
- const d = o.target.value;
5304
+ @change=${(a) => {
5305
+ const d = a.target.value;
5306
5306
  if ([
5307
5307
  "text",
5308
5308
  "html",
@@ -5370,10 +5370,10 @@ Use **bold** and *italic* text.`;
5370
5370
  class="question-label-input"
5371
5371
  placeholder="Question label"
5372
5372
  .value=${n.label || ""}
5373
- @input=${(o) => {
5374
- const a = o.target;
5373
+ @input=${(a) => {
5374
+ const o = a.target;
5375
5375
  this._updateQuestion(n.id, {
5376
- label: a.value
5376
+ label: o.value
5377
5377
  });
5378
5378
  }}
5379
5379
  />
@@ -5384,10 +5384,10 @@ Use **bold** and *italic* text.`;
5384
5384
  <input
5385
5385
  type="checkbox"
5386
5386
  .checked=${n.required || !1}
5387
- @change=${(o) => {
5388
- const a = o.target;
5387
+ @change=${(a) => {
5388
+ const o = a.target;
5389
5389
  this._updateQuestion(n.id, {
5390
- required: a.checked
5390
+ required: o.checked
5391
5391
  });
5392
5392
  }}
5393
5393
  />
@@ -5407,8 +5407,8 @@ Use **bold** and *italic* text.`;
5407
5407
  <select
5408
5408
  class="question-type-select"
5409
5409
  .value=${t.type || "text"}
5410
- @change=${(o) => {
5411
- const d = o.target.value;
5410
+ @change=${(a) => {
5411
+ const d = a.target.value;
5412
5412
  if (![
5413
5413
  "text",
5414
5414
  "html",
@@ -5587,25 +5587,26 @@ class ft {
5587
5587
  return { isValid: !1, errors: {} };
5588
5588
  let r = !0;
5589
5589
  const n = {};
5590
- for (const o of e.elements)
5591
- if (this.isQuestionElement(o)) {
5592
- const a = o;
5593
- if (a.required) {
5590
+ for (const a of e.elements)
5591
+ if (this.isQuestionElement(a)) {
5592
+ const o = a;
5593
+ if (o.required) {
5594
5594
  const d = this.validateQuestion(
5595
- a,
5596
- t[a.id]
5595
+ o,
5596
+ t[o.id],
5597
+ t
5597
5598
  );
5598
- d && (r = !1, n[a.id] = d.message);
5599
+ d && (r = !1, n[o.id] = d.message);
5599
5600
  }
5600
5601
  }
5601
5602
  return { isValid: r, errors: n };
5602
5603
  }
5603
- validateQuestion(e, t) {
5604
+ validateQuestion(e, t, i) {
5604
5605
  switch (e.type) {
5605
5606
  case "checkbox":
5606
5607
  return this.validateCheckbox(e, t);
5607
5608
  case "signature":
5608
- return this.validateSignature(e, t);
5609
+ return this.validateSignature(e, t, i);
5609
5610
  case "file_upload":
5610
5611
  return this.validateFileUpload(e, t);
5611
5612
  default:
@@ -5626,9 +5627,11 @@ class ft {
5626
5627
  };
5627
5628
  return null;
5628
5629
  }
5629
- validateSignature(e, t) {
5630
- const i = this.signaturePads.get(e.id);
5631
- return !i || i.isEmpty() ? {
5630
+ validateSignature(e, t, i) {
5631
+ if (i && i[e.id])
5632
+ return null;
5633
+ const r = this.signaturePads.get(e.id);
5634
+ return !r || r.isEmpty() ? {
5632
5635
  questionId: e.id,
5633
5636
  message: `${e.label} is required.`
5634
5637
  } : this.savedSignatures.has(e.id) ? null : {
@@ -5666,13 +5669,13 @@ class bt {
5666
5669
  getStorageKey(e) {
5667
5670
  return `runner-form-data-${e || "default"}`;
5668
5671
  }
5669
- saveFormData(e, t, i, r, n, o) {
5672
+ saveFormData(e, t, i, r, n, a) {
5670
5673
  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,
5674
+ const o = this.getStorageKey(e), d = a ? {
5675
+ ...a,
5676
+ currentStepId: (u = (c = a.steps) == null ? void 0 : c[i]) == null ? void 0 : u.id,
5674
5677
  completedSteps: Array.from(n),
5675
- steps: (h = o.steps) == null ? void 0 : h.map((g) => ({
5678
+ steps: (h = a.steps) == null ? void 0 : h.map((g) => ({
5676
5679
  ...g,
5677
5680
  responses: g.responses || []
5678
5681
  }))
@@ -5685,7 +5688,7 @@ class bt {
5685
5688
  instance: d
5686
5689
  };
5687
5690
  try {
5688
- localStorage.setItem(a, JSON.stringify(p));
5691
+ localStorage.setItem(o, JSON.stringify(p));
5689
5692
  } catch (g) {
5690
5693
  console.warn("Failed to save form data to localStorage:", g);
5691
5694
  }
@@ -5746,24 +5749,24 @@ class ve {
5746
5749
  return new ve(e[1], i, r, e[2], t.start, t.end);
5747
5750
  }
5748
5751
  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;
5752
+ 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
5753
  return {
5751
5754
  c1: new Z(d.x + Y, d.y + q),
5752
5755
  c2: new Z(p.x + Y, p.y + q)
5753
5756
  };
5754
5757
  }
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;
5758
+ constructor(e, t, i, r, n, a) {
5759
+ this.startPoint = e, this.control2 = t, this.control1 = i, this.endPoint = r, this.startWidth = n, this.endWidth = a;
5757
5760
  }
5758
5761
  length() {
5759
5762
  let t = 0, i, r;
5760
5763
  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);
5764
+ 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
5765
  if (n > 0) {
5763
- const p = a - i, c = d - r;
5766
+ const p = o - i, c = d - r;
5764
5767
  t += Math.sqrt(p * p + c * c);
5765
5768
  }
5766
- i = a, r = d;
5769
+ i = o, r = d;
5767
5770
  }
5768
5771
  return t;
5769
5772
  }
@@ -5790,13 +5793,13 @@ class vt {
5790
5793
  }
5791
5794
  }
5792
5795
  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 = []);
5796
+ let t = 0, i = null, r, n, a;
5797
+ const o = () => {
5798
+ t = Date.now(), i = null, r = s.apply(n, a), i || (n = null, a = []);
5796
5799
  };
5797
5800
  return function(...p) {
5798
5801
  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;
5802
+ 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
5803
  };
5801
5804
  }
5802
5805
  class ee extends vt {
@@ -5810,9 +5813,9 @@ class ee extends vt {
5810
5813
  }
5811
5814
  fromDataURL(e, t = {}) {
5812
5815
  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;
5816
+ 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
5817
  this._reset(this._getPointGroupOptions()), n.onload = () => {
5815
- this._ctx.drawImage(n, p, c, a, d), i();
5818
+ this._ctx.drawImage(n, p, c, o, d), i();
5816
5819
  }, n.onerror = (u) => {
5817
5820
  r(u);
5818
5821
  }, n.crossOrigin = "anonymous", n.src = e, this._isEmpty = !1;
@@ -5971,10 +5974,10 @@ class ee extends vt {
5971
5974
  return;
5972
5975
  }
5973
5976
  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({
5977
+ 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);
5978
+ if (!n || !(n && a)) {
5979
+ const d = this._addPoint(t, o);
5980
+ n ? d && this._drawCurve(d, o) : this._drawDot(t, o), r.push({
5978
5981
  time: t.time,
5979
5982
  x: t.x,
5980
5983
  y: t.y,
@@ -6018,11 +6021,11 @@ class ee extends vt {
6018
6021
  return null;
6019
6022
  }
6020
6023
  _calculateCurveWidths(e, t, i) {
6021
- const r = i.velocityFilterWeight * t.velocityFrom(e) + (1 - i.velocityFilterWeight) * this._lastVelocity, n = this._strokeWidth(r, i), o = {
6024
+ const r = i.velocityFilterWeight * t.velocityFrom(e) + (1 - i.velocityFilterWeight) * this._lastVelocity, n = this._strokeWidth(r, i), a = {
6022
6025
  end: n,
6023
6026
  start: this._lastWidth
6024
6027
  };
6025
- return this._lastVelocity = r, this._lastWidth = n, o;
6028
+ return this._lastVelocity = r, this._lastWidth = n, a;
6026
6029
  }
6027
6030
  _strokeWidth(e, t) {
6028
6031
  return Math.max(t.maxWidth / (e + 1), t.minWidth);
@@ -6034,12 +6037,12 @@ class ee extends vt {
6034
6037
  _drawCurve(e, t) {
6035
6038
  const i = this._ctx, r = e.endWidth - e.startWidth, n = Math.ceil(e.length()) * 2;
6036
6039
  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;
6040
+ for (let a = 0; a < n; a += 1) {
6041
+ const o = a / n, d = o * o, p = d * o, c = 1 - o, u = c * c, h = u * c;
6039
6042
  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;
6043
+ g += 3 * u * o * e.control1.x, g += 3 * c * d * e.control2.x, g += p * e.endPoint.x;
6041
6044
  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;
6045
+ x += 3 * u * o * e.control1.y, x += 3 * c * d * e.control2.y, x += p * e.endPoint.y;
6043
6046
  const S = Math.min(e.startWidth + p * r, t.maxWidth);
6044
6047
  this._drawCurveSegment(g, x, S);
6045
6048
  }
@@ -6051,21 +6054,21 @@ class ee extends vt {
6051
6054
  }
6052
6055
  _fromData(e, t, i) {
6053
6056
  for (const r of e) {
6054
- const { points: n } = r, o = this._getPointGroupOptions(r);
6057
+ const { points: n } = r, a = this._getPointGroupOptions(r);
6055
6058
  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);
6059
+ for (let o = 0; o < n.length; o += 1) {
6060
+ const d = n[o], p = new Z(d.x, d.y, d.pressure, d.time);
6061
+ o === 0 && this._reset(a);
6062
+ const c = this._addPoint(p, a);
6063
+ c && t(c, a);
6061
6064
  }
6062
6065
  else
6063
- this._reset(o), i(n[0], o);
6066
+ this._reset(a), i(n[0], a);
6064
6067
  }
6065
6068
  }
6066
6069
  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) {
6070
+ 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");
6071
+ 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
6072
  const p = document.createElement("rect");
6070
6073
  p.setAttribute("width", "100%"), p.setAttribute("height", "100%"), p.setAttribute("fill", this.backgroundColor), d.appendChild(p);
6071
6074
  }
@@ -6146,8 +6149,8 @@ class _t {
6146
6149
  resizeCanvas(e) {
6147
6150
  const t = Math.max(window.devicePixelRatio || 1, 1), i = window.getComputedStyle(e), r = parseFloat(i.width), n = parseFloat(i.height);
6148
6151
  e.width = r * t, e.height = n * t;
6149
- const o = e.getContext("2d");
6150
- o && o.scale(t, t);
6152
+ const a = e.getContext("2d");
6153
+ a && a.scale(t, t);
6151
6154
  }
6152
6155
  clearSignaturePad(e) {
6153
6156
  var t;
@@ -6173,7 +6176,7 @@ class yt {
6173
6176
  if (!e) return;
6174
6177
  e.responses || (e.responses = []);
6175
6178
  const r = e.responses.findIndex(
6176
- (o) => o.elementId === t
6179
+ (a) => a.elementId === t
6177
6180
  ), n = {
6178
6181
  elementId: t,
6179
6182
  value: i,
@@ -6187,12 +6190,12 @@ class yt {
6187
6190
  if (this.isQuestionElement(r.type)) {
6188
6191
  const n = t[r.id];
6189
6192
  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 = {
6193
+ let a = i.responses.find((o) => o.elementId === r.id);
6194
+ a ? (a.value = n, a.answeredAt = /* @__PURE__ */ new Date()) : (a = {
6192
6195
  elementId: r.id,
6193
6196
  value: n,
6194
6197
  answeredAt: /* @__PURE__ */ new Date()
6195
- }, i.responses.push(o));
6198
+ }, i.responses.push(a));
6196
6199
  }
6197
6200
  }
6198
6201
  });
@@ -6210,7 +6213,7 @@ class yt {
6210
6213
  if (!(i != null && i.steps)) return !0;
6211
6214
  for (const r of i.steps)
6212
6215
  if (r.responses) {
6213
- const n = r.responses.find((o) => o.elementId === e);
6216
+ const n = r.responses.find((a) => a.elementId === e);
6214
6217
  if (n)
6215
6218
  return n.value !== t;
6216
6219
  }
@@ -6266,8 +6269,8 @@ class wt {
6266
6269
  }
6267
6270
  return this.findNextAssignedStep(e, t) === -1;
6268
6271
  }
6269
- canNavigateToStep(e, t, i, r, n, o) {
6270
- if ((n || o) && this.mode !== "admin" && this.mode !== "view-only" && this.mode !== "print")
6272
+ canNavigateToStep(e, t, i, r, n, a) {
6273
+ if ((n || a) && this.mode !== "admin" && this.mode !== "view-only" && this.mode !== "print")
6271
6274
  return {
6272
6275
  canNavigate: !1,
6273
6276
  newStepIndex: t,
@@ -6284,14 +6287,14 @@ class wt {
6284
6287
  newStepIndex: e
6285
6288
  };
6286
6289
  }
6287
- const a = i.steps;
6288
- if (!a || e < 0 || e >= a.length)
6290
+ const o = i.steps;
6291
+ if (!o || e < 0 || e >= o.length)
6289
6292
  return {
6290
6293
  canNavigate: !1,
6291
6294
  newStepIndex: t,
6292
6295
  reason: "Invalid step index"
6293
6296
  };
6294
- const d = a[e];
6297
+ const d = o[e];
6295
6298
  if (this.isStepAssignedToUser(d)) {
6296
6299
  const p = r.has(d.id), c = this.isStepWithinAllowedRange(
6297
6300
  e,
@@ -6315,18 +6318,18 @@ class wt {
6315
6318
  isStepWithinAllowedRange(e, t, i) {
6316
6319
  if (!(t != null && t.steps)) return !1;
6317
6320
  const n = this.getAssignedSteps(t).map((d) => t.steps.findIndex((p) => p.id === d.id)).sort((d, p) => d - p);
6318
- let o = -1;
6321
+ let a = -1;
6319
6322
  for (const d of n) {
6320
6323
  const p = t.steps[d];
6321
- i.has(p.id) && (o = d);
6324
+ i.has(p.id) && (a = d);
6322
6325
  }
6323
- let a = -1;
6326
+ let o = -1;
6324
6327
  for (const d of n)
6325
- if (d > o) {
6326
- a = d;
6328
+ if (d > a) {
6329
+ o = d;
6327
6330
  break;
6328
6331
  }
6329
- return a !== -1 ? e <= a && this.isStepAssignedToUser(t.steps[e]) : this.isStepAssignedToUser(t.steps[e]);
6332
+ return o !== -1 ? e <= o && this.isStepAssignedToUser(t.steps[e]) : this.isStepAssignedToUser(t.steps[e]);
6330
6333
  }
6331
6334
  }
6332
6335
  const te = class te {
@@ -6455,8 +6458,8 @@ const te = class te {
6455
6458
  const t = {};
6456
6459
  return (i = e.elements) == null || i.forEach((r) => {
6457
6460
  if (this.isQuestionElement(r)) {
6458
- const n = r, o = this.formData[n.id];
6459
- o !== void 0 && (t[n.id] = o);
6461
+ const n = r, a = this.formData[n.id];
6462
+ a !== void 0 && (t[n.id] = a);
6460
6463
  }
6461
6464
  }), t;
6462
6465
  }
@@ -6506,16 +6509,16 @@ const ie = class ie {
6506
6509
  this.clearFile(e), (c = i.onRequestUpdate) == null || c.call(i);
6507
6510
  return;
6508
6511
  }
6509
- const o = this.validateFileSize(n);
6510
- if (o) {
6511
- this.handleFileValidationError(e, o, r), (u = i.onRequestUpdate) == null || u.call(i);
6512
+ const a = this.validateFileSize(n);
6513
+ if (a) {
6514
+ this.handleFileValidationError(e, a, r), (u = i.onRequestUpdate) == null || u.call(i);
6512
6515
  return;
6513
6516
  }
6514
6517
  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));
6518
+ const o = this.createFileInfo(n);
6519
+ this.formStateManager.setFormField(e, o);
6520
+ const d = this.hasFileChanged(e, o, i.savedInstance);
6521
+ 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
6522
  }
6520
6523
  /**
6521
6524
  * Clears file data for a question
@@ -6553,10 +6556,10 @@ const ie = class ie {
6553
6556
  if (!(i != null && i.steps)) return !0;
6554
6557
  for (const r of i.steps)
6555
6558
  if (r.responses) {
6556
- const n = r.responses.find((o) => o.elementId === e);
6559
+ const n = r.responses.find((a) => a.elementId === e);
6557
6560
  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;
6561
+ const a = n.value;
6562
+ return a.name !== t.name || a.size !== t.size || a.type !== t.type || a.lastModified !== t.lastModified;
6560
6563
  }
6561
6564
  }
6562
6565
  return !0;
@@ -6565,10 +6568,10 @@ const ie = class ie {
6565
6568
  * Executes the file upload callback with proper context
6566
6569
  */
6567
6570
  executeFileUploadCallback(e, t, i, r) {
6568
- var n, o;
6571
+ var n, a;
6569
6572
  console.log("File changed, calling callback for:", e), console.log("Callback function exists:", !!r.onFileUploaded), r.onFileUploaded && r.onFileUploaded({
6570
6573
  instanceId: (n = r.instance) == null ? void 0 : n.id,
6571
- stepId: (o = r.currentStep) == null ? void 0 : o.id,
6574
+ stepId: (a = r.currentStep) == null ? void 0 : a.id,
6572
6575
  questionId: e,
6573
6576
  file: t,
6574
6577
  fileName: i.name,
@@ -6664,51 +6667,51 @@ class D {
6664
6667
  </select>`;
6665
6668
  }
6666
6669
  static renderRadio(e, t, i) {
6667
- var o;
6670
+ var a;
6668
6671
  const r = this._isInputDisabled(i), n = i.mode === "print";
6669
6672
  return n ? l`<div class="print-response-value radio-response">
6670
6673
  ${t || l`<span class="print-no-response">No selection made</span>`}
6671
6674
  </div>` : l`<div class="radio-group ${n ? "print-mode" : ""}">
6672
- ${(o = e.options) == null ? void 0 : o.map(
6673
- (a) => l`
6675
+ ${(a = e.options) == null ? void 0 : a.map(
6676
+ (o) => l`
6674
6677
  <label class="radio-option">
6675
6678
  <input
6676
6679
  type="radio"
6677
6680
  name=${e.id}
6678
- value=${a}
6679
- .checked=${t === a}
6681
+ value=${o}
6682
+ .checked=${t === o}
6680
6683
  ?disabled=${r}
6681
6684
  @change=${n ? null : (d) => i.handlers.handleInputChange(e.id, d)}
6682
6685
  />
6683
- <span class="radio-label">${a}</span>
6686
+ <span class="radio-label">${o}</span>
6684
6687
  </label>
6685
6688
  `
6686
6689
  )}
6687
6690
  </div>`;
6688
6691
  }
6689
6692
  static renderCheckbox(e, t, i) {
6690
- var o;
6693
+ var a;
6691
6694
  const r = this._isInputDisabled(i), n = i.mode === "print";
6692
6695
  if (e.options && e.options.length > 0) {
6693
6696
  if (n) {
6694
- const a = Array.isArray(t) ? t : [];
6697
+ const o = Array.isArray(t) ? t : [];
6695
6698
  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>`}
6699
+ ${o.length > 0 ? o.map((d) => l`<div>• ${d}</div>`) : l`<span class="print-no-response">No selections made</span>`}
6697
6700
  </div>`;
6698
6701
  }
6699
6702
  return l`<div class="checkbox-group ${n ? "print-mode" : ""}">
6700
- ${(o = e.options) == null ? void 0 : o.map(
6701
- (a) => l`
6703
+ ${(a = e.options) == null ? void 0 : a.map(
6704
+ (o) => l`
6702
6705
  <label class="checkbox-option">
6703
6706
  <input
6704
6707
  type="checkbox"
6705
6708
  name=${e.id}
6706
- value=${a}
6707
- .checked=${Array.isArray(t) ? t.includes(a) : !1}
6709
+ value=${o}
6710
+ .checked=${Array.isArray(t) ? t.includes(o) : !1}
6708
6711
  ?disabled=${r}
6709
- @change=${n ? null : (d) => i.handlers.handleCheckboxGroupChange(e.id, a, d)}
6712
+ @change=${n ? null : (d) => i.handlers.handleCheckboxGroupChange(e.id, o, d)}
6710
6713
  />
6711
- <span class="checkbox-label">${a}</span>
6714
+ <span class="checkbox-label">${o}</span>
6712
6715
  </label>
6713
6716
  `
6714
6717
  )}
@@ -6722,13 +6725,13 @@ class D {
6722
6725
  id=${e.id}
6723
6726
  .checked=${!!t}
6724
6727
  ?disabled=${r}
6725
- @change=${n ? null : (a) => i.handlers.handleCheckboxChange(e.id, a)}
6728
+ @change=${n ? null : (o) => i.handlers.handleCheckboxChange(e.id, o)}
6726
6729
  />
6727
6730
  <span class="checkbox-label">${e.label}</span>
6728
6731
  </label>`;
6729
6732
  }
6730
6733
  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);
6734
+ const r = i.formData[e.id], n = !!i.formData[e.id], a = i.savedSignatures.has(e.id), o = i.replacingSignatures.has(e.id);
6732
6735
  if (i.mode === "print")
6733
6736
  return r && typeof r == "string" ? l`
6734
6737
  <div class="print-response-value signature-response">
@@ -6775,7 +6778,31 @@ class D {
6775
6778
  <span class="no-signature">No signature captured</span>
6776
6779
  </div>
6777
6780
  `;
6778
- if (i.mode === "admin" && r && typeof r == "string" && !a) {
6781
+ if (i.mode === "default" && !i.handlers.isCurrentStepAssigned())
6782
+ return r && typeof r == "string" ? l`
6783
+ <div class="signature-view-only">
6784
+ <img
6785
+ src="${r}"
6786
+ alt="Digital Signature"
6787
+ class="signature-image"
6788
+ @error=${(d) => {
6789
+ var u;
6790
+ const p = d.target;
6791
+ p.style.display = "none";
6792
+ const c = (u = p.parentElement) == null ? void 0 : u.querySelector(".signature-fallback");
6793
+ c && c.classList.remove("hidden");
6794
+ }}
6795
+ />
6796
+ <div class="signature-fallback hidden">
6797
+ <span class="signature-error">Unable to display signature</span>
6798
+ </div>
6799
+ </div>
6800
+ ` : l`
6801
+ <div class="signature-view-only">
6802
+ <span class="no-signature">No signature captured</span>
6803
+ </div>
6804
+ `;
6805
+ if (i.mode === "admin" && r && typeof r == "string" && !o) {
6779
6806
  const d = r.trim().startsWith("<svg");
6780
6807
  return l`
6781
6808
  <div class="signature-admin-display">
@@ -6822,7 +6849,7 @@ class D {
6822
6849
  >
6823
6850
  Clear
6824
6851
  </button>
6825
- ${n && !o ? l`
6852
+ ${n && !a ? l`
6826
6853
  <button
6827
6854
  type="button"
6828
6855
  class="signature-save-btn"
@@ -6832,8 +6859,8 @@ class D {
6832
6859
  Save
6833
6860
  </button>
6834
6861
  ` : ""}
6835
- ${o ? l` <span class="signature-saved">✓ Saved</span> ` : ""}
6836
- ${i.mode === "admin" && a ? l`
6862
+ ${a ? l` <span class="signature-saved">✓ Saved</span> ` : ""}
6863
+ ${i.mode === "admin" && o ? l`
6837
6864
  <button
6838
6865
  type="button"
6839
6866
  class="signature-cancel-btn"
@@ -6850,9 +6877,9 @@ class D {
6850
6877
  const r = i.formData[e.id];
6851
6878
  if (i.mode === "view-only" || i.mode === "print")
6852
6879
  if (r) {
6853
- const n = typeof r == "string", o = typeof r == "object" && r.name;
6880
+ const n = typeof r == "string", a = typeof r == "object" && r.name;
6854
6881
  if (i.mode === "print") {
6855
- if (o)
6882
+ if (a)
6856
6883
  return l`
6857
6884
  <div class="print-response-value file-response">
6858
6885
  📎 ${r.name}
@@ -6862,16 +6889,16 @@ class D {
6862
6889
  </div>
6863
6890
  `;
6864
6891
  if (n) {
6865
- const a = D._extractFilenameFromUrl(r);
6866
- return l` <div class="print-response-value file-response">📎 ${a}</div> `;
6892
+ const o = D._extractFilenameFromUrl(r);
6893
+ return l` <div class="print-response-value file-response">📎 ${o}</div> `;
6867
6894
  } else
6868
6895
  return l` <div class="print-response-value file-response">📎 ${r}</div> `;
6869
6896
  } else {
6870
- const a = n ? r : "#", d = o ? r.name : n ? D._extractFilenameFromUrl(r) : "View File";
6897
+ const o = n ? r : "#", d = a ? r.name : n ? D._extractFilenameFromUrl(r) : "View File";
6871
6898
  return l`
6872
6899
  <div class="file-upload-view-only">
6873
- <a href="${a}" target="_blank" class="file-link"> 📎 ${d} </a>
6874
- ${o && r.size ? l`
6900
+ <a href="${o}" target="_blank" class="file-link"> 📎 ${d} </a>
6901
+ ${a && r.size ? l`
6875
6902
  <span class="file-size-info"
6876
6903
  >(${D._formatFileSize(r.size)})</span
6877
6904
  >
@@ -6952,16 +6979,16 @@ class D {
6952
6979
  default:
6953
6980
  return D.renderDefaultInput(e, i, t);
6954
6981
  }
6955
- }, o = e.type === "checkbox" && (!e.options || e.options.length === 0);
6982
+ }, a = e.type === "checkbox" && (!e.options || e.options.length === 0);
6956
6983
  return t.mode === "print" ? l`
6957
6984
  <div class="question-print">
6958
- ${o ? "" : l` <div class="print-question-title">${e.label}:</div> `}
6985
+ ${a ? "" : l` <div class="print-question-title">${e.label}:</div> `}
6959
6986
  ${n()}
6960
6987
  <hr class="print-question-separator" />
6961
6988
  </div>
6962
6989
  ` : l`
6963
6990
  <div class="question ${r ? "error" : ""}">
6964
- ${o ? "" : l`
6991
+ ${a ? "" : l`
6965
6992
  <div class="runner-question-title">
6966
6993
  ${e.label}${e.required ? l`<span class="runner-question-required">*</span>` : ""}
6967
6994
  </div>
@@ -7125,15 +7152,15 @@ class le {
7125
7152
  <nav aria-label="Workflow steps">
7126
7153
  <div class="runner-mobile-steps-container">
7127
7154
  ${t == null ? void 0 : t.map((r) => {
7128
- const n = e.isStepAssignedToUser(r), o = e.completedSteps.has(r.id);
7155
+ const n = e.isStepAssignedToUser(r), a = e.completedSteps.has(r.id);
7129
7156
  return l`
7130
7157
  <div
7131
- class="runner-mobile-step-tab ${o ? "completed" : ""} ${n ? "" : "unassigned"} ${i ? "disabled" : ""}"
7158
+ class="runner-mobile-step-tab ${a ? "completed" : ""} ${n ? "" : "unassigned"} ${i ? "disabled" : ""}"
7132
7159
  style="cursor: not-allowed; opacity: ${i ? "0.6" : n ? "1" : "0.6"};"
7133
7160
  >
7134
7161
  <span class="runner-mobile-step-title">${r.title}</span>
7135
7162
  <span class="runner-mobile-step-badge">
7136
- ${o ? "Completed" : n ? "Your Step" : "Other User"}
7163
+ ${a ? "Completed" : n ? "Your Step" : "Other User"}
7137
7164
  </span>
7138
7165
  </div>
7139
7166
  `;
@@ -7170,7 +7197,7 @@ class le {
7170
7197
  `;
7171
7198
  }
7172
7199
  static renderSubmissionErrorView(e) {
7173
- var r, n, o;
7200
+ var r, n, a;
7174
7201
  const { submissionError: t, onRetry: i } = e;
7175
7202
  return l`
7176
7203
  <div class="runner-layout">
@@ -7187,14 +7214,14 @@ class le {
7187
7214
  <div class="runner-sidebar-header">Steps</div>
7188
7215
  <nav aria-label="Workflow steps">
7189
7216
  <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);
7217
+ ${(a = (n = e.instance) == null ? void 0 : n.steps) == null ? void 0 : a.map((o) => {
7218
+ const d = e.isStepAssignedToUser(o), p = e.completedSteps.has(o.id);
7192
7219
  return l`
7193
7220
  <li
7194
7221
  class="runner-step-item ${p ? "completed" : ""} ${d ? "" : "unassigned"}"
7195
7222
  style="opacity: ${d ? "1" : "0.6"}; cursor: not-allowed;"
7196
7223
  >
7197
- <span class="runner-step-title">${a.title}</span>
7224
+ <span class="runner-step-title">${o.title}</span>
7198
7225
  <span class="runner-step-badge ${!p && d ? "error" : ""}">
7199
7226
  ${p ? "Submitted" : d ? "Failed" : "Other User"}
7200
7227
  </span>
@@ -7252,15 +7279,15 @@ class le {
7252
7279
  <nav aria-label="Workflow steps">
7253
7280
  <ul class="runner-steps-list">
7254
7281
  ${(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);
7282
+ const a = e.isStepAssignedToUser(n), o = e.completedSteps.has(n.id);
7256
7283
  return l`
7257
7284
  <li
7258
- class="runner-step-item ${a ? "completed" : ""} ${o ? "" : "unassigned"}"
7259
- style="opacity: ${o ? "1" : "0.6"}; cursor: not-allowed;"
7285
+ class="runner-step-item ${o ? "completed" : ""} ${a ? "" : "unassigned"}"
7286
+ style="opacity: ${a ? "1" : "0.6"}; cursor: not-allowed;"
7260
7287
  >
7261
7288
  <span class="runner-step-title">${n.title}</span>
7262
7289
  <span class="runner-step-badge">
7263
- ${a ? "Submitted" : o ? "Your Step" : "Other User"}
7290
+ ${o ? "Submitted" : a ? "Your Step" : "Other User"}
7264
7291
  </span>
7265
7292
  </li>
7266
7293
  `;
@@ -7312,16 +7339,16 @@ class j {
7312
7339
  <nav aria-label="Workflow steps">
7313
7340
  <ul class="runner-steps-list">
7314
7341
  ${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;
7342
+ 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
7343
  return l`
7317
7344
  <li
7318
- class="runner-step-item ${o ? "active" : ""} ${a ? "completed" : ""} ${n ? "" : "unassigned"} ${d ? "disabled" : ""} ${p ? "loading-disabled" : ""}"
7345
+ class="runner-step-item ${a ? "active" : ""} ${o ? "completed" : ""} ${n ? "" : "unassigned"} ${d ? "disabled" : ""} ${p ? "loading-disabled" : ""}"
7319
7346
  @click=${() => !p && e.goToStep(r)}
7320
7347
  style="${d ? "opacity: 0.5; cursor: not-allowed;" : ""}"
7321
7348
  >
7322
7349
  <span class="runner-step-title">${i.title}</span>
7323
7350
  <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"}
7351
+ ${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
7352
  </span>
7326
7353
  </li>
7327
7354
  `;
@@ -7338,17 +7365,17 @@ class j {
7338
7365
  <nav aria-label="Workflow steps">
7339
7366
  <div class="runner-mobile-steps-container">
7340
7367
  ${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;
7368
+ 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
7369
  return l`
7343
7370
  <button
7344
- class="runner-mobile-step-tab ${o ? "active" : ""} ${a ? "completed" : ""} ${n ? "" : "unassigned"} ${d ? "disabled" : ""} ${p ? "loading-disabled" : ""}"
7371
+ class="runner-mobile-step-tab ${a ? "active" : ""} ${o ? "completed" : ""} ${n ? "" : "unassigned"} ${d ? "disabled" : ""} ${p ? "loading-disabled" : ""}"
7345
7372
  @click=${() => !p && e.goToStep(r)}
7346
7373
  ?disabled=${d || p}
7347
- aria-current=${o ? "step" : "false"}
7374
+ aria-current=${a ? "step" : "false"}
7348
7375
  >
7349
7376
  <span class="runner-mobile-step-title">${i.title}</span>
7350
7377
  <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"}
7378
+ ${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
7379
  </span>
7353
7380
  </button>
7354
7381
  `;
@@ -7394,30 +7421,30 @@ class pe {
7394
7421
  /**
7395
7422
  * Handles change events for basic text inputs, textareas, selects, numbers, dates
7396
7423
  */
7397
- static handleInputChange(e, t, i, r, n, o) {
7398
- const a = t.target;
7424
+ static handleInputChange(e, t, i, r, n, a) {
7425
+ const o = t.target;
7399
7426
  let d;
7400
- a.type === "radio" ? d = a.value : a.type === "checkbox" ? d = a.checked : d = a.value;
7427
+ o.type === "radio" ? d = o.value : o.type === "checkbox" ? d = o.checked : d = o.value;
7401
7428
  const p = {
7402
7429
  ...i,
7403
7430
  [e]: d
7404
7431
  };
7405
- r(p), o !== "preview" && n(e, d);
7432
+ r(p), a !== "preview" && n(e, d);
7406
7433
  }
7407
7434
  /**
7408
7435
  * Handles change events for single checkboxes
7409
7436
  */
7410
- static handleCheckboxChange(e, t, i, r, n, o) {
7437
+ static handleCheckboxChange(e, t, i, r, n, a) {
7411
7438
  const d = t.target.checked, p = {
7412
7439
  ...i,
7413
7440
  [e]: d
7414
7441
  };
7415
- r(p), o !== "preview" && n(e, d);
7442
+ r(p), a !== "preview" && n(e, d);
7416
7443
  }
7417
7444
  /**
7418
7445
  * Handles change events for checkbox groups (multiple checkboxes with same name)
7419
7446
  */
7420
- static handleCheckboxGroupChange(e, t, i, r, n, o, a) {
7447
+ static handleCheckboxGroupChange(e, t, i, r, n, a, o) {
7421
7448
  const d = i.target, p = r[e];
7422
7449
  let c = Array.isArray(p) ? [...p] : [];
7423
7450
  d.checked ? c.includes(t) || c.push(t) : c = c.filter((h) => h !== t);
@@ -7425,12 +7452,12 @@ class pe {
7425
7452
  ...r,
7426
7453
  [e]: c
7427
7454
  };
7428
- n(u), a !== "preview" && o(e, c);
7455
+ n(u), o !== "preview" && a(e, c);
7429
7456
  }
7430
7457
  }
7431
7458
  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);
7459
+ for (var r = i > 1 ? void 0 : i ? At(e, t) : e, n = s.length - 1, a; n >= 0; n--)
7460
+ (a = s[n]) && (r = (i ? a(e, t, r) : a(r)) || r);
7434
7461
  return i && r && Ct(e, t, r), r;
7435
7462
  };
7436
7463
  let f = class extends N {
@@ -7519,8 +7546,8 @@ let f = class extends N {
7519
7546
  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
7547
  const i = this._getAssignedSteps(), r = i.filter(
7521
7548
  (n) => {
7522
- var o;
7523
- return (o = this.instance.completedSteps) == null ? void 0 : o.includes(n.id);
7549
+ var a;
7550
+ return (a = this.instance.completedSteps) == null ? void 0 : a.includes(n.id);
7524
7551
  }
7525
7552
  );
7526
7553
  this._userStepsSubmitted = i.length > 0 && r.length === i.length;
@@ -7540,7 +7567,7 @@ let f = class extends N {
7540
7567
  var s;
7541
7568
  !((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
7569
  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(
7570
+ ), this.formStateManager.initializeFromResponses(this.instance.steps), this._formData = this.formStateManager.getFormData(), this._markExistingSignaturesAsSaved(), this._currentStepIndex = this.instance.steps.findIndex(
7544
7571
  (e) => {
7545
7572
  var t;
7546
7573
  return e.id === ((t = this.instance) == null ? void 0 : t.currentStepId);
@@ -7551,19 +7578,30 @@ let f = class extends N {
7551
7578
  }
7552
7579
  _initializeViewOnlyMode() {
7553
7580
  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) => {
7581
+ !((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
7582
  e.responses && e.responses.length > 0 ? (e.status = "completed", this._internalCompletedSteps.add(e.id)) : e.status = "pending";
7556
7583
  }), console.log("View-only mode initialized with existing responses:", this._formData));
7557
7584
  }
7558
7585
  _initializePrintMode() {
7559
7586
  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) => {
7587
+ !((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
7588
  e.responses && e.responses.length > 0 ? (e.status = "completed", this._internalCompletedSteps.add(e.id)) : e.status = "pending";
7562
7589
  }), console.log("Print mode initialized with existing responses:", this._formData));
7563
7590
  }
7564
7591
  _isStepAssignedToUser(s) {
7565
7592
  return this.navigationService.isStepAssignedToUser(s);
7566
7593
  }
7594
+ _markExistingSignaturesAsSaved() {
7595
+ var s;
7596
+ (s = this.instance) != null && s.steps && this.instance.steps.forEach((e) => {
7597
+ e.elements.forEach((t) => {
7598
+ if (t.type === "signature") {
7599
+ const i = t.id;
7600
+ this._formData[i] && this._savedSignatures.add(i);
7601
+ }
7602
+ });
7603
+ });
7604
+ }
7567
7605
  _getAssignedSteps() {
7568
7606
  return this.instance ? this.navigationService.getAssignedSteps(this.instance) : [];
7569
7607
  }
@@ -7642,7 +7680,7 @@ let f = class extends N {
7642
7680
  if (!e) return;
7643
7681
  const t = this._hasSignatureChanged(s, e.svgData);
7644
7682
  this._savedSignatures = /* @__PURE__ */ new Set([...this._savedSignatures, s]), this._replacingSignatures.has(s) && (this._replacingSignatures = new Set(
7645
- [...this._replacingSignatures].filter((o) => o !== s)
7683
+ [...this._replacingSignatures].filter((a) => a !== s)
7646
7684
  )), 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
7685
  instanceId: (i = this.instance) == null ? void 0 : i.id,
7648
7686
  stepId: (r = this._currentStep) == null ? void 0 : r.id,
@@ -7738,15 +7776,25 @@ let f = class extends N {
7738
7776
  const s = this._currentStep;
7739
7777
  s && this._captureSignaturesFromStep(s);
7740
7778
  const e = this._findNextAssignedStep(this._currentStepIndex);
7779
+ if (e === -1) {
7780
+ await this._submitUserSteps();
7781
+ return;
7782
+ }
7783
+ if (e > this._currentStepIndex + 1) {
7784
+ console.log(
7785
+ `Next assigned step (${e}) is not consecutive. Steps in between are assigned to other users.`
7786
+ ), await this._submitUserSteps();
7787
+ return;
7788
+ }
7741
7789
  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", {
7790
+ const a = (t = this._currentStep) == null ? void 0 : t.id;
7791
+ if (this._currentStepIndex = e, (await this._updateInstanceData(a, "step_navigation", {
7744
7792
  direction: "next",
7745
7793
  fromStepIndex: this._currentStepIndex - 1,
7746
7794
  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);
7795
+ completedStepId: a
7796
+ })).success && a && (i = this.instance) != null && i.steps) {
7797
+ const p = this.instance.steps.find((c) => c.id === a);
7750
7798
  p && (p.status = "completed");
7751
7799
  }
7752
7800
  const d = (n = (r = this.instance) == null ? void 0 : r.steps) == null ? void 0 : n[this._currentStepIndex];
@@ -7850,10 +7898,10 @@ let f = class extends N {
7850
7898
  const S = Array.from(this._internalCompletedSteps), Y = S[S.length - 1];
7851
7899
  i = (u = (c = this.instance) == null ? void 0 : c.steps) == null ? void 0 : u.find((q) => q.id === Y);
7852
7900
  }
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 ? {
7901
+ 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
7902
  id: this._currentStep.id,
7855
7903
  title: this._currentStep.title
7856
- } : null, a = {
7904
+ } : null, o = {
7857
7905
  instanceId: (g = this.instance) == null ? void 0 : g.id,
7858
7906
  workflowId: (x = this.instance) == null ? void 0 : x.workflowId,
7859
7907
  completedStepId: s || (i ? i.id : void 0),
@@ -7863,13 +7911,13 @@ let f = class extends N {
7863
7911
  responses: i.responses || []
7864
7912
  } : void 0,
7865
7913
  completedSteps: Array.from(this._internalCompletedSteps),
7866
- currentStep: o,
7914
+ currentStep: a,
7867
7915
  mode: this.mode
7868
7916
  };
7869
7917
  if (this.onInstanceUpdated)
7870
7918
  try {
7871
7919
  this._submissionError = null, this.requestUpdate();
7872
- const S = await this.onInstanceUpdated(a);
7920
+ const S = await this.onInstanceUpdated(o);
7873
7921
  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
7922
  } catch (S) {
7875
7923
  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 +7948,19 @@ let f = class extends N {
7900
7948
  this.updateComplete.then(() => {
7901
7949
  var e, t;
7902
7950
  (e = this.shadowRoot) != null && e.querySelector(".runner-step-form") && (Object.entries(this._formData).forEach(([i, r]) => {
7903
- var o;
7951
+ var a;
7904
7952
  if (i.endsWith("_signatureData")) return;
7905
- const n = (o = this.shadowRoot) == null ? void 0 : o.getElementById(i);
7953
+ const n = (a = this.shadowRoot) == null ? void 0 : a.getElementById(i);
7906
7954
  if (n) {
7907
7955
  if (n.type === "checkbox") {
7908
- const a = n;
7909
- typeof r == "boolean" ? a.checked = r : Array.isArray(r) && (a.checked = r.includes(a.value));
7956
+ const o = n;
7957
+ typeof r == "boolean" ? o.checked = r : Array.isArray(r) && (o.checked = r.includes(o.value));
7910
7958
  } else if (n.type === "radio") {
7911
- const a = n;
7912
- a.checked = a.value === r;
7959
+ const o = n;
7960
+ o.checked = o.value === r;
7913
7961
  } else if (n.type === "file") {
7914
- const a = n;
7915
- a.value = "";
7962
+ const o = n;
7963
+ o.value = "";
7916
7964
  } else
7917
7965
  n.value = String(r || "");
7918
7966
  console.log(`Restored value for ${i}:`, r);
@@ -7926,7 +7974,7 @@ let f = class extends N {
7926
7974
  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
7975
  const i = t, r = this._formData[i.id];
7928
7976
  if (r !== void 0 && e.responses) {
7929
- let n = e.responses.find((o) => o.elementId === i.id);
7977
+ let n = e.responses.find((a) => a.elementId === i.id);
7930
7978
  n ? (n.value = r, n.answeredAt = /* @__PURE__ */ new Date()) : (n = {
7931
7979
  elementId: i.id,
7932
7980
  value: r,
@@ -7968,15 +8016,15 @@ let f = class extends N {
7968
8016
  for (let r = 0; r < t.length; r++) {
7969
8017
  const n = t[r];
7970
8018
  if (n.name || n.id) {
7971
- const o = n.id || n.name;
8019
+ const a = n.id || n.name;
7972
8020
  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;
8021
+ const o = n;
8022
+ o.name && o.name === a ? (s[a] || (s[a] = []), o.checked && s[a].push(o.value)) : s[a] = o.checked;
7975
8023
  } else if (n.type === "radio") {
7976
- const a = n;
7977
- a.checked && (s[o] = a.value);
8024
+ const o = n;
8025
+ o.checked && (s[a] = o.value);
7978
8026
  } else
7979
- s[o] = n.value;
8027
+ s[a] = n.value;
7980
8028
  }
7981
8029
  }
7982
8030
  return s;
@@ -7986,14 +8034,14 @@ let f = class extends N {
7986
8034
  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
8035
  i.responses || (i.responses = []), i.elements.forEach((r) => {
7988
8036
  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 = {
8037
+ const n = r, a = this._formData[n.id];
8038
+ if (a !== void 0 && i.responses) {
8039
+ let o = i.responses.find((d) => d.elementId === n.id);
8040
+ o ? (o.value = a, o.answeredAt = /* @__PURE__ */ new Date()) : (o = {
7993
8041
  elementId: n.id,
7994
- value: o,
8042
+ value: a,
7995
8043
  answeredAt: /* @__PURE__ */ new Date()
7996
- }, i.responses.push(a));
8044
+ }, i.responses.push(o));
7997
8045
  }
7998
8046
  }
7999
8047
  });
@@ -8167,8 +8215,8 @@ let f = class extends N {
8167
8215
  mode: this.mode
8168
8216
  })}
8169
8217
  </div>`}
8170
- <form class="runner-step-form" @submit=${(o) => o.preventDefault()}>
8171
- ${s.elements.map((o) => this._renderStepElement(o))}
8218
+ <form class="runner-step-form" @submit=${(a) => a.preventDefault()}>
8219
+ ${s.elements.map((a) => this._renderStepElement(a))}
8172
8220
  ${Dt.renderFormActions({
8173
8221
  mode: this.mode || "default",
8174
8222
  isLastStep: e,
@@ -8309,7 +8357,7 @@ function Jt(s, e = {}) {
8309
8357
  includeStyles: i = !0,
8310
8358
  customCSS: r = "",
8311
8359
  showTimestamps: n = !1
8312
- } = e, o = /* @__PURE__ */ new Date();
8360
+ } = e, a = /* @__PURE__ */ new Date();
8313
8361
  if (!(s != null && s.steps) || s.steps.length === 0)
8314
8362
  throw new Error("Instance must have at least one step to generate HTML");
8315
8363
  return {
@@ -8330,14 +8378,14 @@ function Jt(s, e = {}) {
8330
8378
  </div>
8331
8379
  <hr class="print-question-separator" />
8332
8380
 
8333
- ${n ? Wt(s, o) : ""}
8381
+ ${n ? Wt(s, a) : ""}
8334
8382
  ${s.steps.map((d) => Et(d)).join(`
8335
8383
  `)}
8336
8384
  </div>
8337
8385
  </body>
8338
8386
  </html>`,
8339
8387
  title: t,
8340
- generatedAt: o
8388
+ generatedAt: a
8341
8389
  };
8342
8390
  }
8343
8391
  function Et(s) {
@@ -8369,30 +8417,30 @@ function Ft(s, e) {
8369
8417
  <div class="print-question-title">
8370
8418
  ${m(s.label)}:
8371
8419
  </div>
8372
- `, o = '<hr class="print-question-separator" />';
8420
+ `, a = '<hr class="print-question-separator" />';
8373
8421
  switch (s.type) {
8374
8422
  case "text_input":
8375
8423
  case "number":
8376
8424
  case "date":
8377
- return n + It(s, i) + o;
8425
+ return n + It(s, i) + a;
8378
8426
  case "textarea":
8379
- return n + Ut(s, i) + o;
8427
+ return n + Ut(s, i) + a;
8380
8428
  case "select":
8381
- return n + Pt(s, i) + o;
8429
+ return n + Pt(s, i) + a;
8382
8430
  case "radio":
8383
- return n + Nt(s, i) + o;
8431
+ return n + Nt(s, i) + a;
8384
8432
  case "checkbox":
8385
- return n + Lt(s, i) + o;
8433
+ return n + Lt(s, i) + a;
8386
8434
  case "file_upload":
8387
- return n + Ot(s, i) + o;
8435
+ return n + Ot(s, i) + a;
8388
8436
  case "signature":
8389
- return n + Rt(s, i) + o;
8437
+ return n + Rt(s, i) + a;
8390
8438
  default:
8391
8439
  return n + `
8392
8440
  <div class="unknown-element">
8393
8441
  <p>⚠️ Unknown question type: ${m(s.type)}</p>
8394
8442
  </div>
8395
- ` + o;
8443
+ ` + a;
8396
8444
  }
8397
8445
  }
8398
8446
  function zt(s) {
@@ -9190,14 +9238,14 @@ function ei(s, e) {
9190
9238
  return i.steps && i.steps.forEach((r) => {
9191
9239
  r.responses || (r.responses = []), r.elements.forEach((n) => {
9192
9240
  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 = {
9241
+ const a = t[n.id];
9242
+ if (a !== void 0) {
9243
+ let o = r.responses.find((d) => d.elementId === n.id);
9244
+ o ? (o.value = a, o.answeredAt = /* @__PURE__ */ new Date()) : (o = {
9197
9245
  elementId: n.id,
9198
- value: o,
9246
+ value: a,
9199
9247
  answeredAt: /* @__PURE__ */ new Date()
9200
- }, r.responses.push(a));
9248
+ }, r.responses.push(o));
9201
9249
  }
9202
9250
  }
9203
9251
  });