@wral/report-it 0.2.0 → 0.2.1

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.
@@ -1,68 +1,68 @@
1
- import { css as y, html as c, nothing as f, LitElement as G } from "lit";
2
- import { getAuthContext as Se, createStorage as Ce, verifyCode as Te, extractTokens as Z, saveTokens as X, decodeJwtPayload as ee, refreshTokenSimple as te, sendCode as Re, createUserPool as Me, signUpIfNeeded as De, createCognitoUser as Pe, STORAGE_KEYS as S, isAuthenticatedSimple as ze } from "@wral/sdk-auth-audience";
3
- const K = globalThis, re = (s) => s, B = K.trustedTypes, se = B ? B.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, xe = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, ve = "?" + v, Be = `<${ve}>`, A = document, O = () => A.createComment(""), R = (s) => s === null || typeof s != "object" && typeof s != "function", Q = Array.isArray, Oe = (s) => Q(s) || typeof s?.[Symbol.iterator] == "function", H = `[
4
- \f\r]`, C = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ie = /-->/g, ne = />/g, $ = RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^
5
- \f\r"'\`<>=]|("|')|))|$)`, "g"), oe = /'/g, ae = /"/g, _e = /^(?:script|style|textarea|title)$/i, M = /* @__PURE__ */ Symbol.for("lit-noChange"), m = /* @__PURE__ */ Symbol.for("lit-nothing"), le = /* @__PURE__ */ new WeakMap(), k = A.createTreeWalker(A, 129);
6
- function $e(s, e) {
7
- if (!Q(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
8
- return se !== void 0 ? se.createHTML(e) : e;
9
- }
10
- const Ue = (s, e) => {
11
- const t = s.length - 1, r = [];
1
+ import { css as b, html as c, nothing as h, LitElement as G } from "lit";
2
+ import { getAuthContext as Re, createStorage as Me, verifyCode as Oe, extractTokens as J, saveTokens as X, decodeJwtPayload as ee, refreshTokenSimple as te, sendCode as De, createUserPool as Pe, createCognitoUser as ze, STORAGE_KEYS as S, isAuthenticatedSimple as Ne, signUpIfNeeded as Be } from "@wral/sdk-auth-audience";
3
+ const K = globalThis, se = (r) => r, z = K.trustedTypes, re = z ? z.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ve = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, _e = "?" + _, Ue = `<${_e}>`, F = document, N = () => F.createComment(""), R = (r) => r === null || typeof r != "object" && typeof r != "function", Q = Array.isArray, Le = (r) => Q(r) || typeof r?.[Symbol.iterator] == "function", H = `[
4
+ \f\r]`, C = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ie = /-->/g, ne = />/g, k = RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^
5
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), oe = /'/g, ae = /"/g, $e = /^(?:script|style|textarea|title)$/i, M = /* @__PURE__ */ Symbol.for("lit-noChange"), m = /* @__PURE__ */ Symbol.for("lit-nothing"), le = /* @__PURE__ */ new WeakMap(), A = F.createTreeWalker(F, 129);
6
+ function ke(r, e) {
7
+ if (!Q(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
8
+ return re !== void 0 ? re.createHTML(e) : e;
9
+ }
10
+ const qe = (r, e) => {
11
+ const t = r.length - 1, s = [];
12
12
  let i, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = C;
13
13
  for (let a = 0; a < t; a++) {
14
- const l = s[a];
15
- let d, p, u = -1, h = 0;
16
- for (; h < l.length && (o.lastIndex = h, p = o.exec(l), p !== null); ) h = o.lastIndex, o === C ? p[1] === "!--" ? o = ie : p[1] !== void 0 ? o = ne : p[2] !== void 0 ? (_e.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = $) : p[3] !== void 0 && (o = $) : o === $ ? p[0] === ">" ? (o = i ?? C, u = -1) : p[1] === void 0 ? u = -2 : (u = o.lastIndex - p[2].length, d = p[1], o = p[3] === void 0 ? $ : p[3] === '"' ? ae : oe) : o === ae || o === oe ? o = $ : o === ie || o === ne ? o = C : (o = $, i = void 0);
17
- const b = o === $ && s[a + 1].startsWith("/>") ? " " : "";
18
- n += o === C ? l + Be : u >= 0 ? (r.push(d), l.slice(0, u) + xe + l.slice(u) + v + b) : l + v + (u === -2 ? a : b);
14
+ const l = r[a];
15
+ let d, p, u = -1, f = 0;
16
+ for (; f < l.length && (o.lastIndex = f, p = o.exec(l), p !== null); ) f = o.lastIndex, o === C ? p[1] === "!--" ? o = ie : p[1] !== void 0 ? o = ne : p[2] !== void 0 ? ($e.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = k) : p[3] !== void 0 && (o = k) : o === k ? p[0] === ">" ? (o = i ?? C, u = -1) : p[1] === void 0 ? u = -2 : (u = o.lastIndex - p[2].length, d = p[1], o = p[3] === void 0 ? k : p[3] === '"' ? ae : oe) : o === ae || o === oe ? o = k : o === ie || o === ne ? o = C : (o = k, i = void 0);
17
+ const y = o === k && r[a + 1].startsWith("/>") ? " " : "";
18
+ n += o === C ? l + Ue : u >= 0 ? (s.push(d), l.slice(0, u) + ve + l.slice(u) + _ + y) : l + _ + (u === -2 ? a : y);
19
19
  }
20
- return [$e(s, n + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), r];
20
+ return [ke(r, n + (r[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
21
21
  };
22
- class D {
23
- constructor({ strings: e, _$litType$: t }, r) {
22
+ class O {
23
+ constructor({ strings: e, _$litType$: t }, s) {
24
24
  let i;
25
25
  this.parts = [];
26
26
  let n = 0, o = 0;
27
- const a = e.length - 1, l = this.parts, [d, p] = Ue(e, t);
28
- if (this.el = D.createElement(d, r), k.currentNode = this.el.content, t === 2 || t === 3) {
27
+ const a = e.length - 1, l = this.parts, [d, p] = qe(e, t);
28
+ if (this.el = O.createElement(d, s), A.currentNode = this.el.content, t === 2 || t === 3) {
29
29
  const u = this.el.content.firstChild;
30
30
  u.replaceWith(...u.childNodes);
31
31
  }
32
- for (; (i = k.nextNode()) !== null && l.length < a; ) {
32
+ for (; (i = A.nextNode()) !== null && l.length < a; ) {
33
33
  if (i.nodeType === 1) {
34
- if (i.hasAttributes()) for (const u of i.getAttributeNames()) if (u.endsWith(xe)) {
35
- const h = p[o++], b = i.getAttribute(u).split(v), w = /([.?@])?(.*)/.exec(h);
36
- l.push({ type: 1, index: n, name: w[2], strings: b, ctor: w[1] === "." ? Ne : w[1] === "?" ? qe : w[1] === "@" ? He : L }), i.removeAttribute(u);
37
- } else u.startsWith(v) && (l.push({ type: 6, index: n }), i.removeAttribute(u));
38
- if (_e.test(i.tagName)) {
39
- const u = i.textContent.split(v), h = u.length - 1;
40
- if (h > 0) {
41
- i.textContent = B ? B.emptyScript : "";
42
- for (let b = 0; b < h; b++) i.append(u[b], O()), k.nextNode(), l.push({ type: 2, index: ++n });
43
- i.append(u[h], O());
34
+ if (i.hasAttributes()) for (const u of i.getAttributeNames()) if (u.endsWith(ve)) {
35
+ const f = p[o++], y = i.getAttribute(u).split(_), w = /([.?@])?(.*)/.exec(f);
36
+ l.push({ type: 1, index: n, name: w[2], strings: y, ctor: w[1] === "." ? je : w[1] === "?" ? We : w[1] === "@" ? Ve : U }), i.removeAttribute(u);
37
+ } else u.startsWith(_) && (l.push({ type: 6, index: n }), i.removeAttribute(u));
38
+ if ($e.test(i.tagName)) {
39
+ const u = i.textContent.split(_), f = u.length - 1;
40
+ if (f > 0) {
41
+ i.textContent = z ? z.emptyScript : "";
42
+ for (let y = 0; y < f; y++) i.append(u[y], N()), A.nextNode(), l.push({ type: 2, index: ++n });
43
+ i.append(u[f], N());
44
44
  }
45
45
  }
46
- } else if (i.nodeType === 8) if (i.data === ve) l.push({ type: 2, index: n });
46
+ } else if (i.nodeType === 8) if (i.data === _e) l.push({ type: 2, index: n });
47
47
  else {
48
48
  let u = -1;
49
- for (; (u = i.data.indexOf(v, u + 1)) !== -1; ) l.push({ type: 7, index: n }), u += v.length - 1;
49
+ for (; (u = i.data.indexOf(_, u + 1)) !== -1; ) l.push({ type: 7, index: n }), u += _.length - 1;
50
50
  }
51
51
  n++;
52
52
  }
53
53
  }
54
54
  static createElement(e, t) {
55
- const r = A.createElement("template");
56
- return r.innerHTML = e, r;
55
+ const s = F.createElement("template");
56
+ return s.innerHTML = e, s;
57
57
  }
58
58
  }
59
- function E(s, e, t = s, r) {
59
+ function E(r, e, t = r, s) {
60
60
  if (e === M) return e;
61
- let i = r !== void 0 ? t._$Co?.[r] : t._$Cl;
61
+ let i = s !== void 0 ? t._$Co?.[s] : t._$Cl;
62
62
  const n = R(e) ? void 0 : e._$litDirective$;
63
- return i?.constructor !== n && (i?._$AO?.(!1), n === void 0 ? i = void 0 : (i = new n(s), i._$AT(s, t, r)), r !== void 0 ? (t._$Co ??= [])[r] = i : t._$Cl = i), i !== void 0 && (e = E(s, i._$AS(s, e.values), i, r)), e;
63
+ return i?.constructor !== n && (i?._$AO?.(!1), n === void 0 ? i = void 0 : (i = new n(r), i._$AT(r, t, s)), s !== void 0 ? (t._$Co ??= [])[s] = i : t._$Cl = i), i !== void 0 && (e = E(r, i._$AS(r, e.values), i, s)), e;
64
64
  }
65
- class Le {
65
+ class He {
66
66
  constructor(e, t) {
67
67
  this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
68
68
  }
@@ -73,29 +73,29 @@ class Le {
73
73
  return this._$AM._$AU;
74
74
  }
75
75
  u(e) {
76
- const { el: { content: t }, parts: r } = this._$AD, i = (e?.creationScope ?? A).importNode(t, !0);
77
- k.currentNode = i;
78
- let n = k.nextNode(), o = 0, a = 0, l = r[0];
76
+ const { el: { content: t }, parts: s } = this._$AD, i = (e?.creationScope ?? F).importNode(t, !0);
77
+ A.currentNode = i;
78
+ let n = A.nextNode(), o = 0, a = 0, l = s[0];
79
79
  for (; l !== void 0; ) {
80
80
  if (o === l.index) {
81
81
  let d;
82
- l.type === 2 ? d = new U(n, n.nextSibling, this, e) : l.type === 1 ? d = new l.ctor(n, l.name, l.strings, this, e) : l.type === 6 && (d = new je(n, this, e)), this._$AV.push(d), l = r[++a];
82
+ l.type === 2 ? d = new B(n, n.nextSibling, this, e) : l.type === 1 ? d = new l.ctor(n, l.name, l.strings, this, e) : l.type === 6 && (d = new Ye(n, this, e)), this._$AV.push(d), l = s[++a];
83
83
  }
84
- o !== l?.index && (n = k.nextNode(), o++);
84
+ o !== l?.index && (n = A.nextNode(), o++);
85
85
  }
86
- return k.currentNode = A, i;
86
+ return A.currentNode = F, i;
87
87
  }
88
88
  p(e) {
89
89
  let t = 0;
90
- for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(e, r, t), t += r.strings.length - 2) : r._$AI(e[t])), t++;
90
+ for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(e, s, t), t += s.strings.length - 2) : s._$AI(e[t])), t++;
91
91
  }
92
92
  }
93
- class U {
93
+ class B {
94
94
  get _$AU() {
95
95
  return this._$AM?._$AU ?? this._$Cv;
96
96
  }
97
- constructor(e, t, r, i) {
98
- this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = r, this.options = i, this._$Cv = i?.isConnected ?? !0;
97
+ constructor(e, t, s, i) {
98
+ this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = s, this.options = i, this._$Cv = i?.isConnected ?? !0;
99
99
  }
100
100
  get parentNode() {
101
101
  let e = this._$AA.parentNode;
@@ -109,7 +109,7 @@ class U {
109
109
  return this._$AB;
110
110
  }
111
111
  _$AI(e, t = this) {
112
- e = E(this, e, t), R(e) ? e === m || e == null || e === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : e !== this._$AH && e !== M && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Oe(e) ? this.k(e) : this._(e);
112
+ e = E(this, e, t), R(e) ? e === m || e == null || e === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : e !== this._$AH && e !== M && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Le(e) ? this.k(e) : this._(e);
113
113
  }
114
114
  O(e) {
115
115
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -118,55 +118,55 @@ class U {
118
118
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
119
119
  }
120
120
  _(e) {
121
- this._$AH !== m && R(this._$AH) ? this._$AA.nextSibling.data = e : this.T(A.createTextNode(e)), this._$AH = e;
121
+ this._$AH !== m && R(this._$AH) ? this._$AA.nextSibling.data = e : this.T(F.createTextNode(e)), this._$AH = e;
122
122
  }
123
123
  $(e) {
124
- const { values: t, _$litType$: r } = e, i = typeof r == "number" ? this._$AC(e) : (r.el === void 0 && (r.el = D.createElement($e(r.h, r.h[0]), this.options)), r);
124
+ const { values: t, _$litType$: s } = e, i = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = O.createElement(ke(s.h, s.h[0]), this.options)), s);
125
125
  if (this._$AH?._$AD === i) this._$AH.p(t);
126
126
  else {
127
- const n = new Le(i, this), o = n.u(this.options);
127
+ const n = new He(i, this), o = n.u(this.options);
128
128
  n.p(t), this.T(o), this._$AH = n;
129
129
  }
130
130
  }
131
131
  _$AC(e) {
132
132
  let t = le.get(e.strings);
133
- return t === void 0 && le.set(e.strings, t = new D(e)), t;
133
+ return t === void 0 && le.set(e.strings, t = new O(e)), t;
134
134
  }
135
135
  k(e) {
136
136
  Q(this._$AH) || (this._$AH = [], this._$AR());
137
137
  const t = this._$AH;
138
- let r, i = 0;
139
- for (const n of e) i === t.length ? t.push(r = new U(this.O(O()), this.O(O()), this, this.options)) : r = t[i], r._$AI(n), i++;
140
- i < t.length && (this._$AR(r && r._$AB.nextSibling, i), t.length = i);
138
+ let s, i = 0;
139
+ for (const n of e) i === t.length ? t.push(s = new B(this.O(N()), this.O(N()), this, this.options)) : s = t[i], s._$AI(n), i++;
140
+ i < t.length && (this._$AR(s && s._$AB.nextSibling, i), t.length = i);
141
141
  }
142
142
  _$AR(e = this._$AA.nextSibling, t) {
143
143
  for (this._$AP?.(!1, !0, t); e !== this._$AB; ) {
144
- const r = re(e).nextSibling;
145
- re(e).remove(), e = r;
144
+ const s = se(e).nextSibling;
145
+ se(e).remove(), e = s;
146
146
  }
147
147
  }
148
148
  setConnected(e) {
149
149
  this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
150
150
  }
151
151
  }
152
- class L {
152
+ class U {
153
153
  get tagName() {
154
154
  return this.element.tagName;
155
155
  }
156
156
  get _$AU() {
157
157
  return this._$AM._$AU;
158
158
  }
159
- constructor(e, t, r, i, n) {
160
- this.type = 1, this._$AH = m, this._$AN = void 0, this.element = e, this.name = t, this._$AM = i, this.options = n, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = m;
159
+ constructor(e, t, s, i, n) {
160
+ this.type = 1, this._$AH = m, this._$AN = void 0, this.element = e, this.name = t, this._$AM = i, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = m;
161
161
  }
162
- _$AI(e, t = this, r, i) {
162
+ _$AI(e, t = this, s, i) {
163
163
  const n = this.strings;
164
164
  let o = !1;
165
165
  if (n === void 0) e = E(this, e, t, 0), o = !R(e) || e !== this._$AH && e !== M, o && (this._$AH = e);
166
166
  else {
167
167
  const a = e;
168
168
  let l, d;
169
- for (e = n[0], l = 0; l < n.length - 1; l++) d = E(this, a[r + l], t, l), d === M && (d = this._$AH[l]), o ||= !R(d) || d !== this._$AH[l], d === m ? e = m : e !== m && (e += (d ?? "") + n[l + 1]), this._$AH[l] = d;
169
+ for (e = n[0], l = 0; l < n.length - 1; l++) d = E(this, a[s + l], t, l), d === M && (d = this._$AH[l]), o ||= !R(d) || d !== this._$AH[l], d === m ? e = m : e !== m && (e += (d ?? "") + n[l + 1]), this._$AH[l] = d;
170
170
  }
171
171
  o && !i && this.j(e);
172
172
  }
@@ -174,7 +174,7 @@ class L {
174
174
  e === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
175
175
  }
176
176
  }
177
- class Ne extends L {
177
+ class je extends U {
178
178
  constructor() {
179
179
  super(...arguments), this.type = 3;
180
180
  }
@@ -182,7 +182,7 @@ class Ne extends L {
182
182
  this.element[this.name] = e === m ? void 0 : e;
183
183
  }
184
184
  }
185
- class qe extends L {
185
+ class We extends U {
186
186
  constructor() {
187
187
  super(...arguments), this.type = 4;
188
188
  }
@@ -190,22 +190,22 @@ class qe extends L {
190
190
  this.element.toggleAttribute(this.name, !!e && e !== m);
191
191
  }
192
192
  }
193
- class He extends L {
194
- constructor(e, t, r, i, n) {
195
- super(e, t, r, i, n), this.type = 5;
193
+ class Ve extends U {
194
+ constructor(e, t, s, i, n) {
195
+ super(e, t, s, i, n), this.type = 5;
196
196
  }
197
197
  _$AI(e, t = this) {
198
198
  if ((e = E(this, e, t, 0) ?? m) === M) return;
199
- const r = this._$AH, i = e === m && r !== m || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, n = e !== m && (r === m || i);
200
- i && this.element.removeEventListener(this.name, this, r), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
199
+ const s = this._$AH, i = e === m && s !== m || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, n = e !== m && (s === m || i);
200
+ i && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
201
201
  }
202
202
  handleEvent(e) {
203
203
  typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
204
204
  }
205
205
  }
206
- class je {
207
- constructor(e, t, r) {
208
- this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = r;
206
+ class Ye {
207
+ constructor(e, t, s) {
208
+ this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
209
209
  }
210
210
  get _$AU() {
211
211
  return this._$AM._$AU;
@@ -214,9 +214,9 @@ class je {
214
214
  E(this, e);
215
215
  }
216
216
  }
217
- const We = K.litHtmlPolyfillSupport;
218
- We?.(D, U), (K.litHtmlVersions ??= []).push("3.3.3");
219
- const ce = (s) => s ?? m, Ve = y`
217
+ const Ge = K.litHtmlPolyfillSupport;
218
+ Ge?.(O, B), (K.litHtmlVersions ??= []).push("3.3.3");
219
+ const ce = (r) => r ?? m, Ke = b`
220
220
  :host {
221
221
  display: block;
222
222
  box-sizing: border-box;
@@ -240,7 +240,7 @@ const ce = (s) => s ?? m, Ve = y`
240
240
  position: absolute; width: 1px; height: 1px; overflow: hidden;
241
241
  clip: rect(0 0 0 0); white-space: nowrap;
242
242
  }
243
- `, Ye = y`
243
+ `, Qe = b`
244
244
  @keyframes pop-in {
245
245
  0% { opacity: 0; transform: translateY(16px) scale(0.95); }
246
246
  100% { opacity: 1; transform: translateY(0) scale(1); }
@@ -271,7 +271,7 @@ const ce = (s) => s ?? m, Ve = y`
271
271
  animation: none !important;
272
272
  }
273
273
  }
274
- `, Ge = y`
274
+ `, Ze = b`
275
275
  .msg { max-width: 85%; padding: 12px 16px; border-radius: 14px; font-size: 15px; }
276
276
  .msg.bot {
277
277
  background: var(--wral-semantic-surface-default, #FFFFFF);
@@ -293,7 +293,7 @@ const ce = (s) => s ?? m, Ve = y`
293
293
  .msg .sub { display: block; font-size: 13px; color: var(--wral-semantic-fg-muted, #64748B); margin-top: 4px; }
294
294
  .msg.user .sub { color: rgba(255, 255, 255, 0.75); }
295
295
  .msg.error { border-left: 3px solid var(--wral-base-red-on-light, #D1232A); }
296
- `, Ke = y`
296
+ `, Je = b`
297
297
  .options { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; max-width: 92%; padding: 2px 0 6px; }
298
298
  .chip {
299
299
  font-family: var(--wral-base-font-ui, 'IBM Plex Sans Condensed', sans-serif);
@@ -307,7 +307,7 @@ const ce = (s) => s ?? m, Ve = y`
307
307
  .chip:hover { background: var(--wral-base-secondary-1, #2594E3); color: #FFFFFF; }
308
308
  .chip:focus-visible { outline: 2px solid var(--wral-base-secondary-1, #2594E3); outline-offset: 2px; }
309
309
  .chip:active { transform: scale(0.97); }
310
- `, Qe = y`
310
+ `, Xe = b`
311
311
  .form-card {
312
312
  align-self: stretch;
313
313
  background: var(--wral-semantic-surface-default, #FFFFFF);
@@ -372,7 +372,7 @@ const ce = (s) => s ?? m, Ve = y`
372
372
  .btn-ghost:hover { border-color: var(--wral-base-secondary-1, #2594E3); }
373
373
  .btn-ghost:active { transform: scale(0.97); }
374
374
  .btn-ghost:focus-visible { outline: 2px solid var(--wral-base-secondary-1, #2594E3); outline-offset: 2px; }
375
- `, Je = y`
375
+ `, et = b`
376
376
  .login-card { padding: 28px 26px; }
377
377
  .login-card h2 {
378
378
  font-family: var(--wral-base-font-display, 'IBM Plex Sans Condensed', sans-serif);
@@ -459,7 +459,7 @@ const ce = (s) => s ?? m, Ve = y`
459
459
  .anon-costs .x { flex-shrink: 0; font-weight: 700; color: var(--wral-base-red-on-light, #D1232A); }
460
460
  .anon-actions { display: flex; flex-direction: column; gap: 10px; }
461
461
  .anon-actions .btn-ghost { width: 100%; }
462
- `, Ze = y`
462
+ `, tt = b`
463
463
  .review-list { margin: 0; padding: 0; list-style: none; font-size: 14px; }
464
464
  .review-list li {
465
465
  display: grid; grid-template-columns: 130px 1fr; gap: 10px;
@@ -491,7 +491,7 @@ const ce = (s) => s ?? m, Ve = y`
491
491
  color: var(--wral-base-primary-1, #001D68);
492
492
  }
493
493
  @media (max-width: 540px) { .review-list li { grid-template-columns: 1fr; gap: 2px; } }
494
- `, Xe = y`
494
+ `, st = b`
495
495
  .upload-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; }
496
496
  .upload-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
497
497
  .upload-row .state { font-size: 12px; color: var(--wral-semantic-fg-subtle, #64748B); }
@@ -507,7 +507,7 @@ const ce = (s) => s ?? m, Ve = y`
507
507
  border-radius: 999px; padding: 3px 12px; cursor: pointer;
508
508
  }
509
509
  .retry-chip:focus-visible { outline: 2px solid var(--wral-base-secondary-1, #2594E3); outline-offset: 2px; }
510
- `, et = y`
510
+ `, rt = b`
511
511
  .confirm-card {
512
512
  align-self: stretch;
513
513
  background: var(--wral-base-primary-1, #001D68);
@@ -557,7 +557,23 @@ const ce = (s) => s ?? m, Ve = y`
557
557
  .c-again:hover { background: rgba(255, 255, 255, 0.12); }
558
558
  .c-again:focus-visible { outline: 2px solid var(--wral-base-secondary-2, #50A9E8); outline-offset: 2px; }
559
559
  .c-again:active { transform: scale(0.97); }
560
- `, tt = y`
560
+ .facts-offer dl {
561
+ display: grid; grid-template-columns: auto 1fr; gap: 4px 14px;
562
+ margin: 0 0 14px; font-size: 14.5px;
563
+ }
564
+ .facts-offer dt { font-weight: 700; color: var(--wral-semantic-fg-subtle, #64748B); }
565
+ .facts-offer dd { margin: 0; overflow-wrap: anywhere; }
566
+ .facts-offer .facts-note {
567
+ display: flex; gap: 8px; align-items: center;
568
+ margin: 0 0 14px; font-size: 13.5px;
569
+ color: var(--wral-semantic-fg-muted, #475569);
570
+ }
571
+ .facts-offer .my-wral-icon {
572
+ flex-shrink: 0; width: 28px; height: 28px;
573
+ color: var(--wral-base-primary-1, #001D68);
574
+ }
575
+ .facts-offer .actions { display: flex; flex-wrap: wrap; gap: 8px; }
576
+ `, it = b`
561
577
  .journey {
562
578
  align-self: stretch;
563
579
  background: var(--wral-semantic-surface-default, #FFFFFF);
@@ -598,7 +614,7 @@ const ce = (s) => s ?? m, Ve = y`
598
614
  color: var(--wral-base-primary-1, #001D68); margin-bottom: 2px;
599
615
  }
600
616
  .j-body .j-d { font-size: 13.5px; color: var(--wral-semantic-fg-muted, #475569); line-height: 1.55; }
601
- `, rt = y`
617
+ `, nt = b`
602
618
  .bottom-bar {
603
619
  position: sticky; bottom: 0; z-index: 20;
604
620
  background: var(--wral-semantic-surface-default, #FFFFFF);
@@ -611,73 +627,84 @@ const ce = (s) => s ?? m, Ve = y`
611
627
  }
612
628
  .bottom-bar .note { margin-left: auto; font-size: 12px; color: var(--wral-semantic-fg-subtle, #64748B); }
613
629
  @media (max-width: 540px) { .bottom-bar .note { display: none; } }
614
- `, st = [Ve, Ye, Ge, Ke, Qe, Je, Ze, Xe, et, tt, rt];
615
- function g(s, e, { noAnim: t = !1, error: r = !1 } = {}) {
630
+ `, ot = [Ke, Qe, Ze, Je, Xe, et, tt, st, rt, it, nt];
631
+ function g(r, e, { noAnim: t = !1, error: s = !1 } = {}) {
616
632
  return c`
617
- <div class="msg bot ${t ? "no-anim" : ""} ${r ? "error" : ""}">
618
- <span class="lead">${s}</span>
619
- ${e ? c`<span class="sub">${e}</span>` : f}
633
+ <div class="msg bot ${t ? "no-anim" : ""} ${s ? "error" : ""}">
634
+ <span class="lead">${r}</span>
635
+ ${e ? c`<span class="sub">${e}</span>` : h}
620
636
  </div>
621
637
  `;
622
638
  }
623
- function F(s, { noAnim: e = !1 } = {}) {
624
- return c`<div class="msg user ${e ? "no-anim" : ""}">${s}</div>`;
639
+ function v(r, { noAnim: e = !1 } = {}) {
640
+ return c`<div class="msg user ${e ? "no-anim" : ""}">${r}</div>`;
625
641
  }
626
642
  function j() {
627
643
  return c`<div class="msg bot typing"><span></span><span></span><span></span></div>`;
628
644
  }
629
- function it(s) {
630
- return s ? c`<span class="flag-pill ${s}">${s === "urgent" ? "Urgent" : "Moderate"}</span>` : f;
645
+ function at(r) {
646
+ return r ? c`<span class="flag-pill ${r}">${r === "urgent" ? "Urgent" : "Moderate"}</span>` : h;
631
647
  }
632
- function nt() {
648
+ function lt() {
633
649
  return c`
634
650
  <svg viewBox="0 0 24 24" fill="none" stroke="#FFFFFF" stroke-width="3"
635
651
  stroke-linecap="round" stroke-linejoin="round" width="20" height="20"
636
652
  aria-hidden="true"><path d="M20 6L9 17l-5-5"/></svg>
637
653
  `;
638
654
  }
639
- const ot = 15e3;
655
+ function ct() {
656
+ return c`
657
+ <svg class="my-wral-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 423 423">
658
+ <rect x="7.4" y="7.4" width="408.21" height="408.21" rx="204.1" ry="204.1" transform="translate(-46.49 60.15) rotate(-14.6)" fill="#fff"/>
659
+ <path d="M275.54,335.39c-6.35-4.36-6.31-10.09-2.64-8.95,2.38.89,7.28,2.02,12.45.67,28.16-7.34,33.71-60.25,33.4-90.88-8.42,12.43-14.4,23.62-24.46,26.24-6.04,1.57-15.9.23-23.04-3.63-9.31-5.1-13.58-10.91-16.81-23.31-4.04-15.5,1.11-47.55,3.78-60.89.07-.92.86-1.43,1.72-1.65,9.48-2.47,28.53,7.02,28.44,17.28.01,15.35-6.27,38.36-3.41,49.35.81,3.1,2.97,4.34,4.98,3.82,7.76-2.02,21.85-31.58,26.87-46.44,6.59-19.48,6.85-37.3,10.88-38.35,6.89-1.8,22.4,5.9,24.17,13.87,10.85,52.26.88,151.79-51.71,165.48-7.47,1.95-16.82,2.57-24.62-2.62Z" fill="currentColor"/>
660
+ <path d="M77.88,314.03c-4.19-16.07-3.14-35.61-2.89-44.1,1.84-47.14,4.3-84.81,13.75-133.32,1.05-5.39,4.7-9.05,16.15-7.52,10.8,1.4,14.78,6.08,16.1,11.16.66,2.54.97,6.07,2,11.22,12.38,1.59,15.13,5.09,19.64,14.15,4.58,9.34,6.28,17.03,8.04,23.79,2.72,10.43,4.49,18.4,7.34,26.99,11.89-22.67,15.82-55.9,34.99-75.34,6.66-6.25,10.81-9.14,15.41-10.34,3.74-.97,4.31-1.12,7.98-1.17,11.21-2.92,20.44,1.9,21.91,7.54.44,1.69,1.77,7.97,2,10.01,2.08,12.7-1.86,42.33-.69,73.93.66,15.48.93,25.95,2.42,36.4.75,5.22-.23,10.9-9.71,13.37-3.16.82-7.4,2.23-10.42,2.41-6.33.45-8.81-6.73-9.78-12.8-6.74-36.47,1.6-91.63-1.83-101.27-9.11,19.23-13.35,32.38-18.54,45.47-3.41,9.32-6.93,21.67-10.7,30.78-3.69,10.59-4.88,15.42-13.22,17.59-3.45.9-6.39,1.36-9.27,2.11-7.19,1.87-17.92-1.65-20.41-8.83-6.22-19.15-9-27.46-20.28-66.06-5.84,78.88-6.35,118.15.88,140.04,1.83,5.85-9.96,7.71-12.04,7.96-23,3.58-26.87-6.55-28.85-14.16Z" fill="currentColor"/>
661
+ <rect x="7.4" y="7.4" width="408.21" height="408.21" rx="204.1" ry="204.1" transform="translate(-46.49 60.15) rotate(-14.6)" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="2"/>
662
+ <rect x="7.4" y="7.4" width="408.21" height="408.21" rx="204.1" ry="204.1" transform="translate(-46.49 60.15) rotate(-14.6)" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="10"/>
663
+ </svg>
664
+ `;
665
+ }
666
+ const dt = 15e3;
640
667
  class I extends Error {
641
668
  constructor(e, t) {
642
669
  super(`api-forms request failed with status ${e}`), this.status = e, this.body = t;
643
670
  }
644
671
  }
645
672
  const de = Object.freeze({ enabled: !1, humanCheck: null });
646
- function at({
647
- baseUrl: s,
673
+ function ut({
674
+ baseUrl: r,
648
675
  fetchFn: e = (...i) => fetch(...i),
649
676
  xhrFactory: t = () => new XMLHttpRequest(),
650
- getAuthHeaders: r
677
+ getAuthHeaders: s
651
678
  }) {
652
- const i = String(s || "").replace(/\/+$/, "");
679
+ const i = String(r || "").replace(/\/+$/, "");
653
680
  let n = de, o = null;
654
- async function a(l, { method: d = "GET", body: p, auth: u = !1, timeoutMs: h } = {}) {
655
- const b = { Accept: "application/json" };
656
- u && Object.assign(b, o ? { Authorization: `Bearer ${o}` } : await r()), p !== void 0 && (b["Content-Type"] = "application/json");
681
+ async function a(l, { method: d = "GET", body: p, auth: u = !1, timeoutMs: f } = {}) {
682
+ const y = { Accept: "application/json" };
683
+ u && Object.assign(y, o ? { Authorization: `Bearer ${o}` } : await s()), p !== void 0 && (y["Content-Type"] = "application/json");
657
684
  let w;
658
685
  try {
659
686
  w = await e(`${i}${l}`, {
660
687
  method: d,
661
- headers: b,
662
- ...h ? { signal: AbortSignal.timeout(h) } : {},
688
+ headers: y,
689
+ ...f ? { signal: AbortSignal.timeout(f) } : {},
663
690
  ...p !== void 0 ? { body: JSON.stringify(p) } : {}
664
691
  });
665
- } catch (P) {
666
- throw Object.assign(new I(0, null), { cause: P });
692
+ } catch (D) {
693
+ throw Object.assign(new I(0, null), { cause: D });
667
694
  }
668
- let _ = null;
695
+ let $ = null;
669
696
  try {
670
- _ = await w.json();
697
+ $ = await w.json();
671
698
  } catch {
672
699
  }
673
700
  if (!w.ok)
674
- throw new I(w.status, _);
675
- return _;
701
+ throw new I(w.status, $);
702
+ return $;
676
703
  }
677
704
  return {
678
705
  /** @returns {Promise<Array>} published form documents */
679
706
  listForms: async () => {
680
- const l = await a("/v1/forms", { timeoutMs: ot });
707
+ const l = await a("/v1/forms", { timeoutMs: dt });
681
708
  return n = l?.anonymous?.enabled === !0 ? { enabled: !0, humanCheck: l.anonymous.humanCheck || null } : de, (l?.forms || []).filter((d) => d?.formId && d?.start && Array.isArray(d?.nodes));
682
709
  },
683
710
  /**
@@ -715,85 +742,177 @@ function at({
715
742
  */
716
743
  uploadFile: ({ url: l, file: d, contentType: p, onProgress: u = () => {
717
744
  } }) => {
718
- const h = t();
719
- return { promise: new Promise((w, _) => {
720
- h.open("PUT", l), h.setRequestHeader("Content-Type", p || d.type), h.upload && (h.upload.onprogress = (P) => {
721
- u({ loaded: P.loaded, total: P.total || d.size });
722
- }), h.onload = () => {
723
- h.status >= 200 && h.status < 300 ? w({ status: h.status }) : _(new I(h.status, null));
724
- }, h.onerror = () => _(new I(0, null)), h.onabort = () => _(new I(0, { aborted: !0 })), h.send(d);
725
- }), abort: () => h.abort() };
745
+ const f = t();
746
+ return { promise: new Promise((w, $) => {
747
+ f.open("PUT", l), f.setRequestHeader("Content-Type", p || d.type), f.upload && (f.upload.onprogress = (D) => {
748
+ u({ loaded: D.loaded, total: D.total || d.size });
749
+ }), f.onload = () => {
750
+ f.status >= 200 && f.status < 300 ? w({ status: f.status }) : $(new I(f.status, null));
751
+ }, f.onerror = () => $(new I(0, null)), f.onabort = () => $(new I(0, { aborted: !0 })), f.send(d);
752
+ }), abort: () => f.abort() };
726
753
  },
727
754
  /** @returns {Promise<{requestId,reference,confirmation,routing}>} */
728
755
  putRequest: async (l, d) => await a(`/v1/requests/${l}`, { method: "PUT", body: d, auth: !0 })
729
756
  };
730
757
  }
731
758
  const ue = 60 * 1e3;
732
- async function lt({ read: s, refresh: e, now: t = Date.now }) {
733
- const r = (n) => {
734
- const { token: o, expiry: a } = s() || {};
759
+ async function pt({ read: r, refresh: e, now: t = Date.now }) {
760
+ const s = (n) => {
761
+ const { token: o, expiry: a } = r() || {};
735
762
  return o && Number(a) - n > t() ? o : null;
736
763
  };
737
- let i = r(ue);
764
+ let i = s(ue);
738
765
  if (!i) {
739
766
  try {
740
767
  await e();
741
768
  } catch {
742
769
  }
743
- i = r(ue) || r(0);
770
+ i = s(ue) || s(0);
744
771
  }
745
772
  if (!i)
746
773
  throw Object.assign(new Error("Please sign in again to continue."), { status: 401, body: null });
747
774
  return { Authorization: `Bearer ${i}` };
748
775
  }
749
- function ct() {
750
- const { config: s, storage: e } = Se();
751
- let t = null;
776
+ const pe = (r) => String(r || "").toLowerCase().trim();
777
+ function ht(r) {
778
+ const e = /* @__PURE__ */ new Set();
752
779
  return {
753
- isAuthenticated: () => ze(),
754
- signedInEmail: () => e.get(S.userEmail) || null,
755
- /* The ID token, so api-forms can record the verified email (../lib/id-token.mjs). */
756
- getAuthHeaders: () => lt({
757
- read: () => ({
758
- token: e.get(S.idToken),
759
- expiry: e.get(S.idTokenExpiry)
760
- }),
761
- refresh: () => te()
780
+ signUpIfNeeded: async (t, ...s) => {
781
+ const i = await r(t, ...s);
782
+ return i?.exists === !1 && !i.error && e.add(pe(t)), i;
783
+ },
784
+ isNewAccount: (t) => e.has(pe(t))
785
+ };
786
+ }
787
+ const ft = "wral_user_facts", mt = "1", gt = 100;
788
+ function yt(r, e) {
789
+ let t = "";
790
+ for (const s of r) {
791
+ if (t.length + s.length > e) break;
792
+ t += s;
793
+ }
794
+ return t;
795
+ }
796
+ const bt = [
797
+ {
798
+ autocomplete: "name",
799
+ factName: "preferred_name",
800
+ label: "Name",
801
+ shape: (r) => {
802
+ const e = String(r ?? "").replace(/\s+/g, " ").trim();
803
+ return e ? yt(e, gt).trim() : null;
804
+ }
805
+ },
806
+ {
807
+ autocomplete: "postal-code",
808
+ factName: "zipcode",
809
+ label: "Zip code",
810
+ shape: (r) => String(r ?? "").trim().match(/^(\d{5})(-\d{4})?$/)?.[1] ?? null
811
+ }
812
+ ];
813
+ function wt(r = [], e = {}) {
814
+ const t = [];
815
+ for (const s of bt) {
816
+ const i = r.find((n) => n?.kind === "text" && n.autocomplete === s.autocomplete && s.shape(e[n.key]) !== null);
817
+ i && t.push({ factName: s.factName, label: s.label, value: s.shape(e[i.key]) });
818
+ }
819
+ return t;
820
+ }
821
+ async function xt(r, {
822
+ baseUrl: e,
823
+ getAuthHeaders: t,
824
+ fetchFn: s = (...n) => fetch(...n),
825
+ onSaved: i = () => {
826
+ }
827
+ }) {
828
+ const n = String(e).replace(/\/+$/, "");
829
+ let o = !1;
830
+ try {
831
+ for (const { factName: a, value: l } of r) {
832
+ const d = { "Content-Type": "application/json", ...await t() };
833
+ let p;
834
+ try {
835
+ p = await s(
836
+ `${n}/user/${encodeURIComponent(a)}/${mt}`,
837
+ { method: "PUT", headers: d, body: JSON.stringify({ value: l }) }
838
+ );
839
+ } catch (u) {
840
+ throw Object.assign(new Error("user-facts request failed"), { status: 0, cause: u });
841
+ }
842
+ if (!p.ok)
843
+ throw Object.assign(
844
+ new Error(`user-facts request failed with status ${p.status}`),
845
+ { status: p.status }
846
+ );
847
+ o = !0;
848
+ }
849
+ } finally {
850
+ o && i();
851
+ }
852
+ }
853
+ function vt({ factsBaseUrl: r } = {}) {
854
+ const { config: e, storage: t } = Re(), s = ht(Be);
855
+ let i = null;
856
+ const n = () => pt({
857
+ read: () => ({
858
+ token: t.get(S.idToken),
859
+ expiry: t.get(S.idTokenExpiry)
762
860
  }),
861
+ refresh: () => te()
862
+ });
863
+ return {
864
+ isAuthenticated: () => Ne(),
865
+ signedInEmail: () => t.get(S.userEmail) || null,
866
+ getAuthHeaders: n,
867
+ /* Save mapped answers (../lib/user-facts.mjs) to the viewer's My WRAL user facts. */
868
+ ...r ? {
869
+ saveUserFacts: (o) => xt(o, {
870
+ baseUrl: r,
871
+ getAuthHeaders: n,
872
+ onSaved: () => {
873
+ try {
874
+ localStorage.removeItem(ft);
875
+ } catch {
876
+ }
877
+ }
878
+ })
879
+ } : {},
763
880
  /**
764
881
  * Email step. Keeps the challenge user in memory for verifyCode.
765
- * @returns {{challengeRequired?: boolean, authenticated?: boolean}}
882
+ * `newAccount` is true when this page load created the account.
883
+ * @returns {{challengeRequired?: boolean, authenticated?: boolean, newAccount: boolean}}
766
884
  */
767
- sendCode: async (r) => {
768
- const i = await Re(
769
- s,
770
- r,
885
+ sendCode: async (o) => {
886
+ const a = await De(
771
887
  e,
772
- Me,
773
- De,
888
+ o,
889
+ t,
774
890
  Pe,
775
- Z,
891
+ s.signUpIfNeeded,
892
+ ze,
893
+ J,
776
894
  X,
777
895
  ee
778
896
  );
779
- return t = i.cognitoUser || null, {
780
- challengeRequired: !!i.challengeRequired,
781
- authenticated: !!i.authenticated
897
+ return i = a.cognitoUser || null, {
898
+ challengeRequired: !!a.challengeRequired,
899
+ authenticated: !!a.authenticated,
900
+ newAccount: s.isNewAccount(o)
782
901
  };
783
902
  },
784
903
  /**
785
904
  * Code step; refreshes immediately after verify so the session
786
905
  * starts with a full lifetime (house pattern).
787
906
  */
788
- verifyCode: async (r) => {
789
- if (!t)
907
+ verifyCode: async (o) => {
908
+ if (!i)
790
909
  throw new Error("Please enter your email again to get a new code.");
791
910
  try {
792
- await Te(
911
+ await Oe(
912
+ i,
913
+ o,
793
914
  t,
794
- r,
795
- e,
796
- Z,
915
+ J,
797
916
  X,
798
917
  ee
799
918
  );
@@ -804,133 +923,133 @@ function ct() {
804
923
  },
805
924
  /** Local sign-out only ("use a different email"). */
806
925
  signOut: () => {
807
- t = null, Ce().clear();
926
+ i = null, Me().clear();
808
927
  },
809
928
  /**
810
929
  * Detect a login completed in ANOTHER tab (the storage event
811
930
  * never fires in the tab that wrote). Returns an unsubscribe.
812
931
  */
813
- onCrossTabLogin: (r) => {
814
- const i = (n) => {
815
- (n.key === S.accessToken || n.key === S.idToken) && r();
932
+ onCrossTabLogin: (o) => {
933
+ const a = (l) => {
934
+ (l.key === S.accessToken || l.key === S.idToken) && o();
816
935
  };
817
- return window.addEventListener("storage", i), () => window.removeEventListener("storage", i);
936
+ return window.addEventListener("storage", a), () => window.removeEventListener("storage", a);
818
937
  }
819
938
  };
820
939
  }
821
- function dt({ baseUrl: s }) {
822
- const e = ct();
823
- return { ...at({ baseUrl: s, getAuthHeaders: e.getAuthHeaders }), ...e };
940
+ function _t({ baseUrl: r, factsBaseUrl: e }) {
941
+ const t = vt({ factsBaseUrl: e });
942
+ return { ...ut({ baseUrl: r, getAuthHeaders: t.getAuthHeaders }), ...t };
824
943
  }
825
- function x(s, e) {
826
- return (s?.nodes || []).find((t) => t.id === e);
944
+ function x(r, e) {
945
+ return (r?.nodes || []).find((t) => t.id === e);
827
946
  }
828
- function N(s) {
829
- return s?.form ? { formId: s.form, path: [...s.path || []] } : null;
947
+ function L(r) {
948
+ return r?.form ? { formId: r.form, path: [...r.path || []] } : null;
830
949
  }
831
- function q(s, e = []) {
950
+ function q(r, e = []) {
832
951
  const t = [];
833
- let r = s?.start;
952
+ let s = r?.start;
834
953
  for (const n of e) {
835
- const o = x(s, r);
954
+ const o = x(r, s);
836
955
  if (!o)
837
- return { nodeId: null, node: null, flags: t, error: { step: n, reason: `unknown node: ${r}` } };
956
+ return { nodeId: null, node: null, flags: t, error: { step: n, reason: `unknown node: ${s}` } };
838
957
  if (o.type === "terminal" || o.type === "redirect")
839
958
  return { nodeId: null, node: null, flags: t, error: { step: n, reason: `steps continue past ${o.type}` } };
840
- if (n.nodeId !== r || n.kind !== o.type)
841
- return { nodeId: null, node: null, flags: t, error: { step: n, reason: `step does not match node ${r}` } };
959
+ if (n.nodeId !== s || n.kind !== o.type)
960
+ return { nodeId: null, node: null, flags: t, error: { step: n, reason: `step does not match node ${s}` } };
842
961
  if (o.type === "choice") {
843
962
  const a = (o.options || []).find((l) => l.id === n.optionId);
844
963
  if (!a)
845
964
  return { nodeId: null, node: null, flags: t, error: { step: n, reason: `unknown option: ${n.optionId}` } };
846
- if (N(a))
965
+ if (L(a))
847
966
  return { nodeId: null, node: null, flags: t, error: { step: n, reason: `steps continue past a hand-off: ${n.optionId}` } };
848
- t.push(...a.flags || []), r = a.next;
967
+ t.push(...a.flags || []), s = a.next;
849
968
  continue;
850
969
  }
851
- r = o.next;
970
+ s = o.next;
852
971
  }
853
- const i = x(s, r);
854
- return i ? { nodeId: r, node: i, flags: Ae(t), error: null } : { nodeId: null, node: null, flags: t, error: { step: null, reason: `unknown node: ${r}` } };
972
+ const i = x(r, s);
973
+ return i ? { nodeId: s, node: i, flags: Ee(t), error: null } : { nodeId: null, node: null, flags: t, error: { step: null, reason: `unknown node: ${s}` } };
855
974
  }
856
- function ut(s, e = []) {
975
+ function Ae(r, e = []) {
857
976
  const t = [];
858
- for (const r of e) {
859
- if (r.kind !== "collect") continue;
860
- const i = x(s, r.nodeId);
977
+ for (const s of e) {
978
+ if (s.kind !== "collect") continue;
979
+ const i = x(r, s.nodeId);
861
980
  t.push(...i?.fields || []);
862
981
  }
863
982
  return t;
864
983
  }
865
- function pt(s = []) {
984
+ function Fe(r = []) {
866
985
  const e = {};
867
- for (const t of s)
986
+ for (const t of r)
868
987
  t.kind === "collect" && Object.assign(e, t.values || {});
869
988
  return e;
870
989
  }
871
- function ht(s = []) {
872
- return s.filter((e) => e.kind === "choice").map((e) => `${e.nodeId}:${e.optionId}`);
990
+ function $t(r = []) {
991
+ return r.filter((e) => e.kind === "choice").map((e) => `${e.nodeId}:${e.optionId}`);
873
992
  }
874
- function ke(s, e = []) {
993
+ function Ie(r, e = []) {
875
994
  const t = [];
876
- for (const r of e) {
877
- if (r.kind !== "choice") continue;
878
- const n = (x(s, r.nodeId)?.options || []).find((o) => o.id === r.optionId);
995
+ for (const s of e) {
996
+ if (s.kind !== "choice") continue;
997
+ const n = (x(r, s.nodeId)?.options || []).find((o) => o.id === s.optionId);
879
998
  t.push(...n?.flags || []);
880
999
  }
881
- return Ae(t);
1000
+ return Ee(t);
882
1001
  }
883
- function ft(s = []) {
884
- return s.includes("urgent") ? "urgent" : s.includes("moderate") ? "moderate" : null;
1002
+ function kt(r = []) {
1003
+ return r.includes("urgent") ? "urgent" : r.includes("moderate") ? "moderate" : null;
885
1004
  }
886
- function Ae(s) {
887
- return [...new Set(s)];
1005
+ function Ee(r) {
1006
+ return [...new Set(r)];
888
1007
  }
889
- function mt(s, e = []) {
1008
+ function At(r, e = []) {
890
1009
  const t = [];
891
1010
  for (const i of e) {
892
- const [n, o] = String(i).split(":"), a = x(s, n), l = a?.type === "choice" ? (a.options || []).find((d) => d.id === o) : null;
1011
+ const [n, o] = String(i).split(":"), a = x(r, n), l = a?.type === "choice" ? (a.options || []).find((d) => d.id === o) : null;
893
1012
  if (!l)
894
1013
  return { steps: [], error: `unknown preset step: ${i}` };
895
1014
  t.push({ nodeId: n, kind: "choice", optionId: o, label: l.label, preset: !0 });
896
1015
  }
897
- const { error: r } = q(s, t);
898
- return r ? { steps: [], error: r.reason } : { steps: t, error: null };
1016
+ const { error: s } = q(r, t);
1017
+ return s ? { steps: [], error: s.reason } : { steps: t, error: null };
899
1018
  }
900
- function gt(s, e) {
901
- const t = N(e);
1019
+ function Ft(r, e) {
1020
+ const t = L(e);
902
1021
  if (!t) return { form: null, steps: [], error: "not a hand-off" };
903
- const r = (s || []).find((o) => o.formId === t.formId);
904
- if (!r) return { form: null, steps: [], error: `unknown form: ${t.formId}` };
905
- const { steps: i, error: n } = mt(r, t.path);
906
- return n ? { form: null, steps: [], error: n } : { form: r, steps: i, error: null };
1022
+ const s = (r || []).find((o) => o.formId === t.formId);
1023
+ if (!s) return { form: null, steps: [], error: `unknown form: ${t.formId}` };
1024
+ const { steps: i, error: n } = At(s, t.path);
1025
+ return n ? { form: null, steps: [], error: n } : { form: s, steps: i, error: null };
907
1026
  }
908
- function bt(s, e, t, r) {
1027
+ function It(r, e, t, s) {
909
1028
  return {
910
- form: s,
1029
+ form: r,
911
1030
  steps: e,
912
- option: { nodeId: t.id, optionId: r.id, label: r.label }
1031
+ option: { nodeId: t.id, optionId: s.id, label: s.label }
913
1032
  };
914
1033
  }
915
- function yt(s = []) {
916
- return s.every((e) => e.preset === !0);
1034
+ function Et(r = []) {
1035
+ return r.every((e) => e.preset === !0);
917
1036
  }
918
- function wt(s, e, t) {
919
- if (!Array.isArray(s) || !s.length) return [];
920
- const r = [];
921
- for (let i = 0; i < s.length; i++) {
922
- const n = s[i], o = (e || []).find((u) => u.formId === n?.formId);
1037
+ function St(r, e, t) {
1038
+ if (!Array.isArray(r) || !r.length) return [];
1039
+ const s = [];
1040
+ for (let i = 0; i < r.length; i++) {
1041
+ const n = r[i], o = (e || []).find((u) => u.formId === n?.formId);
923
1042
  if (!o) return [];
924
1043
  const { node: a, error: l } = q(o, n.steps || []);
925
1044
  if (l || a?.id !== n.option?.nodeId) return [];
926
- const d = (a.options || []).find((u) => u.id === n.option.optionId), p = i + 1 < s.length ? s[i + 1].formId : t;
927
- if (N(d)?.formId !== p) return [];
928
- r.push({ form: o, steps: n.steps || [], option: n.option });
1045
+ const d = (a.options || []).find((u) => u.id === n.option.optionId), p = i + 1 < r.length ? r[i + 1].formId : t;
1046
+ if (L(d)?.formId !== p) return [];
1047
+ s.push({ form: o, steps: n.steps || [], option: n.option });
929
1048
  }
930
- return r;
1049
+ return s;
931
1050
  }
932
- function xt({ attr: s = null, search: e = "" } = {}) {
933
- const t = String(s ?? "").trim();
1051
+ function Ct({ attr: r = null, search: e = "" } = {}) {
1052
+ const t = String(r ?? "").trim();
934
1053
  if (t) return t;
935
1054
  try {
936
1055
  return new URLSearchParams(e || "").get("flow")?.trim() || null;
@@ -938,44 +1057,44 @@ function xt({ attr: s = null, search: e = "" } = {}) {
938
1057
  return null;
939
1058
  }
940
1059
  }
941
- function vt(s, e) {
942
- return e && (s || []).find((t) => t.formId === e) || null;
1060
+ function Tt(r, e) {
1061
+ return e && (r || []).find((t) => t.formId === e) || null;
943
1062
  }
944
- function _t(s, e) {
945
- return !e || s?.form?.formId === e ? !0 : (s?.origins || []).some((t) => t.form?.formId === e);
1063
+ function Rt(r, e) {
1064
+ return !e || r?.form?.formId === e ? !0 : (r?.origins || []).some((t) => t.form?.formId === e);
946
1065
  }
947
- const $t = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/, pe = {
1066
+ const Mt = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/, he = {
948
1067
  text: 500,
949
1068
  textarea: 5e3,
950
1069
  url: 2048
951
- }, kt = "Please confirm the rights statement so we can use what you send.";
952
- function Fe(s, { mediaCount: e = 0 } = {}) {
953
- return s.kind === "consent" && s.requiredIf === "media" ? e > 0 : !!s.required;
1070
+ }, Ot = "Please confirm the rights statement so we can use what you send.";
1071
+ function Se(r, { mediaCount: e = 0 } = {}) {
1072
+ return r.kind === "consent" && r.requiredIf === "media" ? e > 0 : !!r.required;
954
1073
  }
955
- function At(s, e) {
1074
+ function Dt(r, e) {
956
1075
  try {
957
- return new RegExp(s, "u").test(e);
1076
+ return new RegExp(r, "u").test(e);
958
1077
  } catch {
959
1078
  return !0;
960
1079
  }
961
1080
  }
962
- function Ft(s) {
963
- return s.key === "zip" ? "Please enter a five-digit zip code." : `Please check the format of ${s.label.toLowerCase()}.`;
1081
+ function Pt(r) {
1082
+ return r.key === "zip" ? "Please enter a five-digit zip code." : `Please check the format of ${r.label.toLowerCase()}.`;
964
1083
  }
965
- function It(s, e, { mediaCount: t = 0 } = {}) {
966
- const r = Fe(s, { mediaCount: t });
967
- if (s.kind === "consent")
968
- return e === !0 || !r ? null : kt;
969
- if (e == null || e === "" || s.kind === "location" && Et(e))
970
- return r ? `Please fill in: ${s.label.toLowerCase()}.` : null;
971
- switch (s.kind) {
1084
+ function zt(r, e, { mediaCount: t = 0 } = {}) {
1085
+ const s = Se(r, { mediaCount: t });
1086
+ if (r.kind === "consent")
1087
+ return e === !0 || !s ? null : Ot;
1088
+ if (e == null || e === "" || r.kind === "location" && Nt(e))
1089
+ return s ? `Please fill in: ${r.label.toLowerCase()}.` : null;
1090
+ switch (r.kind) {
972
1091
  case "text":
973
1092
  case "textarea": {
974
- const n = s.maxLength || pe[s.kind];
975
- return typeof e != "string" ? `Please enter text for ${s.label.toLowerCase()}.` : e.length > n ? `Please keep ${s.label.toLowerCase()} under ${n} characters.` : s.kind === "text" && s.pattern && !At(s.pattern, e) ? Ft(s) : null;
1093
+ const n = r.maxLength || he[r.kind];
1094
+ return typeof e != "string" ? `Please enter text for ${r.label.toLowerCase()}.` : e.length > n ? `Please keep ${r.label.toLowerCase()} under ${n} characters.` : r.kind === "text" && r.pattern && !Dt(r.pattern, e) ? Pt(r) : null;
976
1095
  }
977
1096
  case "url": {
978
- if (typeof e != "string" || e.length > pe.url)
1097
+ if (typeof e != "string" || e.length > he.url)
979
1098
  return "Please enter a valid link.";
980
1099
  try {
981
1100
  return new URL(e), null;
@@ -984,42 +1103,42 @@ function It(s, e, { mediaCount: t = 0 } = {}) {
984
1103
  }
985
1104
  }
986
1105
  case "datetime":
987
- return $t.test(String(e)) ? null : "Please pick a date and time.";
1106
+ return Mt.test(String(e)) ? null : "Please pick a date and time.";
988
1107
  case "select":
989
- return (s.options || []).map((o) => o.id).includes(e) ? null : `Please choose one of the options for ${s.label.toLowerCase()}.`;
1108
+ return (r.options || []).map((o) => o.id).includes(e) ? null : `Please choose one of the options for ${r.label.toLowerCase()}.`;
990
1109
  case "location":
991
- return St(s, e);
1110
+ return Bt(r, e);
992
1111
  case "media":
993
1112
  return null;
994
1113
  default:
995
- return `Unsupported field: ${s.kind}`;
1114
+ return `Unsupported field: ${r.kind}`;
996
1115
  }
997
1116
  }
998
- function Et(s) {
999
- return s == null ? !0 : typeof s != "object" ? !1 : !s.county && !s.where && !(Array.isArray(s.gps) && s.gps.length);
1117
+ function Nt(r) {
1118
+ return r == null ? !0 : typeof r != "object" ? !1 : !r.county && !r.where && !(Array.isArray(r.gps) && r.gps.length);
1000
1119
  }
1001
- function St(s, e) {
1002
- return typeof e != "object" || Array.isArray(e) ? "Please tell us where this was." : e.county !== void 0 && (typeof e.county != "string" || e.county.length > 100) ? "Please choose a county." : e.where !== void 0 && (typeof e.where != "string" || e.where.length > 500) ? "Please shorten the location description." : e.gps !== void 0 && !(Array.isArray(e.gps) && e.gps.length === 2 && e.gps.every((r) => typeof r == "number" && Number.isFinite(r))) ? "Location coordinates look wrong; try re-sharing your location." : s.required && !e.county && !e.where ? `Please fill in: ${s.label.toLowerCase()}.` : null;
1120
+ function Bt(r, e) {
1121
+ return typeof e != "object" || Array.isArray(e) ? "Please tell us where this was." : e.county !== void 0 && (typeof e.county != "string" || e.county.length > 100) ? "Please choose a county." : e.where !== void 0 && (typeof e.where != "string" || e.where.length > 500) ? "Please shorten the location description." : e.gps !== void 0 && !(Array.isArray(e.gps) && e.gps.length === 2 && e.gps.every((s) => typeof s == "number" && Number.isFinite(s))) ? "Location coordinates look wrong; try re-sharing your location." : r.required && !e.county && !e.where ? `Please fill in: ${r.label.toLowerCase()}.` : null;
1003
1122
  }
1004
- function he(s, e = {}, { mediaCount: t = 0 } = {}) {
1005
- const r = {};
1006
- for (const i of s) {
1123
+ function fe(r, e = {}, { mediaCount: t = 0 } = {}) {
1124
+ const s = {};
1125
+ for (const i of r) {
1007
1126
  if (i.kind === "media") continue;
1008
- const n = It(i, e[i.key], { mediaCount: t });
1009
- n && (r[i.key] = n);
1127
+ const n = zt(i, e[i.key], { mediaCount: t });
1128
+ n && (s[i.key] = n);
1010
1129
  }
1011
- return { ok: Object.keys(r).length === 0, errors: r };
1130
+ return { ok: Object.keys(s).length === 0, errors: s };
1012
1131
  }
1013
- function Y(s = [], e = {}, { required: t = !1 } = {}) {
1132
+ function Y(r = [], e = {}, { required: t = !1 } = {}) {
1014
1133
  const {
1015
- maxFiles: r = 5,
1134
+ maxFiles: s = 5,
1016
1135
  maxFileBytes: i = 512 * 1024 * 1024,
1017
1136
  allowedTypes: n = []
1018
1137
  } = e, o = [];
1019
- return t && s.length === 0 && o.push({ reason: "required", message: "Please attach at least one photo or video." }), s.length > r && o.push({
1138
+ return t && r.length === 0 && o.push({ reason: "required", message: "Please attach at least one photo or video." }), r.length > s && o.push({
1020
1139
  reason: "count",
1021
- message: `This form accepts at most ${r} ${r === 1 ? "file" : "files"}.`
1022
- }), s.forEach((a, l) => {
1140
+ message: `This form accepts at most ${s} ${s === 1 ? "file" : "files"}.`
1141
+ }), r.forEach((a, l) => {
1023
1142
  n.length && !n.includes(a.type) && o.push({
1024
1143
  index: l,
1025
1144
  reason: "type",
@@ -1031,16 +1150,16 @@ function Y(s = [], e = {}, { required: t = !1 } = {}) {
1031
1150
  });
1032
1151
  }), { ok: o.length === 0, errors: o };
1033
1152
  }
1034
- function fe({ formId: s, requestId: e, files: t }) {
1153
+ function me({ formId: r, requestId: e, files: t }) {
1035
1154
  return {
1036
- formId: s,
1155
+ formId: r,
1037
1156
  requestId: e,
1038
- files: t.map((r) => ({ contentType: r.type, size: r.size }))
1157
+ files: t.map((s) => ({ contentType: s.type, size: s.size }))
1039
1158
  };
1040
1159
  }
1041
- function Ct({ form: s, steps: e, media: t = [] }) {
1042
- const r = ut(s, e), i = pt(e), n = {};
1043
- for (const o of r) {
1160
+ function Ut({ form: r, steps: e, media: t = [] }) {
1161
+ const s = Ae(r, e), i = Fe(e), n = {};
1162
+ for (const o of s) {
1044
1163
  if (o.kind === "media") continue;
1045
1164
  const a = i[o.key];
1046
1165
  if (!(a == null || a === "") && !(o.kind === "consent" && (a !== !0 || o.requiredIf === "media" && !t.length))) {
@@ -1053,39 +1172,39 @@ function Ct({ form: s, steps: e, media: t = [] }) {
1053
1172
  }
1054
1173
  }
1055
1174
  return {
1056
- formId: s.formId,
1057
- flowVersion: s.flowVersion,
1058
- path: ht(e),
1175
+ formId: r.formId,
1176
+ flowVersion: r.flowVersion,
1177
+ path: $t(e),
1059
1178
  answers: n,
1060
1179
  media: t.map(({ assetId: o, type: a }) => ({ assetId: o, type: a }))
1061
1180
  };
1062
1181
  }
1063
- function me(s, e) {
1064
- if (s === 429)
1182
+ function ge(r, e) {
1183
+ if (r === 429)
1065
1184
  return {
1066
1185
  kind: "throttled",
1067
1186
  message: e?.message || "You have reached the submission limit; please try again later.",
1068
1187
  limit: e?.limit,
1069
1188
  retryAfter: e?.retryAfter
1070
1189
  };
1071
- if (s === 401)
1190
+ if (r === 401)
1072
1191
  return { kind: "auth", message: "Please sign in again to continue." };
1073
- if (s === 403)
1192
+ if (r === 403)
1074
1193
  return { kind: "forbidden", message: e?.message || "This submission belongs to another account." };
1075
- if (s === 404)
1194
+ if (r === 404)
1076
1195
  return { kind: "unknown-form", message: "This form is no longer available." };
1077
- if (s === 409)
1196
+ if (r === 409)
1078
1197
  return {
1079
1198
  kind: "stale",
1080
1199
  message: e?.message || "The form changed while you were filling it out; please review and resubmit."
1081
1200
  };
1082
- if (s === 400 && e?.code === "media-not-verified")
1201
+ if (r === 400 && e?.code === "media-not-verified")
1083
1202
  return {
1084
1203
  kind: "media",
1085
1204
  message: e.message || "An attached file is missing or does not match this submission.",
1086
1205
  assetId: e.assetId
1087
1206
  };
1088
- if (s === 400 && Array.isArray(e)) {
1207
+ if (r === 400 && Array.isArray(e)) {
1089
1208
  const t = e[0] || {};
1090
1209
  return {
1091
1210
  kind: "validation",
@@ -1093,58 +1212,58 @@ function me(s, e) {
1093
1212
  fieldKey: String(t.instancePath || "").split("/").filter(Boolean)[0] || null
1094
1213
  };
1095
1214
  }
1096
- return s === 0 ? { kind: "network", message: "We could not reach WRAL; check your connection and try again." } : {
1215
+ return r === 0 ? { kind: "network", message: "We could not reach WRAL; check your connection and try again." } : {
1097
1216
  kind: "server",
1098
1217
  message: "Something went wrong on our end; please try again."
1099
1218
  };
1100
1219
  }
1101
- const Tt = 34, Rt = 44;
1102
- function ge(s, e) {
1103
- const t = String(s);
1220
+ const Lt = 34, qt = 44;
1221
+ function ye(r, e) {
1222
+ const t = String(r);
1104
1223
  return t.length > e ? `${t.slice(0, e)}…` : t;
1105
1224
  }
1106
- function Mt(s, e) {
1107
- const t = (s.options || []).find((r) => r.id === e);
1225
+ function Ht(r, e) {
1226
+ const t = (r.options || []).find((s) => s.id === e);
1108
1227
  return t ? t.label : e;
1109
1228
  }
1110
- function Dt(s) {
1111
- return !s || typeof s != "object" ? "" : [s.county, s.where].filter(Boolean).join(", ");
1229
+ function jt(r) {
1230
+ return !r || typeof r != "object" ? "" : [r.county, r.where].filter(Boolean).join(", ");
1112
1231
  }
1113
- function Pt(s, e = {}, t = []) {
1114
- const r = [];
1115
- for (const i of s) {
1232
+ function Wt(r, e = {}, t = []) {
1233
+ const s = [];
1234
+ for (const i of r) {
1116
1235
  if (i.kind === "consent") continue;
1117
1236
  if (i.kind === "media") {
1118
- t.length && r.push(`${t.length} ${t.length === 1 ? "file" : "files"}`);
1237
+ t.length && s.push(`${t.length} ${t.length === 1 ? "file" : "files"}`);
1119
1238
  continue;
1120
1239
  }
1121
- const n = i.kind === "location" ? Dt(e[i.key]) : i.kind === "select" ? Mt(i, e[i.key]) : e[i.key];
1122
- n == null || n === "" || (i.kind === "textarea" ? r.push(`"${ge(n, Rt)}"`) : r.push(ge(n, Tt)));
1240
+ const n = i.kind === "location" ? jt(e[i.key]) : i.kind === "select" ? Ht(i, e[i.key]) : e[i.key];
1241
+ n == null || n === "" || (i.kind === "textarea" ? s.push(`"${ye(n, qt)}"`) : s.push(ye(n, Lt)));
1123
1242
  }
1124
- return r.join(" · ") || "Details provided";
1243
+ return s.join(" · ") || "Details provided";
1125
1244
  }
1126
- function zt(s, e = [], t = null) {
1127
- const r = [];
1245
+ function Vt(r, e = [], t = null) {
1246
+ const s = [];
1128
1247
  for (const n of e) {
1129
- const o = x(s, n.nodeId);
1130
- n.kind === "choice" && o && r.push({ k: (o.prompt || "").replace(/\?$/, ""), v: n.label || n.optionId }), n.kind === "collect" && r.push({ k: "Details", v: n.summary || "Details provided" }), n.kind === "gate" && (n.anonymous ? r.push({ k: "Contact", v: "Anonymous — we will have no way to reach you" }) : (n.email || t) && r.push({ k: "Verified email", v: n.email || t }));
1248
+ const o = x(r, n.nodeId);
1249
+ n.kind === "choice" && o && s.push({ k: (o.prompt || "").replace(/\?$/, ""), v: n.label || n.optionId }), n.kind === "collect" && s.push({ k: "Details", v: n.summary || "Details provided" }), n.kind === "gate" && (n.anonymous ? s.push({ k: "Contact", v: "Anonymous — we will have no way to reach you" }) : (n.email || t) && s.push({ k: "Verified email", v: n.email || t }));
1131
1250
  }
1132
- const i = ft(ke(s, e));
1133
- return i && r.push({ k: "Priority", v: i === "urgent" ? "Urgent" : "Moderate", pill: i }), r;
1251
+ const i = kt(Ie(r, e));
1252
+ return i && s.push({ k: "Priority", v: i === "urgent" ? "Urgent" : "Moderate", pill: i }), s;
1134
1253
  }
1135
- function Bt(s, e = []) {
1136
- const t = s?.confirmation || {};
1254
+ function Yt(r, e = []) {
1255
+ const t = r?.confirmation || {};
1137
1256
  return {
1138
1257
  title: t.title || "Report received.",
1139
1258
  body: t.body || "Your report is in the review queue.",
1140
1259
  urgentNote: e.includes("urgent") ? t.urgentNote : void 0
1141
1260
  };
1142
1261
  }
1143
- function Ot(s, e) {
1262
+ function Gt(r, e) {
1144
1263
  const t = e === "failed" ? " The notification is queued for a delivery retry." : "";
1145
- return s?.startsWith("studio+email:") ? `Sent to the Studio review queue; the desk is emailed.${t}` : s?.startsWith("studio:") ? "Sent to the Studio review queue." : s?.startsWith("jsm:") ? `A ticket is opened for tech support with your details as fields, not prose.${t}` : s?.startsWith("email:") ? `Emailed to the owning desk with a link to your report.${t}` : "Routed to the right team.";
1264
+ return r?.startsWith("studio+email:") ? `Sent to the Studio review queue; the desk is emailed.${t}` : r?.startsWith("studio:") ? "Sent to the Studio review queue." : r?.startsWith("jsm:") ? `A ticket is opened for tech support with your details as fields, not prose.${t}` : r?.startsWith("email:") ? `Emailed to the owning desk with a link to your report.${t}` : "Routed to the right team.";
1146
1265
  }
1147
- function Ut({ routing: s = {}, flags: e = [], reference: t = "", anonymous: r = !1 }) {
1266
+ function Kt({ routing: r = {}, flags: e = [], reference: t = "", anonymous: s = !1 }) {
1148
1267
  const i = e.includes("urgent");
1149
1268
  return [
1150
1269
  {
@@ -1153,12 +1272,12 @@ function Ut({ routing: s = {}, flags: e = [], reference: t = "", anonymous: r =
1153
1272
  },
1154
1273
  {
1155
1274
  title: "Routed",
1156
- body: Ot(s.destination, s.state),
1275
+ body: Gt(r.destination, r.state),
1157
1276
  pill: i ? "Urgent · pinned first" : void 0
1158
1277
  },
1159
1278
  {
1160
1279
  title: "Reviewed",
1161
- body: r ? "An editor reviews it in the Report It queue: accept and promote it uncredited, reject, or re-route." : "An editor reviews it in the Report It queue: accept and promote with your credit, reject, or re-route."
1280
+ body: s ? "An editor reviews it in the Report It queue: accept and promote it uncredited, reject, or re-route." : "An editor reviews it in the Report It queue: accept and promote with your credit, reject, or re-route."
1162
1281
  },
1163
1282
  {
1164
1283
  title: "Monitored",
@@ -1170,42 +1289,42 @@ function Ut({ routing: s = {}, flags: e = [], reference: t = "", anonymous: r =
1170
1289
  }
1171
1290
  ];
1172
1291
  }
1173
- const J = "wral-report-it:draft:v1", Ie = 1;
1174
- function Lt(s, e) {
1292
+ const Z = "wral-report-it:draft:v1", Ce = 1;
1293
+ function Qt(r, e) {
1175
1294
  try {
1176
- s.setItem(J, JSON.stringify({ ...e, v: Ie, savedAt: Date.now() }));
1295
+ r.setItem(Z, JSON.stringify({ ...e, v: Ce, savedAt: Date.now() }));
1177
1296
  } catch {
1178
1297
  }
1179
1298
  }
1180
- function Nt(s) {
1299
+ function Zt(r) {
1181
1300
  try {
1182
- const e = s.getItem(J);
1301
+ const e = r.getItem(Z);
1183
1302
  if (!e) return null;
1184
1303
  const t = JSON.parse(e);
1185
- return t?.v !== Ie ? null : t;
1304
+ return t?.v !== Ce ? null : t;
1186
1305
  } catch {
1187
1306
  return null;
1188
1307
  }
1189
1308
  }
1190
- function be(s) {
1309
+ function be(r) {
1191
1310
  try {
1192
- s.removeItem(J);
1311
+ r.removeItem(Z);
1193
1312
  } catch {
1194
1313
  }
1195
1314
  }
1196
- function qt({
1197
- apiOrigin: s,
1315
+ function Jt({
1316
+ apiOrigin: r,
1198
1317
  form: e,
1199
1318
  steps: t,
1200
- requestId: r = null,
1319
+ requestId: s = null,
1201
1320
  mediaMeta: i = {},
1202
1321
  origins: n = []
1203
1322
  }) {
1204
1323
  return {
1205
- apiOrigin: s,
1324
+ apiOrigin: r,
1206
1325
  formId: e.formId,
1207
1326
  flowVersion: e.flowVersion,
1208
- requestId: r,
1327
+ requestId: s,
1209
1328
  steps: t,
1210
1329
  media: i,
1211
1330
  origins: n.map(({ form: o, steps: a, option: l }) => ({
@@ -1215,31 +1334,31 @@ function qt({
1215
1334
  }))
1216
1335
  };
1217
1336
  }
1218
- function Ht(s, e, { apiOrigin: t } = {}) {
1219
- if (!s) return { status: "discarded" };
1220
- if (t && s.apiOrigin && s.apiOrigin !== t)
1221
- return { status: "discarded" };
1222
- const r = (e || []).find((o) => o.formId === s.formId);
1337
+ function Xt(r, e, { apiOrigin: t } = {}) {
1223
1338
  if (!r) return { status: "discarded" };
1224
- const { error: i } = q(r, s.steps || []);
1339
+ if (t && r.apiOrigin && r.apiOrigin !== t)
1340
+ return { status: "discarded" };
1341
+ const s = (e || []).find((o) => o.formId === r.formId);
1342
+ if (!s) return { status: "discarded" };
1343
+ const { error: i } = q(s, r.steps || []);
1225
1344
  if (i) return { status: "discarded" };
1226
1345
  const n = {};
1227
- for (const [o, a] of Object.entries(s.media || {}))
1346
+ for (const [o, a] of Object.entries(r.media || {}))
1228
1347
  a?.length && (n[o] = a.map((l) => ({ ...l, lost: !0 })));
1229
1348
  return {
1230
- status: s.flowVersion === r.flowVersion ? "ok" : "review-required",
1231
- form: r,
1232
- steps: s.steps || [],
1233
- requestId: s.requestId || null,
1349
+ status: r.flowVersion === s.flowVersion ? "ok" : "review-required",
1350
+ form: s,
1351
+ steps: r.steps || [],
1352
+ requestId: r.requestId || null,
1234
1353
  lostMedia: n,
1235
- origins: wt(s.origins, e, r.formId)
1354
+ origins: St(r.origins, e, s.formId)
1236
1355
  };
1237
1356
  }
1238
- function z(s = []) {
1357
+ function P(r = []) {
1239
1358
  return {
1240
1359
  stage: "idle",
1241
1360
  resumeStage: null,
1242
- files: s.map((e) => ({
1361
+ files: r.map((e) => ({
1243
1362
  name: e.name,
1244
1363
  type: e.type,
1245
1364
  size: e.size,
@@ -1255,82 +1374,82 @@ function z(s = []) {
1255
1374
  error: null
1256
1375
  };
1257
1376
  }
1258
- function jt(s, e) {
1377
+ function es(r, e) {
1259
1378
  switch (e.type) {
1260
1379
  case "START":
1261
- return { ...s, stage: s.files.length ? "minting" : "requesting", error: null };
1380
+ return { ...r, stage: r.files.length ? "minting" : "requesting", error: null };
1262
1381
  case "AUTH_REQUIRED":
1263
- return { ...s, resumeStage: s.stage === "auth" ? s.resumeStage : s.stage, stage: "auth" };
1382
+ return { ...r, resumeStage: r.stage === "auth" ? r.resumeStage : r.stage, stage: "auth" };
1264
1383
  case "AUTH_OK":
1265
- return { ...s, stage: s.resumeStage || "idle", resumeStage: null };
1384
+ return { ...r, stage: r.resumeStage || "idle", resumeStage: null };
1266
1385
  case "MINTED": {
1267
- const t = s.files.map((r, i) => ({
1268
- ...r,
1269
- assetId: e.uploads[i]?.assetId ?? r.assetId,
1270
- url: e.uploads[i]?.url ?? r.url,
1271
- assetUrl: e.uploads[i]?.assetUrl ?? r.assetUrl,
1386
+ const t = r.files.map((s, i) => ({
1387
+ ...s,
1388
+ assetId: e.uploads[i]?.assetId ?? s.assetId,
1389
+ url: e.uploads[i]?.url ?? s.url,
1390
+ assetUrl: e.uploads[i]?.assetUrl ?? s.assetUrl,
1272
1391
  status: "uploading",
1273
1392
  progress: 0,
1274
1393
  error: null
1275
1394
  }));
1276
- return { ...s, stage: "uploading", files: t };
1395
+ return { ...r, stage: "uploading", files: t };
1277
1396
  }
1278
1397
  case "FILE_PROGRESS":
1279
- return T(s, e.i, (t) => ({
1398
+ return T(r, e.i, (t) => ({
1280
1399
  ...t,
1281
1400
  progress: e.total ? e.loaded / e.total : 0
1282
1401
  }));
1283
1402
  case "FILE_DONE": {
1284
- const t = T(s, e.i, (r) => ({ ...r, status: "done", progress: 1 }));
1285
- return Wt(t);
1403
+ const t = T(r, e.i, (s) => ({ ...s, status: "done", progress: 1 }));
1404
+ return ts(t);
1286
1405
  }
1287
1406
  case "FILE_FAIL":
1288
- return { ...T(s, e.i, (r) => ({
1289
- ...r,
1407
+ return { ...T(r, e.i, (s) => ({
1408
+ ...s,
1290
1409
  status: "failed",
1291
1410
  error: e.error || "upload failed"
1292
1411
  })), stage: "uploading-error" };
1293
1412
  case "RETRY_FILE":
1294
- return { ...T(s, e.i, (r) => ({
1295
- ...r,
1413
+ return { ...T(r, e.i, (s) => ({
1414
+ ...s,
1296
1415
  status: "uploading",
1297
1416
  progress: 0,
1298
1417
  error: null
1299
1418
  })), stage: "uploading" };
1300
1419
  case "REMINT_FILE":
1301
- return { ...T(s, e.i, (r) => ({
1302
- ...r,
1420
+ return { ...T(r, e.i, (s) => ({
1421
+ ...s,
1303
1422
  assetId: e.upload.assetId,
1304
1423
  url: e.upload.url,
1305
- assetUrl: e.upload.assetUrl ?? r.assetUrl,
1424
+ assetUrl: e.upload.assetUrl ?? s.assetUrl,
1306
1425
  status: "uploading",
1307
1426
  progress: 0,
1308
1427
  error: null
1309
1428
  })), stage: "uploading" };
1310
1429
  case "REQUEST_START":
1311
- return { ...s, stage: "requesting", error: null };
1430
+ return { ...r, stage: "requesting", error: null };
1312
1431
  case "REQUEST_OK":
1313
- return { ...s, stage: "done", result: e.result, error: null };
1432
+ return { ...r, stage: "done", result: e.result, error: null };
1314
1433
  case "REQUEST_FAIL":
1315
- return { ...s, stage: "requesting-error", error: e.error };
1434
+ return { ...r, stage: "requesting-error", error: e.error };
1316
1435
  case "RESET":
1317
- return z([]);
1436
+ return P([]);
1318
1437
  default:
1319
- return s;
1438
+ return r;
1320
1439
  }
1321
1440
  }
1322
- function T(s, e, t) {
1323
- const r = s.files.map((i, n) => n === e ? t(i) : i);
1324
- return { ...s, files: r };
1441
+ function T(r, e, t) {
1442
+ const s = r.files.map((i, n) => n === e ? t(i) : i);
1443
+ return { ...r, files: s };
1325
1444
  }
1326
- function Wt(s) {
1327
- const e = s.files.every((r) => r.status === "done"), t = s.files.some((r) => r.status === "failed");
1328
- return e ? { ...s, stage: "requesting" } : t ? { ...s, stage: "uploading-error" } : s;
1445
+ function ts(r) {
1446
+ const e = r.files.every((s) => s.status === "done"), t = r.files.some((s) => s.status === "failed");
1447
+ return e ? { ...r, stage: "requesting" } : t ? { ...r, stage: "uploading-error" } : r;
1329
1448
  }
1330
- function ye(s) {
1331
- return s.files.map((e, t) => ({ ...e, i: t })).filter((e) => e.status === "failed");
1449
+ function we(r) {
1450
+ return r.files.map((e, t) => ({ ...e, i: t })).filter((e) => e.status === "failed");
1332
1451
  }
1333
- const Vt = [
1452
+ const ss = [
1334
1453
  "Wake",
1335
1454
  "Durham",
1336
1455
  "Orange",
@@ -1347,20 +1466,21 @@ const Vt = [
1347
1466
  "Moore",
1348
1467
  "Sampson",
1349
1468
  "Other / outside the area"
1350
- ], we = "(919) 821-8600", Yt = "https://www.wral.com/my-wral/", Gt = Object.freeze([
1469
+ ], xe = "(919) 821-8600", rs = "https://www.wral.com/my-wral/", is = Object.freeze([
1351
1470
  "We cannot come back to you for the detail that often turns a tip into a story.",
1352
1471
  "We cannot credit you if we use your photos or video.",
1353
1472
  "If you lose your reference number, we cannot look it up for you."
1354
1473
  ]);
1355
- function Kt(s) {
1356
- const e = String(s).replace(/\D/g, "");
1474
+ function ns(r) {
1475
+ const e = String(r).replace(/\D/g, "");
1357
1476
  return `tel:+1${e.length === 11 && e.startsWith("1") ? e.slice(1) : e}`;
1358
1477
  }
1359
- const Qt = "https://api.wral.com/forms", Jt = 480, Zt = 2, Ee = "What would you like to send to WRAL?", W = `Welcome to Report It. ${Ee}`, V = "A few quick questions route your report to the right team.", Xt = 2500, er = "I took or own this material and give WRAL permission to use it on air and online with credit to me.";
1360
- class ar extends G {
1361
- static styles = st;
1478
+ const os = "https://api.wral.com/forms", as = 480, ls = 2, Te = "What would you like to send to WRAL?", W = `Welcome to Report It. ${Te}`, V = "A few quick questions route your report to the right team.", cs = 2500, ds = "I took or own this material and give WRAL permission to use it on air and online with credit to me.";
1479
+ class ys extends G {
1480
+ static styles = ot;
1362
1481
  static properties = {
1363
1482
  api: { type: String },
1483
+ factsApi: { type: String, attribute: "facts-api" },
1364
1484
  flow: { type: String },
1365
1485
  _phase: { state: !0 },
1366
1486
  _forms: { state: !0 },
@@ -1376,45 +1496,51 @@ class ar extends G {
1376
1496
  _submit: { state: !0 },
1377
1497
  _banner: { state: !0 },
1378
1498
  _notice: { state: !0 },
1379
- _result: { state: !0 }
1499
+ _result: { state: !0 },
1500
+ _factsOffer: { state: !0 }
1380
1501
  };
1381
1502
  #c = null;
1382
1503
  #l = null;
1383
- #u = null;
1504
+ #p = null;
1384
1505
  #t = null;
1385
- #r = {};
1386
1506
  #s = {};
1507
+ #r = {};
1387
1508
  #n = /* @__PURE__ */ new Map();
1388
- #y = null;
1389
- #p = null;
1390
- #w = !1;
1509
+ #w = null;
1510
+ #h = null;
1511
+ #x = !1;
1391
1512
  #d = null;
1392
- #F = 0;
1513
+ #I = 0;
1514
+ /* The gate was passed with an account created on this page load; offered once. */
1515
+ #f = !1;
1393
1516
  constructor() {
1394
- super(), this.api = Qt, this.flow = null, this._phase = "loading", this._forms = [], this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this._typing = !1, this._loadingSlow = !1, this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit = z([]), this._banner = null, this._notice = null, this._result = null;
1517
+ super(), this.api = os, this.factsApi = null, this.flow = null, this._phase = "loading", this._forms = [], this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this._typing = !1, this._loadingSlow = !1, this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit = P([]), this._banner = null, this._notice = null, this._result = null, this._factsOffer = null;
1395
1518
  }
1396
1519
  get client() {
1397
- return this.#c ? this.#c : ((!this.#l || this.#u !== this.api) && (this.#l = dt({ baseUrl: this.api }), this.#u = this.api), this.#l);
1520
+ if (this.#c) return this.#c;
1521
+ const e = `${this.api}
1522
+ ${this.factsApi || ""}`;
1523
+ return (!this.#l || this.#p !== e) && (this.#l = _t({ baseUrl: this.api, factsBaseUrl: this.factsApi || null }), this.#p = e), this.#l;
1398
1524
  }
1399
1525
  set client(e) {
1400
- this.#c = e || null, this.isConnected && this.#x();
1526
+ this.#c = e || null, this.isConnected && this.#v();
1401
1527
  }
1402
1528
  connectedCallback() {
1403
- super.connectedCallback(), this.#x();
1529
+ super.connectedCallback(), this.#v();
1404
1530
  }
1405
1531
  disconnectedCallback() {
1406
- super.disconnectedCallback(), clearTimeout(this.#y), clearTimeout(this.#p), this.#d?.();
1532
+ super.disconnectedCallback(), clearTimeout(this.#w), clearTimeout(this.#h), this.#d?.();
1407
1533
  for (const { abort: e } of this.#n.values()) e?.();
1408
1534
  this.#n.clear();
1409
1535
  }
1410
- get #O() {
1536
+ get #U() {
1411
1537
  try {
1412
1538
  return matchMedia("(prefers-reduced-motion: reduce)").matches;
1413
1539
  } catch {
1414
1540
  return !0;
1415
1541
  }
1416
1542
  }
1417
- get #h() {
1543
+ get #m() {
1418
1544
  try {
1419
1545
  return sessionStorage;
1420
1546
  } catch {
@@ -1429,38 +1555,38 @@ class ar extends G {
1429
1555
  * submission is enabled on this deployment, and a form whose desk needs
1430
1556
  * a way to reach the viewer opts out with allowAnonymous: false.
1431
1557
  */
1432
- get #U() {
1558
+ get #L() {
1433
1559
  return this.client.anonymousCapability?.().enabled === !0 && this._form?.allowAnonymous !== !1;
1434
1560
  }
1435
1561
  /* Derived from the gate step, so a reload restores the choice. */
1436
- get #f() {
1562
+ get #u() {
1437
1563
  return this._steps.some((e) => e.kind === "gate" && e.anonymous === !0);
1438
1564
  }
1439
1565
  // ── Loading + draft restore ─────────────────────────────────────
1440
- async #x() {
1441
- const e = ++this.#F, t = () => e === this.#F;
1442
- this._phase = "loading", this._banner = null, this._loadingSlow = !1, clearTimeout(this.#p), this.#p = setTimeout(() => {
1566
+ async #v() {
1567
+ const e = ++this.#I, t = () => e === this.#I;
1568
+ this._phase = "loading", this._banner = null, this._loadingSlow = !1, clearTimeout(this.#h), this.#h = setTimeout(() => {
1443
1569
  this._loadingSlow = !0;
1444
- }, Xt);
1445
- let r;
1570
+ }, cs);
1571
+ let s;
1446
1572
  try {
1447
- r = await this.client.listForms();
1573
+ s = await this.client.listForms();
1448
1574
  } catch {
1449
1575
  t() && (this._phase = "load-error");
1450
1576
  return;
1451
1577
  } finally {
1452
- t() && (clearTimeout(this.#p), this._loadingSlow = !1);
1578
+ t() && (clearTimeout(this.#h), this._loadingSlow = !1);
1453
1579
  }
1454
1580
  if (!t()) return;
1455
- this._forms = r;
1456
- const i = xt({ attr: this.flow, search: globalThis.location?.search }), n = Ht(Nt(this.#h), this._forms, { apiOrigin: this.api });
1457
- if ((n.status === "ok" || n.status === "review-required") && _t(n, i)) {
1458
- this._form = n.form, this._steps = n.steps, this._origins = n.origins || [], this.#t = n.requestId, this.#s = n.lostMedia || {}, n.status === "review-required" ? this._notice = "This form changed since your last visit — please review your answers." : Object.keys(this.#s).length && (this._notice = "Welcome back — your answers were saved, but attachments need to be re-attached."), this.#i({ animate: !1 });
1581
+ this._forms = s;
1582
+ const i = Ct({ attr: this.flow, search: globalThis.location?.search }), n = Xt(Zt(this.#m), this._forms, { apiOrigin: this.api });
1583
+ if ((n.status === "ok" || n.status === "review-required") && Rt(n, i)) {
1584
+ this._form = n.form, this._steps = n.steps, this._origins = n.origins || [], this.#t = n.requestId, this.#r = n.lostMedia || {}, n.status === "review-required" ? this._notice = "This form changed since your last visit — please review your answers." : Object.keys(this.#r).length && (this._notice = "Welcome back — your answers were saved, but attachments need to be re-attached."), this.#i({ animate: !1 });
1459
1585
  return;
1460
1586
  }
1461
- const o = vt(this._forms, i);
1587
+ const o = Tt(this._forms, i);
1462
1588
  if (o) {
1463
- this.#I(o);
1589
+ this.#E(o);
1464
1590
  return;
1465
1591
  }
1466
1592
  this._phase = "pick";
@@ -1468,9 +1594,9 @@ class ar extends G {
1468
1594
  #o() {
1469
1595
  if (!this._form) return;
1470
1596
  const e = {};
1471
- for (const [t, r] of Object.entries(this.#r))
1472
- r.length && (e[t] = r.map(({ name: i, type: n, size: o }) => ({ name: i, type: n, size: o })));
1473
- Lt(this.#h, qt({
1597
+ for (const [t, s] of Object.entries(this.#s))
1598
+ s.length && (e[t] = s.map(({ name: i, type: n, size: o }) => ({ name: i, type: n, size: o })));
1599
+ Qt(this.#m, Jt({
1474
1600
  apiOrigin: this.api,
1475
1601
  form: this._form,
1476
1602
  steps: this._steps,
@@ -1481,25 +1607,25 @@ class ar extends G {
1481
1607
  }
1482
1608
  // ── Walk mechanics ──────────────────────────────────────────────
1483
1609
  #i({ animate: e = !0 } = {}) {
1484
- this._phase = "walk", this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, e && !this.#O ? (this._typing = !0, clearTimeout(this.#y), this.#y = setTimeout(() => {
1610
+ this._phase = "walk", this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, e && !this.#U ? (this._typing = !0, clearTimeout(this.#w), this.#w = setTimeout(() => {
1485
1611
  this._typing = !1;
1486
- }, Jt)) : this._typing = !1;
1612
+ }, as)) : this._typing = !1;
1487
1613
  }
1488
- get #v() {
1614
+ get #_() {
1489
1615
  return this._form ? q(this._form, this._steps) : { node: null };
1490
1616
  }
1491
- #I(e) {
1492
- this._form = e, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#r = {}, this.#s = {}, this._notice = null, this.#o(), this.#i();
1617
+ #E(e) {
1618
+ this._form = e, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#s = {}, this.#r = {}, this._notice = null, this.#o(), this.#i();
1493
1619
  }
1494
- #m(e) {
1620
+ #g(e) {
1495
1621
  this._steps = [...this._steps, e], this.#o(), this.#i();
1496
1622
  }
1497
- #L(e, t) {
1498
- if (N(t)) {
1499
- this.#N(e, t);
1623
+ #q(e, t) {
1624
+ if (L(t)) {
1625
+ this.#H(e, t);
1500
1626
  return;
1501
1627
  }
1502
- this._handoffError = !1, this.#m({
1628
+ this._handoffError = !1, this.#g({
1503
1629
  nodeId: e.id,
1504
1630
  kind: "choice",
1505
1631
  optionId: t.id,
@@ -1513,97 +1639,97 @@ class ar extends G {
1513
1639
  * Back can return them. A target that is missing or no longer matches
1514
1640
  * its preset path is a config mistake: say so and stay put.
1515
1641
  */
1516
- #N(e, t) {
1517
- const { form: r, steps: i, error: n } = gt(this._forms, t);
1642
+ #H(e, t) {
1643
+ const { form: s, steps: i, error: n } = Ft(this._forms, t);
1518
1644
  if (n) {
1519
1645
  this._handoffError = !0;
1520
1646
  return;
1521
1647
  }
1522
1648
  this._handoffError = !1, this._origins = [...this._origins, {
1523
- ...bt(this._form, this._steps, e, t),
1524
- media: this.#r,
1525
- lostMedia: this.#s
1526
- }], this._form = r, this._steps = i, this.#t = null, this.#r = {}, this.#s = {}, this._notice = null, this.#o(), this.#i();
1649
+ ...It(this._form, this._steps, e, t),
1650
+ media: this.#s,
1651
+ lostMedia: this.#r
1652
+ }], this._form = s, this._steps = i, this.#t = null, this.#s = {}, this.#r = {}, this._notice = null, this.#o(), this.#i();
1527
1653
  }
1528
1654
  /* Back past a hand-off: the originating form, on the choice card. */
1529
- #q() {
1655
+ #j() {
1530
1656
  const e = this._origins.at(-1);
1531
- this._origins = this._origins.slice(0, -1), this._form = e.form, this._steps = e.steps, this.#t = null, this.#r = e.media || {}, this.#s = e.lostMedia || {}, this._handoffError = !1, this.#o(), this.#i({ animate: !1 });
1657
+ this._origins = this._origins.slice(0, -1), this._form = e.form, this._steps = e.steps, this.#t = null, this.#s = e.media || {}, this.#r = e.lostMedia || {}, this._handoffError = !1, this.#o(), this.#i({ animate: !1 });
1532
1658
  }
1533
- #H() {
1659
+ #W() {
1534
1660
  if (this._phase === "done" || this._phase === "submitting") return;
1535
1661
  if (this._phase === "review") {
1536
1662
  this.#i({ animate: !1 });
1537
1663
  return;
1538
1664
  }
1539
- if (this._origins.length && yt(this._steps)) {
1540
- this.#q();
1665
+ if (this._origins.length && Et(this._steps)) {
1666
+ this.#j();
1541
1667
  return;
1542
1668
  }
1543
1669
  if (!this._steps.length) {
1544
- this.#_();
1670
+ this.#$();
1545
1671
  return;
1546
1672
  }
1547
1673
  const e = this._steps.at(-1);
1548
1674
  this._steps = this._steps.slice(0, -1), e.kind === "collect" && (this._cardValues = { ...e.values }), this.#o(), this.#i({ animate: !1 });
1549
1675
  }
1550
- #_() {
1551
- this.client.endAnonSession?.(), this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#r = {}, this.#s = {}, this._result = null, this._banner = null, this._notice = null, this._submit = z([]), be(this.#h), this._phase = "pick";
1676
+ #$() {
1677
+ this.client.endAnonSession?.(), this._form = null, this._steps = [], this._origins = [], this._handoffError = !1, this.#t = null, this.#s = {}, this.#r = {}, this._result = null, this._banner = null, this._notice = null, this._submit = P([]), this._factsOffer = null, be(this.#m), this._phase = "pick";
1552
1678
  }
1553
1679
  // ── Collect card ────────────────────────────────────────────────
1554
- #$(e, t) {
1680
+ #k(e, t) {
1555
1681
  this._cardValues = { ...this._cardValues, [e]: t };
1556
1682
  }
1557
1683
  /* Files attached on the given collect cards (a files-only consent counts them). */
1558
- #E(e) {
1684
+ #S(e) {
1559
1685
  let t = 0;
1560
- for (const r of new Set(e)) t += (this.#r[r] || []).length;
1686
+ for (const s of new Set(e)) t += (this.#s[s] || []).length;
1561
1687
  return t;
1562
1688
  }
1563
1689
  /* Files attached so far on this walk, the card being filled in included. */
1564
- #S(e) {
1565
- const t = this._steps.filter((r) => r.kind === "collect").map((r) => r.nodeId);
1566
- return this.#E([...t, e]);
1690
+ #C(e) {
1691
+ const t = this._steps.filter((s) => s.kind === "collect").map((s) => s.nodeId);
1692
+ return this.#S([...t, e]);
1567
1693
  }
1568
- #j(e) {
1569
- const t = e.fields || [], { ok: r, errors: i } = he(t, this._cardValues, {
1570
- mediaCount: this.#S(e.id)
1694
+ #V(e) {
1695
+ const t = e.fields || [], { ok: s, errors: i } = fe(t, this._cardValues, {
1696
+ mediaCount: this.#C(e.id)
1571
1697
  }), n = t.find((l) => l.kind === "media");
1572
1698
  let o = !0;
1573
1699
  if (n) {
1574
- const l = this.#r[e.id] || [], d = Y(l, this._form.budget, {
1700
+ const l = this.#s[e.id] || [], d = Y(l, this._form.budget, {
1575
1701
  required: !!n.required
1576
1702
  });
1577
- d.ok ? l.length && (this.#s = { ...this.#s, [e.id]: [] }) : (o = !1, i[n.key] = d.errors[0].message);
1703
+ d.ok ? l.length && (this.#r = { ...this.#r, [e.id]: [] }) : (o = !1, i[n.key] = d.errors[0].message);
1578
1704
  }
1579
- if (!r || !o) {
1705
+ if (!s || !o) {
1580
1706
  this._fieldErrors = i;
1581
1707
  return;
1582
1708
  }
1583
- const a = this.#r[e.id] || [];
1584
- this.#m({
1709
+ const a = this.#s[e.id] || [];
1710
+ this.#g({
1585
1711
  nodeId: e.id,
1586
1712
  kind: "collect",
1587
1713
  values: { ...this._cardValues },
1588
- summary: Pt(t, this._cardValues, a)
1714
+ summary: Wt(t, this._cardValues, a)
1589
1715
  });
1590
1716
  }
1591
1717
  // ── Gate ────────────────────────────────────────────────────────
1592
- async #C() {
1593
- if (!(this._gate.stage || this.#w)) {
1594
- this.#w = !0;
1718
+ async #T() {
1719
+ if (!(this._gate.stage || this.#x)) {
1720
+ this.#x = !0;
1595
1721
  try {
1596
1722
  const e = await this.client.isAuthenticated();
1597
1723
  this._gate = e ? { stage: "signedin", email: this.client.signedInEmail?.() || "", error: "", loading: !1 } : { stage: "email", email: "", error: "", loading: !1 };
1598
1724
  } finally {
1599
- this.#w = !1;
1725
+ this.#x = !1;
1600
1726
  }
1601
1727
  this._gate.stage === "email" && this.client.onCrossTabLogin && !this.#d && (this.#d = this.client.onCrossTabLogin(() => {
1602
- this.#d?.(), this.#d = null, this._gate = { stage: null, email: "", error: "", loading: !1 }, this.#C();
1728
+ this.#d?.(), this.#d = null, this._gate = { stage: null, email: "", error: "", loading: !1 }, this.#T();
1603
1729
  }));
1604
1730
  }
1605
1731
  }
1606
- async #k() {
1732
+ async #A() {
1607
1733
  const e = this._gate.email.trim();
1608
1734
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) {
1609
1735
  this._gate = { ...this._gate, error: "Please enter a valid email address." };
@@ -1611,8 +1737,8 @@ class ar extends G {
1611
1737
  }
1612
1738
  this._gate = { ...this._gate, error: "", loading: !0 };
1613
1739
  try {
1614
- const t = await this.client.sendCode(e);
1615
- this._gate = t.authenticated ? { stage: "signedin", email: e, error: "", loading: !1 } : { ...this._gate, stage: "code", loading: !1 };
1740
+ const t = await this.client.sendCode(e), s = !!t.newAccount;
1741
+ this._gate = t.authenticated ? { stage: "signedin", email: e, error: "", loading: !1, newAccount: s } : { ...this._gate, stage: "code", loading: !1, newAccount: s };
1616
1742
  } catch (t) {
1617
1743
  this._gate = {
1618
1744
  ...this._gate,
@@ -1621,10 +1747,10 @@ class ar extends G {
1621
1747
  };
1622
1748
  }
1623
1749
  }
1624
- async #T(e) {
1750
+ async #R(e) {
1625
1751
  this._gate = { ...this._gate, error: "", loading: !0 };
1626
1752
  try {
1627
- await this.client.verifyCode(e), this.#R(this._gate.email);
1753
+ await this.client.verifyCode(e), this.#M(this._gate.email);
1628
1754
  } catch (t) {
1629
1755
  this._gate = {
1630
1756
  ...this._gate,
@@ -1633,74 +1759,74 @@ class ar extends G {
1633
1759
  };
1634
1760
  }
1635
1761
  }
1636
- #R(e) {
1637
- if (this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit.stage === "auth") {
1762
+ #M(e) {
1763
+ if (this.#f = !!this._gate.newAccount, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit.stage === "auth") {
1638
1764
  this.#e({ type: "AUTH_OK" }), this._phase = "submitting", this.#a();
1639
1765
  return;
1640
1766
  }
1641
- const { node: t } = this.#v;
1642
- t?.type === "gate" && this.#m({ nodeId: t.id, kind: "gate", email: e });
1767
+ const { node: t } = this.#_;
1768
+ t?.type === "gate" && this.#g({ nodeId: t.id, kind: "gate", email: e });
1643
1769
  }
1644
- #W() {
1645
- this.client.signOut?.(), this._gate = { stage: "email", email: "", error: "", loading: !1 };
1770
+ #Y() {
1771
+ this.client.signOut?.(), this.#f = !1, this._gate = { stage: "email", email: "", error: "", loading: !1 };
1646
1772
  }
1647
1773
  // ── Anonymous route ─────────────────────────────────────────────
1648
- #V() {
1774
+ #G() {
1649
1775
  this._gate = { ...this._gate, stage: "anon-confirm", error: "" };
1650
1776
  }
1651
- #Y() {
1777
+ #K() {
1652
1778
  this._gate = { ...this._gate, stage: "email", error: "" };
1653
1779
  }
1654
1780
  /*
1655
1781
  * Records the choice only. The session is minted at submit, against
1656
1782
  * the requestId, so an abandoned form leaves nothing behind.
1657
1783
  */
1658
- #G() {
1659
- const { node: e } = this.#v;
1660
- e?.type === "gate" && (this._gate = { stage: null, email: "", error: "", loading: !1 }, this.#m({ nodeId: e.id, kind: "gate", anonymous: !0 }));
1784
+ #Q() {
1785
+ const { node: e } = this.#_;
1786
+ e?.type === "gate" && (this._gate = { stage: null, email: "", error: "", loading: !1 }, this.#g({ nodeId: e.id, kind: "gate", anonymous: !0 }));
1661
1787
  }
1662
- async #M() {
1788
+ async #O() {
1663
1789
  try {
1664
1790
  return await this.client.createAnonSession({
1665
1791
  formId: this._form.formId,
1666
1792
  requestId: this.#t
1667
1793
  }), !0;
1668
1794
  } catch (e) {
1669
- return this._banner = me(e?.status ?? 0, e?.body ?? null), !1;
1795
+ return this._banner = ge(e?.status ?? 0, e?.body ?? null), !1;
1670
1796
  }
1671
1797
  }
1672
1798
  /* An anonymous session outliving the upload run re-mints in place; there
1673
1799
  * is no identity to send back to the sign-in card. */
1674
- async #K() {
1675
- if (await this.#M()) {
1800
+ async #Z() {
1801
+ if (await this.#O()) {
1676
1802
  this.#e({ type: "AUTH_OK" }), this._phase = "submitting", this.#a();
1677
1803
  return;
1678
1804
  }
1679
1805
  this.#e({ type: "REQUEST_FAIL", error: this._banner });
1680
1806
  }
1681
1807
  // ── Submit pipeline ─────────────────────────────────────────────
1682
- get #g() {
1808
+ get #y() {
1683
1809
  const e = [];
1684
1810
  for (const t of this._steps)
1685
1811
  if (t.kind === "collect")
1686
- for (const r of this.#r[t.nodeId] || [])
1687
- e.push(r);
1812
+ for (const s of this.#s[t.nodeId] || [])
1813
+ e.push(s);
1688
1814
  return e;
1689
1815
  }
1690
1816
  #e(e) {
1691
- this._submit = jt(this._submit, e);
1817
+ this._submit = es(this._submit, e);
1692
1818
  }
1693
- async #Q() {
1819
+ async #J() {
1694
1820
  this._banner = null;
1695
1821
  for (let e = 0; e < this._steps.length; e++) {
1696
1822
  const t = this._steps[e];
1697
1823
  if (t.kind !== "collect") continue;
1698
- const r = x(this._form, t.nodeId), i = this._steps.slice(0, e + 1).filter((d) => d.kind === "collect").map((d) => d.nodeId), { ok: n, errors: o } = he(r?.fields || [], t.values, {
1699
- mediaCount: this.#E(i)
1700
- }), a = (r?.fields || []).find((d) => d.kind === "media");
1824
+ const s = x(this._form, t.nodeId), i = this._steps.slice(0, e + 1).filter((d) => d.kind === "collect").map((d) => d.nodeId), { ok: n, errors: o } = fe(s?.fields || [], t.values, {
1825
+ mediaCount: this.#S(i)
1826
+ }), a = (s?.fields || []).find((d) => d.kind === "media");
1701
1827
  let l = !0;
1702
1828
  if (a) {
1703
- const d = this.#r[t.nodeId] || [], p = Y(d, this._form.budget, {
1829
+ const d = this.#s[t.nodeId] || [], p = Y(d, this._form.budget, {
1704
1830
  required: !!a.required
1705
1831
  });
1706
1832
  p.ok || (l = !1, o[a.key] = p.errors[0].message);
@@ -1710,11 +1836,11 @@ class ar extends G {
1710
1836
  return;
1711
1837
  }
1712
1838
  }
1713
- if (this.#t = this.#t || crypto.randomUUID(), this.#o(), this.#f) {
1714
- if (!await this.#M()) return;
1839
+ if (this.#t = this.#t || crypto.randomUUID(), this.#o(), this.#u) {
1840
+ if (!await this.#O()) return;
1715
1841
  } else
1716
1842
  this.client.endAnonSession?.();
1717
- if (this._submit = z(this.#g), this._phase = "submitting", this.#f) {
1843
+ if (this._submit = P(this.#y), this._phase = "submitting", this.#u) {
1718
1844
  this.#e({ type: "START" }), this.#a();
1719
1845
  return;
1720
1846
  }
@@ -1726,32 +1852,32 @@ class ar extends G {
1726
1852
  }
1727
1853
  async #a() {
1728
1854
  const e = this._submit.stage;
1729
- if (e === "minting") return this.#J();
1855
+ if (e === "minting") return this.#X();
1730
1856
  if (e === "uploading") return this.#D();
1731
- if (e === "requesting") return this.#ee();
1857
+ if (e === "requesting") return this.#se();
1732
1858
  }
1733
- async #J() {
1859
+ async #X() {
1734
1860
  try {
1735
- const e = await this.client.createUploads(fe({
1861
+ const e = await this.client.createUploads(me({
1736
1862
  formId: this._form.formId,
1737
1863
  requestId: this.#t,
1738
- files: this.#g
1864
+ files: this.#y
1739
1865
  }));
1740
1866
  this.#e({ type: "MINTED", uploads: e }), this.#a();
1741
1867
  } catch (e) {
1742
- this.#A(e);
1868
+ this.#F(e);
1743
1869
  }
1744
1870
  }
1745
1871
  #D() {
1746
1872
  const e = this._submit.files, t = this.#n.size;
1747
- let r = 0;
1748
- for (let i = 0; i < e.length && t + r < Zt; i++)
1749
- e[i].status !== "uploading" || this.#n.has(i) || (r += 1, this.#Z(i));
1873
+ let s = 0;
1874
+ for (let i = 0; i < e.length && t + s < ls; i++)
1875
+ e[i].status !== "uploading" || this.#n.has(i) || (s += 1, this.#ee(i));
1750
1876
  }
1751
- #Z(e) {
1752
- const t = this._submit.files[e], r = this.#g[e], { promise: i, abort: n } = this.client.uploadFile({
1877
+ #ee(e) {
1878
+ const t = this._submit.files[e], s = this.#y[e], { promise: i, abort: n } = this.client.uploadFile({
1753
1879
  url: t.url,
1754
- file: r,
1880
+ file: s,
1755
1881
  contentType: t.type,
1756
1882
  onProgress: ({ loaded: o, total: a }) => {
1757
1883
  this.#e({ type: "FILE_PROGRESS", i: e, loaded: o, total: a });
@@ -1767,52 +1893,70 @@ class ar extends G {
1767
1893
  });
1768
1894
  });
1769
1895
  }
1770
- async #X(e) {
1896
+ async #te(e) {
1771
1897
  if (this._submit.files[e].error === "expired")
1772
1898
  try {
1773
- const [r] = await this.client.createUploads(fe({
1899
+ const [s] = await this.client.createUploads(me({
1774
1900
  formId: this._form.formId,
1775
1901
  requestId: this.#t,
1776
- files: [this.#g[e]]
1902
+ files: [this.#y[e]]
1777
1903
  }));
1778
- this.#e({ type: "REMINT_FILE", i: e, upload: r });
1779
- } catch (r) {
1780
- this.#A(r);
1904
+ this.#e({ type: "REMINT_FILE", i: e, upload: s });
1905
+ } catch (s) {
1906
+ this.#F(s);
1781
1907
  return;
1782
1908
  }
1783
1909
  else
1784
1910
  this.#e({ type: "RETRY_FILE", i: e });
1785
1911
  this.#D();
1786
1912
  }
1787
- async #ee() {
1913
+ async #se() {
1788
1914
  try {
1789
- const e = this._submit.files.map(({ assetId: r, type: i }) => ({ assetId: r, type: i })), t = await this.client.putRequest(this.#t, Ct({
1915
+ const e = this._submit.files.map(({ assetId: s, type: i }) => ({ assetId: s, type: i })), t = await this.client.putRequest(this.#t, Ut({
1790
1916
  form: this._form,
1791
1917
  steps: this._steps,
1792
1918
  media: e
1793
1919
  }));
1794
- this.#e({ type: "REQUEST_OK", result: t }), this._result = t, be(this.#h), this.client.endAnonSession?.(), this._phase = "done";
1920
+ this.#e({ type: "REQUEST_OK", result: t }), this._result = t, be(this.#m), this.client.endAnonSession?.(), this.#re(), this._phase = "done";
1795
1921
  } catch (e) {
1796
- this.#A(e);
1922
+ this.#F(e);
1797
1923
  }
1798
1924
  }
1799
- #A(e) {
1800
- const t = me(e?.status ?? 0, e?.body ?? null);
1925
+ // ── Save to My WRAL (new accounts only) ─────────────────────────
1926
+ #re() {
1927
+ if (!this.#f || this.#u || !this.client.saveUserFacts) return;
1928
+ this.#f = !1;
1929
+ const e = wt(Ae(this._form, this._steps), Fe(this._steps));
1930
+ e.length && (this._factsOffer = { stage: "offer", facts: e });
1931
+ }
1932
+ async #ie() {
1933
+ const e = this._factsOffer;
1934
+ if (!(!e || e.stage === "saving")) {
1935
+ this._factsOffer = { ...e, stage: "saving" };
1936
+ try {
1937
+ await this.client.saveUserFacts(e.facts), this._factsOffer = { ...e, stage: "saved" };
1938
+ } catch {
1939
+ this._factsOffer = { ...e, stage: "error" };
1940
+ }
1941
+ }
1942
+ }
1943
+ #F(e) {
1944
+ const t = ge(e?.status ?? 0, e?.body ?? null);
1801
1945
  if (t.kind === "auth") {
1802
- if (this.#e({ type: "AUTH_REQUIRED" }), this.#f) {
1803
- this.#K();
1946
+ if (this.#e({ type: "AUTH_REQUIRED" }), this.#u) {
1947
+ this.#Z();
1804
1948
  return;
1805
1949
  }
1806
1950
  this._gate = { stage: "email", email: "", error: "", loading: !1 };
1807
1951
  return;
1808
1952
  }
1809
1953
  if (t.kind === "stale") {
1810
- this._banner = t, this.#e({ type: "REQUEST_FAIL", error: t }), this.#te();
1954
+ this._banner = t, this.#e({ type: "REQUEST_FAIL", error: t }), this.#ne();
1811
1955
  return;
1812
1956
  }
1813
1957
  this._banner = t, this.#e({ type: "REQUEST_FAIL", error: t });
1814
1958
  }
1815
- async #te() {
1959
+ async #ne() {
1816
1960
  try {
1817
1961
  this._forms = await this.client.listForms();
1818
1962
  const e = this._forms.find((t) => t.formId === this._form.formId);
@@ -1820,19 +1964,19 @@ class ar extends G {
1820
1964
  } catch {
1821
1965
  }
1822
1966
  }
1823
- #re() {
1967
+ #oe() {
1824
1968
  this._banner = null, this.#e({ type: "REQUEST_START" }), this.#a();
1825
1969
  }
1826
1970
  // ── Render ──────────────────────────────────────────────────────
1827
1971
  render() {
1828
1972
  return c`
1829
1973
  <div class="chat" aria-live="polite">
1830
- ${this.#se()}
1974
+ ${this.#ae()}
1831
1975
  </div>
1832
- ${this.#ge()}
1976
+ ${this.#$e()}
1833
1977
  `;
1834
1978
  }
1835
- #se() {
1979
+ #ae() {
1836
1980
  switch (this._phase) {
1837
1981
  case "loading":
1838
1982
  return c`${g(W, this._loadingSlow ? "Loading the form list…" : V)}
@@ -1841,31 +1985,31 @@ class ar extends G {
1841
1985
  return c`
1842
1986
  ${g("We could not load the forms.", "Check your connection and try again.", { error: !0 })}
1843
1987
  <div class="options">
1844
- <button type="button" class="chip" @click=${() => this.#x()}>Try again</button>
1988
+ <button type="button" class="chip" @click=${() => this.#v()}>Try again</button>
1845
1989
  </div>
1846
1990
  `;
1847
1991
  case "pick":
1848
- return this.#ie();
1992
+ return this.#le();
1849
1993
  case "walk":
1850
- return c`${this.#b()}${this._typing ? j() : this.#ne()}`;
1994
+ return c`${this.#b()}${this._typing ? j() : this.#ce()}`;
1851
1995
  case "review":
1852
- return c`${this.#b()}${this.#B()}`;
1996
+ return c`${this.#b()}${this.#N()}`;
1853
1997
  case "submitting":
1854
- return c`${this.#b()}${this.#fe()}`;
1998
+ return c`${this.#b()}${this.#be()}`;
1855
1999
  case "done":
1856
- return c`${this.#b()}${this.#me()}`;
2000
+ return c`${this.#b()}${this.#xe ? this.#_e() : c`${this.#ve()}${this.#we()}`}`;
1857
2001
  default:
1858
- return f;
2002
+ return h;
1859
2003
  }
1860
2004
  }
1861
- #ie() {
2005
+ #le() {
1862
2006
  const e = this._forms.filter((t) => t.listed !== !1);
1863
2007
  return c`
1864
2008
  ${g(W, V, { noAnim: !0 })}
1865
- <div class="options" role="group" aria-label=${Ee}>
1866
- ${e.map((t, r) => c`
1867
- <button type="button" class="chip" style="animation-delay: ${60 + r * 50}ms"
1868
- @click=${() => this.#I(t)}>${t.title}</button>
2009
+ <div class="options" role="group" aria-label=${Te}>
2010
+ ${e.map((t, s) => c`
2011
+ <button type="button" class="chip" style="animation-delay: ${60 + s * 50}ms"
2012
+ @click=${() => this.#E(t)}>${t.title}</button>
1869
2013
  `)}
1870
2014
  </div>
1871
2015
  `;
@@ -1880,21 +2024,21 @@ class ar extends G {
1880
2024
  const e = [];
1881
2025
  if (!this._form) return e;
1882
2026
  const t = this._origins[0]?.form || this._form;
1883
- e.push(g(W, V, { noAnim: !0 })), e.push(F(t.title, { noAnim: !0 })), this._notice && e.push(g(this._notice, "", { noAnim: !0 }));
1884
- let r = null;
2027
+ e.push(g(W, V, { noAnim: !0 })), e.push(v(t.title, { noAnim: !0 })), this._notice && e.push(g(this._notice, "", { noAnim: !0 }));
2028
+ let s = null;
1885
2029
  for (const i of this._origins) {
1886
- e.push(...this.#P(i.form, i.steps, r));
2030
+ e.push(...this.#P(i.form, i.steps, s));
1887
2031
  const n = x(i.form, i.option.nodeId);
1888
- n?.prompt && e.push(g(n.prompt, n.help, { noAnim: !0 })), r = i.option.label || i.option.optionId, e.push(F(r, { noAnim: !0 }));
2032
+ n?.prompt && e.push(g(n.prompt, n.help, { noAnim: !0 })), s = i.option.label || i.option.optionId, e.push(v(s, { noAnim: !0 }));
1889
2033
  }
1890
- return e.push(...this.#P(this._form, this._steps, r)), e;
2034
+ return e.push(...this.#P(this._form, this._steps, s)), e;
1891
2035
  }
1892
- #P(e, t, r = null) {
2036
+ #P(e, t, s = null) {
1893
2037
  const i = [];
1894
2038
  for (const n of t) {
1895
2039
  if (n.preset) {
1896
2040
  const a = n.label || n.optionId;
1897
- a !== r && i.push(F(a, { noAnim: !0 }));
2041
+ a !== s && i.push(v(a, { noAnim: !0 }));
1898
2042
  continue;
1899
2043
  }
1900
2044
  const o = x(e, n.nodeId);
@@ -1903,25 +2047,25 @@ class ar extends G {
1903
2047
  "You chose to send this anonymously.",
1904
2048
  { noAnim: !0 }
1905
2049
  ) : g(
1906
- "Last step: verify your email so we can follow up.",
2050
+ "Almost done: verify your email so we can follow up.",
1907
2051
  "One address, one code. No password needed.",
1908
2052
  { noAnim: !0 }
1909
- )), n.kind === "choice" && i.push(F(n.label || n.optionId, { noAnim: !0 })), n.kind === "collect" && i.push(F(n.summary || "Details provided", { noAnim: !0 })), n.kind === "gate" && i.push(F(n.anonymous ? "Send anonymously" : n.email, { noAnim: !0 }));
2053
+ )), n.kind === "choice" && i.push(v(n.label || n.optionId, { noAnim: !0 })), n.kind === "collect" && i.push(v(n.summary || "Details provided", { noAnim: !0 })), n.kind === "gate" && i.push(v(n.anonymous ? "Send anonymously" : n.email, { noAnim: !0 }));
1910
2054
  }
1911
2055
  return i;
1912
2056
  }
1913
- #ne() {
1914
- const { node: e, error: t } = this.#v;
1915
- return t || !e ? g("Something went sideways with this form.", "Please start over.", { error: !0 }) : e.type === "choice" ? this.#oe(e) : e.type === "collect" ? this.#ae(e) : e.type === "gate" ? this.#z(e) : e.type === "redirect" ? this.#he(e) : e.type === "terminal" ? this.#B() : f;
2057
+ #ce() {
2058
+ const { node: e, error: t } = this.#_;
2059
+ return t || !e ? g("Something went sideways with this form.", "Please start over.", { error: !0 }) : e.type === "choice" ? this.#de(e) : e.type === "collect" ? this.#ue(e) : e.type === "gate" ? this.#z(e) : e.type === "redirect" ? this.#ye(e) : e.type === "terminal" ? this.#N() : h;
1916
2060
  }
1917
- #oe(e) {
2061
+ #de(e) {
1918
2062
  return c`
1919
2063
  ${g(e.prompt, e.help)}
1920
- ${this._handoffError ? g("We could not load the forms.", "Check your connection and try again.", { error: !0 }) : f}
2064
+ ${this._handoffError ? g("We could not load the forms.", "Check your connection and try again.", { error: !0 }) : h}
1921
2065
  <div class="options" role="group" aria-label=${e.prompt || "Choose one"}>
1922
- ${(e.options || []).map((t, r) => c`
1923
- <button type="button" class="chip" style="animation-delay: ${60 + r * 50}ms"
1924
- @click=${() => this.#L(e, t)}>${t.label}</button>
2066
+ ${(e.options || []).map((t, s) => c`
2067
+ <button type="button" class="chip" style="animation-delay: ${60 + s * 50}ms"
2068
+ @click=${() => this.#q(e, t)}>${t.label}</button>
1925
2069
  `)}
1926
2070
  </div>
1927
2071
  `;
@@ -1932,94 +2076,94 @@ class ar extends G {
1932
2076
  * novalidate: the card validates itself (native url checks would
1933
2077
  * otherwise block the submit silently).
1934
2078
  */
1935
- #ae(e) {
2079
+ #ue(e) {
1936
2080
  const t = e.fields || [];
1937
2081
  return c`
1938
2082
  ${g(e.prompt, e.help)}
1939
2083
  <form class="form-card" autocomplete="on" novalidate
1940
- @submit=${(r) => {
1941
- r.preventDefault(), this.#j(e);
2084
+ @submit=${(s) => {
2085
+ s.preventDefault(), this.#V(e);
1942
2086
  }}>
1943
- ${t.map((r) => this.#le(e, r))}
2087
+ ${t.map((s) => this.#pe(e, s))}
1944
2088
  <button type="submit" class="btn-primary">Continue</button>
1945
2089
  </form>
1946
2090
  `;
1947
2091
  }
1948
- #le(e, t) {
1949
- const r = this.#S(e.id);
1950
- if (t.kind === "consent" && t.requiredIf === "media" && r === 0)
1951
- return f;
1952
- const i = this._cardValues[t.key], n = this._fieldErrors[t.key], o = !Fe(t, { mediaCount: r }) && t.kind !== "consent" ? c` <span class="opt">optional</span>` : f, a = t.kind === "consent" ? f : c`
2092
+ #pe(e, t) {
2093
+ const s = this.#C(e.id);
2094
+ if (t.kind === "consent" && t.requiredIf === "media" && s === 0)
2095
+ return h;
2096
+ const i = this._cardValues[t.key], n = this._fieldErrors[t.key], o = !Se(t, { mediaCount: s }) && t.kind !== "consent" ? c` <span class="opt">optional</span>` : h, a = t.kind === "consent" ? h : c`
1953
2097
  <label for="f-${t.key}">${t.label}${o}</label>
1954
2098
  `;
1955
2099
  return c`
1956
2100
  <div class="field">
1957
2101
  ${a}
1958
- ${this.#ce(e, t, i)}
1959
- ${n ? c`<div class="err" role="alert">${n}</div>` : f}
2102
+ ${this.#he(e, t, i)}
2103
+ ${n ? c`<div class="err" role="alert">${n}</div>` : h}
1960
2104
  </div>
1961
2105
  `;
1962
2106
  }
1963
- #ce(e, t, r) {
1964
- const i = (n) => (o) => this.#$(n, o.target.value);
2107
+ #he(e, t, s) {
2108
+ const i = (n) => (o) => this.#k(n, o.target.value);
1965
2109
  switch (t.kind) {
1966
2110
  case "text":
1967
- return c`<input type="text" id="f-${t.key}" name=${t.key} .value=${r || ""}
2111
+ return c`<input type="text" id="f-${t.key}" name=${t.key} .value=${s || ""}
1968
2112
  inputmode=${ce(t.inputMode)} autocomplete=${ce(t.autocomplete)}
1969
2113
  placeholder=${t.placeholder || ""} @input=${i(t.key)}>`;
1970
2114
  case "url":
1971
- return c`<input type="url" id="f-${t.key}" .value=${r || ""}
2115
+ return c`<input type="url" id="f-${t.key}" .value=${s || ""}
1972
2116
  placeholder=${t.placeholder || ""} @input=${i(t.key)}>`;
1973
2117
  case "textarea":
1974
- return c`<textarea id="f-${t.key}" .value=${r || ""}
2118
+ return c`<textarea id="f-${t.key}" .value=${s || ""}
1975
2119
  placeholder=${t.placeholder || ""} @input=${i(t.key)}></textarea>`;
1976
2120
  case "datetime":
1977
- return c`<input type="datetime-local" id="f-${t.key}" .value=${r || ""}
2121
+ return c`<input type="datetime-local" id="f-${t.key}" .value=${s || ""}
1978
2122
  @input=${i(t.key)}>`;
1979
2123
  case "select":
1980
2124
  return c`
1981
2125
  <select id="f-${t.key}" @change=${i(t.key)}>
1982
2126
  <option value="">Choose one</option>
1983
2127
  ${(t.options || []).map((n) => c`
1984
- <option value=${n.id} ?selected=${r === n.id}>${n.label}</option>
2128
+ <option value=${n.id} ?selected=${s === n.id}>${n.label}</option>
1985
2129
  `)}
1986
2130
  </select>
1987
2131
  `;
1988
2132
  case "location":
1989
- return this.#de(t, r || {});
2133
+ return this.#fe(t, s || {});
1990
2134
  case "consent":
1991
2135
  return c`
1992
2136
  <div class="consent-row">
1993
- <input type="checkbox" id="f-${t.key}" .checked=${r === !0}
1994
- @change=${(n) => this.#$(t.key, n.target.checked)}>
2137
+ <input type="checkbox" id="f-${t.key}" .checked=${s === !0}
2138
+ @change=${(n) => this.#k(t.key, n.target.checked)}>
1995
2139
  <label for="f-${t.key}" style="all: unset; cursor: pointer;">
1996
- ${t.text || er}
2140
+ ${t.text || ds}
1997
2141
  </label>
1998
2142
  </div>
1999
2143
  `;
2000
2144
  case "media":
2001
2145
  return c`
2002
2146
  <wral-report-media
2003
- .files=${this.#r[e.id] || []}
2004
- .lostMeta=${this.#s[e.id] || []}
2147
+ .files=${this.#s[e.id] || []}
2148
+ .lostMeta=${this.#r[e.id] || []}
2005
2149
  .budget=${this._form.budget || {}}
2006
2150
  ?required=${!!t.required}
2007
2151
  label=${t.label}
2008
2152
  @files-changed=${(n) => {
2009
- this.#r = { ...this.#r, [e.id]: n.detail.files }, this.requestUpdate();
2153
+ this.#s = { ...this.#s, [e.id]: n.detail.files }, this.requestUpdate();
2010
2154
  }}></wral-report-media>
2011
2155
  `;
2012
2156
  default:
2013
- return f;
2157
+ return h;
2014
2158
  }
2015
2159
  }
2016
- #de(e, t) {
2017
- const r = e.counties || Vt, i = (n) => this.#$(e.key, { ...t, ...n });
2160
+ #fe(e, t) {
2161
+ const s = e.counties || ss, i = (n) => this.#k(e.key, { ...t, ...n });
2018
2162
  return c`
2019
2163
  <select id="f-${e.key}" aria-label="County"
2020
2164
  @change=${(n) => i({ county: n.target.value || void 0 })}>
2021
2165
  <option value="">Choose a county</option>
2022
- ${r.map((n) => c`
2166
+ ${s.map((n) => c`
2023
2167
  <option value=${n} ?selected=${t.county === n}>${n}</option>
2024
2168
  `)}
2025
2169
  </select>
@@ -2031,24 +2175,24 @@ class ar extends G {
2031
2175
  `;
2032
2176
  }
2033
2177
  #z(e) {
2034
- this.#C();
2035
- const t = this._gate, r = g(
2036
- "Last step: verify your email so we can follow up.",
2178
+ this.#T();
2179
+ const t = this._gate, s = g(
2180
+ "Almost done: verify your email so we can follow up.",
2037
2181
  "One address, one code. No password needed."
2038
2182
  );
2039
2183
  return t.stage ? t.stage === "signedin" ? c`
2040
- ${r}
2184
+ ${s}
2041
2185
  <div class="form-card">
2042
2186
  <p style="margin: 0 0 12px; font-size: 14.5px;">
2043
2187
  You are signed in as <strong>${t.email || "your My WRAL account"}</strong> on this device.
2044
2188
  </p>
2045
2189
  <button type="button" class="btn-primary"
2046
- @click=${() => this.#R(t.email)}>Continue</button>
2190
+ @click=${() => this.#M(t.email)}>Continue</button>
2047
2191
  <button type="button" class="btn-ghost"
2048
- @click=${() => this.#W()}>Use a different email</button>
2192
+ @click=${() => this.#Y()}>Use a different email</button>
2049
2193
  </div>
2050
2194
  ` : t.stage === "email" ? c`
2051
- ${r}
2195
+ ${s}
2052
2196
  <div class="form-card login-card">
2053
2197
  <h2>Sign in or create account</h2>
2054
2198
  <p class="login-sub">
@@ -2062,12 +2206,12 @@ class ar extends G {
2062
2206
  this._gate = { ...t, email: i.target.value };
2063
2207
  }}
2064
2208
  @keydown=${(i) => {
2065
- i.key === "Enter" && this.#k();
2209
+ i.key === "Enter" && this.#A();
2066
2210
  }}>
2067
2211
  </div>
2068
- ${t.error ? c`<div class="err" role="alert">${t.error}</div>` : f}
2212
+ ${t.error ? c`<div class="err" role="alert">${t.error}</div>` : h}
2069
2213
  <button type="button" class="login-btn" ?disabled=${t.loading}
2070
- @click=${() => this.#k()}>
2214
+ @click=${() => this.#A()}>
2071
2215
  ${t.loading ? "Sending…" : "Continue with email"}
2072
2216
  </button>
2073
2217
  <div class="login-why">
@@ -2076,13 +2220,13 @@ class ar extends G {
2076
2220
  <li>We can follow up on your report</li>
2077
2221
  <li>Your contact information fills in automatically next time</li>
2078
2222
  <li>You are credited by name when we use your photos or video</li>
2079
- <li><a href=${Yt} target="_blank" rel="noopener">All other My WRAL account benefits</a></li>
2223
+ <li><a href=${rs} target="_blank" rel="noopener">All other My WRAL account benefits</a></li>
2080
2224
  </ul>
2081
2225
  </div>
2082
- ${this._submit.stage === "auth" ? f : this.#ue()}
2226
+ ${this._submit.stage === "auth" ? h : this.#me()}
2083
2227
  </div>
2084
- ` : t.stage === "anon-confirm" ? this.#pe(r) : c`
2085
- ${r}
2228
+ ` : t.stage === "anon-confirm" ? this.#ge(s) : c`
2229
+ ${s}
2086
2230
  <div class="form-card login-card">
2087
2231
  <h2>Enter verification code</h2>
2088
2232
  <p class="login-sub">We sent a 6-digit code to <strong>${t.email}</strong></p>
@@ -2095,47 +2239,47 @@ class ar extends G {
2095
2239
  <div class="field">
2096
2240
  <label>Verification code</label>
2097
2241
  <wral-code-input
2098
- @code-complete=${(i) => this.#T(i.detail?.code ?? i.detail?.value ?? i.target.value)}>
2242
+ @code-complete=${(i) => this.#R(i.detail?.code ?? i.detail?.value ?? i.target.value)}>
2099
2243
  </wral-code-input>
2100
2244
  </div>
2101
- ${t.error ? c`<div class="err" role="alert">${t.error}</div>` : f}
2245
+ ${t.error ? c`<div class="err" role="alert">${t.error}</div>` : h}
2102
2246
  <button type="button" class="login-btn" ?disabled=${t.loading}
2103
2247
  @click=${() => {
2104
2248
  const i = this.renderRoot.querySelector("wral-code-input");
2105
- this.#T(i?.value || "");
2249
+ this.#R(i?.value || "");
2106
2250
  }}>
2107
2251
  ${t.loading ? "Checking…" : "Sign in"}
2108
2252
  </button>
2109
2253
  <p class="login-help">
2110
2254
  Didn’t receive a code? Check your spam folder or
2111
- <button type="button" @click=${() => this.#k()}>resend a new code</button>.
2255
+ <button type="button" @click=${() => this.#A()}>resend a new code</button>.
2112
2256
  </p>
2113
2257
  </div>
2114
- ` : c`${r}${j()}`;
2258
+ ` : c`${s}${j()}`;
2115
2259
  }
2116
2260
  /* Collapsed by default: findable for whoever needs it, never the
2117
2261
  * first thing a viewer reaches for. */
2118
- #ue() {
2262
+ #me() {
2119
2263
  return c`
2120
2264
  <details class="login-alt">
2121
2265
  <summary>Other ways to send this</summary>
2122
2266
  <div class="alt-body">
2123
2267
  <p class="alt-row">
2124
2268
  Call the newsroom desk at
2125
- <a href=${Kt(we)}>${we}</a>.
2269
+ <a href=${ns(xe)}>${xe}</a>.
2126
2270
  </p>
2127
- ${this.#U ? c`
2271
+ ${this.#L ? c`
2128
2272
  <p class="alt-row">
2129
2273
  <button type="button" class="alt-link"
2130
- @click=${() => this.#V()}>Send this anonymously</button>
2274
+ @click=${() => this.#G()}>Send this anonymously</button>
2131
2275
  — no follow-up, and no credit if we use your photos or video.
2132
2276
  </p>
2133
- ` : f}
2277
+ ` : h}
2134
2278
  </div>
2135
2279
  </details>
2136
2280
  `;
2137
2281
  }
2138
- #pe(e) {
2282
+ #ge(e) {
2139
2283
  return c`
2140
2284
  ${e}
2141
2285
  <div class="form-card login-card">
@@ -2144,20 +2288,20 @@ class ar extends G {
2144
2288
  You can send this report without an account. Here is what it costs you.
2145
2289
  </p>
2146
2290
  <ul class="anon-costs">
2147
- ${Gt.map((t) => c`
2291
+ ${is.map((t) => c`
2148
2292
  <li><span class="x" aria-hidden="true">✕</span><span>${t}</span></li>
2149
2293
  `)}
2150
2294
  </ul>
2151
2295
  <div class="anon-actions">
2152
2296
  <button type="button" class="login-btn"
2153
- @click=${() => this.#Y()}>Sign in instead</button>
2297
+ @click=${() => this.#K()}>Sign in instead</button>
2154
2298
  <button type="button" class="btn-ghost"
2155
- @click=${() => this.#G()}>Continue anonymously</button>
2299
+ @click=${() => this.#Q()}>Continue anonymously</button>
2156
2300
  </div>
2157
2301
  </div>
2158
2302
  `;
2159
2303
  }
2160
- #he(e) {
2304
+ #ye(e) {
2161
2305
  const t = e.redirect || {};
2162
2306
  return c`
2163
2307
  <div class="form-card">
@@ -2176,8 +2320,8 @@ class ar extends G {
2176
2320
  </div>
2177
2321
  `;
2178
2322
  }
2179
- #B() {
2180
- const e = zt(this._form, this._steps);
2323
+ #N() {
2324
+ const e = Vt(this._form, this._steps);
2181
2325
  return c`
2182
2326
  ${g("Here is what you are sending.", "Check it over, then submit.")}
2183
2327
  <div class="form-card">
@@ -2185,22 +2329,22 @@ class ar extends G {
2185
2329
  ${e.map((t) => c`
2186
2330
  <li>
2187
2331
  <span class="k">${t.k}</span>
2188
- <span>${t.pill ? it(t.pill) : t.v}</span>
2332
+ <span>${t.pill ? at(t.pill) : t.v}</span>
2189
2333
  </li>
2190
2334
  `)}
2191
2335
  </ul>
2192
2336
  ${this._banner ? c`
2193
2337
  <div class="err" role="alert" style="margin-top: 12px;">${this._banner.message}</div>
2194
- ` : f}
2338
+ ` : h}
2195
2339
  <div style="margin-top: 16px;">
2196
- <button type="button" class="btn-primary" @click=${() => this.#Q()}>
2340
+ <button type="button" class="btn-primary" @click=${() => this.#J()}>
2197
2341
  Submit report
2198
2342
  </button>
2199
2343
  </div>
2200
2344
  </div>
2201
2345
  `;
2202
2346
  }
2203
- #fe() {
2347
+ #be() {
2204
2348
  const e = this._submit;
2205
2349
  if (e.stage === "auth") return this.#z({ id: null, type: "gate" });
2206
2350
  const t = {
@@ -2213,22 +2357,22 @@ class ar extends G {
2213
2357
  return c`
2214
2358
  ${g("Submitting your report.", t)}
2215
2359
  <div class="form-card">
2216
- ${e.files.map((r, i) => c`
2360
+ ${e.files.map((s, i) => c`
2217
2361
  <div class="upload-row">
2218
- <span class="name">${r.name}</span>
2362
+ <span class="name">${s.name}</span>
2219
2363
  <div class="upload-bar" role="progressbar"
2220
2364
  aria-valuemin="0" aria-valuemax="100"
2221
- aria-valuenow=${Math.round((r.status === "done" ? 1 : r.progress) * 100)}>
2222
- <div class="fill" style="width: ${(r.status === "done" ? 1 : r.progress) * 100}%"></div>
2365
+ aria-valuenow=${Math.round((s.status === "done" ? 1 : s.progress) * 100)}>
2366
+ <div class="fill" style="width: ${(s.status === "done" ? 1 : s.progress) * 100}%"></div>
2223
2367
  </div>
2224
- <span class="state ${r.status === "failed" ? "failed" : ""}">
2225
- ${r.status === "done" ? "Done" : r.status === "failed" ? "Failed" : "Uploading"}
2368
+ <span class="state ${s.status === "failed" ? "failed" : ""}">
2369
+ ${s.status === "done" ? "Done" : s.status === "failed" ? "Failed" : "Uploading"}
2226
2370
  </span>
2227
- ${r.status === "failed" ? c`
2228
- <button type="button" class="retry-chip" @click=${() => this.#X(i)}>
2371
+ ${s.status === "failed" ? c`
2372
+ <button type="button" class="retry-chip" @click=${() => this.#te(i)}>
2229
2373
  Retry
2230
2374
  </button>
2231
- ` : f}
2375
+ ` : h}
2232
2376
  </div>
2233
2377
  `)}
2234
2378
  ${e.stage === "requesting-error" ? c`
@@ -2236,51 +2380,55 @@ class ar extends G {
2236
2380
  ${this._banner?.retryAfter ? c`
2237
2381
  <div class="file-note">You can try again in about
2238
2382
  ${Math.ceil(this._banner.retryAfter / 60)} minutes.</div>
2239
- ` : f}
2383
+ ` : h}
2240
2384
  <button type="button" class="btn-primary" style="margin-top: 8px;"
2241
- @click=${() => this.#re()}>Try again</button>
2242
- ` : f}
2243
- ${ye(e).length && e.stage === "uploading-error" ? c`
2385
+ @click=${() => this.#oe()}>Try again</button>
2386
+ ` : h}
2387
+ ${we(e).length && e.stage === "uploading-error" ? c`
2244
2388
  <div class="err" role="alert">Retry the failed
2245
- ${ye(e).length === 1 ? "file" : "files"} to continue.</div>
2246
- ` : f}
2389
+ ${we(e).length === 1 ? "file" : "files"} to continue.</div>
2390
+ ` : h}
2247
2391
  </div>
2248
2392
  `;
2249
2393
  }
2250
- #me() {
2251
- const e = ke(this._form, this._steps), t = Bt(this._result, e), r = Ut({
2394
+ #we() {
2395
+ const e = Ie(this._form, this._steps), t = Yt(this._result, e), s = Kt({
2252
2396
  routing: this._result?.routing || {},
2253
2397
  flags: e,
2254
2398
  reference: this._result?.reference || "",
2255
- anonymous: this.#f
2399
+ anonymous: this.#u
2256
2400
  });
2257
2401
  return c`
2258
2402
  <div class="confirm-card">
2259
2403
  <div class="c-head">
2260
- <div class="c-check">${nt()}</div>
2404
+ <div class="c-check">${lt()}</div>
2261
2405
  <div>
2262
2406
  <div class="eyebrow">Report received</div>
2263
2407
  <h2>${t.title}</h2>
2264
2408
  </div>
2265
2409
  </div>
2266
2410
  <p>${t.body}</p>
2267
- ${t.urgentNote ? c`<p>${t.urgentNote}</p>` : f}
2411
+ ${t.urgentNote ? c`<p>${t.urgentNote}</p>` : h}
2412
+ ${this._factsOffer?.stage === "saved" ? c`
2413
+ <p role="status">Your ${this.#B} ${this._factsOffer.facts.length === 1 ? "is" : "are"}
2414
+ saved to your My WRAL account.</p>
2415
+ ` : h}
2268
2416
  <div class="refs">
2269
2417
  <span class="ref"><span class="rk">Reference</span>${this._result?.reference || ""}</span>
2270
2418
  </div>
2271
- <button type="button" class="c-again" @click=${() => this.#_()}>
2419
+ <button type="button" class="c-again" @click=${() => this.#$()}>
2272
2420
  Start a new report
2273
2421
  </button>
2274
2422
  </div>
2275
2423
  <div class="journey">
2276
2424
  <div class="j-eyebrow">Behind the scenes</div>
2277
2425
  <div class="j-title">What happens to your report now</div>
2278
- ${r.map((i, n) => c`
2426
+ ${s.map((i, n) => c`
2279
2427
  <div class="j-step">
2280
2428
  <div class="j-dot">${n + 1}</div>
2281
2429
  <div class="j-body">
2282
2430
  <div class="j-t">${i.title}
2283
- ${i.pill ? c` <span class="flag-pill urgent">${i.pill}</span>` : f}
2431
+ ${i.pill ? c` <span class="flag-pill urgent">${i.pill}</span>` : h}
2284
2432
  </div>
2285
2433
  <div class="j-d">${i.body}</div>
2286
2434
  </div>
@@ -2289,15 +2437,59 @@ class ar extends G {
2289
2437
  </div>
2290
2438
  `;
2291
2439
  }
2292
- #ge() {
2440
+ /* The offer is a step of its own: the confirmation waits for Save or No thanks. */
2441
+ get #xe() {
2442
+ return ["offer", "saving", "error"].includes(this._factsOffer?.stage);
2443
+ }
2444
+ get #B() {
2445
+ return (this._factsOffer?.facts || []).map((e) => e.label.toLowerCase()).join(" and ");
2446
+ }
2447
+ #ve() {
2448
+ const e = this._factsOffer?.stage;
2449
+ return e === "saved" ? v("Save to my account", { noAnim: !0 }) : e === "dismissed" ? v("No thanks", { noAnim: !0 }) : h;
2450
+ }
2451
+ #_e() {
2452
+ const e = this._factsOffer, t = e.stage === "saving";
2453
+ return c`
2454
+ ${g(
2455
+ `One more step: save your ${this.#B} to your new My WRAL account?`,
2456
+ "Only what is listed here is saved."
2457
+ )}
2458
+ <div class="form-card facts-offer">
2459
+ <dl>
2460
+ ${e.facts.map((s) => c`<dt>${s.label}</dt><dd>${s.value}</dd>`)}
2461
+ </dl>
2462
+ <p class="facts-note">
2463
+ ${ct()}
2464
+ <span>${e.facts.length === 1 ? "This is saved to your My WRAL dashboard, where you can change it anytime." : "These are saved to your My WRAL dashboard, where you can change them anytime."}</span>
2465
+ </p>
2466
+ ${e.stage === "error" ? c`
2467
+ <div class="err" role="alert">We couldn't save these. Please try again.</div>
2468
+ ` : h}
2469
+ <div class="actions">
2470
+ <button type="button" class="btn-primary" ?disabled=${t}
2471
+ @click=${() => this.#ie()}>
2472
+ ${t ? "Saving…" : e.stage === "error" ? "Try again" : "Save to my account"}
2473
+ </button>
2474
+ <button type="button" class="btn-ghost" ?disabled=${t}
2475
+ @click=${() => {
2476
+ this._factsOffer = { ...e, stage: "dismissed" };
2477
+ }}>
2478
+ No thanks
2479
+ </button>
2480
+ </div>
2481
+ </div>
2482
+ `;
2483
+ }
2484
+ #$e() {
2293
2485
  const e = this._phase === "submitting" || this._phase === "done" || this._phase === "loading" || this._phase === "load-error";
2294
2486
  return c`
2295
2487
  <div class="bottom-bar">
2296
2488
  <div class="inner">
2297
2489
  <button type="button" class="btn-ghost" ?disabled=${e || this._phase === "pick"}
2298
- @click=${() => this.#H()}>← Back</button>
2490
+ @click=${() => this.#W()}>← Back</button>
2299
2491
  <button type="button" class="btn-ghost" ?disabled=${this._phase === "submitting"}
2300
- @click=${() => this.#_()}>Start over</button>
2492
+ @click=${() => this.#$()}>Start over</button>
2301
2493
  <span class="note">Your report goes to a person on the right desk.</span>
2302
2494
  </div>
2303
2495
  </div>
@@ -2307,7 +2499,7 @@ class ar extends G {
2307
2499
  this.renderRoot?.querySelector(".chat")?.lastElementChild?.scrollIntoView?.({ block: "nearest" });
2308
2500
  }
2309
2501
  }
2310
- class lr extends G {
2502
+ class bs extends G {
2311
2503
  static properties = {
2312
2504
  files: { attribute: !1 },
2313
2505
  lostMeta: { attribute: !1 },
@@ -2315,7 +2507,7 @@ class lr extends G {
2315
2507
  required: { type: Boolean },
2316
2508
  label: { type: String }
2317
2509
  };
2318
- static styles = y`
2510
+ static styles = b`
2319
2511
  :host { display: block; }
2320
2512
  input[type=file] { font-family: inherit; font-size: 14px; }
2321
2513
  .file-list { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13.5px; }
@@ -2347,7 +2539,7 @@ class lr extends G {
2347
2539
  composed: !0
2348
2540
  }));
2349
2541
  }
2350
- #u(e) {
2542
+ #p(e) {
2351
2543
  const t = [...e.target.files || []];
2352
2544
  this.#l([...this.files || [], ...t]), e.target.value = "";
2353
2545
  }
@@ -2359,66 +2551,66 @@ class lr extends G {
2359
2551
  const e = this.files || [], { errors: t } = Y(e, this.budget, { required: !1 });
2360
2552
  return c`
2361
2553
  <input type="file" multiple
2362
- accept=${this.#c || f}
2554
+ accept=${this.#c || h}
2363
2555
  aria-label=${this.label}
2364
- @change=${this.#u}>
2556
+ @change=${this.#p}>
2365
2557
  ${e.length ? c`
2366
2558
  <ul class="file-list">
2367
- ${e.map((r, i) => c`
2559
+ ${e.map((s, i) => c`
2368
2560
  <li>
2369
- <span>${r.name}</span>
2370
- <span class="size">${tr(r.size)}</span>
2561
+ <span>${s.name}</span>
2562
+ <span class="size">${us(s.size)}</span>
2371
2563
  <button type="button" class="remove"
2372
- aria-label="Remove ${r.name}"
2564
+ aria-label="Remove ${s.name}"
2373
2565
  @click=${() => this.#t(i)}>✕</button>
2374
2566
  </li>
2375
2567
  `)}
2376
2568
  </ul>
2377
- ` : f}
2569
+ ` : h}
2378
2570
  ${(this.lostMeta || []).length ? c`
2379
2571
  <div class="lost">
2380
2572
  Please re-attach your ${this.lostMeta.length === 1 ? "file" : "files"}
2381
- (${this.lostMeta.map((r) => r.name).join(", ")}) —
2573
+ (${this.lostMeta.map((s) => s.name).join(", ")}) —
2382
2574
  attachments can't be saved between visits.
2383
2575
  </div>
2384
- ` : f}
2385
- ${t.map((r) => c`<div class="err">${r.message}</div>`)}
2576
+ ` : h}
2577
+ ${t.map((s) => c`<div class="err">${s.message}</div>`)}
2386
2578
  `;
2387
2579
  }
2388
2580
  }
2389
- function tr(s) {
2390
- return Number.isFinite(s) ? s >= 1024 * 1024 ? `${(s / (1024 * 1024)).toFixed(1)} MB` : s >= 1024 ? `${Math.round(s / 1024)} KB` : `${s} B` : "";
2581
+ function us(r) {
2582
+ return Number.isFinite(r) ? r >= 1024 * 1024 ? `${(r / (1024 * 1024)).toFixed(1)} MB` : r >= 1024 ? `${Math.round(r / 1024)} KB` : `${r} B` : "";
2391
2583
  }
2392
- const rr = (s, e, t, r) => {
2584
+ const ps = (r, e, t, s) => {
2393
2585
  const i = e.target.value.replace(/\D/g, "").slice(-1), n = [...t];
2394
- n[s] = i;
2586
+ n[r] = i;
2395
2587
  const o = n.join(""), a = n.every((l) => l !== "");
2396
- return r("code-change", { value: o, complete: a }), i && a && r("code-complete", { value: o }), n;
2397
- }, sr = (s, e, t, r) => {
2588
+ return s("code-change", { value: o, complete: a }), i && a && s("code-complete", { value: o }), n;
2589
+ }, hs = (r, e, t, s) => {
2398
2590
  if (e.key === "Backspace") {
2399
2591
  const i = [...t];
2400
- !i[s] && s > 0 ? i[s - 1] = "" : i[s] && (i[s] = "");
2592
+ !i[r] && r > 0 ? i[r - 1] = "" : i[r] && (i[r] = "");
2401
2593
  const n = i.join("");
2402
- return r("code-change", { value: n, complete: !1 }), i;
2594
+ return s("code-change", { value: n, complete: !1 }), i;
2403
2595
  }
2404
2596
  return t;
2405
- }, ir = (s, e, t) => {
2406
- s.preventDefault();
2407
- const r = s.clipboardData.getData("text").replace(/\D/g, "").slice(0, 6);
2408
- if (r.length === 0) return e;
2597
+ }, fs = (r, e, t) => {
2598
+ r.preventDefault();
2599
+ const s = r.clipboardData.getData("text").replace(/\D/g, "").slice(0, 6);
2600
+ if (s.length === 0) return e;
2409
2601
  const i = [...e];
2410
- for (let a = 0; a < r.length && a < 6; a++)
2411
- i[a] = r[a];
2602
+ for (let a = 0; a < s.length && a < 6; a++)
2603
+ i[a] = s[a];
2412
2604
  const n = i.join(""), o = i.every((a) => a !== "");
2413
- return t("code-change", { value: n, complete: o }), r.length === 6 && t("code-complete", { value: n }), i;
2605
+ return t("code-change", { value: n, complete: o }), s.length === 6 && t("code-complete", { value: n }), i;
2414
2606
  };
2415
- class cr extends G {
2607
+ class ws extends G {
2416
2608
  static formAssociated = !0;
2417
2609
  static properties = {
2418
2610
  _values: { type: Array, state: !0 },
2419
2611
  disabled: { type: Boolean, reflect: !0 }
2420
2612
  };
2421
- static styles = y`
2613
+ static styles = b`
2422
2614
  :host {
2423
2615
  display: block;
2424
2616
  width: 100%;
@@ -2517,7 +2709,7 @@ class cr extends G {
2517
2709
  this.getInputs()[e]?.focus();
2518
2710
  }
2519
2711
  inputHandler(e, t) {
2520
- this._values = rr(
2712
+ this._values = ps(
2521
2713
  e,
2522
2714
  t,
2523
2715
  this._values,
@@ -2526,17 +2718,17 @@ class cr extends G {
2526
2718
  }
2527
2719
  keydownHandler(e, t) {
2528
2720
  if (t.key === "Backspace") {
2529
- const r = !this._values[e];
2530
- this._values = sr(
2721
+ const s = !this._values[e];
2722
+ this._values = hs(
2531
2723
  e,
2532
2724
  t,
2533
2725
  this._values,
2534
2726
  this.dispatchCustomEvent.bind(this)
2535
- ), r && e > 0 && this.focusInput(e - 1);
2727
+ ), s && e > 0 && this.focusInput(e - 1);
2536
2728
  }
2537
2729
  }
2538
2730
  pasteHandler(e) {
2539
- this._values = ir(e, this._values, this.dispatchCustomEvent.bind(this));
2731
+ this._values = fs(e, this._values, this.dispatchCustomEvent.bind(this));
2540
2732
  }
2541
2733
  render() {
2542
2734
  return c`
@@ -2561,10 +2753,10 @@ class cr extends G {
2561
2753
  }
2562
2754
  }
2563
2755
  export {
2564
- cr as W,
2565
- lr as a,
2566
- ar as b,
2567
- ct as c,
2568
- at as d,
2569
- dt as e
2756
+ ws as W,
2757
+ bs as a,
2758
+ ys as b,
2759
+ vt as c,
2760
+ ut as d,
2761
+ _t as e
2570
2762
  };