@wral/report-it 0.1.1 → 0.1.2

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,6 +1,6 @@
1
1
  import { css as p, html as l, nothing as c, LitElement as I } from "lit";
2
- import { getAuthContext as O, createStorage as V, verifyCode as W, extractTokens as S, saveTokens as A, decodeJwtPayload as R, refreshTokenSimple as N, sendCode as H, createUserPool as Y, signUpIfNeeded as K, createCognitoUser as Q, getAuthHeaders as G, STORAGE_KEYS as _, isAuthenticatedSimple as J } from "@wral/sdk-auth-audience";
3
- const X = p`
2
+ import { getAuthContext as W, createStorage as V, verifyCode as N, extractTokens as S, saveTokens as A, decodeJwtPayload as R, refreshTokenSimple as H, sendCode as Y, createUserPool as K, signUpIfNeeded as Q, createCognitoUser as G, getAuthHeaders as J, STORAGE_KEYS as _, isAuthenticatedSimple as X } from "@wral/sdk-auth-audience";
3
+ const Z = p`
4
4
  :host {
5
5
  display: block;
6
6
  box-sizing: border-box;
@@ -24,7 +24,7 @@ const X = p`
24
24
  position: absolute; width: 1px; height: 1px; overflow: hidden;
25
25
  clip: rect(0 0 0 0); white-space: nowrap;
26
26
  }
27
- `, Z = p`
27
+ `, ee = p`
28
28
  @keyframes pop-in {
29
29
  0% { opacity: 0; transform: translateY(16px) scale(0.95); }
30
30
  100% { opacity: 1; transform: translateY(0) scale(1); }
@@ -55,7 +55,7 @@ const X = p`
55
55
  animation: none !important;
56
56
  }
57
57
  }
58
- `, ee = p`
58
+ `, te = p`
59
59
  .msg { max-width: 85%; padding: 12px 16px; border-radius: 14px; font-size: 15px; }
60
60
  .msg.bot {
61
61
  background: var(--wral-semantic-surface-default, #FFFFFF);
@@ -77,7 +77,7 @@ const X = p`
77
77
  .msg .sub { display: block; font-size: 13px; color: var(--wral-semantic-fg-muted, #64748B); margin-top: 4px; }
78
78
  .msg.user .sub { color: rgba(255, 255, 255, 0.75); }
79
79
  .msg.error { border-left: 3px solid var(--wral-base-red-on-light, #D1232A); }
80
- `, te = p`
80
+ `, re = p`
81
81
  .options { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; max-width: 92%; padding: 2px 0 6px; }
82
82
  .chip {
83
83
  font-family: var(--wral-base-font-ui, 'IBM Plex Sans Condensed', sans-serif);
@@ -91,7 +91,7 @@ const X = p`
91
91
  .chip:hover { background: var(--wral-base-secondary-1, #2594E3); color: #FFFFFF; }
92
92
  .chip:focus-visible { outline: 2px solid var(--wral-base-secondary-1, #2594E3); outline-offset: 2px; }
93
93
  .chip:active { transform: scale(0.97); }
94
- `, re = p`
94
+ `, se = p`
95
95
  .form-card {
96
96
  align-self: stretch;
97
97
  background: var(--wral-semantic-surface-default, #FFFFFF);
@@ -156,7 +156,7 @@ const X = p`
156
156
  .btn-ghost:hover { border-color: var(--wral-base-secondary-1, #2594E3); }
157
157
  .btn-ghost:active { transform: scale(0.97); }
158
158
  .btn-ghost:focus-visible { outline: 2px solid var(--wral-base-secondary-1, #2594E3); outline-offset: 2px; }
159
- `, se = p`
159
+ `, ie = p`
160
160
  .login-card { padding: 28px 26px; }
161
161
  .login-card h2 {
162
162
  font-family: var(--wral-base-font-display, 'IBM Plex Sans Condensed', sans-serif);
@@ -201,7 +201,14 @@ const X = p`
201
201
  }
202
202
  .login-why ul { margin: 0; padding-left: 20px; font-size: 14px; color: var(--color-gray-6, #565454); }
203
203
  .login-why li { margin-bottom: 4px; line-height: 1.5; }
204
- `, ie = p`
204
+ .login-why a { color: var(--color-secondary, #2594E3); font-weight: 600; text-decoration: underline; }
205
+ .login-anon {
206
+ border-top: 1px solid var(--color-gray-2, #E7E5E4); margin: 16px 0 0; padding-top: 14px;
207
+ font-size: 14px; color: var(--color-gray-6, #565454); line-height: 1.5;
208
+ }
209
+ .login-anon a { color: var(--color-primary-dark, #00144A); font-weight: 600; text-decoration: none; white-space: nowrap; }
210
+ .login-anon a:hover { text-decoration: underline; }
211
+ `, ae = p`
205
212
  .review-list { margin: 0; padding: 0; list-style: none; font-size: 14px; }
206
213
  .review-list li {
207
214
  display: grid; grid-template-columns: 130px 1fr; gap: 10px;
@@ -233,7 +240,7 @@ const X = p`
233
240
  color: var(--wral-base-primary-1, #001D68);
234
241
  }
235
242
  @media (max-width: 540px) { .review-list li { grid-template-columns: 1fr; gap: 2px; } }
236
- `, ae = p`
243
+ `, ne = p`
237
244
  .upload-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; }
238
245
  .upload-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
239
246
  .upload-row .state { font-size: 12px; color: var(--wral-semantic-fg-subtle, #64748B); }
@@ -249,7 +256,7 @@ const X = p`
249
256
  border-radius: 999px; padding: 3px 12px; cursor: pointer;
250
257
  }
251
258
  .retry-chip:focus-visible { outline: 2px solid var(--wral-base-secondary-1, #2594E3); outline-offset: 2px; }
252
- `, ne = p`
259
+ `, oe = p`
253
260
  .confirm-card {
254
261
  align-self: stretch;
255
262
  background: var(--wral-base-primary-1, #001D68);
@@ -299,7 +306,7 @@ const X = p`
299
306
  .c-again:hover { background: rgba(255, 255, 255, 0.12); }
300
307
  .c-again:focus-visible { outline: 2px solid var(--wral-base-secondary-2, #50A9E8); outline-offset: 2px; }
301
308
  .c-again:active { transform: scale(0.97); }
302
- `, oe = p`
309
+ `, le = p`
303
310
  .journey {
304
311
  align-self: stretch;
305
312
  background: var(--wral-semantic-surface-default, #FFFFFF);
@@ -340,7 +347,7 @@ const X = p`
340
347
  color: var(--wral-base-primary-1, #001D68); margin-bottom: 2px;
341
348
  }
342
349
  .j-body .j-d { font-size: 13.5px; color: var(--wral-semantic-fg-muted, #475569); line-height: 1.55; }
343
- `, le = p`
350
+ `, de = p`
344
351
  .bottom-bar {
345
352
  position: sticky; bottom: 0; z-index: 20;
346
353
  background: var(--wral-semantic-surface-default, #FFFFFF);
@@ -353,7 +360,7 @@ const X = p`
353
360
  }
354
361
  .bottom-bar .note { margin-left: auto; font-size: 12px; color: var(--wral-semantic-fg-subtle, #64748B); }
355
362
  @media (max-width: 540px) { .bottom-bar .note { display: none; } }
356
- `, de = [X, Z, ee, te, re, se, ie, ae, ne, oe, le];
363
+ `, ce = [Z, ee, te, re, se, ie, ae, ne, oe, le, de];
357
364
  function h(r, e, { noAnim: t = !1, error: s = !1 } = {}) {
358
365
  return l`
359
366
  <div class="msg bot ${t ? "no-anim" : ""} ${s ? "error" : ""}">
@@ -368,10 +375,10 @@ function v(r, { noAnim: e = !1 } = {}) {
368
375
  function $() {
369
376
  return l`<div class="msg bot typing"><span></span><span></span><span></span></div>`;
370
377
  }
371
- function ce(r) {
378
+ function ue(r) {
372
379
  return r ? l`<span class="flag-pill ${r}">${r === "urgent" ? "Urgent" : "Moderate"}</span>` : c;
373
380
  }
374
- function ue() {
381
+ function pe() {
375
382
  return l`
376
383
  <svg viewBox="0 0 24 24" fill="none" stroke="#FFFFFF" stroke-width="3"
377
384
  stroke-linecap="round" stroke-linejoin="round" width="20" height="20"
@@ -383,7 +390,7 @@ class w extends Error {
383
390
  super(`api-forms request failed with status ${e}`), this.status = e, this.body = t;
384
391
  }
385
392
  }
386
- function pe({
393
+ function he({
387
394
  baseUrl: r,
388
395
  fetchFn: e = (...i) => fetch(...i),
389
396
  xhrFactory: t = () => new XMLHttpRequest(),
@@ -443,25 +450,25 @@ function pe({
443
450
  putRequest: async (n, o) => await a(`/v1/requests/${n}`, { method: "PUT", body: o, auth: !0 })
444
451
  };
445
452
  }
446
- function he() {
447
- const { config: r, storage: e } = O();
453
+ function fe() {
454
+ const { config: r, storage: e } = W();
448
455
  let t = null;
449
456
  return {
450
- isAuthenticated: () => J(),
457
+ isAuthenticated: () => X(),
451
458
  signedInEmail: () => e.get(_.userEmail) || null,
452
- getAuthHeaders: () => G(r, e),
459
+ getAuthHeaders: () => J(r, e),
453
460
  /**
454
461
  * Email step. Keeps the challenge user in memory for verifyCode.
455
462
  * @returns {{challengeRequired?: boolean, authenticated?: boolean}}
456
463
  */
457
464
  sendCode: async (s) => {
458
- const i = await H(
465
+ const i = await Y(
459
466
  r,
460
467
  s,
461
468
  e,
462
- Y,
463
469
  K,
464
470
  Q,
471
+ G,
465
472
  S,
466
473
  A,
467
474
  R
@@ -479,7 +486,7 @@ function he() {
479
486
  if (!t)
480
487
  throw new Error("Please enter your email again to get a new code.");
481
488
  try {
482
- await W(
489
+ await N(
483
490
  t,
484
491
  s,
485
492
  e,
@@ -490,7 +497,7 @@ function he() {
490
497
  } catch {
491
498
  throw new Error("Invalid or expired code. Please request a new one and try again.");
492
499
  }
493
- return await N(), { success: !0 };
500
+ return await H(), { success: !0 };
494
501
  },
495
502
  /** Local sign-out only ("use a different email"). */
496
503
  signOut: () => {
@@ -508,14 +515,14 @@ function he() {
508
515
  }
509
516
  };
510
517
  }
511
- function fe({ baseUrl: r }) {
512
- const e = he();
513
- return { ...pe({ baseUrl: r, getAuthHeaders: e.getAuthHeaders }), ...e };
518
+ function ge({ baseUrl: r }) {
519
+ const e = fe();
520
+ return { ...he({ baseUrl: r, getAuthHeaders: e.getAuthHeaders }), ...e };
514
521
  }
515
522
  function g(r, e) {
516
523
  return (r?.nodes || []).find((t) => t.id === e);
517
524
  }
518
- function M(r, e = []) {
525
+ function U(r, e = []) {
519
526
  const t = [];
520
527
  let s = r?.start;
521
528
  for (const a of e) {
@@ -536,9 +543,9 @@ function M(r, e = []) {
536
543
  s = n.next;
537
544
  }
538
545
  const i = g(r, s);
539
- return i ? { nodeId: s, node: i, flags: j(t), error: null } : { nodeId: null, node: null, flags: t, error: { step: null, reason: `unknown node: ${s}` } };
546
+ return i ? { nodeId: s, node: i, flags: L(t), error: null } : { nodeId: null, node: null, flags: t, error: { step: null, reason: `unknown node: ${s}` } };
540
547
  }
541
- function ge(r, e = []) {
548
+ function me(r, e = []) {
542
549
  const t = [];
543
550
  for (const s of e) {
544
551
  if (s.kind !== "collect") continue;
@@ -547,37 +554,37 @@ function ge(r, e = []) {
547
554
  }
548
555
  return t;
549
556
  }
550
- function me(r = []) {
557
+ function be(r = []) {
551
558
  const e = {};
552
559
  for (const t of r)
553
560
  t.kind === "collect" && Object.assign(e, t.values || {});
554
561
  return e;
555
562
  }
556
- function be(r = []) {
563
+ function ye(r = []) {
557
564
  return r.filter((e) => e.kind === "choice").map((e) => `${e.nodeId}:${e.optionId}`);
558
565
  }
559
- function U(r, e = []) {
566
+ function j(r, e = []) {
560
567
  const t = [];
561
568
  for (const s of e) {
562
569
  if (s.kind !== "choice") continue;
563
570
  const a = (g(r, s.nodeId)?.options || []).find((n) => n.id === s.optionId);
564
571
  t.push(...a?.flags || []);
565
572
  }
566
- return j(t);
573
+ return L(t);
567
574
  }
568
- function ye(r = []) {
575
+ function we(r = []) {
569
576
  return r.includes("urgent") ? "urgent" : r.includes("moderate") ? "moderate" : null;
570
577
  }
571
- function j(r) {
578
+ function L(r) {
572
579
  return [...new Set(r)];
573
580
  }
574
- const we = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/, D = {
581
+ const xe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/, D = {
575
582
  text: 500,
576
583
  textarea: 5e3,
577
584
  url: 2048
578
585
  };
579
- function xe(r, e) {
580
- if (e == null || e === "" || r.kind === "location" && ve(e))
586
+ function ve(r, e) {
587
+ if (e == null || e === "" || r.kind === "location" && ke(e))
581
588
  return r.required ? `Please fill in: ${r.label.toLowerCase()}.` : null;
582
589
  switch (r.kind) {
583
590
  case "text":
@@ -595,30 +602,30 @@ function xe(r, e) {
595
602
  }
596
603
  }
597
604
  case "datetime":
598
- return we.test(String(e)) ? null : "Please pick a date and time.";
605
+ return xe.test(String(e)) ? null : "Please pick a date and time.";
599
606
  case "select":
600
607
  return (r.options || []).map((i) => i.id).includes(e) ? null : `Please choose one of the options for ${r.label.toLowerCase()}.`;
601
608
  case "consent":
602
609
  return e === !0 ? null : "Please confirm the rights statement so we can use what you send.";
603
610
  case "location":
604
- return ke(r, e);
611
+ return _e(r, e);
605
612
  case "media":
606
613
  return null;
607
614
  default:
608
615
  return `Unsupported field: ${r.kind}`;
609
616
  }
610
617
  }
611
- function ve(r) {
618
+ function ke(r) {
612
619
  return r == null ? !0 : typeof r != "object" ? !1 : !r.county && !r.where && !(Array.isArray(r.gps) && r.gps.length);
613
620
  }
614
- function ke(r, e) {
621
+ function _e(r, e) {
615
622
  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;
616
623
  }
617
624
  function T(r, e = {}) {
618
625
  const t = {};
619
626
  for (const s of r) {
620
627
  if (s.kind === "media") continue;
621
- const i = xe(s, e[s.key]);
628
+ const i = ve(s, e[s.key]);
622
629
  i && (t[s.key] = i);
623
630
  }
624
631
  return { ok: Object.keys(t).length === 0, errors: t };
@@ -651,8 +658,8 @@ function z({ formId: r, requestId: e, files: t }) {
651
658
  files: t.map((s) => ({ contentType: s.type, size: s.size }))
652
659
  };
653
660
  }
654
- function _e({ form: r, steps: e, media: t = [] }) {
655
- const s = ge(r, e), i = me(e), a = {};
661
+ function $e({ form: r, steps: e, media: t = [] }) {
662
+ const s = me(r, e), i = be(e), a = {};
656
663
  for (const n of s) {
657
664
  if (n.kind === "media") continue;
658
665
  const o = i[n.key];
@@ -668,12 +675,12 @@ function _e({ form: r, steps: e, media: t = [] }) {
668
675
  return {
669
676
  formId: r.formId,
670
677
  flowVersion: r.flowVersion,
671
- path: be(e),
678
+ path: ye(e),
672
679
  answers: a,
673
680
  media: t.map(({ assetId: n, type: o }) => ({ assetId: n, type: o }))
674
681
  };
675
682
  }
676
- function $e(r, e) {
683
+ function Fe(r, e) {
677
684
  if (r === 429)
678
685
  return {
679
686
  kind: "throttled",
@@ -711,15 +718,15 @@ function $e(r, e) {
711
718
  message: "Something went wrong on our end; please try again."
712
719
  };
713
720
  }
714
- const Fe = 34, Ie = 44;
721
+ const Ie = 34, Ee = 44;
715
722
  function P(r, e) {
716
723
  const t = String(r);
717
724
  return t.length > e ? `${t.slice(0, e)}…` : t;
718
725
  }
719
- function Ee(r) {
726
+ function Ce(r) {
720
727
  return !r || typeof r != "object" ? "" : [r.county, r.where].filter(Boolean).join(", ");
721
728
  }
722
- function Ce(r, e = {}, t = []) {
729
+ function Se(r, e = {}, t = []) {
723
730
  const s = [];
724
731
  for (const i of r) {
725
732
  if (i.kind === "consent") continue;
@@ -727,21 +734,21 @@ function Ce(r, e = {}, t = []) {
727
734
  t.length && s.push(`${t.length} ${t.length === 1 ? "file" : "files"}`);
728
735
  continue;
729
736
  }
730
- const a = i.kind === "location" ? Ee(e[i.key]) : e[i.key];
731
- a == null || a === "" || (i.kind === "textarea" ? s.push(`"${P(a, Ie)}"`) : s.push(P(a, Fe)));
737
+ const a = i.kind === "location" ? Ce(e[i.key]) : e[i.key];
738
+ a == null || a === "" || (i.kind === "textarea" ? s.push(`"${P(a, Ee)}"`) : s.push(P(a, Ie)));
732
739
  }
733
740
  return s.join(" · ") || "Details provided";
734
741
  }
735
- function Se(r, e = [], t = null) {
742
+ function Ae(r, e = [], t = null) {
736
743
  const s = [];
737
744
  for (const a of e) {
738
745
  const n = g(r, a.nodeId);
739
746
  a.kind === "choice" && n && s.push({ k: (n.prompt || "").replace(/\?$/, ""), v: a.label || a.optionId }), a.kind === "collect" && s.push({ k: "Details", v: a.summary || "Details provided" }), a.kind === "gate" && (a.email || t) && s.push({ k: "Verified email", v: a.email || t });
740
747
  }
741
- const i = ye(U(r, e));
748
+ const i = we(j(r, e));
742
749
  return i && s.push({ k: "Priority", v: i === "urgent" ? "Urgent" : "Moderate", pill: i }), s;
743
750
  }
744
- function Ae(r, e = []) {
751
+ function Re(r, e = []) {
745
752
  const t = r?.confirmation || {};
746
753
  return {
747
754
  title: t.title || "Report received.",
@@ -749,11 +756,11 @@ function Ae(r, e = []) {
749
756
  urgentNote: e.includes("urgent") ? t.urgentNote : void 0
750
757
  };
751
758
  }
752
- function Re(r, e) {
759
+ function De(r, e) {
753
760
  const t = e === "failed" ? " The notification is queued for a delivery retry." : "";
754
761
  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.";
755
762
  }
756
- function De({ routing: r = {}, flags: e = [], reference: t = "" }) {
763
+ function Te({ routing: r = {}, flags: e = [], reference: t = "" }) {
757
764
  const s = e.includes("urgent");
758
765
  return [
759
766
  {
@@ -762,7 +769,7 @@ function De({ routing: r = {}, flags: e = [], reference: t = "" }) {
762
769
  },
763
770
  {
764
771
  title: "Routed",
765
- body: Re(r.destination, r.state),
772
+ body: De(r.destination, r.state),
766
773
  pill: s ? "Urgent · pinned first" : void 0
767
774
  },
768
775
  {
@@ -779,19 +786,19 @@ function De({ routing: r = {}, flags: e = [], reference: t = "" }) {
779
786
  }
780
787
  ];
781
788
  }
782
- const E = "wral-report-it:draft:v1", L = 1;
783
- function Te(r, e) {
789
+ const E = "wral-report-it:draft:v1", O = 1;
790
+ function ze(r, e) {
784
791
  try {
785
- r.setItem(E, JSON.stringify({ ...e, v: L, savedAt: Date.now() }));
792
+ r.setItem(E, JSON.stringify({ ...e, v: O, savedAt: Date.now() }));
786
793
  } catch {
787
794
  }
788
795
  }
789
- function ze(r) {
796
+ function Pe(r) {
790
797
  try {
791
798
  const e = r.getItem(E);
792
799
  if (!e) return null;
793
800
  const t = JSON.parse(e);
794
- return t?.v !== L ? null : t;
801
+ return t?.v !== O ? null : t;
795
802
  } catch {
796
803
  return null;
797
804
  }
@@ -802,7 +809,7 @@ function B(r) {
802
809
  } catch {
803
810
  }
804
811
  }
805
- function Pe({ apiOrigin: r, form: e, steps: t, requestId: s = null, mediaMeta: i = {} }) {
812
+ function Be({ apiOrigin: r, form: e, steps: t, requestId: s = null, mediaMeta: i = {} }) {
806
813
  return {
807
814
  apiOrigin: r,
808
815
  formId: e.formId,
@@ -812,13 +819,13 @@ function Pe({ apiOrigin: r, form: e, steps: t, requestId: s = null, mediaMeta: i
812
819
  media: i
813
820
  };
814
821
  }
815
- function Be(r, e, { apiOrigin: t } = {}) {
822
+ function qe(r, e, { apiOrigin: t } = {}) {
816
823
  if (!r) return { status: "discarded" };
817
824
  if (t && r.apiOrigin && r.apiOrigin !== t)
818
825
  return { status: "discarded" };
819
826
  const s = (e || []).find((n) => n.formId === r.formId);
820
827
  if (!s) return { status: "discarded" };
821
- const { error: i } = M(s, r.steps || []);
828
+ const { error: i } = U(s, r.steps || []);
822
829
  if (i) return { status: "discarded" };
823
830
  const a = {};
824
831
  for (const [n, o] of Object.entries(r.media || {}))
@@ -851,7 +858,7 @@ function k(r = []) {
851
858
  error: null
852
859
  };
853
860
  }
854
- function qe(r, e) {
861
+ function Me(r, e) {
855
862
  switch (e.type) {
856
863
  case "START":
857
864
  return { ...r, stage: r.files.length ? "minting" : "requesting", error: null };
@@ -878,7 +885,7 @@ function qe(r, e) {
878
885
  }));
879
886
  case "FILE_DONE": {
880
887
  const t = x(r, e.i, (s) => ({ ...s, status: "done", progress: 1 }));
881
- return Me(t);
888
+ return Ue(t);
882
889
  }
883
890
  case "FILE_FAIL":
884
891
  return { ...x(r, e.i, (s) => ({
@@ -919,14 +926,14 @@ function x(r, e, t) {
919
926
  const s = r.files.map((i, a) => a === e ? t(i) : i);
920
927
  return { ...r, files: s };
921
928
  }
922
- function Me(r) {
929
+ function Ue(r) {
923
930
  const e = r.files.every((s) => s.status === "done"), t = r.files.some((s) => s.status === "failed");
924
931
  return e ? { ...r, stage: "requesting" } : t ? { ...r, stage: "uploading-error" } : r;
925
932
  }
926
933
  function q(r) {
927
934
  return r.files.map((e, t) => ({ ...e, i: t })).filter((e) => e.status === "failed");
928
935
  }
929
- const Ue = [
936
+ const je = [
930
937
  "Wake",
931
938
  "Durham",
932
939
  "Orange",
@@ -943,9 +950,14 @@ const Ue = [
943
950
  "Moore",
944
951
  "Sampson",
945
952
  "Other / outside the area"
946
- ], je = "https://api.wral.com/forms", Le = 480, Oe = 2;
947
- class Qe extends I {
948
- static styles = de;
953
+ ], M = "(919) 821-8600", Le = "https://www.wral.com/my-wral/";
954
+ function Oe(r) {
955
+ const e = String(r).replace(/\D/g, "");
956
+ return `tel:+1${e.length === 11 && e.startsWith("1") ? e.slice(1) : e}`;
957
+ }
958
+ const We = "https://api.wral.com/forms", Ve = 480, Ne = 2;
959
+ class Xe extends I {
960
+ static styles = ce;
949
961
  static properties = {
950
962
  api: { type: String },
951
963
  _phase: { state: !0 },
@@ -972,10 +984,10 @@ class Qe extends I {
972
984
  #m = !1;
973
985
  #l = null;
974
986
  constructor() {
975
- super(), this.api = je, this._phase = "loading", this._forms = [], this._form = null, this._steps = [], this._typing = !1, this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit = k([]), this._banner = null, this._notice = null, this._result = null;
987
+ super(), this.api = We, this._phase = "loading", this._forms = [], this._form = null, this._steps = [], this._typing = !1, this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, this._submit = k([]), this._banner = null, this._notice = null, this._result = null;
976
988
  }
977
989
  get client() {
978
- return this.#o ? this.#o : ((!this.#a || this.#u !== this.api) && (this.#a = fe({ baseUrl: this.api }), this.#u = this.api), this.#a);
990
+ return this.#o ? this.#o : ((!this.#a || this.#u !== this.api) && (this.#a = ge({ baseUrl: this.api }), this.#u = this.api), this.#a);
979
991
  }
980
992
  set client(e) {
981
993
  this.#o = e || null, this.isConnected && this.#b();
@@ -1013,7 +1025,7 @@ class Qe extends I {
1013
1025
  this._phase = "load-error";
1014
1026
  return;
1015
1027
  }
1016
- const e = Be(ze(this.#p), this._forms, { apiOrigin: this.api });
1028
+ const e = qe(Pe(this.#p), this._forms, { apiOrigin: this.api });
1017
1029
  if (e.status === "ok" || e.status === "review-required") {
1018
1030
  this._form = e.form, this._steps = e.steps, this.#t = e.requestId, this.#s = e.lostMedia || {}, e.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.#n({ animate: !1 });
1019
1031
  return;
@@ -1025,7 +1037,7 @@ class Qe extends I {
1025
1037
  const e = {};
1026
1038
  for (const [t, s] of Object.entries(this.#r))
1027
1039
  s.length && (e[t] = s.map(({ name: i, type: a, size: n }) => ({ name: i, type: a, size: n })));
1028
- Te(this.#p, Pe({
1040
+ ze(this.#p, Be({
1029
1041
  apiOrigin: this.api,
1030
1042
  form: this._form,
1031
1043
  steps: this._steps,
@@ -1037,10 +1049,10 @@ class Qe extends I {
1037
1049
  #n({ animate: e = !0 } = {}) {
1038
1050
  this._phase = "walk", this._cardValues = {}, this._fieldErrors = {}, this._gate = { stage: null, email: "", error: "", loading: !1 }, e && !this.#A ? (this._typing = !0, clearTimeout(this.#g), this.#g = setTimeout(() => {
1039
1051
  this._typing = !1;
1040
- }, Le)) : this._typing = !1;
1052
+ }, Ve)) : this._typing = !1;
1041
1053
  }
1042
1054
  get #_() {
1043
- return this._form ? M(this._form, this._steps) : { node: null };
1055
+ return this._form ? U(this._form, this._steps) : { node: null };
1044
1056
  }
1045
1057
  #R(e) {
1046
1058
  this._form = e, this._steps = [], this.#t = null, this.#r = {}, this.#s = {}, this._notice = null, this.#d(), this.#n();
@@ -1086,7 +1098,7 @@ class Qe extends I {
1086
1098
  nodeId: e.id,
1087
1099
  kind: "collect",
1088
1100
  values: { ...this._cardValues },
1089
- summary: Ce(t, this._cardValues, o)
1101
+ summary: Se(t, this._cardValues, o)
1090
1102
  });
1091
1103
  }
1092
1104
  // ── Gate ────────────────────────────────────────────────────────
@@ -1155,7 +1167,7 @@ class Qe extends I {
1155
1167
  return e;
1156
1168
  }
1157
1169
  #e(e) {
1158
- this._submit = qe(this._submit, e);
1170
+ this._submit = Me(this._submit, e);
1159
1171
  }
1160
1172
  async #P() {
1161
1173
  this._banner = null;
@@ -1202,7 +1214,7 @@ class Qe extends I {
1202
1214
  #E() {
1203
1215
  const e = this._submit.files, t = this.#i.size;
1204
1216
  let s = 0;
1205
- for (let i = 0; i < e.length && t + s < Oe; i++)
1217
+ for (let i = 0; i < e.length && t + s < Ne; i++)
1206
1218
  e[i].status !== "uploading" || this.#i.has(i) || (s += 1, this.#q(i));
1207
1219
  }
1208
1220
  #q(e) {
@@ -1243,7 +1255,7 @@ class Qe extends I {
1243
1255
  }
1244
1256
  async #U() {
1245
1257
  try {
1246
- const e = this._submit.files.map(({ assetId: s, type: i }) => ({ assetId: s, type: i })), t = await this.client.putRequest(this.#t, _e({
1258
+ const e = this._submit.files.map(({ assetId: s, type: i }) => ({ assetId: s, type: i })), t = await this.client.putRequest(this.#t, $e({
1247
1259
  form: this._form,
1248
1260
  steps: this._steps,
1249
1261
  media: e
@@ -1254,7 +1266,7 @@ class Qe extends I {
1254
1266
  }
1255
1267
  }
1256
1268
  #k(e) {
1257
- const t = $e(e?.status ?? 0, e?.body ?? null);
1269
+ const t = Fe(e?.status ?? 0, e?.body ?? null);
1258
1270
  if (t.kind === "auth") {
1259
1271
  this.#e({ type: "AUTH_REQUIRED" }), this._gate = { stage: "email", email: "", error: "", loading: !1 };
1260
1272
  return;
@@ -1297,9 +1309,9 @@ class Qe extends I {
1297
1309
  </div>
1298
1310
  `;
1299
1311
  case "pick":
1300
- return this.#V();
1312
+ return this.#W();
1301
1313
  case "walk":
1302
- return l`${this.#f()}${this._typing ? $() : this.#W()}`;
1314
+ return l`${this.#f()}${this._typing ? $() : this.#V()}`;
1303
1315
  case "review":
1304
1316
  return l`${this.#f()}${this.#S()}`;
1305
1317
  case "submitting":
@@ -1310,7 +1322,7 @@ class Qe extends I {
1310
1322
  return c;
1311
1323
  }
1312
1324
  }
1313
- #V() {
1325
+ #W() {
1314
1326
  const e = this._forms;
1315
1327
  return l`
1316
1328
  ${h(
@@ -1342,7 +1354,7 @@ class Qe extends I {
1342
1354
  }
1343
1355
  return e;
1344
1356
  }
1345
- #W() {
1357
+ #V() {
1346
1358
  const { node: e, error: t } = this.#_;
1347
1359
  return t || !e ? h("Something went sideways with this form.", "Please start over.", { error: !0 }) : e.type === "choice" ? this.#N(e) : e.type === "collect" ? this.#H(e) : e.type === "gate" ? this.#C(e) : e.type === "redirect" ? this.#G(e) : e.type === "terminal" ? this.#S() : c;
1348
1360
  }
@@ -1440,7 +1452,7 @@ class Qe extends I {
1440
1452
  }
1441
1453
  }
1442
1454
  #Q(e, t) {
1443
- const s = e.counties || Ue, i = (a) => this.#x(e.key, { ...t, ...a });
1455
+ const s = e.counties || je, i = (a) => this.#x(e.key, { ...t, ...a });
1444
1456
  return l`
1445
1457
  <select id="f-${e.key}" aria-label="County"
1446
1458
  @change=${(a) => i({ county: a.target.value || void 0 })}>
@@ -1502,8 +1514,13 @@ class Qe extends I {
1502
1514
  <li>We can follow up on your report</li>
1503
1515
  <li>Your contact information fills in automatically next time</li>
1504
1516
  <li>You are credited by name when we use your photos or video</li>
1517
+ <li><a href=${Le} target="_blank" rel="noopener">All other My WRAL account benefits</a></li>
1505
1518
  </ul>
1506
1519
  </div>
1520
+ <p class="login-anon">
1521
+ Want to remain anonymous? Call us at
1522
+ <a href=${Oe(M)}>${M}</a>.
1523
+ </p>
1507
1524
  </div>
1508
1525
  ` : l`
1509
1526
  ${s}
@@ -1557,7 +1574,7 @@ class Qe extends I {
1557
1574
  `;
1558
1575
  }
1559
1576
  #S() {
1560
- const e = Se(this._form, this._steps);
1577
+ const e = Ae(this._form, this._steps);
1561
1578
  return l`
1562
1579
  ${h("Here is what you are sending.", "Check it over, then submit.")}
1563
1580
  <div class="form-card">
@@ -1565,7 +1582,7 @@ class Qe extends I {
1565
1582
  ${e.map((t) => l`
1566
1583
  <li>
1567
1584
  <span class="k">${t.k}</span>
1568
- <span>${t.pill ? ce(t.pill) : t.v}</span>
1585
+ <span>${t.pill ? ue(t.pill) : t.v}</span>
1569
1586
  </li>
1570
1587
  `)}
1571
1588
  </ul>
@@ -1625,7 +1642,7 @@ class Qe extends I {
1625
1642
  `;
1626
1643
  }
1627
1644
  #X() {
1628
- const e = U(this._form, this._steps), t = Ae(this._result, e), s = De({
1645
+ const e = j(this._form, this._steps), t = Re(this._result, e), s = Te({
1629
1646
  routing: this._result?.routing || {},
1630
1647
  flags: e,
1631
1648
  reference: this._result?.reference || ""
@@ -1633,7 +1650,7 @@ class Qe extends I {
1633
1650
  return l`
1634
1651
  <div class="confirm-card">
1635
1652
  <div class="c-head">
1636
- <div class="c-check">${ue()}</div>
1653
+ <div class="c-check">${pe()}</div>
1637
1654
  <div>
1638
1655
  <div class="eyebrow">Report received</div>
1639
1656
  <h2>${t.title}</h2>
@@ -1683,7 +1700,7 @@ class Qe extends I {
1683
1700
  this.renderRoot?.querySelector(".chat")?.lastElementChild?.scrollIntoView?.({ block: "nearest" });
1684
1701
  }
1685
1702
  }
1686
- class Ge extends I {
1703
+ class Ze extends I {
1687
1704
  static properties = {
1688
1705
  files: { attribute: !1 },
1689
1706
  lostMeta: { attribute: !1 },
@@ -1743,7 +1760,7 @@ class Ge extends I {
1743
1760
  ${e.map((s, i) => l`
1744
1761
  <li>
1745
1762
  <span>${s.name}</span>
1746
- <span class="size">${Ve(s.size)}</span>
1763
+ <span class="size">${He(s.size)}</span>
1747
1764
  <button type="button" class="remove"
1748
1765
  aria-label="Remove ${s.name}"
1749
1766
  @click=${() => this.#t(i)}>✕</button>
@@ -1762,15 +1779,15 @@ class Ge extends I {
1762
1779
  `;
1763
1780
  }
1764
1781
  }
1765
- function Ve(r) {
1782
+ function He(r) {
1766
1783
  return Number.isFinite(r) ? r >= 1024 * 1024 ? `${(r / (1024 * 1024)).toFixed(1)} MB` : r >= 1024 ? `${Math.round(r / 1024)} KB` : `${r} B` : "";
1767
1784
  }
1768
- const We = (r, e, t, s) => {
1785
+ const Ye = (r, e, t, s) => {
1769
1786
  const i = e.target.value.replace(/\D/g, "").slice(-1), a = [...t];
1770
1787
  a[r] = i;
1771
1788
  const n = a.join(""), o = a.every((d) => d !== "");
1772
1789
  return s("code-change", { value: n, complete: o }), i && o && s("code-complete", { value: n }), a;
1773
- }, Ne = (r, e, t, s) => {
1790
+ }, Ke = (r, e, t, s) => {
1774
1791
  if (e.key === "Backspace") {
1775
1792
  const i = [...t];
1776
1793
  !i[r] && r > 0 ? i[r - 1] = "" : i[r] && (i[r] = "");
@@ -1778,7 +1795,7 @@ const We = (r, e, t, s) => {
1778
1795
  return s("code-change", { value: a, complete: !1 }), i;
1779
1796
  }
1780
1797
  return t;
1781
- }, He = (r, e, t) => {
1798
+ }, Qe = (r, e, t) => {
1782
1799
  r.preventDefault();
1783
1800
  const s = r.clipboardData.getData("text").replace(/\D/g, "").slice(0, 6);
1784
1801
  if (s.length === 0) return e;
@@ -1788,7 +1805,7 @@ const We = (r, e, t, s) => {
1788
1805
  const a = i.join(""), n = i.every((o) => o !== "");
1789
1806
  return t("code-change", { value: a, complete: n }), s.length === 6 && t("code-complete", { value: a }), i;
1790
1807
  };
1791
- class Je extends I {
1808
+ class et extends I {
1792
1809
  static formAssociated = !0;
1793
1810
  static properties = {
1794
1811
  _values: { type: Array, state: !0 },
@@ -1893,7 +1910,7 @@ class Je extends I {
1893
1910
  this.getInputs()[e]?.focus();
1894
1911
  }
1895
1912
  inputHandler(e, t) {
1896
- this._values = We(
1913
+ this._values = Ye(
1897
1914
  e,
1898
1915
  t,
1899
1916
  this._values,
@@ -1903,7 +1920,7 @@ class Je extends I {
1903
1920
  keydownHandler(e, t) {
1904
1921
  if (t.key === "Backspace") {
1905
1922
  const s = !this._values[e];
1906
- this._values = Ne(
1923
+ this._values = Ke(
1907
1924
  e,
1908
1925
  t,
1909
1926
  this._values,
@@ -1912,7 +1929,7 @@ class Je extends I {
1912
1929
  }
1913
1930
  }
1914
1931
  pasteHandler(e) {
1915
- this._values = He(e, this._values, this.dispatchCustomEvent.bind(this));
1932
+ this._values = Qe(e, this._values, this.dispatchCustomEvent.bind(this));
1916
1933
  }
1917
1934
  render() {
1918
1935
  return l`
@@ -1937,10 +1954,10 @@ class Je extends I {
1937
1954
  }
1938
1955
  }
1939
1956
  export {
1940
- Je as W,
1941
- Ge as a,
1942
- Qe as b,
1943
- he as c,
1944
- pe as d,
1945
- fe as e
1957
+ et as W,
1958
+ Ze as a,
1959
+ Xe as b,
1960
+ fe as c,
1961
+ he as d,
1962
+ ge as e
1946
1963
  };