@getcredify/credify-insurance-widget 1.42.0 → 1.44.0

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.
Files changed (56) hide show
  1. package/README.md +18 -0
  2. package/dist/{address-BEVwov8q-C8G87tij.js → address-BEVwov8q-CuX4iOBo.js} +1 -1
  3. package/dist/{api-C7f0dnt7.js → api-DYP3b3gY.js} +15 -15
  4. package/dist/{car-B0hJrE0Z.js → car-CR69ZjJ2.js} +1 -1
  5. package/dist/{check-Dfh9u4c0.js → check-Bo3wjuln.js} +1 -1
  6. package/dist/{copy-applicant-offer-B-BIN2o5-BX-QE7Ao.js → copy-applicant-offer-CqzfNhkJ-C01V9k7v.js} +3 -3
  7. package/dist/{copy-from-record-BNP6CFFR-Bcb9EW-a.js → copy-from-record-BNP6CFFR-B0wsM313.js} +8 -8
  8. package/dist/{core-Po4qPIof-fZL0sXdW.js → core-CrEw_I-E-D_5b2Ij3.js} +1 -1
  9. package/dist/{coverageDerivation-CV2ORogj-CAthw76f.js → coverageDerivation-CV2ORogj-CEEm5ZWr.js} +1 -1
  10. package/dist/{fixtures-ijbZ16Zg-Csnryzo8.js → fixtures-ijbZ16Zg-C9Egb9wf.js} +1 -1
  11. package/dist/{household-prefill-DVLBBva1-GGgzEdDL.js → household-prefill-CmtB9R3R-D86kYzTo.js} +8 -8
  12. package/dist/{householdPrefill-DLm3pxFH-B34UGBGP.js → householdPrefill-DLm3pxFH-BWVN4BLJ.js} +1 -1
  13. package/dist/iframe/assets/{address-BEVwov8q-BpbNiia-.js → address-BEVwov8q-BckjuR7s.js} +1 -1
  14. package/dist/iframe/assets/{car-DkfXVYz0.js → car-DKll0kXc.js} +1 -1
  15. package/dist/iframe/assets/{check-l6TGSrXO.js → check-B9ojZKSs.js} +1 -1
  16. package/dist/iframe/assets/{copy-applicant-offer-B-BIN2o5-cs-SCWuH.js → copy-applicant-offer-CqzfNhkJ-DJkKq7un.js} +1 -1
  17. package/dist/iframe/assets/{copy-from-record-BNP6CFFR-BtCRUQRw.js → copy-from-record-BNP6CFFR-Dk7QPvpr.js} +1 -1
  18. package/dist/iframe/assets/{core-Po4qPIof-jDmdAxP7.js → core-CrEw_I-E-Cgrp_zkJ.js} +1 -1
  19. package/dist/iframe/assets/{coverageDerivation-CV2ORogj-DhQFAhwv.js → coverageDerivation-CV2ORogj-BaQlJ22H.js} +1 -1
  20. package/dist/iframe/assets/{dob-calendar-RIJ5S6YU-DO_r0-z3.js → dob-calendar-RIJ5S6YU-C3ZYmy3v.js} +1 -1
  21. package/dist/iframe/assets/{fixtures-ijbZ16Zg-CUQxYANz.js → fixtures-ijbZ16Zg-B0KKADMf.js} +1 -1
  22. package/dist/iframe/assets/{household-prefill-DVLBBva1-DTK1EHT0.js → household-prefill-CmtB9R3R-DtfByJ8T.js} +1 -1
  23. package/dist/iframe/assets/{householdPrefill-DLm3pxFH-BM54Rqyd.js → householdPrefill-DLm3pxFH-DNBBTd54.js} +1 -1
  24. package/dist/iframe/assets/iframe-Chy4dD4i.js +107 -0
  25. package/dist/iframe/assets/{index-CNb9AhPB.js → index-D81Toecg.js} +2 -2
  26. package/dist/iframe/assets/{intake-review-panel-B7rXvRvm-wNGntinn.js → intake-review-panel-D27t8CZO-CyXFTi_6.js} +1 -1
  27. package/dist/iframe/assets/{mockJump-DpXrnQUq-DKyp2H5R.js → mockJump-hNzgzUmO-B4HifTQZ.js} +1 -1
  28. package/dist/iframe/assets/payload-DrGFAxms-CKeiScMv.js +1 -0
  29. package/dist/iframe/assets/{question-list-ChcBzofd-D5ZVofFR.js → question-list-DFjWa8ZA-5HX-Q_DR.js} +3 -3
  30. package/dist/iframe/assets/{rates-panel-BaIzEqX6-GSsykLkc.js → rates-panel-BSFiWEZX-CUbwWzwJ.js} +3 -3
  31. package/dist/iframe/assets/{review-panel-DYCuhwdo-CyBebe6T.js → review-panel-C_WxX33U-BnudlA3G.js} +2 -2
  32. package/dist/iframe/assets/{stage-Bpq1A5xB-CwZgWOhp.js → stage-knShj71W-BrRsgDlE.js} +1 -1
  33. package/dist/iframe/assets/{validation-DRqHT-u7-pY2KjHw4.js → validation-D42QXxck-DJUS31-5.js} +1 -1
  34. package/dist/iframe/assets/{vehicleCoverage-BPJaWQyg-DBJ_jL3e.js → vehicleCoverage-CBWORI1l-Bs6c4Xhh.js} +1 -1
  35. package/dist/iframe/assets/{visibility-hEdBjgi7-_AUGO8E2.js → visibility-CKRGC3Il-DVTBboJH.js} +1 -1
  36. package/dist/iframe/iframe.html +1 -1
  37. package/dist/{index-CQXR1Un8.js → index-7nmHdjZ4.js} +1 -1
  38. package/dist/index.d.ts +8 -0
  39. package/dist/index.es.js +1 -1
  40. package/dist/index.umd.js +103 -103
  41. package/dist/{intake-review-panel-B7rXvRvm-CDyR-rVg.js → intake-review-panel-D27t8CZO-CKLXjEb0.js} +11 -11
  42. package/dist/{mockJump-DpXrnQUq-BaitU9aZ.js → mockJump-hNzgzUmO-De8oea8T.js} +1 -1
  43. package/dist/{payload-JXpCaeS6-pjITtvlm.js → payload-DrGFAxms-CivFCNuj.js} +4 -4
  44. package/dist/{question-list-ChcBzofd-fVRN9fTl.js → question-list-DFjWa8ZA-sWgoo34K.js} +13 -13
  45. package/dist/{rates-panel-BaIzEqX6-BULjKxqz.js → rates-panel-BSFiWEZX-D2Z8IzSh.js} +36 -36
  46. package/dist/{review-panel-DYCuhwdo-BImR4S06.js → review-panel-C_WxX33U-qkUKI77r.js} +16 -16
  47. package/dist/{stage-Bpq1A5xB-Cphc07aC.js → stage-knShj71W-Cndh8rxW.js} +15 -15
  48. package/dist/utils/placesAuthFailure.d.ts +10 -0
  49. package/dist/utils/prefill.d.ts +18 -0
  50. package/dist/{validation-DRqHT-u7-CL2m7f4k.js → validation-D42QXxck-DFkyiEd-.js} +1 -1
  51. package/dist/{vehicleCoverage-BPJaWQyg-g7bBFmro.js → vehicleCoverage-CBWORI1l-Br309K1G.js} +3 -3
  52. package/dist/{visibility-hEdBjgi7-WW4BVjmf.js → visibility-CKRGC3Il-SsuTwW3e.js} +1 -1
  53. package/dist/{widget-BUAzkBEK.js → widget-Bc0CD2Yh.js} +2834 -2767
  54. package/package.json +2 -2
  55. package/dist/iframe/assets/iframe-BImWklE9.js +0 -107
  56. package/dist/iframe/assets/payload-JXpCaeS6-CcfrGvLo.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/iframe-BImWklE9.js","assets/iframe-Bl0qTZgO.css"])))=>i.map(i=>d[i]);
2
- import{m as ee,t as Le,r as n,_ as xe,b as e,f as j,T as De,h as E,n as w,o as J,p as D,q as He,g as he,s as Fe,v as Oe,K as fe,w as ze,J as Me,x as Be,y as pe,z as We,P as Ve,B as Ye}from"./iframe-BImWklE9.js";import{g as Ue,A as Ke,k as Qe,j as Ge,S as X,u as g,p as k,y as Je,m as je,W as ge,H as Xe,h as Ze,b as es}from"./core-Po4qPIof-jDmdAxP7.js";import{C as ss}from"./check-l6TGSrXO.js";import{C as ts}from"./car-DkfXVYz0.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/iframe-Chy4dD4i.js","assets/iframe-Bl0qTZgO.css"])))=>i.map(i=>d[i]);
2
+ import{l as ee,t as Le,r as n,_ as xe,a as e,f as j,T as De,h as E,m as w,n as J,o as D,p as Fe,g as he,q as He,s as Oe,G as fe,v as ze,K as Me,x as We,y as pe,z as Be,F as Ve,H as Ye}from"./iframe-Chy4dD4i.js";import{g as Ue,A as Ge,k as Ke,j as Qe,S as X,u as g,p as k,y as Je,m as je,W as ge,H as Xe,h as Ze,b as es}from"./core-CrEw_I-E-Cgrp_zkJ.js";import{C as ss}from"./check-B9ojZKSs.js";import{C as ts}from"./car-DKll0kXc.js";/**
3
3
  * @license lucide-react v0.562.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -14,4 +14,4 @@ import{m as ee,t as Le,r as n,_ as xe,b as e,f as j,T as De,h as E,n as w,o as J
14
14
  *
15
15
  * This source code is licensed under the ISC license.
16
16
  * See the LICENSE file in the root directory of this source tree.
17
- */const ls=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],ye=ee("phone",ls);var ns=2500,is=t=>{if(!t)return null;let c=Math.round((Date.parse(t)-Date.now())/864e5);return!Number.isFinite(c)||c<1?null:c===1?"It works for 1 more day.":`It works for the next ${c} days.`},os=({quoteId:t})=>{let[c,o]=n.useState({kind:"pending"}),[r,m]=n.useState(!1),q=n.useRef(null),l=n.useRef(!1);n.useEffect(()=>{l.current||(l.current=!0,(async()=>{try{let[{issueResumeLink:x},{buildResumeUrl:h}]=await Promise.all([xe(()=>import("./iframe-BImWklE9.js").then(b=>b.a3),__vite__mapDeps([0,1])),xe(()=>import("./iframe-BImWklE9.js").then(b=>b.a2),__vite__mapDeps([0,1])).then(b=>b.u)]),{resumeToken:C,expiresAt:F}=await x(t??void 0);o({kind:"ready",url:h(C),expiresAt:F})}catch{o({kind:"unavailable"})}})())},[t]),n.useEffect(()=>{if(!r)return;let x=setTimeout(()=>m(!1),ns);return()=>clearTimeout(x)},[r]);let u=n.useCallback(async x=>{q.current?.select();try{await navigator.clipboard.writeText(x),m(!0)}catch{m(!1)}},[]);if(c.kind!=="ready")return null;let v=is(c.expiresAt);return e.jsx("div",{"data-credify-resume-link":!0,className:"cds-mt-6 cds-rounded-xl cds-border cds-border-border cds-bg-surface-muted cds-p-4",children:e.jsxs("div",{className:"cds-flex cds-items-start cds-gap-3",children:[e.jsx(rs,{"aria-hidden":"true",className:"cds-mt-0.5 cds-h-5 cds-w-5 cds-shrink-0 cds-text-fg"}),e.jsxs("div",{className:"cds-min-w-0 cds-flex-1",children:[e.jsx("h3",{className:"cds-text-sm cds-font-bold cds-text-fg",children:"Want to think it over?"}),e.jsxs("p",{className:"cds-mt-1 cds-text-sm cds-text-fg-muted",children:["Save this link and open it on any device to come back to these quotes.",v?` ${v}`:""]}),e.jsxs("div",{className:"cds-mt-3 cds-flex cds-flex-col cds-gap-2 sm:cds-flex-row",children:[e.jsx("input",{ref:q,type:"text",readOnly:!0,value:c.url,"aria-label":"Link back to your quotes",onFocus:x=>x.currentTarget.select(),className:`cds-min-w-0 cds-flex-1 cds-rounded-lg cds-border cds-border-input cds-bg-surface-elevated cds-px-3 cds-py-2 cds-text-xs cds-text-fg-muted ${j}`}),e.jsxs("button",{type:"button",onClick:()=>void u(c.url),className:`cds-inline-flex cds-shrink-0 cds-items-center cds-justify-center cds-gap-1.5 cds-rounded-lg cds-border cds-border-primary cds-px-4 cds-py-2 cds-text-sm cds-font-semibold cds-text-fg cds-transition-colors hover:cds-bg-primary hover:cds-text-primary-foreground ${j}`,children:[e.jsx(r?ss:cs,{"aria-hidden":"true",className:"cds-h-4 cds-w-4"}),r?"Copied":"Copy link"]})]}),e.jsx("p",{"aria-live":"polite",className:"sr-only",children:r?"Link copied to clipboard":""}),e.jsx("p",{className:"cds-mt-2 cds-text-xs cds-text-fg-muted",children:"Anyone with this link can see your quote, so keep it to yourself. You'll still confirm by text message before anything is submitted to a carrier."})]})]})})},ws=Le({RatesPanel:()=>ys}),ms=3e3,us=33e4,Z=t=>`$${(t/100).toLocaleString("en-US",{maximumFractionDigits:0})}`,xs=t=>t.split(/\s+/).filter(Boolean).slice(0,2).map(c=>c[0]?.toUpperCase()??"").join(""),hs=[{market:"admitted",label:"Admitted"},{market:"non_admitted",label:"Non-admitted"},{market:"not_quoted",label:"Not quoted"}],L=t=>({tab:`rates-tab-${t}`,panel:`rates-panel-${t}`}),Ne=({rate:t,size:c})=>{let o=g(t.carrier_name),r=c==="sm"?"cds-h-9 cds-w-9":"cds-h-10 cds-w-10";return t.carrier_logo_base64?e.jsx("img",{src:`data:image/png;base64,${t.carrier_logo_base64}`,alt:o,className:`${r} cds-rounded cds-object-contain`}):e.jsx("span",{"aria-hidden":"true",className:`cds-flex ${r} cds-shrink-0 cds-items-center cds-justify-center cds-rounded cds-bg-primary/10 cds-text-sm cds-font-bold cds-text-fg`,children:xs(o)})},be={PersonalAuto:"Personal Auto",PersonalHome:"Homeowners"},fs={PersonalHome:Xe,PersonalAuto:ts,Flood:ge,ExcessFlood:ge},H=({lob:t,size:c="md"})=>{let o=t&&fs[t]||X,r=c==="sm"?"cds-h-5 cds-w-5":"cds-h-7 cds-w-7",m=c==="sm"?"cds-h-3 cds-w-3":"cds-h-4 cds-w-4";return e.jsx("span",{"aria-hidden":"true",className:`cds-inline-flex ${r} cds-shrink-0 cds-items-center cds-justify-center cds-rounded-full cds-bg-accent/15 cds-ring-1 cds-ring-inset cds-ring-ring/25`,children:e.jsx(o,{className:`${m} cds-text-accent`,strokeWidth:2.5})})},ps=({rate:t,showLob:c,isSelected:o,isRequested:r,lobLocked:m,onSelect:q})=>{let l=g(t.carrier_name),u=es(t),v=c?k(t.lob):null,x=t.effective_date&&t.policy_end_date?`${t.effective_date} – ${t.policy_end_date}`:t.effective_date;return e.jsxs("div",{className:`cds-rounded-xl cds-border cds-bg-surface-elevated cds-p-4 ${r?"cds-border-accent cds-ring-2 ring-emerald-500/30":o?"cds-border-accent cds-ring-2 cds-ring-ring/30":"cds-border-border"} ${m?"cds-opacity-60":""}`,children:[v?e.jsxs("p",{className:"cds-mb-2 cds-flex cds-items-center cds-gap-1.5 cds-text-xs cds-font-semibold cds-uppercase cds-tracking-wide cds-text-fg",children:[e.jsx(H,{lob:t.lob,size:"sm"}),v]}):null,e.jsxs("div",{className:"cds-flex cds-items-center cds-gap-3",children:[e.jsx(Ne,{rate:t,size:"md"}),e.jsxs("div",{className:"cds-min-w-0 cds-flex-1",children:[e.jsx("p",{className:"cds-truncate cds-font-bold cds-text-fg",children:l}),e.jsxs("p",{className:"cds-text-xs cds-text-fg-muted",children:[Z(t.premium_cents)," for ",t.term_months," months"]}),t.admitted_status==="non_admitted"?e.jsx("p",{className:"cds-mt-1 cds-inline-block cds-rounded cds-bg-warning-surface cds-px-1.5 cds-py-0.5 cds-text-[11px] cds-font-semibold cds-text-warning-foreground",children:"Surplus lines"}):null]}),e.jsxs("div",{className:"cds-text-right",children:[e.jsx("p",{className:"cds-text-xl cds-font-extrabold cds-text-fg",children:Z(je(t))}),e.jsx("p",{className:"cds-text-xs cds-text-fg-muted",children:"/mo"})]})]}),x?e.jsxs("p",{className:"cds-mt-2 cds-text-xs cds-text-fg-muted",children:["Effective ",x]}):null,u.length?e.jsx("dl",{className:"cds-mt-3 cds-space-y-1 cds-border-t cds-border-border cds-pt-3 cds-text-xs",children:u.map((h,C)=>e.jsxs("div",{className:"cds-flex cds-justify-between cds-gap-2",children:[e.jsx("dt",{className:"cds-text-fg-muted",children:h.label}),e.jsx("dd",{className:"cds-text-right cds-font-semibold cds-text-fg",children:h.value})]},`${h.label}-${C}`))}):null,t.carrier_quote_id?e.jsxs("p",{className:"cds-mt-2 cds-text-xs cds-text-fg-muted",children:["Carrier quote ID: ",t.carrier_quote_id]}):null,r?e.jsx("p",{className:"cds-mt-3 cds-rounded-lg cds-bg-highlight cds-px-4 cds-py-2 cds-text-center cds-text-sm cds-font-bold cds-text-accent",children:"Request sent"}):m?e.jsxs("p",{className:"cds-mt-3 cds-text-center cds-text-xs cds-text-fg-muted",children:["You already have a request in for ",k(t.lob)??"this line","."]}):e.jsx("button",{type:"button",onClick:q,className:`cds-mt-3 cds-w-full cds-rounded-lg cds-border cds-border-accent cds-px-4 cds-py-2 cds-text-sm cds-font-bold cds-text-fg hover:cds-bg-highlight ${j}`,children:o?"Selected":"Continue with this quote"})]})},gs=({rate:t})=>{let c=(t.decline_reasons??[]).filter(Boolean),o=t.decline_category?.trim();return e.jsxs("div",{className:"cds-flex cds-gap-3 cds-rounded-xl cds-border cds-border-border cds-bg-surface-elevated cds-p-4",children:[e.jsx(Ne,{rate:t,size:"sm"}),e.jsxs("div",{className:"cds-min-w-0 cds-flex-1",children:[e.jsx("p",{className:"cds-font-bold cds-text-fg",children:g(t.carrier_name)}),o?e.jsx("p",{className:"cds-mt-0.5 cds-text-xs cds-font-semibold cds-uppercase cds-tracking-wide cds-text-fg-muted",children:o}):null,c.length?e.jsx("ul",{className:"cds-mt-2 cds-list-outside cds-list-disc cds-space-y-1 cds-pl-5 cds-text-sm cds-text-fg-muted",children:c.map((r,m)=>e.jsx("li",{children:r},`${r}-${m}`))}):e.jsx("p",{className:"cds-mt-2 cds-text-sm cds-text-fg-muted",children:"This carrier did not return a quote."})]})]})},T=({quoteId:t})=>t?e.jsxs("div",{className:"cds-mt-6 cds-inline-block cds-rounded-lg cds-border cds-border-border cds-bg-surface-muted cds-px-4 cds-py-2.5 cds-text-center",children:[e.jsx("p",{className:"cds-text-xs cds-text-fg-muted",children:"Reference ID"}),e.jsx("p",{className:"cds-mt-0.5 cds-select-all cds-font-mono cds-text-sm cds-font-semibold cds-text-fg",children:t})]}):null,K=({heading:t,body:c,quoteId:o})=>e.jsxs("div",{className:"cds-py-6 cds-text-center",children:[e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:t}),e.jsx("p",{className:"cds-mb-6 cds-text-fg-muted",children:c}),e.jsxs("a",{href:D,onClick:()=>J("phone_call_click",{placement:"quote_rates_fallback",phone:w}),className:`cds-inline-flex cds-items-center cds-gap-2 cds-rounded-xl cds-bg-accent cds-px-8 cds-py-3.5 cds-text-base cds-font-bold cds-text-primary-foreground hover:cds-bg-accent ${j}`,children:[e.jsx(ye,{"aria-hidden":"true",className:"cds-h-4 cds-w-4"}),"Call ",w]}),e.jsx("div",{children:e.jsx(T,{quoteId:o})})]}),bs={Auto:["PersonalAuto"],Home:["PersonalHome"],Bundle:["PersonalAuto","PersonalHome"]},A=t=>t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`,Q=t=>t.lob??"_other",G=(t,c)=>{let o=new Set(c.map(r=>r.lob));return[...new Set(t.filter(r=>Ze(r)!=="not_quoted").map(r=>r.lob).filter(r=>!!r))].filter(r=>!o.has(r))},js=({appetites:t,product:c})=>{let o=bs[c]??Object.keys(t??{}),r=[...new Set(o.flatMap(m=>t?.[m]??[]).map(g))].slice(0,8);return r.length?e.jsxs("p",{className:"cds-mt-4 cds-text-sm cds-text-fg-muted",children:["Checking ",r.join(", "),r.length>=8?" and more":"","…"]}):null},ys=({product:t,quoteId:c,describeField:o,onFixAnswers:r,onRetry:m,onBound:q})=>{let[l,u]=n.useState({kind:"polling"}),[v,x]=n.useState(null),[h,C]=n.useState(),[F,b]=n.useState({}),[y,_e]=n.useState([]),[ke,ve]=n.useState(!1),[O,se]=n.useState(""),[we,S]=n.useState(),[z,te]=n.useState(!1),[I,M]=n.useState(0),[de,ce]=n.useState(!1),[B,ae]=n.useState(!1),[qe,re]=n.useState(),$=n.useRef(0),W=n.useCallback(()=>{$.current+=1;let s=$.current,d=Date.now(),a=async()=>{if(s===$.current){try{let{quote:i}=await Fe(c??void 0);if(s!==$.current)return;C(i);let U=i?.rates_status;if(U==="completed"){let{rates:P}=await Oe(c??void 0);if(s!==$.current)return;let R=P??[];u(R.length?{kind:"ready",rates:R}:{kind:"no_rates"});return}if(U==="no_rates"){u({kind:"no_rates"});return}if(U==="failed"){let P=i?.last_validation_errors??[];if(i?.last_failure_code==="BOLT_VALIDATION"&&P.length){u({kind:"validation_failed",errors:P,message:i?.rates_failure_message??void 0});return}let R=i?.last_failure_code==="UNHANDLED"||i?.last_failure_code==="DISPATCH"||i?.last_failure_code==="BOLT_RATES";u({kind:"failed",retryable:R,message:i?.rates_failure_message??void 0}),fe(Error(i?.rates_failure_message||`Rating failed: ${i?.last_failure_code??"unknown"}`),{phase:"rates_failed",product:t,quoteId:c,failureCode:i?.last_failure_code});return}}catch(i){ze("rates poll failed",{status:Me(i)})}if(Date.now()-d>=us){u({kind:"failed",retryable:!0}),fe(Error("Rating timed out before returning a result"),{phase:"rates_timeout",product:t,quoteId:c});return}setTimeout(()=>void a(),ms)}};a()},[c,t]);n.useEffect(()=>(W(),()=>{$.current+=1}),[W]),n.useEffect(()=>{if(I<=0)return;let s=setTimeout(()=>M(d=>d-1),1e3);return()=>clearTimeout(s)},[I]);let f=n.useMemo(()=>Ue(l.kind==="ready"?l.rates:[]),[l]),le=s=>Array.isArray(s)?s.filter(d=>d&&typeof d=="object"):[],$e=n.useMemo(()=>l.kind==="validation_failed"?Ke(l.errors,{describeField:o,vehicles:le(h?.vehicles),drivers:le(h?.drivers)}):void 0,[l,o,h]),p=v??(f.admitted.length?"admitted":f.non_admitted.length?"non_admitted":f.not_quoted.length?"not_quoted":"admitted"),ne=async(s,d)=>{if(!c)return;u({kind:"verify",rate:s,rates:d}),S(void 0),se("");let a=String(h?.phone??"");try{await We(c,a),M(60)}catch(i){i instanceof pe&&i.statusCode===429?M(i.retryAfterSeconds??60):S("We could not text your code. Try again in a moment.")}},Ae=async(s,d)=>{if(!(!c||z)){te(!0),S(void 0);try{let{isVerified:a}=await Be(c,O);if(!a){S("That code did not match. Check it and try again.");return}u({kind:"ready",rates:d.length?d:[s]}),ve(!0),b(i=>({...i,[Q(s)]:s.quote_rate_id}))}catch(a){S(a instanceof pe&&a.statusCode===429?"Too many attempts. Request a new code.":"We could not verify that code. Please try again.")}finally{te(!1)}}},ie=s=>{Ve(),u({kind:"bound",rates:s}),q?.(s)},Ce=async s=>{if(B||!s.length)return;ae(!0),re(void 0);try{await Ye(s.map(a=>a.quote_rate_id),!0)}catch{re(s.length>1?"We could not submit those requests. Please call us and we will finish them for you.":"We could not submit that request. Please call us and we will finish it for you.");return}finally{ae(!1)}let d=[...y,...s];if(_e(d),b({}),G(l.kind==="ready"?l.rates:[],d).length){ce(!1);return}ie(d)};if(l.kind==="polling")return e.jsxs("div",{className:"cds-py-10 cds-text-center","aria-live":"polite",children:[e.jsx("div",{className:"cds-mx-auto cds-mb-6 cds-h-10 cds-w-10 cds-animate-spin cds-rounded-full cds-border-4 cds-border-accent cds-border-t-transparent","aria-hidden":"true"}),e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:"Getting your quotes…"}),e.jsx("p",{className:"cds-text-fg-muted",children:"Please keep this window open while we run your details through our carriers. This usually takes a minute or two."}),e.jsx("p",{className:"cds-mt-2 cds-text-fg-muted",children:"If you get disconnected, your progress is saved in this browser — reopen this page and you'll pick up where you left off. Thanks for your patience."}),e.jsx(js,{appetites:h?.appetites,product:t})]});if(l.kind==="validation_failed"){let s=$e;return!s||s.isOpaque?e.jsx(K,{heading:"Let's finish this one together",body:"The carrier needs a couple of details we can't collect online. An agent can sort it out with you in a few minutes.",quoteId:c}):e.jsxs("div",{className:"cds-py-6",children:[e.jsxs("div",{className:"cds-mb-5 cds-rounded-xl cds-border cds-border-warning cds-bg-warning-surface cds-p-4",children:[e.jsxs("div",{className:"cds-flex cds-items-start cds-gap-3",children:[e.jsx(De,{"aria-hidden":"true",className:"cds-mt-0.5 cds-h-5 cds-w-5 cds-shrink-0 cds-text-warning"}),e.jsxs("div",{children:[e.jsx("h2",{className:"cds-text-lg cds-font-bold cds-text-fg",children:"A few answers need another look"}),e.jsx("p",{className:"cds-mt-1 cds-text-sm cds-text-fg-muted",children:"The carrier couldn't price your quote until these are sorted. It only takes a minute."})]})]}),e.jsx("div",{className:"cds-mt-4 cds-space-y-4",children:s.groups.map(d=>e.jsxs("div",{children:[e.jsx("p",{className:"cds-text-sm cds-font-bold cds-text-fg",children:d.heading}),d.sharedMessage?e.jsxs("p",{className:"cds-mt-1 cds-text-sm cds-text-fg-muted",children:[d.sharedMessage," ",e.jsx("span",{className:"cds-font-semibold",children:Qe(d.labels)}),"."]}):e.jsx("ul",{className:"cds-mt-1 cds-list-outside cds-list-disc cds-space-y-1 cds-pl-5 cds-text-sm cds-text-fg-muted",children:d.issues.map(a=>e.jsx("li",{children:Ge(a)},`${a.label??""}-${a.message}`))})]},d.id))}),s.otherCount?e.jsxs("p",{className:"cds-mt-4 cds-text-xs cds-text-fg-muted",children:["The carrier flagged ",s.otherCount," other ",s.otherCount===1?"detail":"details"," we'll check with you if it still won't price."]}):null]}),e.jsx(E,{onClick:()=>r(l.errors),children:"Fix my answers"}),e.jsxs("p",{className:"cds-mt-4 cds-text-center cds-text-sm cds-text-fg-muted",children:["Or call"," ",e.jsx("a",{href:D,onClick:()=>J("phone_call_click",{placement:"quote_rates_validation",phone:w}),className:"cds-font-semibold cds-text-fg cds-underline",children:w})," ","and an agent will finish it with you."]}),e.jsx("div",{className:"cds-text-center",children:e.jsx(T,{quoteId:c})})]})}if(l.kind==="failed")return e.jsx("div",{className:"cds-py-6",children:l.retryable?e.jsxs("div",{className:"cds-text-center",children:[e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:"That took longer than expected"}),e.jsx("p",{className:"cds-mb-6 cds-text-fg-muted",children:l.message??"Our carrier connection hiccuped. One more try usually does it."}),e.jsx(E,{onClick:()=>{u({kind:"polling"}),m().then(s=>{s&&W()})},children:"Try again"}),e.jsxs("p",{className:"cds-mt-4 cds-text-sm cds-text-fg-muted",children:["Or call"," ",e.jsx("a",{href:D,className:"cds-font-semibold cds-text-fg cds-underline",children:w})," ","and an agent will pull them for you."]}),e.jsx(T,{quoteId:c})]}):e.jsx(K,{heading:"Let's get your quotes another way",body:"A licensed agent can pull your quotes over the phone in a few minutes — no waiting.",quoteId:c})});if(l.kind==="no_rates")return e.jsx(K,{heading:"No online offers for this one",body:"That happens with some homes and vehicles. An agent has access to carriers that don't quote online.",quoteId:c});if(l.kind==="verify"){let{rate:s,rates:d}=l;return e.jsxs("div",{className:"cds-py-6",children:[e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:"Verify your number"}),e.jsxs("p",{className:"cds-mb-6 cds-text-fg-muted",children:["We texted a 6-digit code to confirm it's you before we send your ",s.carrier_name," request."]}),e.jsx("label",{htmlFor:"sms-code",className:"cds-mb-1 cds-block cds-text-sm cds-font-semibold cds-text-fg",children:"Verification code"}),e.jsx("input",{id:"sms-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,value:O,onChange:a=>se(a.target.value.replace(/\D/g,"").slice(0,6)),className:`${He} cds-tracking-[0.4em]`}),e.jsx(he,{message:we}),e.jsx(E,{disabled:O.length!==6||z,onClick:()=>void Ae(s,d),children:z?"Verifying…":"Verify and continue"}),e.jsx("button",{type:"button",disabled:I>0,onClick:()=>void ne(s,d),className:`cds-mt-3 cds-w-full cds-rounded-lg cds-px-4 cds-py-2 cds-text-sm cds-font-semibold cds-text-fg cds-underline disabled:cds-no-underline disabled:cds-opacity-60 ${j}`,children:I>0?`Resend code in ${I}s`:"Resend code"})]})}if(l.kind==="bound"){let s=l.rates.length===1?l.rates[0]:void 0;return e.jsxs("div",{className:"cds-py-10 cds-text-center",children:[e.jsx(X,{"aria-hidden":"true",className:"cds-mx-auto cds-mb-4 cds-h-12 cds-w-12 cds-text-accent"}),e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:"You're all set"}),s?e.jsxs("p",{className:"cds-text-fg-muted",children:["A licensed agent is finalizing your ",g(s.carrier_name)," policy and will call you shortly to confirm the details."]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"cds-mb-4 cds-text-fg-muted",children:"A licensed agent is finalizing these policies and will call you shortly to confirm the details."}),e.jsx("ul",{className:"cds-mx-auto cds-max-w-sm cds-space-y-2 cds-text-left",children:l.rates.map(d=>e.jsxs("li",{className:"cds-flex cds-items-center cds-gap-2 cds-rounded-lg cds-border cds-border-border cds-bg-surface-elevated cds-p-3 cds-text-sm",children:[e.jsx(H,{lob:d.lob}),e.jsxs("span",{children:[e.jsx("span",{className:"cds-font-bold cds-text-fg",children:g(d.carrier_name)}),k(d.lob)?e.jsxs("span",{className:"cds-text-fg-muted",children:[" — ",k(d.lob)]}):null]})]},d.quote_rate_id))})]}),e.jsx(T,{quoteId:c}),e.jsxs("p",{className:"cds-mt-2 cds-text-xs cds-text-fg-muted",children:["Quote this if you call us about ",l.rates.length>1?"these requests":"this request","."]})]})}let V=new Set(y.map(s=>s.quote_rate_id)),Se=new Set(y.map(s=>s.lob)),oe=s=>F[Q(s)]===s.quote_rate_id,N=l.rates.filter(s=>oe(s)&&!V.has(s.quote_rate_id)),Ie=ke,Y=G(l.rates,y),Te=G(l.rates,[]).length>1,me=Y.filter(s=>!N.some(d=>d.lob===s)),_=hs.filter(s=>s.market!=="not_quoted"||f.not_quoted.length>0),Pe=f.admitted.length+f.non_admitted.length,Re=Je(p==="not_quoted"?f.not_quoted:f[p],{sortBy:p==="not_quoted"?"carrier":"premium"}),ue=t==="Bundle"?[{lob:"PersonalAuto",label:be.PersonalAuto},{lob:"PersonalHome",label:be.PersonalHome}].filter(({lob:s})=>!l.rates.some(d=>d.lob===s)):[],Ee=s=>{let d=s.key==="ArrowRight"?1:s.key==="ArrowLeft"?-1:0,a=s.key==="Home"?_[0]:s.key==="End"?_[_.length-1]:d?_[(_.findIndex(i=>i.market===p)+d+_.length)%_.length]:void 0;a&&(s.preventDefault(),x(a.market),setTimeout(()=>document.getElementById(L(a.market).tab)?.focus(),0))};return e.jsxs("div",{className:"cds-py-2",children:[e.jsx("h2",{className:"cds-mb-1 cds-text-2xl cds-font-bold cds-text-fg",children:"Your quotes"}),e.jsx("p",{className:"cds-mb-4 cds-text-sm cds-text-fg-muted",children:"Real prices from our carriers, based on the answers you gave."}),ue.length?e.jsx("div",{className:"cds-mb-4 cds-space-y-1",children:ue.map(({lob:s,label:d})=>e.jsxs("p",{className:"cds-text-sm cds-text-fg-muted",children:["Sorry, no rates found for ",d,"."]},s))}):null,y.length>0&&Y.length>0?e.jsxs("div",{className:"cds-mb-5 cds-rounded-xl cds-border cds-border-accent cds-bg-highlight cds-p-4",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"cds-flex cds-items-start cds-gap-3",children:[e.jsx(X,{"aria-hidden":"true",className:"cds-mt-0.5 cds-h-5 cds-w-5 cds-shrink-0 cds-text-accent"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"cds-text-sm cds-font-bold cds-text-fg",children:["We've sent your ",A(y.map(s=>k(s.lob)??g(s.carrier_name)))," request to"," ",A(y.map(s=>g(s.carrier_name)))]}),e.jsxs("p",{className:"cds-mt-1 cds-text-sm cds-text-fg-muted",children:["You can still add ",A(Y.map(s=>k(s)??s))," — pick a quote above and we'll send that one too. You won't need another verification code."]})]})]}),e.jsx("button",{type:"button",onClick:()=>ie(y),className:`cds-mt-3 cds-text-sm cds-font-semibold cds-text-fg cds-underline ${j}`,children:"No thanks, I'm done"})]}):null,e.jsx("div",{className:"cds-mb-4 -cds-mx-1 cds-overflow-x-auto cds-border-b cds-border-border cds-px-1",children:e.jsx("div",{className:"cds-flex cds-items-center cds-gap-4 sm:cds-gap-6",role:"tablist","aria-label":"Rate market type",children:_.map(s=>{let d=s.market===p,a=L(s.market);return e.jsxs("button",{id:a.tab,type:"button",role:"tab","aria-selected":d,"aria-controls":a.panel,tabIndex:d?0:-1,onClick:()=>x(s.market),onKeyDown:Ee,className:`cds-whitespace-nowrap cds-border-b-2 cds-px-1 cds-py-2 cds-text-xs cds-font-semibold cds-transition-colors sm:cds-text-sm ${j} ${d?"cds-border-accent cds-text-fg":"cds-border-transparent cds-text-fg-muted hover:cds-text-fg"}`,children:[s.label," (",f[s.market].length,")"]},s.market)})})}),e.jsxs("div",{id:L(p).panel,role:"tabpanel","aria-labelledby":L(p).tab,tabIndex:0,className:`cds-mb-6 cds-outline-none ${j}`,children:[p==="admitted"&&!f.admitted.length?e.jsx("p",{className:"cds-text-sm cds-text-fg-muted",children:"No admitted-market carriers priced this quote."}):null,p==="non_admitted"&&!f.non_admitted.length?e.jsx("p",{className:"cds-text-sm cds-text-fg-muted",children:"No surplus-lines carriers priced this quote."}):null,p==="not_quoted"?e.jsx("p",{className:"cds-mb-3 cds-text-sm cds-text-fg-muted",children:"These carriers looked at your details and passed. Their reasons are below."}):null,Re.map((s,d)=>e.jsxs("div",{className:"cds-mb-5 last:cds-mb-0",children:[d?e.jsx("div",{"aria-hidden":"true",className:"cds-mb-5 cds-h-px cds-bg-gradient-to-r cds-from-transparent cds-via-brand-accent/40 cds-to-transparent"}):null,s.lob?e.jsxs("h3",{className:"cds-mb-2 cds-flex cds-items-center cds-gap-2 cds-text-sm cds-font-bold cds-uppercase cds-tracking-wide cds-text-fg",children:[e.jsx(H,{lob:s.lob}),s.title]}):null,e.jsx("ul",{className:"cds-space-y-3",children:s.rates.map(a=>p==="not_quoted"?e.jsx("li",{children:e.jsx(gs,{rate:a})},a.quote_rate_id):e.jsx("li",{children:e.jsx(ps,{rate:a,showLob:!s.lob,isSelected:oe(a),isRequested:V.has(a.quote_rate_id),lobLocked:!V.has(a.quote_rate_id)&&Se.has(a.lob),onSelect:()=>Ie?b(i=>({...i,[Q(a)]:a.quote_rate_id})):void ne(a,l.rates)})},a.quote_rate_id))})]},s.lob??"all"))]}),Pe?null:e.jsxs("div",{className:"cds-mb-6 cds-rounded-xl cds-border cds-border-border cds-bg-surface-muted cds-p-4 cds-text-center",children:[e.jsx("p",{className:"cds-mb-3 cds-text-sm cds-text-fg-muted",children:"No carrier priced this one online. An agent has access to carriers that don't quote on the web."}),e.jsxs("a",{href:D,onClick:()=>J("phone_call_click",{placement:"quote_rates_all_declined",phone:w}),className:`cds-inline-flex cds-items-center cds-gap-2 cds-rounded-xl cds-bg-accent cds-px-6 cds-py-3 cds-text-sm cds-font-bold cds-text-primary-foreground hover:cds-bg-accent ${j}`,children:[e.jsx(ye,{"aria-hidden":"true",className:"cds-h-4 cds-w-4"}),"Call ",w]}),e.jsx("div",{children:e.jsx(T,{quoteId:c})})]}),N.length?e.jsxs("div",{className:"cds-rounded-xl cds-border cds-border-border cds-bg-surface-muted cds-p-4",children:[e.jsxs("h3",{className:"cds-mb-2 cds-text-sm cds-font-bold cds-text-fg",children:["Finish with ",A(N.map(s=>g(s.carrier_name)))]}),Te?e.jsx("ul",{className:"cds-mb-3 cds-space-y-1",children:N.map(s=>e.jsxs("li",{className:"cds-flex cds-justify-between cds-gap-2 cds-text-xs",children:[e.jsxs("span",{className:"cds-flex cds-items-center cds-gap-1.5 cds-text-fg-muted",children:[e.jsx(H,{lob:s.lob,size:"sm"}),k(s.lob)??"Policy"]}),e.jsxs("span",{className:"cds-text-right cds-font-semibold cds-text-fg",children:[g(s.carrier_name)," · ",Z(je(s)),"/mo"]})]},s.quote_rate_id))}):null,e.jsxs("label",{className:"cds-mb-3 cds-flex cds-cursor-pointer cds-items-start cds-gap-2 cds-text-xs cds-text-fg-muted",children:[e.jsx("input",{type:"checkbox",checked:de,onChange:s=>ce(s.target.checked),className:"cds-mt-0.5"}),e.jsxs("span",{children:["I acknowledge the"," ",e.jsx("a",{href:"/privacy-policy",className:"cds-font-semibold cds-text-fg cds-underline",children:"Privacy Notice"})," ","and authorize Credify to share my information with"," ",e.jsx("span",{className:"cds-font-semibold",children:A(N.map(s=>g(s.carrier_name)))})," to complete my"," ",N.length>1?"applications":"application","."]})]}),me.length?e.jsxs("p",{className:"cds-mb-3 cds-text-xs cds-text-fg-muted",children:["You haven't picked a ",A(me.map(s=>k(s)??s))," quote yet — choose one above to request both together, or go ahead and we'll ask about it after."]}):null,e.jsx(he,{message:qe}),e.jsx(E,{disabled:!de||B,onClick:()=>void Ce(N),children:B?"Submitting…":N.length>1?"Request these policies":"Request this policy"})]}):null,e.jsx(os,{quoteId:c}),e.jsx("p",{className:"cds-mt-6 cds-text-xs cds-leading-relaxed cds-text-fg-muted",children:"Quotes are estimates based on the information provided and are subject to carrier underwriting. Final premiums may differ."})]})};export{ws as n,os as r,ys as t};
17
+ */const ls=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],ye=ee("phone",ls);var ns=2500,is=t=>{if(!t)return null;let c=Math.round((Date.parse(t)-Date.now())/864e5);return!Number.isFinite(c)||c<1?null:c===1?"It works for 1 more day.":`It works for the next ${c} days.`},os=({quoteId:t})=>{let[c,o]=n.useState({kind:"pending"}),[r,m]=n.useState(!1),q=n.useRef(null),l=n.useRef(!1);n.useEffect(()=>{l.current||(l.current=!0,(async()=>{try{let[{issueResumeLink:x},{buildResumeUrl:h}]=await Promise.all([xe(()=>import("./iframe-Chy4dD4i.js").then(b=>b.a3),__vite__mapDeps([0,1])),xe(()=>import("./iframe-Chy4dD4i.js").then(b=>b.a2),__vite__mapDeps([0,1])).then(b=>b.u)]),{resumeToken:C,expiresAt:H}=await x(t??void 0);o({kind:"ready",url:h(C),expiresAt:H})}catch{o({kind:"unavailable"})}})())},[t]),n.useEffect(()=>{if(!r)return;let x=setTimeout(()=>m(!1),ns);return()=>clearTimeout(x)},[r]);let u=n.useCallback(async x=>{q.current?.select();try{await navigator.clipboard.writeText(x),m(!0)}catch{m(!1)}},[]);if(c.kind!=="ready")return null;let v=is(c.expiresAt);return e.jsx("div",{"data-credify-resume-link":!0,className:"cds-mt-6 cds-rounded-xl cds-border cds-border-border cds-bg-surface-muted cds-p-4",children:e.jsxs("div",{className:"cds-flex cds-items-start cds-gap-3",children:[e.jsx(rs,{"aria-hidden":"true",className:"cds-mt-0.5 cds-h-5 cds-w-5 cds-shrink-0 cds-text-fg"}),e.jsxs("div",{className:"cds-min-w-0 cds-flex-1",children:[e.jsx("h3",{className:"cds-text-sm cds-font-bold cds-text-fg",children:"Want to think it over?"}),e.jsxs("p",{className:"cds-mt-1 cds-text-sm cds-text-fg-muted",children:["Save this link and open it on any device to come back to these quotes.",v?` ${v}`:""]}),e.jsxs("div",{className:"cds-mt-3 cds-flex cds-flex-col cds-gap-2 sm:cds-flex-row",children:[e.jsx("input",{ref:q,type:"text",readOnly:!0,value:c.url,"aria-label":"Link back to your quotes",onFocus:x=>x.currentTarget.select(),className:`cds-min-w-0 cds-flex-1 cds-rounded-lg cds-border cds-border-input cds-bg-surface-elevated cds-px-3 cds-py-2 cds-text-xs cds-text-fg-muted ${j}`}),e.jsxs("button",{type:"button",onClick:()=>void u(c.url),className:`cds-inline-flex cds-shrink-0 cds-items-center cds-justify-center cds-gap-1.5 cds-rounded-lg cds-border cds-border-primary cds-px-4 cds-py-2 cds-text-sm cds-font-semibold cds-text-fg cds-transition-colors hover:cds-bg-primary hover:cds-text-primary-foreground ${j}`,children:[e.jsx(r?ss:cs,{"aria-hidden":"true",className:"cds-h-4 cds-w-4"}),r?"Copied":"Copy link"]})]}),e.jsx("p",{"aria-live":"polite",className:"sr-only",children:r?"Link copied to clipboard":""}),e.jsx("p",{className:"cds-mt-2 cds-text-xs cds-text-fg-muted",children:"Anyone with this link can see your quote, so keep it to yourself. You'll still confirm by text message before anything is submitted to a carrier."})]})]})})},ws=Le({RatesPanel:()=>ys}),ms=3e3,us=33e4,Z=t=>`$${(t/100).toLocaleString("en-US",{maximumFractionDigits:0})}`,xs=t=>t.split(/\s+/).filter(Boolean).slice(0,2).map(c=>c[0]?.toUpperCase()??"").join(""),hs=[{market:"admitted",label:"Admitted"},{market:"non_admitted",label:"Non-admitted"},{market:"not_quoted",label:"Not quoted"}],L=t=>({tab:`rates-tab-${t}`,panel:`rates-panel-${t}`}),Ne=({rate:t,size:c})=>{let o=g(t.carrier_name),r=c==="sm"?"cds-h-9 cds-w-9":"cds-h-10 cds-w-10";return t.carrier_logo_base64?e.jsx("img",{src:`data:image/png;base64,${t.carrier_logo_base64}`,alt:o,className:`${r} cds-rounded cds-object-contain`}):e.jsx("span",{"aria-hidden":"true",className:`cds-flex ${r} cds-shrink-0 cds-items-center cds-justify-center cds-rounded cds-bg-primary/10 cds-text-sm cds-font-bold cds-text-fg`,children:xs(o)})},be={PersonalAuto:"Personal Auto",PersonalHome:"Homeowners"},fs={PersonalHome:Xe,PersonalAuto:ts,Flood:ge,ExcessFlood:ge},F=({lob:t,size:c="md"})=>{let o=t&&fs[t]||X,r=c==="sm"?"cds-h-5 cds-w-5":"cds-h-7 cds-w-7",m=c==="sm"?"cds-h-3 cds-w-3":"cds-h-4 cds-w-4";return e.jsx("span",{"aria-hidden":"true",className:`cds-inline-flex ${r} cds-shrink-0 cds-items-center cds-justify-center cds-rounded-full cds-bg-accent/15 cds-ring-1 cds-ring-inset cds-ring-ring/25`,children:e.jsx(o,{className:`${m} cds-text-accent`,strokeWidth:2.5})})},ps=({rate:t,showLob:c,isSelected:o,isRequested:r,lobLocked:m,onSelect:q})=>{let l=g(t.carrier_name),u=es(t),v=c?k(t.lob):null,x=t.effective_date&&t.policy_end_date?`${t.effective_date} – ${t.policy_end_date}`:t.effective_date;return e.jsxs("div",{className:`cds-rounded-xl cds-border cds-bg-surface-elevated cds-p-4 ${r?"cds-border-accent cds-ring-2 ring-emerald-500/30":o?"cds-border-accent cds-ring-2 cds-ring-ring/30":"cds-border-border"} ${m?"cds-opacity-60":""}`,children:[v?e.jsxs("p",{className:"cds-mb-2 cds-flex cds-items-center cds-gap-1.5 cds-text-xs cds-font-semibold cds-uppercase cds-tracking-wide cds-text-fg",children:[e.jsx(F,{lob:t.lob,size:"sm"}),v]}):null,e.jsxs("div",{className:"cds-flex cds-items-center cds-gap-3",children:[e.jsx(Ne,{rate:t,size:"md"}),e.jsxs("div",{className:"cds-min-w-0 cds-flex-1",children:[e.jsx("p",{className:"cds-truncate cds-font-bold cds-text-fg",children:l}),e.jsxs("p",{className:"cds-text-xs cds-text-fg-muted",children:[Z(t.premium_cents)," for ",t.term_months," months"]}),t.admitted_status==="non_admitted"?e.jsx("p",{className:"cds-mt-1 cds-inline-block cds-rounded cds-bg-warning-surface cds-px-1.5 cds-py-0.5 cds-text-[11px] cds-font-semibold cds-text-warning-foreground",children:"Surplus lines"}):null]}),e.jsxs("div",{className:"cds-text-right",children:[e.jsx("p",{className:"cds-text-xl cds-font-extrabold cds-text-fg",children:Z(je(t))}),e.jsx("p",{className:"cds-text-xs cds-text-fg-muted",children:"/mo"})]})]}),x?e.jsxs("p",{className:"cds-mt-2 cds-text-xs cds-text-fg-muted",children:["Effective ",x]}):null,u.length?e.jsx("dl",{className:"cds-mt-3 cds-space-y-1 cds-border-t cds-border-border cds-pt-3 cds-text-xs",children:u.map((h,C)=>e.jsxs("div",{className:"cds-flex cds-justify-between cds-gap-2",children:[e.jsx("dt",{className:"cds-text-fg-muted",children:h.label}),e.jsx("dd",{className:"cds-text-right cds-font-semibold cds-text-fg",children:h.value})]},`${h.label}-${C}`))}):null,t.carrier_quote_id?e.jsxs("p",{className:"cds-mt-2 cds-text-xs cds-text-fg-muted",children:["Carrier quote ID: ",t.carrier_quote_id]}):null,r?e.jsx("p",{className:"cds-mt-3 cds-rounded-lg cds-bg-highlight cds-px-4 cds-py-2 cds-text-center cds-text-sm cds-font-bold cds-text-accent",children:"Request sent"}):m?e.jsxs("p",{className:"cds-mt-3 cds-text-center cds-text-xs cds-text-fg-muted",children:["You already have a request in for ",k(t.lob)??"this line","."]}):e.jsx("button",{type:"button",onClick:q,className:`cds-mt-3 cds-w-full cds-rounded-lg cds-border cds-border-accent cds-px-4 cds-py-2 cds-text-sm cds-font-bold cds-text-fg hover:cds-bg-highlight ${j}`,children:o?"Selected":"Continue with this quote"})]})},gs=({rate:t})=>{let c=(t.decline_reasons??[]).filter(Boolean),o=t.decline_category?.trim();return e.jsxs("div",{className:"cds-flex cds-gap-3 cds-rounded-xl cds-border cds-border-border cds-bg-surface-elevated cds-p-4",children:[e.jsx(Ne,{rate:t,size:"sm"}),e.jsxs("div",{className:"cds-min-w-0 cds-flex-1",children:[e.jsx("p",{className:"cds-font-bold cds-text-fg",children:g(t.carrier_name)}),o?e.jsx("p",{className:"cds-mt-0.5 cds-text-xs cds-font-semibold cds-uppercase cds-tracking-wide cds-text-fg-muted",children:o}):null,c.length?e.jsx("ul",{className:"cds-mt-2 cds-list-outside cds-list-disc cds-space-y-1 cds-pl-5 cds-text-sm cds-text-fg-muted",children:c.map((r,m)=>e.jsx("li",{children:r},`${r}-${m}`))}):e.jsx("p",{className:"cds-mt-2 cds-text-sm cds-text-fg-muted",children:"This carrier did not return a quote."})]})]})},T=({quoteId:t})=>t?e.jsxs("div",{className:"cds-mt-6 cds-inline-block cds-rounded-lg cds-border cds-border-border cds-bg-surface-muted cds-px-4 cds-py-2.5 cds-text-center",children:[e.jsx("p",{className:"cds-text-xs cds-text-fg-muted",children:"Reference ID"}),e.jsx("p",{className:"cds-mt-0.5 cds-select-all cds-font-mono cds-text-sm cds-font-semibold cds-text-fg",children:t})]}):null,G=({heading:t,body:c,quoteId:o})=>e.jsxs("div",{className:"cds-py-6 cds-text-center",children:[e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:t}),e.jsx("p",{className:"cds-mb-6 cds-text-fg-muted",children:c}),e.jsxs("a",{href:D,onClick:()=>J("phone_call_click",{placement:"quote_rates_fallback",phone:w}),className:`cds-inline-flex cds-items-center cds-gap-2 cds-rounded-xl cds-bg-accent cds-px-8 cds-py-3.5 cds-text-base cds-font-bold cds-text-primary-foreground hover:cds-bg-accent ${j}`,children:[e.jsx(ye,{"aria-hidden":"true",className:"cds-h-4 cds-w-4"}),"Call ",w]}),e.jsx("div",{children:e.jsx(T,{quoteId:o})})]}),bs={Auto:["PersonalAuto"],Home:["PersonalHome"],Bundle:["PersonalAuto","PersonalHome"]},A=t=>t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`,K=t=>t.lob??"_other",Q=(t,c)=>{let o=new Set(c.map(r=>r.lob));return[...new Set(t.filter(r=>Ze(r)!=="not_quoted").map(r=>r.lob).filter(r=>!!r))].filter(r=>!o.has(r))},js=({appetites:t,product:c})=>{let o=bs[c]??Object.keys(t??{}),r=[...new Set(o.flatMap(m=>t?.[m]??[]).map(g))].slice(0,8);return r.length?e.jsxs("p",{className:"cds-mt-4 cds-text-sm cds-text-fg-muted",children:["Checking ",r.join(", "),r.length>=8?" and more":"","…"]}):null},ys=({product:t,quoteId:c,describeField:o,onFixAnswers:r,onRetry:m,onBound:q})=>{let[l,u]=n.useState({kind:"polling"}),[v,x]=n.useState(null),[h,C]=n.useState(),[H,b]=n.useState({}),[y,_e]=n.useState([]),[ke,ve]=n.useState(!1),[O,se]=n.useState(""),[we,S]=n.useState(),[z,te]=n.useState(!1),[I,M]=n.useState(0),[de,ce]=n.useState(!1),[W,ae]=n.useState(!1),[qe,re]=n.useState(),$=n.useRef(0),B=n.useCallback(()=>{$.current+=1;let s=$.current,d=Date.now(),a=async()=>{if(s===$.current){try{let{quote:i}=await He(c??void 0);if(s!==$.current)return;C(i);let U=i?.rates_status;if(U==="completed"){let{rates:P}=await Oe(c??void 0);if(s!==$.current)return;let R=P??[];u(R.length?{kind:"ready",rates:R}:{kind:"no_rates"});return}if(U==="no_rates"){u({kind:"no_rates"});return}if(U==="failed"){let P=i?.last_validation_errors??[];if(i?.last_failure_code==="BOLT_VALIDATION"&&P.length){u({kind:"validation_failed",errors:P,message:i?.rates_failure_message??void 0});return}let R=i?.last_failure_code==="UNHANDLED"||i?.last_failure_code==="DISPATCH"||i?.last_failure_code==="BOLT_RATES";u({kind:"failed",retryable:R,message:i?.rates_failure_message??void 0}),fe(Error(i?.rates_failure_message||`Rating failed: ${i?.last_failure_code??"unknown"}`),{phase:"rates_failed",product:t,quoteId:c,failureCode:i?.last_failure_code});return}}catch(i){ze("rates poll failed",{status:Me(i)})}if(Date.now()-d>=us){u({kind:"failed",retryable:!0}),fe(Error("Rating timed out before returning a result"),{phase:"rates_timeout",product:t,quoteId:c});return}setTimeout(()=>void a(),ms)}};a()},[c,t]);n.useEffect(()=>(B(),()=>{$.current+=1}),[B]),n.useEffect(()=>{if(I<=0)return;let s=setTimeout(()=>M(d=>d-1),1e3);return()=>clearTimeout(s)},[I]);let f=n.useMemo(()=>Ue(l.kind==="ready"?l.rates:[]),[l]),le=s=>Array.isArray(s)?s.filter(d=>d&&typeof d=="object"):[],$e=n.useMemo(()=>l.kind==="validation_failed"?Ge(l.errors,{describeField:o,vehicles:le(h?.vehicles),drivers:le(h?.drivers)}):void 0,[l,o,h]),p=v??(f.admitted.length?"admitted":f.non_admitted.length?"non_admitted":f.not_quoted.length?"not_quoted":"admitted"),ne=async(s,d)=>{if(!c)return;u({kind:"verify",rate:s,rates:d}),S(void 0),se("");let a=String(h?.phone??"");try{await Be(c,a),M(60)}catch(i){i instanceof pe&&i.statusCode===429?M(i.retryAfterSeconds??60):S("We could not text your code. Try again in a moment.")}},Ae=async(s,d)=>{if(!(!c||z)){te(!0),S(void 0);try{let{isVerified:a}=await We(c,O);if(!a){S("That code did not match. Check it and try again.");return}u({kind:"ready",rates:d.length?d:[s]}),ve(!0),b(i=>({...i,[K(s)]:s.quote_rate_id}))}catch(a){S(a instanceof pe&&a.statusCode===429?"Too many attempts. Request a new code.":"We could not verify that code. Please try again.")}finally{te(!1)}}},ie=s=>{Ve(),u({kind:"bound",rates:s}),q?.(s)},Ce=async s=>{if(W||!s.length)return;ae(!0),re(void 0);try{await Ye(s.map(a=>a.quote_rate_id),!0)}catch{re(s.length>1?"We could not submit those requests. Please call us and we will finish them for you.":"We could not submit that request. Please call us and we will finish it for you.");return}finally{ae(!1)}let d=[...y,...s];if(_e(d),b({}),Q(l.kind==="ready"?l.rates:[],d).length){ce(!1);return}ie(d)};if(l.kind==="polling")return e.jsxs("div",{className:"cds-py-10 cds-text-center","aria-live":"polite",children:[e.jsx("div",{className:"cds-mx-auto cds-mb-6 cds-h-10 cds-w-10 cds-animate-spin cds-rounded-full cds-border-4 cds-border-accent cds-border-t-transparent","aria-hidden":"true"}),e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:"Getting your quotes…"}),e.jsx("p",{className:"cds-text-fg-muted",children:"Please keep this window open while we run your details through our carriers. This usually takes a minute or two."}),e.jsx("p",{className:"cds-mt-2 cds-text-fg-muted",children:"If you get disconnected, your progress is saved in this browser — reopen this page and you'll pick up where you left off. Thanks for your patience."}),e.jsx(js,{appetites:h?.appetites,product:t})]});if(l.kind==="validation_failed"){let s=$e;return!s||s.isOpaque?e.jsx(G,{heading:"Let's finish this one together",body:"The carrier needs a couple of details we can't collect online. An agent can sort it out with you in a few minutes.",quoteId:c}):e.jsxs("div",{className:"cds-py-6",children:[e.jsxs("div",{className:"cds-mb-5 cds-rounded-xl cds-border cds-border-warning cds-bg-warning-surface cds-p-4",children:[e.jsxs("div",{className:"cds-flex cds-items-start cds-gap-3",children:[e.jsx(De,{"aria-hidden":"true",className:"cds-mt-0.5 cds-h-5 cds-w-5 cds-shrink-0 cds-text-warning"}),e.jsxs("div",{children:[e.jsx("h2",{className:"cds-text-lg cds-font-bold cds-text-fg",children:"A few answers need another look"}),e.jsx("p",{className:"cds-mt-1 cds-text-sm cds-text-fg-muted",children:"The carrier couldn't price your quote until these are sorted. It only takes a minute."})]})]}),e.jsx("div",{className:"cds-mt-4 cds-space-y-4",children:s.groups.map(d=>e.jsxs("div",{children:[e.jsx("p",{className:"cds-text-sm cds-font-bold cds-text-fg",children:d.heading}),d.sharedMessage?e.jsxs("p",{className:"cds-mt-1 cds-text-sm cds-text-fg-muted",children:[d.sharedMessage," ",e.jsx("span",{className:"cds-font-semibold",children:Ke(d.labels)}),"."]}):e.jsx("ul",{className:"cds-mt-1 cds-list-outside cds-list-disc cds-space-y-1 cds-pl-5 cds-text-sm cds-text-fg-muted",children:d.issues.map(a=>e.jsx("li",{children:Qe(a)},`${a.label??""}-${a.message}`))})]},d.id))}),s.otherCount?e.jsxs("p",{className:"cds-mt-4 cds-text-xs cds-text-fg-muted",children:["The carrier flagged ",s.otherCount," other ",s.otherCount===1?"detail":"details"," we'll check with you if it still won't price."]}):null]}),e.jsx(E,{onClick:()=>r(l.errors),children:"Fix my answers"}),e.jsxs("p",{className:"cds-mt-4 cds-text-center cds-text-sm cds-text-fg-muted",children:["Or call"," ",e.jsx("a",{href:D,onClick:()=>J("phone_call_click",{placement:"quote_rates_validation",phone:w}),className:"cds-font-semibold cds-text-fg cds-underline",children:w})," ","and an agent will finish it with you."]}),e.jsx("div",{className:"cds-text-center",children:e.jsx(T,{quoteId:c})})]})}if(l.kind==="failed")return e.jsx("div",{className:"cds-py-6",children:l.retryable?e.jsxs("div",{className:"cds-text-center",children:[e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:"That took longer than expected"}),e.jsx("p",{className:"cds-mb-6 cds-text-fg-muted",children:l.message??"Our carrier connection hiccuped. One more try usually does it."}),e.jsx(E,{onClick:()=>{u({kind:"polling"}),m().then(s=>{s&&B()})},children:"Try again"}),e.jsxs("p",{className:"cds-mt-4 cds-text-sm cds-text-fg-muted",children:["Or call"," ",e.jsx("a",{href:D,className:"cds-font-semibold cds-text-fg cds-underline",children:w})," ","and an agent will pull them for you."]}),e.jsx(T,{quoteId:c})]}):e.jsx(G,{heading:"Let's get your quotes another way",body:"A licensed agent can pull your quotes over the phone in a few minutes — no waiting.",quoteId:c})});if(l.kind==="no_rates")return e.jsx(G,{heading:"No online offers for this one",body:"That happens with some homes and vehicles. An agent has access to carriers that don't quote online.",quoteId:c});if(l.kind==="verify"){let{rate:s,rates:d}=l;return e.jsxs("div",{className:"cds-py-6",children:[e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:"Verify your number"}),e.jsxs("p",{className:"cds-mb-6 cds-text-fg-muted",children:["We texted a 6-digit code to confirm it's you before we send your ",s.carrier_name," request."]}),e.jsx("label",{htmlFor:"sms-code",className:"cds-mb-1 cds-block cds-text-sm cds-font-semibold cds-text-fg",children:"Verification code"}),e.jsx("input",{id:"sms-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,value:O,onChange:a=>se(a.target.value.replace(/\D/g,"").slice(0,6)),className:`${Fe} cds-tracking-[0.4em]`}),e.jsx(he,{message:we}),e.jsx(E,{disabled:O.length!==6||z,onClick:()=>void Ae(s,d),children:z?"Verifying…":"Verify and continue"}),e.jsx("button",{type:"button",disabled:I>0,onClick:()=>void ne(s,d),className:`cds-mt-3 cds-w-full cds-rounded-lg cds-px-4 cds-py-2 cds-text-sm cds-font-semibold cds-text-fg cds-underline disabled:cds-no-underline disabled:cds-opacity-60 ${j}`,children:I>0?`Resend code in ${I}s`:"Resend code"})]})}if(l.kind==="bound"){let s=l.rates.length===1?l.rates[0]:void 0;return e.jsxs("div",{className:"cds-py-10 cds-text-center",children:[e.jsx(X,{"aria-hidden":"true",className:"cds-mx-auto cds-mb-4 cds-h-12 cds-w-12 cds-text-accent"}),e.jsx("h2",{className:"cds-mb-2 cds-text-2xl cds-font-bold cds-text-fg",children:"You're all set"}),s?e.jsxs("p",{className:"cds-text-fg-muted",children:["A licensed agent is finalizing your ",g(s.carrier_name)," policy and will call you shortly to confirm the details."]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"cds-mb-4 cds-text-fg-muted",children:"A licensed agent is finalizing these policies and will call you shortly to confirm the details."}),e.jsx("ul",{className:"cds-mx-auto cds-max-w-sm cds-space-y-2 cds-text-left",children:l.rates.map(d=>e.jsxs("li",{className:"cds-flex cds-items-center cds-gap-2 cds-rounded-lg cds-border cds-border-border cds-bg-surface-elevated cds-p-3 cds-text-sm",children:[e.jsx(F,{lob:d.lob}),e.jsxs("span",{children:[e.jsx("span",{className:"cds-font-bold cds-text-fg",children:g(d.carrier_name)}),k(d.lob)?e.jsxs("span",{className:"cds-text-fg-muted",children:[" — ",k(d.lob)]}):null]})]},d.quote_rate_id))})]}),e.jsx(T,{quoteId:c}),e.jsxs("p",{className:"cds-mt-2 cds-text-xs cds-text-fg-muted",children:["Quote this if you call us about ",l.rates.length>1?"these requests":"this request","."]})]})}let V=new Set(y.map(s=>s.quote_rate_id)),Se=new Set(y.map(s=>s.lob)),oe=s=>H[K(s)]===s.quote_rate_id,N=l.rates.filter(s=>oe(s)&&!V.has(s.quote_rate_id)),Ie=ke,Y=Q(l.rates,y),Te=Q(l.rates,[]).length>1,me=Y.filter(s=>!N.some(d=>d.lob===s)),_=hs.filter(s=>s.market!=="not_quoted"||f.not_quoted.length>0),Pe=f.admitted.length+f.non_admitted.length,Re=Je(p==="not_quoted"?f.not_quoted:f[p],{sortBy:p==="not_quoted"?"carrier":"premium"}),ue=t==="Bundle"?[{lob:"PersonalAuto",label:be.PersonalAuto},{lob:"PersonalHome",label:be.PersonalHome}].filter(({lob:s})=>!l.rates.some(d=>d.lob===s)):[],Ee=s=>{let d=s.key==="ArrowRight"?1:s.key==="ArrowLeft"?-1:0,a=s.key==="Home"?_[0]:s.key==="End"?_[_.length-1]:d?_[(_.findIndex(i=>i.market===p)+d+_.length)%_.length]:void 0;a&&(s.preventDefault(),x(a.market),setTimeout(()=>document.getElementById(L(a.market).tab)?.focus(),0))};return e.jsxs("div",{className:"cds-py-2",children:[e.jsx("h2",{className:"cds-mb-1 cds-text-2xl cds-font-bold cds-text-fg",children:"Your quotes"}),e.jsx("p",{className:"cds-mb-4 cds-text-sm cds-text-fg-muted",children:"Real prices from our carriers, based on the answers you gave."}),ue.length?e.jsx("div",{className:"cds-mb-4 cds-space-y-1",children:ue.map(({lob:s,label:d})=>e.jsxs("p",{className:"cds-text-sm cds-text-fg-muted",children:["Sorry, no rates found for ",d,"."]},s))}):null,y.length>0&&Y.length>0?e.jsxs("div",{className:"cds-mb-5 cds-rounded-xl cds-border cds-border-accent cds-bg-highlight cds-p-4",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"cds-flex cds-items-start cds-gap-3",children:[e.jsx(X,{"aria-hidden":"true",className:"cds-mt-0.5 cds-h-5 cds-w-5 cds-shrink-0 cds-text-accent"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"cds-text-sm cds-font-bold cds-text-fg",children:["We've sent your ",A(y.map(s=>k(s.lob)??g(s.carrier_name)))," request to"," ",A(y.map(s=>g(s.carrier_name)))]}),e.jsxs("p",{className:"cds-mt-1 cds-text-sm cds-text-fg-muted",children:["You can still add ",A(Y.map(s=>k(s)??s))," — pick a quote above and we'll send that one too. You won't need another verification code."]})]})]}),e.jsx("button",{type:"button",onClick:()=>ie(y),className:`cds-mt-3 cds-text-sm cds-font-semibold cds-text-fg cds-underline ${j}`,children:"No thanks, I'm done"})]}):null,e.jsx("div",{className:"cds-mb-4 -cds-mx-1 cds-overflow-x-auto cds-border-b cds-border-border cds-px-1",children:e.jsx("div",{className:"cds-flex cds-items-center cds-gap-4 sm:cds-gap-6",role:"tablist","aria-label":"Rate market type",children:_.map(s=>{let d=s.market===p,a=L(s.market);return e.jsxs("button",{id:a.tab,type:"button",role:"tab","aria-selected":d,"aria-controls":a.panel,tabIndex:d?0:-1,onClick:()=>x(s.market),onKeyDown:Ee,className:`cds-whitespace-nowrap cds-border-b-2 cds-px-1 cds-py-2 cds-text-xs cds-font-semibold cds-transition-colors sm:cds-text-sm ${j} ${d?"cds-border-accent cds-text-fg":"cds-border-transparent cds-text-fg-muted hover:cds-text-fg"}`,children:[s.label," (",f[s.market].length,")"]},s.market)})})}),e.jsxs("div",{id:L(p).panel,role:"tabpanel","aria-labelledby":L(p).tab,tabIndex:0,className:`cds-mb-6 cds-outline-none ${j}`,children:[p==="admitted"&&!f.admitted.length?e.jsx("p",{className:"cds-text-sm cds-text-fg-muted",children:"No admitted-market carriers priced this quote."}):null,p==="non_admitted"&&!f.non_admitted.length?e.jsx("p",{className:"cds-text-sm cds-text-fg-muted",children:"No surplus-lines carriers priced this quote."}):null,p==="not_quoted"?e.jsx("p",{className:"cds-mb-3 cds-text-sm cds-text-fg-muted",children:"These carriers looked at your details and passed. Their reasons are below."}):null,Re.map((s,d)=>e.jsxs("div",{className:"cds-mb-5 last:cds-mb-0",children:[d?e.jsx("div",{"aria-hidden":"true",className:"cds-mb-5 cds-h-px cds-bg-gradient-to-r cds-from-transparent cds-via-brand-accent/40 cds-to-transparent"}):null,s.lob?e.jsxs("h3",{className:"cds-mb-2 cds-flex cds-items-center cds-gap-2 cds-text-sm cds-font-bold cds-uppercase cds-tracking-wide cds-text-fg",children:[e.jsx(F,{lob:s.lob}),s.title]}):null,e.jsx("ul",{className:"cds-space-y-3",children:s.rates.map(a=>p==="not_quoted"?e.jsx("li",{children:e.jsx(gs,{rate:a})},a.quote_rate_id):e.jsx("li",{children:e.jsx(ps,{rate:a,showLob:!s.lob,isSelected:oe(a),isRequested:V.has(a.quote_rate_id),lobLocked:!V.has(a.quote_rate_id)&&Se.has(a.lob),onSelect:()=>Ie?b(i=>({...i,[K(a)]:a.quote_rate_id})):void ne(a,l.rates)})},a.quote_rate_id))})]},s.lob??"all"))]}),Pe?null:e.jsxs("div",{className:"cds-mb-6 cds-rounded-xl cds-border cds-border-border cds-bg-surface-muted cds-p-4 cds-text-center",children:[e.jsx("p",{className:"cds-mb-3 cds-text-sm cds-text-fg-muted",children:"No carrier priced this one online. An agent has access to carriers that don't quote on the web."}),e.jsxs("a",{href:D,onClick:()=>J("phone_call_click",{placement:"quote_rates_all_declined",phone:w}),className:`cds-inline-flex cds-items-center cds-gap-2 cds-rounded-xl cds-bg-accent cds-px-6 cds-py-3 cds-text-sm cds-font-bold cds-text-primary-foreground hover:cds-bg-accent ${j}`,children:[e.jsx(ye,{"aria-hidden":"true",className:"cds-h-4 cds-w-4"}),"Call ",w]}),e.jsx("div",{children:e.jsx(T,{quoteId:c})})]}),N.length?e.jsxs("div",{className:"cds-rounded-xl cds-border cds-border-border cds-bg-surface-muted cds-p-4",children:[e.jsxs("h3",{className:"cds-mb-2 cds-text-sm cds-font-bold cds-text-fg",children:["Finish with ",A(N.map(s=>g(s.carrier_name)))]}),Te?e.jsx("ul",{className:"cds-mb-3 cds-space-y-1",children:N.map(s=>e.jsxs("li",{className:"cds-flex cds-justify-between cds-gap-2 cds-text-xs",children:[e.jsxs("span",{className:"cds-flex cds-items-center cds-gap-1.5 cds-text-fg-muted",children:[e.jsx(F,{lob:s.lob,size:"sm"}),k(s.lob)??"Policy"]}),e.jsxs("span",{className:"cds-text-right cds-font-semibold cds-text-fg",children:[g(s.carrier_name)," · ",Z(je(s)),"/mo"]})]},s.quote_rate_id))}):null,e.jsxs("label",{className:"cds-mb-3 cds-flex cds-cursor-pointer cds-items-start cds-gap-2 cds-text-xs cds-text-fg-muted",children:[e.jsx("input",{type:"checkbox",checked:de,onChange:s=>ce(s.target.checked),className:"cds-mt-0.5"}),e.jsxs("span",{children:["I acknowledge the"," ",e.jsx("a",{href:"/privacy-policy",className:"cds-font-semibold cds-text-fg cds-underline",children:"Privacy Notice"})," ","and authorize Credify to share my information with"," ",e.jsx("span",{className:"cds-font-semibold",children:A(N.map(s=>g(s.carrier_name)))})," to complete my"," ",N.length>1?"applications":"application","."]})]}),me.length?e.jsxs("p",{className:"cds-mb-3 cds-text-xs cds-text-fg-muted",children:["You haven't picked a ",A(me.map(s=>k(s)??s))," quote yet — choose one above to request both together, or go ahead and we'll ask about it after."]}):null,e.jsx(he,{message:qe}),e.jsx(E,{disabled:!de||W,onClick:()=>void Ce(N),children:W?"Submitting…":N.length>1?"Request these policies":"Request this policy"})]}):null,e.jsx(os,{quoteId:c}),e.jsx("p",{className:"cds-mt-6 cds-text-xs cds-leading-relaxed cds-text-fg-muted",children:"Quotes are estimates based on the information provided and are subject to carrier underwriting. Final premiums may differ."})]})};export{ws as n,os as r,ys as t};
@@ -1,6 +1,6 @@
1
- var ge=n=>{throw TypeError(n)};var Ce=(n,o,e)=>o.has(n)||ge("Cannot "+e);var R=(n,o,e)=>(Ce(n,o,"read from private field"),e?e.call(n):o.get(n)),ve=(n,o,e)=>o.has(n)?ge("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(n):o.set(n,e),J=(n,o,e,t)=>(Ce(n,o,"write to private field"),t?t.call(n,e):o.set(n,e),e);import{m as qe,r as l,C as T,b as c,F as V,t as He,e as ee,d as be,f as Ae,g as Be,G as Fe}from"./iframe-BImWklE9.js";import{o as Ge,n as Ue,r as We}from"./stage-Bpq1A5xB-CwZgWOhp.js";import{c as K,P as $,a as we,u as te,b as Re,d as Ye,e as Je,C as Qe}from"./index-CNb9AhPB.js";/**
1
+ var ge=n=>{throw TypeError(n)};var Ce=(n,o,e)=>o.has(n)||ge("Cannot "+e);var w=(n,o,e)=>(Ce(n,o,"read from private field"),e?e.call(n):o.get(n)),ve=(n,o,e)=>o.has(n)?ge("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(n):o.set(n,e),Y=(n,o,e,t)=>(Ce(n,o,"write to private field"),t?t.call(n,e):o.set(n,e),e);import{l as qe,r as l,L as T,a as c,M as V,t as He,d as ee,c as be,f as Ae,g as Be,P as Fe}from"./iframe-Chy4dD4i.js";import{o as Ge,n as Ue,r as We}from"./stage-knShj71W-BrRsgDlE.js";import{c as K,P as $,a as Re,u as te,b as we,d as Xe,e as Ye,C as Je}from"./index-D81Toecg.js";/**
2
2
  * @license lucide-react v0.562.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Xe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ze=qe("pencil",Xe);var et=Object.defineProperty,y=(n,o)=>et(n,"name",{value:o,configurable:!0});function je(n){const o=n+"CollectionProvider",[e,t]=K(o),[r,s]=e(o,{collectionRef:{current:null},itemMap:new Map}),i=y(v=>{const{scope:g,children:I}=v,A=l.useRef(null),u=l.useRef(new Map).current;return c.jsx(r,{scope:g,itemMap:u,collectionRef:A,children:I})},"CollectionProvider");i.displayName=o;const d=n+"CollectionSlot",f=V(d),p=l.forwardRef((v,g)=>{const{scope:I,children:A}=v,u=s(d,I),m=T(g,u.collectionRef);return c.jsx(f,{ref:m,children:A})});p.displayName=d;const a=n+"CollectionItemSlot",h="data-radix-collection-item",x=V(a),j=l.forwardRef((v,g)=>{const{scope:I,children:A,...u}=v,m=l.useRef(null),O=T(g,m),N=s(a,I);return l.useEffect(()=>(N.itemMap.set(m,{ref:m,...u}),()=>void N.itemMap.delete(m))),c.jsx(x,{[h]:"",ref:O,children:A})});j.displayName=a;function C(v){const g=s(n+"CollectionConsumer",v);return l.useCallback(()=>{const A=g.collectionRef.current;if(!A)return[];const u=Array.from(A.querySelectorAll(`[${h}]`));return Array.from(g.itemMap.values()).sort((N,_)=>u.indexOf(N.ref.current)-u.indexOf(_.ref.current))},[g.collectionRef,g.itemMap])}return y(C,"useCollection"),[{Provider:i,Slot:p,ItemSlot:j},C,t]}y(je,"createCollection");var ye=new WeakMap,b,P,Q=(P=class extends Map{constructor(e){super(e);ve(this,b);J(this,b,[...super.keys()]),ye.set(this,!0)}set(e,t){return ye.get(this)&&(this.has(e)?R(this,b)[R(this,b).indexOf(e)]=e:R(this,b).push(e)),super.set(e,t),this}insert(e,t,r){const s=this.has(t),i=R(this,b).length,d=oe(e);let f=d>=0?d:i+d;const p=f<0||f>=i?-1:f;if(p===this.size||s&&p===this.size-1||p===-1)return this.set(t,r),this;const a=this.size+(s?0:1);d<0&&f++;const h=[...R(this,b)];let x,j=!1;for(let C=f;C<a;C++)if(f===C){let v=h[C];h[C]===t&&(v=h[C+1]),s&&this.delete(t),x=this.get(v),this.set(t,r)}else{!j&&h[C-1]===t&&(j=!0);const v=h[j?C:C-1],g=x;x=this.get(v),this.delete(v),this.set(v,g)}return this}with(e,t,r){const s=new P(this);return s.insert(e,t,r),s}before(e){const t=R(this,b).indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){const s=R(this,b).indexOf(e);return s===-1?this:this.insert(s,t,r)}after(e){let t=R(this,b).indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,r){const s=R(this,b).indexOf(e);return s===-1?this:this.insert(s+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return J(this,b,[]),super.clear()}delete(e){const t=super.delete(e);return t&&R(this,b).splice(R(this,b).indexOf(e),1),t}deleteAt(e){const t=this.keyAt(e);return t!==void 0?this.delete(t):!1}at(e){const t=z(R(this,b),e);if(t!==void 0)return this.get(t)}entryAt(e){const t=z(R(this,b),e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return R(this,b).indexOf(e)}keyAt(e){return z(R(this,b),e)}from(e,t){const r=this.indexOf(e);if(r===-1)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(e,t){const r=this.indexOf(e);if(r===-1)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(e,t){let r=0;for(const s of this){if(Reflect.apply(e,t,[s,r,this]))return s;r++}}findIndex(e,t){let r=0;for(const s of this){if(Reflect.apply(e,t,[s,r,this]))return r;r++}return-1}filter(e,t){const r=[];let s=0;for(const i of this)Reflect.apply(e,t,[i,s,this])&&r.push(i),s++;return new P(r)}map(e,t){const r=[];let s=0;for(const i of this)r.push([i[0],Reflect.apply(e,t,[i,s,this])]),s++;return new P(r)}reduce(...e){const[t,r]=e;let s=0,i=r??this.at(0);for(const d of this)s===0&&e.length===1?i=d:i=Reflect.apply(t,this,[i,d,s,this]),s++;return i}reduceRight(...e){const[t,r]=e;let s=r??this.at(-1);for(let i=this.size-1;i>=0;i--){const d=this.at(i);i===this.size-1&&e.length===1?s=d:s=Reflect.apply(t,this,[s,d,i,this])}return s}toSorted(e){const t=[...this.entries()].sort(e);return new P(t)}toReversed(){const e=new P;for(let t=this.size-1;t>=0;t--){const r=this.keyAt(t),s=this.get(r);e.set(r,s)}return e}toSpliced(...e){const t=[...this.entries()];return t.splice(...e),new P(t)}slice(e,t){const r=new P;let s=this.size-1;if(e===void 0)return r;e<0&&(e=e+this.size),t!==void 0&&t>0&&(s=t-1);for(let i=e;i<=s;i++){const d=this.keyAt(i),f=this.get(d);r.set(d,f)}return r}every(e,t){let r=0;for(const s of this){if(!Reflect.apply(e,t,[s,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(const s of this){if(Reflect.apply(e,t,[s,r,this]))return!0;r++}return!1}},b=new WeakMap,y(P,"OrderedDict"),P);function z(n,o){if("at"in Array.prototype)return Array.prototype.at.call(n,o);const e=Ne(n,o);return e===-1?void 0:n[e]}y(z,"at");function Ne(n,o){const e=n.length,t=oe(o),r=t>=0?t:e+t;return r<0||r>=e?-1:r}y(Ne,"toSafeIndex");function oe(n){return n!==n||n===0?0:Math.trunc(n)}y(oe,"toSafeInteger");function tt(n){const o=n+"CollectionProvider",[e,t]=K(o),[r,s]=e(o,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Q,setItemMap:y(()=>{},"setItemMap")}),i=y(({state:u,...m})=>u?c.jsx(f,{...m,state:u}):c.jsx(d,{...m}),"CollectionProvider");i.displayName=o;const d=y(u=>{const m=g();return c.jsx(f,{...u,state:m})},"CollectionInit");d.displayName=o+"Init";const f=y(u=>{const{scope:m,children:O,state:N}=u,_=l.useRef(null),[E,w]=l.useState(null),G=T(_,w),[U,W]=N;return l.useEffect(()=>{if(!E)return;const D=Se(()=>{});return D.observe(E,{childList:!0,subtree:!0}),()=>{D.disconnect()}},[E]),c.jsx(r,{scope:m,itemMap:U,setItemMap:W,collectionRef:G,collectionRefObject:_,collectionElement:E,children:O})},"CollectionProviderImpl");f.displayName=o+"Impl";const p=n+"CollectionSlot",a=V(p),h=l.forwardRef((u,m)=>{const{scope:O,children:N}=u,_=s(p,O),E=T(m,_.collectionRef);return c.jsx(a,{ref:E,children:N})});h.displayName=p;const x=n+"CollectionItemSlot",j="data-radix-collection-item",C=V(x),v=l.forwardRef((u,m)=>{const{scope:O,children:N,..._}=u,E=l.useRef(null),[w,G]=l.useState(null),U=T(m,E,G),W=s(x,O),{setItemMap:D}=W,Y=l.useRef(_);_e(Y.current,_)||(Y.current=_);const me=Y.current;return l.useEffect(()=>{const xe=me;return D(M=>w?M.has(w)?M.set(w,{...xe,element:w}).toSorted(X):(M.set(w,{...xe,element:w}),M.toSorted(X)):M),()=>{D(M=>!w||!M.has(w)?M:(M.delete(w),new Q(M)))}},[w,me,D]),c.jsx(C,{[j]:"",ref:U,children:N})});v.displayName=x;function g(){return l.useState(new Q)}y(g,"useInitCollection");function I(u){const{itemMap:m}=s(n+"CollectionConsumer",u);return m}return y(I,"useCollection"),[{Provider:i,Slot:h,ItemSlot:v},{createCollectionScope:t,useCollection:I,useInitCollection:g}]}y(tt,"createCollection");function _e(n,o){if(n===o)return!0;if(typeof n!="object"||typeof o!="object"||n==null||o==null)return!1;const e=Object.keys(n),t=Object.keys(o);if(e.length!==t.length)return!1;for(const r of e)if(!Object.prototype.hasOwnProperty.call(o,r)||n[r]!==o[r])return!1;return!0}y(_e,"shallowEqual");function Pe(n,o){return!!(o.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING)}y(Pe,"isElementPreceding");function X(n,o){return!n[1].element||!o[1].element?0:Pe(n[1].element,o[1].element)?-1:1}y(X,"sortByDocumentPosition");function Se(n){return new MutationObserver(e=>{for(const t of e)if(t.type==="childList"){n();return}})}y(Se,"getChildListObserver");var ot=Object.defineProperty,nt=(n,o)=>ot(n,"name",{value:o,configurable:!0}),st=l.createContext(void 0);function Oe(n){const o=l.useContext(st);return n||o||"ltr"}nt(Oe,"useDirection");var rt=Object.defineProperty,L=(n,o)=>rt(n,"name",{value:o,configurable:!0}),ne="Collapsible",[ct,Ee]=K(ne),[it,se]=ct(ne),lt=l.forwardRef(L(function(o,e){const{__scopeCollapsible:t,open:r,defaultOpen:s,disabled:i,onOpenChange:d,...f}=o,[p,a]=te({prop:r,defaultProp:s??!1,onChange:d,caller:ne});return c.jsx(it,{scope:t,disabled:i,contentId:Re(),open:p,onOpenToggle:l.useCallback(()=>a(h=>!h),[a]),children:c.jsx($.div,{"data-state":q(p),"data-disabled":i?"":void 0,...f,ref:e})})},"Collapsible")),at="CollapsibleTrigger",dt=l.forwardRef(L(function(o,e){const{__scopeCollapsible:t,...r}=o,s=se(at,t);return c.jsx($.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":q(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:we(o.onClick,s.onOpenToggle)})},"CollapsibleTrigger")),Me="CollapsibleContent",ut=l.forwardRef(L(function(o,e){const{forceMount:t,...r}=o,s=se(Me,o.__scopeCollapsible);return c.jsx(Ye,{present:t||s.open,children:({present:i})=>c.jsx(ft,{...r,ref:e,present:i})})},"CollapsibleContent")),ft=l.forwardRef(L(function(o,e){const{__scopeCollapsible:t,present:r,children:s,...i}=o,d=se(Me,t),[f,p]=l.useState(r),a=l.useRef(null),h=T(e,a),x=l.useRef(0),j=x.current,C=l.useRef(0),v=C.current,g=d.open||f,I=l.useRef(g),A=l.useRef(void 0);return l.useEffect(()=>{const u=requestAnimationFrame(()=>I.current=!1);return()=>cancelAnimationFrame(u)},[]),Je(()=>{const u=a.current;if(u){A.current=A.current||{transitionDuration:u.style.transitionDuration,animationName:u.style.animationName},u.style.transitionDuration="0s",u.style.animationName="none";const m=u.getBoundingClientRect();x.current=m.height,C.current=m.width,I.current||(u.style.transitionDuration=A.current.transitionDuration,u.style.animationName=A.current.animationName),p(r)}},[d.open,r]),c.jsx($.div,{"data-state":q(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!g,...i,ref:h,style:{"--radix-collapsible-content-height":j?`${j}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...o.style},children:g&&s})},"CollapsibleContentImpl"));function q(n){return n?"open":"closed"}L(q,"getState");var pt=lt,ht=dt,mt=ut,xt=Object.defineProperty,S=(n,o)=>xt(n,"name",{value:o,configurable:!0}),k="Accordion",gt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[re,Ct,vt]=je(k),[H,qt]=K(k,[vt,Ee]),ce=Ee(),bt=l.forwardRef(S(function(o,e){const{type:t,...r}=o,s=r,i=r;return c.jsx(re.Provider,{scope:o.__scopeAccordion,children:t==="multiple"?c.jsx(wt,{...i,ref:e}):c.jsx(At,{...s,ref:e})})},"Accordion")),[ke,yt]=H(k),[Te,It]=H(k,{collapsible:!1}),At=l.forwardRef(S(function(o,e){const{value:t,defaultValue:r,onValueChange:s=S(()=>{},"onValueChange"),collapsible:i=!1,...d}=o,[f,p]=te({prop:t,defaultProp:r??"",onChange:s,caller:k});return c.jsx(ke,{scope:o.__scopeAccordion,value:l.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:l.useCallback(()=>i&&p(""),[i,p]),children:c.jsx(Te,{scope:o.__scopeAccordion,collapsible:i,children:c.jsx(De,{...d,ref:e})})})},"AccordionImplSingle")),wt=l.forwardRef(S(function(o,e){const{value:t,defaultValue:r,onValueChange:s=S(()=>{},"onValueChange"),...i}=o,[d,f]=te({prop:t,defaultProp:r??[],onChange:s,caller:k}),p=l.useCallback(h=>f((x=[])=>[...x,h]),[f]),a=l.useCallback(h=>f((x=[])=>x.filter(j=>j!==h)),[f]);return c.jsx(ke,{scope:o.__scopeAccordion,value:d,onItemOpen:p,onItemClose:a,children:c.jsx(Te,{scope:o.__scopeAccordion,collapsible:!0,children:c.jsx(De,{...i,ref:e})})})},"AccordionImplMultiple")),[Rt,B]=H(k),De=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,disabled:r,dir:s,orientation:i="vertical",...d}=o,f=l.useRef(null),p=T(f,e),a=Ct(t),x=Oe(s)==="ltr",j=we(o.onKeyDown,C=>{if(!gt.includes(C.key))return;const v=C.target,g=a().filter(w=>!w.ref.current?.disabled),I=g.findIndex(w=>w.ref.current===v),A=g.length;if(I===-1)return;C.preventDefault();let u=I;const m=0,O=A-1,N=S(()=>{u=I+1,u>O&&(u=m)},"moveNext"),_=S(()=>{u=I-1,u<m&&(u=O)},"movePrev");switch(C.key){case"Home":u=m;break;case"End":u=O;break;case"ArrowRight":i==="horizontal"&&(x?N():_());break;case"ArrowDown":i==="vertical"&&N();break;case"ArrowLeft":i==="horizontal"&&(x?_():N());break;case"ArrowUp":i==="vertical"&&_();break}const E=u%A;g[E].ref.current?.focus()});return c.jsx(Rt,{scope:t,disabled:r,direction:s,orientation:i,children:c.jsx(re.Slot,{scope:t,children:c.jsx($.div,{...d,"data-orientation":i,ref:p,onKeyDown:r?void 0:j})})})},"AccordionImpl")),Z="AccordionItem",[jt,ie]=H(Z),Nt=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,value:r,...s}=o,i=B(Z,t),d=yt(Z,t),f=ce(t),p=Re(),a=r&&d.value.includes(r)||!1,h=i.disabled||o.disabled;return c.jsx(jt,{scope:t,open:a,disabled:h,triggerId:p,children:c.jsx(pt,{"data-orientation":i.orientation,"data-state":le(a),...f,...s,ref:e,disabled:h,open:a,onOpenChange:x=>{x?d.onItemOpen(r):d.onItemClose(r)}})})},"AccordionItem")),_t="AccordionHeader",Pt=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,...r}=o,s=B(k,t),i=ie(_t,t);return c.jsx($.h3,{"data-orientation":s.orientation,"data-state":le(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:e})},"AccordionHeader")),Ie="AccordionTrigger",St=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,...r}=o,s=B(k,t),i=ie(Ie,t),d=It(Ie,t),f=ce(t);return c.jsx(re.ItemSlot,{scope:t,children:c.jsx(ht,{"aria-disabled":i.open&&!d.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...f,...r,ref:e})})},"AccordionTrigger")),Ot="AccordionContent",Et=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,...r}=o,s=B(k,t),i=ie(Ot,t),d=ce(t);return c.jsx(mt,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...d,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...o.style}})},"AccordionContent"));function le(n){return n?"open":"closed"}S(le,"getState");var Mt=bt,kt=Nt,Tt=Pt,$e=St,Le=Et,ze=Mt,ae=l.forwardRef(({className:n,...o},e)=>c.jsx(kt,{ref:e,className:ee("cds-border-b cds-border-border",n),...o}));ae.displayName="AccordionItem";var de=l.forwardRef(({className:n,children:o,...e},t)=>c.jsx(Tt,{className:"cds-flex",children:c.jsxs($e,{ref:t,className:ee("cds-flex cds-flex-1 cds-items-center cds-justify-between cds-py-4 cds-text-left cds-font-medium cds-text-fg cds-transition-all hover:cds-underline focus-visible:cds-outline-none focus-visible:cds-ring-2 focus-visible:cds-ring-ring [&[data-state=open]>svg]:cds-rotate-180",n),...e,children:[o,c.jsx(Qe,{className:"cds-h-4 cds-w-4 cds-shrink-0 cds-text-fg-muted cds-transition-transform cds-duration-200"})]})}));de.displayName=$e.displayName;var ue=l.forwardRef(({className:n,children:o,...e},t)=>c.jsx(Le,{ref:t,className:"cds-overflow-hidden cds-text-sm cds-text-fg data-[state=closed]:cds-animate-accordion-up data-[state=open]:cds-animate-accordion-down",...e,children:c.jsx("div",{className:ee("cds-pb-4 cds-pt-0",n),children:o})}));ue.displayName=Le.displayName;var Dt=He({GroupEntries:()=>he,ReviewEditButton:()=>Ve,ReviewPanel:()=>Ke,RowList:()=>F,sectionClass:()=>fe,sectionHeadingClass:()=>pe}),fe="cds-mb-4 cds-rounded-xl cds-border cds-border-border cds-bg-surface-elevated cds-p-4",pe="cds-text-sm cds-font-bold cds-uppercase cds-tracking-wide cds-text-fg",$t=n=>{let o=n.label.replace(/s$/i,"").toLowerCase();return`${n.entries.length} ${n.entries.length===1?o:`${o}s`}`},F=({rows:n})=>c.jsx("dl",{className:"cds-space-y-1 cds-text-sm",children:n.map(o=>c.jsxs("div",{className:"cds-flex cds-justify-between cds-gap-4",children:[c.jsx("dt",{className:"cds-min-w-0 cds-flex-1 cds-text-fg-muted",children:o.label}),c.jsx("dd",{"data-credify-redact":!0,className:"cds-max-w-[55%] cds-text-right cds-font-semibold cds-text-fg",children:o.value})]},o.key))}),Ve=({label:n,onClick:o})=>c.jsxs("button",{type:"button",onClick:o,"aria-label":`Edit ${n}`,className:`cds-inline-flex cds-items-center cds-gap-1 cds-rounded cds-px-2 cds-py-1 cds-text-xs cds-font-semibold cds-text-fg hover:cds-bg-highlight ${Ae}`,children:[c.jsx(Ze,{"aria-hidden":"true",className:"cds-h-3.5 cds-w-3.5"}),"Edit"]}),Ke=({stages:n,questionsByStage:o,values:e,busy:t,error:r,suppressedKeys:s,onEditStage:i,onConfirm:d})=>{let f=n.map(a=>{let h=o[a]??[];return{stage:a,rows:We({questions:h,values:e,stageKey:a,suppressedKeys:s}),groups:Ue({questions:h,values:e,stageKey:a,suppressedKeys:s}),validation:Ge({questions:h,values:e,stageKey:a})}}),p=f.filter(a=>!a.validation.isValid);return c.jsxs("div",{className:"cds-py-2",children:[c.jsx("h2",{className:"cds-mb-1 cds-text-2xl cds-font-bold cds-text-fg",children:"Review your answers"}),c.jsx("p",{className:"cds-mb-5 cds-text-sm cds-text-fg-muted",children:"Carriers price from exactly this — a quick check now avoids surprises later."}),p.length?c.jsxs("div",{className:"cds-mb-5 cds-rounded-xl cds-border cds-border-warning cds-bg-warning-surface cds-p-4",children:[c.jsxs("h3",{className:"cds-mb-2 cds-text-sm cds-font-bold cds-text-fg",children:[p.length===1?"One section needs":`${p.length} sections need`," attention"]}),c.jsx("ul",{className:"cds-space-y-1 cds-text-sm cds-text-fg-muted",children:p.map(a=>c.jsxs("li",{children:[c.jsx("button",{type:"button",onClick:()=>i(a.stage),className:`cds-font-semibold cds-text-fg cds-underline ${Ae}`,children:be(a.stage).short}),": ",a.validation.issues[0],a.validation.issues.length>1?` (+${a.validation.issues.length-1} more)`:""]},a.stage))})]}):null,f.filter(a=>a.rows.length>0||a.groups.length>0).map(a=>{let h=be(a.stage).short;return c.jsxs("section",{className:fe,children:[c.jsxs("div",{className:"cds-mb-2 cds-flex cds-items-center cds-justify-between",children:[c.jsx("h3",{className:pe,children:h}),c.jsx(Ve,{label:h,onClick:()=>i(a.stage)})]}),a.rows.length?c.jsx(F,{rows:a.rows}):null,a.groups.map(x=>c.jsx(he,{group:x},x.groupKey))]},a.stage)}),c.jsx(Be,{message:r}),c.jsx(Fe,{disabled:p.length>0,busy:t,onChoose:d}),c.jsx("p",{className:"cds-mt-3 cds-text-xs cds-text-fg-muted",children:"Either choice takes you to your quotes. Submitting runs a soft credit inquiry with the carriers you authorized. It does not affect your credit score."})]})},he=({group:n})=>n.entries.length?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"cds-mb-1 cds-text-sm cds-text-fg-muted",children:$t(n)}),c.jsx(ze,{type:"multiple",children:n.entries.map((o,e)=>c.jsxs(ae,{value:`${n.groupKey}-${e}`,className:"cds-border-border last:cds-border-b-0",children:[c.jsx(de,{className:"cds-py-2 cds-text-sm cds-font-semibold cds-text-fg hover:cds-no-underline",children:o.name}),c.jsx(ue,{className:"cds-pb-3 cds-pt-0",children:c.jsx(F,{rows:o.rows})})]},`${n.groupKey}-${e}`))})]}):c.jsxs("p",{className:"cds-text-sm cds-text-fg-muted",children:["No ",n.label.toLowerCase()," added yet."]});const Ht=Object.freeze(Object.defineProperty({__proto__:null,a:fe,c:ue,i:Dt,l:ae,n:Ke,o:pe,r:F,s:ze,t:he,u:de},Symbol.toStringTag,{value:"Module"}));export{he as D,Ze as P,pe as S,Ht as r,F as w,fe as x};
6
+ */const Qe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ze=qe("pencil",Qe);var et=Object.defineProperty,y=(n,o)=>et(n,"name",{value:o,configurable:!0});function je(n){const o=n+"CollectionProvider",[e,t]=K(o),[r,s]=e(o,{collectionRef:{current:null},itemMap:new Map}),i=y(v=>{const{scope:g,children:I}=v,A=l.useRef(null),u=l.useRef(new Map).current;return c.jsx(r,{scope:g,itemMap:u,collectionRef:A,children:I})},"CollectionProvider");i.displayName=o;const d=n+"CollectionSlot",f=V(d),p=l.forwardRef((v,g)=>{const{scope:I,children:A}=v,u=s(d,I),m=T(g,u.collectionRef);return c.jsx(f,{ref:m,children:A})});p.displayName=d;const a=n+"CollectionItemSlot",h="data-radix-collection-item",x=V(a),j=l.forwardRef((v,g)=>{const{scope:I,children:A,...u}=v,m=l.useRef(null),O=T(g,m),N=s(a,I);return l.useEffect(()=>(N.itemMap.set(m,{ref:m,...u}),()=>void N.itemMap.delete(m))),c.jsx(x,{[h]:"",ref:O,children:A})});j.displayName=a;function C(v){const g=s(n+"CollectionConsumer",v);return l.useCallback(()=>{const A=g.collectionRef.current;if(!A)return[];const u=Array.from(A.querySelectorAll(`[${h}]`));return Array.from(g.itemMap.values()).sort((N,_)=>u.indexOf(N.ref.current)-u.indexOf(_.ref.current))},[g.collectionRef,g.itemMap])}return y(C,"useCollection"),[{Provider:i,Slot:p,ItemSlot:j},C,t]}y(je,"createCollection");var ye=new WeakMap,b,P,J=(P=class extends Map{constructor(e){super(e);ve(this,b);Y(this,b,[...super.keys()]),ye.set(this,!0)}set(e,t){return ye.get(this)&&(this.has(e)?w(this,b)[w(this,b).indexOf(e)]=e:w(this,b).push(e)),super.set(e,t),this}insert(e,t,r){const s=this.has(t),i=w(this,b).length,d=oe(e);let f=d>=0?d:i+d;const p=f<0||f>=i?-1:f;if(p===this.size||s&&p===this.size-1||p===-1)return this.set(t,r),this;const a=this.size+(s?0:1);d<0&&f++;const h=[...w(this,b)];let x,j=!1;for(let C=f;C<a;C++)if(f===C){let v=h[C];h[C]===t&&(v=h[C+1]),s&&this.delete(t),x=this.get(v),this.set(t,r)}else{!j&&h[C-1]===t&&(j=!0);const v=h[j?C:C-1],g=x;x=this.get(v),this.delete(v),this.set(v,g)}return this}with(e,t,r){const s=new P(this);return s.insert(e,t,r),s}before(e){const t=w(this,b).indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){const s=w(this,b).indexOf(e);return s===-1?this:this.insert(s,t,r)}after(e){let t=w(this,b).indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,r){const s=w(this,b).indexOf(e);return s===-1?this:this.insert(s+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Y(this,b,[]),super.clear()}delete(e){const t=super.delete(e);return t&&w(this,b).splice(w(this,b).indexOf(e),1),t}deleteAt(e){const t=this.keyAt(e);return t!==void 0?this.delete(t):!1}at(e){const t=z(w(this,b),e);if(t!==void 0)return this.get(t)}entryAt(e){const t=z(w(this,b),e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return w(this,b).indexOf(e)}keyAt(e){return z(w(this,b),e)}from(e,t){const r=this.indexOf(e);if(r===-1)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(e,t){const r=this.indexOf(e);if(r===-1)return;let s=r+t;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(e,t){let r=0;for(const s of this){if(Reflect.apply(e,t,[s,r,this]))return s;r++}}findIndex(e,t){let r=0;for(const s of this){if(Reflect.apply(e,t,[s,r,this]))return r;r++}return-1}filter(e,t){const r=[];let s=0;for(const i of this)Reflect.apply(e,t,[i,s,this])&&r.push(i),s++;return new P(r)}map(e,t){const r=[];let s=0;for(const i of this)r.push([i[0],Reflect.apply(e,t,[i,s,this])]),s++;return new P(r)}reduce(...e){const[t,r]=e;let s=0,i=r??this.at(0);for(const d of this)s===0&&e.length===1?i=d:i=Reflect.apply(t,this,[i,d,s,this]),s++;return i}reduceRight(...e){const[t,r]=e;let s=r??this.at(-1);for(let i=this.size-1;i>=0;i--){const d=this.at(i);i===this.size-1&&e.length===1?s=d:s=Reflect.apply(t,this,[s,d,i,this])}return s}toSorted(e){const t=[...this.entries()].sort(e);return new P(t)}toReversed(){const e=new P;for(let t=this.size-1;t>=0;t--){const r=this.keyAt(t),s=this.get(r);e.set(r,s)}return e}toSpliced(...e){const t=[...this.entries()];return t.splice(...e),new P(t)}slice(e,t){const r=new P;let s=this.size-1;if(e===void 0)return r;e<0&&(e=e+this.size),t!==void 0&&t>0&&(s=t-1);for(let i=e;i<=s;i++){const d=this.keyAt(i),f=this.get(d);r.set(d,f)}return r}every(e,t){let r=0;for(const s of this){if(!Reflect.apply(e,t,[s,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(const s of this){if(Reflect.apply(e,t,[s,r,this]))return!0;r++}return!1}},b=new WeakMap,y(P,"OrderedDict"),P);function z(n,o){if("at"in Array.prototype)return Array.prototype.at.call(n,o);const e=Ne(n,o);return e===-1?void 0:n[e]}y(z,"at");function Ne(n,o){const e=n.length,t=oe(o),r=t>=0?t:e+t;return r<0||r>=e?-1:r}y(Ne,"toSafeIndex");function oe(n){return n!==n||n===0?0:Math.trunc(n)}y(oe,"toSafeInteger");function tt(n){const o=n+"CollectionProvider",[e,t]=K(o),[r,s]=e(o,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new J,setItemMap:y(()=>{},"setItemMap")}),i=y(({state:u,...m})=>u?c.jsx(f,{...m,state:u}):c.jsx(d,{...m}),"CollectionProvider");i.displayName=o;const d=y(u=>{const m=g();return c.jsx(f,{...u,state:m})},"CollectionInit");d.displayName=o+"Init";const f=y(u=>{const{scope:m,children:O,state:N}=u,_=l.useRef(null),[E,R]=l.useState(null),G=T(_,R),[U,W]=N;return l.useEffect(()=>{if(!E)return;const D=Se(()=>{});return D.observe(E,{childList:!0,subtree:!0}),()=>{D.disconnect()}},[E]),c.jsx(r,{scope:m,itemMap:U,setItemMap:W,collectionRef:G,collectionRefObject:_,collectionElement:E,children:O})},"CollectionProviderImpl");f.displayName=o+"Impl";const p=n+"CollectionSlot",a=V(p),h=l.forwardRef((u,m)=>{const{scope:O,children:N}=u,_=s(p,O),E=T(m,_.collectionRef);return c.jsx(a,{ref:E,children:N})});h.displayName=p;const x=n+"CollectionItemSlot",j="data-radix-collection-item",C=V(x),v=l.forwardRef((u,m)=>{const{scope:O,children:N,..._}=u,E=l.useRef(null),[R,G]=l.useState(null),U=T(m,E,G),W=s(x,O),{setItemMap:D}=W,X=l.useRef(_);_e(X.current,_)||(X.current=_);const me=X.current;return l.useEffect(()=>{const xe=me;return D(M=>R?M.has(R)?M.set(R,{...xe,element:R}).toSorted(Q):(M.set(R,{...xe,element:R}),M.toSorted(Q)):M),()=>{D(M=>!R||!M.has(R)?M:(M.delete(R),new J(M)))}},[R,me,D]),c.jsx(C,{[j]:"",ref:U,children:N})});v.displayName=x;function g(){return l.useState(new J)}y(g,"useInitCollection");function I(u){const{itemMap:m}=s(n+"CollectionConsumer",u);return m}return y(I,"useCollection"),[{Provider:i,Slot:h,ItemSlot:v},{createCollectionScope:t,useCollection:I,useInitCollection:g}]}y(tt,"createCollection");function _e(n,o){if(n===o)return!0;if(typeof n!="object"||typeof o!="object"||n==null||o==null)return!1;const e=Object.keys(n),t=Object.keys(o);if(e.length!==t.length)return!1;for(const r of e)if(!Object.prototype.hasOwnProperty.call(o,r)||n[r]!==o[r])return!1;return!0}y(_e,"shallowEqual");function Pe(n,o){return!!(o.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING)}y(Pe,"isElementPreceding");function Q(n,o){return!n[1].element||!o[1].element?0:Pe(n[1].element,o[1].element)?-1:1}y(Q,"sortByDocumentPosition");function Se(n){return new MutationObserver(e=>{for(const t of e)if(t.type==="childList"){n();return}})}y(Se,"getChildListObserver");var ot=Object.defineProperty,nt=(n,o)=>ot(n,"name",{value:o,configurable:!0}),st=l.createContext(void 0);function Oe(n){const o=l.useContext(st);return n||o||"ltr"}nt(Oe,"useDirection");var rt=Object.defineProperty,L=(n,o)=>rt(n,"name",{value:o,configurable:!0}),ne="Collapsible",[ct,Ee]=K(ne),[it,se]=ct(ne),lt=l.forwardRef(L(function(o,e){const{__scopeCollapsible:t,open:r,defaultOpen:s,disabled:i,onOpenChange:d,...f}=o,[p,a]=te({prop:r,defaultProp:s??!1,onChange:d,caller:ne});return c.jsx(it,{scope:t,disabled:i,contentId:we(),open:p,onOpenToggle:l.useCallback(()=>a(h=>!h),[a]),children:c.jsx($.div,{"data-state":q(p),"data-disabled":i?"":void 0,...f,ref:e})})},"Collapsible")),at="CollapsibleTrigger",dt=l.forwardRef(L(function(o,e){const{__scopeCollapsible:t,...r}=o,s=se(at,t);return c.jsx($.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":q(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:Re(o.onClick,s.onOpenToggle)})},"CollapsibleTrigger")),Me="CollapsibleContent",ut=l.forwardRef(L(function(o,e){const{forceMount:t,...r}=o,s=se(Me,o.__scopeCollapsible);return c.jsx(Xe,{present:t||s.open,children:({present:i})=>c.jsx(ft,{...r,ref:e,present:i})})},"CollapsibleContent")),ft=l.forwardRef(L(function(o,e){const{__scopeCollapsible:t,present:r,children:s,...i}=o,d=se(Me,t),[f,p]=l.useState(r),a=l.useRef(null),h=T(e,a),x=l.useRef(0),j=x.current,C=l.useRef(0),v=C.current,g=d.open||f,I=l.useRef(g),A=l.useRef(void 0);return l.useEffect(()=>{const u=requestAnimationFrame(()=>I.current=!1);return()=>cancelAnimationFrame(u)},[]),Ye(()=>{const u=a.current;if(u){A.current=A.current||{transitionDuration:u.style.transitionDuration,animationName:u.style.animationName},u.style.transitionDuration="0s",u.style.animationName="none";const m=u.getBoundingClientRect();x.current=m.height,C.current=m.width,I.current||(u.style.transitionDuration=A.current.transitionDuration,u.style.animationName=A.current.animationName),p(r)}},[d.open,r]),c.jsx($.div,{"data-state":q(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!g,...i,ref:h,style:{"--radix-collapsible-content-height":j?`${j}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...o.style},children:g&&s})},"CollapsibleContentImpl"));function q(n){return n?"open":"closed"}L(q,"getState");var pt=lt,ht=dt,mt=ut,xt=Object.defineProperty,S=(n,o)=>xt(n,"name",{value:o,configurable:!0}),k="Accordion",gt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[re,Ct,vt]=je(k),[H,qt]=K(k,[vt,Ee]),ce=Ee(),bt=l.forwardRef(S(function(o,e){const{type:t,...r}=o,s=r,i=r;return c.jsx(re.Provider,{scope:o.__scopeAccordion,children:t==="multiple"?c.jsx(Rt,{...i,ref:e}):c.jsx(At,{...s,ref:e})})},"Accordion")),[ke,yt]=H(k),[Te,It]=H(k,{collapsible:!1}),At=l.forwardRef(S(function(o,e){const{value:t,defaultValue:r,onValueChange:s=S(()=>{},"onValueChange"),collapsible:i=!1,...d}=o,[f,p]=te({prop:t,defaultProp:r??"",onChange:s,caller:k});return c.jsx(ke,{scope:o.__scopeAccordion,value:l.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:l.useCallback(()=>i&&p(""),[i,p]),children:c.jsx(Te,{scope:o.__scopeAccordion,collapsible:i,children:c.jsx(De,{...d,ref:e})})})},"AccordionImplSingle")),Rt=l.forwardRef(S(function(o,e){const{value:t,defaultValue:r,onValueChange:s=S(()=>{},"onValueChange"),...i}=o,[d,f]=te({prop:t,defaultProp:r??[],onChange:s,caller:k}),p=l.useCallback(h=>f((x=[])=>[...x,h]),[f]),a=l.useCallback(h=>f((x=[])=>x.filter(j=>j!==h)),[f]);return c.jsx(ke,{scope:o.__scopeAccordion,value:d,onItemOpen:p,onItemClose:a,children:c.jsx(Te,{scope:o.__scopeAccordion,collapsible:!0,children:c.jsx(De,{...i,ref:e})})})},"AccordionImplMultiple")),[wt,B]=H(k),De=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,disabled:r,dir:s,orientation:i="vertical",...d}=o,f=l.useRef(null),p=T(f,e),a=Ct(t),x=Oe(s)==="ltr",j=Re(o.onKeyDown,C=>{if(!gt.includes(C.key))return;const v=C.target,g=a().filter(R=>!R.ref.current?.disabled),I=g.findIndex(R=>R.ref.current===v),A=g.length;if(I===-1)return;C.preventDefault();let u=I;const m=0,O=A-1,N=S(()=>{u=I+1,u>O&&(u=m)},"moveNext"),_=S(()=>{u=I-1,u<m&&(u=O)},"movePrev");switch(C.key){case"Home":u=m;break;case"End":u=O;break;case"ArrowRight":i==="horizontal"&&(x?N():_());break;case"ArrowDown":i==="vertical"&&N();break;case"ArrowLeft":i==="horizontal"&&(x?_():N());break;case"ArrowUp":i==="vertical"&&_();break}const E=u%A;g[E].ref.current?.focus()});return c.jsx(wt,{scope:t,disabled:r,direction:s,orientation:i,children:c.jsx(re.Slot,{scope:t,children:c.jsx($.div,{...d,"data-orientation":i,ref:p,onKeyDown:r?void 0:j})})})},"AccordionImpl")),Z="AccordionItem",[jt,ie]=H(Z),Nt=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,value:r,...s}=o,i=B(Z,t),d=yt(Z,t),f=ce(t),p=we(),a=r&&d.value.includes(r)||!1,h=i.disabled||o.disabled;return c.jsx(jt,{scope:t,open:a,disabled:h,triggerId:p,children:c.jsx(pt,{"data-orientation":i.orientation,"data-state":le(a),...f,...s,ref:e,disabled:h,open:a,onOpenChange:x=>{x?d.onItemOpen(r):d.onItemClose(r)}})})},"AccordionItem")),_t="AccordionHeader",Pt=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,...r}=o,s=B(k,t),i=ie(_t,t);return c.jsx($.h3,{"data-orientation":s.orientation,"data-state":le(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:e})},"AccordionHeader")),Ie="AccordionTrigger",St=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,...r}=o,s=B(k,t),i=ie(Ie,t),d=It(Ie,t),f=ce(t);return c.jsx(re.ItemSlot,{scope:t,children:c.jsx(ht,{"aria-disabled":i.open&&!d.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...f,...r,ref:e})})},"AccordionTrigger")),Ot="AccordionContent",Et=l.forwardRef(S(function(o,e){const{__scopeAccordion:t,...r}=o,s=B(k,t),i=ie(Ot,t),d=ce(t);return c.jsx(mt,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...d,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...o.style}})},"AccordionContent"));function le(n){return n?"open":"closed"}S(le,"getState");var Mt=bt,kt=Nt,Tt=Pt,$e=St,Le=Et,ze=Mt,ae=l.forwardRef(({className:n,...o},e)=>c.jsx(kt,{ref:e,className:ee("cds-border-b cds-border-border",n),...o}));ae.displayName="AccordionItem";var de=l.forwardRef(({className:n,children:o,...e},t)=>c.jsx(Tt,{className:"cds-flex",children:c.jsxs($e,{ref:t,className:ee("cds-flex cds-flex-1 cds-items-center cds-justify-between cds-py-4 cds-text-left cds-font-medium cds-text-fg cds-transition-all hover:cds-underline focus-visible:cds-outline-none focus-visible:cds-ring-2 focus-visible:cds-ring-ring [&[data-state=open]>svg]:cds-rotate-180",n),...e,children:[o,c.jsx(Je,{className:"cds-h-4 cds-w-4 cds-shrink-0 cds-text-fg-muted cds-transition-transform cds-duration-200"})]})}));de.displayName=$e.displayName;var ue=l.forwardRef(({className:n,children:o,...e},t)=>c.jsx(Le,{ref:t,className:"cds-overflow-hidden cds-text-sm cds-text-fg data-[state=closed]:cds-animate-accordion-up data-[state=open]:cds-animate-accordion-down",...e,children:c.jsx("div",{className:ee("cds-pb-4 cds-pt-0",n),children:o})}));ue.displayName=Le.displayName;var Dt=He({GroupEntries:()=>he,ReviewEditButton:()=>Ve,ReviewPanel:()=>Ke,RowList:()=>F,sectionClass:()=>fe,sectionHeadingClass:()=>pe}),fe="cds-mb-4 cds-rounded-xl cds-border cds-border-border cds-bg-surface-elevated cds-p-4",pe="cds-text-sm cds-font-bold cds-uppercase cds-tracking-wide cds-text-fg",$t=n=>{let o=n.label.replace(/s$/i,"").toLowerCase();return`${n.entries.length} ${n.entries.length===1?o:`${o}s`}`},F=({rows:n})=>c.jsx("dl",{className:"cds-space-y-1 cds-text-sm",children:n.map(o=>c.jsxs("div",{className:"cds-flex cds-justify-between cds-gap-4",children:[c.jsx("dt",{className:"cds-min-w-0 cds-flex-1 cds-text-fg-muted",children:o.label}),c.jsx("dd",{"data-credify-redact":!0,className:"cds-max-w-[55%] cds-text-right cds-font-semibold cds-text-fg",children:o.value})]},o.key))}),Ve=({label:n,onClick:o})=>c.jsxs("button",{type:"button",onClick:o,"aria-label":`Edit ${n}`,className:`cds-inline-flex cds-items-center cds-gap-1 cds-rounded cds-px-2 cds-py-1 cds-text-xs cds-font-semibold cds-text-fg hover:cds-bg-highlight ${Ae}`,children:[c.jsx(Ze,{"aria-hidden":"true",className:"cds-h-3.5 cds-w-3.5"}),"Edit"]}),Ke=({stages:n,questionsByStage:o,values:e,busy:t,error:r,suppressedKeys:s,onEditStage:i,onConfirm:d})=>{let f=n.map(a=>{let h=o[a]??[];return{stage:a,rows:We({questions:h,values:e,stageKey:a,suppressedKeys:s}),groups:Ue({questions:h,values:e,stageKey:a,suppressedKeys:s}),validation:Ge({questions:h,values:e,stageKey:a})}}),p=f.filter(a=>!a.validation.isValid);return c.jsxs("div",{className:"cds-py-2",children:[c.jsx("h2",{className:"cds-mb-1 cds-text-2xl cds-font-bold cds-text-fg",children:"Review your answers"}),c.jsx("p",{className:"cds-mb-5 cds-text-sm cds-text-fg-muted",children:"Carriers price from exactly this — a quick check now avoids surprises later."}),p.length?c.jsxs("div",{className:"cds-mb-5 cds-rounded-xl cds-border cds-border-warning cds-bg-warning-surface cds-p-4",children:[c.jsxs("h3",{className:"cds-mb-2 cds-text-sm cds-font-bold cds-text-fg",children:[p.length===1?"One section needs":`${p.length} sections need`," attention"]}),c.jsx("ul",{className:"cds-space-y-1 cds-text-sm cds-text-fg-muted",children:p.map(a=>c.jsxs("li",{children:[c.jsx("button",{type:"button",onClick:()=>i(a.stage),className:`cds-font-semibold cds-text-fg cds-underline ${Ae}`,children:be(a.stage).short}),": ",a.validation.issues[0],a.validation.issues.length>1?` (+${a.validation.issues.length-1} more)`:""]},a.stage))})]}):null,f.filter(a=>a.rows.length>0||a.groups.length>0).map(a=>{let h=be(a.stage).short;return c.jsxs("section",{className:fe,children:[c.jsxs("div",{className:"cds-mb-2 cds-flex cds-items-center cds-justify-between",children:[c.jsx("h3",{className:pe,children:h}),c.jsx(Ve,{label:h,onClick:()=>i(a.stage)})]}),a.rows.length?c.jsx(F,{rows:a.rows}):null,a.groups.map(x=>c.jsx(he,{group:x},x.groupKey))]},a.stage)}),c.jsx(Be,{message:r}),c.jsx(Fe,{disabled:p.length>0,busy:t,onChoose:d}),c.jsx("p",{className:"cds-mt-3 cds-text-xs cds-text-fg-muted",children:"Either choice takes you to your quotes. Submitting runs a soft credit inquiry with the carriers you authorized. It does not affect your credit score."})]})},he=({group:n})=>n.entries.length?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"cds-mb-1 cds-text-sm cds-text-fg-muted",children:$t(n)}),c.jsx(ze,{type:"multiple",children:n.entries.map((o,e)=>c.jsxs(ae,{value:`${n.groupKey}-${e}`,className:"cds-border-border last:cds-border-b-0",children:[c.jsx(de,{className:"cds-py-2 cds-text-sm cds-font-semibold cds-text-fg hover:cds-no-underline",children:o.name}),c.jsx(ue,{className:"cds-pb-3 cds-pt-0",children:c.jsx(F,{rows:o.rows})})]},`${n.groupKey}-${e}`))})]}):c.jsxs("p",{className:"cds-text-sm cds-text-fg-muted",children:["No ",n.label.toLowerCase()," added yet."]});const Ht=Object.freeze(Object.defineProperty({__proto__:null,a:fe,c:ue,i:Dt,l:ae,n:Ke,o:pe,r:F,s:ze,t:he,u:de},Symbol.toStringTag,{value:"Module"}));export{he as D,Ze as P,pe as S,Ht as r,F as w,fe as x};
@@ -1 +1 @@
1
- import{t as O,i as V,k as x,H as D,u as F}from"./iframe-BImWklE9.js";import{t as q,n as g}from"./types-LUGvo5ic-CB-wcgK3.js";import{k as d,j as f,n as L,u as P,c as R,d as U,A as j}from"./visibility-hEdBjgi7-_AUGO8E2.js";import{k as A}from"./validation-DRqHT-u7-pY2KjHw4.js";import{t as $,l as Y,a as H,o as Q,i as K,f as I,n as M,r as B}from"./vehicleCoverage-BPJaWQyg-DBJ_jL3e.js";var C=new Set(["sale_price_cents","dwelling_replacement_cost","other_structures_coverage","personal_property_coverage","loss_of_use_coverage","custom_equipment_value_cents","cost_new_value_cents","stated_value_amount_cents","property_damage_amount_paid_cents","personal_injury_amount_paid_cents","auto_current_annual_premium_cents","amount_paid_cents"]),W=new Set(["total_area_sq_ft","annual_mileage","miles_to_work","distance_to_coast_miles"]),G=s=>C.has(s),Z=s=>C.has(s)||W.has(s),z=(s,e)=>{let r=String(s??"").replace(/\D/g,"");if(!r)return"";let t=Number(r);if(!Number.isFinite(t))return"";let o=t.toLocaleString("en-US");return e?`$${o}`:o},pe=O({STAGES_BY_PRODUCT:()=>F,ZIP_FIRST_PAINT_CACHE_KEY:()=>D,ZIP_FIRST_PAINT_QUESTIONS:()=>x,itemScope:()=>w,reviewGroupsForStage:()=>le,reviewRowsForStage:()=>oe,stageSlice:()=>te,validateStage:()=>se}),J=["ssn_display"],w=(s,e)=>{let r={...s,...e};for(let t of J)t in e||delete r[t];return r},X=(s,e,r)=>{let t=w(s,e);for(let o of r)o.key in e?t[o.key]=e[o.key]:delete t[o.key];return t},ee={vehicles:"Vehicle",drivers:"Driver",driver_accidents:"Accident",driver_violations:"Violation",losses:"Loss",home_losses:"Loss"},h=s=>ee[s]??"Entry",b=(s,e,r,t)=>{let o=(l,i)=>{l.forEach(a=>{let u=P(a);if(u){let n=R(a)||i[a.key]===u.conditionalValue;t(a.key,u.conditionalQuestions??[],n)}U(a,i).forEach(n=>{n.conditionalQuestionsAllowMultiple||o(n.conditionalQuestions??[],i)})})};o(L(s),e)},se=({questions:s,values:e,stageKey:r})=>{let t=d(s,e,r),o=A(t,e),l=[],i=[];for(let[a,u]of Object.entries(o)){let n=t.find(c=>c.key===a);i.push(`${n?.question??a}: ${u}`)}if(b(s,e,r,(a,u,n)=>{if(!n)return;let c=f(e,a);if(!c.length){i.push(`Add at least one ${h(a).toLowerCase()}.`),o[g(a)]=`Add at least one ${h(a).toLowerCase()}.`;return}c.forEach((y,p)=>{let _=j(u,y,e,r,p),N=A(_,X(e,y,_)),m={};for(let k of _){let v=N[k.key];v&&(m[k.key]=v,i.push(`${h(a)} ${p+1} — ${k.question}: ${v}`))}Object.keys(m).length&&l.push({groupKey:a,index:p,errorsByKey:m})})}),t.some(a=>a.key==="vehicle_policy_selections")){let a=f(e,"vehicles"),u=new Map;for(let y of Y(a))u.set(y.index,{...y.errorsByKey}),i.push(`Vehicle ${y.index+1} — coverage selections are incomplete.`);let n=H(e),c=f(e,"drivers").length;a.forEach((y,p)=>{let _=Q(n,p,c);_&&(u.set(p,{...u.get(p)??{},[$]:_}),i.push(`Vehicle ${p+1} — ${_}`))});for(let[y,p]of u)l.push({groupKey:"vehicles",index:y,errorsByKey:p})}return{errorsByKey:o,itemErrors:l,issues:i,isValid:Object.keys(o).length===0&&l.length===0}},E=s=>Object.values(s).every(e=>e==null||String(e).trim()===""),te=(s,e,r)=>{let t={};for(let l of d(s,e,r))l.key in e&&(t[l.key]=e[l.key]);b(s,e,r,(l,i,a)=>{let u=g(l);if(!a||!(u in e))return;let n=f(e,l),c=n.filter(y=>!E(y));!c.length&&n.length||(t[u]=c,t[l]=e[l]??"Yes")});let o=g("vehicles");return d(s,e,r).some(l=>l.key==="vehicle_policy_selections")&&o in e&&!(o in t)&&(t[o]=f(e,"vehicles").filter(l=>!E(l)),t.vehicles=e.vehicles??"Yes","driver_vehicle_assignments"in e&&(t[$]=e[$])),t},re=(s,e)=>[s.first_name,s.last_name].map(r=>String(r??"").trim()).filter(Boolean).join(" ")||`Driver ${e+1}`,ie=(s,e,r)=>s==="vehicles"?I(e,r):s==="drivers"?re(e,r):`${h(s)} ${r+1}`,le=({questions:s,values:e,stageKey:r,suppressedKeys:t})=>{let o=[];return b(s,e,r,(l,i,a)=>{if(!a)return;let u=f(e,l).map((n,c)=>{let y=w(e,n),p=j(i,n,e,r,c);return{name:ie(l,n,c),rows:p.filter(_=>!_.key.endsWith(q)).filter(_=>!t?.has(_.key)).map(_=>({key:`${l}__${c}__${_.key}`,label:_.question,value:S(_,n[_.key],y)}))}});o.push({groupKey:l,label:l.replace(/_/g," ").replace(/^./,n=>n.toUpperCase()),entries:u})}),o},T=s=>{let e=String(s??"").replace(/\D/g,"");return e.length>=4?e.slice(-4):null},S=(s,e,r)=>{if(s.key==="social_security_number"){let t=T(e)??T(r.ssn_display);return t?`•••–••–${t}`:"—"}return e==null||e===""?"—":e===!0?"Yes":e===!1?"No":Array.isArray(e)?`${e.length} added`:s.inputType==="select"||s.inputType==="radio"?V(s.key,String(e)):s.inputType==="number"&&Z(s.key)&&z(e,G(s.key))||String(e)},ae=s=>({question:B[s],key:s,required:!0,inputType:"select"}),oe=({questions:s,values:e,stageKey:r,suppressedKeys:t})=>{let o=d(s,e,r),l=o.filter(i=>!i.key.endsWith(q)).filter(i=>i.key!==K).filter(i=>!t?.has(i.key)).map(i=>({key:i.key,label:i.question,value:S(i,e[i.key],e)}));return o.some(i=>i.key==="vehicle_policy_selections")&&f(e,"vehicles").forEach((i,a)=>{let u=I(i,a);for(let n of M)l.push({key:`${K}__${a}__${n}`,label:`${u} — ${B[n]}`,value:S(ae(n),i[n],e)})}),l};export{pe as a,W as c,Z as d,te as i,z as l,le as n,se as o,oe as r,C as s,w as t,G as u};
1
+ import{t as O,e as V,u as x,B as D,i as F}from"./iframe-Chy4dD4i.js";import{t as q,n as g}from"./types-LUGvo5ic-CB-wcgK3.js";import{k as d,j as f,n as L,u as P,c as R,d as U,A as j}from"./visibility-CKRGC3Il-DVTBboJH.js";import{k as A}from"./validation-D42QXxck-DJUS31-5.js";import{t as $,l as Y,a as Q,o as M,i as K,f as B,n as W,r as I}from"./vehicleCoverage-CBWORI1l-Bs6c4Xhh.js";var C=new Set(["sale_price_cents","dwelling_replacement_cost","other_structures_coverage","personal_property_coverage","loss_of_use_coverage","custom_equipment_value_cents","cost_new_value_cents","stated_value_amount_cents","property_damage_amount_paid_cents","personal_injury_amount_paid_cents","auto_current_annual_premium_cents","amount_paid_cents"]),G=new Set(["total_area_sq_ft","annual_mileage","miles_to_work","distance_to_coast_miles"]),H=s=>C.has(s),Z=s=>C.has(s)||G.has(s),z=(s,e)=>{let r=String(s??"").replace(/\D/g,"");if(!r)return"";let t=Number(r);if(!Number.isFinite(t))return"";let o=t.toLocaleString("en-US");return e?`$${o}`:o},pe=O({STAGES_BY_PRODUCT:()=>F,ZIP_FIRST_PAINT_CACHE_KEY:()=>D,ZIP_FIRST_PAINT_QUESTIONS:()=>x,itemScope:()=>w,reviewGroupsForStage:()=>le,reviewRowsForStage:()=>oe,stageSlice:()=>te,validateStage:()=>se}),J=["ssn_display"],w=(s,e)=>{let r={...s,...e};for(let t of J)t in e||delete r[t];return r},X=(s,e,r)=>{let t=w(s,e);for(let o of r)o.key in e?t[o.key]=e[o.key]:delete t[o.key];return t},ee={vehicles:"Vehicle",drivers:"Driver",driver_accidents:"Accident",driver_violations:"Violation",losses:"Loss",home_losses:"Loss"},h=s=>ee[s]??"Entry",b=(s,e,r,t)=>{let o=(l,i)=>{l.forEach(a=>{let u=P(a);if(u){let n=R(a)||i[a.key]===u.conditionalValue;t(a.key,u.conditionalQuestions??[],n)}U(a,i).forEach(n=>{n.conditionalQuestionsAllowMultiple||o(n.conditionalQuestions??[],i)})})};o(L(s),e)},se=({questions:s,values:e,stageKey:r})=>{let t=d(s,e,r),o=A(t,e),l=[],i=[];for(let[a,u]of Object.entries(o)){let n=t.find(c=>c.key===a);i.push(`${n?.question??a}: ${u}`)}if(b(s,e,r,(a,u,n)=>{if(!n)return;let c=f(e,a);if(!c.length){i.push(`Add at least one ${h(a).toLowerCase()}.`),o[g(a)]=`Add at least one ${h(a).toLowerCase()}.`;return}c.forEach((y,p)=>{let _=j(u,y,e,r,p),N=A(_,X(e,y,_)),m={};for(let v of _){let k=N[v.key];k&&(m[v.key]=k,i.push(`${h(a)} ${p+1} — ${v.question}: ${k}`))}Object.keys(m).length&&l.push({groupKey:a,index:p,errorsByKey:m})})}),t.some(a=>a.key==="vehicle_policy_selections")){let a=f(e,"vehicles"),u=new Map;for(let y of Y(a))u.set(y.index,{...y.errorsByKey}),i.push(`Vehicle ${y.index+1} — coverage selections are incomplete.`);let n=Q(e),c=f(e,"drivers").length;a.forEach((y,p)=>{let _=M(n,p,c);_&&(u.set(p,{...u.get(p)??{},[$]:_}),i.push(`Vehicle ${p+1} — ${_}`))});for(let[y,p]of u)l.push({groupKey:"vehicles",index:y,errorsByKey:p})}return{errorsByKey:o,itemErrors:l,issues:i,isValid:Object.keys(o).length===0&&l.length===0}},E=s=>Object.values(s).every(e=>e==null||String(e).trim()===""),te=(s,e,r)=>{let t={};for(let l of d(s,e,r))l.key in e&&(t[l.key]=e[l.key]);b(s,e,r,(l,i,a)=>{let u=g(l);if(!a||!(u in e))return;let n=f(e,l),c=n.filter(y=>!E(y));!c.length&&n.length||(t[u]=c,t[l]=e[l]??"Yes")});let o=g("vehicles");return d(s,e,r).some(l=>l.key==="vehicle_policy_selections")&&o in e&&!(o in t)&&(t[o]=f(e,"vehicles").filter(l=>!E(l)),t.vehicles=e.vehicles??"Yes","driver_vehicle_assignments"in e&&(t[$]=e[$])),t},re=(s,e)=>[s.first_name,s.last_name].map(r=>String(r??"").trim()).filter(Boolean).join(" ")||`Driver ${e+1}`,ie=(s,e,r)=>s==="vehicles"?B(e,r):s==="drivers"?re(e,r):`${h(s)} ${r+1}`,le=({questions:s,values:e,stageKey:r,suppressedKeys:t})=>{let o=[];return b(s,e,r,(l,i,a)=>{if(!a)return;let u=f(e,l).map((n,c)=>{let y=w(e,n),p=j(i,n,e,r,c);return{name:ie(l,n,c),rows:p.filter(_=>!_.key.endsWith(q)).filter(_=>!t?.has(_.key)).map(_=>({key:`${l}__${c}__${_.key}`,label:_.question,value:S(_,n[_.key],y)}))}});o.push({groupKey:l,label:l.replace(/_/g," ").replace(/^./,n=>n.toUpperCase()),entries:u})}),o},T=s=>{let e=String(s??"").replace(/\D/g,"");return e.length>=4?e.slice(-4):null},S=(s,e,r)=>{if(s.key==="social_security_number"){let t=T(e)??T(r.ssn_display);return t?`•••–••–${t}`:"—"}return e==null||e===""?"—":e===!0?"Yes":e===!1?"No":Array.isArray(e)?`${e.length} added`:s.inputType==="select"||s.inputType==="radio"?V(s.key,String(e)):s.inputType==="number"&&Z(s.key)&&z(e,H(s.key))||String(e)},ae=s=>({question:I[s],key:s,required:!0,inputType:"select"}),oe=({questions:s,values:e,stageKey:r,suppressedKeys:t})=>{let o=d(s,e,r),l=o.filter(i=>!i.key.endsWith(q)).filter(i=>i.key!==K).filter(i=>!t?.has(i.key)).map(i=>({key:i.key,label:i.question,value:S(i,e[i.key],e)}));return o.some(i=>i.key==="vehicle_policy_selections")&&f(e,"vehicles").forEach((i,a)=>{let u=B(i,a);for(let n of W)l.push({key:`${K}__${a}__${n}`,label:`${u} — ${I[n]}`,value:S(ae(n),i[n],e)})}),l};export{pe as a,G as c,Z as d,te as i,z as l,le as n,se as o,oe as r,C as s,w as t,H as u};