@getcredify/credify-insurance-widget 1.30.3 → 1.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credify-insurance-widget.css +1 -1
- package/dist/iframe/assets/iframe-DazTp2lf.css +1 -0
- package/dist/iframe/assets/{iframe-BFQadK_h.js → iframe-ptnr6BX-.js} +3 -3
- package/dist/iframe/assets/iframe-ptnr6BX-.js.map +1 -0
- package/dist/iframe/iframe.html +2 -2
- package/dist/index.es.js +2225 -2200
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +18 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/iframe/assets/iframe-BFQadK_h.js.map +0 -1
- package/dist/iframe/assets/iframe-DQ1Cy_my.css +0 -1
|
@@ -107,7 +107,7 @@ Url: ${kl(t)}`),!0)}function G1(t,n){return t.type||!n||!n.length?!1:q1(t).some(
|
|
|
107
107
|
`)}w.write("payload.value = newResult;"),w.write("return payload;");const se=w.compile();return(W,oe)=>se(N,W,oe)};let f;const d=jl,m=!V0.jitless,h=m&&dO.value,v=n.catchall;let b;t._zod.parse=(N,w)=>{b??(b=o.value);const D=N.value;return d(D)?m&&h&&w?.async===!1&&w.jitless!==!0?(f||(f=l(n.shape)),N=f(N,w),v?fv([],D,N,w,b,t):N):a(N,w):(N.issues.push({expected:"object",code:"invalid_type",input:D,inst:t}),N)}});function Jg(t,n,a,o){for(const f of t)if(f.issues.length===0)return n.value=f.value,n;const l=t.filter(f=>!Ci(f));return l.length===1?(n.value=l[0].value,l[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:a,errors:t.map(f=>f.issues.map(d=>wa(d,o,Na())))}),n)}const JN=P("$ZodUnion",(t,n)=>{dt.init(t,n),Ke(t._zod,"optin",()=>n.options.some(l=>l._zod.optin==="optional")?"optional":void 0),Ke(t._zod,"optout",()=>n.options.some(l=>l._zod.optout==="optional")?"optional":void 0),Ke(t._zod,"values",()=>{if(n.options.every(l=>l._zod.values))return new Set(n.options.flatMap(l=>Array.from(l._zod.values)))}),Ke(t._zod,"pattern",()=>{if(n.options.every(l=>l._zod.pattern)){const l=n.options.map(f=>f._zod.pattern);return new RegExp(`^(${l.map(f=>Yd(f.source)).join("|")})$`)}});const a=n.options.length===1,o=n.options[0]._zod.run;t._zod.parse=(l,f)=>{if(a)return o(l,f);let d=!1;const m=[];for(const _ of n.options){const h=_._zod.run({value:l.value,issues:[]},f);if(h instanceof Promise)m.push(h),d=!0;else{if(h.issues.length===0)return h;m.push(h)}}return d?Promise.all(m).then(_=>Jg(_,l,t,f)):Jg(m,l,t,f)}}),ew=P("$ZodIntersection",(t,n)=>{dt.init(t,n),t._zod.parse=(a,o)=>{const l=a.value,f=n.left._zod.run({value:l,issues:[]},o),d=n.right._zod.run({value:l,issues:[]},o);return f instanceof Promise||d instanceof Promise?Promise.all([f,d]).then(([_,h])=>ey(a,_,h)):ey(a,f,d)}});function fd(t,n){if(t===n)return{valid:!0,data:t};if(t instanceof Date&&n instanceof Date&&+t==+n)return{valid:!0,data:t};if($o(t)&&$o(n)){const a=Object.keys(n),o=Object.keys(t).filter(f=>a.indexOf(f)!==-1),l={...t,...n};for(const f of o){const d=fd(t[f],n[f]);if(!d.valid)return{valid:!1,mergeErrorPath:[f,...d.mergeErrorPath]};l[f]=d.data}return{valid:!0,data:l}}if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let o=0;o<t.length;o++){const l=t[o],f=n[o],d=fd(l,f);if(!d.valid)return{valid:!1,mergeErrorPath:[o,...d.mergeErrorPath]};a.push(d.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}function ey(t,n,a){const o=new Map;let l;for(const m of n.issues)if(m.code==="unrecognized_keys"){l??(l=m);for(const _ of m.keys)o.has(_)||o.set(_,{}),o.get(_).l=!0}else t.issues.push(m);for(const m of a.issues)if(m.code==="unrecognized_keys")for(const _ of m.keys)o.has(_)||o.set(_,{}),o.get(_).r=!0;else t.issues.push(m);const f=[...o].filter(([,m])=>m.l&&m.r).map(([m])=>m);if(f.length&&l&&t.issues.push({...l,keys:f}),Ci(t))return t;const d=fd(n.value,a.value);if(!d.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(d.mergeErrorPath)}`);return t.value=d.data,t}const tw=P("$ZodEnum",(t,n)=>{dt.init(t,n);const a=K0(n.entries),o=new Set(a);t._zod.values=o,t._zod.pattern=new RegExp(`^(${a.filter(l=>mO.has(typeof l)).map(l=>typeof l=="string"?ki(l):l.toString()).join("|")})$`),t._zod.parse=(l,f)=>{const d=l.value;return o.has(d)||l.issues.push({code:"invalid_value",values:a,input:d,inst:t}),l}}),nw=P("$ZodLiteral",(t,n)=>{if(dt.init(t,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");const a=new Set(n.values);t._zod.values=a,t._zod.pattern=new RegExp(`^(${n.values.map(o=>typeof o=="string"?ki(o):o?ki(o.toString()):String(o)).join("|")})$`),t._zod.parse=(o,l)=>{const f=o.value;return a.has(f)||o.issues.push({code:"invalid_value",values:n.values,input:f,inst:t}),o}}),rw=P("$ZodTransform",(t,n)=>{dt.init(t,n),t._zod.parse=(a,o)=>{if(o.direction==="backward")throw new q0(t.constructor.name);const l=n.transform(a.value,a);if(o.async)return(l instanceof Promise?l:Promise.resolve(l)).then(d=>(a.value=d,a));if(l instanceof Promise)throw new Ni;return a.value=l,a}});function ty(t,n){return t.issues.length&&n===void 0?{issues:[],value:void 0}:t}const dv=P("$ZodOptional",(t,n)=>{dt.init(t,n),t._zod.optin="optional",t._zod.optout="optional",Ke(t._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),Ke(t._zod,"pattern",()=>{const a=n.innerType._zod.pattern;return a?new RegExp(`^(${Yd(a.source)})?$`):void 0}),t._zod.parse=(a,o)=>{if(n.innerType._zod.optin==="optional"){const l=n.innerType._zod.run(a,o);return l instanceof Promise?l.then(f=>ty(f,a.value)):ty(l,a.value)}return a.value===void 0?a:n.innerType._zod.run(a,o)}}),aw=P("$ZodExactOptional",(t,n)=>{dv.init(t,n),Ke(t._zod,"values",()=>n.innerType._zod.values),Ke(t._zod,"pattern",()=>n.innerType._zod.pattern),t._zod.parse=(a,o)=>n.innerType._zod.run(a,o)}),iw=P("$ZodNullable",(t,n)=>{dt.init(t,n),Ke(t._zod,"optin",()=>n.innerType._zod.optin),Ke(t._zod,"optout",()=>n.innerType._zod.optout),Ke(t._zod,"pattern",()=>{const a=n.innerType._zod.pattern;return a?new RegExp(`^(${Yd(a.source)}|null)$`):void 0}),Ke(t._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),t._zod.parse=(a,o)=>a.value===null?a:n.innerType._zod.run(a,o)}),ow=P("$ZodDefault",(t,n)=>{dt.init(t,n),t._zod.optin="optional",Ke(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(a,o)=>{if(o.direction==="backward")return n.innerType._zod.run(a,o);if(a.value===void 0)return a.value=n.defaultValue,a;const l=n.innerType._zod.run(a,o);return l instanceof Promise?l.then(f=>ny(f,n)):ny(l,n)}});function ny(t,n){return t.value===void 0&&(t.value=n.defaultValue),t}const sw=P("$ZodPrefault",(t,n)=>{dt.init(t,n),t._zod.optin="optional",Ke(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(a,o)=>(o.direction==="backward"||a.value===void 0&&(a.value=n.defaultValue),n.innerType._zod.run(a,o))}),lw=P("$ZodNonOptional",(t,n)=>{dt.init(t,n),Ke(t._zod,"values",()=>{const a=n.innerType._zod.values;return a?new Set([...a].filter(o=>o!==void 0)):void 0}),t._zod.parse=(a,o)=>{const l=n.innerType._zod.run(a,o);return l instanceof Promise?l.then(f=>ry(f,t)):ry(l,t)}});function ry(t,n){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:n}),t}const cw=P("$ZodCatch",(t,n)=>{dt.init(t,n),Ke(t._zod,"optin",()=>n.innerType._zod.optin),Ke(t._zod,"optout",()=>n.innerType._zod.optout),Ke(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(a,o)=>{if(o.direction==="backward")return n.innerType._zod.run(a,o);const l=n.innerType._zod.run(a,o);return l instanceof Promise?l.then(f=>(a.value=f.value,f.issues.length&&(a.value=n.catchValue({...a,error:{issues:f.issues.map(d=>wa(d,o,Na()))},input:a.value}),a.issues=[]),a)):(a.value=l.value,l.issues.length&&(a.value=n.catchValue({...a,error:{issues:l.issues.map(f=>wa(f,o,Na()))},input:a.value}),a.issues=[]),a)}}),uw=P("$ZodPipe",(t,n)=>{dt.init(t,n),Ke(t._zod,"values",()=>n.in._zod.values),Ke(t._zod,"optin",()=>n.in._zod.optin),Ke(t._zod,"optout",()=>n.out._zod.optout),Ke(t._zod,"propValues",()=>n.in._zod.propValues),t._zod.parse=(a,o)=>{if(o.direction==="backward"){const f=n.out._zod.run(a,o);return f instanceof Promise?f.then(d=>gl(d,n.in,o)):gl(f,n.in,o)}const l=n.in._zod.run(a,o);return l instanceof Promise?l.then(f=>gl(f,n.out,o)):gl(l,n.out,o)}});function gl(t,n,a){return t.issues.length?(t.aborted=!0,t):n._zod.run({value:t.value,issues:t.issues},a)}const fw=P("$ZodReadonly",(t,n)=>{dt.init(t,n),Ke(t._zod,"propValues",()=>n.innerType._zod.propValues),Ke(t._zod,"values",()=>n.innerType._zod.values),Ke(t._zod,"optin",()=>n.innerType?._zod?.optin),Ke(t._zod,"optout",()=>n.innerType?._zod?.optout),t._zod.parse=(a,o)=>{if(o.direction==="backward")return n.innerType._zod.run(a,o);const l=n.innerType._zod.run(a,o);return l instanceof Promise?l.then(ay):ay(l)}});function ay(t){return t.value=Object.freeze(t.value),t}const dw=P("$ZodCustom",(t,n)=>{on.init(t,n),dt.init(t,n),t._zod.parse=(a,o)=>a,t._zod.check=a=>{const o=a.value,l=n.fn(o);if(l instanceof Promise)return l.then(f=>iy(f,a,o,t));iy(l,a,o,t)}});function iy(t,n,a,o){if(!t){const l={code:"custom",input:a,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(l.params=o._zod.def.params),n.issues.push(Fo(l))}}var oy;class mw{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...a){const o=a[0];return this._map.set(n,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const a=this._map.get(n);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(n),this}get(n){const a=n._zod.parent;if(a){const o={...this.get(a)??{}};delete o.id;const l={...o,...this._map.get(n)};return Object.keys(l).length?l:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function pw(){return new mw}(oy=globalThis).__zod_globalRegistry??(oy.__zod_globalRegistry=pw());const Bo=globalThis.__zod_globalRegistry;function _w(t,n){return new t({type:"string",...pe(n)})}function hw(t,n){return new t({type:"string",format:"email",check:"string_format",abort:!1,...pe(n)})}function sy(t,n){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...pe(n)})}function gw(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...pe(n)})}function yw(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...pe(n)})}function vw(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...pe(n)})}function bw(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...pe(n)})}function Sw(t,n){return new t({type:"string",format:"url",check:"string_format",abort:!1,...pe(n)})}function Ew(t,n){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...pe(n)})}function Aw(t,n){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...pe(n)})}function Tw(t,n){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...pe(n)})}function Cw(t,n){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...pe(n)})}function Ow(t,n){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...pe(n)})}function Nw(t,n){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...pe(n)})}function ww(t,n){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...pe(n)})}function Mw(t,n){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...pe(n)})}function xw(t,n){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...pe(n)})}function Dw(t,n){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...pe(n)})}function Rw(t,n){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...pe(n)})}function Lw(t,n){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...pe(n)})}function kw(t,n){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...pe(n)})}function zw(t,n){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...pe(n)})}function jw(t,n){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...pe(n)})}function Bw(t,n){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...pe(n)})}function Iw(t,n){return new t({type:"string",format:"date",check:"string_format",...pe(n)})}function Uw(t,n){return new t({type:"string",format:"time",check:"string_format",precision:null,...pe(n)})}function Hw(t,n){return new t({type:"string",format:"duration",check:"string_format",...pe(n)})}function $w(t,n){return new t({type:"number",coerce:!0,checks:[],...pe(n)})}function Fw(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...pe(n)})}function Gw(t,n){return new t({type:"boolean",...pe(n)})}function Yw(t){return new t({type:"unknown"})}function Zw(t,n){return new t({type:"never",...pe(n)})}function ly(t,n){return new ov({check:"less_than",...pe(n),value:t,inclusive:!1})}function zf(t,n){return new ov({check:"less_than",...pe(n),value:t,inclusive:!0})}function cy(t,n){return new sv({check:"greater_than",...pe(n),value:t,inclusive:!1})}function jf(t,n){return new sv({check:"greater_than",...pe(n),value:t,inclusive:!0})}function uy(t,n){return new sN({check:"multiple_of",...pe(n),value:t})}function mv(t,n){return new cN({check:"max_length",...pe(n),maximum:t})}function Il(t,n){return new uN({check:"min_length",...pe(n),minimum:t})}function pv(t,n){return new fN({check:"length_equals",...pe(n),length:t})}function Pw(t,n){return new dN({check:"string_format",format:"regex",...pe(n),pattern:t})}function qw(t){return new mN({check:"string_format",format:"lowercase",...pe(t)})}function Vw(t){return new pN({check:"string_format",format:"uppercase",...pe(t)})}function Kw(t,n){return new _N({check:"string_format",format:"includes",...pe(n),includes:t})}function Qw(t,n){return new hN({check:"string_format",format:"starts_with",...pe(n),prefix:t})}function Xw(t,n){return new gN({check:"string_format",format:"ends_with",...pe(n),suffix:t})}function Bi(t){return new yN({check:"overwrite",tx:t})}function Ww(t){return Bi(n=>n.normalize(t))}function Jw(){return Bi(t=>t.trim())}function eM(){return Bi(t=>t.toLowerCase())}function tM(){return Bi(t=>t.toUpperCase())}function nM(){return Bi(t=>fO(t))}function rM(t,n,a){return new t({type:"array",element:n,...pe(a)})}function aM(t,n,a){return new t({type:"custom",check:"custom",fn:n,...pe(a)})}function iM(t){const n=oM(a=>(a.addIssue=o=>{if(typeof o=="string")a.issues.push(Fo(o,a.value,n._zod.def));else{const l=o;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=a.value),l.inst??(l.inst=n),l.continue??(l.continue=!n._zod.def.abort),a.issues.push(Fo(l))}},t(a.value,a)));return n}function oM(t,n){const a=new on({check:"custom",...pe(n)});return a._zod.check=t,a}function _v(t){let n=t?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Bo,target:n,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function Ut(t,n,a={path:[],schemaPath:[]}){var o;const l=t._zod.def,f=n.seen.get(t);if(f)return f.count++,a.schemaPath.includes(t)&&(f.cycle=a.path),f.schema;const d={schema:{},count:1,cycle:void 0,path:a.path};n.seen.set(t,d);const m=t._zod.toJSONSchema?.();if(m)d.schema=m;else{const v={...a,schemaPath:[...a.schemaPath,t],path:a.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(n,d.schema,v);else{const N=d.schema,w=n.processors[l.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);w(t,n,N,v)}const b=t._zod.parent;b&&(d.ref||(d.ref=b),Ut(b,n,v),n.seen.get(b).isParent=!0)}const _=n.metadataRegistry.get(t);return _&&Object.assign(d.schema,_),n.io==="input"&&Vt(t)&&(delete d.schema.examples,delete d.schema.default),n.io==="input"&&d.schema._prefault&&((o=d.schema).default??(o.default=d.schema._prefault)),delete d.schema._prefault,n.seen.get(t).schema}function hv(t,n){const a=t.seen.get(n);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const d of t.seen.entries()){const m=t.metadataRegistry.get(d[0])?.id;if(m){const _=o.get(m);if(_&&_!==d[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(m,d[0])}}const l=d=>{const m=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const b=t.external.registry.get(d[0])?.id,N=t.external.uri??(D=>D);if(b)return{ref:N(b)};const w=d[1].defId??d[1].schema.id??`schema${t.counter++}`;return d[1].defId=w,{defId:w,ref:`${N("__shared")}#/${m}/${w}`}}if(d[1]===a)return{ref:"#"};const h=`#/${m}/`,v=d[1].schema.id??`__schema${t.counter++}`;return{defId:v,ref:h+v}},f=d=>{if(d[1].schema.$ref)return;const m=d[1],{ref:_,defId:h}=l(d);m.def={...m.schema},h&&(m.defId=h);const v=m.schema;for(const b in v)delete v[b];v.$ref=_};if(t.cycles==="throw")for(const d of t.seen.entries()){const m=d[1];if(m.cycle)throw new Error(`Cycle detected: #/${m.cycle?.join("/")}/<root>
|
|
108
108
|
|
|
109
109
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of t.seen.entries()){const m=d[1];if(n===d[0]){f(d);continue}if(t.external){const h=t.external.registry.get(d[0])?.id;if(n!==d[0]&&h){f(d);continue}}if(t.metadataRegistry.get(d[0])?.id){f(d);continue}if(m.cycle){f(d);continue}if(m.count>1&&t.reused==="ref"){f(d);continue}}}function gv(t,n){const a=t.seen.get(n);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=d=>{const m=t.seen.get(d);if(m.ref===null)return;const _=m.def??m.schema,h={..._},v=m.ref;if(m.ref=null,v){o(v);const N=t.seen.get(v),w=N.schema;if(w.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(_.allOf=_.allOf??[],_.allOf.push(w)):Object.assign(_,w),Object.assign(_,h),d._zod.parent===v)for(const k in _)k==="$ref"||k==="allOf"||k in h||delete _[k];if(w.$ref&&N.def)for(const k in _)k==="$ref"||k==="allOf"||k in N.def&&JSON.stringify(_[k])===JSON.stringify(N.def[k])&&delete _[k]}const b=d._zod.parent;if(b&&b!==v){o(b);const N=t.seen.get(b);if(N?.schema.$ref&&(_.$ref=N.schema.$ref,N.def))for(const w in _)w==="$ref"||w==="allOf"||w in N.def&&JSON.stringify(_[w])===JSON.stringify(N.def[w])&&delete _[w]}t.override({zodSchema:d,jsonSchema:_,path:m.path??[]})};for(const d of[...t.seen.entries()].reverse())o(d[0]);const l={};if(t.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const d=t.external.registry.get(n)?.id;if(!d)throw new Error("Schema is missing an `id` property");l.$id=t.external.uri(d)}Object.assign(l,a.def??a.schema);const f=t.external?.defs??{};for(const d of t.seen.entries()){const m=d[1];m.def&&m.defId&&(f[m.defId]=m.def)}t.external||Object.keys(f).length>0&&(t.target==="draft-2020-12"?l.$defs=f:l.definitions=f);try{const d=JSON.parse(JSON.stringify(l));return Object.defineProperty(d,"~standard",{value:{...n["~standard"],jsonSchema:{input:Ul(n,"input",t.processors),output:Ul(n,"output",t.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function Vt(t,n){const a=n??{seen:new Set};if(a.seen.has(t))return!1;a.seen.add(t);const o=t._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Vt(o.element,a);if(o.type==="set")return Vt(o.valueType,a);if(o.type==="lazy")return Vt(o.getter(),a);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Vt(o.innerType,a);if(o.type==="intersection")return Vt(o.left,a)||Vt(o.right,a);if(o.type==="record"||o.type==="map")return Vt(o.keyType,a)||Vt(o.valueType,a);if(o.type==="pipe")return Vt(o.in,a)||Vt(o.out,a);if(o.type==="object"){for(const l in o.shape)if(Vt(o.shape[l],a))return!0;return!1}if(o.type==="union"){for(const l of o.options)if(Vt(l,a))return!0;return!1}if(o.type==="tuple"){for(const l of o.items)if(Vt(l,a))return!0;return!!(o.rest&&Vt(o.rest,a))}return!1}const sM=(t,n={})=>a=>{const o=_v({...a,processors:n});return Ut(t,o),hv(o,t),gv(o,t)},Ul=(t,n,a={})=>o=>{const{libraryOptions:l,target:f}=o??{},d=_v({...l??{},target:f,io:n,processors:a});return Ut(t,d),hv(d,t),gv(d,t)},lM={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},cM=(t,n,a,o)=>{const l=a;l.type="string";const{minimum:f,maximum:d,format:m,patterns:_,contentEncoding:h}=t._zod.bag;if(typeof f=="number"&&(l.minLength=f),typeof d=="number"&&(l.maxLength=d),m&&(l.format=lM[m]??m,l.format===""&&delete l.format,m==="time"&&delete l.format),h&&(l.contentEncoding=h),_&&_.size>0){const v=[..._];v.length===1?l.pattern=v[0].source:v.length>1&&(l.allOf=[...v.map(b=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}},uM=(t,n,a,o)=>{const l=a,{minimum:f,maximum:d,format:m,multipleOf:_,exclusiveMaximum:h,exclusiveMinimum:v}=t._zod.bag;typeof m=="string"&&m.includes("int")?l.type="integer":l.type="number",typeof v=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(l.minimum=v,l.exclusiveMinimum=!0):l.exclusiveMinimum=v),typeof f=="number"&&(l.minimum=f,typeof v=="number"&&n.target!=="draft-04"&&(v>=f?delete l.minimum:delete l.exclusiveMinimum)),typeof h=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(l.maximum=h,l.exclusiveMaximum=!0):l.exclusiveMaximum=h),typeof d=="number"&&(l.maximum=d,typeof h=="number"&&n.target!=="draft-04"&&(h<=d?delete l.maximum:delete l.exclusiveMaximum)),typeof _=="number"&&(l.multipleOf=_)},fM=(t,n,a,o)=>{a.type="boolean"},dM=(t,n,a,o)=>{a.not={}},mM=(t,n,a,o)=>{},pM=(t,n,a,o)=>{const l=t._zod.def,f=K0(l.entries);f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),a.enum=f},_M=(t,n,a,o)=>{const l=t._zod.def,f=[];for(const d of l.values)if(d===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof d=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");f.push(Number(d))}else f.push(d);if(f.length!==0)if(f.length===1){const d=f[0];a.type=d===null?"null":typeof d,n.target==="draft-04"||n.target==="openapi-3.0"?a.enum=[d]:a.const=d}else f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),f.every(d=>typeof d=="boolean")&&(a.type="boolean"),f.every(d=>d===null)&&(a.type="null"),a.enum=f},hM=(t,n,a,o)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},gM=(t,n,a,o)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},yM=(t,n,a,o)=>{const l=a,f=t._zod.def,{minimum:d,maximum:m}=t._zod.bag;typeof d=="number"&&(l.minItems=d),typeof m=="number"&&(l.maxItems=m),l.type="array",l.items=Ut(f.element,n,{...o,path:[...o.path,"items"]})},vM=(t,n,a,o)=>{const l=a,f=t._zod.def;l.type="object",l.properties={};const d=f.shape;for(const h in d)l.properties[h]=Ut(d[h],n,{...o,path:[...o.path,"properties",h]});const m=new Set(Object.keys(d)),_=new Set([...m].filter(h=>{const v=f.shape[h]._zod;return n.io==="input"?v.optin===void 0:v.optout===void 0}));_.size>0&&(l.required=Array.from(_)),f.catchall?._zod.def.type==="never"?l.additionalProperties=!1:f.catchall?f.catchall&&(l.additionalProperties=Ut(f.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):n.io==="output"&&(l.additionalProperties=!1)},bM=(t,n,a,o)=>{const l=t._zod.def,f=l.inclusive===!1,d=l.options.map((m,_)=>Ut(m,n,{...o,path:[...o.path,f?"oneOf":"anyOf",_]}));f?a.oneOf=d:a.anyOf=d},SM=(t,n,a,o)=>{const l=t._zod.def,f=Ut(l.left,n,{...o,path:[...o.path,"allOf",0]}),d=Ut(l.right,n,{...o,path:[...o.path,"allOf",1]}),m=h=>"allOf"in h&&Object.keys(h).length===1,_=[...m(f)?f.allOf:[f],...m(d)?d.allOf:[d]];a.allOf=_},EM=(t,n,a,o)=>{const l=t._zod.def,f=Ut(l.innerType,n,o),d=n.seen.get(t);n.target==="openapi-3.0"?(d.ref=l.innerType,a.nullable=!0):a.anyOf=[f,{type:"null"}]},AM=(t,n,a,o)=>{const l=t._zod.def;Ut(l.innerType,n,o);const f=n.seen.get(t);f.ref=l.innerType},TM=(t,n,a,o)=>{const l=t._zod.def;Ut(l.innerType,n,o);const f=n.seen.get(t);f.ref=l.innerType,a.default=JSON.parse(JSON.stringify(l.defaultValue))},CM=(t,n,a,o)=>{const l=t._zod.def;Ut(l.innerType,n,o);const f=n.seen.get(t);f.ref=l.innerType,n.io==="input"&&(a._prefault=JSON.parse(JSON.stringify(l.defaultValue)))},OM=(t,n,a,o)=>{const l=t._zod.def;Ut(l.innerType,n,o);const f=n.seen.get(t);f.ref=l.innerType;let d;try{d=l.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}a.default=d},NM=(t,n,a,o)=>{const l=t._zod.def,f=n.io==="input"?l.in._zod.def.type==="transform"?l.out:l.in:l.out;Ut(f,n,o);const d=n.seen.get(t);d.ref=f},wM=(t,n,a,o)=>{const l=t._zod.def;Ut(l.innerType,n,o);const f=n.seen.get(t);f.ref=l.innerType,a.readOnly=!0},yv=(t,n,a,o)=>{const l=t._zod.def;Ut(l.innerType,n,o);const f=n.seen.get(t);f.ref=l.innerType},MM=P("ZodISODateTime",(t,n)=>{RN.init(t,n),ct.init(t,n)});function xM(t){return Bw(MM,t)}const DM=P("ZodISODate",(t,n)=>{LN.init(t,n),ct.init(t,n)});function RM(t){return Iw(DM,t)}const LM=P("ZodISOTime",(t,n)=>{kN.init(t,n),ct.init(t,n)});function kM(t){return Uw(LM,t)}const zM=P("ZodISODuration",(t,n)=>{zN.init(t,n),ct.init(t,n)});function jM(t){return Hw(zM,t)}const BM=(t,n)=>{ev.init(t,n),t.name="ZodError",Object.defineProperties(t,{format:{value:a=>TO(t,a)},flatten:{value:a=>AO(t,a)},addIssue:{value:a=>{t.issues.push(a),t.message=JSON.stringify(t.issues,ud,2)}},addIssues:{value:a=>{t.issues.push(...a),t.message=JSON.stringify(t.issues,ud,2)}},isEmpty:{get(){return t.issues.length===0}}})},kn=P("ZodError",BM,{Parent:Error}),IM=Pd(kn),UM=qd(kn),HM=tc(kn),$M=nc(kn),FM=NO(kn),GM=wO(kn),YM=MO(kn),ZM=xO(kn),PM=DO(kn),qM=RO(kn),VM=LO(kn),KM=kO(kn),mt=P("ZodType",(t,n)=>(dt.init(t,n),Object.assign(t["~standard"],{jsonSchema:{input:Ul(t,"input"),output:Ul(t,"output")}}),t.toJSONSchema=sM(t,{}),t.def=n,t.type=n.type,Object.defineProperty(t,"_def",{value:n}),t.check=(...a)=>t.clone(ta(n,{checks:[...n.checks??[],...a.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),t.with=t.check,t.clone=(a,o)=>na(t,a,o),t.brand=()=>t,t.register=((a,o)=>(a.add(t,o),t)),t.parse=(a,o)=>IM(t,a,o,{callee:t.parse}),t.safeParse=(a,o)=>HM(t,a,o),t.parseAsync=async(a,o)=>UM(t,a,o,{callee:t.parseAsync}),t.safeParseAsync=async(a,o)=>$M(t,a,o),t.spa=t.safeParseAsync,t.encode=(a,o)=>FM(t,a,o),t.decode=(a,o)=>GM(t,a,o),t.encodeAsync=async(a,o)=>YM(t,a,o),t.decodeAsync=async(a,o)=>ZM(t,a,o),t.safeEncode=(a,o)=>PM(t,a,o),t.safeDecode=(a,o)=>qM(t,a,o),t.safeEncodeAsync=async(a,o)=>VM(t,a,o),t.safeDecodeAsync=async(a,o)=>KM(t,a,o),t.refine=(a,o)=>t.check(Zx(a,o)),t.superRefine=a=>t.check(Px(a)),t.overwrite=a=>t.check(Bi(a)),t.optional=()=>py(t),t.exactOptional=()=>Rx(t),t.nullable=()=>_y(t),t.nullish=()=>py(_y(t)),t.nonoptional=a=>Ix(t,a),t.array=()=>Sx(t),t.or=a=>Sv([t,a]),t.and=a=>Ox(t,a),t.transform=a=>hy(t,xx(a)),t.default=a=>zx(t,a),t.prefault=a=>Bx(t,a),t.catch=a=>Hx(t,a),t.pipe=a=>hy(t,a),t.readonly=()=>Gx(t),t.describe=a=>{const o=t.clone();return Bo.add(o,{description:a}),o},Object.defineProperty(t,"description",{get(){return Bo.get(t)?.description},configurable:!0}),t.meta=(...a)=>{if(a.length===0)return Bo.get(t);const o=t.clone();return Bo.add(o,a[0]),o},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=a=>a(t),t)),vv=P("_ZodString",(t,n)=>{Vd.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(o,l,f)=>cM(t,o,l);const a=t._zod.bag;t.format=a.format??null,t.minLength=a.minimum??null,t.maxLength=a.maximum??null,t.regex=(...o)=>t.check(Pw(...o)),t.includes=(...o)=>t.check(Kw(...o)),t.startsWith=(...o)=>t.check(Qw(...o)),t.endsWith=(...o)=>t.check(Xw(...o)),t.min=(...o)=>t.check(Il(...o)),t.max=(...o)=>t.check(mv(...o)),t.length=(...o)=>t.check(pv(...o)),t.nonempty=(...o)=>t.check(Il(1,...o)),t.lowercase=o=>t.check(qw(o)),t.uppercase=o=>t.check(Vw(o)),t.trim=()=>t.check(Jw()),t.normalize=(...o)=>t.check(Ww(...o)),t.toLowerCase=()=>t.check(eM()),t.toUpperCase=()=>t.check(tM()),t.slugify=()=>t.check(nM())}),QM=P("ZodString",(t,n)=>{Vd.init(t,n),vv.init(t,n),t.email=a=>t.check(hw(XM,a)),t.url=a=>t.check(Sw(WM,a)),t.jwt=a=>t.check(jw(mx,a)),t.emoji=a=>t.check(Ew(JM,a)),t.guid=a=>t.check(sy(fy,a)),t.uuid=a=>t.check(gw(yl,a)),t.uuidv4=a=>t.check(yw(yl,a)),t.uuidv6=a=>t.check(vw(yl,a)),t.uuidv7=a=>t.check(bw(yl,a)),t.nanoid=a=>t.check(Aw(ex,a)),t.guid=a=>t.check(sy(fy,a)),t.cuid=a=>t.check(Tw(tx,a)),t.cuid2=a=>t.check(Cw(nx,a)),t.ulid=a=>t.check(Ow(rx,a)),t.base64=a=>t.check(Lw(ux,a)),t.base64url=a=>t.check(kw(fx,a)),t.xid=a=>t.check(Nw(ax,a)),t.ksuid=a=>t.check(ww(ix,a)),t.ipv4=a=>t.check(Mw(ox,a)),t.ipv6=a=>t.check(xw(sx,a)),t.cidrv4=a=>t.check(Dw(lx,a)),t.cidrv6=a=>t.check(Rw(cx,a)),t.e164=a=>t.check(zw(dx,a)),t.datetime=a=>t.check(xM(a)),t.date=a=>t.check(RM(a)),t.time=a=>t.check(kM(a)),t.duration=a=>t.check(jM(a))});function Pr(t){return _w(QM,t)}const ct=P("ZodStringFormat",(t,n)=>{st.init(t,n),vv.init(t,n)}),XM=P("ZodEmail",(t,n)=>{AN.init(t,n),ct.init(t,n)}),fy=P("ZodGUID",(t,n)=>{SN.init(t,n),ct.init(t,n)}),yl=P("ZodUUID",(t,n)=>{EN.init(t,n),ct.init(t,n)}),WM=P("ZodURL",(t,n)=>{TN.init(t,n),ct.init(t,n)}),JM=P("ZodEmoji",(t,n)=>{CN.init(t,n),ct.init(t,n)}),ex=P("ZodNanoID",(t,n)=>{ON.init(t,n),ct.init(t,n)}),tx=P("ZodCUID",(t,n)=>{NN.init(t,n),ct.init(t,n)}),nx=P("ZodCUID2",(t,n)=>{wN.init(t,n),ct.init(t,n)}),rx=P("ZodULID",(t,n)=>{MN.init(t,n),ct.init(t,n)}),ax=P("ZodXID",(t,n)=>{xN.init(t,n),ct.init(t,n)}),ix=P("ZodKSUID",(t,n)=>{DN.init(t,n),ct.init(t,n)}),ox=P("ZodIPv4",(t,n)=>{jN.init(t,n),ct.init(t,n)}),sx=P("ZodIPv6",(t,n)=>{BN.init(t,n),ct.init(t,n)}),lx=P("ZodCIDRv4",(t,n)=>{IN.init(t,n),ct.init(t,n)}),cx=P("ZodCIDRv6",(t,n)=>{UN.init(t,n),ct.init(t,n)}),ux=P("ZodBase64",(t,n)=>{HN.init(t,n),ct.init(t,n)}),fx=P("ZodBase64URL",(t,n)=>{FN.init(t,n),ct.init(t,n)}),dx=P("ZodE164",(t,n)=>{GN.init(t,n),ct.init(t,n)}),mx=P("ZodJWT",(t,n)=>{ZN.init(t,n),ct.init(t,n)}),bv=P("ZodNumber",(t,n)=>{cv.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(o,l,f)=>uM(t,o,l),t.gt=(o,l)=>t.check(cy(o,l)),t.gte=(o,l)=>t.check(jf(o,l)),t.min=(o,l)=>t.check(jf(o,l)),t.lt=(o,l)=>t.check(ly(o,l)),t.lte=(o,l)=>t.check(zf(o,l)),t.max=(o,l)=>t.check(zf(o,l)),t.int=o=>t.check(dy(o)),t.safe=o=>t.check(dy(o)),t.positive=o=>t.check(cy(0,o)),t.nonnegative=o=>t.check(jf(0,o)),t.negative=o=>t.check(ly(0,o)),t.nonpositive=o=>t.check(zf(0,o)),t.multipleOf=(o,l)=>t.check(uy(o,l)),t.step=(o,l)=>t.check(uy(o,l)),t.finite=()=>t;const a=t._zod.bag;t.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??.5),t.isFinite=!0,t.format=a.format??null}),px=P("ZodNumberFormat",(t,n)=>{PN.init(t,n),bv.init(t,n)});function dy(t){return Fw(px,t)}const _x=P("ZodBoolean",(t,n)=>{qN.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>fM(t,a,o)});function hx(t){return Gw(_x,t)}const gx=P("ZodUnknown",(t,n)=>{VN.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>mM()});function my(){return Yw(gx)}const yx=P("ZodNever",(t,n)=>{KN.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>dM(t,a,o)});function vx(t){return Zw(yx,t)}const bx=P("ZodArray",(t,n)=>{QN.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>yM(t,a,o,l),t.element=n.element,t.min=(a,o)=>t.check(Il(a,o)),t.nonempty=a=>t.check(Il(1,a)),t.max=(a,o)=>t.check(mv(a,o)),t.length=(a,o)=>t.check(pv(a,o)),t.unwrap=()=>t.element});function Sx(t,n){return rM(bx,t,n)}const Ex=P("ZodObject",(t,n)=>{WN.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>vM(t,a,o,l),Ke(t,"shape",()=>n.shape),t.keyof=()=>Ei(Object.keys(t._zod.def.shape)),t.catchall=a=>t.clone({...t._zod.def,catchall:a}),t.passthrough=()=>t.clone({...t._zod.def,catchall:my()}),t.loose=()=>t.clone({...t._zod.def,catchall:my()}),t.strict=()=>t.clone({...t._zod.def,catchall:vx()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=a=>yO(t,a),t.safeExtend=a=>vO(t,a),t.merge=a=>bO(t,a),t.pick=a=>hO(t,a),t.omit=a=>gO(t,a),t.partial=(...a)=>SO(Ev,t,a[0]),t.required=(...a)=>EO(Av,t,a[0])});function Ax(t,n){const a={type:"object",shape:t??{},...pe(n)};return new Ex(a)}const Tx=P("ZodUnion",(t,n)=>{JN.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>bM(t,a,o,l),t.options=n.options});function Sv(t,n){return new Tx({type:"union",options:t,...pe(n)})}const Cx=P("ZodIntersection",(t,n)=>{ew.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>SM(t,a,o,l)});function Ox(t,n){return new Cx({type:"intersection",left:t,right:n})}const dd=P("ZodEnum",(t,n)=>{tw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(o,l,f)=>pM(t,o,l),t.enum=n.entries,t.options=Object.values(n.entries);const a=new Set(Object.keys(n.entries));t.extract=(o,l)=>{const f={};for(const d of o)if(a.has(d))f[d]=n.entries[d];else throw new Error(`Key ${d} not found in enum`);return new dd({...n,checks:[],...pe(l),entries:f})},t.exclude=(o,l)=>{const f={...n.entries};for(const d of o)if(a.has(d))delete f[d];else throw new Error(`Key ${d} not found in enum`);return new dd({...n,checks:[],...pe(l),entries:f})}});function Ei(t,n){const a=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new dd({type:"enum",entries:a,...pe(n)})}const Nx=P("ZodLiteral",(t,n)=>{nw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>_M(t,a,o),t.values=new Set(n.values),Object.defineProperty(t,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function wx(t,n){return new Nx({type:"literal",values:Array.isArray(t)?t:[t],...pe(n)})}const Mx=P("ZodTransform",(t,n)=>{rw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>gM(t,a),t._zod.parse=(a,o)=>{if(o.direction==="backward")throw new q0(t.constructor.name);a.addIssue=f=>{if(typeof f=="string")a.issues.push(Fo(f,a.value,n));else{const d=f;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=a.value),d.inst??(d.inst=t),a.issues.push(Fo(d))}};const l=n.transform(a.value,a);return l instanceof Promise?l.then(f=>(a.value=f,a)):(a.value=l,a)}});function xx(t){return new Mx({type:"transform",transform:t})}const Ev=P("ZodOptional",(t,n)=>{dv.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>yv(t,a,o,l),t.unwrap=()=>t._zod.def.innerType});function py(t){return new Ev({type:"optional",innerType:t})}const Dx=P("ZodExactOptional",(t,n)=>{aw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>yv(t,a,o,l),t.unwrap=()=>t._zod.def.innerType});function Rx(t){return new Dx({type:"optional",innerType:t})}const Lx=P("ZodNullable",(t,n)=>{iw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>EM(t,a,o,l),t.unwrap=()=>t._zod.def.innerType});function _y(t){return new Lx({type:"nullable",innerType:t})}const kx=P("ZodDefault",(t,n)=>{ow.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>TM(t,a,o,l),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function zx(t,n){return new kx({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():X0(n)}})}const jx=P("ZodPrefault",(t,n)=>{sw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>CM(t,a,o,l),t.unwrap=()=>t._zod.def.innerType});function Bx(t,n){return new jx({type:"prefault",innerType:t,get defaultValue(){return typeof n=="function"?n():X0(n)}})}const Av=P("ZodNonOptional",(t,n)=>{lw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>AM(t,a,o,l),t.unwrap=()=>t._zod.def.innerType});function Ix(t,n){return new Av({type:"nonoptional",innerType:t,...pe(n)})}const Ux=P("ZodCatch",(t,n)=>{cw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>OM(t,a,o,l),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Hx(t,n){return new Ux({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}const $x=P("ZodPipe",(t,n)=>{uw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>NM(t,a,o,l),t.in=n.in,t.out=n.out});function hy(t,n){return new $x({type:"pipe",in:t,out:n})}const Fx=P("ZodReadonly",(t,n)=>{fw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>wM(t,a,o,l),t.unwrap=()=>t._zod.def.innerType});function Gx(t){return new Fx({type:"readonly",innerType:t})}const Yx=P("ZodCustom",(t,n)=>{dw.init(t,n),mt.init(t,n),t._zod.processJSONSchema=(a,o,l)=>hM(t,a)});function Zx(t,n={}){return aM(Yx,t,n)}function Px(t){return iM(t)}const md={custom:"custom"};function Nt(t){return $w(bv,t)}const qx=["additional_pip","tort_threshold","pip_coverage_type","extended_medical","policy_pip_deductible"],Vx=new Set([...qx,"is_corporation"]);Ax({additional_pip:Ei(["cov100_10400_LIMITED","cov125_13000_LIMITED","cov175_18200_LIMITED","cov250_26000_LIMITED","cov400_41600_LIMITED","cov500_52000_LIMITED","cov600_62400_LIMITED","cov700_72800_LIMITED","cov100_UNLIMITED","cov125_UNLIMITED","cov175_UNLIMITED","cov250_UNLIMITED","cov400_UNLIMITED","cov500_UNLIMITED","cov600_UNLIMITED","cov700_UNLIMITED"]),tort_threshold:Ei(["Verbal_Threshold","Zero_Threshold"]),pip_coverage_type:Ei(["Primary","Secondary"]),extended_medical:Ei(["cov1000","cov10000"]),policy_pip_deductible:Ei(["cov250","cov500","cov1000","cov2000","cov2500"]),has_health_insurance_auto_accident:hx().nullable().optional()}).superRefine((t,n)=>{t.pip_coverage_type==="Secondary"&&t.has_health_insurance_auto_accident!==!0&&n.addIssue({code:md.custom,path:["pip_coverage_type"],message:"Secondary PIP coverage requires health insurance that covers auto accidents."})});const Kx=new Set(["Home","HomeConstruction","HomeFeatures","Demographics"]),Qx=new Set(["HomePolicy","BundlePolicy"]),Xx=new Set(["HomeCustomer","BundleCustomer","Demographics"]);function Hl(t){if(typeof t!="string"||!t.trim())return!1;const n=t.trim().toLowerCase();return n==="nj"||n==="n.j."||n==="n.j"||n==="new jersey"}function gy(t){return t?Hl(t.state??t.State):!1}function Tv(t,n,a){return t==="has_health_insurance_auto_accident"?n==="BundleCustomer"||n==="Demographics"?!1:!gy(a):Vx.has(t)?!gy(a):t==="household_size"?!(n&&Kx.has(n)):t==="number_of_mortgagees"?!(n&&Qx.has(n)):(t==="has_co_applicant"||t==="co_applicant_middle_name"||t==="co_applicant_relationship")&&n&&Xx.has(n)?!1:t==="multi_policy_discount"&&n==="HomePolicy"?!0:Wx.has(t)}const Wx=new Set(["anti_theft_type","passive_restraint_type","anti_lock_brakes","daytime_running_lights","vehicle_full_glass","vehicle_loan_lease","percent_to_work","stated_value_amount_cents","vehicle_comp_deductible","vehicle_coll_deductible","vehicle_towing_and_labor","vehicle_transportation_expense","accident_prevention_course","driver_accidents","driver_violations","losses","middle_name","ssn_display","auto_current_annual_premium_cents","has_co_applicant","co_applicant_middle_name","co_applicant_relationship"]),Cv=new Date().getUTCFullYear(),vl=Pr().trim().min(1,"Required").regex(/^[A-Za-z\s]+$/,"Only alphabetic characters are allowed."),yy=Sv([wx(""),Pr().trim().regex(/^[A-Za-z\s]*$/,"Only alphabetic characters are allowed.")]).optional(),Jx=(t,n,a)=>Nt({error:`${t} must be a number.`}).min(n,`${t} must be between ${n.toLocaleString()} and ${a.toLocaleString()}.`).max(a,`${t} must be between ${n.toLocaleString()} and ${a.toLocaleString()}.`).int(`${t} must be a whole number.`),bi=(t,n)=>Nt({error:`${t} must be a number.`}).min(0,`${t} must be between 0 and ${n.toLocaleString()}.`).max(n,`${t} must be between 0 and ${n.toLocaleString()}.`).int(`${t} must be a whole number.`),bl=(t,n=1600)=>Nt({error:`${t} must be a valid 4-digit year.`}).int(`${t} must be a whole number.`).min(n,`${t} should be between ${n} and the current year.`).max(Cv,`${t} cannot be in the future.`),Sl=t=>Nt({error:`${t} must be a number.`}).int(`${t} must be a whole number.`).min(0,`${t} must be between 0 and 99.`).max(99,`${t} must be between 0 and 99.`),Lo=(t,n,a=0)=>{const o=Math.pow(10,n)-1,l=o.toLocaleString("en-US"),f=a.toLocaleString("en-US");return Nt({error:`${t} must be a number.`}).min(a,`${t}: Value must be between ${f} and ${l}.`).max(o,`${t}: Value must be between ${f} and ${l}.`).int(`${t} must be a whole number.`)},eD={email:Pr().trim().min(1,"Required").email("Please enter a valid email address."),phone:Pr().trim().min(1,"Required").refine(t=>{let n=t.replace(/\D/g,"");return n.length===11&&n.startsWith("1")&&(n=n.slice(1)),n.length===10},"Please enter a valid 10-digit US phone number."),social_security_number:Pr().trim().refine(t=>t===""||/^\d{3}-\d{2}-\d{4}$/.test(t),"Social Security Number must be in the format XXX-XX-XXXX.").optional(),sms_code:Pr().trim().min(1,"Required").regex(/^\d{6}$/,"Please enter the 6-digit code."),first_name:vl,last_name:vl,middle_name:yy,co_applicant_first_name:vl,co_applicant_last_name:vl,co_applicant_middle_name:yy,year_built:bl("Year built",1800),year_roof_updated:Nt({error:"Please enter a valid 4-digit year."}).int("Year must be a whole number.").min(1e3,"Please enter a valid 4-digit year.").max(9999,"Please enter a valid 4-digit year."),heating_update_year:bl("Heating update year"),plumbing_update_year:bl("Plumbing update year"),electrical_update_year:bl("Electrical update year"),total_area_sq_ft:Jx("Square footage",1,999999),sale_price_cents:Nt({error:"Purchase Price must be a number."}).min(1,"Purchase Price must be between 1 and 21,474,836.").max(21474836,"Purchase Price must be between 1 and 21,474,836.").int("Purchase Price must be a whole number."),home_prior_years:Sl("Number of years with your prior carrier"),home_continuous_coverage_years:Sl("How long you have had continuous home coverage"),household_size:Nt({error:"Household size must be a number."}).min(1,"Occupants must be between 1 and 8.").max(8,"Occupants must be between 1 and 8.").int("Occupants must be between 1 and 8."),number_of_mortgagees:Nt({error:"Number of mortgagees must be a number."}).int().min(0,"Number of mortgagees cannot be negative.").max(3,"Number of mortgagees must be between 0 and 3."),dwelling_replacement_cost:Lo("Replacement cost",9,1),other_structures_coverage:Lo("Other structures",9),personal_property_coverage:Lo("Personal property",7),loss_of_use_coverage:Lo("Loss of use coverage",8),years_at_address:Nt({error:"Years at address must be a number."}).int().min(0,"Years at address cannot be negative.").max(100,"Years at address must be 100 or less."),months_at_address:Nt({error:"Months at address must be a number."}).int().min(0,"Months at address cannot be negative.").max(11,"Months at address must be between 0 and 11."),years_at_prior_address:Nt({error:"Years at prior address must be a number."}).int().min(0,"Years at prior address cannot be negative.").max(100,"Years at prior address must be 100 or less."),number_of_units:Nt({error:"Number of units must be a number."}).int().min(1,"Number of units/apartments should be greater than 0.").max(99,"Number of units/apartments must be between 1 and 99."),number_of_families:Nt({error:"Number of families must be a number."}).int("Number of families must be a whole number.").refine(t=>t>=1&&t<=5,{message:"Number of families must be between 1 and 5."}),number_of_dogs:Nt({error:"Number of dogs must be a number."}).int().min(0,"Number of dogs must be between 0 and 99.").max(99,"Number of dogs must be between 0 and 99."),distance_to_coast_miles:Nt({error:"Distance to coast must be a number."}).int().min(0,"Distance to coast cannot be negative.").max(9999,"Distance to coast must be at most 4 digits."),amount_paid_cents:Lo("Amount paid",7),license_number:Pr().trim().min(1,"Required").max(20,"License number must be 20 characters or fewer.").regex(/^[A-Z0-9]+$/i,"License number must contain only letters and numbers."),vin:Pr().superRefine((t,n)=>{if(typeof t!="string"||t.trim()==="")return;if(/\s/.test(t)){n.addIssue({code:md.custom,message:"VIN cannot contain spaces."});return}const a=t.trim();/^[A-HJ-NPR-Z0-9]{17}$/i.test(a)||n.addIssue({code:md.custom,message:"VIN must be exactly 17 letters and numbers (excluding I, O, and Q)."})}),annual_mileage:Nt({error:"Annual mileage must be a number."}).int("Annual mileage must be a whole number.").min(1e3,"Vehicle annual use should be between 1,000 & 100,000 miles.").max(1e5,"Vehicle annual use should be between 1,000 & 100,000 miles."),miles_to_work:Nt({error:"Miles driven to work/school must be a number."}).int("Miles driven to work/school must be a whole number.").min(1,"Please enter a value greater than 0.").max(9999,"Miles driven to work/school must be between 1 and 9,999."),custom_equipment_value_cents:bi("Modifications value",9999999),cost_new_value_cents:bi("Cost new value",9999999),stated_value_amount_cents:bi("Stated Value Amount",9999999),property_damage_amount_paid_cents:bi("Property damage amount paid",9999999),personal_injury_amount_paid_cents:bi("Personal injury amount paid",9999999),auto_current_annual_premium_cents:bi("Current annual premium",9999999),auto_prior_years:Sl("Years with prior auto carrier"),auto_prior_months:Nt({error:"Months with prior carrier must be a number."}).int().min(0,"Months with prior carrier must be between 0 and 11.").max(11,"Months with prior carrier must be between 0 and 11."),auto_continuous_coverage_years:Sl("Years with continuous auto coverage")};function yt(t){return new Date(`${t}T00:00:00Z`)}function Bt(){const t=new Date;return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()))}function Yr(t,n){let a=n.getUTCFullYear()-t.getUTCFullYear();const o=n.getUTCMonth()-t.getUTCMonth();return(o<0||o===0&&n.getUTCDate()<t.getUTCDate())&&a--,a}const Ov=[{targetKey:"social_security_number",dependsOn:["social_security_number","state"],validate:t=>{if(!("social_security_number"in t)||!Hl(t.state))return;const n=t.social_security_number;return(typeof n=="string"?n.trim():"")===""?"Social Security Number is required in New Jersey.":void 0}},{targetKey:"date_of_birth",dependsOn:["date_of_birth"],validate:t=>{const n=t.date_of_birth;if(!n||typeof n!="string")return;const a=yt(n);return isNaN(a.getTime())?"Invalid date.":a.getUTCFullYear()<1900?"Date of birth year can't be earlier than 1900.":Yr(a,Bt())<18?"Applicant can't be under the age of 18.":void 0}},{targetKey:"co_applicant_date_of_birth",dependsOn:["co_applicant_date_of_birth"],validate:t=>{const n=t.co_applicant_date_of_birth;if(!n||typeof n!="string")return;const a=yt(n);return isNaN(a.getTime())?"Invalid date.":a.getUTCFullYear()<1900?"Date of birth year can't be earlier than 1900.":Yr(a,Bt())<16?"Co-applicant can't be under the age of 16.":void 0}},{targetKey:"year_roof_updated",dependsOn:["year_roof_updated","year_built"],validate:t=>{const n=Number(t.year_roof_updated),a=Number(t.year_built);if(isNaN(n))return;const o=isNaN(a)?1e3:a;if(n<o||n>Cv)return"Roof renovation/replacement year must be between the home's build year and the current year."}},{targetKey:"move_in_date",dependsOn:["move_in_date","year_built"],validate:t=>{const n=t.move_in_date,a=t.year_built;if(!n||a==null)return;const o=yt(String(n));if(isNaN(o.getTime()))return;const l=Number(a);if(!isNaN(l))return o.getUTCFullYear()<l?"Purchase date cannot be prior to the year the building was originally constructed.":void 0}},{targetKey:"date_first_licensed",dependsOn:["date_first_licensed"],validate:t=>{const n=t.date_first_licensed;if(!n||typeof n!="string")return;const a=yt(n);return isNaN(a.getTime())?"Invalid date.":a>Bt()?"Date first licensed cannot be in the future.":void 0}},{targetKey:"date_first_licensed",dependsOn:["date_first_licensed","date_of_birth"],validate:t=>{const n=t.date_first_licensed,a=t.date_of_birth;if(!n||typeof n!="string"||!a||typeof a!="string")return;const o=yt(a),l=yt(n);if(isNaN(o.getTime())||isNaN(l.getTime()))return;if(l<o)return"Date licensed cannot be before driver date of birth.";const f=new Date(Date.UTC(o.getUTCFullYear()+18,o.getUTCMonth(),o.getUTCDate()));return l<f?"Driver can't be licensed to drive before the age of 18.":void 0}},{targetKey:"occurred_at",dependsOn:["occurred_at"],validate:t=>{const n=t.occurred_at;if(!n||typeof n!="string")return;const a=yt(n);return isNaN(a.getTime())?"Invalid date.":a>Bt()?"Incident date cannot be in the future.":void 0}},{targetKey:"accident_prevention_course_date",dependsOn:["accident_prevention_course_date"],validate:t=>{const n=t.accident_prevention_course_date;if(!n||typeof n!="string")return;const a=yt(n);return isNaN(a.getTime())?"Invalid date.":a>Bt()?"Course date cannot be in the future.":void 0}},{targetKey:"effective_date",dependsOn:["effective_date"],validate:t=>{const n=t.effective_date;if(!n||typeof n!="string")return;const a=yt(n);if(isNaN(a.getTime()))return"Invalid date.";const o=Bt(),l=new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth()+3,o.getUTCDate()));if(a<o)return"Insurance start date cannot be in the past.";if(a>l)return"Insurance must begin within 3 months from today."}},{targetKey:"years_at_address",dependsOn:["years_at_address","date_of_birth"],validate:t=>{const n=t.years_at_address,a=t.date_of_birth;if(n==null||a==null||typeof a!="string")return;const o=Number(n);if(isNaN(o))return;const l=yt(a);if(isNaN(l.getTime()))return;const f=Yr(l,Bt());return o>f?"Time at address cannot be greater than the applicant age.":void 0}},{targetKey:"years_at_prior_address",dependsOn:["years_at_prior_address","date_of_birth"],validate:t=>{const n=t.years_at_prior_address,a=t.date_of_birth;if(n==null||a==null||typeof a!="string")return;const o=Number(n);if(isNaN(o))return;const l=yt(a);if(isNaN(l.getTime()))return;const f=Yr(l,Bt());return o>f?"Years at prior address cannot be greater than the applicant age.":void 0}},{targetKey:"home_prior_years",dependsOn:["home_prior_years","home_continuous_coverage_years"],validate:t=>{const n=t.home_prior_years,a=t.home_continuous_coverage_years;if(n==null||a==null)return;const o=Number(n),l=Number(a);if(!(isNaN(o)||isNaN(l)))return o>l?"Years with prior carrier cannot be higher than years with continuous coverage.":void 0}},{targetKey:"home_prior_years",dependsOn:["home_prior_years","date_of_birth"],validate:t=>{const n=t.home_prior_years,a=t.date_of_birth;if(n==null||a==null||typeof a!="string")return;const o=Number(n);if(isNaN(o))return;const l=yt(a);if(isNaN(l.getTime()))return;const f=Yr(l,Bt());return o>f?"Years with prior carrier cannot be greater than the Applicant's age.":void 0}},{targetKey:"home_continuous_coverage_years",dependsOn:["home_continuous_coverage_years","date_of_birth"],validate:t=>{const n=t.home_continuous_coverage_years,a=t.date_of_birth;if(n==null||a==null||typeof a!="string")return;const o=Number(n);if(isNaN(o))return;const l=yt(a);if(isNaN(l.getTime()))return;const f=Yr(l,Bt());return o>f?"Years with continuous home coverage cannot be greater than the Applicant's age.":void 0}},{targetKey:"move_in_date",dependsOn:["move_in_date"],validate:t=>{const n=t.move_in_date;if(!n||typeof n!="string")return;const a=yt(n);return isNaN(a.getTime())?"Invalid date.":a>Bt()?"Purchase date cannot be in the future.":void 0}},{targetKey:"date_of_incident",dependsOn:["date_of_incident"],validate:t=>{const n=t.date_of_incident;if(!n||typeof n!="string")return;const a=yt(n);if(isNaN(a.getTime()))return"Invalid date.";const o=Bt();return a>o?"Loss date cannot be in the future.":void 0}},{targetKey:"home_prior_expiration_date",dependsOn:["home_prior_expiration_date"],validate:t=>{const n=t.home_prior_expiration_date;if(!n||typeof n!="string")return;const a=yt(n);if(isNaN(a.getTime()))return"Invalid date.";const o=Bt(),l=new Date(Date.UTC(o.getUTCFullYear()-1,o.getUTCMonth(),o.getUTCDate())),f=new Date(Date.UTC(o.getUTCFullYear()+1,o.getUTCMonth(),o.getUTCDate()));if(a<l||a>f)return"Policy expiration date must be between 1 year ago and 1 year from now."}},{targetKey:"purchase_date",dependsOn:["purchase_date"],validate:t=>{const n=t.purchase_date;if(!n||typeof n!="string")return;const a=yt(n);return isNaN(a.getTime())?"Invalid date.":a>Bt()?"Vehicle purchase date cannot be in the future.":void 0}},{targetKey:"purchase_date",dependsOn:["purchase_date","year"],validate:t=>{const n=t.purchase_date,a=t.year;if(!n||typeof n!="string"||a==null)return;const o=yt(n);if(isNaN(o.getTime()))return;const l=Number(a);if(!isNaN(l))return o.getUTCFullYear()<l?"The year the vehicle was purchased is not valid with the model year.":void 0}},{targetKey:"auto_prior_expiration_date",dependsOn:["auto_prior_expiration_date"],validate:t=>{const n=t.auto_prior_expiration_date;if(!n||typeof n!="string")return;const a=yt(n);if(isNaN(a.getTime()))return"Invalid date.";const o=Bt(),l=new Date(Date.UTC(o.getUTCFullYear()-1,o.getUTCMonth(),o.getUTCDate())),f=new Date(Date.UTC(o.getUTCFullYear()+1,o.getUTCMonth(),o.getUTCDate()));if(a<l||a>f)return"Auto policy expiration date must be between 1 year ago and 1 year from now."}},{targetKey:"auto_prior_years",dependsOn:["auto_prior_years","auto_continuous_coverage_years"],validate:t=>{const n=t.auto_prior_years,a=t.auto_continuous_coverage_years;if(n==null||a==null)return;const o=Number(n),l=Number(a);if(!(isNaN(o)||isNaN(l)))return o>l?"Years with prior auto carrier cannot be higher than years with continuous coverage.":void 0}},{targetKey:"auto_prior_years",dependsOn:["auto_prior_years","date_of_birth"],validate:t=>{const n=t.auto_prior_years,a=t.date_of_birth;if(n==null||a==null||typeof a!="string")return;const o=Number(n);if(isNaN(o))return;const l=yt(a);if(isNaN(l.getTime()))return;const f=Yr(l,Bt());return o>f?"Years with prior auto carrier cannot be greater than the Applicant's age.":void 0}},{targetKey:"auto_continuous_coverage_years",dependsOn:["auto_continuous_coverage_years","date_of_birth"],validate:t=>{const n=t.auto_continuous_coverage_years,a=t.date_of_birth;if(n==null||a==null||typeof a!="string")return;const o=Number(n);if(isNaN(o))return;const l=yt(a);if(isNaN(l.getTime()))return;const f=Yr(l,Bt());return o>f?"Years with continuous auto coverage cannot be greater than the Applicant's age.":void 0}},{targetKey:"vehicle_coll_deductible",dependsOn:["vehicle_coll_deductible","vehicle_comp_deductible"],validate:t=>{const n=t.vehicle_coll_deductible,a=t.vehicle_comp_deductible;if(!(!n||typeof n!="string"||!a||typeof a!="string")&&a==="NoCoverage"&&n!=="NoCoverage")return"Collision Coverage cannot be chosen if Comprehensive is No Coverage."}},{targetKey:"policy_um",dependsOn:["policy_um","policy_bi"],validate:t=>{const n=t.policy_um,a=t.policy_bi;if(!n||typeof n!="string"||!a||typeof a!="string"||n==="Reject"||a==="Dontknow")return;const o=h=>h.endsWith("CSL"),l=o(n),f=o(a);if(l&&!f)return"A Combined Single Limit cannot be selected for Uninsured/Underinsured Motorist unless a Combined Single Limit has also been selected for Liability.";const d={cov30to60:30,cov50to100:50,cov100to100:100,cov100to300:100,cov250to500:250,cov300to300:300,cov500to500:500,cov100CSL:100,cov300CSL:300,cov500CSL:500},m=d[n],_=d[a];if(m!=null&&_!=null&&m>_)return"Uninsured/Underinsured Motorist Limit value cannot be greater than Bodily Injury Limit value."}},{targetKey:"policy_umpd",dependsOn:["policy_umpd","policy_pd"],validate:t=>{const n=t.policy_umpd,a=t.policy_pd;if(!n||typeof n!="string"||!a||typeof a!="string"||n==="NoCoverage"||a==="Dontknow")return;const o=d=>{if(!d.startsWith("cov"))return null;const m=parseInt(d.replace("cov",""),10);return isNaN(m)?null:m},l=o(n),f=o(a);if(l!=null&&f!=null&&l>f)return"Uninsured Motorist Property Damage Limit value cannot be greater than Liability Property Damage Limit value."}},{targetKey:"custom_equipment_value_cents",dependsOn:["custom_equipment_value_cents","stated_value_amount_cents"],validate:t=>{const n=t.custom_equipment_value_cents,a=t.stated_value_amount_cents;if(n==null||a==null)return;const o=Number(n),l=Number(a);if(!(isNaN(o)||isNaN(l))&&l>0&&o>0)return"Modifications should be included in the stated value of the vehicle. If a stated value quote is not required, remove the stated value."}}];function pd(t,n){const a=eD[t];if(!a)return;const o=a.safeParse(n);return o.success?void 0:o.error.issues[0].message}function vy(t){if(/\s/.test(t))return!1;const n=t.trim();return n.length===17&&/^[A-HJ-NPR-Z0-9]{17}$/i.test(n)}function tD(t,n){const a={};for(const o of Ov){if(n?.has(o.targetKey))continue;const l=o.validate(t);l&&(a[o.targetKey]=l)}return a}function _d(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function Uo(t,n){return t.key??`${_d(t.question)}-${n}`}function Vr(t,n){return n==="number"?t==null||typeof t=="string"&&t.trim()==="":n==="checkbox"?t!==!0:t==null||typeof t=="string"&&t.trim()===""}function $l(t,n){const a={};t.forEach((d,m)=>{const _=Uo(d,m),h=n[_];if(d.required&&Vr(h,d.inputType)){a[_]="Required";return}if(!Vr(h,d.inputType)){const v=pd(_,h);if(v){a[_]=v;return}}});const o={...n};t.forEach((d,m)=>{const _=Uo(d,m);_ in o||(o[_]="")});const l=new Set(Object.keys(a).filter(d=>a[d])),f=tD(o,l);for(const[d,m]of Object.entries(f))a[d]=m;return a}function nD(t){if(t===""||t===null||t===void 0)return;const n=Number(t);return Number.isNaN(n)?void 0:n}const rD={NoPriorInsurance:"No Prior Insurance",TwentyFirstCentury:"21st Century",ACentral:"A.Central",AAA:"AAA",AARP:"AARP",Acadia:"Acadia",Ace:"Ace",Acuity:"Acuity",AdirondackInsExchange:"Adirondack Ins Exchange",Aegis:"Aegis",AIC:"AIC",AIG:"AIG",AlfaAlliance:"Alfa Alliance",Allied:"Allied",Allstate:"Allstate",AmericaFirst:"America First",AmericanCommerce:"American Commerce",AmericanFamily:"American Family",Amica:"Amica",ASILloyds:"ASI Lloyds",AustinMutual:"Austin Mutual",Autoone:"Autoone",AutoOwners:"Auto-Owners",BadgerMutual:"Badger Mutual",Balboa:"Balboa",Bankers:"Bankers",BeaconNational:"Beacon National",BrethernMutual:"Brethern Mutual",BristolWest:"Bristol West",CapitalInsuranceGroup:"Capital Insurance Group",Celina:"Celina",CentralMutualOfOH:"Central Mutual of OH",Chubb:"Chubb",Cincinnati:"Cincinnati",Clearcover:"Clearcover",CNA:"CNA",ColonialPenn:"Colonial Penn",ColoradoCasualty:"Colorado Casualty",Columbia:"Columbia",CommerceWest:"Commerce West",CommonwealthCasualty:"Commonwealth Casualty",Ameriprise:"CONNECT",ConstitutionalCasualty:"Constitutional Casualty",Cornerstone:"Cornerstone",Countrywide:"Countrywide",CSE:"CSE",Cumberland:"Cumberland",Dairyland:"Dairyland",Deerbrook:"Deerbrook",Direct:"Direct",Donegal:"Donegal",Drive:"Drive",Electric:"Electric",EMC:"EMC",Encompass:"Encompass",Erie:"Erie",Esurance:"Esurance",Explorer:"Explorer",FarmBureau:"Farm Bureau",Farmers:"Farmers",FiremansFund:"Firemans Fund",FirstAmerican:"First American",Foremost:"Foremost",Geico:"Geico",GeneralCasualty:"General Casualty",GermantownMutual:"Germantown Mutual",GMAC:"GMAC",Grange:"Grange",GreatAmerican:"Great American",Grinnell:"Grinnell",GuideOne:"Guide One",Hanover:"Hanover",Harbor:"Harbor",Harleysville:"Harleysville",HartfordOMNI:"Hartford OMNI",Hartford:"Hartford",HastingsMutual:"Hastings Mutual",HawkeyeSecurity:"Hawkeye Security",HDI:"HDI",HoraceMann:"Horace Mann",HoustonGeneral:"Houston General",IFA:"IFA",ImperialCasualty:"Imperial Casualty",IndianaFarmers:"Indiana Farmers",Indiana:"Indiana",Infinity:"Infinity",Insurequest:"Insurequest",Integon:"Integon",Integrity:"Integrity",Kemper:"Kemper",LibertyMutual:"Liberty Mutual",LibertyNorthwest:"Liberty Northwest",MainStreetAmerica:"Main Street America",Mapfre:"Mapfre",Mendota:"Mendota",MerchantsGroup:"Merchants Group",Mercury:"Mercury",Metlife:"MetLife",Metropolitan:"Metropolitan",MidContinent:"Mid-Continent",MidwesternIndemnity:"Midwestern Indemnity",Montgomery:"Montgomery",MSA:"MSA",MtWashington:"Mt. Washington",MutualBenefit:"Mutual Benefit",NationalGeneral:"National General",Nationwide:"Nationwide",NewYorkCentralMutual:"New York Central Mutual",NJManufacturers:"NJ Manufacturers",NJSkylands:"NJ Skylands",Northstar:"Northstar",Occidental:"Occidental",OhioCasualty:"Ohio Casualty",OmahaPC:"Omaha P/C",OneBeacon:"One Beacon",OregonMutual:"Oregon Mutual",Palisades:"Palisades",PeerlessMontgomery:"Peerless/Montgomery",Pekin:"Pekin",Pemco:"Pemco",PennNational:"Penn National",PlymouthRock:"Plymouth Rock",PreferredMutual:"Preferred Mutual",Proformance:"Proformance",Progressive:"Progressive",Prudential:"Prudential",Republic:"Republic",RockfordMutual:"Rockford Mutual",RoyalAndSunAlliance:"Royal and Sun Alliance",Safeco:"Safeco",SECURA:"SECURA",Selective:"Selective",SouthernCounty:"Southern County",SouthernMutual:"Southern Mutual",SouthernTrust:"Southern Trust",StPaulTravelers:"St. Paul/Travelers",StandardMutual:"Standard Mutual",StarCasualty:"Star Casualty",StateAuto:"State Auto",StateFarm:"State Farm",Fidelity:"Stillwater",Travelers:"Travelers",TWFG:"TWFG",Unigard:"Unigard",UnitedFireAndCasualty:"United Fire and Casualty",Unitrin:"Unitrin",Universal:"Universal",USAA:"USAA",UticaNational:"Utica National",Victoria:"Victoria",WestBend:"West Bend",WesternNational:"Western National",WesternReserveGroup:"Western Reserve Group",Westfield:"Westfield",WhiteMountains:"White Mountains",WilsonMutual:"Wilson Mutual",Windsor:"Windsor",Zurich:"Zurich",OtherStandard:"Other Standard",OtherNonStandard:"Other Non-Standard"},aD={OwnHome:"Own Home",OwnCondo:"Own Condo",RentHome:"Rent Home",RentCondo:"Rent Condo",RentApartment:"Rent Apartment",LiveWithParents:"Live With Parents"},iD={TwentyFirstCentury:"21st Century",AAA:"AAA",Acuity:"Acuity",AdirondackInsExchange:"Adirondack Ins Exchange",AIG:"AIG",AlfaAlliance:"Alfa Alliance",AllianzOfAmerica:"Allianz of America",AllianzOfAmericaJefferson:"Allianz of America-Jefferson",Allied:"Allied",Allmerica:"Allmerica",Allstate:"Allstate",AmericaFirst:"America First",AmericanFamily:"American Family",AmericanCommerce:"American Commerce",Amica:"Amica",ASILloyds:"ASI Lloyds",Assurant:"Assurant",AtlasGeneralAgency:"Atlas General Agency",AustinMutual:"Austin Mutual",AutoOwners:"Auto-Owners",BadgerMutual:"Badger Mutual",Balboa:"Balboa",Bamboo:"Bamboo",BeaconNational:"Beacon National",BunkerHill:"Bunker Hill",CapitalInsuranceGroup:"Capital Insurance Group",CentralMutualOfOH:"Central Mutual of OH",ChubbInsurance:"Chubb",Cincinnati:"Cincinnati",Citizens:"Citizens",ColoradoCasualty:"Colorado Casualty",Ameriprise:"CONNECT",CSE:"CSE",Cumberland:"Cumberland",Cypress:"Cypress",Dairyland:"Dairyland",Donegal:"Donegal",Electric:"Electric",EMC:"EMC",Encompass:"Encompass",Erie:"Erie",Esurance:"Esurance",ExcelsiorInsuranceCompany:"Excelsior Insurance Company",FairPlan:"Fair Plan",FarmBureau:"Farm Bureau",Farmers:"Farmers",FiremansFund:"Firemans Fund",FirstAmerican:"First American",ForemostInsuranceCompany:"Foremost Insurance Company",Geico:"Geico",GeneralCasualty:"General Casualty",GermantownMutual:"Germantown Mutual",GMAC:"GMAC",Grange:"Grange",Grinnell:"Grinnell",GuideOne:"Guide One",Hanover:"Hanover",Harleysville:"Harleysville",Hartford:"Hartford",HartfordOMNI:"Hartford OMNI",HawkeyeSecurity:"Hawkeye Security",HippoInsuranceCompany:"Hippo Insurance Company",HomeownersOfAmerica:"Homeowners of America",Homesite:"Homesite",HoraceMann:"Horace Mann",HoustonGeneral:"Houston General",Indiana:"Indiana",IndianaFarmers:"Indiana Farmers",Integrity:"Integrity",Kemper:"Kemper",LibertyMutual:"Liberty Mutual",LibertyNorthwest:"Liberty Northwest",Lloyds:"Lloyds",MainStreetAmerica:"Main Street America",MarkelInsuranceCompany:"Markel Insurance Company",MerchantsGroup:"Merchants Group",Mercury:"Mercury",Metlife:"MetLife",MidwesternIndemnity:"Midwestern Indemnity",Montgomery:"Montgomery",MSA:"MSA",MutualBenefit:"Mutual Benefit",Tower:"National General",NatGenPremier:"NatGen Premier",Nationwide:"Nationwide",NationwideScottsdale:"Nationwide-Scottsdale",NewYorkCentralMutual:"New York Central Mutual",NJSkylands:"NJ Skylands",Northstar:"Northstar",OhioCasualty:"Ohio Casualty",OneBeacon:"One Beacon",OregonMutual:"Oregon Mutual",PeerlessMontgomery:"Peerless/Montgomery",Pekin:"Pekin",PennNational:"Penn National",PlymouthRock:"Plymouth Rock",PreferredMutual:"Preferred Mutual",Prudential:"Prudential",PureHighValue:"Pure High Value",Republic:"Republic",RoyalAndSunAlliance:"Royal and Sun Alliance",Safeco:"Safeco",SECURA:"SECURA",SouthernMutual:"Southern Mutual",SouthernTrust:"Southern Trust",StPaulTravelers:"St. Paul/Travelers",StandardMutual:"Standard Mutual",StateAuto:"State Auto",StateFarm:"State Farm",StateFarmFloridaInsuranceCompany:"State Farm Florida Insurance Company",Fidelity:"Stillwater",SunshineStateInsuranceCompany:"Sunshine State Insurance Company",Travelers:"Travelers",TWFG:"TWFG",Unigard:"Unigard",UnitedFireAndCasualty:"United Fire and Casualty",Unitrin:"Unitrin",Universal:"Universal",USAA:"USAA",UticaNational:"Utica National",Wellington:"Wellington",WestBend:"West Bend",WesternNational:"Western National",WesternReserveGroup:"Western Reserve Group",Westfield:"Westfield",WhiteMountains:"White Mountains",WilsonMutual:"Wilson Mutual",Zurich:"Zurich",Other:"Other",OtherNonStandard:"Other Non-Standard",OtherStandard:"Other Standard"},oD={Business:"Business",Pleasure:"Pleasure",Farming:"Farming",To_FromWork:"To/From Work",To_FromSchool:"To/From School"},sD={Dontknow:"Don't Know",ThirtyToSixty:"30/60",FiftyToHundred:"50/100",HundredToHundred:"100/100",HundredToThreeHundred:"100/300",TwoHundredFiftyToFiveHundred:"250/500",ThreeHundredToThreeHundred:"300/300",FiveHundredToFiveHundred:"500/500",HundredCSL:"100CSL",ThreeHundredCSL:"300CSL",FiveHundredCSL:"500CSL"},lD={ActiveMilitaryDuty:"Active Military Duty",DrivingCompanyCar:"Driving A Company Car",DrivingCarOwnedByRelative:"Driving A Car Owned By A Relative",HasNotOwnedOrOperatedVehicle:"Has Not Owned Or Operated A Vehicle",OwnedVehParkedStoredOffRoadNotDriven:"Owned Veh Parked/Stored Off Road/Not Driven",NonPayment:"Non-Payment",Other:"Other"},cD={Dontknow:"Don't Know",cov30to60:"30/60",cov35to70:"35/70",cov50to100:"50/100",cov100to100:"100/100",cov100to300:"100/300",cov250to500:"250/500",cov300to300:"300/300",cov500to500:"500/500",cov100CSL:"100 CSL",cov300CSL:"300 CSL",cov500CSL:"500 CSL"},uD={Reject:"Reject",cov30to60:"30/60",cov35to70:"35/70",cov50to100:"50/100",cov100to100:"100/100",cov100to300:"100/300",cov250to500:"250/500",cov300to300:"300/300",cov500to500:"500/500",cov100CSL:"100 CSL",cov300CSL:"300 CSL",cov500CSL:"500 CSL"},fD={Dontknow:"Don't know",cov25000:"25,000",cov50000:"50,000",cov100000:"100,000",cov250000:"250,000",cov500000:"500,000"},dD={None:"None",cov500:"500",cov1000:"1,000",cov2000:"2,000",cov2500:"2,500",cov5000:"5,000",cov10000:"10,000",cov15000:"15,000",cov25000:"25,000",cov50000:"50,000",cov100000:"100,000"},mD={cov25000:"25,000",cov35000:"35,000",cov50000:"50,000",cov100000:"100,000",cov200000:"200,000",cov250000:"250,000",cov300000:"300,000",cov500000:"500,000"},pD={cov15000:"15,000",cov2500:"2,500",cov5000:"5,000",cov10000:"10,000",cov25000:"25,000",cov50000:"50,000",cov100000:"100,000",cov250000:"250,000",cov75000:"75,000",cov150000:"150,000"},_D={NoCoverage:"No Coverage",cov5000:"5,000",cov10000:"10,000"},hd={NoCoverage:"No Coverage",Zero:"0",Fifty:"50",Hundred:"100",TwoHunderd:"200",TwoHundredfifty:"250",FiveHundred:"500",SeventyFiveHundred:"750",Thousand:"1,000",TwoThousand:"2,000"},hD=["NoCoverage","Zero","Fifty","Hundred","TwoHunderd","TwoHundredfifty","FiveHundred","SeventyFiveHundred","Thousand","TwoThousand"],gD=["NoCoverage","Zero","Fifty","Hundred","TwoHunderd","TwoHundredfifty","FiveHundred","Thousand","TwoThousand"],gd={NoCoverage:"No Coverage",TwentyFive:"25",Forty:"40",Fifty:"50",SeventyFive:"75",Eighty:"80",Hundred:"100",TwelveHundred:"120",TwoHundred:"200",Unlimited:"Unlimited"},yD=["NoCoverage","TwentyFive","Fifty","SeventyFive","Hundred","TwoHundred","Unlimited"],Nv={NoCoverage:"No Coverage",cov20to600:"20/600",cov25to750:"25/750",cov30to900:"30/900",cov40to1200:"40/1,200",cov50to1500:"50/1,500",cov100to3000:"100/3,000"},vD=["NoCoverage","cov20to600","cov25to750","cov30to900","cov40to1200","cov50to1500","cov100to3000"],bD=["NoCoverage","cov20to600","cov30to900","cov40to1200","cov50to1500"],wv={NoHighSchoolDiploma:"No High School Diploma",HighSchoolDiploma:"High School Diploma",SomeCollegeNoDegree:"Some College - No Degree",VocationalTechnicalDegree:"Vocational Technical Degree",AssociatesDegree:"Associates Degree",Bachelors:"Bachelors",Masters:"Masters",Phd:"Phd",MedicalDegree:"Medical Degree",LawDegree:"Law Degree"},SD={TwoFamilyHome:"2-Family Home",American4square:"American 4-square",Basic:"Basic",BiLevel:"Bi-Level",Bungalow:"Bungalow",CapeCod:"Cape Cod",Colonial:"Colonial",ColonialSpanish:"Colonial - Spanish",CompletelyCustom:"Completely Custom",Contemporary:"Contemporary",ContractorModern:"Contractor Modern",Farmhouse:"Farmhouse",Folk:"Folk",Log:"Log",Mediterranean:"Mediterranean",Ranch:"Ranch",TriLevel:"Tri-Level",Tudor:"Tudor",Vernacular:"Vernacular",Victorian:"Victorian"},ED={SingleFamilyHouse:"Single Family House",Townhouse:"Townhouse",Rowhouse:"Rowhouse",Duplex:"Duplex/Two Family Unit",Triplex:"Tri-plex/Three Family Unit",Fourplex:"Four-plex/Four Family Unit",MultFamily:"Multi-family (more than four units)"},AD={OwnerPrimary:"Owner Primary",OwnerSecondary:"Owner Secondary",OwnerSeasonal:"Owner Seasonal"},TD={Basic:"Basic",Modest:"Modest",Average:"Average",AboveAverage:"Above Average",Expensive:"Expensive",VeryExpensive:"Very Expensive",Opulent:"Opulent"},CD={Frame:"Frame",Masonry:"Masonry",MasonryVeneer:"Masonry Veneer",Log:"Log",Asbestos:"Asbestos",EFIS:"EFIS",HardiPlank:"HardiPlank",SuperiorFireResistive:"Superior Fire Resistive",SuperiorMasonryNonCombustible:"Superior Masonry Non Combustible",SuperiorNonCombustible:"Superior Non Combustible"},OD={Slab:"Slab",Basement:"Basement",CrawlSpace:"Crawl Space",PartialBasement:"Partial Basement",PiersPostsPiles:"Piers / Posts / Piles",Open:"Open"},ND={NotOverWater:"No",PartiallyOverWater:"Partially Over Water",FullyOrEntirelyOverWater:"Fully or Entirely Over Water"},wD={One:"1",OneHalf:"1.5",Two:"2",TwoHalf:"2.5",Three:"3",ThreeHalf:"3.5",Four:"4",BiLevel:"Bi-Level",TriLevel:"Tri-Level"},MD={VinylSiding:"Vinyl Siding",WoodFraming:"Wood Framing",BrickVeneer:"Brick Veneer",Stucco:"Stucco",AdobeBlock:"Adobe Block",AluminumSiding:"Aluminum Siding",CementFiberShingles:"Cement Fiber Shingles",Clapboard:"Clapboard",ConcreteBlock:"Concrete Block",HardboardSiding:"Hardboard Siding",InsulatedConcreteForms:"Insulated Concrete Forms",LightGaugeSteelFraming:"Light Gauge Steel Framing",LogsSolid:"Logs (Solid)",MasoniteSiding:"Masonite Siding",PreEngineeredMetal:"Pre-Engineered Metal",SolidBrickConstruction:"Solid Brick Construction",SolidConcrete:"Solid Concrete",StandardPoleFramed:"Standard Pole Framed",Stone:"Stone",StructuralInsulatedPanels:"Structural Insulated Panels",TimberFraming:"Timber Framing"},xD={ASPHALT_SHINGLES:"Asphalt Shingles",ARCHITECTURAL_SHINGLES:"Architectural Shingles",METAL:"Metal",TILE_CONCRETE:"Tile (Concrete)",ASBESTOS:"Asbestos",BUILT_UP:"Built-Up",COMPOSITION:"Composition",CONCRETE:"Concrete",COPPER:"Copper",CORRUGATED_STEEL:"Corrugated Steel",FIBERGLASS:"Fiberglass",FOAM:"Foam",GRAVEL:"Gravel",MEMBRANE:"Membrane",MINERAL_FIBER_SHAKE:"Mineral Fiber Shake",PLASTIC:"Plastic",ROCK:"Rock",ROLLED_PAPER:"Rolled Paper",RUBBER:"Rubber",SLATE:"Slate",TAR:"Tar",TAR_GRAVEL:"Tar and Gravel",TILE_CLAY:"Tile (Clay)",TILE_MISSION:"Tile (Mission)",TILE_SPANISH:"Tile (Spanish)",TIN:"Tin",WOOD_FIBERGLASS_SHINGLES:"Wood/Fiberglass Shingles",WOOD_SHAKE:"Wood Shake",WOOD_SHINGLES:"Wood Shingles",OTHER:"Other"},DD={B_Gable:"Gable",C_Hip:"Hip",A_Flat:"Flat",D_Other:"Other"},RD={NotUpdated:"Not Updated",PartialUpdate:"Partial Update",CompleteUpdate:"Complete Update"},LD={Electric:"Electric",Gas:"Gas",GasForcedAir:"Gas - Forced Air",GasHotWater:"Gas - Hot Water",Oil:"Oil",OilForcedAir:"Oil - Forced Air",OilHotWater:"Oil - Hot Water",SolidFuel:"Solid Fuel",HeatPump:"Heat Pump",Other:"Other"},kD={AboveGround:"Above Ground",BelowGround:"Below Ground"},zD={Basement:"Below Grade Basement",SplitLevelBasement:"Split Level Basement",WalkoutBasement:"Walkout Basement"},jD={EntirelyCopper:"Entirely Copper",EntirelyGalvanized:"Entirely Galvanized",EntirelyPEX:"Entirely PEX",EntirelyPVC:"Entirely PVC",Polybutylene:"Polybutylene"},BD={TwentyFive:"$25,000",Fifty:"$50,000",OneHundred:"$100,000",TwoHundred:"$200,000",ThreeHundred:"$300,000",FourHundred:"$400,000",FiveHundred:"$500,000"},ID={cov1000:"$1,000",cov2000:"$2,000",cov3000:"$3,000",cov4000:"$4,000",cov5000:"$5,000"},UD={TwoHundredFifty:"$250",FiveHundred:"$500",SevenHundredFifty:"$750",OneThousand:"$1,000",OneThousandFiveHundred:"$1,500",TwoThousand:"$2,000",TwoThousandFiveHundred:"$2,500",ThreeThousands:"$3,000",FourThousands:"$4,000",FiveThousands:"$5,000",OnePercent:"1%",TwoPercent:"2%",ThreePercent:"3%",FourPercent:"4%",FivePercent:"5%"},HD={None:"None",OnePercent:"1%",TwoPercent:"2%",FivePercent:"5%",TenPercent:"10%"},$D={_0_500ft:"0-500 Feet",_501_1000ft:"501-1000 Feet",_1001ftAndGreater:"1001 Feet And Greater"},FD={Lessthan5miles:"Less Than 5 Miles",Over5miles:"Over 5 Miles",NotAvailable:"Not Available"},by={"Agriclt/Forestry/Fish":"Agriculture/Forestry/Fishing","Art/Design/Media":"Art/Design/Media","Banking/Finance/RE":"Banking/Finance/Real Estate","Business/Sales/Offi":"Business/Sales/Office","Construct/EnrgyTrds":"Construction/Energy Trades",Disabled:"Disabled","Education/Library":"Education/Library","Engr/Archt/Sci/Math":"Engineer/Architect/Science/Math","Government/Military":"Government/Military","Homemaker/Houseprsn":"Homemaker/House Person","Info Tech":"Information Technology",Insurance:"Insurance","Lgl/Law Enfcmt/Sec":"Legal/Law Enforcement/Security","Maint/Rpr/Hsekeep":"Maintenance/Repair/Housekeeping","Mfg/Production":"Manufacturing/Production","Med/Soc Svcs/Relig":"Medical/Social Services/Religion",Other:"Other","Person.Care/Service":"Personal Care/Service","Rest/Hotel Services":"Restaurant/Hotel Services",Retired:"Retired","Sports/Recreation":"Sports/Recreation",Student:"Student","Trvl/Trnsprt/Warehs":"Travel/Transportation/Warehousing",Unemployed:"Unemployed"},Sy={Single:"Single",Married:"Married",Seperated:"Separated",Divorced:"Divorced",Widowed:"Widowed",DomesticPartner:"Domestic Partner"},Ey={Female:"Female",Male:"Male"},Mv={"Agriclt/Forestry/Fish":"Agriculture/Forestry/Fishing","Art/Design/Media":"Art/Design/Media","Banking/Finance/RE":"Banking/Finance/Real Estate","Business/Sales/Offi":"Business/Sales/Office","Construct/EnrgyTrds":"Construction/Energy Trades",Disabled:"Disabled","Education/Library":"Education/Library","Engr/Archt/Sci/Math":"Engineer/Architect/Science/Math","Government/Military":"Government/Military","Homemaker/Houseprsn":"Homemaker/House person","Info Tech":"Information Technology",Insurance:"Insurance","Lgl/Law Enfcmt/Sec":"Legal/Law Enforcement/Security","Maint/Rpr/Hsekeep":"Maintenance/Repair/Housekeeping","Mfg/Production":"Manufacturing/Production","Med/Soc Svcs/Relig":"Medical/Social Services/Religion",Other:"Other","Person.Care/Service":"Personal Care/Service","Rest/Hotel Services":"Restaurant/Hotel Services",Retired:"Retired","Sports/Recreation":"Sports/Recreation",Student:"Student","Trvl/Trnsprt/Warehs":"Travel/Transportation/Warehousing",Unemployed:"Unemployed"},GD={CONTAMINATION:"Contamination",CREDITCARD:"Credit Card",DAMAGETOPROPERTYOFOTHERS:"Damage To Property Of Others",DOGBITELIABILITY:"Dog Bite",EARTHMOVEMENT:"Earth Movement",EARTHQUAKE:"Earthquake",EXTENDEDCOVERAGEPERILS:"Extended Coverage Perils",FIRE:"Fire",FLOOD:"Flood",FREEZINGWATERINCLUDINGBURSTPIPES:"Freezing Water",HAIL:"Hail",HURRICANE:"Hurricane",LIABILITYALLOTHER:"Liability",LIGHTNING:"Lightning",MEDICALPAYMENTS:"Medical Payments",MYSTERIOUSDISAPPEARANCE:"Mysterious Disappearance",MYSTERIOUSDISAPPEARANCESCHEDULEDPROPERTY:"Mysterious Disappearance - Scheduled Property",PHYSICALDAMAGEALLOTHER:"Physical Damage",SINKHOLE:"Sinkhole",SLIPFALLLIABILITY:"Slip/Fall",SMOKE:"Smoke",THEFTSCHEDULEDPROPERTY:"Theft - Scheduled Property",THEFTBURGLARY:"Theft - Burglary",TORNADO:"Tornado",VANDALISMMALICIOUSMISCHIEF:"Vandalism",WATERDAMAGE:"Water Damage",WIND:"Wind",WORKERSCOMPENSATION:"Workers Compensation",ALLOTHER:"All Other"},YD={Verbal_Threshold:"Limited right to sue",Zero_Threshold:"Unlimited right to sue"},ZD={Primary:"Primary",Secondary:"Secondary"},PD={cov1000:"$1,000",cov10000:"$10,000"},qD={cov100_10400_LIMITED:"100 - 10,400/ LIMITED",cov125_13000_LIMITED:"125 - 13,000/ LIMITED",cov175_18200_LIMITED:"175 - 18,200/ LIMITED",cov250_26000_LIMITED:"250 - 26,000/ LIMITED",cov400_41600_LIMITED:"400 - 41,600/ LIMITED",cov500_52000_LIMITED:"500 - 52,000/ LIMITED",cov600_62400_LIMITED:"600 - 62,400/ LIMITED",cov700_72800_LIMITED:"700 - 72,800/ LIMITED",cov100_UNLIMITED:"100/UNLIMITED",cov125_UNLIMITED:"125/UNLIMITED",cov175_UNLIMITED:"175/UNLIMITED",cov250_UNLIMITED:"250/UNLIMITED",cov400_UNLIMITED:"400/UNLIMITED",cov500_UNLIMITED:"500/UNLIMITED",cov600_UNLIMITED:"600/UNLIMITED",cov700_UNLIMITED:"700/UNLIMITED"},VD={cov250:"$250",cov500:"$500",cov1000:"$1,000",cov2000:"$2,000",cov2500:"$2,500"},KD={"Agriclt/Forestry/Fish":["Agr Inspect/Grader","Arborist","Clerk","Equip. Operator","Farm/Ranch Owner","Farm/Ranch Worker","Fisherman","Florist","Laborer/Worker","Landscape/NursryWkr","Landscaper","Logger","Millworker","Other","Ranger","Supervisor","Timber Grader/Scale"],"Art/Design/Media":["Actor","Admin Assist","Announcer/Broadcstr","Artist/Animator","Author/Writer","Choreography/Dancer","Clerk","Composer/Director","Curator","Designer","Editor","Journalist/Reporter","Musician/Singer","Other","Printer","Producer","Production Crew","Projectionist","Receptionist/Sec","Ticket Sales/Usher"],"Banking/Finance/RE":["Accountant/Auditor","Admin Assist","Analyst/Broker","Bookkeeper","Branch Manager","Clerk","Collections","Consultant","Controller","CSR/Teller","Director/Administr","Executive","Financial Advisor","Investment Banker","Investor","Loan/EscrowProcess","Mgr-Credit/Loan","Mgr-Portfolio/Prod.","Mgr-Property","Other","Realtor","Receptionist/Sec","SalesAgt/Represent.","Trader,Finan Instru","Underwriter"],"Business/Sales/Offi":["Account Executive","Admin Assist","Buyer","Clerk-Office","Consultant","CSR","Director/Administr","Executive","H.R. Representative","Marketing Researchr","Messenger/Courier","Mgr - District","Mgr - Finance","Mgr-Dept/Store","Mgr-General Opers","Mgr-H.R./PublicRel","Mgr-Mkt/Sales","Mgr/Supervisr-Offic","Other","Receptionist/Sec","Sales-Counter/Rentl","Sales-Home Based","Sales-Mfg Rep","Sales-Retail/Whlsle","Sales-Route/Vendor"],"Construct/EnrgyTrds":["Boiler Oper/Maker","Bricklayer/Mason","Carpenter","Carpet Installer","Concrete Worker","Constrct Proj Mgr","Contractor","Crane Operator","Electrician/Linesmn","ElevatorTech/Instl","Equip. Operator","FloorLayer/Finisher","Foreman/Supervisor","Handyman","Heat/Air Technician","Inspector","Laborer/Worker","Metalworker","Miner","Oil/GasDril/RigOpr","Other","Painter","Plstr/Drywall/Stuc","Plumber","Roofer"],Disabled:["Disabled"],"Education/Library":["Admin Assist","Audio-Visual Tech.","Child/DayCare Wrker","Clerk","Counselor","Grad. Teaching/Asst","Instructor-Vocation","Librarian/Curator","Other","Professor, College","Receptionist/Sec","Superintendent","Teacher, College","Teacher, K-12","Teaching Asst/Aide","Tutor"],"Engr/Archt/Sci/Math":["Actuary","Admin Assist","Analyst","Architect","Clerk","Clinical Data Coord.","Drafter","Engineer","Manager-Project","Manager-R&D","Mathematician","Other","Receptionist/Sec","Research Prog. Dir.","Researcher","Scientist","Sociologist","Surveyor/Mapmaker","Technician"],"Government/Military":["Accountant/Auditor","Admin Assist","Analyst","Attorney","Chief Executive","Clerk","Commissioner","Council member","Director/Administr","Enlst Mil Prsnl E1-4","Legislator","Mayor/City Manager","Meter Reader","NCO (E5-9)","Officer-Commissiond","Officer-Warrant","Other","Park Ranger","Planner","Postmaster","Receptionist/Sec","Regulator","US Postal Worker"],"Homemaker/Houseprsn":["Homemaker/Houseprsn"],"Info Tech":["Admin Assist","Analyst","Clerk","Director/Administr","Engineer-Hardware","Engineer-Software","Engineer-Systems","Executive","Manager-Systems","Network Admin","Other","Programmer","Project Coordinator","Receptionist/Sec","Support Technician","Systems Security","Technical Writer","Web Developer"],Insurance:["Accountant/Auditor","Actuarial Clerk","Actuary","Admin Assist","Agent/Broker","Analyst","Attorney","Claims Adjuster","Clerk","Commissioner","CSR","Director/Administr","Executive","Other","Product Manager","Receptionist/Sec","Sales Rep","Underwriter"],"Lgl/Law Enfcmt/Sec":["Airport Sec Ofcr","Animal Control Ofcr","Attorney","Bailiff","Corrections Officer","Court Clrk/Reporter","Deputy Sheriff","Dispatcher","Examiner","Fed Agt/Marshall","Fire Chief","Fire Fighter/Supv.","Gaming Ofcr/Invest","Highway Patrol Ofcr","Judge/Hearing Ofcr","Legal Asst./Sec","Other","Paralegal/Law Clerk","Police Chief","Police Det/Investgr","Police Offcr/Supvr","Process Server","Prvt Invest/Detec.","Security Guard","Sheriff"],"Maint/Rpr/Hsekeep":["Bldg Maint Engineer","Custodian/Janitor","Electrician","Field Service Tech.","Handyman","Heat/AirCond Repair","Housekeeper/Maid","Lndscpe/Grnds Maint","Maint Mechanic","Mechanic","Other"],"Mfg/Production":["Admin Assist","Clerk","Factory Worker","Foreman/Supervisor","Furniture Finisher","Inspector","Jeweler","Machine Operator","Other","Packer","Plant Manager","Printer/Bookbinder","Quality Control","Receptionist/Sec","Refining Operator","Shoemaker","Tailor/Custom Sewer","Textile Worker","Upholsterer"],"Med/Soc Svcs/Relig":["Admin Assist","Assist-Med/Dent/Vet","Clergy","Clerk","Client Care Worker","Dental Hygenist","Dentist","Doctor","Hospice Volunteer","Mortician","Nurse - C.N.A.","Nurse - LPN","Nurse - RN","Nurse Practitioner","Optometrist","Other","Paramedic/EM Tech","Pharmacist","Receptionist/Sec","Social Worker","Support Services","Technician","Therapist","Veterinarian"],Other:["Other"],"Person.Care/Service":["Caregiver","Dry Cleaner/Laundry","Hair Stylist/Barber","Housekeeper","Manicurist","Masseuse","Nanny","Other","Pet Services","Receptionist/Sec"],"Rest/Hotel Services":["Baker","Bartender","Bellhop","Bus Person","Caterer","Chef","Concessionaire","Concierge","Cook-Rest/Cafeteria","Cook/Wrkr-Fast Food","Delivery Person","Desk Clerk","Dishwasher","Food Prod/Packing","Host/Maitre d","Housekeeper/Maid","Manager","Other","Valet","Waiter/Waitress","Wine Steward"],Retired:["Retired"],"Sports/Recreation":["Activity/Recre.Asst","Admin Assist","Agent","Athlete","CampCounselor/Lead","Clerk","Coach","Concessionaire","Director, Program","Event Mgr/Promoter","Life Guard","Mgr - Fitness Club","Other","Park Ranger","Receptionist/Sec","Sales-Tkt/Mmbrshp","SportsBrdcstr/Journ","Trainer/Instructor","Umpire/Referee"],Student:["Graduate Student","High school","Other","Undergraduate"],"Trvl/Trnsprt/Warehs":["Admin Assist","Air Traffic Control","Airport Ops Crew","Bellhop/Porter","Clerk","Crane Loader/Oper","Dispatcher","Driver-Bus/Strcar","Driver-Taxi/Limo","Driver-Truck/Delvry","Flight Attendant","Forklift Operator","Laborer","Longshoreman","Mate/Sailor","Mgr Warehse/Dist","Other","Parking Lot Attend","Pilot/Capt/Eng","Railroad Worker","Receptionist/Sec","Shipping/RecClk","Subway/LgtRail Oper","Ticket Agent","Transportation Spec"],Unemployed:["Unemployed"]},QD={"Agr Inspect/Grader":"Agriculture Inspector/Grader",Arborist:"Arborist",Clerk:"Clerk","Equip. Operator":"Equipment Operator","Farm/Ranch Owner":"Farm/Ranch Owner","Farm/Ranch Worker":"Farm/Ranch Worker",Fisherman:"Fisherman",Florist:"Florist","Laborer/Worker":"Laborer/Worker","Landscape/NursryWkr":"Landscaper/Nursery Worker",Landscaper:"Landscaper",Logger:"Logger",Millworker:"Mill worker",Other:"Other",Ranger:"Ranger",Supervisor:"Supervisor","Timber Grader/Scale":"Timber Grader/Scale",Actor:"Actor","Admin Assist":"Administrative Assistant","Announcer/Broadcstr":"Announcer/Broadcaster","Artist/Animator":"Artist/Animator","Author/Writer":"Author/Writer","Choreography/Dancer":"Choreography/Dancer","Composer/Director":"Composer/Director",Curator:"Curator",Designer:"Designer",Editor:"Editor","Journalist/Reporter":"Journalist/Reporter","Musician/Singer":"Musician/Singer",Printer:"Printer",Producer:"Producer","Production Crew":"Production Crew",Projectionist:"Projectionist","Receptionist/Sec":"Receptionist/Secretary","Ticket Sales/Usher":"Ticket Sales/Usher","Accountant/Auditor":"Accountant/Auditor","Analyst/Broker":"Analyst/Broker",Bookkeeper:"Bookkeeper","Branch Manager":"Branch Manager",Collections:"Collections",Consultant:"Consultant",Controller:"Controller","CSR/Teller":"CSR/Teller","Director/Administr":"Director/Administrator",Executive:"Executive","Financial Advisor":"Financial Advisor","Investment Banker":"Investment Banker",Investor:"Investor","Loan/EscrowProcess":"Loan/Escrow Processor","Mgr-Credit/Loan":"Manager-Credit/Loan","Mgr-Portfolio/Prod.":"Manager-Portfolio/Production","Mgr-Property":"Manager-Property",Realtor:"Realtor","SalesAgt/Represent.":"Sales Agent/Representative","Trader,Finan Instru":"Trader, Financial Instruments",Underwriter:"Underwriter","Account Executive":"Account Executive",Buyer:"Buyer","Clerk-Office":"Clerk-Office",CSR:"Customer Service Representative","H.R. Representative":"H.R. Representative","Marketing Researchr":"Marketing Researcher","Messenger/Courier":"Messenger/Courier","Mgr - District":"Manager - District","Mgr - Finance":"Manager - Finance","Mgr-Dept/Store":"Manager - Department/Store","Mgr-General Opers":"Manager - General Operations","Mgr-H.R./PublicRel":"Manager - H.R./Public Relations","Mgr-Mkt/Sales":"Manager - Marketing/Sales","Mgr/Supervisr-Offic":"Manager/Supervisor - Office","Sales-Counter/Rentl":"Sales-Counter/Rental","Sales-Home Based":"Sales-Home Based","Sales-Mfg Rep":"Sales-Manufacture Rep","Sales-Retail/Whlsle":"Sales-Retail/Wholesale","Sales-Route/Vendor":"Sales-Route/Vendor","Boiler Oper/Maker":"Boiler Operator/Maker","Bricklayer/Mason":"Bricklayer/Mason",Carpenter:"Carpenter","Carpet Installer":"Carpet Installer","Concrete Worker":"Concrete Worker","Constrct Proj Mgr":"Construction - Project Manager",Contractor:"Contractor","Crane Operator":"Crane Operator","Electrician/Linesmn":"Electrician/Linesman","ElevatorTech/Instl":"Elevator Technician/Installer","FloorLayer/Finisher":"Floor Layer/Finisher","Foreman/Supervisor":"Foreman/Supervisor",Handyman:"Handyman","Heat/Air Technician":"Heat/Air Technician",Inspector:"Inspector",Metalworker:"Metalworker",Miner:"Miner","Oil/GasDril/RigOpr":"Oil/Gas Driller/Rig Operator",Painter:"Painter","Plstr/Drywall/Stuc":"Plaster/Drywall/Stucco",Plumber:"Plumber",Roofer:"Roofer",Disabled:"Disabled","Audio-Visual Tech.":"Audio-Visual Tech.","Child/DayCare Wrker":"Child/Daycare Worker",Counselor:"Counselor","Grad. Teaching/Asst":"Graduate Teaching Assistant","Instructor-Vocation":"Instructor-Vocation","Librarian/Curator":"Librarian/Curator","Professor, College":"Professor, College",Superintendent:"Superintendent","Teacher, College":"Teacher, College","Teacher, K-12":"Teacher, K-12","Teaching Asst/Aide":"Teaching Assistant/Aide",Tutor:"Tutor",Actuary:"Actuary",Analyst:"Analyst",Architect:"Architect","Clinical Data Coord.":"Clinical Data Coordinator",Drafter:"Drafter",Engineer:"Engineer","Manager-Project":"Manager-Project","Manager-R&D":"Manager-R&D",Mathematician:"Mathematician","Research Prog. Dir.":"Research Program Director",Researcher:"Researcher",Scientist:"Scientist",Sociologist:"Sociologist","Surveyor/Mapmaker":"Surveyor/Mapmaker",Technician:"Technician",Attorney:"Attorney","Chief Executive":"Chief Executive",Commissioner:"Commissioner","Council member":"Council member","Enlst Mil Prsnl E1-4":"Enlisted Military Personnel (E1-4)",Legislator:"Legislator","Mayor/City Manager":"Mayor/City Manager","Meter Reader":"Meter Reader","NCO (E5-9)":"NCO (E5-9)","Officer-Commissiond":"Officer-Commissioned","Officer-Warrant":"Officer-Warrant","Park Ranger":"Park Ranger",Planner:"Planner",Postmaster:"Postmaster",Regulator:"Regulator","US Postal Worker":"US Postal Worker","Homemaker/Houseprsn":"Homemaker/House person","Engineer-Hardware":"Engineer-Hardware","Engineer-Software":"Engineer-Software","Engineer-Systems":"Engineer-Systems","Manager-Systems":"Manager-Systems","Network Admin":"Network Administrator",Programmer:"Programmer","Project Coordinator":"Project Coordinator","Support Technician":"Support Technician","Systems Security":"Systems Security","Technical Writer":"Technical Writer","Web Developer":"Web Developer","Actuarial Clerk":"Actuarial Clerk","Agent/Broker":"Agent/Broker","Claims Adjuster":"Claims Adjuster","Product Manager":"Product Manager","Sales Rep":"Sales Representative","Airport Sec Ofcr":"Airport Security Officer","Animal Control Ofcr":"Animal Control Officer",Bailiff:"Bailiff","Corrections Officer":"Corrections Officer","Court Clrk/Reporter":"Court Clerk/Reporter","Deputy Sheriff":"Deputy Sheriff",Dispatcher:"Dispatcher",Examiner:"Examiner","Fed Agt/Marshall":"Federal Agent/Marshall","Fire Chief":"Fire Chief","Fire Fighter/Supv.":"Fire Fighter/Supervisor","Gaming Ofcr/Invest":"Gaming Officer/Investigator","Highway Patrol Ofcr":"Highway Patrol Officer","Judge/Hearing Ofcr":"Judge/Hearing Officer","Legal Asst./Sec":"Legal Assistant/Secretary","Paralegal/Law Clerk":"Paralegal/Law Clerk","Police Chief":"Police Chief","Police Det/Investgr":"Police Detective/Investigator","Police Offcr/Supvr":"Police Officer/Supervisor","Process Server":"Process Server","Prvt Invest/Detec.":"Private Investigator/Detective","Security Guard":"Security Guard",Sheriff:"Sheriff","Bldg Maint Engineer":"Building Maintenance Engineer","Custodian/Janitor":"Custodian/Janitor",Electrician:"Electrician","Field Service Tech.":"Field Service Technician","Heat/AirCond Repair":"Heat/Air Conditioner Repairman","Housekeeper/Maid":"Housekeeper/Maid","Lndscpe/Grnds Maint":"Landscape/Grounds Maintenance","Maint Mechanic":"Maintenance Mechanic",Mechanic:"Mechanic","Factory Worker":"Factory Worker","Furniture Finisher":"Furniture Finisher",Jeweler:"Jeweler","Machine Operator":"Machine Operator",Packer:"Packer","Plant Manager":"Plant Manager","Printer/Bookbinder":"Printer/Bookbinder","Quality Control":"Quality Control","Refining Operator":"Refining Operator",Shoemaker:"Shoemaker","Tailor/Custom Sewer":"Tailor/Custom Sewer","Textile Worker":"Textile Worker",Upholsterer:"Upholsterer","Assist-Med/Dent/Vet":"Assistant - Medic/Dent/Vet",Clergy:"Clergy","Client Care Worker":"Client Care Worker","Dental Hygenist":"Dental Hygienist",Dentist:"Dentist",Doctor:"Doctor","Hospice Volunteer":"Hospice Volunteer",Mortician:"Mortician","Nurse - C.N.A.":"Nurse - C.N.A.","Nurse - LPN":"Nurse - LPN","Nurse - RN":"Nurse - RN","Nurse Practitioner":"Nurse Practitioner",Optometrist:"Optometrist","Paramedic/EM Tech":"Paramedic/E.M. Technician",Pharmacist:"Pharmacist","Social Worker":"Social Worker","Support Services":"Support Services",Therapist:"Therapist",Veterinarian:"Veterinarian",Caregiver:"Caregiver","Dry Cleaner/Laundry":"Dry Cleaner/Laundry","Hair Stylist/Barber":"Hair Stylist/Barber",Housekeeper:"Housekeeper",Manicurist:"Manicurist",Masseuse:"Masseuse",Nanny:"Nanny","Pet Services":"Pet Services",Baker:"Baker",Bartender:"Bartender",Bellhop:"Bellhop","Bus Person":"Bus Person",Caterer:"Caterer",Chef:"Chef",Concessionaire:"Concessionaire",Concierge:"Concierge","Cook-Rest/Cafeteria":"Cook - Restaurant/Cafeteria","Cook/Wrkr-Fast Food":"Cook/Worker-Fast Food","Delivery Person":"Delivery Person","Desk Clerk":"Desk Clerk",Dishwasher:"Dishwasher","Food Prod/Packing":"Food Production/Packing","Host/Maitre d":"Host/Maitre d",Manager:"Manager",Valet:"Valet","Waiter/Waitress":"Waiter/Waitress","Wine Steward":"Wine Steward",Retired:"Retired","Activity/Recre.Asst":"Activity/Recreational Assistant",Agent:"Agent",Athlete:"Athlete","CampCounselor/Lead":"Camp Counselor/Lead",Coach:"Coach","Director, Program":"Director, Program","Event Mgr/Promoter":"Event Manager/Promoter","Life Guard":"Life Guard","Mgr - Fitness Club":"Manager - Fitness Club","Sales-Tkt/Mmbrshp":"Sales-Ticket/Membership","SportsBrdcstr/Journ":"Sports Broadcaster/Journalist","Trainer/Instructor":"Trainer/Instructor","Umpire/Referee":"Umpire/Referee","Graduate Student":"Graduate Student","High school":"High school",Undergraduate:"Undergraduate","Air Traffic Control":"Air Traffic Control","Airport Ops Crew":"Airport Operations Crew","Bellhop/Porter":"Bellhop/Porter","Crane Loader/Oper":"Crane Loader/Operator","Driver-Bus/Strcar":"Driver - Bus/Streetcar","Driver-Taxi/Limo":"Driver-Taxi/Limo","Driver-Truck/Delvry":"Driver-Truck/Delivery","Flight Attendant":"Flight Attendant","Forklift Operator":"Forklift Operator",Laborer:"Laborer",Longshoreman:"Longshoreman","Mate/Sailor":"Mate/Sailor","Mgr Warehse/Dist":"Manager - Warehouse/District","Parking Lot Attend":"Parking Lot Attendant","Pilot/Capt/Eng":"Pilot/Captain/Engineer","Railroad Worker":"Railroad Worker","Shipping/RecClk":"Shipping/Receiving Clerk","Subway/LgtRail Oper":"Subway/Light Rail Operator","Ticket Agent":"Ticket Agent","Transportation Spec":"Transportation Specialist",Unemployed:"Unemployed"},Ay=KD,xv=QD;function Kd(t,n){if(typeof t!="string")return t;const a=t.trim();if(!a)return t;if(n[a])return a;const o=a.toLowerCase();return Object.keys(n).find(f=>f.toLowerCase()===o||n[f]?.toLowerCase()===o)??t}function Fl(t){return Kd(t,Mv)}function Dv(t){return Kd(t,wv)}function Rv(t){return Kd(t,xv)}function XD(t){return t.trim().toLowerCase()}function Ty(t){if(typeof t!="string")return null;const n=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n)return null;const a=Number(n[1]),o=Number(n[2]),l=Number(n[3]);if(!Number.isFinite(a)||!Number.isFinite(o)||!Number.isFinite(l)||o<1||o>12||l<1||l>31)return null;const f=new Date(Date.UTC(a,o-1,l));return f.getUTCFullYear()!==a||f.getUTCMonth()!==o-1||f.getUTCDate()!==l?null:f.getTime()}function wi(t,n){if(!n.effectiveDateKey||!n.expirationDateKey)return!1;const a=Ty(t[n.expirationDateKey]),o=Ty(t[n.effectiveDateKey]);return a==null||o==null?!1:a<o}const WD=new Set(["HomePolicy","BundlePolicy"]);function Nl(t,n,a){return String(t.key??"")!=="lapse_in_coverage"||!a||!WD.has(a)?!0:n.home_prior_carrier_name!=="NoPriorInsurance"}function Qd(t){let n=null,a=null,o=null;const l=new Set,f=new Set,d=_=>{const h=String(_.key??""),v=XD(String(_.question??""));!n&&(h==="auto_prior_carrier_name"||h==="home_prior_carrier_name"||v.includes("current auto insurance company"))&&(n=h),!a&&(h==="effective_date"||v.includes("when do you need your insurance to begin"))&&(a=h),!o&&(h==="auto_prior_expiration_date"||h==="home_prior_expiration_date"||v.includes("when does the current policy expire"))&&(o=h),(h==="auto_reason_for_no_insurance"||v.includes("reason you are not currently insured")||v.includes("reason for lapse in coverage"))&&l.add(h),(h==="auto_prior_years"||h==="auto_prior_months"||h==="auto_continuous_coverage_years"||h==="auto_prior_expiration_date"||h==="auto_current_annual_premium_cents"||h==="auto_prior_liability_limit")&&f.add(h)};t.forEach(d);const m=_=>{_.forEach(h=>{(h.conditionals??[]).forEach(v=>{const b=v.conditionalQuestions??[];b.forEach(d),m(b)})})};return m(t),{currentCarrierKey:n,effectiveDateKey:a,expirationDateKey:o,noInsuranceReasonKeys:l,hideWhenNoPriorInsuranceKeys:f}}function Go(t,n){return n.currentCarrierKey==="home_prior_carrier_name"&&t.home_prior_carrier_name==="NoPriorInsurance"&&t.auto_prior_carrier_name!=="NoPriorInsurance"?!1:(n.currentCarrierKey?t[n.currentCarrierKey]:void 0)==="NoPriorInsurance"?!0:!n.effectiveDateKey||!n.expirationDateKey||n.expirationDateKey==="home_prior_expiration_date"&&wi(t,n)?!1:wi(t,n)}function wl(t,n,a){const o=String(t.key??"");if(a.noInsuranceReasonKeys.has(o)&&a.currentCarrierKey==="home_prior_carrier_name"&&n.home_prior_carrier_name==="NoPriorInsurance"&&n.auto_prior_carrier_name!=="NoPriorInsurance")return!1;const f=(a.currentCarrierKey?n[a.currentCarrierKey]:void 0)==="NoPriorInsurance";return f&&a.hideWhenNoPriorInsuranceKeys.has(o)?!1:!a.noInsuranceReasonKeys.has(o)||f?!0:Go(n,a)}function Gl(t,n){const a=String(t.key??"");return n.noInsuranceReasonKeys.has(a)}const JD=["ACURA","ALFA ROMEO","ASTON MARTIN","AUDI","BENTLEY","BMW","BUGATTI","BUICK","CADILLAC","CHEVROLET","CHRYSLER","CRUISE","DODGE","FERRARI","FIAT","FORD","FREIGHTLINER","GENESIS","GLOBAL ELECTRIC MOTORS","GMC","HONDA","HYUNDAI","INFINITI","JAGUAR","JEEP","KARMA AUTOMOTIVE","KIA","LAMBORGHINI","LAND ROVER","LEXUS","LINCOLN","LOTUS","MASERATI","MAZDA","MCLAREN AUTOMOTIVE","MERCEDES-BENZ","MINI","MITSUBISHI","NISSAN","POLESTAR","PORSCHE","RAM","ROLLS-ROYCE","SUBARU","TESLA","TOYOTA","VOLKSWAGEN","VOLVO"],Xd="credify_quote_id",Wd="credify_auth_token";function Cy(t){try{localStorage.setItem(Xd,t)}catch(n){console.error("Failed to save quoteId to localStorage:",n)}}function ac(){try{return localStorage.getItem(Xd)}catch(t){return console.error("Failed to load quoteId from localStorage:",t),null}}function Lv(){try{localStorage.removeItem(Xd)}catch(t){console.error("Failed to clear quoteId from localStorage:",t)}}function eR(t){try{localStorage.setItem(Wd,t)}catch(n){console.error("Failed to save authToken to localStorage:",n)}}function tR(){try{return localStorage.getItem(Wd)}catch(t){return console.error("Failed to load authToken from localStorage:",t),null}}function kv(){try{localStorage.removeItem(Wd)}catch(t){console.error("Failed to clear authToken from localStorage:",t)}}function nR(){Lv(),kv()}const rR="credify-insurance-widget",aR="1.0",zv=25,jv=64*1024,iR=`
|
|
110
|
-
…[truncated]`;let Oy=!1,Ny=null,wy="",Bv=zv,yd=jv,Ho=[];function oR(t){return typeof t=="string"?t:t instanceof URL?t.href:t.url}function sR(t,n){return n?.method?n.method.toUpperCase():typeof t!="string"&&!(t instanceof URL)&&t.method?t.method.toUpperCase():"GET"}function My(t){if(!t)return[];const n=[];if(Array.isArray(t))for(const[a,o]of t)n.push({name:a,value:String(o)});else if(typeof t.forEach=="function")t.forEach((a,o)=>n.push({name:o,value:a}));else for(const[a,o]of Object.entries(t))n.push({name:a,value:String(o)});return n}function lR(t){try{const n=[];return new URL(t).searchParams.forEach((a,o)=>n.push({name:o,value:a})),n}catch{return[]}}function cR(t,n){const a=n?.body;return typeof a!="string"||a.length===0?void 0:{mimeType:t.find(l=>l.name.toLowerCase()==="content-type")?.value??"application/json",text:a}}function uR(t){const n=t.length;return n<=yd?{text:t,size:n}:{text:t.slice(0,yd)+iR,size:n}}function fR(t){Ho.push(t),Ho.length>Bv&&Ho.shift()}function dR(t){if(Oy)return!0;if(typeof window>"u"||typeof window.fetch!="function")return!1;wy=t.baseUrl,Bv=t.maxEntries??zv,yd=t.maxBodyBytes??jv,Ny=window.fetch.bind(window);const n=Ny;return window.fetch=async(a,o)=>{let l;try{l=oR(a)}catch{return n(a,o)}if(!l.startsWith(wy))return n(a,o);const f=My(o?.headers??(typeof a!="string"&&!(a instanceof URL)?a.headers:void 0)),d={startedDateTime:new Date().toISOString(),time:-1,request:{method:sR(a,o),url:l,httpVersion:"HTTP/1.1",headers:f,queryString:lR(l),cookies:[],headersSize:-1,bodySize:typeof o?.body=="string"?o.body.length:-1,postData:cR(f,o)},response:mR(),cache:{},timings:{send:0,wait:-1,receive:0}};fR(d);const m=typeof performance<"u"?performance.now():0;let _;try{_=await n(a,o)}catch(v){const b=(typeof performance<"u"?performance.now():0)-m;throw d.time=Math.round(b),d.timings.wait=Math.round(b),d.response._error=v instanceof Error?v.message:String(v),v}const h=(typeof performance<"u"?performance.now():0)-m;d.time=Math.round(h),d.timings.wait=Math.round(h),d.response.status=_.status,d.response.statusText=_.statusText,d.response.headers=My(_.headers),d.response.content.mimeType=typeof _.headers?.get=="function"&&_.headers.get("content-type")||"";try{_.clone().text().then(b=>{const{text:N,size:w}=uR(b);d.response.content.text=N,d.response.content.size=w,d.response.bodySize=w}).catch(()=>{})}catch{}return _},Oy=!0,!0}function mR(){return{status:0,statusText:"",httpVersion:"HTTP/1.1",headers:[],cookies:[],content:{size:0,mimeType:""},redirectURL:"",headersSize:-1,bodySize:-1}}function pR(){return{log:{version:"1.2",creator:{name:rR,version:aR},entries:Ho.map(t=>({...t}))}}}function _R(){return Ho.length}const hR=[/ssn/i,/social.?security/i,/(driver.?licen[cs]e|^dln$|^dl$)/i,/(date.?of.?birth|^dob$)/i,/^vin$/i,/(sms.?code|^otp$|^code$|verification.?code)/i,/phone/i,/^email$/i,/(first.?name|last.?name|full.?name)/i,/(^address$|street|^zip$|postal)/i,/(jwt|^token$|authorization|^auth$|api.?key|secret|password|credential)/i,/cookie/i],gR=[/\b\d{3}-?\d{2}-?\d{4}\b/g,/\b[A-HJ-NPR-Z0-9]{17}\b/g,/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,/\bsk_[A-Za-z0-9]{16,}\b/g,/\bBearer\s+[A-Za-z0-9._-]+/gi],Xr="[REDACTED]",yR=8;function ic(t){for(const n of hR)if(n.test(t))return!0;return!1}function Wr(t){let n=t;for(const a of gR)n=n.replace(a,Xr);return n}function qr(t,n=0,a=new WeakSet){if(n>yR)return Xr;if(t==null)return t;if(typeof t=="string")return Wr(t);if(typeof t!="object")return t;if(a.has(t))return Xr;if(a.add(t),Array.isArray(t))return t.map(f=>qr(f,n+1,a));const o=Object.getPrototypeOf(t);if(o!==null&&o!==Object.prototype)return t;const l={};for(const[f,d]of Object.entries(t)){if(ic(f)){l[f]=Xr;continue}l[f]=qr(d,n+1,a)}return l}function xy(t){if(t.request&&(t.request.data!==void 0&&(t.request.data=qr(t.request.data)),t.request.cookies!==void 0&&(t.request.cookies=Xr),t.request.headers)){const n=t.request.headers;for(const a of Object.keys(n))ic(a)&&(n[a]=Xr)}if(t.extra&&(t.extra=qr(t.extra)),t.contexts&&(t.contexts=qr(t.contexts)),t.tags&&(t.tags=qr(t.tags)),t.user){const{id:n,email:a,username:o}=t.user;t.user={...typeof n=="string"?{id:n}:{},...typeof a=="string"?{email:a}:{},...typeof o=="string"?{username:o}:{}}}if(Array.isArray(t.breadcrumbs))for(const n of t.breadcrumbs)n.data!==void 0&&(n.data=qr(n.data)),typeof n.message=="string"&&(n.message=Wr(n.message));return typeof t.message=="string"&&(t.message=Wr(t.message)),t}function Dy(t){for(const n of t)n.value=ic(n.name)?Xr:Wr(n.value)}function Ry(t){try{return JSON.stringify(qr(JSON.parse(t)))}catch{return Wr(t)}}function vR(t){const n=JSON.parse(JSON.stringify(t));for(const a of n.log.entries){Dy(a.request.headers),Dy(a.response.headers);for(const o of a.request.queryString)o.value=ic(o.name)?Xr:Wr(o.value);a.request.postData?.text&&(a.request.postData.text=Ry(a.request.postData.text)),a.response.content.text&&(a.response.content.text=Ry(a.response.content.text)),a.request.url=Wr(a.request.url),a.response._error&&(a.response._error=Wr(a.response._error))}return n}function Ai(t,n={}){try{kd(a=>{a.setTag("failure_type","quote"),n.stage&&a.setTag("stage",n.stage),n.quoteId&&a.setTag("quote_id",n.quoteId),n.phase&&a.setTag("phase",n.phase),n.endpoint&&a.setTag("endpoint",n.endpoint),typeof n.statusCode=="number"&&a.setTag("status_code",String(n.statusCode));try{_R()>0&&a.addAttachment({filename:"quote-failure.har",data:JSON.stringify(vR(pR())),contentType:"application/json"})}catch{}const o=t instanceof Error?t:new Error(n.message??"Quote failed");ec(o)})}catch{}}const Zt="https://api.getcredify.com";let zi=null;const bR=6e4,Ly=new Map;function SR(t){try{return new URL(t).pathname}catch{return t}}function ky(t,n,a){if(!(a>=500&&a<600)&&!(a===0))return;t.__sentryReported=!0;const f=SR(n),d=`${f}:${a}`,m=Date.now(),_=Ly.get(d);_&&m-_<bR||(Ly.set(d,m),Ai(t,{phase:"api_request",endpoint:f,statusCode:a}))}function Bf(t){zi=t,eR(t)}function Ti(){return zi}function vd(){const t=tR();t&&(zi=t)}function Iv(){zi=null,kv()}async function gn(t,n){const a={"Content-Type":"application/json"};zi&&(a.Authorization=`Bearer ${zi}`);let o;try{o=await fetch(t,{method:"POST",headers:a,body:JSON.stringify(n)})}catch(l){const f=l instanceof Error?l:new Error(String(l));throw ky(f,t,0),l}if(!o.ok){let l=`Request failed with status ${o.status}`;try{l=(await o.json()).error||l}catch{l=o.statusText||l}const f=new Error(l);throw f.statusCode=o.status,ky(f,t,o.status),f}return o}async function ER(t){try{return await t.json()}catch{return{}}}async function AR(t,n){const a=n?{stage:t,quoteId:n}:{stage:t};return await(await gn(`${Zt}/get-questions-by-stage`,a)).json()}async function El(t){const n=t?{quoteId:t}:{};return await(await gn(`${Zt}/get-stages-for-quote`,n)).json()}async function TR(t){const a=await(await gn(`${Zt}/create-quote`,{postal_code:t})).json();if(!a||typeof a!="object"||!a.quoteId)throw new Error(`Invalid createQuote response: ${JSON.stringify(a)}`);return a}async function CR(t,n){return await(await gn(`${Zt}/verify-quote`,{action:"send",quoteId:t,phone:n})).json()}async function Si(t,n,a){const o={payload:t,getRates:n};a&&typeof a=="string"&&a.trim()!==""&&(o.quoteId=a);const l=await gn(`${Zt}/update-quote`,o),f=await ER(l);return!f||typeof f!="object"||!("status"in f)||f.status==null?{status:"success"}:f}async function zy(t,n){return await(await gn(`${Zt}/verify-quote`,{quoteId:t,smsCode:n})).json()}async function OR(t){return await(await gn(`${Zt}/verify-quote`,{action:"resume",resumeToken:t})).json()}async function NR(t,n){const a={state:t};return n&&typeof n=="string"&&n.trim()!==""&&(a.quoteId=n),await(await gn(`${Zt}/is-supported-state`,a)).json()}async function If(){return await(await gn(`${Zt}/get-rates`,{})).json()}async function jy(t){const n=t?{quoteId:t}:{};return await(await gn(`${Zt}/get-quote`,n)).json()}async function By(t){return(await gn(`${Zt}/get-vehicle-options`,t)).json()}async function wR(t){return(await gn(`${Zt}/get-vehicle-options`,{...t,action:"vinDecode"})).json()}async function MR(t,n){const o=await(await gn(`${Zt}/request-bind`,{quoteRateId:t,privacyNoticeAcknowledged:n})).json();return o&&typeof o=="object"&&"success"in o?o:{success:!0}}const Uf=new Set(["auto_prior_years","auto_prior_months","auto_continuous_coverage_years"]),xR={None:"None","30000/60000/25000":"30/60k","30000/60000/30000":"30/60k","50000/100000/30000":"50/100k","50000/100000/50000":"50/100k","100000/300000/50000":"100/300k","100000/300000/100000":"100/300k","250000/500000/100000":"250/500k","250000/500000/250000":"250/500k","300000/500000/250000":"300/500k","300000/500000/300000":"300/500k","500000/500000/300000":"500k CSL","500000/500000/500000":"500k CSL","500000/1000000/300000":"500k/1M","500000/1000000/500000":"500k/1M"},Iy={auto_prior_carrier_name:rD,auto_prior_liability_limit:sD,auto_reason_for_no_insurance:lD,residence_type:aD,home_prior_carrier_name:iD,policy_bi:cD,policy_um:uD,policy_pd:fD,policy_mp:dD,policy_umpd:mD,policy_pip:pD,policy_auto_death_indemnity:_D,vehicle_comp_deductible:hd,vehicle_coll_deductible:hd,vehicle_towing_and_labor:gd,vehicle_transportation_expense:Nv,education_level:wv,industry:Mv,occupation:xv,usage:oD,architectural_style:SD,dwelling_type:ED,occupancy_type:AD,construction_quality:TD,construction_type:CD,foundation_type:OD,located_over_water:ND,number_of_stories:wD,exterior_wall_type:MD,roof_material_type:xD,roof_shape:DD,roof_updated_type:RD,heating_type:LD,oil_tank_location:kD,basement_type:zD,plumbing_type:jD,personal_liability:BD,dwelling_medical_payments:ID,all_perils_deductible:UD,windstorm_deductible:HD,distance_from_fire_hydrant_ft:$D,distance_from_fire_station_miles:FD,employment_industry:by,marital_status:Sy,gender:Ey,co_applicant_employment_industry:by,co_applicant_marital_status:Sy,co_applicant_gender:Ey,description:GD,tort_threshold:YD,pip_coverage_type:ZD,extended_medical:PD,additional_pip:qD,policy_pip_deductible:VD},DR=["OTHER / NOT LISTED"],RR=["SEDAN","SUV","COUPE","HATCHBACK","PICKUP","VAN","WAGON","OTHER"],LR=["Other"];function pn(t){const n=t.getUTCFullYear(),a=String(t.getUTCMonth()+1).padStart(2,"0"),o=String(t.getUTCDate()).padStart(2,"0");return`${n}-${a}-${o}`}function Uy(t){const n=t.replace(/\D+/g,"");if(n!=="")return nD(n)}function kR(t){return t==="-"||t==="+"||t==="."||t==="e"||t==="E"}const zR={year_built:4,year_roof_updated:4,heating_update_year:4,plumbing_update_year:4,electrical_update_year:4,total_area_sq_ft:6,sale_price_cents:9,dwelling_replacement_cost:9,other_structures_coverage:9,personal_property_coverage:7,amount_paid_cents:7,loss_of_use_coverage:8,home_prior_years:2,home_continuous_coverage_years:2,number_of_dogs:2,number_of_units:2,months_at_address:2,years_at_address:3,years_at_prior_address:3,distance_to_coast_miles:4,household_size:1,number_of_families:1,number_of_mortgagees:1,annual_mileage:6,miles_to_work:4,custom_equipment_value_cents:7,cost_new_value_cents:7,stated_value_amount_cents:7,property_damage_amount_paid_cents:7,personal_injury_amount_paid_cents:7,auto_current_annual_premium_cents:7,auto_prior_years:2,auto_prior_months:2,auto_continuous_coverage_years:2},Hy=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"]),jR=new Set(["total_area_sq_ft","annual_mileage","miles_to_work","distance_to_coast_miles"]),Al={first_name:"given-name",last_name:"family-name",co_applicant_first_name:"given-name",co_applicant_last_name:"family-name",date_of_birth:"bday",co_applicant_date_of_birth:"bday",sms_code:"one-time-code",vin:"off",license_number:"off",effective_date:"off"},BR={license_number:20};function IR(t){const n=new Date,a=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()));if(t==="effective_date"){const o=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth()+3,a.getUTCDate()));return{min:pn(a),max:pn(o)}}if(t==="home_prior_expiration_date"){const o=new Date(Date.UTC(a.getUTCFullYear()-1,a.getUTCMonth(),a.getUTCDate())),l=new Date(Date.UTC(a.getUTCFullYear()+1,a.getUTCMonth(),a.getUTCDate()));return{min:pn(o),max:pn(l)}}if(t==="date_of_incident")return{max:pn(a)};if(t==="move_in_date")return{max:pn(a)};if(t==="purchase_date")return{max:pn(a)};if(t==="date_of_birth")return{max:pn(a)};if(t==="date_first_licensed")return{max:pn(a)};if(t==="occurred_at")return{max:pn(a)};if(t==="accident_prevention_course_date")return{max:pn(a)};if(t==="auto_prior_expiration_date"){const o=new Date(Date.UTC(a.getUTCFullYear()-1,a.getUTCMonth(),a.getUTCDate())),l=new Date(Date.UTC(a.getUTCFullYear()+1,a.getUTCMonth(),a.getUTCDate()));return{min:pn(o),max:pn(l)}}return{}}const UR=new Set(["Disabled","Retired","Unemployed","Other"]);function Hf(t,n,a){const o=String(t.key??"");if(o!=="occupation"&&o!=="co_applicant_occupation"||o==="co_applicant_occupation")return!0;const l=It(n,a,"industry"),f=It(n,a,"employment_industry"),d=String(l??f??"").trim();return!UR.has(d)}function $f(t,n,a,o){return Tv(t,o,a)}function Ml(t){return t.inputType!=="radio"||!t.options||t.options.length!==1||t.options[0]!=="Yes"?!1:(t.conditionals??[]).some(a=>a.conditionalQuestionsAllowMultiple&&a.conditionalType==="equals"&&a.conditionalValue==="Yes")}function $y(t,n){return Ml(t)?"Yes":n}function Fy(t){return typeof t=="number"&&Number.isFinite(t)?t:typeof t=="string"&&t.trim()!==""&&!Number.isNaN(Number(t))?Number(t):null}function Gy(t){if(t instanceof Date&&!Number.isNaN(t.getTime()))return t.getTime();if(typeof t=="string"){const n=Date.parse(t);return Number.isNaN(n)?null:n}return null}function Yy(t,n){const a=Fy(t),o=Fy(n);if(a!=null&&o!=null)return a-o;const l=Gy(t),f=Gy(n);return l!=null&&f!=null?l-f:t==null||n==null?null:String(t).localeCompare(String(n))}function HR(t,n){return Array.isArray(t)?t.some(a=>a===n):typeof t=="string"?n!=null&&t.includes(String(n)):!1}function ko(t,n,a){switch(n){case"equals":return t===a;case"notEquals":return t!==a&&t!==""&&t!=null;case"lessThan":{const o=Yy(t,a);return o!=null&&o<0}case"greaterThan":{const o=Yy(t,a);return o!=null&&o>0}case"contains":return HR(t,a);case"startsWith":return t!=null&&a!=null&&String(t).startsWith(String(a));case"endsWith":return t!=null&&a!=null&&String(t).endsWith(String(a));default:return!1}}function Io(t,n){return n.reduce((a,o)=>a?.[o],t)}function Un(t,n,a){if(n.length===0)return t;const[o,...l]=n;if(l.length===0){if(typeof o=="number"){const h=(Array.isArray(t)?t:[]).slice();return h[o]=a,h}return{...t,[o]:a}}const f=t?.[o],d=typeof l[0]=="number"?Array.isArray(f)?f:[]:f&&typeof f=="object"?f:{},m=Un(d,l,a);if(typeof o=="number"){const h=(Array.isArray(t)?t:[]).slice();return h[o]=m,h}return{...t,[o]:m}}function It(t,n,a){return Io(t,[...n??[],a])}function Yt(t,n,a,o){return Un(t,[...n??[],a],o)}function $R(t,n){return t?.length?`${t.join("-")}-${n}`:n}const FR="__items",Tl=t=>`${t}${FR}`;function rn(t){return t==null?"":typeof t=="string"?t:String(t)}function Zy(t){return t==null?"":typeof t=="number"&&Number.isFinite(t)||typeof t=="string"?t:""}function GR(t){return t==null?"":typeof t=="string"||typeof t=="number"?t:String(t)}function YR({questions:t,initialValues:n,controlledValues:a,onChangeValues:o,onSubmit:l,quoteId:f,widgetStageKey:d}){const m=B.useMemo(()=>$d(t),[t]),_=B.useMemo(()=>Qd(m),[m]),h=B.useMemo(()=>d==="BundlePolicy"?!0:m.some(C=>String(C.key)==="home_prior_carrier_name")&&m.some(C=>String(C.key)==="driver_vehicle_assignments"),[d,m]),v=B.useMemo(()=>{const C={};return n&&Object.assign(C,n),C},[n]),[b,N]=B.useState(v);B.useEffect(()=>{N(v)},[v]);const[w,D]=B.useState({}),k=B.useMemo(()=>({...w,...a??b}),[w,a,b]);B.useEffect(()=>{a&&D(C=>({...C,...a}))},[a]);const[ue,ne]=B.useState({}),se=B.useRef(new Map),W=B.useRef(new Set),[,oe]=B.useState({}),[F,ie]=B.useState({}),te=B.useRef(!1);B.useEffect(()=>{!f||te.current||!m.some(A=>A.key==="year"||A.key==="make"||A.key==="model"||A.key==="body_style")||(te.current=!0,By({quoteId:f}).catch(()=>{}))},[f,m]);const[ae,ve]=B.useState({}),[Ee,Te]=B.useState({}),Le=B.useCallback(async(C,A)=>{if(!f||!vy(A))return;const S=C?C.join("-"):"_root";ve(R=>({...R,[S]:!0})),Te(R=>({...R,[S]:null}));try{const R=await wR({quoteId:f,vin:A});if(R.error){Te(Y=>({...Y,[S]:R.error}));return}let I=k;R.year&&(I=Yt(I,C,"year",String(R.year))),R.make&&(I=Yt(I,C,"make",R.make)),R.model&&(I=Yt(I,C,"model",R.model)),R.bodyStyle&&(I=Yt(I,C,"body_style",R.bodyStyle)),a&&o?o(I):N(I),D(I),se.current.clear(),W.current.clear(),oe({})}catch{Te(R=>({...R,[S]:"VIN lookup failed — please enter vehicle details manually"}))}finally{ve(R=>({...R,[S]:!1}))}},[f,k,a,o]),it=B.useCallback(C=>{const A=`${C.year}|${C.make??""}|${C.model??""}`,S=C.model?"bodyStyles":C.make?"models":"makes",R=se.current.get(A);return R?R[S]??[]:void 0},[]),Ge=B.useCallback((C,A)=>{if(!f)return;const S=`${A.year}|${A.make??""}|${A.model??""}`,R=A.model?"bodyStyles":A.make?"models":"makes",I=`${C}:${R}`;se.current.has(S)||W.current.has(S)||(W.current.add(S),ie(Y=>({...Y,[I]:!0})),By({quoteId:f,...A}).then(Y=>{se.current.set(S,Y),oe(K=>({...K,[I]:Y[R]??[]}))}).catch(()=>{se.current.set(S,{}),oe(Y=>({...Y,[I]:[]}))}).finally(()=>{W.current.delete(S),ie(Y=>({...Y,[I]:!1}))}))},[f]);function he(C,A,S){const R=k,I=C?Io(k,C)??{}:R;return C?{state:R.state,...I,[A]:S}:{...I,[A]:S}}function x(C,A){const S=Ov.filter(I=>I.targetKey===C||I.dependsOn.includes(C)),R={[C]:void 0};for(const I of S){const Y=I.validate(A);I.targetKey in R?Y!==void 0&&(R[I.targetKey]=Y):R[I.targetKey]=Y}ne(I=>({...I,...R}))}const U=(C,A,S)=>{const R=It(k,S,C);if(Vr(R,A)){ue[C]&&ne(Y=>({...Y,[C]:void 0}));return}const I=pd(C,R);if(I){ne(Y=>({...Y,[C]:I}));return}x(C,he(S,C,R))};B.useEffect(()=>{let C=k,A=!1;m.forEach(S=>{if(!Ml(S))return;const R=String(S.key);It(C,void 0,R)!=="Yes"&&(C=Yt(C,void 0,R,"Yes"),A=!0)}),A&&(a&&o?o(C):N(C),D(C))},[m,k,a,o]);function J(C,A){const S=C.key;if((S==="relationship_to_insured"||S==="is_registered_owner")&&A){const V=A[A.length-1];if(typeof V=="number"&&V===0)return null}if((S==="purchase_date"||S==="cost_new_value_cents")&&A)return null;if(S==="custom_equipment_value_cents"&&A){const V=It(k,A,"vehicle_has_modifications");if(V!=="Yes"&&V!==!0)return null}const R=S==="auto_reason_for_no_insurance"&&_.currentCarrierKey?k[_.currentCarrierKey]==="NoPriorInsurance"?"Reason you are not currently insured":"Reason for lapse in coverage":C.question,I=C.hint,Y=It(k,A,S),K=Gl(C,_)?Go(k,_):S==="social_security_number"&&Hl(k.state??k.State)?!0:C.required,Q=ue[S],re=V=>{let X=Yt(k,A,S,V);if(C.inputType==="radio"&&C.conditionals){const ee=C.conditionals??[];for(const de of ee){const Se=It(k,A,S),we=ko(Se,de.conditionalType,de.conditionalValue),Ce=ko(V,de.conditionalType,de.conditionalValue);if(we&&!Ce&&de.conditionalQuestionsAllowMultiple){const Ye=de.conditionalQuestions??[];if(Ye.length>0){const ce=Tl(S);X=Un(X,[...A??[],ce],[]);const He=(xe,lt)=>{xe.forEach(Ht=>{(Ht.conditionals??[]).forEach(pt=>{if(pt.conditionalQuestionsAllowMultiple){const tt=Tl(Ht.key);X=Un(X,[...lt,tt],[])}const $t=pt.conditionalQuestions??[];$t.length>0&&He($t,lt)})})};He(Ye,[...A??[],ce])}}}}a&&o?o(X):N(X),D(X)};if(S==="vehicle_policy_selections"){const V=k.vehicles__items??[],X=k.drivers__items??[];if(V.length===0)return g.jsx("p",{style:{color:"#666",fontStyle:"italic"},children:"Add vehicles first to configure coverage selections."},S);const ee=k.driver_vehicle_assignments??{},de=X.length>1,Se=tt=>Object.entries(tt).map(([ke,vt])=>({value:ke,label:vt})),we=Hl(k.state??k.State),Ce=(tt,ke)=>Object.fromEntries(tt.filter(vt=>vt in ke).map(vt=>[vt,ke[vt]])),ce=Se(Ce(we?hD:gD,hd)),He=we?Ce(yD,gd):gd,xe=Se(He),Ht=Se(Ce(we?vD:bD,Nv)),Ze=(tt,ke,vt)=>{const _t=Un(k,["vehicles__items",tt,ke],vt);a&&o?o(_t):N(_t),D(_t)},pt=(tt,ke,vt)=>{const _t={...ee},Pt=`v${tt}`;_t[Pt]={..._t[Pt]??{}},_t[Pt][`d${ke}`]=vt;const Qe=Un(k,["driver_vehicle_assignments"],_t);a&&o?o(Qe):N(Qe),D(Qe)},$t=tt=>{if(!de)return null;const ke=ee[`v${tt}`];if(!ke)return null;const vt=X.map((Qe,Ft)=>ke[`d${Ft}`]??0),_t=vt.filter(Qe=>Qe>0);if(_t.length>=2&&_t.every(Qe=>Qe===_t[0])&&_t[0]===50)return`Assignments for Vehicle ${tt+1} cannot be 50 percent for both Drivers.`;const Pt=vt.reduce((Qe,Ft)=>Qe+Ft,0);return Pt>0&&Pt!==100?`Driver percentages for this vehicle must add up to 100% (currently ${Pt}%).`:null};return g.jsx("div",{children:V.map((tt,ke)=>{const vt=[tt.year,tt.make,tt.model].filter(Boolean).join(" ")||`Vehicle ${ke+1}`,_t=$t(ke),Pt=Qe=>typeof tt[Qe]=="string"?tt[Qe]:"";return g.jsxs("fieldset",{style:{border:`1px solid ${_t?"#dc3545":"#ddd"}`,borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[g.jsx("legend",{style:{fontWeight:600,padding:"0 8px"},children:vt}),g.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"12px"},children:[g.jsx(Ro,{id:`veh-${ke}-comp`,label:"Comprehensive deductible",required:!0,placeholder:"Select...",options:ce,value:Pt("vehicle_comp_deductible"),onChange:Qe=>Ze(ke,"vehicle_comp_deductible",Qe.currentTarget.value)}),g.jsx(Ro,{id:`veh-${ke}-coll`,label:"Collision deductible",required:!0,placeholder:"Select...",options:ce,value:Pt("vehicle_coll_deductible"),onChange:Qe=>Ze(ke,"vehicle_coll_deductible",Qe.currentTarget.value)}),g.jsx(Ro,{id:`veh-${ke}-tow`,label:"Towing and Labor",required:!0,placeholder:"Select...",options:xe,value:Pt("vehicle_towing_and_labor"),onChange:Qe=>Ze(ke,"vehicle_towing_and_labor",Qe.currentTarget.value)}),g.jsx(Ro,{id:`veh-${ke}-trans`,label:"Transportation expense",required:!0,placeholder:"Select...",options:Ht,value:Pt("vehicle_transportation_expense"),onChange:Qe=>Ze(ke,"vehicle_transportation_expense",Qe.currentTarget.value)})]}),de&&g.jsxs("div",{style:{marginTop:"16px"},children:[g.jsx("p",{style:{fontWeight:600,margin:"0 0 8px"},children:"Drivers usage (%)"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px"},children:X.map((Qe,Ft)=>{const Dt=[Qe.first_name,Qe.last_name].filter(Boolean).join(" ")||`Driver ${Ft+1}`,bt=ee[`v${ke}`]?.[`d${Ft}`];return g.jsx("div",{style:{flex:"0 0 140px"},children:g.jsx(Rf,{id:`assignment-v${ke}-d${Ft}`,label:`${Dt} %`,value:bt??"",min:0,max:100,step:1,inputMode:"numeric",onChange:Ct=>{const Fn=Ct.currentTarget.value.replace(/\D+/g,"");pt(ke,Ft,Fn===""?0:Math.min(100,parseInt(Fn,10)))}})},`${ke}-${Ft}`)})}),_t&&g.jsx("p",{style:{color:"#dc3545",fontSize:"0.85rem",marginTop:"8px",marginBottom:0},children:_t})]})]},ke)})},S)}if(S==="driver_vehicle_assignments"){const V=k.vehicles__items??[],X=k.drivers__items??[];if(h&&X.length<=1)return null;if(V.length===0||X.length===0)return g.jsx("p",{style:{color:"#666",fontStyle:"italic"},children:"Add vehicles and drivers first to configure driver usage percentages."},S);const ee=k.driver_vehicle_assignments??{},de=(we,Ce,Ye)=>{const ce={...ee},He=`v${we}`;ce[He]={...ce[He]??{}},ce[He][`d${Ce}`]=Ye,re(ce)},Se=we=>{if(X.length<2)return null;const Ce=ee[`v${we}`];if(!Ce)return null;const Ye=X.map((xe,lt)=>Ce[`d${lt}`]??0),ce=Ye.filter(xe=>xe>0);if(ce.length>=2&&ce.every(xe=>xe===ce[0])&&ce[0]===50)return`Assignments for Vehicle ${we+1} cannot be 50 percent for both Drivers.`;const He=Ye.reduce((xe,lt)=>xe+lt,0);return He>0&&He!==100?`Driver percentages for this vehicle must add up to 100% (currently ${He}%).`:null};return g.jsxs("div",{children:[g.jsx("h4",{style:{marginBottom:"12px"},children:R}),V.map((we,Ce)=>{const Ye=[we.year,we.make,we.model].filter(Boolean).join(" ")||`Vehicle ${Ce+1}`,ce=Se(Ce);return g.jsxs("fieldset",{style:{border:`1px solid ${ce?"#dc3545":"#ddd"}`,borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[g.jsx("legend",{style:{fontWeight:600,padding:"0 8px"},children:Ye}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px"},children:X.map((He,xe)=>{const lt=[He.first_name,He.last_name].filter(Boolean).join(" ")||`Driver ${xe+1}`,Ht=ee[`v${Ce}`]?.[`d${xe}`];return g.jsx("div",{style:{flex:"0 0 140px"},children:g.jsx(Rf,{id:`assignment-v${Ce}-d${xe}`,label:`${lt} %`,value:Ht??"",min:0,max:100,step:1,inputMode:"numeric",onChange:Ze=>{const pt=Ze.currentTarget.value.replace(/\D+/g,"");de(Ce,xe,pt===""?0:Math.min(100,parseInt(pt,10)))}})},`${Ce}-${xe}`)})}),ce&&g.jsx("p",{style:{color:"#dc3545",fontSize:"0.85rem",marginTop:"8px",marginBottom:0},children:ce})]},Ce)})]},S)}switch(C.inputType){case"text":{if(S==="vin"&&f){const V=A?A.join("-"):"_root",X=ae[V]??!1,ee=Ee[V]??null,de=[I?`${S}-hint`:null,Q?`${S}-error`:null,ee?`${S}-vin-error`:null].filter(Boolean).join(" ");return g.jsxs("div",{children:[g.jsx(hn,{id:S,label:R,hint:I,error:Q,required:K,children:g.jsxs("div",{className:"flex items-end gap-2",children:[g.jsx("div",{className:"flex-1 min-w-0",children:g.jsx("input",{id:S,className:`form-input ${Q?"input-error":""}`,"aria-invalid":!!Q,"aria-describedby":de||void 0,"aria-required":K||void 0,required:K,value:rn(Y),maxLength:17,onChange:Se=>re(Se.currentTarget.value),onBlur:()=>U(S,"text",A),autoComplete:Al[S],type:"text"})}),g.jsx("button",{type:"button",disabled:X||!vy(rn(Y)),className:"btn btn-outline shrink-0 self-end !w-auto min-w-[8.5rem] px-4 whitespace-nowrap disabled:opacity-50",onClick:()=>Le(A,rn(Y)),children:X?"Looking up...":"Verify VIN"})]})}),ee&&g.jsx("p",{id:`${S}-vin-error`,className:"text-sm text-red-600 mt-1",children:ee})]},S)}if(S==="sms_code"){const V=rn(Y);return g.jsx(Df,{id:S,label:R,hint:I,value:V,inputMode:"numeric",pattern:"[0-9]*",maxLength:6,onChange:X=>{const ee=X.currentTarget.value.replace(/\D+/g,"").slice(0,6);re(ee)},onBlur:()=>U(S,"text",A),"aria-required":K||void 0,error:Q,autoComplete:Al[S]},S)}if(S==="license_number")return g.jsx(Df,{id:S,label:R,hint:I,value:rn(Y),onChange:V=>re(V.currentTarget.value.replace(/[^A-Z0-9]/gi,"").slice(0,20)),onBlur:()=>U(S,"text",A),"aria-required":K||void 0,error:Q,autoComplete:"off",maxLength:20},S);if(S==="social_security_number"){const V=It(k,A,"ssn_display"),X=typeof V=="string"?V:"",ee=X?`${X}. Re-enter to update.${I?` ${I}`:""}`:I;return g.jsx(QC,{id:S,label:R,hint:ee,value:rn(Y),onChange:de=>re(de.currentTarget.value),onBlur:()=>U(S,"text",A),"aria-required":K||void 0,error:Q},S)}return g.jsx(Df,{id:S,label:R,hint:I,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"text",A),"aria-required":K||void 0,error:Q,autoComplete:Al[S],maxLength:BR[S]},S)}case"email":return g.jsx(XC,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"email",A),"aria-required":K||void 0,error:Q},S);case"password":return g.jsx(eO,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"password",A),"aria-required":K||void 0,error:Q},S);case"tel":return g.jsxs(g.Fragment,{children:[g.jsx(WC,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"tel",A),"aria-required":K||void 0,error:Q},S),S==="phone"&&g.jsxs("div",{className:"mt-3 text-xs text-slate-600 space-y-1",children:[g.jsx("p",{children:"We verify your number before showing your quotes — you'll get a 6-digit code next. This is just to confirm your number, not a sales call."}),g.jsx("p",{children:"Message & data rates may apply. One message per request."}),g.jsxs("p",{children:["See our"," ",g.jsx("a",{href:"https://getcredify.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})," ","and"," ",g.jsx("a",{href:"https://getcredify.com/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Terms of Service"}),"."]})]})]});case"url":return g.jsx(JC,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"url",A),"aria-required":K||void 0,error:Q},S);case"number":{const V=zR[S];return Hy.has(S)||jR.has(S)?g.jsx(KC,{id:S,label:R,hint:I,value:Zy(Y),isCurrency:Hy.has(S),maxDigits:V,onChange:X=>re(Uy(X.currentTarget.value)),onBlur:()=>U(S,"number",A),"aria-required":K||void 0,error:Q},S):g.jsx(Rf,{id:S,label:R,hint:I,value:Zy(Y),inputMode:"numeric",pattern:"[0-9]*",onKeyDown:X=>{if(kR(X.key)){X.preventDefault();return}V!==void 0&&/^\d$/.test(X.key)&&String(X.currentTarget.value).replace(/\D/g,"").length>=V&&X.preventDefault()},onChange:X=>{let ee=X.currentTarget.value;V!==void 0&&(ee=ee.slice(0,V)),re(Uy(ee))},onBlur:()=>U(S,"number",A),"aria-required":K||void 0,error:Q},S)}case"textarea":return g.jsx(tO,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"textarea",A),"aria-required":K||void 0,error:Q,rows:4},S);case"date":{const{min:V,max:X}=IR(S);return g.jsx(nO,{id:S,label:R,hint:I,value:rn(Y),min:V,max:X,onChange:ee=>{const de=ee.currentTarget.value;re(de),!Vr(de,"date")&&!pd(S,de)&&x(S,he(A,S,de))},onBlur:()=>U(S,"date",A),"aria-required":K||void 0,error:Q,autoComplete:Al[S]},S)}case"checkbox":{if(C.options){const V=Array.isArray(Y)?Y:[];return g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"form-label",children:[R,K&&g.jsx("span",{className:"text-red-600 ml-1",children:"*"})]}),g.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:C.options.map(X=>{const ee=`${S}-${_d(X)}`,de=V.includes(X);return g.jsx(zl,{id:ee,label:X,checked:de,onChange:Se=>{const we=new Set(V);Se.currentTarget.checked?we.add(X):we.delete(X),re(Array.from(we))},"aria-required":K||void 0},ee)})}),Q&&g.jsx("p",{className:"mt-1 text-sm text-red-600",children:Q})]},S)}return g.jsx(zl,{id:S,label:K?`${R} *`:R,checked:!!Y,onChange:V=>re(V.currentTarget.checked),"aria-required":K||void 0},S)}case"radio":{if(Ml(C))return null;const V=C.options??[],X=A&&A.length>0?`${S}__${A.join("__")}`:S;return g.jsx(iO,{legend:R,legendClassName:K?"legend-required":void 0,children:V.map(ee=>g.jsx(aO,{name:X,value:ee,checked:Y===ee,onChange:()=>{re(ee),x(S,he(A,S,ee))},children:Iy[S]?.[ee]??ee},`${S}-${_d(ee)}`))},S)}case"select":{let V=C.options??[];S==="quote_vehicle_id"&&(V=a?.vehicles__items?.map(Ce=>Ce.vin)??[]);let X=!1,ee,de,Se;if(S==="year"||S==="make"||S==="model"||S==="body_style"){const Ce=A?A.join("-"):"_root";ae[Ce]&&(X=!0,ee="Looking up VIN...")}if(!X&&(S==="make"||S==="model"||S==="body_style")){const Ce=A?A.join("-"):"_root";Se=Ce;const Ye=It(k,A,"year"),ce=typeof Ye=="number"?Ye:Number(Ye);if(S==="make"){const He=`${Ce}:makes`;if(!ce||!Number.isFinite(ce))X=!0,ee="Select a year first";else{de={year:ce};const xe=it(de);xe&&xe.length>0?V=xe:F[He]?(X=!0,ee="Loading makes..."):V=[...JD]}}else if(S==="model"){const He=`${Ce}:models`,xe=String(It(k,A,"make")??"");if(!xe)X=!0,ee="Select a make first";else if(ce&&Number.isFinite(ce)){de={year:ce,make:xe};const lt=it(de);lt&<.length>0?V=lt:F[He]?(X=!0,ee="Loading models..."):V=[...DR]}typeof Y=="string"&&Y&&!V.includes(Y)&&(V=[Y,...V])}else{const He=`${Ce}:bodyStyles`,xe=String(It(k,A,"make")??""),lt=String(It(k,A,"model")??"");if(!lt)X=!0,ee="Select a model first";else if(ce&&Number.isFinite(ce)&&xe){de={year:ce,make:xe,model:lt};const Ht=it(de);Ht&&Ht.length>0?V=Ht:F[He]?(X=!0,ee="Loading body styles..."):V=[...RR]}typeof Y=="string"&&Y&&!V.includes(Y)&&(V=[Y,...V])}}if(S==="occupation"||S==="co_applicant_occupation"){const Ce=S==="co_applicant_occupation"?"co_applicant_employment_industry":void 0,Ye=Ce?void 0:It(k,A,"industry"),ce=It(k,A,Ce??"employment_industry"),xe=String(Fl(Ye??ce)??"").trim();V=[...Ay[xe]??LR],typeof Y=="string"&&Y&&!V.includes(Y)&&(V=[Y,...V])}const we=$R(A,S);return g.jsx(Ro,{id:we,label:ee?`${R} — ${ee}`:R,"aria-required":K||void 0,error:Q,disabled:X,value:GR(Y),onChange:Ce=>{const Ye=Ce.currentTarget.value;if(S!=="year"&&S!=="make"&&S!=="model"&&S!=="industry"&&S!=="employment_industry"&&S!=="co_applicant_employment_industry"){re(Ye),x(S,he(A,S,Ye));return}let ce=Yt(k,A,S,Ye);if(S==="year")ce=Yt(ce,A,"make",""),ce=Yt(ce,A,"model",""),ce=Yt(ce,A,"body_style","");else if(S==="make")ce=Yt(ce,A,"model",""),ce=Yt(ce,A,"body_style","");else if(S==="model")ce=Yt(ce,A,"body_style","");else if(S==="industry"||S==="employment_industry")ce=Yt(ce,A,"occupation","");else if(S==="co_applicant_employment_industry"){const xe=String(Fl(Ye)??"").trim(),lt=Ay[xe]??[],Ht=lt.find(Ze=>Ze===xe)??lt[0]??"";ce=Yt(ce,A,"co_applicant_occupation",Ht??"")}a&&o?o(ce):N(ce),D(ce);const He=A?Io(ce,A)??{}:ce;x(S,{...He,[S]:Ye})},placeholder:ee??"Select an option",onFocus:de&&Se?()=>Ge(Se,de):void 0,options:V.map(Ce=>({value:Ce,label:Iy[S]?.[Ce]??xR[Ce]??Ce}))},we)}case"address":return g.jsx(cO,{id:S,label:R,value:rn(Y),onChange:(V,X)=>{let ee=Yt(k,A,S,V);const de=X?.state??(typeof V=="string"?V.match(/,\s*([A-Z]{2})\s+\d{5}\b/)?.[1]:void 0);if(de){const Se=A?[...A,"state"]:["state"];ee=Un(ee,Se,de)}a&&o?o(ee):N(ee),D(ee)},onBlur:()=>U(S,"address",A),required:K,"aria-required":K||void 0,error:Q},S);default:return null}}function _e(C,A){const S=C.some(I=>String(I.key)==="years_at_address"),R=C.find(I=>String(I.key)==="months_at_address");return C.map((I,Y)=>{const K=String(I.key);if(K==="months_at_address"&&S||!wl(I,k,_)||!Hf(I,k,A)||!Nl(I,k,d))return null;if($f(K,I,k,d)){const Se=_.currentCarrierKey?k[_.currentCarrierKey]:void 0;if(!(Se&&Se!=="NoPriorInsurance"&&wi(k,_)&&Uf.has(K)))return null}const Q=J(I,A),re=K==="years_at_address"&&R?J(R,A):null,V=I.conditionals??[];if(!V.length)return d==="BundlePolicy"&&K==="policy_bi"?g.jsxs("div",{children:[g.jsx("h3",{className:"text-lg font-semibold mt-6 mb-3",children:"Vehicle Coverage Information"}),Q]},`wrap-${K}-${Y}`):g.jsxs("div",{children:[Q,re]},`wrap-${K}-${Y}`);const X=$y(I,It(k,A,K)),ee=V.filter(Se=>ko(X,Se.conditionalType,Se.conditionalValue)),de=ee.length>1&&!ee.some(Se=>Se.conditionalQuestionsAllowMultiple)?ee.slice(0,1):ee;return g.jsxs("div",{children:[Q,re,de.map((Se,we)=>{const Ce=Se.conditionalQuestions??[];if(!Ce.length)return null;if(!Se.conditionalQuestionsAllowMultiple)return g.jsx("div",{className:"mt-3",children:_e(Ce,A)},`branch-${K}-${we}`);const Ye=Tl(K),ce=Io(k,[...A??[],Ye])??[],He=Math.max(1,ce.length||1),xe=()=>{const Ze=Un(k,[...A??[],Ye,ce.length],{});a&&o?o(Ze):N(Ze),D(Ze)},lt=()=>{const Ze=ce.slice(0,Math.max(0,ce.length-1)),pt=Un(k,[...A??[],Ye],Ze);a&&o?o(pt):N(pt),D(pt)},Ht=`${K}__c${we}`;return g.jsxs("div",{className:"mt-3",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsx("div",{className:"text-sm font-medium opacity-75",children:"Add one or more entries"}),g.jsxs("div",{className:"space-x-2",children:[g.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:xe,children:"Add another"}),He>1&&g.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:lt,children:"Remove last"})]})]}),Array.from({length:He}).map((Ze,pt)=>{const $t=[...A??[],Ye,pt],tt=`${Ht}__i${pt}`,ke=ce[pt]??{},vt=K==="drivers",Qe=vt?`Driver #${pt+1}`:K==="vehicles"?`Vehicle #${pt+1}`:K==="home_losses"||K==="losses"?`Loss #${pt+1}`:`Entry #${pt+1}`,Dt=vt&&typeof ke.ssn_display=="string"&&ke.ssn_display?` — ${ke.ssn_display}`:"";return g.jsxs("div",{className:"rounded-lg border p-3 mb-3",children:[g.jsxs("div",{className:"text-sm font-semibold mb-2",children:[Qe,Dt]}),Ce.map(bt=>{const Ct=String(bt.key);if(!wl(bt,k,_)||!Hf(bt,k,$t)||!Nl(bt,k,d))return null;if($f(Ct,bt,k,d)){const Fn=_.currentCarrierKey?k[_.currentCarrierKey]:void 0;if(!(Fn&&Fn!=="NoPriorInsurance"&&wi(k,_)&&Uf.has(Ct)))return null}return g.jsxs("div",{className:"mt-3",children:[J(bt,$t),(()=>{const Fn=bt.conditionals??[];if(!Fn.length)return null;const qo=It(k,$t,bt.key),za=Fn.filter(yn=>ko(qo,yn.conditionalType,yn.conditionalValue));return(za.length>1&&!za.some(yn=>yn.conditionalQuestionsAllowMultiple)?za.slice(0,1):za).map((yn,vr)=>{const zn=yn.conditionalQuestions??[];if(!zn.length)return null;if(!yn.conditionalQuestionsAllowMultiple)return g.jsx("div",{className:"mt-3",children:_e(zn,$t)},`nested-${tt}-${vr}`);const Kn=Tl(bt.key),Gn=Io(k,[...$t,Kn])??[],Vo=Math.max(1,Gn.length||1),Ko=()=>{const vn=Un(k,[...$t,Kn,Gn.length],{});a&&o?o(vn):N(vn),D(vn)},Ui=()=>{const vn=Gn.slice(0,Math.max(0,Gn.length-1)),Qn=Un(k,[...$t,Kn],vn);a&&o?o(Qn):N(Qn),D(Qn)};return g.jsxs("div",{className:"mt-3",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsx("div",{className:"text-sm font-medium opacity-75",children:"Add one or more entries"}),g.jsxs("div",{className:"space-x-2",children:[g.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Ko,children:"Add another"}),Vo>1&&g.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Ui,children:"Remove last"})]})]}),Array.from({length:Vo}).map((vn,Qn)=>{const Qo=[...$t,Kn,Qn];return g.jsxs("div",{className:"rounded-lg border p-3 mb-3",children:[g.jsxs("div",{className:"text-sm font-semibold mb-2",children:["Entry #",Qn+1]}),_e(zn,Qo)]},`nested-item-${tt}-${vr}-${Qn}`)})]},`nested-repeat-${tt}-${vr}`)})})()]},`${tt}-${Ct}`)})]},`group-${tt}`)})]},`branch-${K}-${we}`)})]},`wrap-${K}-${Y}`)})}const G=B.useMemo(()=>{const C=[],A=(S,R)=>{S.forEach(I=>{if(!wl(I,k,_)||!Hf(I,k,R)||!Nl(I,k,d))return;const Y=String(I.key);if($f(Y,I,k,d)){const X=_.currentCarrierKey?k[_.currentCarrierKey]:void 0;if(!(X&&X!=="NoPriorInsurance"&&wi(k,_)&&Uf.has(Y)))return}Ml(I)||C.push(I);const K=I.conditionals??[];if(!K.length)return;const Q=$y(I,It(k,R,Y)),re=K.filter(X=>ko(Q,X.conditionalType,X.conditionalValue));(re.length>1&&!re.some(X=>X.conditionalQuestionsAllowMultiple)?re.slice(0,1):re).forEach(X=>{const ee=X.conditionalQuestions??[];ee.length&&(X.conditionalQuestionsAllowMultiple||A(ee,R))})})};return A(m),C},[m,k,_,d]);function E(C){C.preventDefault();const A=Go(k,_),S=G.map(I=>Gl(I,_)?{...I,required:A}:I),R=$l(S,k);if(ne(R),Object.keys(R).length>0){const I=G.findIndex(Y=>R[Y.key]);I>=0&&document.getElementById(G[I].key)?.focus();return}l(k)}return g.jsx("form",{className:"space-y-6 px-1",onSubmit:E,noValidate:!0,children:_e(m)})}const ZR="https://getcredify.com/privacy-policy";function PR(){return g.jsx("a",{href:ZR,target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})}function Py(){return g.jsxs(g.Fragment,{children:["See our ",g.jsx(PR,{})," for how we use your information."]})}const qR=new Set(["Product","Name","Home","HomeConstruction","HomeFeatures","Vehicle","Driver","Demographics","Customer","HomeCustomer","BundleCustomer"]),VR=new Set(["AutoCurrentCarrier","HomeCurrentCarrier","HomePolicy","BundlePolicy","AutoPolicy"]);function KR({stageKey:t}){return t?t==="Zip"?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:"No credit card required."}):t==="Email"?g.jsxs("div",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left space-y-1",children:[g.jsx("p",{children:"We'll send your quotes and updates here, and save your progress so you can return anytime."}),g.jsx("p",{children:g.jsx(Py,{})})]}):VR.has(t)?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:"Tell us about your current coverage. Carriers ask about your coverage history to put together accurate quotes — it's a standard step on any application. Coverage gaps are common, so just enter things as they are. You're almost there: your quotes are almost ready."}):t==="Ssn"?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:"Your SSN is required by some carriers for fraud prevention, underwriting and to generate a quote. It's entered directly into our secure, encrypted form."}):t==="SMSVerification"?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:"You'll receive a text from Credify shortly."}):qR.has(t)?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:g.jsx(Py,{})}):null:null}const QR=["widgetOpened","widgetClosed","stageViewed","stageCompleted","flowCompleted","ratesViewed","ratesBack","submissionFailed"],Yl={};function XR(t){let n=Yl[t];return n||(n=new Set,Yl[t]=n),n}function Uv(t,n){XR(t).add(n)}function Hv(t,n){Yl[t]?.delete(n)}function ra(t,...n){const a=Yl[t];if(!a||a.size===0)return;const o=n[0],l={quoteId:ac(),timestamp:Date.now()};for(const f of[...a])try{f(o,l)}catch(d){ec(d,{tags:{source:"widget-event-listener",event:t}})}}function WR(){ra("widgetOpened")}function qy(){ra("widgetClosed")}function JR(t){ra("stageViewed",t)}function Vy(t){ra("stageCompleted",t)}function e2(){ra("flowCompleted")}function t2(t){ra("ratesViewed",t)}function n2(){ra("ratesBack")}function zo(t){ra("submissionFailed",t)}const $v=new Set(["Disabled","Retired","Unemployed","Other"]);function r2(t,n){const a=String(t.key??"");if(a==="co_applicant_occupation"||a!=="occupation")return!0;const o=n.industry,l=n.employment_industry,f=String(o??l??"").trim();return!$v.has(f)}function a2(t,n){const a=String(t.key??"");if(a==="co_applicant_occupation"||a!=="occupation")return!0;const o=n.industry,l=n.employment_industry,f=String(o??l??"").trim();return!$v.has(f)}function Fv(t){return t.inputType!=="radio"||!t.options||t.options.length!==1||t.options[0]!=="Yes"?!1:(t.conditionals??[]).some(a=>a.conditionalQuestionsAllowMultiple&&a.conditionalType==="equals"&&a.conditionalValue==="Yes")}function Gv(t,n){return Fv(t)?"Yes":n}function Ky(t){return typeof t=="number"&&Number.isFinite(t)?t:typeof t=="string"&&t.trim()!==""&&!Number.isNaN(Number(t))?Number(t):null}function Qy(t){if(t instanceof Date&&!Number.isNaN(t.getTime()))return t.getTime();if(typeof t=="string"){const n=Date.parse(t);return Number.isNaN(n)?null:n}return null}function Xy(t,n){const a=Ky(t),o=Ky(n);if(a!=null&&o!=null)return a-o;const l=Qy(t),f=Qy(n);return l!=null&&f!=null?l-f:t==null||n==null?null:String(t).localeCompare(String(n))}function i2(t,n){return Array.isArray(t)?t.some(a=>a===n):typeof t=="string"?n!=null&&t.includes(String(n)):!1}function Yv(t,n,a){switch(n){case"equals":return t===a;case"notEquals":return t!==a&&t!==""&&t!=null;case"lessThan":{const o=Xy(t,a);return o!=null&&o<0}case"greaterThan":{const o=Xy(t,a);return o!=null&&o>0}case"contains":return i2(t,a);case"startsWith":return t!=null&&a!=null&&String(t).startsWith(String(a));case"endsWith":return t!=null&&a!=null&&String(t).endsWith(String(a));default:return!1}}const o2=new Set(["auto_prior_years","auto_prior_months","auto_continuous_coverage_years"]);function bd(t,n,a){const o=$d([...t]),l=Qd(o),f=[],d=m=>{m.forEach(_=>{if(!wl(_,n,l)||!r2(_,n)||!Nl(_,n,a))return;const h=String(_.key);if(Tv(h,a,n)){const D=l.currentCarrierKey?n[l.currentCarrierKey]:void 0;if(!(D&&D!=="NoPriorInsurance"&&wi(n,l)&&o2.has(h)))return}Fv(_)||f.push(_);const v=Gv(_,n[h]),b=_.conditionals??[];if(!b.length)return;const N=b.filter(D=>Yv(v,D.conditionalType,D.conditionalValue));(N.length>1&&!N.some(D=>D.conditionalQuestionsAllowMultiple)?N.slice(0,1):N).forEach(D=>{const k=D.conditionalQuestions??[];k.length&&(D.conditionalQuestionsAllowMultiple||d(k))})})};return d(o),f}const Zv="__items",Sd=t=>`${t}${Zv}`;function s2(t,n){if(t.key==="relationship_to_insured"||t.key==="is_registered_owner"){const a=n[n.length-1];return typeof a=="number"&&a===0}return!1}function Ed(t,n,a=[],o=void 0,l=n){for(const f of t){const d=String(f.key),m=Gv(f,n[d]),_=f.conditionals??[];if(!_.length)continue;const h=_.filter(b=>Yv(m,b.conditionalType,b.conditionalValue)),v=h.length>1&&!h.some(b=>b.conditionalQuestionsAllowMultiple)?h.slice(0,1):h;for(const b of v){const N=b.conditionalQuestions??[];if(!N.length)continue;if(!b.conditionalQuestionsAllowMultiple){if(Ed(N,n,a,o,l))return!0;continue}const w=n[Sd(d)]??[];if(w.length===0)return!0;for(const[D,k]of w.entries()){const ue=[...a,Sd(d),D],ne=bd(N,k,o).filter(oe=>!(s2(oe,ue)||!a2(oe,k))),se={state:l.state,...k},W=$l(ne,se);if(Object.values(W).some(Boolean)||Ed(N,k,ue,o,l))return!0}}}return!1}function Wy(t,n,a){return Ed(t,n,[],a,n)}function Jy(t){const n=t.vehicles__items??[];if(!Array.isArray(n)||n.length===0)return!1;for(const a of n)if(Vr(a.vehicle_comp_deductible,"select")||Vr(a.vehicle_coll_deductible,"select")||Vr(a.vehicle_towing_and_labor,"select")||Vr(a.vehicle_transportation_expense,"select"))return!0;return!1}function l2({stages:t,onStageComplete:n,onComplete:a,initialValues:o,initialActive:l,quoteId:f,nonTerminalStageKeys:d}){const[m,_]=B.useState(l??0),[h,v]=B.useState(o??{}),[b,N]=B.useState({}),[w,D]=B.useState(!1),[k,ue]=B.useState(!1),[ne,se]=B.useState(null),W=B.useRef([]),oe=B.useRef(t),F=Array.isArray(t)&&t.length>0,ie=F?Math.min(m,t.length-1):0,te=F?t[ie]:null,ae=te?.key??null;B.useEffect(()=>{l!==void 0&&_(l)},[l]),oe.current=t;const ve=B.useMemo(()=>{const U=ie>=t.length-1;return U&&ae&&d?.has(ae)?!1:!!(U||t.slice(ie+1).every(_e=>_e.key==="AutoPolicy")&&(h.drivers__items??[]).length<=1)},[ie,t,h,ae,d]);B.useEffect(()=>{F&&m>=t.length&&_(t.length-1)},[m,t.length,F]),B.useEffect(()=>{const U=W.current[ie];U&&U.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[ie]),B.useEffect(()=>{o!==void 0&&v(o)},[o]),B.useEffect(()=>{if(!te||!ae){D(!1),se(null);return}if(b[ae]){D(!1),se(null);return}let U=!1;return D(!0),se(null),Promise.resolve(te.loadQuestions()).then(J=>{if(!U){if(!Array.isArray(J))throw new Error(`loadQuestions("${ae}") did not return an array`);N(_e=>({..._e,[ae]:J}))}}).catch(J=>{U||se(`Failed to load stage "${te?.title??""}": ${J?.message??"Unknown error"}`)}).finally(()=>{U||D(!1)}),()=>{U=!0}},[te,ae,b]);const Ee=ae?b[ae]:void 0,Te=B.useMemo(()=>Qd($d(Ee??[])),[Ee]);B.useEffect(()=>{te&&ae&&Ee&&JR({stageKey:ae,stageTitle:te.title??ae,stepIndex:m+1,totalSteps:t.length})},[ae,m,t.length,te,Ee]);const Le=B.useMemo(()=>{if(!Ee)return{};const U={};(G=>{const E=[],C=A=>{A.forEach((S,R)=>{const I=Uo(S,R);E.push(I);const Y=Sd(I);E.push(Y),(S.conditionals??[]).forEach(Q=>{const re=Q.conditionalQuestions??[];re.length>0&&C(re)})})};return C(G),E})(Ee).forEach(G=>{G in h&&(U[G]=h[G])});for(const G of["state","State","address","product"])G in h&&(U[G]=h[G]);for(const[G,E]of Object.entries(h))G.endsWith(Zv)&&!(G in U)&&(U[G]=E);return U},[Ee,h]),it=U=>{v(J=>({...J,...U}))},Ge=()=>{_(U=>U>0?U-1:0),document.querySelector(".panel-body")?.scrollTo({top:0,behavior:"instant"})},he=async()=>{if(!Ee||!te||w||ne||k)return;const U=bd(Ee,Le,ae??void 0),J=Go(h,Te),_e=U.map(Q=>Gl(Q,Te)?{...Q,required:J}:Q),G=$l(_e,Le),E=new Set(_e.map((Q,re)=>Uo(Q,re))),C=Object.entries(G).some(([Q,re])=>re&&E.has(Q)),A=Wy(Ee,h,ae??void 0),R=U.some(Q=>String(Q.key??"")==="vehicle_policy_selections")?Jy(h):!1,I=h.driver_vehicle_assignments,Y=h.drivers__items??[];let K=!1;if(I&&Y.length>=2){const Q=h.vehicles__items??[];for(let re=0;re<Q.length;re++){const V=I[`v${re}`];if(!V)continue;const X=Y.map((Se,we)=>V[`d${we}`]??0),ee=X.filter(Se=>Se>0);if(ee.length>=2&&ee.every(Se=>Se===50)){K=!0;break}const de=X.reduce((Se,we)=>Se+we,0);if(de>0&&de!==100){K=!0;break}}}if(!(C||A||R||K)){ue(!0);try{const Q=ve,re=Q?await a(h,ae??""):await n(Le,ae??""),{success:V,error:X}=re;if(!V){se(X??"An error occurred");return}if(!Q){const ee=re.latestStages??oe.current,de=ee.findIndex(we=>we.key===ae),Se=de>=0?Math.min(de+1,ee.length-1):Math.min(m+1,ee.length-1);_(Se)}}finally{ue(!1)}}},x=B.useMemo(()=>{if(!Ee||w||ne||k)return!0;const U=bd(Ee,Le,ae??void 0),J=Go(h,Te),_e=U.map(Q=>Gl(Q,Te)?{...Q,required:J}:Q),G=$l(_e,Le),E=new Set(_e.map((Q,re)=>Uo(Q,re))),C=Object.entries(G).some(([Q,re])=>re&&E.has(Q)),A=Wy(Ee,h,ae??void 0),R=U.some(Q=>String(Q.key??"")==="vehicle_policy_selections")?Jy(h):!1,I=h.driver_vehicle_assignments,Y=h.drivers__items??[];let K=!1;if(I&&Y.length>=2){const Q=h.vehicles__items??[];for(let re=0;re<Q.length;re++){const V=I[`v${re}`];if(!V)continue;const X=Y.map((Se,we)=>V[`d${we}`]??0),ee=X.filter(Se=>Se>0);if(ee.length>=2&&ee.every(Se=>Se===50)){K=!0;break}const de=X.reduce((Se,we)=>Se+we,0);if(de>0&&de!==100){K=!0;break}}}return C||A||R||K},[Ee,Le,h,w,ne,k,Te,ae]);return F?g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"form-wizard-steps-header flex items-center justify-between gap-4",children:[g.jsx("ol",{className:"form-wizard-steps flex gap-2 text-xs overflow-x-auto flex-1 pb-1 scrollbar-hide items-center",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t.flatMap((U,J)=>[g.jsx("li",{ref:_e=>{W.current[J]=_e},className:`form-wizard-step-pill px-2.5 py-1 rounded-full border whitespace-nowrap flex-shrink-0 ${J<ie?"bg-blue-600 text-white border-blue-600":J===ie?"border-blue-600 text-blue-600 bg-white":"border-slate-200 text-slate-600"}`,children:U.title},U.key??`stage-${J}`),...J<t.length-1?[g.jsx("li",{className:"form-wizard-step-arrow text-slate-400 flex-shrink-0",children:"→"},`arrow-${U.key??J}`)]:[]])}),g.jsxs("div",{className:"form-wizard-step-counter text-sm text-slate-500 flex-shrink-0",children:[ie+1," / ",t.length]})]}),g.jsxs("div",{children:[w&&g.jsx("div",{className:"text-slate-500",children:"Loading…"}),te&&g.jsx(YR,{questions:Ee??[],controlledValues:Le,onChangeValues:it,onSubmit:()=>he(),quoteId:f,widgetStageKey:ae??void 0},te.key)]}),!w&&ne&&g.jsxs("div",{className:"text-red-600 text-sm -mt-4",children:[g.jsx("div",{children:ne}),te&&g.jsx("button",{type:"button",className:"credify-retry-btn underline mt-1 font-bold",onClick:()=>{N(U=>{if(!ae)return U;const J={...U};return delete J[ae],J})},children:"Retry"})]}),g.jsx(KR,{stageKey:ae}),g.jsxs("div",{className:ie>0?"grid grid-cols-2 gap-3":"",children:[ie>0&&g.jsx("button",{type:"button",onClick:Ge,disabled:w,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",children:"Back"}),g.jsxs("button",{type:"button","data-widget-ctrl":"next",onClick:he,disabled:x,className:["form-wizard-next-btn",ie>0?"":"w-full","h-12 rounded-full text-white transition","disabled:opacity-50 disabled:cursor-not-allowed","flex items-center justify-center gap-2",x?"bg-gray-300":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[k&&g.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[g.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),g.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),ve?"Finish":"Next"]})]})]}):g.jsx("div",{className:"text-slate-600",children:"Loading..."})}const Pv={SafecoPersonal:{name:"Safeco",abbr:"SFC",color:"#0F337A"},SafecoPersoanl:{name:"Safeco",abbr:"SFC",color:"#0F337A"},AssuranceAmerica:{name:"Assurance America",abbr:"AA",color:"#2768B5"},CommonWealthCasualty:{name:"Commonwealth Casualty",abbr:"CW",color:"#2D69EC"},Alinsco:{name:"Alinsco",abbr:"AL",color:"#20395D"},ACORDBOLTPersonalAuto:{name:"Bolt Auto",abbr:"BLT",color:"#1F2937"},ACORDBOLTPersonalHome:{name:"Bolt Home",abbr:"BLT",color:"#1F2937"},TwentyFirstCentury:{name:"21st Century",abbr:"21C",color:"#B2392A"},ACentral:{name:"A-Central",abbr:"ACT",color:"#EAAD1D"},AAA:{name:"AAA",abbr:"AAA",color:"#DB461C"},AARP:{name:"AARP",abbr:"ARP",color:"#DB4724"},Acadia:{name:"Acadia",abbr:"ACD",color:"#386B61"},Ace:{name:"ACE",abbr:"ACE",color:"#457D48"},Acuity:{name:"Acuity",abbr:"ACU",color:"#D74630"},AdirondackInsExchange:{name:"Adirondack",abbr:"ADK",color:"#1F5490"},Aegis:{name:"Aegis",abbr:"AEG",color:"#1A4675"},AIC:{name:"AIC",abbr:"AIC",color:"#508F47"},AIG:{name:"AIG",abbr:"AIG",color:"#223572"},AlfaAlliance:{name:"Alfa Alliance",abbr:"ALF",color:"#C13D17"},AllianzOfAmerica:{name:"Allianz",abbr:"ALZ",color:"#003781"},AllianzOfAmericaJefferson:{name:"Allianz Jefferson",abbr:"ALZ",color:"#003781"},Allied:{name:"Allied",abbr:"ALD",color:"#0047BB"},Allmerica:{name:"Allmerica",abbr:"ALM",color:"#003DA5"},Allstate:{name:"Allstate",abbr:"ALS",color:"#002F87"},AmericaFirst:{name:"America First",abbr:"AMF",color:"#003DA5"},AmericanCommerce:{name:"American Commerce",abbr:"ACM",color:"#003DA5"},AmericanFamily:{name:"American Family",abbr:"AMF",color:"#0033A0"},Amica:{name:"Amica",abbr:"AMI",color:"#003DA5"},Ameriprise:{name:"Ameriprise",abbr:"AMP",color:"#003DA5"},ASILloyds:{name:"ASI Lloyds",abbr:"ASI",color:"#003DA5"},Assurant:{name:"Assurant",abbr:"ASR",color:"#0033A0"},AtlasGeneralAgency:{name:"Atlas General",abbr:"ATL",color:"#1F3864"},AustinMutual:{name:"Austin Mutual",abbr:"AUS",color:"#1F3864"},Autoone:{name:"AutoOne",abbr:"AON",color:"#003DA5"},AutoOwners:{name:"Auto-Owners",abbr:"AO",color:"#C8102E"},BadgerMutual:{name:"Badger Mutual",abbr:"BDG",color:"#003DA5"},Balboa:{name:"Balboa",abbr:"BAL",color:"#1F3864"},Bamboo:{name:"Bamboo",abbr:"BMB",color:"#0F4C3A"},Bankers:{name:"Bankers",abbr:"BNK",color:"#1F3864"},BeaconNational:{name:"Beacon National",abbr:"BCN",color:"#003DA5"},BrethernMutual:{name:"Brethren Mutual",abbr:"BRT",color:"#1F3864"},BristolWest:{name:"Bristol West",abbr:"BW",color:"#003DA5"},BunkerHill:{name:"Bunker Hill",abbr:"BHL",color:"#1F3864"},CapitalInsuranceGroup:{name:"Capital Insurance",abbr:"CIG",color:"#003DA5"},Celina:{name:"Celina",abbr:"CEL",color:"#1F3864"},CentralMutualOfOH:{name:"Central Mutual",abbr:"CMO",color:"#003DA5"},Chubb:{name:"Chubb",abbr:"CHB",color:"#000000"},ChubbInsurance:{name:"Chubb",abbr:"CHB",color:"#000000"},Cincinnati:{name:"Cincinnati",abbr:"CIN",color:"#003DA5"},Citizens:{name:"Citizens",abbr:"CTZ",color:"#003DA5"},Clearcover:{name:"Clearcover",abbr:"CC",color:"#00B5E2"},CNA:{name:"CNA",abbr:"CNA",color:"#CC3232"},ColonialPenn:{name:"Colonial Penn",abbr:"CPN",color:"#0072CE"},ColoradoCasualty:{name:"Colorado Casualty",abbr:"COC",color:"#1F3864"},Columbia:{name:"Columbia",abbr:"CLM",color:"#003DA5"},CommerceWest:{name:"Commerce West",abbr:"CMW",color:"#003DA5"},CommonwealthCasualty:{name:"Commonwealth Casualty",abbr:"CW",color:"#1F3864"},ConstitutionalCasualty:{name:"Constitutional Casualty",abbr:"CON",color:"#1F3864"},Cornerstone:{name:"Cornerstone",abbr:"CRN",color:"#1F3864"},Countrywide:{name:"Countrywide",abbr:"CTW",color:"#003DA5"},CSE:{name:"CSE",abbr:"CSE",color:"#003DA5"},Cumberland:{name:"Cumberland",abbr:"CMB",color:"#1F3864"},Cypress:{name:"Cypress",abbr:"CYP",color:"#0F4C3A"},Dairyland:{name:"Dairyland",abbr:"DL",color:"#0072CE"},Deerbrook:{name:"Deerbrook",abbr:"DBK",color:"#1F3864"},Direct:{name:"Direct",abbr:"DIR",color:"#D52B1E"},Donegal:{name:"Donegal",abbr:"DON",color:"#003DA5"},Drive:{name:"Drive",abbr:"DRV",color:"#1F3864"},Electric:{name:"Electric",abbr:"ELC",color:"#003DA5"},EMC:{name:"EMC",abbr:"EMC",color:"#003DA5"},Encompass:{name:"Encompass",abbr:"ENC",color:"#002F87"},Erie:{name:"Erie",abbr:"ERI",color:"#005FAC"},Esurance:{name:"Esurance",abbr:"ESU",color:"#00A6CE"},ExcelsiorInsuranceCompany:{name:"Excelsior",abbr:"EXC",color:"#1F3864"},Explorer:{name:"Explorer",abbr:"EXP",color:"#1F3864"},FairPlan:{name:"FAIR Plan",abbr:"FPN",color:"#1F3864"},FarmBureau:{name:"Farm Bureau",abbr:"FB",color:"#00843D"},Farmers:{name:"Farmers",abbr:"FRM",color:"#1C428B"},Fidelity:{name:"Fidelity",abbr:"FID",color:"#00833F"},FiremansFund:{name:"Fireman's Fund",abbr:"FF",color:"#E31837"},FirstAmerican:{name:"First American",abbr:"FAM",color:"#003DA5"},Foremost:{name:"Foremost",abbr:"FOR",color:"#E31837"},ForemostInsuranceCompany:{name:"Foremost",abbr:"FOR",color:"#E31837"},Geico:{name:"GEICO",abbr:"GEI",color:"#0F4293"},GeneralCasualty:{name:"General Casualty",abbr:"GC",color:"#1F3864"},GermantownMutual:{name:"Germantown Mutual",abbr:"GTM",color:"#1F3864"},GMAC:{name:"GMAC",abbr:"GMA",color:"#003DA5"},Grange:{name:"Grange",abbr:"GRG",color:"#003DA5"},GreatAmerican:{name:"Great American",abbr:"GA",color:"#003DA5"},Grinnell:{name:"Grinnell Mutual",abbr:"GRN",color:"#E31837"},GuideOne:{name:"GuideOne",abbr:"GO",color:"#0072CE"},Hanover:{name:"Hanover",abbr:"HAN",color:"#003DA5"},Harbor:{name:"Harbor",abbr:"HBR",color:"#1F3864"},Harleysville:{name:"Harleysville",abbr:"HRL",color:"#003DA5"},Hartford:{name:"The Hartford",abbr:"HFD",color:"#7F1734"},HartfordOMNI:{name:"Hartford OMNI",abbr:"HOM",color:"#7F1734"},HastingsMutual:{name:"Hastings Mutual",abbr:"HST",color:"#1F3864"},HawkeyeSecurity:{name:"Hawkeye Security",abbr:"HWK",color:"#1F3864"},HDI:{name:"HDI",abbr:"HDI",color:"#00563F"},HippoInsuranceCompany:{name:"Hippo",abbr:"HPO",color:"#00C9A7"},HomeownersOfAmerica:{name:"Homeowners of America",abbr:"HOA",color:"#003DA5"},Homesite:{name:"Homesite",abbr:"HMS",color:"#0033A0"},HoraceMann:{name:"Horace Mann",abbr:"HM",color:"#003DA5"},HoustonGeneral:{name:"Houston General",abbr:"HG",color:"#1F3864"},IFA:{name:"IFA",abbr:"IFA",color:"#003DA5"},ImperialCasualty:{name:"Imperial Casualty",abbr:"IMP",color:"#1F3864"},Indiana:{name:"Indiana Insurance",abbr:"IND",color:"#003DA5"},IndianaFarmers:{name:"Indiana Farmers",abbr:"IFM",color:"#00843D"},Infinity:{name:"Infinity",abbr:"INF",color:"#E31837"},Insurequest:{name:"Insurequest",abbr:"INQ",color:"#1F3864"},Integon:{name:"Integon",abbr:"ITG",color:"#003DA5"},Integrity:{name:"Integrity",abbr:"ITY",color:"#1F3864"},Kemper:{name:"Kemper",abbr:"KMP",color:"#0033A0"},LibertyMutual:{name:"Liberty Mutual",abbr:"LM",color:"#FFD000"},LibertyNorthwest:{name:"Liberty Northwest",abbr:"LNW",color:"#FFD000"},Lloyds:{name:"Lloyd's",abbr:"LLY",color:"#003DA5"},MainStreetAmerica:{name:"Main Street America",abbr:"MSA",color:"#003DA5"},Mapfre:{name:"MAPFRE",abbr:"MAP",color:"#E31837"},MarkelInsuranceCompany:{name:"Markel",abbr:"MKL",color:"#003DA5"},Mendota:{name:"Mendota",abbr:"MND",color:"#1F3864"},MerchantsGroup:{name:"Merchants Group",abbr:"MRC",color:"#003DA5"},Mercury:{name:"Mercury",abbr:"MER",color:"#ED1C24"},Metlife:{name:"MetLife",abbr:"MET",color:"#0090DA"},Metropolitan:{name:"Metropolitan",abbr:"MTP",color:"#0090DA"},MidContinent:{name:"Mid-Continent",abbr:"MC",color:"#003DA5"},MidwesternIndemnity:{name:"Midwestern Indemnity",abbr:"MWI",color:"#003DA5"},Montgomery:{name:"Montgomery",abbr:"MTG",color:"#1F3864"},MSA:{name:"MSA",abbr:"MSA",color:"#003DA5"},MtWashington:{name:"Mt. Washington",abbr:"MTW",color:"#1F3864"},MutualBenefit:{name:"Mutual Benefit",abbr:"MB",color:"#1F3864"},NatGenPremier:{name:"NatGen Premier",abbr:"NGP",color:"#0033A0"},NationalGeneral:{name:"National General",abbr:"NG",color:"#0033A0"},Nationwide:{name:"Nationwide",abbr:"NW",color:"#204D9B"},NationwideScottsdale:{name:"Nationwide Scottsdale",abbr:"NWS",color:"#204D9B"},NewYorkCentralMutual:{name:"NY Central Mutual",abbr:"NYC",color:"#003DA5"},NJManufacturers:{name:"NJM Insurance",abbr:"NJM",color:"#003DA5"},NJSkylands:{name:"NJ Skylands",abbr:"NJS",color:"#003DA5"},Northstar:{name:"Northstar",abbr:"NST",color:"#1F3864"},Occidental:{name:"Occidental",abbr:"OCC",color:"#1F3864"},OhioCasualty:{name:"Ohio Casualty",abbr:"OHC",color:"#003DA5"},OmahaPC:{name:"Omaha P&C",abbr:"OMA",color:"#003DA5"},OneBeacon:{name:"OneBeacon",abbr:"OB",color:"#003DA5"},OregonMutual:{name:"Oregon Mutual",abbr:"ORE",color:"#003DA5"},Palisades:{name:"Palisades",abbr:"PAL",color:"#1F3864"},PeerlessMontgomery:{name:"Peerless Montgomery",abbr:"PRM",color:"#1F3864"},Pekin:{name:"Pekin",abbr:"PEK",color:"#003DA5"},Pemco:{name:"PEMCO",abbr:"PMC",color:"#0072CE"},PennNational:{name:"Penn National",abbr:"PN",color:"#003DA5"},PlymouthRock:{name:"Plymouth Rock",abbr:"PLR",color:"#003DA5"},PreferredMutual:{name:"Preferred Mutual",abbr:"PFM",color:"#003DA5"},Proformance:{name:"Proformance",abbr:"PRF",color:"#1F3864"},Progressive:{name:"Progressive",abbr:"PRG",color:"#0053BA"},Prudential:{name:"Prudential",abbr:"PRU",color:"#0033A0"},PureHighValue:{name:"PURE",abbr:"PUR",color:"#003DA5"},Republic:{name:"Republic",abbr:"REP",color:"#003DA5"},RockfordMutual:{name:"Rockford Mutual",abbr:"RKF",color:"#1F3864"},RoyalAndSunAlliance:{name:"Royal & SunAlliance",abbr:"RSA",color:"#003DA5"},Safeco:{name:"Safeco",abbr:"SFC",color:"#E4002B"},SECURA:{name:"SECURA",abbr:"SEC",color:"#003DA5"},Selective:{name:"Selective",abbr:"SEL",color:"#003DA5"},SouthernCounty:{name:"Southern County",abbr:"SCM",color:"#1F3864"},SouthernMutual:{name:"Southern Mutual",abbr:"SM",color:"#1F3864"},SouthernTrust:{name:"Southern Trust",abbr:"ST",color:"#1F3864"},StPaulTravelers:{name:"St. Paul Travelers",abbr:"SPT",color:"#C8102E"},StandardMutual:{name:"Standard Mutual",abbr:"STM",color:"#1F3864"},StarCasualty:{name:"Star Casualty",abbr:"SC",color:"#1F3864"},StateAuto:{name:"State Auto",abbr:"SA",color:"#003DA5"},StateFarm:{name:"State Farm",abbr:"SF",color:"#CC0717"},StateFarmFloridaInsuranceCompany:{name:"State Farm Florida",abbr:"SFF",color:"#CC0717"},SunshineStateInsuranceCompany:{name:"Sunshine State",abbr:"SSS",color:"#FFC72C"},Travelers:{name:"Travelers",abbr:"TRV",color:"#C8102E"},Tower:{name:"Tower",abbr:"TWR",color:"#1F3864"},TWFG:{name:"TWFG",abbr:"TWF",color:"#003DA5"},Unigard:{name:"Unigard",abbr:"UNG",color:"#1F3864"},UnitedFireAndCasualty:{name:"United Fire & Casualty",abbr:"UFC",color:"#003DA5"},Unitrin:{name:"Unitrin",abbr:"UTN",color:"#003DA5"},Universal:{name:"Universal",abbr:"UNV",color:"#003DA5"},USAA:{name:"USAA",abbr:"USA",color:"#1A3258"},UticaNational:{name:"Utica National",abbr:"UTC",color:"#003DA5"},Victoria:{name:"Victoria",abbr:"VIC",color:"#1F3864"},Wellington:{name:"Wellington",abbr:"WLG",color:"#1F3864"},WestBend:{name:"West Bend",abbr:"WB",color:"#003DA5"},WesternNational:{name:"Western National",abbr:"WN",color:"#003DA5"},WesternReserveGroup:{name:"Western Reserve",abbr:"WR",color:"#003DA5"},Westfield:{name:"Westfield",abbr:"WF",color:"#F05136"},WhiteMountains:{name:"White Mountains",abbr:"WM",color:"#1F3864"},WilsonMutual:{name:"Wilson Mutual",abbr:"WLM",color:"#1F3864"},Windsor:{name:"Windsor",abbr:"WIN",color:"#1F3864"},Zurich:{name:"Zurich",abbr:"ZUR",color:"#003399"}},e0=["#0369A1","#1D4ED8","#0F766E","#7C3AED","#B45309","#DC2626","#0891B2","#9333EA"];function c2(t){return t.replace(/[^A-Za-z0-9]/g,"").slice(0,3).toUpperCase()||"CAR"}function qv(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ").trim()}function Sa(t){if(!t)return t;const n=Pv[t];return n?n.name:qv(t)}function u2(t){const n=new Set,a=[];return t.forEach((o,l)=>{const d=Pv[o]??{name:qv(o),abbr:c2(o),color:e0[l%e0.length]};n.has(d.name)||(n.add(d.name),a.push(d))}),a}function f2(t,n){if(!t)return[];const a=[];return(n==="Auto"||n==="Bundle")&&Array.isArray(t.PersonalAuto)&&a.push(...t.PersonalAuto),(n==="Home"||n==="Bundle")&&Array.isArray(t.PersonalHome)&&a.push(...t.PersonalHome),u2(a)}const d2="https://getcredify.com/privacy-policy";function m2({acknowledged:t,onChange:n,disabled:a=!1}){return g.jsx("div",{className:"privacy-notice-ack rounded-xl border border-slate-200 bg-slate-50 p-4","data-testid":"privacy-notice-acknowledgment",children:g.jsx(zl,{id:"privacy-notice-ack-checkbox",className:"privacy-notice-ack-checkbox",checked:t,onChange:o=>n(o.target.checked),disabled:a,label:g.jsxs(g.Fragment,{children:["I acknowledge I have received Credify’s"," ",g.jsx("a",{href:d2,target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Notice"}),"."]})})})}function p2({carrierName:t,formattedPremium:n,lobLabel:a,acknowledged:o,onAcknowledgeChange:l,onCancel:f,onProceed:d,isProcessing:m,hasError:_}){const h=!o||m;return g.jsxs("div",{className:"bind-confirmation","data-testid":"bind-confirmation",role:"group","aria-label":"Confirm your bind request",children:[g.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Confirm your bind request"}),g.jsxs("div",{className:"mt-4 rounded-xl border border-slate-200 bg-white p-4",children:[a&&g.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500",children:a}),g.jsx("p",{className:"font-semibold text-slate-900",children:t}),g.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[n,g.jsx("span",{className:"ml-1 text-sm font-medium text-slate-500",children:"/month"})]})]}),g.jsx("div",{className:"mt-4",children:g.jsx(m2,{acknowledged:o,onChange:l,disabled:m})}),_&&g.jsx("p",{className:"mt-3 text-sm text-red-600",role:"alert",children:"Something went wrong while processing your bind request. Please try again."}),g.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3",children:[g.jsx("button",{type:"button","data-testid":"bind-confirmation-cancel",onClick:f,disabled:m,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancel"}),g.jsxs("button",{type:"button","data-testid":"bind-confirmation-proceed",onClick:d,disabled:h,className:["h-12 rounded-full text-white font-bold transition","flex items-center justify-center gap-2","disabled:cursor-not-allowed",h?"bg-slate-400":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[m&&g.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[g.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),g.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),m?"Processing…":"Proceed"]})]})]})}const Vv=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function Kv(t){const n=Number.isFinite(t.term_months)&&t.term_months>0?t.term_months:1;return t.monthly_premium_cents!=null?t.monthly_premium_cents:Math.round((t.premium_cents||0)/n)}const Zl={PersonalHome:"Homeowners",PersonalAuto:"Personal Auto",Flood:"Flood",ExcessFlood:"Excess Flood",_other:"Other"},Pl=["PersonalHome","PersonalAuto","Flood","ExcessFlood"];function _2(t){if(t.length===0)return[];const n=(o,l)=>Sa(o.carrier_name).localeCompare(Sa(l.carrier_name));if(!t.some(o=>o.lob))return[{lob:null,title:"Not Quoted",rates:[...t].sort(n)}];const a=new Map;for(const o of t){const l=o.lob||"_other",f=a.get(l);f?f.push(o):a.set(l,[o])}return[...a.entries()].sort(([o],[l])=>{const f=Pl.indexOf(o),d=Pl.indexOf(l);return(f===-1?999:f)-(d===-1?999:d)}).map(([o,l])=>({lob:o,title:Zl[o]??o,rates:[...l].sort(n)}))}function t0({onBack:t}){const n=()=>{n2(),t?.()};return g.jsx("button",{type:"button",onClick:n,className:"credify-btn-back credify-btn-back-rates h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition w-full",children:"Back"})}function h2({rate:t,status:n,onRequestBind:a,disabled:o,showLobLabel:l=!0,className:f}){const d=Kv(t)/100,m=Vv.format(d),_=n==="loading",h=n==="success",v=!!o||_||h,b=!!(t.effective_date&&t.policy_end_date),N=t.lob?Zl[t.lob]||t.lob:null;return g.jsxs("div",{className:`flex w-full flex-col rounded-xl border border-slate-200 bg-white p-6 shadow-sm transition hover:shadow-md${f?` ${f}`:""}`,children:[l&&N&&g.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:N}),g.jsxs("div",{className:"mb-4 flex flex-col items-start gap-2",children:[t.carrier_logo_base64?g.jsx("img",{src:`data:image/png;base64,${t.carrier_logo_base64}`,alt:Sa(t.carrier_name),className:"h-12 w-auto max-w-full object-contain"}):g.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-md bg-slate-100 text-sm font-semibold text-slate-500",children:Sa(t.carrier_name).charAt(0).toUpperCase()}),g.jsx("h4",{className:"w-full break-words text-left font-semibold text-slate-900",children:Sa(t.carrier_name)})]}),g.jsx("div",{className:"mb-2",children:g.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[m,g.jsx("span",{className:"ml-1 text-sm font-medium text-slate-500",children:"/month"})]})}),b&&g.jsx("div",{className:"mb-2",children:g.jsxs("p",{className:"text-xs text-slate-500",children:["Effective ",t.effective_date," - ",t.policy_end_date]})}),t.carrier_quote_id&&g.jsx("div",{className:"mb-4",children:g.jsxs("p",{className:"text-xs text-slate-400",children:["Quote ID: ",t.carrier_quote_id]})}),g.jsxs("div",{className:"mt-auto pt-4",children:[g.jsx("button",{type:"button",onClick:a,disabled:v,className:`rates-bind-btn w-full rounded-full px-4 py-2.5 text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 disabled:cursor-not-allowed ${h?"rates-bind-btn-requested":"hover:bg-blue-600/90 disabled:bg-slate-300 disabled:text-slate-500"}`,children:_?"Requesting…":h?"Requested":"Request Bind"}),n==="error"&&g.jsx("p",{className:"mt-2 text-xs text-red-600",children:"Something went wrong. Please try again."}),n==="success"&&g.jsx("p",{className:"mt-2 text-xs text-emerald-600",children:"We received your bind request."})]})]})}function g2({item:t}){const n=Sa(t.carrier_name),a=(t.decline_reasons??[]).filter(Boolean);return g.jsxs("div",{className:"flex w-full gap-4 rounded-xl border border-slate-200 bg-white p-4 shadow-sm",children:[g.jsx("div",{className:"shrink-0",children:t.carrier_logo_base64?g.jsx("img",{src:`data:image/png;base64,${t.carrier_logo_base64}`,alt:n,className:"h-10 w-auto max-w-[7rem] object-contain"}):g.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-slate-100 text-sm font-semibold text-slate-500",children:n.charAt(0).toUpperCase()})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("div",{className:"flex flex-wrap items-center gap-2",children:g.jsx("h4",{className:"break-words font-semibold text-slate-900",children:n})}),a.length>0?g.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5 text-sm text-slate-600",children:a.map((o,l)=>g.jsx("li",{children:o},l))}):g.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"This carrier did not return a quote."})]})]})}function y2({rates:t,onBack:n,isBundleFlow:a=!1}){const o=Array.isArray(t)?t:[],l=o.length>0,[f,d]=B.useState({}),[m,_]=B.useState("admitted"),[h,v]=B.useState(!1),[b,N]=B.useState(null),[w,D]=B.useState(!1),k=B.useMemo(()=>o.some(G=>G.lob==="PersonalAuto"),[o]),ue=B.useMemo(()=>o.some(G=>G.lob==="PersonalHome"),[o]),ne=B.useMemo(()=>{if(!a)return[];const G=[];return k&&G.push("PersonalAuto"),ue&&G.push("PersonalHome"),G},[a,k,ue]),se=B.useMemo(()=>{const G=new Set;for(const E of o){const C=E.lob??null;C&&f[E.quote_rate_id]==="success"&&G.add(C)}return G},[o,f]),W=B.useMemo(()=>Object.values(f).some(G=>G==="success"),[f]),oe=B.useMemo(()=>h?!0:!a||ne.length===0?W:ne.every(G=>se.has(G)),[h,a,W,ne,se]),F=B.useMemo(()=>l?o.filter(G=>(G.admitted_status??"admitted")==="admitted"):[],[o,l]),ie=B.useMemo(()=>l?o.filter(G=>G.admitted_status==="non_admitted"):[],[o,l]),te=B.useMemo(()=>l?o.filter(G=>G.admitted_status==="not_quoted"):[],[o,l]),ae=F.length,ve=ie.length,Ee=te.length,Te=ae+ve>0,Le=Te||Ee>0,it=B.useMemo(()=>_2(te),[te]);B.useEffect(()=>{Le&&m==="admitted"&&ae===0&&(ve>0?_("non_admitted"):Ee>0&&_("not_quoted"))},[m,ae,ve,Ee,Le]);const Ge=B.useMemo(()=>Te?m==="admitted"?F:m==="non_admitted"?ie:[]:[],[Te,m,F,ie]);B.useEffect(()=>{vd()},[]),B.useEffect(()=>{!oe||h||(nR(),Iv(),v(!0))},[oe,h]);const he=B.useMemo(()=>{if(Ge.length===0)return[];if(!Ge.some(A=>A.lob))return[{lob:null,title:"Rates",rates:[...Ge].sort((S,R)=>{const I=Number.isFinite(S.term_months)&&S.term_months>0?S.term_months:1,Y=Number.isFinite(R.term_months)&&R.term_months>0?R.term_months:1,K=S.monthly_premium_cents??Math.round((S.premium_cents||0)/I),Q=R.monthly_premium_cents??Math.round((R.premium_cents||0)/Y);return K-Q})}];const E=new Map;for(const A of Ge){const S=A.lob||"_other",R=E.get(S);R?R.push(A):E.set(S,[A])}return[...E.entries()].sort(([A],[S])=>{const R=Pl.indexOf(A),I=Pl.indexOf(S);return(R===-1?999:R)-(I===-1?999:I)}).map(([A,S])=>({lob:A,title:Zl[A]??A,rates:[...S].sort((R,I)=>{const Y=Number.isFinite(R.term_months)&&R.term_months>0?R.term_months:1,K=Number.isFinite(I.term_months)&&I.term_months>0?I.term_months:1,Q=R.monthly_premium_cents??Math.round((R.premium_cents||0)/Y),re=I.monthly_premium_cents??Math.round((I.premium_cents||0)/K);return Q-re})}))},[Ge]),x=B.useMemo(()=>{if(!a)return[];const G=o.some(A=>A.lob==="PersonalAuto"),E=o.some(A=>A.lob==="PersonalHome"),C=[];return G||C.push("Sorry, no rates found for Personal Auto."),E||C.push("Sorry, no rates found for Homeowners."),C},[a,o]);if(!Le)return g.jsxs("section",{className:"mt-8",children:[g.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Rates"}),g.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"Sorry, no rates are available at this time."}),n&&g.jsx(t0,{onBack:n})]});const U=G=>{d(E=>({...E,[G.quote_rate_id]:"idle"})),D(!1),N({cardKey:G.quote_rate_id,rate:G})},J=()=>{N(null),D(!1)},_e=async()=>{if(!b||!w)return;const G=b.cardKey;d(E=>({...E,[G]:"loading"}));try{if(vd(),!Ti())throw new Error("Authentication required. Please verify your phone number first.");if(!((await MR(G,!0))?.success!==!1))throw new Error("Request failed");d(S=>({...S,[G]:"success"})),N(null),D(!1)}catch{d(E=>({...E,[G]:"error"}))}};if(b){const G=b.rate.lob?Zl[b.rate.lob]||b.rate.lob:null;return g.jsx("section",{className:"mt-8",children:g.jsx(p2,{carrierName:Sa(b.rate.carrier_name),formattedPremium:Vv.format(Kv(b.rate)/100),lobLabel:G,acknowledged:w,onAcknowledgeChange:D,onCancel:J,onProceed:_e,isProcessing:f[b.cardKey]==="loading",hasError:f[b.cardKey]==="error"})})}return g.jsxs("section",{className:"mt-8",children:[g.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Rates"}),x.length>0&&g.jsx("div",{className:"mt-3 space-y-1",children:x.map(G=>g.jsx("p",{className:"text-sm text-slate-600",children:G},G))}),g.jsx("div",{className:"mt-4 border-b border-slate-200",children:g.jsxs("div",{className:"flex items-center gap-6",children:[g.jsxs("button",{type:"button",onClick:()=>_("admitted"),className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${m==="admitted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Admitted (",ae,")"]}),g.jsxs("button",{type:"button",onClick:()=>_("non_admitted"),className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${m==="non_admitted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Non-admitted (",ve,")"]}),Ee>0&&g.jsxs("button",{type:"button",onClick:()=>_("not_quoted"),className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${m==="not_quoted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Not Quoted (",Ee,")"]})]})}),m==="not_quoted"?it.map(G=>g.jsxs("div",{className:"mt-6",children:[G.lob!=null&&g.jsx("h4",{className:"mb-3 text-base font-semibold text-slate-800",children:G.title}),g.jsx("div",{className:"space-y-3",children:G.rates.map(E=>g.jsx(g2,{item:E},E.quote_rate_id))})]},G.lob??"all")):g.jsxs(g.Fragment,{children:[Ge.length===0&&g.jsx("p",{className:"mt-4 text-sm text-slate-500",children:m==="admitted"?"Sorry, no admitted rates are available at this time.":"Sorry, no non-admitted rates are available at this time."}),Ge.length>0&&he.map(G=>g.jsxs("div",{className:"mt-6",children:[g.jsx("h4",{className:"mb-3 text-base font-semibold text-slate-800",children:G.title}),g.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:G.rates.map(E=>g.jsx("div",{className:"mx-auto w-full min-w-0 max-w-md",children:g.jsx(h2,{rate:E,showLobLabel:G.lob==null,status:f[E.quote_rate_id]??"idle",disabled:oe||(a?!!(E.lob&&ne.includes(E.lob)&&se.has(E.lob)):W),onRequestBind:()=>U(E)})},E.quote_rate_id))})]},G.lob??"all"))]}),n&&g.jsx(t0,{onBack:n})]})}const Ff=["Validating your details...","Checking underwriting rules...","Applying eligible discounts...","Reviewing your risk profile...","Calculating premium...","Check complete"],n0={Auto:{label:"Auto Policy",icon:"🚗",accent:"#0369A1"},Home:{label:"Home Policy",icon:"🏠",accent:"#059669"},Bundle:{label:"Home + Auto Bundle",icon:"🔗",accent:"#7C3AED"}},r0={Auto:6e4,Home:9e4,Bundle:12e4};function v2({progress:t,color:n,size:a=80}){const o=(a-10)/2,l=2*Math.PI*o,f=l-t/100*l;return g.jsxs("svg",{width:a,height:a,style:{transform:"rotate(-90deg)"},children:[g.jsx("circle",{cx:a/2,cy:a/2,r:o,fill:"none",stroke:"#F1F5F9",strokeWidth:6}),g.jsx("circle",{cx:a/2,cy:a/2,r:o,fill:"none",stroke:n,strokeWidth:6,strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:f,style:{transition:"stroke-dashoffset 0.2s linear"}})]})}function b2({providers:t=[],totalTime:n=6e4,flow:a="Auto",isComplete:o=!1,onComplete:l}){const f=n0[a]??n0.Auto,d=r0[a]??r0.Auto,m=t.length>0?Math.floor(d/t.length):n,[_,h]=B.useState(0),[v,b]=B.useState(0),[N,w]=B.useState(0),[D,k]=B.useState(0),[ue,ne]=B.useState(!0),se=B.useRef(o),W=B.useRef(l),oe=B.useRef(_),F=B.useRef(t.length),ie=B.useRef(!1),te=B.useRef(!1);B.useEffect(()=>{se.current=o,o&&t.length===0&&!ie.current&&(ie.current=!0,W.current?.())},[o,t.length]),B.useEffect(()=>{W.current=l},[l]),B.useEffect(()=>{oe.current=_},[_]),B.useEffect(()=>{F.current=t.length,t.length>0&&(te.current=!1,h(0),b(0),w(0),k(0),ne(!0))},[t.length]),B.useEffect(()=>{if(t.length===0){se.current&&!ie.current&&(ie.current=!0,W.current?.());return}te.current=!1;const Te=100,Le=100/(m/Te),it=setInterval(()=>{w(Ge=>{if(te.current||ie.current)return Ge;const he=Ge+Le;return he<100?he:(te.current=!0,setTimeout(()=>{if(se.current){if(ie.current)return;ie.current=!0,W.current?.();return}const U=oe.current===F.current-1;ne(!1),setTimeout(()=>{U?(h(0),b(J=>J+1)):h(J=>J+1),w(0),k(0),ne(!0)},300)},400),100)})},Te);return()=>clearInterval(it)},[_,m,t.length]),B.useEffect(()=>{if(t.length===0)return;const Te=Math.floor(m/Ff.length),Le=setInterval(()=>k(it=>Math.min(it+1,Ff.length-1)),Te);return()=>clearInterval(Le)},[_,m,t.length]);const ae=t.length===0,ve=ae?null:t[Math.min(_,t.length-1)],Ee=v>0;return g.jsxs(g.Fragment,{children:[g.jsx("style",{children:`
|
|
110
|
+
…[truncated]`;let Oy=!1,Ny=null,wy="",Bv=zv,yd=jv,Ho=[];function oR(t){return typeof t=="string"?t:t instanceof URL?t.href:t.url}function sR(t,n){return n?.method?n.method.toUpperCase():typeof t!="string"&&!(t instanceof URL)&&t.method?t.method.toUpperCase():"GET"}function My(t){if(!t)return[];const n=[];if(Array.isArray(t))for(const[a,o]of t)n.push({name:a,value:String(o)});else if(typeof t.forEach=="function")t.forEach((a,o)=>n.push({name:o,value:a}));else for(const[a,o]of Object.entries(t))n.push({name:a,value:String(o)});return n}function lR(t){try{const n=[];return new URL(t).searchParams.forEach((a,o)=>n.push({name:o,value:a})),n}catch{return[]}}function cR(t,n){const a=n?.body;return typeof a!="string"||a.length===0?void 0:{mimeType:t.find(l=>l.name.toLowerCase()==="content-type")?.value??"application/json",text:a}}function uR(t){const n=t.length;return n<=yd?{text:t,size:n}:{text:t.slice(0,yd)+iR,size:n}}function fR(t){Ho.push(t),Ho.length>Bv&&Ho.shift()}function dR(t){if(Oy)return!0;if(typeof window>"u"||typeof window.fetch!="function")return!1;wy=t.baseUrl,Bv=t.maxEntries??zv,yd=t.maxBodyBytes??jv,Ny=window.fetch.bind(window);const n=Ny;return window.fetch=async(a,o)=>{let l;try{l=oR(a)}catch{return n(a,o)}if(!l.startsWith(wy))return n(a,o);const f=My(o?.headers??(typeof a!="string"&&!(a instanceof URL)?a.headers:void 0)),d={startedDateTime:new Date().toISOString(),time:-1,request:{method:sR(a,o),url:l,httpVersion:"HTTP/1.1",headers:f,queryString:lR(l),cookies:[],headersSize:-1,bodySize:typeof o?.body=="string"?o.body.length:-1,postData:cR(f,o)},response:mR(),cache:{},timings:{send:0,wait:-1,receive:0}};fR(d);const m=typeof performance<"u"?performance.now():0;let _;try{_=await n(a,o)}catch(v){const b=(typeof performance<"u"?performance.now():0)-m;throw d.time=Math.round(b),d.timings.wait=Math.round(b),d.response._error=v instanceof Error?v.message:String(v),v}const h=(typeof performance<"u"?performance.now():0)-m;d.time=Math.round(h),d.timings.wait=Math.round(h),d.response.status=_.status,d.response.statusText=_.statusText,d.response.headers=My(_.headers),d.response.content.mimeType=typeof _.headers?.get=="function"&&_.headers.get("content-type")||"";try{_.clone().text().then(b=>{const{text:N,size:w}=uR(b);d.response.content.text=N,d.response.content.size=w,d.response.bodySize=w}).catch(()=>{})}catch{}return _},Oy=!0,!0}function mR(){return{status:0,statusText:"",httpVersion:"HTTP/1.1",headers:[],cookies:[],content:{size:0,mimeType:""},redirectURL:"",headersSize:-1,bodySize:-1}}function pR(){return{log:{version:"1.2",creator:{name:rR,version:aR},entries:Ho.map(t=>({...t}))}}}function _R(){return Ho.length}const hR=[/ssn/i,/social.?security/i,/(driver.?licen[cs]e|^dln$|^dl$)/i,/(date.?of.?birth|^dob$)/i,/^vin$/i,/(sms.?code|^otp$|^code$|verification.?code)/i,/phone/i,/^email$/i,/(first.?name|last.?name|full.?name)/i,/(^address$|street|^zip$|postal)/i,/(jwt|^token$|authorization|^auth$|api.?key|secret|password|credential)/i,/cookie/i],gR=[/\b\d{3}-?\d{2}-?\d{4}\b/g,/\b[A-HJ-NPR-Z0-9]{17}\b/g,/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,/\bsk_[A-Za-z0-9]{16,}\b/g,/\bBearer\s+[A-Za-z0-9._-]+/gi],Xr="[REDACTED]",yR=8;function ic(t){for(const n of hR)if(n.test(t))return!0;return!1}function Wr(t){let n=t;for(const a of gR)n=n.replace(a,Xr);return n}function qr(t,n=0,a=new WeakSet){if(n>yR)return Xr;if(t==null)return t;if(typeof t=="string")return Wr(t);if(typeof t!="object")return t;if(a.has(t))return Xr;if(a.add(t),Array.isArray(t))return t.map(f=>qr(f,n+1,a));const o=Object.getPrototypeOf(t);if(o!==null&&o!==Object.prototype)return t;const l={};for(const[f,d]of Object.entries(t)){if(ic(f)){l[f]=Xr;continue}l[f]=qr(d,n+1,a)}return l}function xy(t){if(t.request&&(t.request.data!==void 0&&(t.request.data=qr(t.request.data)),t.request.cookies!==void 0&&(t.request.cookies=Xr),t.request.headers)){const n=t.request.headers;for(const a of Object.keys(n))ic(a)&&(n[a]=Xr)}if(t.extra&&(t.extra=qr(t.extra)),t.contexts&&(t.contexts=qr(t.contexts)),t.tags&&(t.tags=qr(t.tags)),t.user){const{id:n,email:a,username:o}=t.user;t.user={...typeof n=="string"?{id:n}:{},...typeof a=="string"?{email:a}:{},...typeof o=="string"?{username:o}:{}}}if(Array.isArray(t.breadcrumbs))for(const n of t.breadcrumbs)n.data!==void 0&&(n.data=qr(n.data)),typeof n.message=="string"&&(n.message=Wr(n.message));return typeof t.message=="string"&&(t.message=Wr(t.message)),t}function Dy(t){for(const n of t)n.value=ic(n.name)?Xr:Wr(n.value)}function Ry(t){try{return JSON.stringify(qr(JSON.parse(t)))}catch{return Wr(t)}}function vR(t){const n=JSON.parse(JSON.stringify(t));for(const a of n.log.entries){Dy(a.request.headers),Dy(a.response.headers);for(const o of a.request.queryString)o.value=ic(o.name)?Xr:Wr(o.value);a.request.postData?.text&&(a.request.postData.text=Ry(a.request.postData.text)),a.response.content.text&&(a.response.content.text=Ry(a.response.content.text)),a.request.url=Wr(a.request.url),a.response._error&&(a.response._error=Wr(a.response._error))}return n}function Ai(t,n={}){try{kd(a=>{a.setTag("failure_type","quote"),n.stage&&a.setTag("stage",n.stage),n.quoteId&&a.setTag("quote_id",n.quoteId),n.phase&&a.setTag("phase",n.phase),n.endpoint&&a.setTag("endpoint",n.endpoint),typeof n.statusCode=="number"&&a.setTag("status_code",String(n.statusCode));try{_R()>0&&a.addAttachment({filename:"quote-failure.har",data:JSON.stringify(vR(pR())),contentType:"application/json"})}catch{}const o=t instanceof Error?t:new Error(n.message??"Quote failed");ec(o)})}catch{}}const Zt="https://api.getcredify.com";let zi=null;const bR=6e4,Ly=new Map;function SR(t){try{return new URL(t).pathname}catch{return t}}function ky(t,n,a){if(!(a>=500&&a<600)&&!(a===0))return;t.__sentryReported=!0;const f=SR(n),d=`${f}:${a}`,m=Date.now(),_=Ly.get(d);_&&m-_<bR||(Ly.set(d,m),Ai(t,{phase:"api_request",endpoint:f,statusCode:a}))}function Bf(t){zi=t,eR(t)}function Ti(){return zi}function vd(){const t=tR();t&&(zi=t)}function Iv(){zi=null,kv()}async function gn(t,n){const a={"Content-Type":"application/json"};zi&&(a.Authorization=`Bearer ${zi}`);let o;try{o=await fetch(t,{method:"POST",headers:a,body:JSON.stringify(n)})}catch(l){const f=l instanceof Error?l:new Error(String(l));throw ky(f,t,0),l}if(!o.ok){let l=`Request failed with status ${o.status}`;try{l=(await o.json()).error||l}catch{l=o.statusText||l}const f=new Error(l);throw f.statusCode=o.status,ky(f,t,o.status),f}return o}async function ER(t){try{return await t.json()}catch{return{}}}async function AR(t,n){const a=n?{stage:t,quoteId:n}:{stage:t};return await(await gn(`${Zt}/get-questions-by-stage`,a)).json()}async function El(t){const n=t?{quoteId:t}:{};return await(await gn(`${Zt}/get-stages-for-quote`,n)).json()}async function TR(t,n=!1){const a=n?{postal_code:t,is_test:!0}:{postal_code:t},l=await(await gn(`${Zt}/create-quote`,a)).json();if(!l||typeof l!="object"||!l.quoteId)throw new Error(`Invalid createQuote response: ${JSON.stringify(l)}`);return l}async function CR(t,n){return await(await gn(`${Zt}/verify-quote`,{action:"send",quoteId:t,phone:n})).json()}async function Si(t,n,a){const o={payload:t,getRates:n};a&&typeof a=="string"&&a.trim()!==""&&(o.quoteId=a);const l=await gn(`${Zt}/update-quote`,o),f=await ER(l);return!f||typeof f!="object"||!("status"in f)||f.status==null?{status:"success"}:f}async function zy(t,n){return await(await gn(`${Zt}/verify-quote`,{quoteId:t,smsCode:n})).json()}async function OR(t){return await(await gn(`${Zt}/verify-quote`,{action:"resume",resumeToken:t})).json()}async function NR(t,n){const a={state:t};return n&&typeof n=="string"&&n.trim()!==""&&(a.quoteId=n),await(await gn(`${Zt}/is-supported-state`,a)).json()}async function If(){return await(await gn(`${Zt}/get-rates`,{})).json()}async function jy(t){const n=t?{quoteId:t}:{};return await(await gn(`${Zt}/get-quote`,n)).json()}async function By(t){return(await gn(`${Zt}/get-vehicle-options`,t)).json()}async function wR(t){return(await gn(`${Zt}/get-vehicle-options`,{...t,action:"vinDecode"})).json()}async function MR(t,n){const o=await(await gn(`${Zt}/request-bind`,{quoteRateId:t,privacyNoticeAcknowledged:n})).json();return o&&typeof o=="object"&&"success"in o?o:{success:!0}}const Uf=new Set(["auto_prior_years","auto_prior_months","auto_continuous_coverage_years"]),xR={None:"None","30000/60000/25000":"30/60k","30000/60000/30000":"30/60k","50000/100000/30000":"50/100k","50000/100000/50000":"50/100k","100000/300000/50000":"100/300k","100000/300000/100000":"100/300k","250000/500000/100000":"250/500k","250000/500000/250000":"250/500k","300000/500000/250000":"300/500k","300000/500000/300000":"300/500k","500000/500000/300000":"500k CSL","500000/500000/500000":"500k CSL","500000/1000000/300000":"500k/1M","500000/1000000/500000":"500k/1M"},Iy={auto_prior_carrier_name:rD,auto_prior_liability_limit:sD,auto_reason_for_no_insurance:lD,residence_type:aD,home_prior_carrier_name:iD,policy_bi:cD,policy_um:uD,policy_pd:fD,policy_mp:dD,policy_umpd:mD,policy_pip:pD,policy_auto_death_indemnity:_D,vehicle_comp_deductible:hd,vehicle_coll_deductible:hd,vehicle_towing_and_labor:gd,vehicle_transportation_expense:Nv,education_level:wv,industry:Mv,occupation:xv,usage:oD,architectural_style:SD,dwelling_type:ED,occupancy_type:AD,construction_quality:TD,construction_type:CD,foundation_type:OD,located_over_water:ND,number_of_stories:wD,exterior_wall_type:MD,roof_material_type:xD,roof_shape:DD,roof_updated_type:RD,heating_type:LD,oil_tank_location:kD,basement_type:zD,plumbing_type:jD,personal_liability:BD,dwelling_medical_payments:ID,all_perils_deductible:UD,windstorm_deductible:HD,distance_from_fire_hydrant_ft:$D,distance_from_fire_station_miles:FD,employment_industry:by,marital_status:Sy,gender:Ey,co_applicant_employment_industry:by,co_applicant_marital_status:Sy,co_applicant_gender:Ey,description:GD,tort_threshold:YD,pip_coverage_type:ZD,extended_medical:PD,additional_pip:qD,policy_pip_deductible:VD},DR=["OTHER / NOT LISTED"],RR=["SEDAN","SUV","COUPE","HATCHBACK","PICKUP","VAN","WAGON","OTHER"],LR=["Other"];function pn(t){const n=t.getUTCFullYear(),a=String(t.getUTCMonth()+1).padStart(2,"0"),o=String(t.getUTCDate()).padStart(2,"0");return`${n}-${a}-${o}`}function Uy(t){const n=t.replace(/\D+/g,"");if(n!=="")return nD(n)}function kR(t){return t==="-"||t==="+"||t==="."||t==="e"||t==="E"}const zR={year_built:4,year_roof_updated:4,heating_update_year:4,plumbing_update_year:4,electrical_update_year:4,total_area_sq_ft:6,sale_price_cents:9,dwelling_replacement_cost:9,other_structures_coverage:9,personal_property_coverage:7,amount_paid_cents:7,loss_of_use_coverage:8,home_prior_years:2,home_continuous_coverage_years:2,number_of_dogs:2,number_of_units:2,months_at_address:2,years_at_address:3,years_at_prior_address:3,distance_to_coast_miles:4,household_size:1,number_of_families:1,number_of_mortgagees:1,annual_mileage:6,miles_to_work:4,custom_equipment_value_cents:7,cost_new_value_cents:7,stated_value_amount_cents:7,property_damage_amount_paid_cents:7,personal_injury_amount_paid_cents:7,auto_current_annual_premium_cents:7,auto_prior_years:2,auto_prior_months:2,auto_continuous_coverage_years:2},Hy=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"]),jR=new Set(["total_area_sq_ft","annual_mileage","miles_to_work","distance_to_coast_miles"]),Al={first_name:"given-name",last_name:"family-name",co_applicant_first_name:"given-name",co_applicant_last_name:"family-name",date_of_birth:"bday",co_applicant_date_of_birth:"bday",sms_code:"one-time-code",vin:"off",license_number:"off",effective_date:"off"},BR={license_number:20};function IR(t){const n=new Date,a=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()));if(t==="effective_date"){const o=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth()+3,a.getUTCDate()));return{min:pn(a),max:pn(o)}}if(t==="home_prior_expiration_date"){const o=new Date(Date.UTC(a.getUTCFullYear()-1,a.getUTCMonth(),a.getUTCDate())),l=new Date(Date.UTC(a.getUTCFullYear()+1,a.getUTCMonth(),a.getUTCDate()));return{min:pn(o),max:pn(l)}}if(t==="date_of_incident")return{max:pn(a)};if(t==="move_in_date")return{max:pn(a)};if(t==="purchase_date")return{max:pn(a)};if(t==="date_of_birth")return{max:pn(a)};if(t==="date_first_licensed")return{max:pn(a)};if(t==="occurred_at")return{max:pn(a)};if(t==="accident_prevention_course_date")return{max:pn(a)};if(t==="auto_prior_expiration_date"){const o=new Date(Date.UTC(a.getUTCFullYear()-1,a.getUTCMonth(),a.getUTCDate())),l=new Date(Date.UTC(a.getUTCFullYear()+1,a.getUTCMonth(),a.getUTCDate()));return{min:pn(o),max:pn(l)}}return{}}const UR=new Set(["Disabled","Retired","Unemployed","Other"]);function Hf(t,n,a){const o=String(t.key??"");if(o!=="occupation"&&o!=="co_applicant_occupation"||o==="co_applicant_occupation")return!0;const l=It(n,a,"industry"),f=It(n,a,"employment_industry"),d=String(l??f??"").trim();return!UR.has(d)}function $f(t,n,a,o){return Tv(t,o,a)}function Ml(t){return t.inputType!=="radio"||!t.options||t.options.length!==1||t.options[0]!=="Yes"?!1:(t.conditionals??[]).some(a=>a.conditionalQuestionsAllowMultiple&&a.conditionalType==="equals"&&a.conditionalValue==="Yes")}function $y(t,n){return Ml(t)?"Yes":n}function Fy(t){return typeof t=="number"&&Number.isFinite(t)?t:typeof t=="string"&&t.trim()!==""&&!Number.isNaN(Number(t))?Number(t):null}function Gy(t){if(t instanceof Date&&!Number.isNaN(t.getTime()))return t.getTime();if(typeof t=="string"){const n=Date.parse(t);return Number.isNaN(n)?null:n}return null}function Yy(t,n){const a=Fy(t),o=Fy(n);if(a!=null&&o!=null)return a-o;const l=Gy(t),f=Gy(n);return l!=null&&f!=null?l-f:t==null||n==null?null:String(t).localeCompare(String(n))}function HR(t,n){return Array.isArray(t)?t.some(a=>a===n):typeof t=="string"?n!=null&&t.includes(String(n)):!1}function ko(t,n,a){switch(n){case"equals":return t===a;case"notEquals":return t!==a&&t!==""&&t!=null;case"lessThan":{const o=Yy(t,a);return o!=null&&o<0}case"greaterThan":{const o=Yy(t,a);return o!=null&&o>0}case"contains":return HR(t,a);case"startsWith":return t!=null&&a!=null&&String(t).startsWith(String(a));case"endsWith":return t!=null&&a!=null&&String(t).endsWith(String(a));default:return!1}}function Io(t,n){return n.reduce((a,o)=>a?.[o],t)}function Un(t,n,a){if(n.length===0)return t;const[o,...l]=n;if(l.length===0){if(typeof o=="number"){const h=(Array.isArray(t)?t:[]).slice();return h[o]=a,h}return{...t,[o]:a}}const f=t?.[o],d=typeof l[0]=="number"?Array.isArray(f)?f:[]:f&&typeof f=="object"?f:{},m=Un(d,l,a);if(typeof o=="number"){const h=(Array.isArray(t)?t:[]).slice();return h[o]=m,h}return{...t,[o]:m}}function It(t,n,a){return Io(t,[...n??[],a])}function Yt(t,n,a,o){return Un(t,[...n??[],a],o)}function $R(t,n){return t?.length?`${t.join("-")}-${n}`:n}const FR="__items",Tl=t=>`${t}${FR}`;function rn(t){return t==null?"":typeof t=="string"?t:String(t)}function Zy(t){return t==null?"":typeof t=="number"&&Number.isFinite(t)||typeof t=="string"?t:""}function GR(t){return t==null?"":typeof t=="string"||typeof t=="number"?t:String(t)}function YR({questions:t,initialValues:n,controlledValues:a,onChangeValues:o,onSubmit:l,quoteId:f,widgetStageKey:d}){const m=B.useMemo(()=>$d(t),[t]),_=B.useMemo(()=>Qd(m),[m]),h=B.useMemo(()=>d==="BundlePolicy"?!0:m.some(C=>String(C.key)==="home_prior_carrier_name")&&m.some(C=>String(C.key)==="driver_vehicle_assignments"),[d,m]),v=B.useMemo(()=>{const C={};return n&&Object.assign(C,n),C},[n]),[b,N]=B.useState(v);B.useEffect(()=>{N(v)},[v]);const[w,D]=B.useState({}),k=B.useMemo(()=>({...w,...a??b}),[w,a,b]);B.useEffect(()=>{a&&D(C=>({...C,...a}))},[a]);const[ue,ne]=B.useState({}),se=B.useRef(new Map),W=B.useRef(new Set),[,oe]=B.useState({}),[F,ie]=B.useState({}),te=B.useRef(!1);B.useEffect(()=>{!f||te.current||!m.some(A=>A.key==="year"||A.key==="make"||A.key==="model"||A.key==="body_style")||(te.current=!0,By({quoteId:f}).catch(()=>{}))},[f,m]);const[ae,ve]=B.useState({}),[Ee,Te]=B.useState({}),Le=B.useCallback(async(C,A)=>{if(!f||!vy(A))return;const S=C?C.join("-"):"_root";ve(R=>({...R,[S]:!0})),Te(R=>({...R,[S]:null}));try{const R=await wR({quoteId:f,vin:A});if(R.error){Te(Y=>({...Y,[S]:R.error}));return}let I=k;R.year&&(I=Yt(I,C,"year",String(R.year))),R.make&&(I=Yt(I,C,"make",R.make)),R.model&&(I=Yt(I,C,"model",R.model)),R.bodyStyle&&(I=Yt(I,C,"body_style",R.bodyStyle)),a&&o?o(I):N(I),D(I),se.current.clear(),W.current.clear(),oe({})}catch{Te(R=>({...R,[S]:"VIN lookup failed — please enter vehicle details manually"}))}finally{ve(R=>({...R,[S]:!1}))}},[f,k,a,o]),it=B.useCallback(C=>{const A=`${C.year}|${C.make??""}|${C.model??""}`,S=C.model?"bodyStyles":C.make?"models":"makes",R=se.current.get(A);return R?R[S]??[]:void 0},[]),Ge=B.useCallback((C,A)=>{if(!f)return;const S=`${A.year}|${A.make??""}|${A.model??""}`,R=A.model?"bodyStyles":A.make?"models":"makes",I=`${C}:${R}`;se.current.has(S)||W.current.has(S)||(W.current.add(S),ie(Y=>({...Y,[I]:!0})),By({quoteId:f,...A}).then(Y=>{se.current.set(S,Y),oe(K=>({...K,[I]:Y[R]??[]}))}).catch(()=>{se.current.set(S,{}),oe(Y=>({...Y,[I]:[]}))}).finally(()=>{W.current.delete(S),ie(Y=>({...Y,[I]:!1}))}))},[f]);function he(C,A,S){const R=k,I=C?Io(k,C)??{}:R;return C?{state:R.state,...I,[A]:S}:{...I,[A]:S}}function x(C,A){const S=Ov.filter(I=>I.targetKey===C||I.dependsOn.includes(C)),R={[C]:void 0};for(const I of S){const Y=I.validate(A);I.targetKey in R?Y!==void 0&&(R[I.targetKey]=Y):R[I.targetKey]=Y}ne(I=>({...I,...R}))}const U=(C,A,S)=>{const R=It(k,S,C);if(Vr(R,A)){ue[C]&&ne(Y=>({...Y,[C]:void 0}));return}const I=pd(C,R);if(I){ne(Y=>({...Y,[C]:I}));return}x(C,he(S,C,R))};B.useEffect(()=>{let C=k,A=!1;m.forEach(S=>{if(!Ml(S))return;const R=String(S.key);It(C,void 0,R)!=="Yes"&&(C=Yt(C,void 0,R,"Yes"),A=!0)}),A&&(a&&o?o(C):N(C),D(C))},[m,k,a,o]);function J(C,A){const S=C.key;if((S==="relationship_to_insured"||S==="is_registered_owner")&&A){const V=A[A.length-1];if(typeof V=="number"&&V===0)return null}if((S==="purchase_date"||S==="cost_new_value_cents")&&A)return null;if(S==="custom_equipment_value_cents"&&A){const V=It(k,A,"vehicle_has_modifications");if(V!=="Yes"&&V!==!0)return null}const R=S==="auto_reason_for_no_insurance"&&_.currentCarrierKey?k[_.currentCarrierKey]==="NoPriorInsurance"?"Reason you are not currently insured":"Reason for lapse in coverage":C.question,I=C.hint,Y=It(k,A,S),K=Gl(C,_)?Go(k,_):S==="social_security_number"&&Hl(k.state??k.State)?!0:C.required,Q=ue[S],re=V=>{let X=Yt(k,A,S,V);if(C.inputType==="radio"&&C.conditionals){const ee=C.conditionals??[];for(const de of ee){const Se=It(k,A,S),we=ko(Se,de.conditionalType,de.conditionalValue),Ce=ko(V,de.conditionalType,de.conditionalValue);if(we&&!Ce&&de.conditionalQuestionsAllowMultiple){const Ye=de.conditionalQuestions??[];if(Ye.length>0){const ce=Tl(S);X=Un(X,[...A??[],ce],[]);const He=(xe,lt)=>{xe.forEach(Ht=>{(Ht.conditionals??[]).forEach(pt=>{if(pt.conditionalQuestionsAllowMultiple){const tt=Tl(Ht.key);X=Un(X,[...lt,tt],[])}const $t=pt.conditionalQuestions??[];$t.length>0&&He($t,lt)})})};He(Ye,[...A??[],ce])}}}}a&&o?o(X):N(X),D(X)};if(S==="vehicle_policy_selections"){const V=k.vehicles__items??[],X=k.drivers__items??[];if(V.length===0)return g.jsx("p",{style:{color:"#666",fontStyle:"italic"},children:"Add vehicles first to configure coverage selections."},S);const ee=k.driver_vehicle_assignments??{},de=X.length>1,Se=tt=>Object.entries(tt).map(([ke,vt])=>({value:ke,label:vt})),we=Hl(k.state??k.State),Ce=(tt,ke)=>Object.fromEntries(tt.filter(vt=>vt in ke).map(vt=>[vt,ke[vt]])),ce=Se(Ce(we?hD:gD,hd)),He=we?Ce(yD,gd):gd,xe=Se(He),Ht=Se(Ce(we?vD:bD,Nv)),Ze=(tt,ke,vt)=>{const _t=Un(k,["vehicles__items",tt,ke],vt);a&&o?o(_t):N(_t),D(_t)},pt=(tt,ke,vt)=>{const _t={...ee},Pt=`v${tt}`;_t[Pt]={..._t[Pt]??{}},_t[Pt][`d${ke}`]=vt;const Qe=Un(k,["driver_vehicle_assignments"],_t);a&&o?o(Qe):N(Qe),D(Qe)},$t=tt=>{if(!de)return null;const ke=ee[`v${tt}`];if(!ke)return null;const vt=X.map((Qe,Ft)=>ke[`d${Ft}`]??0),_t=vt.filter(Qe=>Qe>0);if(_t.length>=2&&_t.every(Qe=>Qe===_t[0])&&_t[0]===50)return`Assignments for Vehicle ${tt+1} cannot be 50 percent for both Drivers.`;const Pt=vt.reduce((Qe,Ft)=>Qe+Ft,0);return Pt>0&&Pt!==100?`Driver percentages for this vehicle must add up to 100% (currently ${Pt}%).`:null};return g.jsx("div",{children:V.map((tt,ke)=>{const vt=[tt.year,tt.make,tt.model].filter(Boolean).join(" ")||`Vehicle ${ke+1}`,_t=$t(ke),Pt=Qe=>typeof tt[Qe]=="string"?tt[Qe]:"";return g.jsxs("fieldset",{style:{border:`1px solid ${_t?"#dc3545":"#ddd"}`,borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[g.jsx("legend",{style:{fontWeight:600,padding:"0 8px"},children:vt}),g.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"12px"},children:[g.jsx(Ro,{id:`veh-${ke}-comp`,label:"Comprehensive deductible",required:!0,placeholder:"Select...",options:ce,value:Pt("vehicle_comp_deductible"),onChange:Qe=>Ze(ke,"vehicle_comp_deductible",Qe.currentTarget.value)}),g.jsx(Ro,{id:`veh-${ke}-coll`,label:"Collision deductible",required:!0,placeholder:"Select...",options:ce,value:Pt("vehicle_coll_deductible"),onChange:Qe=>Ze(ke,"vehicle_coll_deductible",Qe.currentTarget.value)}),g.jsx(Ro,{id:`veh-${ke}-tow`,label:"Towing and Labor",required:!0,placeholder:"Select...",options:xe,value:Pt("vehicle_towing_and_labor"),onChange:Qe=>Ze(ke,"vehicle_towing_and_labor",Qe.currentTarget.value)}),g.jsx(Ro,{id:`veh-${ke}-trans`,label:"Transportation expense",required:!0,placeholder:"Select...",options:Ht,value:Pt("vehicle_transportation_expense"),onChange:Qe=>Ze(ke,"vehicle_transportation_expense",Qe.currentTarget.value)})]}),de&&g.jsxs("div",{style:{marginTop:"16px"},children:[g.jsx("p",{style:{fontWeight:600,margin:"0 0 8px"},children:"Drivers usage (%)"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px"},children:X.map((Qe,Ft)=>{const Dt=[Qe.first_name,Qe.last_name].filter(Boolean).join(" ")||`Driver ${Ft+1}`,bt=ee[`v${ke}`]?.[`d${Ft}`];return g.jsx("div",{style:{flex:"0 0 140px"},children:g.jsx(Rf,{id:`assignment-v${ke}-d${Ft}`,label:`${Dt} %`,value:bt??"",min:0,max:100,step:1,inputMode:"numeric",onChange:Ct=>{const Fn=Ct.currentTarget.value.replace(/\D+/g,"");pt(ke,Ft,Fn===""?0:Math.min(100,parseInt(Fn,10)))}})},`${ke}-${Ft}`)})}),_t&&g.jsx("p",{style:{color:"#dc3545",fontSize:"0.85rem",marginTop:"8px",marginBottom:0},children:_t})]})]},ke)})},S)}if(S==="driver_vehicle_assignments"){const V=k.vehicles__items??[],X=k.drivers__items??[];if(h&&X.length<=1)return null;if(V.length===0||X.length===0)return g.jsx("p",{style:{color:"#666",fontStyle:"italic"},children:"Add vehicles and drivers first to configure driver usage percentages."},S);const ee=k.driver_vehicle_assignments??{},de=(we,Ce,Ye)=>{const ce={...ee},He=`v${we}`;ce[He]={...ce[He]??{}},ce[He][`d${Ce}`]=Ye,re(ce)},Se=we=>{if(X.length<2)return null;const Ce=ee[`v${we}`];if(!Ce)return null;const Ye=X.map((xe,lt)=>Ce[`d${lt}`]??0),ce=Ye.filter(xe=>xe>0);if(ce.length>=2&&ce.every(xe=>xe===ce[0])&&ce[0]===50)return`Assignments for Vehicle ${we+1} cannot be 50 percent for both Drivers.`;const He=Ye.reduce((xe,lt)=>xe+lt,0);return He>0&&He!==100?`Driver percentages for this vehicle must add up to 100% (currently ${He}%).`:null};return g.jsxs("div",{children:[g.jsx("h4",{style:{marginBottom:"12px"},children:R}),V.map((we,Ce)=>{const Ye=[we.year,we.make,we.model].filter(Boolean).join(" ")||`Vehicle ${Ce+1}`,ce=Se(Ce);return g.jsxs("fieldset",{style:{border:`1px solid ${ce?"#dc3545":"#ddd"}`,borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[g.jsx("legend",{style:{fontWeight:600,padding:"0 8px"},children:Ye}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px"},children:X.map((He,xe)=>{const lt=[He.first_name,He.last_name].filter(Boolean).join(" ")||`Driver ${xe+1}`,Ht=ee[`v${Ce}`]?.[`d${xe}`];return g.jsx("div",{style:{flex:"0 0 140px"},children:g.jsx(Rf,{id:`assignment-v${Ce}-d${xe}`,label:`${lt} %`,value:Ht??"",min:0,max:100,step:1,inputMode:"numeric",onChange:Ze=>{const pt=Ze.currentTarget.value.replace(/\D+/g,"");de(Ce,xe,pt===""?0:Math.min(100,parseInt(pt,10)))}})},`${Ce}-${xe}`)})}),ce&&g.jsx("p",{style:{color:"#dc3545",fontSize:"0.85rem",marginTop:"8px",marginBottom:0},children:ce})]},Ce)})]},S)}switch(C.inputType){case"text":{if(S==="vin"&&f){const V=A?A.join("-"):"_root",X=ae[V]??!1,ee=Ee[V]??null,de=[I?`${S}-hint`:null,Q?`${S}-error`:null,ee?`${S}-vin-error`:null].filter(Boolean).join(" ");return g.jsxs("div",{children:[g.jsx(hn,{id:S,label:R,hint:I,error:Q,required:K,children:g.jsxs("div",{className:"flex items-end gap-2",children:[g.jsx("div",{className:"flex-1 min-w-0",children:g.jsx("input",{id:S,className:`form-input ${Q?"input-error":""}`,"aria-invalid":!!Q,"aria-describedby":de||void 0,"aria-required":K||void 0,required:K,value:rn(Y),maxLength:17,onChange:Se=>re(Se.currentTarget.value),onBlur:()=>U(S,"text",A),autoComplete:Al[S],type:"text"})}),g.jsx("button",{type:"button",disabled:X||!vy(rn(Y)),className:"btn btn-outline shrink-0 self-end !w-auto min-w-[8.5rem] px-4 whitespace-nowrap disabled:opacity-50",onClick:()=>Le(A,rn(Y)),children:X?"Looking up...":"Verify VIN"})]})}),ee&&g.jsx("p",{id:`${S}-vin-error`,className:"text-sm text-red-600 mt-1",children:ee})]},S)}if(S==="sms_code"){const V=rn(Y);return g.jsx(Df,{id:S,label:R,hint:I,value:V,inputMode:"numeric",pattern:"[0-9]*",maxLength:6,onChange:X=>{const ee=X.currentTarget.value.replace(/\D+/g,"").slice(0,6);re(ee)},onBlur:()=>U(S,"text",A),"aria-required":K||void 0,error:Q,autoComplete:Al[S]},S)}if(S==="license_number")return g.jsx(Df,{id:S,label:R,hint:I,value:rn(Y),onChange:V=>re(V.currentTarget.value.replace(/[^A-Z0-9]/gi,"").slice(0,20)),onBlur:()=>U(S,"text",A),"aria-required":K||void 0,error:Q,autoComplete:"off",maxLength:20},S);if(S==="social_security_number"){const V=It(k,A,"ssn_display"),X=typeof V=="string"?V:"",ee=X?`${X}. Re-enter to update.${I?` ${I}`:""}`:I;return g.jsx(QC,{id:S,label:R,hint:ee,value:rn(Y),onChange:de=>re(de.currentTarget.value),onBlur:()=>U(S,"text",A),"aria-required":K||void 0,error:Q},S)}return g.jsx(Df,{id:S,label:R,hint:I,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"text",A),"aria-required":K||void 0,error:Q,autoComplete:Al[S],maxLength:BR[S]},S)}case"email":return g.jsx(XC,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"email",A),"aria-required":K||void 0,error:Q},S);case"password":return g.jsx(eO,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"password",A),"aria-required":K||void 0,error:Q},S);case"tel":return g.jsxs(g.Fragment,{children:[g.jsx(WC,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"tel",A),"aria-required":K||void 0,error:Q},S),S==="phone"&&g.jsxs("div",{className:"mt-3 text-xs text-slate-600 space-y-1",children:[g.jsx("p",{children:"We verify your number before showing your quotes — you'll get a 6-digit code next. This is just to confirm your number, not a sales call."}),g.jsx("p",{children:"Message & data rates may apply. One message per request."}),g.jsxs("p",{children:["See our"," ",g.jsx("a",{href:"https://getcredify.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})," ","and"," ",g.jsx("a",{href:"https://getcredify.com/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Terms of Service"}),"."]})]})]});case"url":return g.jsx(JC,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"url",A),"aria-required":K||void 0,error:Q},S);case"number":{const V=zR[S];return Hy.has(S)||jR.has(S)?g.jsx(KC,{id:S,label:R,hint:I,value:Zy(Y),isCurrency:Hy.has(S),maxDigits:V,onChange:X=>re(Uy(X.currentTarget.value)),onBlur:()=>U(S,"number",A),"aria-required":K||void 0,error:Q},S):g.jsx(Rf,{id:S,label:R,hint:I,value:Zy(Y),inputMode:"numeric",pattern:"[0-9]*",onKeyDown:X=>{if(kR(X.key)){X.preventDefault();return}V!==void 0&&/^\d$/.test(X.key)&&String(X.currentTarget.value).replace(/\D/g,"").length>=V&&X.preventDefault()},onChange:X=>{let ee=X.currentTarget.value;V!==void 0&&(ee=ee.slice(0,V)),re(Uy(ee))},onBlur:()=>U(S,"number",A),"aria-required":K||void 0,error:Q},S)}case"textarea":return g.jsx(tO,{id:S,label:R,value:rn(Y),onChange:V=>re(V.currentTarget.value),onBlur:()=>U(S,"textarea",A),"aria-required":K||void 0,error:Q,rows:4},S);case"date":{const{min:V,max:X}=IR(S);return g.jsx(nO,{id:S,label:R,hint:I,value:rn(Y),min:V,max:X,onChange:ee=>{const de=ee.currentTarget.value;re(de),!Vr(de,"date")&&!pd(S,de)&&x(S,he(A,S,de))},onBlur:()=>U(S,"date",A),"aria-required":K||void 0,error:Q,autoComplete:Al[S]},S)}case"checkbox":{if(C.options){const V=Array.isArray(Y)?Y:[];return g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"form-label",children:[R,K&&g.jsx("span",{className:"text-red-600 ml-1",children:"*"})]}),g.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:C.options.map(X=>{const ee=`${S}-${_d(X)}`,de=V.includes(X);return g.jsx(zl,{id:ee,label:X,checked:de,onChange:Se=>{const we=new Set(V);Se.currentTarget.checked?we.add(X):we.delete(X),re(Array.from(we))},"aria-required":K||void 0},ee)})}),Q&&g.jsx("p",{className:"mt-1 text-sm text-red-600",children:Q})]},S)}return g.jsx(zl,{id:S,label:K?`${R} *`:R,checked:!!Y,onChange:V=>re(V.currentTarget.checked),"aria-required":K||void 0},S)}case"radio":{if(Ml(C))return null;const V=C.options??[],X=A&&A.length>0?`${S}__${A.join("__")}`:S;return g.jsx(iO,{legend:R,legendClassName:K?"legend-required":void 0,children:V.map(ee=>g.jsx(aO,{name:X,value:ee,checked:Y===ee,onChange:()=>{re(ee),x(S,he(A,S,ee))},children:Iy[S]?.[ee]??ee},`${S}-${_d(ee)}`))},S)}case"select":{let V=C.options??[];S==="quote_vehicle_id"&&(V=a?.vehicles__items?.map(Ce=>Ce.vin)??[]);let X=!1,ee,de,Se;if(S==="year"||S==="make"||S==="model"||S==="body_style"){const Ce=A?A.join("-"):"_root";ae[Ce]&&(X=!0,ee="Looking up VIN...")}if(!X&&(S==="make"||S==="model"||S==="body_style")){const Ce=A?A.join("-"):"_root";Se=Ce;const Ye=It(k,A,"year"),ce=typeof Ye=="number"?Ye:Number(Ye);if(S==="make"){const He=`${Ce}:makes`;if(!ce||!Number.isFinite(ce))X=!0,ee="Select a year first";else{de={year:ce};const xe=it(de);xe&&xe.length>0?V=xe:F[He]?(X=!0,ee="Loading makes..."):V=[...JD]}}else if(S==="model"){const He=`${Ce}:models`,xe=String(It(k,A,"make")??"");if(!xe)X=!0,ee="Select a make first";else if(ce&&Number.isFinite(ce)){de={year:ce,make:xe};const lt=it(de);lt&<.length>0?V=lt:F[He]?(X=!0,ee="Loading models..."):V=[...DR]}typeof Y=="string"&&Y&&!V.includes(Y)&&(V=[Y,...V])}else{const He=`${Ce}:bodyStyles`,xe=String(It(k,A,"make")??""),lt=String(It(k,A,"model")??"");if(!lt)X=!0,ee="Select a model first";else if(ce&&Number.isFinite(ce)&&xe){de={year:ce,make:xe,model:lt};const Ht=it(de);Ht&&Ht.length>0?V=Ht:F[He]?(X=!0,ee="Loading body styles..."):V=[...RR]}typeof Y=="string"&&Y&&!V.includes(Y)&&(V=[Y,...V])}}if(S==="occupation"||S==="co_applicant_occupation"){const Ce=S==="co_applicant_occupation"?"co_applicant_employment_industry":void 0,Ye=Ce?void 0:It(k,A,"industry"),ce=It(k,A,Ce??"employment_industry"),xe=String(Fl(Ye??ce)??"").trim();V=[...Ay[xe]??LR],typeof Y=="string"&&Y&&!V.includes(Y)&&(V=[Y,...V])}const we=$R(A,S);return g.jsx(Ro,{id:we,label:ee?`${R} — ${ee}`:R,"aria-required":K||void 0,error:Q,disabled:X,value:GR(Y),onChange:Ce=>{const Ye=Ce.currentTarget.value;if(S!=="year"&&S!=="make"&&S!=="model"&&S!=="industry"&&S!=="employment_industry"&&S!=="co_applicant_employment_industry"){re(Ye),x(S,he(A,S,Ye));return}let ce=Yt(k,A,S,Ye);if(S==="year")ce=Yt(ce,A,"make",""),ce=Yt(ce,A,"model",""),ce=Yt(ce,A,"body_style","");else if(S==="make")ce=Yt(ce,A,"model",""),ce=Yt(ce,A,"body_style","");else if(S==="model")ce=Yt(ce,A,"body_style","");else if(S==="industry"||S==="employment_industry")ce=Yt(ce,A,"occupation","");else if(S==="co_applicant_employment_industry"){const xe=String(Fl(Ye)??"").trim(),lt=Ay[xe]??[],Ht=lt.find(Ze=>Ze===xe)??lt[0]??"";ce=Yt(ce,A,"co_applicant_occupation",Ht??"")}a&&o?o(ce):N(ce),D(ce);const He=A?Io(ce,A)??{}:ce;x(S,{...He,[S]:Ye})},placeholder:ee??"Select an option",onFocus:de&&Se?()=>Ge(Se,de):void 0,options:V.map(Ce=>({value:Ce,label:Iy[S]?.[Ce]??xR[Ce]??Ce}))},we)}case"address":return g.jsx(cO,{id:S,label:R,value:rn(Y),onChange:(V,X)=>{let ee=Yt(k,A,S,V);const de=X?.state??(typeof V=="string"?V.match(/,\s*([A-Z]{2})\s+\d{5}\b/)?.[1]:void 0);if(de){const Se=A?[...A,"state"]:["state"];ee=Un(ee,Se,de)}a&&o?o(ee):N(ee),D(ee)},onBlur:()=>U(S,"address",A),required:K,"aria-required":K||void 0,error:Q},S);default:return null}}function _e(C,A){const S=C.some(I=>String(I.key)==="years_at_address"),R=C.find(I=>String(I.key)==="months_at_address");return C.map((I,Y)=>{const K=String(I.key);if(K==="months_at_address"&&S||!wl(I,k,_)||!Hf(I,k,A)||!Nl(I,k,d))return null;if($f(K,I,k,d)){const Se=_.currentCarrierKey?k[_.currentCarrierKey]:void 0;if(!(Se&&Se!=="NoPriorInsurance"&&wi(k,_)&&Uf.has(K)))return null}const Q=J(I,A),re=K==="years_at_address"&&R?J(R,A):null,V=I.conditionals??[];if(!V.length)return d==="BundlePolicy"&&K==="policy_bi"?g.jsxs("div",{children:[g.jsx("h3",{className:"text-lg font-semibold mt-6 mb-3",children:"Vehicle Coverage Information"}),Q]},`wrap-${K}-${Y}`):g.jsxs("div",{children:[Q,re]},`wrap-${K}-${Y}`);const X=$y(I,It(k,A,K)),ee=V.filter(Se=>ko(X,Se.conditionalType,Se.conditionalValue)),de=ee.length>1&&!ee.some(Se=>Se.conditionalQuestionsAllowMultiple)?ee.slice(0,1):ee;return g.jsxs("div",{children:[Q,re,de.map((Se,we)=>{const Ce=Se.conditionalQuestions??[];if(!Ce.length)return null;if(!Se.conditionalQuestionsAllowMultiple)return g.jsx("div",{className:"mt-3",children:_e(Ce,A)},`branch-${K}-${we}`);const Ye=Tl(K),ce=Io(k,[...A??[],Ye])??[],He=Math.max(1,ce.length||1),xe=()=>{const Ze=Un(k,[...A??[],Ye,ce.length],{});a&&o?o(Ze):N(Ze),D(Ze)},lt=()=>{const Ze=ce.slice(0,Math.max(0,ce.length-1)),pt=Un(k,[...A??[],Ye],Ze);a&&o?o(pt):N(pt),D(pt)},Ht=`${K}__c${we}`;return g.jsxs("div",{className:"mt-3",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsx("div",{className:"text-sm font-medium opacity-75",children:"Add one or more entries"}),g.jsxs("div",{className:"space-x-2",children:[g.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:xe,children:"Add another"}),He>1&&g.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:lt,children:"Remove last"})]})]}),Array.from({length:He}).map((Ze,pt)=>{const $t=[...A??[],Ye,pt],tt=`${Ht}__i${pt}`,ke=ce[pt]??{},vt=K==="drivers",Qe=vt?`Driver #${pt+1}`:K==="vehicles"?`Vehicle #${pt+1}`:K==="home_losses"||K==="losses"?`Loss #${pt+1}`:`Entry #${pt+1}`,Dt=vt&&typeof ke.ssn_display=="string"&&ke.ssn_display?` — ${ke.ssn_display}`:"";return g.jsxs("div",{className:"rounded-lg border p-3 mb-3",children:[g.jsxs("div",{className:"text-sm font-semibold mb-2",children:[Qe,Dt]}),Ce.map(bt=>{const Ct=String(bt.key);if(!wl(bt,k,_)||!Hf(bt,k,$t)||!Nl(bt,k,d))return null;if($f(Ct,bt,k,d)){const Fn=_.currentCarrierKey?k[_.currentCarrierKey]:void 0;if(!(Fn&&Fn!=="NoPriorInsurance"&&wi(k,_)&&Uf.has(Ct)))return null}return g.jsxs("div",{className:"mt-3",children:[J(bt,$t),(()=>{const Fn=bt.conditionals??[];if(!Fn.length)return null;const qo=It(k,$t,bt.key),za=Fn.filter(yn=>ko(qo,yn.conditionalType,yn.conditionalValue));return(za.length>1&&!za.some(yn=>yn.conditionalQuestionsAllowMultiple)?za.slice(0,1):za).map((yn,vr)=>{const zn=yn.conditionalQuestions??[];if(!zn.length)return null;if(!yn.conditionalQuestionsAllowMultiple)return g.jsx("div",{className:"mt-3",children:_e(zn,$t)},`nested-${tt}-${vr}`);const Kn=Tl(bt.key),Gn=Io(k,[...$t,Kn])??[],Vo=Math.max(1,Gn.length||1),Ko=()=>{const vn=Un(k,[...$t,Kn,Gn.length],{});a&&o?o(vn):N(vn),D(vn)},Ui=()=>{const vn=Gn.slice(0,Math.max(0,Gn.length-1)),Qn=Un(k,[...$t,Kn],vn);a&&o?o(Qn):N(Qn),D(Qn)};return g.jsxs("div",{className:"mt-3",children:[g.jsxs("div",{className:"flex items-center justify-between mb-2",children:[g.jsx("div",{className:"text-sm font-medium opacity-75",children:"Add one or more entries"}),g.jsxs("div",{className:"space-x-2",children:[g.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Ko,children:"Add another"}),Vo>1&&g.jsx("button",{type:"button",className:"btn-outline px-3 py-1",onClick:Ui,children:"Remove last"})]})]}),Array.from({length:Vo}).map((vn,Qn)=>{const Qo=[...$t,Kn,Qn];return g.jsxs("div",{className:"rounded-lg border p-3 mb-3",children:[g.jsxs("div",{className:"text-sm font-semibold mb-2",children:["Entry #",Qn+1]}),_e(zn,Qo)]},`nested-item-${tt}-${vr}-${Qn}`)})]},`nested-repeat-${tt}-${vr}`)})})()]},`${tt}-${Ct}`)})]},`group-${tt}`)})]},`branch-${K}-${we}`)})]},`wrap-${K}-${Y}`)})}const G=B.useMemo(()=>{const C=[],A=(S,R)=>{S.forEach(I=>{if(!wl(I,k,_)||!Hf(I,k,R)||!Nl(I,k,d))return;const Y=String(I.key);if($f(Y,I,k,d)){const X=_.currentCarrierKey?k[_.currentCarrierKey]:void 0;if(!(X&&X!=="NoPriorInsurance"&&wi(k,_)&&Uf.has(Y)))return}Ml(I)||C.push(I);const K=I.conditionals??[];if(!K.length)return;const Q=$y(I,It(k,R,Y)),re=K.filter(X=>ko(Q,X.conditionalType,X.conditionalValue));(re.length>1&&!re.some(X=>X.conditionalQuestionsAllowMultiple)?re.slice(0,1):re).forEach(X=>{const ee=X.conditionalQuestions??[];ee.length&&(X.conditionalQuestionsAllowMultiple||A(ee,R))})})};return A(m),C},[m,k,_,d]);function E(C){C.preventDefault();const A=Go(k,_),S=G.map(I=>Gl(I,_)?{...I,required:A}:I),R=$l(S,k);if(ne(R),Object.keys(R).length>0){const I=G.findIndex(Y=>R[Y.key]);I>=0&&document.getElementById(G[I].key)?.focus();return}l(k)}return g.jsx("form",{className:"space-y-6 px-1",onSubmit:E,noValidate:!0,children:_e(m)})}const ZR="https://getcredify.com/privacy-policy";function PR(){return g.jsx("a",{href:ZR,target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Policy"})}function Py(){return g.jsxs(g.Fragment,{children:["See our ",g.jsx(PR,{})," for how we use your information."]})}const qR=new Set(["Product","Name","Home","HomeConstruction","HomeFeatures","Vehicle","Driver","Demographics","Customer","HomeCustomer","BundleCustomer"]),VR=new Set(["AutoCurrentCarrier","HomeCurrentCarrier","HomePolicy","BundlePolicy","AutoPolicy"]);function KR({stageKey:t}){return t?t==="Zip"?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:"No credit card required."}):t==="Email"?g.jsxs("div",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left space-y-1",children:[g.jsx("p",{children:"We'll send your quotes and updates here, and save your progress so you can return anytime."}),g.jsx("p",{children:g.jsx(Py,{})})]}):VR.has(t)?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:"Tell us about your current coverage. Carriers ask about your coverage history to put together accurate quotes — it's a standard step on any application. Coverage gaps are common, so just enter things as they are. You're almost there: your quotes are almost ready."}):t==="Ssn"?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:"Your SSN is required by some carriers for fraud prevention, underwriting and to generate a quote. It's entered directly into our secure, encrypted form."}):t==="SMSVerification"?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:"You'll receive a text from Credify shortly."}):qR.has(t)?g.jsx("p",{className:"stage-footer-hint mt-3 text-xs text-slate-600 text-left",children:g.jsx(Py,{})}):null:null}const QR=["widgetOpened","widgetClosed","stageViewed","stageCompleted","flowCompleted","ratesViewed","ratesBack","submissionFailed"],Yl={};function XR(t){let n=Yl[t];return n||(n=new Set,Yl[t]=n),n}function Uv(t,n){XR(t).add(n)}function Hv(t,n){Yl[t]?.delete(n)}function ra(t,...n){const a=Yl[t];if(!a||a.size===0)return;const o=n[0],l={quoteId:ac(),timestamp:Date.now()};for(const f of[...a])try{f(o,l)}catch(d){ec(d,{tags:{source:"widget-event-listener",event:t}})}}function WR(){ra("widgetOpened")}function qy(){ra("widgetClosed")}function JR(t){ra("stageViewed",t)}function Vy(t){ra("stageCompleted",t)}function e2(){ra("flowCompleted")}function t2(t){ra("ratesViewed",t)}function n2(){ra("ratesBack")}function zo(t){ra("submissionFailed",t)}const $v=new Set(["Disabled","Retired","Unemployed","Other"]);function r2(t,n){const a=String(t.key??"");if(a==="co_applicant_occupation"||a!=="occupation")return!0;const o=n.industry,l=n.employment_industry,f=String(o??l??"").trim();return!$v.has(f)}function a2(t,n){const a=String(t.key??"");if(a==="co_applicant_occupation"||a!=="occupation")return!0;const o=n.industry,l=n.employment_industry,f=String(o??l??"").trim();return!$v.has(f)}function Fv(t){return t.inputType!=="radio"||!t.options||t.options.length!==1||t.options[0]!=="Yes"?!1:(t.conditionals??[]).some(a=>a.conditionalQuestionsAllowMultiple&&a.conditionalType==="equals"&&a.conditionalValue==="Yes")}function Gv(t,n){return Fv(t)?"Yes":n}function Ky(t){return typeof t=="number"&&Number.isFinite(t)?t:typeof t=="string"&&t.trim()!==""&&!Number.isNaN(Number(t))?Number(t):null}function Qy(t){if(t instanceof Date&&!Number.isNaN(t.getTime()))return t.getTime();if(typeof t=="string"){const n=Date.parse(t);return Number.isNaN(n)?null:n}return null}function Xy(t,n){const a=Ky(t),o=Ky(n);if(a!=null&&o!=null)return a-o;const l=Qy(t),f=Qy(n);return l!=null&&f!=null?l-f:t==null||n==null?null:String(t).localeCompare(String(n))}function i2(t,n){return Array.isArray(t)?t.some(a=>a===n):typeof t=="string"?n!=null&&t.includes(String(n)):!1}function Yv(t,n,a){switch(n){case"equals":return t===a;case"notEquals":return t!==a&&t!==""&&t!=null;case"lessThan":{const o=Xy(t,a);return o!=null&&o<0}case"greaterThan":{const o=Xy(t,a);return o!=null&&o>0}case"contains":return i2(t,a);case"startsWith":return t!=null&&a!=null&&String(t).startsWith(String(a));case"endsWith":return t!=null&&a!=null&&String(t).endsWith(String(a));default:return!1}}const o2=new Set(["auto_prior_years","auto_prior_months","auto_continuous_coverage_years"]);function bd(t,n,a){const o=$d([...t]),l=Qd(o),f=[],d=m=>{m.forEach(_=>{if(!wl(_,n,l)||!r2(_,n)||!Nl(_,n,a))return;const h=String(_.key);if(Tv(h,a,n)){const D=l.currentCarrierKey?n[l.currentCarrierKey]:void 0;if(!(D&&D!=="NoPriorInsurance"&&wi(n,l)&&o2.has(h)))return}Fv(_)||f.push(_);const v=Gv(_,n[h]),b=_.conditionals??[];if(!b.length)return;const N=b.filter(D=>Yv(v,D.conditionalType,D.conditionalValue));(N.length>1&&!N.some(D=>D.conditionalQuestionsAllowMultiple)?N.slice(0,1):N).forEach(D=>{const k=D.conditionalQuestions??[];k.length&&(D.conditionalQuestionsAllowMultiple||d(k))})})};return d(o),f}const Zv="__items",Sd=t=>`${t}${Zv}`;function s2(t,n){if(t.key==="relationship_to_insured"||t.key==="is_registered_owner"){const a=n[n.length-1];return typeof a=="number"&&a===0}return!1}function Ed(t,n,a=[],o=void 0,l=n){for(const f of t){const d=String(f.key),m=Gv(f,n[d]),_=f.conditionals??[];if(!_.length)continue;const h=_.filter(b=>Yv(m,b.conditionalType,b.conditionalValue)),v=h.length>1&&!h.some(b=>b.conditionalQuestionsAllowMultiple)?h.slice(0,1):h;for(const b of v){const N=b.conditionalQuestions??[];if(!N.length)continue;if(!b.conditionalQuestionsAllowMultiple){if(Ed(N,n,a,o,l))return!0;continue}const w=n[Sd(d)]??[];if(w.length===0)return!0;for(const[D,k]of w.entries()){const ue=[...a,Sd(d),D],ne=bd(N,k,o).filter(oe=>!(s2(oe,ue)||!a2(oe,k))),se={state:l.state,...k},W=$l(ne,se);if(Object.values(W).some(Boolean)||Ed(N,k,ue,o,l))return!0}}}return!1}function Wy(t,n,a){return Ed(t,n,[],a,n)}function Jy(t){const n=t.vehicles__items??[];if(!Array.isArray(n)||n.length===0)return!1;for(const a of n)if(Vr(a.vehicle_comp_deductible,"select")||Vr(a.vehicle_coll_deductible,"select")||Vr(a.vehicle_towing_and_labor,"select")||Vr(a.vehicle_transportation_expense,"select"))return!0;return!1}function l2({stages:t,onStageComplete:n,onComplete:a,initialValues:o,initialActive:l,quoteId:f,nonTerminalStageKeys:d}){const[m,_]=B.useState(l??0),[h,v]=B.useState(o??{}),[b,N]=B.useState({}),[w,D]=B.useState(!1),[k,ue]=B.useState(!1),[ne,se]=B.useState(null),W=B.useRef([]),oe=B.useRef(t),F=Array.isArray(t)&&t.length>0,ie=F?Math.min(m,t.length-1):0,te=F?t[ie]:null,ae=te?.key??null;B.useEffect(()=>{l!==void 0&&_(l)},[l]),oe.current=t;const ve=B.useMemo(()=>{const U=ie>=t.length-1;return U&&ae&&d?.has(ae)?!1:!!(U||t.slice(ie+1).every(_e=>_e.key==="AutoPolicy")&&(h.drivers__items??[]).length<=1)},[ie,t,h,ae,d]);B.useEffect(()=>{F&&m>=t.length&&_(t.length-1)},[m,t.length,F]),B.useEffect(()=>{const U=W.current[ie];U&&U.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[ie]),B.useEffect(()=>{o!==void 0&&v(o)},[o]),B.useEffect(()=>{if(!te||!ae){D(!1),se(null);return}if(b[ae]){D(!1),se(null);return}let U=!1;return D(!0),se(null),Promise.resolve(te.loadQuestions()).then(J=>{if(!U){if(!Array.isArray(J))throw new Error(`loadQuestions("${ae}") did not return an array`);N(_e=>({..._e,[ae]:J}))}}).catch(J=>{U||se(`Failed to load stage "${te?.title??""}": ${J?.message??"Unknown error"}`)}).finally(()=>{U||D(!1)}),()=>{U=!0}},[te,ae,b]);const Ee=ae?b[ae]:void 0,Te=B.useMemo(()=>Qd($d(Ee??[])),[Ee]);B.useEffect(()=>{te&&ae&&Ee&&JR({stageKey:ae,stageTitle:te.title??ae,stepIndex:m+1,totalSteps:t.length})},[ae,m,t.length,te,Ee]);const Le=B.useMemo(()=>{if(!Ee)return{};const U={};(G=>{const E=[],C=A=>{A.forEach((S,R)=>{const I=Uo(S,R);E.push(I);const Y=Sd(I);E.push(Y),(S.conditionals??[]).forEach(Q=>{const re=Q.conditionalQuestions??[];re.length>0&&C(re)})})};return C(G),E})(Ee).forEach(G=>{G in h&&(U[G]=h[G])});for(const G of["state","State","address","product"])G in h&&(U[G]=h[G]);for(const[G,E]of Object.entries(h))G.endsWith(Zv)&&!(G in U)&&(U[G]=E);return U},[Ee,h]),it=U=>{v(J=>({...J,...U}))},Ge=()=>{_(U=>U>0?U-1:0),document.querySelector(".panel-body")?.scrollTo({top:0,behavior:"instant"})},he=async()=>{if(!Ee||!te||w||ne||k)return;const U=bd(Ee,Le,ae??void 0),J=Go(h,Te),_e=U.map(Q=>Gl(Q,Te)?{...Q,required:J}:Q),G=$l(_e,Le),E=new Set(_e.map((Q,re)=>Uo(Q,re))),C=Object.entries(G).some(([Q,re])=>re&&E.has(Q)),A=Wy(Ee,h,ae??void 0),R=U.some(Q=>String(Q.key??"")==="vehicle_policy_selections")?Jy(h):!1,I=h.driver_vehicle_assignments,Y=h.drivers__items??[];let K=!1;if(I&&Y.length>=2){const Q=h.vehicles__items??[];for(let re=0;re<Q.length;re++){const V=I[`v${re}`];if(!V)continue;const X=Y.map((Se,we)=>V[`d${we}`]??0),ee=X.filter(Se=>Se>0);if(ee.length>=2&&ee.every(Se=>Se===50)){K=!0;break}const de=X.reduce((Se,we)=>Se+we,0);if(de>0&&de!==100){K=!0;break}}}if(!(C||A||R||K)){ue(!0);try{const Q=ve,re=Q?await a(h,ae??""):await n(Le,ae??""),{success:V,error:X}=re;if(!V){se(X??"An error occurred");return}if(!Q){const ee=re.latestStages??oe.current,de=ee.findIndex(we=>we.key===ae),Se=de>=0?Math.min(de+1,ee.length-1):Math.min(m+1,ee.length-1);_(Se)}}finally{ue(!1)}}},x=B.useMemo(()=>{if(!Ee||w||ne||k)return!0;const U=bd(Ee,Le,ae??void 0),J=Go(h,Te),_e=U.map(Q=>Gl(Q,Te)?{...Q,required:J}:Q),G=$l(_e,Le),E=new Set(_e.map((Q,re)=>Uo(Q,re))),C=Object.entries(G).some(([Q,re])=>re&&E.has(Q)),A=Wy(Ee,h,ae??void 0),R=U.some(Q=>String(Q.key??"")==="vehicle_policy_selections")?Jy(h):!1,I=h.driver_vehicle_assignments,Y=h.drivers__items??[];let K=!1;if(I&&Y.length>=2){const Q=h.vehicles__items??[];for(let re=0;re<Q.length;re++){const V=I[`v${re}`];if(!V)continue;const X=Y.map((Se,we)=>V[`d${we}`]??0),ee=X.filter(Se=>Se>0);if(ee.length>=2&&ee.every(Se=>Se===50)){K=!0;break}const de=X.reduce((Se,we)=>Se+we,0);if(de>0&&de!==100){K=!0;break}}}return C||A||R||K},[Ee,Le,h,w,ne,k,Te,ae]);return F?g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"form-wizard-steps-header flex items-center justify-between gap-4",children:[g.jsx("ol",{className:"form-wizard-steps flex gap-2 text-xs overflow-x-auto flex-1 pb-1 scrollbar-hide items-center",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t.flatMap((U,J)=>[g.jsx("li",{ref:_e=>{W.current[J]=_e},className:`form-wizard-step-pill px-2.5 py-1 rounded-full border whitespace-nowrap flex-shrink-0 ${J<ie?"bg-blue-600 text-white border-blue-600":J===ie?"border-blue-600 text-blue-600 bg-white":"border-slate-200 text-slate-600"}`,children:U.title},U.key??`stage-${J}`),...J<t.length-1?[g.jsx("li",{className:"form-wizard-step-arrow text-slate-400 flex-shrink-0",children:"→"},`arrow-${U.key??J}`)]:[]])}),g.jsxs("div",{className:"form-wizard-step-counter text-sm text-slate-500 flex-shrink-0",children:[ie+1," / ",t.length]})]}),g.jsxs("div",{children:[w&&g.jsx("div",{className:"text-slate-500",children:"Loading…"}),te&&g.jsx(YR,{questions:Ee??[],controlledValues:Le,onChangeValues:it,onSubmit:()=>he(),quoteId:f,widgetStageKey:ae??void 0},te.key)]}),!w&&ne&&g.jsxs("div",{className:"text-red-600 text-sm -mt-4",children:[g.jsx("div",{children:ne}),te&&g.jsx("button",{type:"button",className:"credify-retry-btn underline mt-1 font-bold",onClick:()=>{N(U=>{if(!ae)return U;const J={...U};return delete J[ae],J})},children:"Retry"})]}),g.jsx(KR,{stageKey:ae}),g.jsxs("div",{className:ie>0?"grid grid-cols-2 gap-3":"",children:[ie>0&&g.jsx("button",{type:"button",onClick:Ge,disabled:w,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",children:"Back"}),g.jsxs("button",{type:"button","data-widget-ctrl":"next",onClick:he,disabled:x,className:["form-wizard-next-btn",ie>0?"":"w-full","h-12 rounded-full text-white transition","disabled:opacity-50 disabled:cursor-not-allowed","flex items-center justify-center gap-2",x?"bg-gray-300":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[k&&g.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[g.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),g.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),ve?"Finish":"Next"]})]})]}):g.jsx("div",{className:"text-slate-600",children:"Loading..."})}const Pv={SafecoPersonal:{name:"Safeco",abbr:"SFC",color:"#0F337A"},SafecoPersoanl:{name:"Safeco",abbr:"SFC",color:"#0F337A"},AssuranceAmerica:{name:"Assurance America",abbr:"AA",color:"#2768B5"},CommonWealthCasualty:{name:"Commonwealth Casualty",abbr:"CW",color:"#2D69EC"},Alinsco:{name:"Alinsco",abbr:"AL",color:"#20395D"},ACORDBOLTPersonalAuto:{name:"Bolt Auto",abbr:"BLT",color:"#1F2937"},ACORDBOLTPersonalHome:{name:"Bolt Home",abbr:"BLT",color:"#1F2937"},TwentyFirstCentury:{name:"21st Century",abbr:"21C",color:"#B2392A"},ACentral:{name:"A-Central",abbr:"ACT",color:"#EAAD1D"},AAA:{name:"AAA",abbr:"AAA",color:"#DB461C"},AARP:{name:"AARP",abbr:"ARP",color:"#DB4724"},Acadia:{name:"Acadia",abbr:"ACD",color:"#386B61"},Ace:{name:"ACE",abbr:"ACE",color:"#457D48"},Acuity:{name:"Acuity",abbr:"ACU",color:"#D74630"},AdirondackInsExchange:{name:"Adirondack",abbr:"ADK",color:"#1F5490"},Aegis:{name:"Aegis",abbr:"AEG",color:"#1A4675"},AIC:{name:"AIC",abbr:"AIC",color:"#508F47"},AIG:{name:"AIG",abbr:"AIG",color:"#223572"},AlfaAlliance:{name:"Alfa Alliance",abbr:"ALF",color:"#C13D17"},AllianzOfAmerica:{name:"Allianz",abbr:"ALZ",color:"#003781"},AllianzOfAmericaJefferson:{name:"Allianz Jefferson",abbr:"ALZ",color:"#003781"},Allied:{name:"Allied",abbr:"ALD",color:"#0047BB"},Allmerica:{name:"Allmerica",abbr:"ALM",color:"#003DA5"},Allstate:{name:"Allstate",abbr:"ALS",color:"#002F87"},AmericaFirst:{name:"America First",abbr:"AMF",color:"#003DA5"},AmericanCommerce:{name:"American Commerce",abbr:"ACM",color:"#003DA5"},AmericanFamily:{name:"American Family",abbr:"AMF",color:"#0033A0"},Amica:{name:"Amica",abbr:"AMI",color:"#003DA5"},Ameriprise:{name:"Ameriprise",abbr:"AMP",color:"#003DA5"},ASILloyds:{name:"ASI Lloyds",abbr:"ASI",color:"#003DA5"},Assurant:{name:"Assurant",abbr:"ASR",color:"#0033A0"},AtlasGeneralAgency:{name:"Atlas General",abbr:"ATL",color:"#1F3864"},AustinMutual:{name:"Austin Mutual",abbr:"AUS",color:"#1F3864"},Autoone:{name:"AutoOne",abbr:"AON",color:"#003DA5"},AutoOwners:{name:"Auto-Owners",abbr:"AO",color:"#C8102E"},BadgerMutual:{name:"Badger Mutual",abbr:"BDG",color:"#003DA5"},Balboa:{name:"Balboa",abbr:"BAL",color:"#1F3864"},Bamboo:{name:"Bamboo",abbr:"BMB",color:"#0F4C3A"},Bankers:{name:"Bankers",abbr:"BNK",color:"#1F3864"},BeaconNational:{name:"Beacon National",abbr:"BCN",color:"#003DA5"},BrethernMutual:{name:"Brethren Mutual",abbr:"BRT",color:"#1F3864"},BristolWest:{name:"Bristol West",abbr:"BW",color:"#003DA5"},BunkerHill:{name:"Bunker Hill",abbr:"BHL",color:"#1F3864"},CapitalInsuranceGroup:{name:"Capital Insurance",abbr:"CIG",color:"#003DA5"},Celina:{name:"Celina",abbr:"CEL",color:"#1F3864"},CentralMutualOfOH:{name:"Central Mutual",abbr:"CMO",color:"#003DA5"},Chubb:{name:"Chubb",abbr:"CHB",color:"#000000"},ChubbInsurance:{name:"Chubb",abbr:"CHB",color:"#000000"},Cincinnati:{name:"Cincinnati",abbr:"CIN",color:"#003DA5"},Citizens:{name:"Citizens",abbr:"CTZ",color:"#003DA5"},Clearcover:{name:"Clearcover",abbr:"CC",color:"#00B5E2"},CNA:{name:"CNA",abbr:"CNA",color:"#CC3232"},ColonialPenn:{name:"Colonial Penn",abbr:"CPN",color:"#0072CE"},ColoradoCasualty:{name:"Colorado Casualty",abbr:"COC",color:"#1F3864"},Columbia:{name:"Columbia",abbr:"CLM",color:"#003DA5"},CommerceWest:{name:"Commerce West",abbr:"CMW",color:"#003DA5"},CommonwealthCasualty:{name:"Commonwealth Casualty",abbr:"CW",color:"#1F3864"},ConstitutionalCasualty:{name:"Constitutional Casualty",abbr:"CON",color:"#1F3864"},Cornerstone:{name:"Cornerstone",abbr:"CRN",color:"#1F3864"},Countrywide:{name:"Countrywide",abbr:"CTW",color:"#003DA5"},CSE:{name:"CSE",abbr:"CSE",color:"#003DA5"},Cumberland:{name:"Cumberland",abbr:"CMB",color:"#1F3864"},Cypress:{name:"Cypress",abbr:"CYP",color:"#0F4C3A"},Dairyland:{name:"Dairyland",abbr:"DL",color:"#0072CE"},Deerbrook:{name:"Deerbrook",abbr:"DBK",color:"#1F3864"},Direct:{name:"Direct",abbr:"DIR",color:"#D52B1E"},Donegal:{name:"Donegal",abbr:"DON",color:"#003DA5"},Drive:{name:"Drive",abbr:"DRV",color:"#1F3864"},Electric:{name:"Electric",abbr:"ELC",color:"#003DA5"},EMC:{name:"EMC",abbr:"EMC",color:"#003DA5"},Encompass:{name:"Encompass",abbr:"ENC",color:"#002F87"},Erie:{name:"Erie",abbr:"ERI",color:"#005FAC"},Esurance:{name:"Esurance",abbr:"ESU",color:"#00A6CE"},ExcelsiorInsuranceCompany:{name:"Excelsior",abbr:"EXC",color:"#1F3864"},Explorer:{name:"Explorer",abbr:"EXP",color:"#1F3864"},FairPlan:{name:"FAIR Plan",abbr:"FPN",color:"#1F3864"},FarmBureau:{name:"Farm Bureau",abbr:"FB",color:"#00843D"},Farmers:{name:"Farmers",abbr:"FRM",color:"#1C428B"},Fidelity:{name:"Fidelity",abbr:"FID",color:"#00833F"},FiremansFund:{name:"Fireman's Fund",abbr:"FF",color:"#E31837"},FirstAmerican:{name:"First American",abbr:"FAM",color:"#003DA5"},Foremost:{name:"Foremost",abbr:"FOR",color:"#E31837"},ForemostInsuranceCompany:{name:"Foremost",abbr:"FOR",color:"#E31837"},Geico:{name:"GEICO",abbr:"GEI",color:"#0F4293"},GeneralCasualty:{name:"General Casualty",abbr:"GC",color:"#1F3864"},GermantownMutual:{name:"Germantown Mutual",abbr:"GTM",color:"#1F3864"},GMAC:{name:"GMAC",abbr:"GMA",color:"#003DA5"},Grange:{name:"Grange",abbr:"GRG",color:"#003DA5"},GreatAmerican:{name:"Great American",abbr:"GA",color:"#003DA5"},Grinnell:{name:"Grinnell Mutual",abbr:"GRN",color:"#E31837"},GuideOne:{name:"GuideOne",abbr:"GO",color:"#0072CE"},Hanover:{name:"Hanover",abbr:"HAN",color:"#003DA5"},Harbor:{name:"Harbor",abbr:"HBR",color:"#1F3864"},Harleysville:{name:"Harleysville",abbr:"HRL",color:"#003DA5"},Hartford:{name:"The Hartford",abbr:"HFD",color:"#7F1734"},HartfordOMNI:{name:"Hartford OMNI",abbr:"HOM",color:"#7F1734"},HastingsMutual:{name:"Hastings Mutual",abbr:"HST",color:"#1F3864"},HawkeyeSecurity:{name:"Hawkeye Security",abbr:"HWK",color:"#1F3864"},HDI:{name:"HDI",abbr:"HDI",color:"#00563F"},HippoInsuranceCompany:{name:"Hippo",abbr:"HPO",color:"#00C9A7"},HomeownersOfAmerica:{name:"Homeowners of America",abbr:"HOA",color:"#003DA5"},Homesite:{name:"Homesite",abbr:"HMS",color:"#0033A0"},HoraceMann:{name:"Horace Mann",abbr:"HM",color:"#003DA5"},HoustonGeneral:{name:"Houston General",abbr:"HG",color:"#1F3864"},IFA:{name:"IFA",abbr:"IFA",color:"#003DA5"},ImperialCasualty:{name:"Imperial Casualty",abbr:"IMP",color:"#1F3864"},Indiana:{name:"Indiana Insurance",abbr:"IND",color:"#003DA5"},IndianaFarmers:{name:"Indiana Farmers",abbr:"IFM",color:"#00843D"},Infinity:{name:"Infinity",abbr:"INF",color:"#E31837"},Insurequest:{name:"Insurequest",abbr:"INQ",color:"#1F3864"},Integon:{name:"Integon",abbr:"ITG",color:"#003DA5"},Integrity:{name:"Integrity",abbr:"ITY",color:"#1F3864"},Kemper:{name:"Kemper",abbr:"KMP",color:"#0033A0"},LibertyMutual:{name:"Liberty Mutual",abbr:"LM",color:"#FFD000"},LibertyNorthwest:{name:"Liberty Northwest",abbr:"LNW",color:"#FFD000"},Lloyds:{name:"Lloyd's",abbr:"LLY",color:"#003DA5"},MainStreetAmerica:{name:"Main Street America",abbr:"MSA",color:"#003DA5"},Mapfre:{name:"MAPFRE",abbr:"MAP",color:"#E31837"},MarkelInsuranceCompany:{name:"Markel",abbr:"MKL",color:"#003DA5"},Mendota:{name:"Mendota",abbr:"MND",color:"#1F3864"},MerchantsGroup:{name:"Merchants Group",abbr:"MRC",color:"#003DA5"},Mercury:{name:"Mercury",abbr:"MER",color:"#ED1C24"},Metlife:{name:"MetLife",abbr:"MET",color:"#0090DA"},Metropolitan:{name:"Metropolitan",abbr:"MTP",color:"#0090DA"},MidContinent:{name:"Mid-Continent",abbr:"MC",color:"#003DA5"},MidwesternIndemnity:{name:"Midwestern Indemnity",abbr:"MWI",color:"#003DA5"},Montgomery:{name:"Montgomery",abbr:"MTG",color:"#1F3864"},MSA:{name:"MSA",abbr:"MSA",color:"#003DA5"},MtWashington:{name:"Mt. Washington",abbr:"MTW",color:"#1F3864"},MutualBenefit:{name:"Mutual Benefit",abbr:"MB",color:"#1F3864"},NatGenPremier:{name:"NatGen Premier",abbr:"NGP",color:"#0033A0"},NationalGeneral:{name:"National General",abbr:"NG",color:"#0033A0"},Nationwide:{name:"Nationwide",abbr:"NW",color:"#204D9B"},NationwideScottsdale:{name:"Nationwide Scottsdale",abbr:"NWS",color:"#204D9B"},NewYorkCentralMutual:{name:"NY Central Mutual",abbr:"NYC",color:"#003DA5"},NJManufacturers:{name:"NJM Insurance",abbr:"NJM",color:"#003DA5"},NJSkylands:{name:"NJ Skylands",abbr:"NJS",color:"#003DA5"},Northstar:{name:"Northstar",abbr:"NST",color:"#1F3864"},Occidental:{name:"Occidental",abbr:"OCC",color:"#1F3864"},OhioCasualty:{name:"Ohio Casualty",abbr:"OHC",color:"#003DA5"},OmahaPC:{name:"Omaha P&C",abbr:"OMA",color:"#003DA5"},OneBeacon:{name:"OneBeacon",abbr:"OB",color:"#003DA5"},OregonMutual:{name:"Oregon Mutual",abbr:"ORE",color:"#003DA5"},Palisades:{name:"Palisades",abbr:"PAL",color:"#1F3864"},PeerlessMontgomery:{name:"Peerless Montgomery",abbr:"PRM",color:"#1F3864"},Pekin:{name:"Pekin",abbr:"PEK",color:"#003DA5"},Pemco:{name:"PEMCO",abbr:"PMC",color:"#0072CE"},PennNational:{name:"Penn National",abbr:"PN",color:"#003DA5"},PlymouthRock:{name:"Plymouth Rock",abbr:"PLR",color:"#003DA5"},PreferredMutual:{name:"Preferred Mutual",abbr:"PFM",color:"#003DA5"},Proformance:{name:"Proformance",abbr:"PRF",color:"#1F3864"},Progressive:{name:"Progressive",abbr:"PRG",color:"#0053BA"},Prudential:{name:"Prudential",abbr:"PRU",color:"#0033A0"},PureHighValue:{name:"PURE",abbr:"PUR",color:"#003DA5"},Republic:{name:"Republic",abbr:"REP",color:"#003DA5"},RockfordMutual:{name:"Rockford Mutual",abbr:"RKF",color:"#1F3864"},RoyalAndSunAlliance:{name:"Royal & SunAlliance",abbr:"RSA",color:"#003DA5"},Safeco:{name:"Safeco",abbr:"SFC",color:"#E4002B"},SECURA:{name:"SECURA",abbr:"SEC",color:"#003DA5"},Selective:{name:"Selective",abbr:"SEL",color:"#003DA5"},SouthernCounty:{name:"Southern County",abbr:"SCM",color:"#1F3864"},SouthernMutual:{name:"Southern Mutual",abbr:"SM",color:"#1F3864"},SouthernTrust:{name:"Southern Trust",abbr:"ST",color:"#1F3864"},StPaulTravelers:{name:"St. Paul Travelers",abbr:"SPT",color:"#C8102E"},StandardMutual:{name:"Standard Mutual",abbr:"STM",color:"#1F3864"},StarCasualty:{name:"Star Casualty",abbr:"SC",color:"#1F3864"},StateAuto:{name:"State Auto",abbr:"SA",color:"#003DA5"},StateFarm:{name:"State Farm",abbr:"SF",color:"#CC0717"},StateFarmFloridaInsuranceCompany:{name:"State Farm Florida",abbr:"SFF",color:"#CC0717"},SunshineStateInsuranceCompany:{name:"Sunshine State",abbr:"SSS",color:"#FFC72C"},Travelers:{name:"Travelers",abbr:"TRV",color:"#C8102E"},Tower:{name:"Tower",abbr:"TWR",color:"#1F3864"},TWFG:{name:"TWFG",abbr:"TWF",color:"#003DA5"},Unigard:{name:"Unigard",abbr:"UNG",color:"#1F3864"},UnitedFireAndCasualty:{name:"United Fire & Casualty",abbr:"UFC",color:"#003DA5"},Unitrin:{name:"Unitrin",abbr:"UTN",color:"#003DA5"},Universal:{name:"Universal",abbr:"UNV",color:"#003DA5"},USAA:{name:"USAA",abbr:"USA",color:"#1A3258"},UticaNational:{name:"Utica National",abbr:"UTC",color:"#003DA5"},Victoria:{name:"Victoria",abbr:"VIC",color:"#1F3864"},Wellington:{name:"Wellington",abbr:"WLG",color:"#1F3864"},WestBend:{name:"West Bend",abbr:"WB",color:"#003DA5"},WesternNational:{name:"Western National",abbr:"WN",color:"#003DA5"},WesternReserveGroup:{name:"Western Reserve",abbr:"WR",color:"#003DA5"},Westfield:{name:"Westfield",abbr:"WF",color:"#F05136"},WhiteMountains:{name:"White Mountains",abbr:"WM",color:"#1F3864"},WilsonMutual:{name:"Wilson Mutual",abbr:"WLM",color:"#1F3864"},Windsor:{name:"Windsor",abbr:"WIN",color:"#1F3864"},Zurich:{name:"Zurich",abbr:"ZUR",color:"#003399"}},e0=["#0369A1","#1D4ED8","#0F766E","#7C3AED","#B45309","#DC2626","#0891B2","#9333EA"];function c2(t){return t.replace(/[^A-Za-z0-9]/g,"").slice(0,3).toUpperCase()||"CAR"}function qv(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ").trim()}function Sa(t){if(!t)return t;const n=Pv[t];return n?n.name:qv(t)}function u2(t){const n=new Set,a=[];return t.forEach((o,l)=>{const d=Pv[o]??{name:qv(o),abbr:c2(o),color:e0[l%e0.length]};n.has(d.name)||(n.add(d.name),a.push(d))}),a}function f2(t,n){if(!t)return[];const a=[];return(n==="Auto"||n==="Bundle")&&Array.isArray(t.PersonalAuto)&&a.push(...t.PersonalAuto),(n==="Home"||n==="Bundle")&&Array.isArray(t.PersonalHome)&&a.push(...t.PersonalHome),u2(a)}const d2="https://getcredify.com/privacy-policy";function m2({acknowledged:t,onChange:n,disabled:a=!1}){return g.jsx("div",{className:"privacy-notice-ack rounded-xl border border-slate-200 bg-slate-50 p-4","data-testid":"privacy-notice-acknowledgment",children:g.jsx(zl,{id:"privacy-notice-ack-checkbox",className:"privacy-notice-ack-checkbox",checked:t,onChange:o=>n(o.target.checked),disabled:a,label:g.jsxs(g.Fragment,{children:["I acknowledge I have received Credify’s"," ",g.jsx("a",{href:d2,target:"_blank",rel:"noopener noreferrer",className:"credify-link-underline",children:"Privacy Notice"}),"."]})})})}function p2({carrierName:t,formattedPremium:n,lobLabel:a,acknowledged:o,onAcknowledgeChange:l,onCancel:f,onProceed:d,isProcessing:m,hasError:_}){const h=!o||m;return g.jsxs("div",{className:"bind-confirmation","data-testid":"bind-confirmation",role:"group","aria-label":"Confirm your bind request",children:[g.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Confirm your bind request"}),g.jsxs("div",{className:"mt-4 rounded-xl border border-slate-200 bg-white p-4",children:[a&&g.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500",children:a}),g.jsx("p",{className:"font-semibold text-slate-900",children:t}),g.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[n,g.jsx("span",{className:"ml-1 text-sm font-medium text-slate-500",children:"/month"})]})]}),g.jsx("div",{className:"mt-4",children:g.jsx(m2,{acknowledged:o,onChange:l,disabled:m})}),_&&g.jsx("p",{className:"mt-3 text-sm text-red-600",role:"alert",children:"Something went wrong while processing your bind request. Please try again."}),g.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3",children:[g.jsx("button",{type:"button","data-testid":"bind-confirmation-cancel",onClick:f,disabled:m,className:"credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancel"}),g.jsxs("button",{type:"button","data-testid":"bind-confirmation-proceed",onClick:d,disabled:h,className:["h-12 rounded-full text-white font-bold transition","flex items-center justify-center gap-2","disabled:cursor-not-allowed",h?"bg-slate-400":"bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"].join(" "),children:[m&&g.jsxs("svg",{className:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[g.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),g.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),m?"Processing…":"Proceed"]})]})]})}const Vv=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function Kv(t){const n=Number.isFinite(t.term_months)&&t.term_months>0?t.term_months:1;return t.monthly_premium_cents!=null?t.monthly_premium_cents:Math.round((t.premium_cents||0)/n)}const Zl={PersonalHome:"Homeowners",PersonalAuto:"Personal Auto",Flood:"Flood",ExcessFlood:"Excess Flood",_other:"Other"},Pl=["PersonalHome","PersonalAuto","Flood","ExcessFlood"];function _2(t){if(t.length===0)return[];const n=(o,l)=>Sa(o.carrier_name).localeCompare(Sa(l.carrier_name));if(!t.some(o=>o.lob))return[{lob:null,title:"Not Quoted",rates:[...t].sort(n)}];const a=new Map;for(const o of t){const l=o.lob||"_other",f=a.get(l);f?f.push(o):a.set(l,[o])}return[...a.entries()].sort(([o],[l])=>{const f=Pl.indexOf(o),d=Pl.indexOf(l);return(f===-1?999:f)-(d===-1?999:d)}).map(([o,l])=>({lob:o,title:Zl[o]??o,rates:[...l].sort(n)}))}function t0({onBack:t}){const n=()=>{n2(),t?.()};return g.jsx("button",{type:"button",onClick:n,className:"credify-btn-back credify-btn-back-rates h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition w-full",children:"Back"})}function h2({rate:t,status:n,onRequestBind:a,disabled:o,showLobLabel:l=!0,className:f}){const d=Kv(t)/100,m=Vv.format(d),_=n==="loading",h=n==="success",v=!!o||_||h,b=!!(t.effective_date&&t.policy_end_date),N=t.lob?Zl[t.lob]||t.lob:null;return g.jsxs("div",{className:`flex w-full flex-col rounded-xl border border-slate-200 bg-white p-6 shadow-sm transition hover:shadow-md${f?` ${f}`:""}`,children:[l&&N&&g.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:N}),g.jsxs("div",{className:"mb-4 flex flex-col items-start gap-2",children:[t.carrier_logo_base64?g.jsx("img",{src:`data:image/png;base64,${t.carrier_logo_base64}`,alt:Sa(t.carrier_name),className:"h-12 w-auto max-w-full object-contain"}):g.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-md bg-slate-100 text-sm font-semibold text-slate-500",children:Sa(t.carrier_name).charAt(0).toUpperCase()}),g.jsx("h4",{className:"w-full break-words text-left font-semibold text-slate-900",children:Sa(t.carrier_name)})]}),g.jsx("div",{className:"mb-2",children:g.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[m,g.jsx("span",{className:"ml-1 text-sm font-medium text-slate-500",children:"/month"})]})}),b&&g.jsx("div",{className:"mb-2",children:g.jsxs("p",{className:"text-xs text-slate-500",children:["Effective ",t.effective_date," - ",t.policy_end_date]})}),t.carrier_quote_id&&g.jsx("div",{className:"mb-4",children:g.jsxs("p",{className:"text-xs text-slate-400",children:["Quote ID: ",t.carrier_quote_id]})}),g.jsxs("div",{className:"mt-auto pt-4",children:[g.jsx("button",{type:"button",onClick:a,disabled:v,className:`rates-bind-btn w-full rounded-full px-4 py-2.5 text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 disabled:cursor-not-allowed ${h?"rates-bind-btn-requested":"hover:bg-blue-600/90 disabled:bg-slate-300 disabled:text-slate-500"}`,children:_?"Requesting…":h?"Requested":"Request Bind"}),n==="error"&&g.jsx("p",{className:"mt-2 text-xs text-red-600",children:"Something went wrong. Please try again."}),n==="success"&&g.jsx("p",{className:"mt-2 text-xs text-emerald-600",children:"We received your bind request."})]})]})}function g2({item:t}){const n=Sa(t.carrier_name),a=(t.decline_reasons??[]).filter(Boolean);return g.jsxs("div",{className:"flex w-full gap-4 rounded-xl border border-slate-200 bg-white p-4 shadow-sm",children:[g.jsx("div",{className:"shrink-0",children:t.carrier_logo_base64?g.jsx("img",{src:`data:image/png;base64,${t.carrier_logo_base64}`,alt:n,className:"h-10 w-auto max-w-[7rem] object-contain"}):g.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-slate-100 text-sm font-semibold text-slate-500",children:n.charAt(0).toUpperCase()})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("div",{className:"flex flex-wrap items-center gap-2",children:g.jsx("h4",{className:"break-words font-semibold text-slate-900",children:n})}),a.length>0?g.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5 text-sm text-slate-600",children:a.map((o,l)=>g.jsx("li",{children:o},l))}):g.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"This carrier did not return a quote."})]})]})}function y2({rates:t,onBack:n,isBundleFlow:a=!1}){const o=Array.isArray(t)?t:[],l=o.length>0,[f,d]=B.useState({}),[m,_]=B.useState("admitted"),[h,v]=B.useState(!1),[b,N]=B.useState(null),[w,D]=B.useState(!1),k=B.useMemo(()=>o.some(G=>G.lob==="PersonalAuto"),[o]),ue=B.useMemo(()=>o.some(G=>G.lob==="PersonalHome"),[o]),ne=B.useMemo(()=>{if(!a)return[];const G=[];return k&&G.push("PersonalAuto"),ue&&G.push("PersonalHome"),G},[a,k,ue]),se=B.useMemo(()=>{const G=new Set;for(const E of o){const C=E.lob??null;C&&f[E.quote_rate_id]==="success"&&G.add(C)}return G},[o,f]),W=B.useMemo(()=>Object.values(f).some(G=>G==="success"),[f]),oe=B.useMemo(()=>h?!0:!a||ne.length===0?W:ne.every(G=>se.has(G)),[h,a,W,ne,se]),F=B.useMemo(()=>l?o.filter(G=>(G.admitted_status??"admitted")==="admitted"):[],[o,l]),ie=B.useMemo(()=>l?o.filter(G=>G.admitted_status==="non_admitted"):[],[o,l]),te=B.useMemo(()=>l?o.filter(G=>G.admitted_status==="not_quoted"):[],[o,l]),ae=F.length,ve=ie.length,Ee=te.length,Te=ae+ve>0,Le=Te||Ee>0,it=B.useMemo(()=>_2(te),[te]);B.useEffect(()=>{Le&&m==="admitted"&&ae===0&&(ve>0?_("non_admitted"):Ee>0&&_("not_quoted"))},[m,ae,ve,Ee,Le]);const Ge=B.useMemo(()=>Te?m==="admitted"?F:m==="non_admitted"?ie:[]:[],[Te,m,F,ie]);B.useEffect(()=>{vd()},[]),B.useEffect(()=>{!oe||h||(nR(),Iv(),v(!0))},[oe,h]);const he=B.useMemo(()=>{if(Ge.length===0)return[];if(!Ge.some(A=>A.lob))return[{lob:null,title:"Rates",rates:[...Ge].sort((S,R)=>{const I=Number.isFinite(S.term_months)&&S.term_months>0?S.term_months:1,Y=Number.isFinite(R.term_months)&&R.term_months>0?R.term_months:1,K=S.monthly_premium_cents??Math.round((S.premium_cents||0)/I),Q=R.monthly_premium_cents??Math.round((R.premium_cents||0)/Y);return K-Q})}];const E=new Map;for(const A of Ge){const S=A.lob||"_other",R=E.get(S);R?R.push(A):E.set(S,[A])}return[...E.entries()].sort(([A],[S])=>{const R=Pl.indexOf(A),I=Pl.indexOf(S);return(R===-1?999:R)-(I===-1?999:I)}).map(([A,S])=>({lob:A,title:Zl[A]??A,rates:[...S].sort((R,I)=>{const Y=Number.isFinite(R.term_months)&&R.term_months>0?R.term_months:1,K=Number.isFinite(I.term_months)&&I.term_months>0?I.term_months:1,Q=R.monthly_premium_cents??Math.round((R.premium_cents||0)/Y),re=I.monthly_premium_cents??Math.round((I.premium_cents||0)/K);return Q-re})}))},[Ge]),x=B.useMemo(()=>{if(!a)return[];const G=o.some(A=>A.lob==="PersonalAuto"),E=o.some(A=>A.lob==="PersonalHome"),C=[];return G||C.push("Sorry, no rates found for Personal Auto."),E||C.push("Sorry, no rates found for Homeowners."),C},[a,o]);if(!Le)return g.jsxs("section",{className:"mt-8",children:[g.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Rates"}),g.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"Sorry, no rates are available at this time."}),n&&g.jsx(t0,{onBack:n})]});const U=G=>{d(E=>({...E,[G.quote_rate_id]:"idle"})),D(!1),N({cardKey:G.quote_rate_id,rate:G})},J=()=>{N(null),D(!1)},_e=async()=>{if(!b||!w)return;const G=b.cardKey;d(E=>({...E,[G]:"loading"}));try{if(vd(),!Ti())throw new Error("Authentication required. Please verify your phone number first.");if(!((await MR(G,!0))?.success!==!1))throw new Error("Request failed");d(S=>({...S,[G]:"success"})),N(null),D(!1)}catch{d(E=>({...E,[G]:"error"}))}};if(b){const G=b.rate.lob?Zl[b.rate.lob]||b.rate.lob:null;return g.jsx("section",{className:"mt-8",children:g.jsx(p2,{carrierName:Sa(b.rate.carrier_name),formattedPremium:Vv.format(Kv(b.rate)/100),lobLabel:G,acknowledged:w,onAcknowledgeChange:D,onCancel:J,onProceed:_e,isProcessing:f[b.cardKey]==="loading",hasError:f[b.cardKey]==="error"})})}return g.jsxs("section",{className:"mt-8",children:[g.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Rates"}),x.length>0&&g.jsx("div",{className:"mt-3 space-y-1",children:x.map(G=>g.jsx("p",{className:"text-sm text-slate-600",children:G},G))}),g.jsx("div",{className:"mt-4 border-b border-slate-200",children:g.jsxs("div",{className:"flex items-center gap-6",children:[g.jsxs("button",{type:"button",onClick:()=>_("admitted"),className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${m==="admitted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Admitted (",ae,")"]}),g.jsxs("button",{type:"button",onClick:()=>_("non_admitted"),className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${m==="non_admitted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Non-admitted (",ve,")"]}),Ee>0&&g.jsxs("button",{type:"button",onClick:()=>_("not_quoted"),className:`border-b-2 px-1 py-2 text-sm font-semibold transition ${m==="not_quoted"?"border-cyan-500 text-slate-900":"border-transparent text-slate-500 hover:text-slate-800"}`,children:["Not Quoted (",Ee,")"]})]})}),m==="not_quoted"?it.map(G=>g.jsxs("div",{className:"mt-6",children:[G.lob!=null&&g.jsx("h4",{className:"mb-3 text-base font-semibold text-slate-800",children:G.title}),g.jsx("div",{className:"space-y-3",children:G.rates.map(E=>g.jsx(g2,{item:E},E.quote_rate_id))})]},G.lob??"all")):g.jsxs(g.Fragment,{children:[Ge.length===0&&g.jsx("p",{className:"mt-4 text-sm text-slate-500",children:m==="admitted"?"Sorry, no admitted rates are available at this time.":"Sorry, no non-admitted rates are available at this time."}),Ge.length>0&&he.map(G=>g.jsxs("div",{className:"mt-6",children:[g.jsx("h4",{className:"mb-3 text-base font-semibold text-slate-800",children:G.title}),g.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:G.rates.map(E=>g.jsx("div",{className:"mx-auto w-full min-w-0 max-w-md",children:g.jsx(h2,{rate:E,showLobLabel:G.lob==null,status:f[E.quote_rate_id]??"idle",disabled:oe||(a?!!(E.lob&&ne.includes(E.lob)&&se.has(E.lob)):W),onRequestBind:()=>U(E)})},E.quote_rate_id))})]},G.lob??"all"))]}),n&&g.jsx(t0,{onBack:n})]})}const Ff=["Validating your details...","Checking underwriting rules...","Applying eligible discounts...","Reviewing your risk profile...","Calculating premium...","Check complete"],n0={Auto:{label:"Auto Policy",icon:"🚗",accent:"#0369A1"},Home:{label:"Home Policy",icon:"🏠",accent:"#059669"},Bundle:{label:"Home + Auto Bundle",icon:"🔗",accent:"#7C3AED"}},r0={Auto:6e4,Home:9e4,Bundle:12e4};function v2({progress:t,color:n,size:a=80}){const o=(a-10)/2,l=2*Math.PI*o,f=l-t/100*l;return g.jsxs("svg",{width:a,height:a,style:{transform:"rotate(-90deg)"},children:[g.jsx("circle",{cx:a/2,cy:a/2,r:o,fill:"none",stroke:"#F1F5F9",strokeWidth:6}),g.jsx("circle",{cx:a/2,cy:a/2,r:o,fill:"none",stroke:n,strokeWidth:6,strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:f,style:{transition:"stroke-dashoffset 0.2s linear"}})]})}function b2({providers:t=[],totalTime:n=6e4,flow:a="Auto",isComplete:o=!1,onComplete:l}){const f=n0[a]??n0.Auto,d=r0[a]??r0.Auto,m=t.length>0?Math.floor(d/t.length):n,[_,h]=B.useState(0),[v,b]=B.useState(0),[N,w]=B.useState(0),[D,k]=B.useState(0),[ue,ne]=B.useState(!0),se=B.useRef(o),W=B.useRef(l),oe=B.useRef(_),F=B.useRef(t.length),ie=B.useRef(!1),te=B.useRef(!1);B.useEffect(()=>{se.current=o,o&&t.length===0&&!ie.current&&(ie.current=!0,W.current?.())},[o,t.length]),B.useEffect(()=>{W.current=l},[l]),B.useEffect(()=>{oe.current=_},[_]),B.useEffect(()=>{F.current=t.length,t.length>0&&(te.current=!1,h(0),b(0),w(0),k(0),ne(!0))},[t.length]),B.useEffect(()=>{if(t.length===0){se.current&&!ie.current&&(ie.current=!0,W.current?.());return}te.current=!1;const Te=100,Le=100/(m/Te),it=setInterval(()=>{w(Ge=>{if(te.current||ie.current)return Ge;const he=Ge+Le;return he<100?he:(te.current=!0,setTimeout(()=>{if(se.current){if(ie.current)return;ie.current=!0,W.current?.();return}const U=oe.current===F.current-1;ne(!1),setTimeout(()=>{U?(h(0),b(J=>J+1)):h(J=>J+1),w(0),k(0),ne(!0)},300)},400),100)})},Te);return()=>clearInterval(it)},[_,m,t.length]),B.useEffect(()=>{if(t.length===0)return;const Te=Math.floor(m/Ff.length),Le=setInterval(()=>k(it=>Math.min(it+1,Ff.length-1)),Te);return()=>clearInterval(Le)},[_,m,t.length]);const ae=t.length===0,ve=ae?null:t[Math.min(_,t.length-1)],Ee=v>0;return g.jsxs(g.Fragment,{children:[g.jsx("style",{children:`
|
|
111
111
|
@keyframes providerPulse {
|
|
112
112
|
0%, 100% { transform: scale(1); }
|
|
113
113
|
50% { transform: scale(1.05); }
|
|
@@ -142,5 +142,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
142
142
|
.iq-status-text {
|
|
143
143
|
animation: statusFadeIn 0.25s ease forwards;
|
|
144
144
|
}
|
|
145
|
-
`}),g.jsx("div",{style:{background:"#F8FAFC",display:"flex",alignItems:"center",justifyContent:"center",padding:"2rem",fontFamily:"'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",height:"100%",minHeight:400,overflowY:"auto"},children:g.jsxs("div",{style:{width:"100%",maxWidth:560},children:[g.jsxs("div",{style:{textAlign:"center",marginBottom:40},children:[g.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:f.accent+"12",border:`1px solid ${f.accent}30`,borderRadius:100,padding:"6px 16px",marginBottom:16},children:[g.jsx("span",{style:{fontSize:14},children:f.icon}),g.jsx("span",{style:{fontSize:12,fontWeight:700,color:f.accent,letterSpacing:"0.1em",textTransform:"uppercase"},children:f.label})]}),g.jsx("h1",{style:{fontSize:26,fontWeight:700,color:"#0F172A",margin:0,letterSpacing:"-0.02em",lineHeight:1.3},children:ae?"Connecting to top carriers":"Fetching your best rates"}),g.jsx("p",{style:{fontSize:14,color:"#64748B",marginTop:8,marginBottom:0},children:ae?"Identifying the carriers eligible for your quote...":Ee?"Still gathering — a few carriers are taking a little longer...":"We're reaching out to multiple insurers on your behalf"})]}),g.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:32},children:ae?g.jsx("div",{style:{display:"flex",gap:20},children:[0,1,2,3,4].map(Te=>g.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6},children:[g.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${Te*.12}s`}}),g.jsx("div",{style:{width:40,height:8,borderRadius:4,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${Te*.12}s`}})]},`skeleton-${Te}`))}):ve?g.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[g.jsxs("div",{style:{width:64,height:64,borderRadius:18,background:ve.color+"18",border:`2px solid ${ve.color}`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:16,color:ve.color,position:"relative",animation:"providerPulse 1.8s ease-in-out infinite"},children:[ve.abbr,g.jsx("div",{style:{position:"absolute",inset:-5,borderRadius:22,border:`2px solid ${ve.color}`,pointerEvents:"none",animation:"ringPulse 1.6s ease-in-out infinite"}})]}),g.jsx("span",{style:{fontSize:13,fontWeight:600,color:ve.color,letterSpacing:"0.04em"},children:ve.name})]}):null}),g.jsxs("div",{className:`iq-card-fade ${ue?"iq-card-visible":"iq-card-hidden"}`,style:{background:"#FFFFFF",borderRadius:24,border:"1px solid #E2E8F0",padding:32},children:[g.jsx("div",{style:{display:"flex",alignItems:"center",gap:20,marginBottom:28},children:ae||!ve?g.jsxs("div",{style:{flex:1,textAlign:"center",padding:"8px 0"},children:[g.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 6px"},children:"Please wait"}),g.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:"Checking eligible providers"}),g.jsx("p",{style:{fontSize:13,color:"#64748B",margin:0},children:"Reviewing your details against our carrier network"})]}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{style:{position:"relative",flexShrink:0},children:[g.jsx(v2,{progress:N,color:ve.color,size:80}),g.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsxs("span",{style:{fontSize:14,fontWeight:700,color:ve.color},children:[Math.round(N),"%"]})})]}),g.jsxs("div",{style:{flex:1},children:[g.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 4px"},children:Ee?"Still checking":"Now checking"}),g.jsx("h2",{style:{fontSize:20,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:ve.name}),g.jsx("p",{className:"iq-status-text",style:{fontSize:13,color:"#64748B",margin:0},children:Ff[D]},`${_}-${D}`)]})]})}),g.jsxs("div",{children:[g.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.08em",textTransform:"uppercase",margin:"0 0 8px"},children:ae?"Initializing":"Gathering quotes"}),g.jsx("div",{style:{height:6,background:"#F1F5F9",borderRadius:100,overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",width:"35%",background:f.accent,borderRadius:100,animation:"shimmerSlide 1.4s ease-in-out infinite"}})})]})]})]})})]})}function Qv({onGoBack:t}){return g.jsxs("section",{className:"mt-4",children:[g.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-5",children:[g.jsx("h3",{className:"text-base font-semibold text-red-700",children:"Sorry, quote submission failed"}),g.jsx("p",{className:"mt-2 text-sm text-red-700",children:"We ran into an issue submitting your quote. Our team will investigate and get back to you soon."})]}),g.jsx("div",{className:"mt-5",children:g.jsx("button",{type:"button",onClick:t,className:"h-12 w-full rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",children:"Go back"})})]})}var Gf={};function S2(){try{return typeof Gf<"u"&&Gf?Gf:{}}catch{return{}}}function E2(t){const n=S2(),a=n.intercomAppId,o=n.cobrowseLicense;return{enabled:!!(a||o),intercomAppId:a||void 0,cobrowseLicense:o||void 0,proactiveOnError:!0}}const Yf=new Map;function Xv(t){if(typeof document>"u")return Promise.reject(new Error("loadScript called without a document"));const n=Yf.get(t);if(n)return n;const a=new Promise((o,l)=>{const f=document.createElement("script");f.src=t,f.async=!0,f.onload=()=>o(),f.onerror=()=>{Yf.delete(t),l(new Error(`Failed to load script: ${t}`))},document.head.appendChild(f)});return Yf.set(t,a),a}let Ad=!1;function A2(){if(typeof window.Intercom=="function")return window.Intercom;const t=function(...n){t.c?.(n)};return t.q=[],t.c=n=>{t.q.push(n)},window.Intercom=t,t}function T2(t){const n={app_id:t,hide_default_launcher:!0},a=ac();return a&&(n.quote_id=a),n}function Wv(t){if(typeof window>"u")return;A2();const n=T2(t);if(window.intercomSettings=n,Ad){window.Intercom("update",n);return}window.Intercom("boot",n),Ad=!0,Xv(`https://widget.intercom.io/widget/${t}`).catch(()=>{})}function C2(){typeof window?.Intercom=="function"&&window.Intercom("show")}function O2(t){typeof window?.Intercom=="function"&&window.Intercom("showNewMessage",t)}function N2(t){typeof window?.Intercom=="function"&&window.Intercom("update",t)}function w2(){if(typeof window?.Intercom=="function")try{window.Intercom("shutdown")}catch{}Ad=!1}const M2="https://js.cobrowse.io/CobrowseIO.js";let Td=!1;async function x2(t){await Xv(M2);const n=window.CobrowseIO;if(!n)return null;if(!Td){n.license=t,n.redactedViews=["input","select","textarea","[data-credify-redact]"],n.customData={quote_id:ac()??void 0,device_name:"Credify Insurance Widget"},n.confirmSession=()=>Promise.resolve(typeof window<"u"?window.confirm("Allow a Credify support agent to view your screen?"):!1);try{await n.client?.()}catch{}n.start?.(),Td=!0}return n}async function D2(t){if(typeof window>"u")return null;try{const n=await x2(t);return n?.createSessionCode?await n.createSessionCode():null}catch{return null}}function R2(){try{window.CobrowseIO?.stop?.()}catch{}Td=!1}const L2="Hi! It looks like something went wrong submitting your quote. We're here to help — tell us what you were trying to do and we'll jump in.";let Ln=null,xl=null,Cd=!1;function k2(t){I2();const n=E2();if(Ln=n,!!n.enabled&&n.proactiveOnError&&n.intercomAppId){const a=o=>{Cd||(Cd=!0,Wv(n.intercomAppId),N2({last_quote_error:o?.reason??"unknown"}),O2(L2))};Uv("submissionFailed",a),xl=a}}function Jv(){!Ln?.enabled||!Ln.intercomAppId||(Wv(Ln.intercomAppId),C2())}function z2(){return!Ln?.enabled||!Ln.cobrowseLicense?Promise.resolve(null):D2(Ln.cobrowseLicense)}function j2(){return!!(Ln?.enabled&&Ln.intercomAppId)}function B2(){return!!(Ln?.enabled&&Ln.cobrowseLicense)}function I2(){xl&&(Hv("submissionFailed",xl),xl=null),w2(),R2(),Cd=!1,Ln=null}const U2="Chat with our support team in real time — we'll help you finish your quote.",H2="Share your screen with a support agent so they can see what you see and guide you in real time. We'll generate a secure code — share it with your agent to begin. Your personal information stays hidden.",a0="inline-flex h-9 w-9 items-center justify-center rounded-full text-slate-500 hover:bg-slate-100 hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:opacity-60",i0="pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-60 -translate-x-1/2 rounded-lg bg-slate-800 px-3 py-2 text-center text-xs leading-snug text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100";function $2(){const t=j2(),n=B2(),[a,o]=B.useState(null),[l,f]=B.useState(!1),[d,m]=B.useState(!1),_=B.useCallback(async()=>{f(!0),m(!1);try{const h=await z2();h?o(h):m(!0)}finally{f(!1)}},[]);return!t&&!n?null:g.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-sm text-slate-500",children:[g.jsx("span",{className:"font-medium",children:"Need help?"}),g.jsxs("div",{className:"inline-flex items-center gap-1",children:[t&&g.jsxs("span",{className:"group relative inline-flex",children:[g.jsx("button",{type:"button",onClick:Jv,"aria-label":"Chat with support","aria-describedby":"credify-chat-tooltip",className:a0,children:g.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:g.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-8.5 8.5 9 9 0 0 1-3.8-.8L3 21l1.3-4.2A8.38 8.38 0 0 1 3.5 11.5 8.5 8.5 0 0 1 12 3a8.38 8.38 0 0 1 9 8.5Z",strokeLinejoin:"round"})})}),g.jsx("span",{id:"credify-chat-tooltip",role:"tooltip",className:i0,children:U2})]}),t&&n&&g.jsx("span",{className:"mx-1 h-6 w-px bg-slate-200","aria-hidden":"true"}),n&&g.jsxs("span",{className:"group relative inline-flex",children:[g.jsx("button",{type:"button",onClick:_,disabled:l,"aria-label":"Share your screen with an agent","aria-describedby":"credify-cobrowse-tooltip",className:a0,children:l?g.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600","aria-hidden":"true"}):g.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[g.jsx("rect",{x:"2.5",y:"4",width:"19",height:"13",rx:"2"}),g.jsx("path",{d:"M8 21h8M12 17v4",strokeLinecap:"round"}),g.jsx("path",{d:"M12 13V8m0 0-2 2m2-2 2 2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),g.jsx("span",{id:"credify-cobrowse-tooltip",role:"tooltip",className:i0,children:H2})]})]}),a&&g.jsxs("span",{children:["Read this code to your agent: ",g.jsx("strong",{className:"tracking-widest text-text-primary",children:a})]}),d&&g.jsx("span",{className:"text-red-600",children:"Couldn't start screen sharing. Please try chat instead."})]})}let o0=null;function F2(){const t=o0;return o0=null,t}function be(t){if(t===!0)return"Yes";if(t===!1)return"No"}function an(t){if(t)try{const n=typeof t=="string"?new Date(t):t;return isNaN(n.getTime())?void 0:n.toISOString().split("T")[0]}catch{return}}function G2(t){const n=t,a={};n.phone&&(a.phone=n.phone),n.first_name&&(a.first_name=n.first_name),n.last_name&&(a.last_name=n.last_name),n.email&&(a.email=n.email),n.date_of_birth&&(a.date_of_birth=an(n.date_of_birth)),n.product&&(a.product=n.product),n.state&&(a.state=n.state),n.postal_code&&(a.postal_code=n.postal_code);const o=[];n.line_1&&o.push(n.line_1),n.line_2&&o.push(n.line_2),n.city&&o.push(n.city),n.state&&o.push(n.state),n.postal_code&&o.push(n.postal_code),o.length>0&&(a.address=o.join(", ")),typeof n.ssn_display=="string"&&(a.ssn_display=n.ssn_display),n.years_at_address!==null&&n.years_at_address!==void 0&&(a.years_at_address=n.years_at_address),n.months_at_address!==null&&n.months_at_address!==void 0&&(a.months_at_address=n.months_at_address),n.move_in_date&&(a.move_in_date=an(n.move_in_date));const l=[];n.prior_line_1&&l.push(n.prior_line_1),n.prior_line_2&&l.push(n.prior_line_2),n.prior_city&&l.push(n.prior_city),n.prior_state&&l.push(n.prior_state),n.prior_postal_code&&l.push(n.prior_postal_code),l.length>0&&(a.prior_address=l.join(", ")),n.years_at_prior_address!==null&&n.years_at_prior_address!==void 0&&(a.years_at_prior_address=n.years_at_prior_address),n.is_mailing_address_different!==null&&n.is_mailing_address_different!==void 0&&(a.is_mailing_address_different=be(n.is_mailing_address_different)),n.mailing_address&&(a.mailing_address=n.mailing_address),n.effective_date&&(a.effective_date=an(n.effective_date)),n.auto_has_prior_insurance!==null&&n.auto_has_prior_insurance!==void 0&&(a.auto_has_prior_insurance=be(n.auto_has_prior_insurance)),n.auto_prior_expiration_date&&(a.auto_prior_expiration_date=an(n.auto_prior_expiration_date)),n.auto_prior_carrier_name&&(a.auto_prior_carrier_name=n.auto_prior_carrier_name),n.auto_prior_liability_limit&&(a.auto_prior_liability_limit=n.auto_prior_liability_limit),n.auto_reason_for_no_insurance&&(a.auto_reason_for_no_insurance=n.auto_reason_for_no_insurance),n.auto_prior_years!==null&&n.auto_prior_years!==void 0&&(a.auto_prior_years=n.auto_prior_years),n.auto_prior_months!==null&&n.auto_prior_months!==void 0&&(a.auto_prior_months=n.auto_prior_months),n.auto_continuous_coverage_years!==null&&n.auto_continuous_coverage_years!==void 0&&(a.auto_continuous_coverage_years=n.auto_continuous_coverage_years),n.auto_cancelled_declined_refused_to_renew!==null&&n.auto_cancelled_declined_refused_to_renew!==void 0&&(a.auto_cancelled_declined_refused_to_renew=be(n.auto_cancelled_declined_refused_to_renew)),n.auto_current_annual_premium_cents!==null&&n.auto_current_annual_premium_cents!==void 0&&(a.auto_current_annual_premium_cents=n.auto_current_annual_premium_cents),n.policy_bi&&(a.policy_bi=n.policy_bi),n.policy_um&&(a.policy_um=n.policy_um),n.policy_pd&&(a.policy_pd=n.policy_pd),n.policy_mp&&(a.policy_mp=n.policy_mp),n.policy_umpd&&(a.policy_umpd=n.policy_umpd),n.policy_pip&&(a.policy_pip=n.policy_pip),n.policy_auto_death_indemnity&&(a.policy_auto_death_indemnity=n.policy_auto_death_indemnity),n.driver_vehicle_assignments&&(a.driver_vehicle_assignments=n.driver_vehicle_assignments),n.home_has_prior_insurance!==null&&n.home_has_prior_insurance!==void 0&&(a.home_has_prior_insurance=be(n.home_has_prior_insurance)),n.home_prior_expiration_date&&(a.home_prior_expiration_date=an(n.home_prior_expiration_date)),n.home_prior_carrier_name&&(a.home_prior_carrier_name=n.home_prior_carrier_name),n.home_prior_years!==null&&n.home_prior_years!==void 0&&(a.home_prior_years=n.home_prior_years),n.home_continuous_coverage_years!==null&&n.home_continuous_coverage_years!==void 0&&(a.home_continuous_coverage_years=n.home_continuous_coverage_years),n.property_insurance_cancelled!==null&&n.property_insurance_cancelled!==void 0&&(a.property_insurance_cancelled=be(n.property_insurance_cancelled)),n.lapse_in_coverage!==null&&n.lapse_in_coverage!==void 0&&(a.lapse_in_coverage=be(n.lapse_in_coverage)),n.year_built!==null&&n.year_built!==void 0&&(a.year_built=n.year_built),n.number_of_units!==null&&n.number_of_units!==void 0&&(a.number_of_units=n.number_of_units),n.number_of_stories!==null&&n.number_of_stories!==void 0&&(a.number_of_stories=n.number_of_stories),n.number_of_beds!==null&&n.number_of_beds!==void 0&&(a.number_of_beds=n.number_of_beds),n.number_of_full_baths!==null&&n.number_of_full_baths!==void 0&&(a.number_of_full_baths=n.number_of_full_baths),n.number_of_partial_baths!==null&&n.number_of_partial_baths!==void 0&&(a.number_of_partial_baths=n.number_of_partial_baths),n.under_construction!==null&&n.under_construction!==void 0&&(a.under_construction=be(n.under_construction)),n.distance_from_fire_hydrant_ft&&(a.distance_from_fire_hydrant_ft=n.distance_from_fire_hydrant_ft),n.distance_from_fire_station_miles&&(a.distance_from_fire_station_miles=n.distance_from_fire_station_miles),n.architectural_style&&(a.architectural_style=n.architectural_style),n.dwelling_type&&(a.dwelling_type=n.dwelling_type),n.construction_quality&&(a.construction_quality=n.construction_quality),n.located_over_water!==null&&n.located_over_water!==void 0&&(a.located_over_water=n.located_over_water),n.construction_type&&(a.construction_type=n.construction_type),n.exterior_wall_type&&(a.exterior_wall_type=n.exterior_wall_type),n.foundation_type&&(a.foundation_type=n.foundation_type),n.roof_material_type&&(a.roof_material_type=n.roof_material_type),n.roof_shape&&(a.roof_shape=n.roof_shape),n.roof_updated_type&&(a.roof_updated_type=n.roof_updated_type),n.year_roof_updated!==null&&n.year_roof_updated!==void 0&&(a.year_roof_updated=n.year_roof_updated),n.mit_credit_form!==null&&n.mit_credit_form!==void 0&&(a.mit_credit_form=be(n.mit_credit_form)),n.storm_shutters!==null&&n.storm_shutters!==void 0&&(a.storm_shutters=be(n.storm_shutters)),n.heating_type&&(a.heating_type=n.heating_type),n.oil_tank_location&&(a.oil_tank_location=n.oil_tank_location),n.heating_fuel_type&&(a.heating_fuel_type=n.heating_fuel_type),n.number_of_fireplaces!==null&&n.number_of_fireplaces!==void 0&&(a.number_of_fireplaces=n.number_of_fireplaces),n.basement_type&&(a.basement_type=n.basement_type),n.parking_type&&(a.parking_type=n.parking_type),n.number_of_parking_spaces!==null&&n.number_of_parking_spaces!==void 0&&(a.number_of_parking_spaces=n.number_of_parking_spaces),n.plumbing_type&&(a.plumbing_type=n.plumbing_type),n.pool_type&&(a.pool_type=n.pool_type),n.total_area_sq_ft!==null&&n.total_area_sq_ft!==void 0&&(a.total_area_sq_ft=n.total_area_sq_ft),n.parcel_area_sq_ft!==null&&n.parcel_area_sq_ft!==void 0&&(a.parcel_area_sq_ft=n.parcel_area_sq_ft),n.residence_type&&(a.residence_type=n.residence_type),n.usage_type&&(a.usage_type=n.usage_type),n.household_size!==null&&n.household_size!==void 0&&(a.household_size=n.household_size),n.number_of_mortgagees!==null&&n.number_of_mortgagees!==void 0&&(a.number_of_mortgagees=n.number_of_mortgagees),n.has_dog!==null&&n.has_dog!==void 0&&(a.has_dog=be(n.has_dog)),n.dog_breed_type&&(a.dog_breed_type=n.dog_breed_type),n.number_of_dogs!==null&&n.number_of_dogs!==void 0&&(a.number_of_dogs=n.number_of_dogs),n.has_vicious_animals!==null&&n.has_vicious_animals!==void 0&&(a.has_vicious_animals=be(n.has_vicious_animals)),n.has_business_on_premises!==null&&n.has_business_on_premises!==void 0&&(a.has_business_on_premises=be(n.has_business_on_premises)),n.business_class&&(a.business_class=n.business_class),n.occupancy_type&&(a.occupancy_type=n.occupancy_type),n.short_term_rental!==null&&n.short_term_rental!==void 0&&(a.short_term_rental=be(n.short_term_rental)),n.sale_price_cents!==null&&n.sale_price_cents!==void 0&&(a.sale_price_cents=Math.round(Number(n.sale_price_cents)/100)),n.number_of_families!==null&&n.number_of_families!==void 0&&(a.number_of_families=n.number_of_families),n.number_of_units_in_firewall!==null&&n.number_of_units_in_firewall!==void 0&&(a.number_of_units_in_firewall=n.number_of_units_in_firewall),n.heating_update_yn!==null&&n.heating_update_yn!==void 0&&(a.heating_update_yn=be(n.heating_update_yn)),n.heating_update_type&&(a.heating_update_type=n.heating_update_type),n.heating_update_year!==null&&n.heating_update_year!==void 0&&(a.heating_update_year=n.heating_update_year),n.plumbing_update_yn!==null&&n.plumbing_update_yn!==void 0&&(a.plumbing_update_yn=be(n.plumbing_update_yn)),n.plumbing_update_type&&(a.plumbing_update_type=n.plumbing_update_type),n.plumbing_update_year!==null&&n.plumbing_update_year!==void 0&&(a.plumbing_update_year=n.plumbing_update_year),n.electrical_update_yn!==null&&n.electrical_update_yn!==void 0&&(a.electrical_update_yn=be(n.electrical_update_yn)),n.electrical_update_type&&(a.electrical_update_type=n.electrical_update_type),n.electrical_update_year!==null&&n.electrical_update_year!==void 0&&(a.electrical_update_year=n.electrical_update_year),n.electric_circuit_breaker!==null&&n.electric_circuit_breaker!==void 0&&(a.electric_circuit_breaker=be(n.electric_circuit_breaker)),n.dwelling_replacement_cost!==null&&n.dwelling_replacement_cost!==void 0&&(a.dwelling_replacement_cost=n.dwelling_replacement_cost),n.other_structures_coverage!==null&&n.other_structures_coverage!==void 0&&(a.other_structures_coverage=n.other_structures_coverage),n.personal_property_coverage!==null&&n.personal_property_coverage!==void 0&&(a.personal_property_coverage=n.personal_property_coverage),n.loss_of_use_coverage!==null&&n.loss_of_use_coverage!==void 0&&(a.loss_of_use_coverage=n.loss_of_use_coverage),n.personal_liability&&(a.personal_liability=n.personal_liability),n.dwelling_medical_payments&&(a.dwelling_medical_payments=n.dwelling_medical_payments),n.all_perils_deductible&&(a.all_perils_deductible=n.all_perils_deductible),n.windstorm_deductible&&(a.windstorm_deductible=n.windstorm_deductible),n.has_garage!==null&&n.has_garage!==void 0&&(a.has_garage=be(n.has_garage)),n.has_pool!==null&&n.has_pool!==void 0&&(a.has_pool=be(n.has_pool)),n.has_trampoline!==null&&n.has_trampoline!==void 0&&(a.has_trampoline=be(n.has_trampoline)),n.gender&&(a.gender=n.gender),n.marital_status&&(a.marital_status=n.marital_status),n.employment_industry&&(a.employment_industry=n.employment_industry),n.occupation&&(a.occupation=n.occupation),n.has_co_applicant!==null&&n.has_co_applicant!==void 0&&(a.has_co_applicant=be(n.has_co_applicant)),n.co_applicant_first_name&&(a.co_applicant_first_name=n.co_applicant_first_name),n.co_applicant_middle_name&&(a.co_applicant_middle_name=n.co_applicant_middle_name),n.co_applicant_last_name&&(a.co_applicant_last_name=n.co_applicant_last_name),n.co_applicant_gender&&(a.co_applicant_gender=n.co_applicant_gender),n.co_applicant_marital_status&&(a.co_applicant_marital_status=n.co_applicant_marital_status),n.co_applicant_relationship&&(a.co_applicant_relationship=n.co_applicant_relationship),n.co_applicant_date_of_birth&&(a.co_applicant_date_of_birth=an(n.co_applicant_date_of_birth)),n.co_applicant_employment_industry&&(a.co_applicant_employment_industry=n.co_applicant_employment_industry),n.co_applicant_occupation&&(a.co_applicant_occupation=n.co_applicant_occupation),n.retiree_discount!==null&&n.retiree_discount!==void 0&&(a.retiree_discount=be(n.retiree_discount)),n.gated_community_discount!==null&&n.gated_community_discount!==void 0&&(a.gated_community_discount=be(n.gated_community_discount)),n.multi_policy_discount!==null&&n.multi_policy_discount!==void 0&&(a.multi_policy_discount=be(n.multi_policy_discount)),n.non_smoker_discount!==null&&n.non_smoker_discount!==void 0&&(a.non_smoker_discount=be(n.non_smoker_discount)),n.first_time_buyer_discount!==null&&n.first_time_buyer_discount!==void 0&&(a.first_time_buyer_discount=be(n.first_time_buyer_discount)),n.fire_detection_system!==null&&n.fire_detection_system!==void 0&&(a.fire_detection_system=be(n.fire_detection_system)),n.burglar_alarm_system!==null&&n.burglar_alarm_system!==void 0&&(a.burglar_alarm_system=be(n.burglar_alarm_system)),n.burglar_alarm_system_type&&(a.burglar_alarm_system_type=n.burglar_alarm_system_type),n.smoke_detectors!==null&&n.smoke_detectors!==void 0&&(a.smoke_detectors=be(n.smoke_detectors)),n.sprinkler_system!==null&&n.sprinkler_system!==void 0&&(a.sprinkler_system=be(n.sprinkler_system)),n.sprinkler_system_type&&(a.sprinkler_system_type=n.sprinkler_system_type),n.gas_leakage_detector!==null&&n.gas_leakage_detector!==void 0&&(a.gas_leakage_detector=be(n.gas_leakage_detector)),n.deadbolt_locks!==null&&n.deadbolt_locks!==void 0&&(a.deadbolt_locks=be(n.deadbolt_locks)),n.fire_extinguisher!==null&&n.fire_extinguisher!==void 0&&(a.fire_extinguisher=be(n.fire_extinguisher)),n.order_credit_authorized!==null&&n.order_credit_authorized!==void 0&&(a.order_credit_authorized=be(n.order_credit_authorized)),n.has_health_insurance_auto_accident!==null&&n.has_health_insurance_auto_accident!==void 0&&(a.has_health_insurance_auto_accident=be(n.has_health_insurance_auto_accident)),n.is_corporation!==null&&n.is_corporation!==void 0&&(a.is_corporation=be(n.is_corporation)),n.named_insured_foreclosure_repo_bankruptcy!==null&&n.named_insured_foreclosure_repo_bankruptcy!==void 0&&(a.named_insured_foreclosure_repo_bankruptcy=be(n.named_insured_foreclosure_repo_bankruptcy)),n.named_insured_convicted_insurance_fraud!==null&&n.named_insured_convicted_insurance_fraud!==void 0&&(a.named_insured_convicted_insurance_fraud=be(n.named_insured_convicted_insurance_fraud));const f={};if(n.vehicles)for(const d of n.vehicles)d.quote_vehicle_id&&d.vin&&(f[d.quote_vehicle_id]=d.vin);return n.drivers&&n.drivers.length>0?(a.drivers="Yes",a.drivers__items=n.drivers.map(d=>{const m=d,_={};m.first_name&&(_.first_name=m.first_name),m.middle_name&&(_.middle_name=m.middle_name),m.last_name&&(_.last_name=m.last_name),m.date_of_birth&&(_.date_of_birth=an(m.date_of_birth)),m.gender&&(_.gender=m.gender),m.marital_status&&(_.marital_status=m.marital_status),m.relationship_to_insured&&(_.relationship_to_insured=m.relationship_to_insured),m.is_registered_owner!==null&&m.is_registered_owner!==void 0&&(_.is_registered_owner=m.is_registered_owner?"Yes":"No"),m.license_state&&(_.license_state=m.license_state),m.license_status&&(_.license_status=m.license_status),m.license_number&&(_.license_number=m.license_number),m.date_first_licensed&&(_.date_first_licensed=an(m.date_first_licensed)),m.education_level&&(_.education_level=Dv(m.education_level)),m.occupation&&(_.occupation=Rv(m.occupation)),m.industry&&(_.industry=Fl(m.industry)),m.employment_status&&(_.employment_status=m.employment_status),m.last_5_years_license_suspended_or_revoked!==null&&m.last_5_years_license_suspended_or_revoked!==void 0&&(_.last_5_years_license_suspended_or_revoked=be(m.last_5_years_license_suspended_or_revoked)),m.accident_prevention_course!==null&&m.accident_prevention_course!==void 0&&(_.accident_prevention_course=be(m.accident_prevention_course)),m.accident_prevention_course_date&&(_.accident_prevention_course_date=an(m.accident_prevention_course_date)),m.sr22!==null&&m.sr22!==void 0&&(_.sr22=be(m.sr22));const h=m.ssn_display;typeof h=="string"&&(_.ssn_display=h);const v=m.driver_violations;v&&v.length>0&&(_.driver_violations="Yes",_.driver_violations__items=v.map(w=>{const D={};return w.code&&(D.code=w.code),w.occurred_at&&(D.occurred_at=an(w.occurred_at)),D}));const b=m.driver_accidents;b&&b.length>0&&(_.driver_accidents="Yes",_.driver_accidents__items=b.map(w=>{const D={};return w.occurred_at&&(D.occurred_at=an(w.occurred_at)),w.description&&(D.description=w.description),w.quote_vehicle_id&&(D.quote_vehicle_id=f[w.quote_vehicle_id]??w.quote_vehicle_id),w.property_damage_amount_paid_cents!==null&&w.property_damage_amount_paid_cents!==void 0&&(D.property_damage_amount_paid_cents=w.property_damage_amount_paid_cents),w.personal_injury_amount_paid_cents!==null&&w.personal_injury_amount_paid_cents!==void 0&&(D.personal_injury_amount_paid_cents=w.personal_injury_amount_paid_cents),D}));const N=m.losses;return N&&N.length>0&&(_.losses="Yes",_.losses__items=N.map(w=>{const D={};return w.description&&(D.description=w.description),w.date_of_incident&&(D.date_of_incident=an(w.date_of_incident)),w.amount_paid_cents!==null&&w.amount_paid_cents!==void 0&&(D.amount_paid_cents=w.amount_paid_cents),w.quote_vehicle_id&&(D.quote_vehicle_id=f[w.quote_vehicle_id]??w.quote_vehicle_id),D})),_})):a.drivers="No",n.vehicles&&n.vehicles.length>0?(a.vehicles="Yes",a.vehicles__items=n.vehicles.map(d=>{const m=d,_={};m.vin&&(_.vin=m.vin),m.year!==null&&m.year!==void 0&&(_.year=String(m.year)),m.make&&(_.make=m.make),m.model&&(_.model=m.model),m.body_style&&(_.body_style=m.body_style),m.ownership_type&&(_.ownership_type=m.ownership_type),m.usage&&(_.usage=m.usage),m.annual_mileage!==null&&m.annual_mileage!==void 0&&(_.annual_mileage=m.annual_mileage),m.miles_to_work!==null&&m.miles_to_work!==void 0&&(_.miles_to_work=m.miles_to_work),m.percent_to_work!==null&&m.percent_to_work!==void 0&&(_.percent_to_work=m.percent_to_work);const h=[];return m.garaging_address_line_1&&h.push(m.garaging_address_line_1),m.garaging_address_line_2&&h.push(m.garaging_address_line_2),m.garaging_address_city&&h.push(m.garaging_address_city),m.garaging_address_state&&h.push(m.garaging_address_state),m.garaging_address_postal_code&&h.push(m.garaging_address_postal_code),h.length>0&&(_.garaging_address=h.join(", ")),m.new_when_purchased!==null&&m.new_when_purchased!==void 0&&(_.new_when_purchased=be(m.new_when_purchased)),m.purchase_date&&(_.purchase_date=an(m.purchase_date)),m.anti_theft_type&&(_.anti_theft_type=m.anti_theft_type),m.passive_restraint_type&&(_.passive_restraint_type=m.passive_restraint_type),m.anti_lock_brakes!==null&&m.anti_lock_brakes!==void 0&&(_.anti_lock_brakes=be(m.anti_lock_brakes)),m.daytime_running_lights!==null&&m.daytime_running_lights!==void 0&&(_.daytime_running_lights=be(m.daytime_running_lights)),m.custom_equipment_value_cents!==null&&m.custom_equipment_value_cents!==void 0&&(_.custom_equipment_value_cents=m.custom_equipment_value_cents),m.cost_new_value_cents!==null&&m.cost_new_value_cents!==void 0&&(_.cost_new_value_cents=m.cost_new_value_cents),m.stated_value_amount_cents!==null&&m.stated_value_amount_cents!==void 0&&(_.stated_value_amount_cents=m.stated_value_amount_cents),m.vehicle_has_modifications!==null&&m.vehicle_has_modifications!==void 0&&(_.vehicle_has_modifications=be(m.vehicle_has_modifications)),m.vehicle_garaged_at_residence!==null&&m.vehicle_garaged_at_residence!==void 0&&(_.vehicle_garaged_at_residence=be(m.vehicle_garaged_at_residence)),m.vehicle_comp_deductible&&(_.vehicle_comp_deductible=m.vehicle_comp_deductible),m.vehicle_coll_deductible&&(_.vehicle_coll_deductible=m.vehicle_coll_deductible),m.vehicle_towing_and_labor&&(_.vehicle_towing_and_labor=m.vehicle_towing_and_labor),m.vehicle_transportation_expense&&(_.vehicle_transportation_expense=m.vehicle_transportation_expense),m.vehicle_full_glass!==null&&m.vehicle_full_glass!==void 0&&(_.vehicle_full_glass=be(m.vehicle_full_glass)),m.vehicle_loan_lease!==null&&m.vehicle_loan_lease!==void 0&&(_.vehicle_loan_lease=be(m.vehicle_loan_lease)),m.coverages&&m.coverages.length>0&&(_.coverages__items=m.coverages.map(v=>{const b={};return v.type&&(b.type=v.type),v.per_person_limit_cents!==null&&v.per_person_limit_cents!==void 0&&(b.per_person_limit_cents=v.per_person_limit_cents),v.per_incident_limit_cents!==null&&v.per_incident_limit_cents!==void 0&&(b.per_incident_limit_cents=v.per_incident_limit_cents),v.per_incident_limit_percent!==null&&v.per_incident_limit_percent!==void 0&&(b.per_incident_limit_percent=v.per_incident_limit_percent),v.per_day_limit_cents!==null&&v.per_day_limit_cents!==void 0&&(b.per_day_limit_cents=v.per_day_limit_cents),v.deductible_cents!==null&&v.deductible_cents!==void 0&&(b.deductible_cents=v.deductible_cents),v.is_declined!==null&&v.is_declined!==void 0&&(b.is_declined=be(v.is_declined)),b})),m.vehicle_lienholders&&m.vehicle_lienholders.length>0&&(_.vehicle_lienholders__items=m.vehicle_lienholders.map(v=>{const b={};return v.name&&(b.name=v.name),v.type&&(b.type=v.type),v.line_1&&(b.line_1=v.line_1),v.line_2&&(b.line_2=v.line_2),v.city&&(b.city=v.city),v.state&&(b.state=v.state),v.postal_code&&(b.postal_code=v.postal_code),v.phone&&(b.phone=v.phone),v.fax&&(b.fax=v.fax),b})),_})):a.vehicles="No",n.losses&&n.losses.length>0?(a.home_losses="Yes",a.home_losses__items=n.losses.map(d=>{const m={};return d.description&&(m.description=d.description),d.date_of_incident&&(m.date_of_incident=an(d.date_of_incident)),d.amount_paid_cents!==null&&d.amount_paid_cents!==void 0&&(m.amount_paid_cents=Math.round(Number(d.amount_paid_cents)/100)),m})):a.home_losses="No",a}const s0=new Set(["Zip","Product","Driver","Vehicle"]);function Y2(t){return t?Array.isArray(t.drivers__items)?t.drivers__items.length:Array.isArray(t.drivers)?t.drivers.length:null:null}function l0(t,n){const a=Y2(n),o=t.filter(f=>f.key!=="AutoPolicy"),l=o.length>0?o:t;return l}function Dl(t){const n={},a=h=>{if(typeof h=="string"){if(h==="Yes")return!0;if(h==="No")return!1}return h},o=Object.keys(t).filter(h=>!h.includes("__items")),l=new Set,f=new Set;for(const[h,v]of Object.entries(t))if(h.endsWith("__items")&&Array.isArray(v)){const b=h.replace("__items","");f.add(b),o.includes(b)&&v.forEach(N=>{typeof N=="object"&&N!==null&&Object.keys(N).forEach(w=>{l.add(w)})})}for(const[h,v]of Object.entries(t))if(h.endsWith("__items")){const b=h.replace("__items","");if(o.includes(b)){const w=Array.isArray(v)?v.map(D=>Dl(D)):v;n[b]=w}}else if(!h.includes("__items")){if(f.has(h))continue;l.has(h)||(n[h]=a(v))}const d=n.auto_prior_carrier_name;if(typeof d=="string"&&d.trim()!==""){const h=d==="NoPriorInsurance";n.auto_has_prior_insurance=!h,h&&(delete n.auto_prior_years,delete n.auto_prior_months,delete n.auto_prior_expiration_date,delete n.auto_prior_liability_limit,delete n.auto_continuous_coverage_years,delete n.auto_cancelled_declined_refused_to_renew,delete n.auto_current_annual_premium_cents)}const m=n.home_prior_carrier_name;if(typeof m=="string"&&m.trim()!==""){const h=m==="NoPriorInsurance";n.home_has_prior_insurance=!h,h&&(delete n.home_prior_years,delete n.home_continuous_coverage_years,delete n.home_prior_expiration_date,delete n.property_insurance_cancelled)}Array.isArray(n.drivers)&&(n.drivers=n.drivers.map(h=>{if(!h||typeof h!="object")return h;const v={...h};return v.industry=Fl(v.industry),v.education_level=Dv(v.education_level),v.occupation=Rv(v.occupation),v}));const _=21474836;if("sale_price_cents"in n){const h=n.sale_price_cents;if(typeof h=="number"&&Number.isFinite(h)){const v=Math.trunc(h);if(v>=1){const b=Math.min(v,_);n.sale_price_cents=b*100}}}return Array.isArray(n.home_losses)&&(n.home_losses=n.home_losses.map(h=>{if(!h||typeof h!="object")return h;const v=h,b=v.amount_paid_cents;if(typeof b!="number"||!Number.isFinite(b))return v;const N=Math.trunc(b),w=Math.min(Math.max(N,0),_);return{...v,amount_paid_cents:w*100}})),n}function Z2(t,n){const a=t.findIndex(l=>l.key===n);return a<0?n:t[a+1]?.key??n}function eb(t){return t.some(n=>String(n.key)==="BundlePolicy"||String(n.key)==="BundleCustomer")}function c0(t){return eb(t)?"Bundle":t.some(n=>String(n.key)==="Vehicle"||String(n.key)==="Driver")?"Auto":"Home"}const P2={Auto:45e3,Home:5e4,Bundle:1e5};function q2(t,n){if(t!=="AutoCurrentCarrier")return n;const a=n.some(f=>String(f.key)==="auto_cancelled_declined_refused_to_renew"),o=n.some(f=>String(f.key)==="vehicle_policy_selections"),l=[...n];return a||l.push({question:"Has any auto insurance company cancelled, declined or refused to renew you in the last 5 years?",inputType:"radio",options:["Yes","No"],key:"auto_cancelled_declined_refused_to_renew",required:!0}),o||l.push({question:"Vehicle coverage selections",inputType:"custom",key:"vehicle_policy_selections",required:!1}),l}function V2(t,n){if(t!=="Vehicle")return n;const a=o=>o.map(l=>{const f=l.conditionals?.map(d=>{const m=d.conditionalQuestions??[];return m.length?{...d,conditionalQuestions:a(m)}:d});return String(l.key)!=="vin"?f?{...l,conditionals:f}:l:{...l,required:!1,...f?{conditionals:f}:{}}});return a(n)}function K2({isOpen:t,onClose:n}){const[a,o]=B.useState([]),[l,f]=B.useState(null),d=B.useRef(null);B.useEffect(()=>{d.current=l},[l]);const[m,_]=B.useState(null),[h,v]=B.useState(!1),[b,N]=B.useState(!1),[w,D]=B.useState([]),k=B.useRef(null),[ue,ne]=B.useState(null),[se,W]=B.useState(void 0),[oe,F]=B.useState(!1),[ie,te]=B.useState(null),[ae,ve]=B.useState(null),[Ee,Te]=B.useState(!1),[Le,it]=B.useState(!1),Ge=B.useRef(!1);B.useEffect(()=>{if(!h||b)return;const G=c0(a);let E=!1;const C=[];let A=0,S=0;const R=66,I=3,Y=5e3;let K=!1;const Q=async()=>{if(E)return;A++;try{const{quote:V}=await jy();if(E)return;if(S=0,!K){const ee=V?.appetites??null,de=f2(ee,G);de.length>0&&(D(de),K=!0)}const X=V?.rates_status??null;if(X==="completed"){const{rates:ee}=await If();if(E)return;k.current=ee,N(!0);return}if(X==="no_rates"){k.current=[],N(!0);return}if(X==="failed"){Ai(new Error("Quote failed: rate-generation worker reported rates_status=failed"),{quoteId:d.current??void 0,phase:"rates_status_failed"}),zo({reason:"submission"}),te({message:"submission_failed"}),v(!1);return}}catch(V){if(S++,console.warn("Provider polling: getQuote failed",{attempt:A,consecutiveFailures:S,error:V}),S>=I){V?.__sentryReported||Ai(V,{quoteId:d.current??void 0,phase:"rates_polling",message:`Quote failed: ${I} consecutive get-quote poll failures`}),zo({reason:"network"}),te({message:"submission_failed"}),v(!1);return}}if(E)return;if(A>=R){Ai(new Error(`Quote failed: rate-generation timed out after ${R} polls`),{quoteId:d.current??void 0,phase:"rates_polling_timeout"}),zo({reason:"timeout"}),te({message:"submission_failed"}),v(!1);return}const re=window.setTimeout(Q,Y);C.push(re)};return Q(),()=>{E=!0,C.forEach(re=>window.clearTimeout(re))}},[h,b,a]);function he(G){const E={Zip:"ZIP Code",Email:"Email",Product:"Product & Address",Home:"Home Details",Vehicle:"Vehicle",Name:"Name & DOB",Driver:"Operator",AutoCurrentCarrier:"Policy",HomeCurrentCarrier:"Policy",HomePolicy:"Policy",BundlePolicy:"Policy",Demographics:"Applicant",Ssn:"SSN",Phone:"Phone",SMSVerification:"Verify",AutoPolicy:"Policy",Customer:"Applicant",HomeCustomer:"Applicant",BundleCustomer:"Applicant",HomeConstruction:"Structure",HomeFeatures:"Features"};return G.map(A=>({key:A,title:E[A]||A,loadQuestions:async()=>{const S=await AR(A,d.current??void 0);let R=q2(A,S.questions);return R=V2(A,R),R}}))}B.useEffect(()=>{const G=async()=>{try{const E=F2();if(E)try{const{token:A,quoteId:S}=await OR(E);A&&S&&(Bf(A),Cy(S))}catch(A){A.statusCode===401&&it(!0)}const C=ac();if(vd(),C){F(!0),f(C);try{const A=Ti(),S=await jy(A?void 0:C);if(!S||!S.quote)throw new Error("Invalid response from getQuote: missing quote data");const{quote:R}=S,{stages:I}=await El(C),Y=he(I);o(Y);let K;try{K=G2(R),ne(K)}catch(V){throw new Error(`Failed to transform quote data: ${V instanceof Error?V.message:"Unknown error"}`)}const Q=l0(Y,K);o(Q);const re=R?.rates_status??null;if(Ti()){if(re==="completed")try{const{rates:V}=await If();_(V);return}catch(V){console.warn("Failed to fetch completed rates on resume",V)}else if(re==="no_rates"){_([]);return}else if(re==="processing"){D([]),N(!1),k.current=null,v(!0);return}}if(R.current_stage){const V=R.current_stage==="State"?"Product":R.current_stage,X=Q.findIndex(ee=>ee.key===V);X>=0?W(X):W(Q.length-1)}else W(Q.length-1)}catch(A){const S=A;if(S.statusCode===404)Lv(),f(null);else if(S.statusCode===401){Iv();try{const{stages:R}=await El(C),I=he(R);o(I);const Y=I.findIndex(K=>K.key==="SMSVerification");Y>=0&&W(Y)}catch{}}}finally{F(!1)}}else{const{stages:A}=await El();o(he(A))}}catch{F(!1)}};t&&!Ge.current&&(Ge.current=!0,G())},[t]),B.useEffect(()=>{if(!t)return;const{overflow:G}=document.body.style;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=G}},[t]);const x=B.useCallback(G=>{G.key==="Escape"&&(qy(),n())},[n]);B.useEffect(()=>{if(t)return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[t,x]),B.useEffect(()=>{t||(ne(null),W(void 0),F(!1),v(!1),ve(null),Te(!1))},[t]),B.useEffect(()=>{t&&WR()},[t]),B.useEffect(()=>{m&&Array.isArray(m)&&t2({rateCount:m.length})},[m]);const U=B.useCallback(()=>{te(null),W(Math.max(0,a.length-1))},[a.length]),J=B.useCallback(async G=>{if(!(!ae||!l||Ee)){Te(!0);try{const C={...Dl(ae.allValues),communications_consent:G};D([]),N(!1),k.current=null,v(!0),ve(null);let A;try{A=await Si(C,!0)}catch(I){throw v(!1),I}if(A.status==="submission_failed"){Ai(new Error(`Quote failed at submission: ${A.message}`),{quoteId:l??void 0,phase:"consent_submit"}),v(!1),N(!1),k.current=null,zo({reason:"submission"}),te({message:A.message});return}if(A.status==="success")try{const{rates:I}=await If();k.current=I,N(!0)}catch(I){throw v(!1),I}const S=a.length,R=a[S-1];Vy({stageKey:R?.key??"unknown",stageTitle:R?.title??"unknown",stepIndex:S,totalSteps:S}),e2()}catch(E){E?.__sentryReported||Ai(E,{quoteId:l??void 0,phase:"consent_submit"}),v(!1),zo({reason:"submission"}),te({message:"Oops, something went wrong. Please try again later."})}finally{Te(!1)}}},[ae,l,Ee,a]);if(!t)return null;const _e=()=>{qy(),n()};return g.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true","aria-labelledby":"insurance-modal-title",children:[g.jsx("div",{className:"backdrop","aria-hidden":"true"}),g.jsxs("div",{className:"modal-panel bg-white relative w-full max-w-2xl flex flex-col max-h-[90vh] overflow-hidden",role:"document",children:[g.jsx("button",{onClick:_e,className:"modal-close-btn absolute top-4 right-4 text-slate-400 hover:text-slate-600 text-xl","aria-label":"Close",type:"button",children:"×"}),!h&&!ie&&g.jsx("div",{className:"text-center mb-6",children:g.jsx("h2",{id:"insurance-modal-title",className:"h1-title",children:"Let's shop multiple leading carriers for you."})}),g.jsxs("div",{className:"panel-body flex-1 min-h-0 overflow-y-auto",children:[Le&&g.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-800",role:"alert",children:[g.jsx("span",{children:"This resume link has expired or is no longer valid. For your security, emailed links only work for a limited time — you can continue your quote below."}),g.jsx("button",{type:"button",onClick:()=>it(!1),className:"shrink-0 font-bold text-amber-800 hover:text-amber-900","aria-label":"Dismiss",children:"×"})]}),ie&&g.jsx(Qv,{onGoBack:U}),!ie&&h&&(()=>{const G=c0(a);return g.jsx(b2,{providers:w,totalTime:P2[G],flow:G,isComplete:b,onComplete:()=>{v(!1),N(!1),D([]),k.current&&(_(k.current),k.current=null)}})})(),!ie&&!h&&ae&&g.jsx(rO,{onChoose:J,isSubmitting:Ee}),!ie&&!m&&!h&&!ae&&g.jsx(g.Fragment,{children:oe||a.length===0?g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"text-slate-600",children:"Loading..."})}):g.jsx(l2,{stages:a,initialValues:ue??void 0,initialActive:se,quoteId:l??void 0,nonTerminalStageKeys:s0,onStageComplete:async(G,E)=>{try{const C=Dl(G);let A=l,S=a;const R=S.findIndex(K=>K.key===E),I=S[R],Y=Z2(S,E);if(A)if(E==="Phone"){const K=C.phone;if(!K)throw new Error("Phone number is required.");const Q=Ti();await Si({...C,current_stage:Y},!1,Q?void 0:A),await CR(A,K)}else if(E==="SMSVerification"){const{isVerified:K,token:Q}=await zy(A,C.sms_code);if(!K)throw new Error("Invalid SMS code");Q&&Bf(Q),await Si({current_stage:Y},!1)}else if(E==="Product"){const K=Ti(),{isSupported:Q}=await NR(C.state,K?void 0:A??void 0);if(!Q)throw new Error("State is not supported");await Si({...C,current_stage:Y},!1,K?void 0:A)}else{const K=Ti();await Si({...C,current_stage:Y},!1,K?void 0:A||void 0)}else{const K=C.postal_code??"";if(!K)throw new Error("ZIP code is required to start a quote.");const re=(await TR(K))?.quoteId;if(!re||typeof re!="string"||re.trim()==="")throw new Error(`Failed to create quote - invalid quoteId returned: ${re}`);A=re,f(re),Cy(re),await Si({...C,current_stage:Y},!1,re)}if(s0.has(E))try{const{stages:K}=await El(A||void 0);S=he(K),S=l0(S,G),o(S)}catch(K){console.warn("Unable to refresh stages after flow-shaping step",K)}return Vy({stageKey:E,stageTitle:I?.title??E,stepIndex:R+1,totalSteps:S.length}),{success:!0,latestStages:S}}catch(C){return{success:!1,error:C instanceof Error?C.message:"An error occurred"}}},onComplete:async(G,E)=>{if(!l)return{success:!1,error:"Oops, something went wrong. Please try again later."};ne(G);try{if(E==="SMSVerification"){const C=Dl(G),{isVerified:A,token:S}=await zy(l,C.sms_code);return A?(S&&Bf(S),ve({allValues:G}),{success:!0}):{success:!1,error:"Invalid SMS code"}}return ve({allValues:G}),{success:!0}}catch{const A="Oops, something went wrong. Please try again later.";return te({message:A}),{success:!1,error:A}}}})})," ",!ie&&m&&l&&g.jsx(y2,{rates:m,onBack:()=>_(null),isBundleFlow:eb(a)})]}),g.jsxs("div",{className:"mt-4 pt-4 border-t border-slate-200 space-y-2",children:[g.jsx($2,{}),g.jsx("p",{className:"text-center text-sm text-slate-500",children:"Insurance products offered through Credify Corporation, a licensed insurance agency."})]})]})]})}function Q2({onClose:t}){return g.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true",children:[g.jsx("div",{className:"backdrop","aria-hidden":"true"}),g.jsx("div",{className:"modal-panel bg-white relative w-full max-w-2xl p-6",children:g.jsx(Qv,{onGoBack:t})})]})}var Zf={};function X2(){try{return typeof Zf<"u"&&Zf?Zf:{}}catch{return{}}}let u0=!1;function W2(t,n){if(!t)return n;const a=Number(t);return Number.isFinite(a)&&a>=0&&a<=1?a:n}function J2(t={}){if(u0)return!0;if(typeof window>"u")return!1;const n=X2(),a=t.dsn??n.dsn;return!a||t.enabled===!1?!1:(dR({baseUrl:Zt}),$C({dsn:a,environment:t.environment??n.environment??"production",release:t.release??n.release,sendDefaultPii:!1,maxBreadcrumbs:50,tracesSampleRate:t.tracesSampleRate??W2(n.tracesSampleRate,.1),tracePropagationTargets:[Zt],replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSend:o=>xy(o),beforeBreadcrumb:o=>o&&(xy({breadcrumbs:[o]}),o)}),u0=!0,UC("replayIntegration").then(o=>{try{y1(o({maskAllText:!0,maskAllInputs:!0,blockAllMedia:!0,networkDetailAllowUrls:[Zt],networkCaptureBodies:!1}))}catch{}}).catch(()=>{}),!0)}function eL(){const[t,n]=B.useState(!1);B.useEffect(()=>{J2(),k2()},[]);const a=B.useCallback(l=>{window.parent&&window.parent!==window&&window.parent.postMessage({type:l,source:"credify-insurance-widget"},"*")},[]);B.useEffect(()=>{const l=(d,m,_)=>{window.parent&&window.parent!==window&&window.parent.postMessage({type:"event",source:"credify-insurance-widget",event:d,data:m,meta:_},"*")},f=QR.map(d=>{const m=(_,h)=>l(d,_,h);return Uv(d,m),[d,m]});return()=>{for(const[d,m]of f)Hv(d,m)}},[]),B.useEffect(()=>{const l=f=>{if(f.data?.source==="credify-insurance-widget")switch(f.data.type){case"open":n(!0),a("opened");break;case"close":n(!1),a("closed");break;case"init":a("ready");break;case"support-open":Jv();break}};return window.addEventListener("message",l),a("ready"),()=>{window.removeEventListener("message",l)}},[a]);const o=B.useCallback(()=>{n(!1),a("closed")},[a]);return g.jsx(Hd,{fallback:g.jsx(Q2,{onClose:o}),children:g.jsx(K2,{isOpen:t,onClose:o})})}const tL="modulepreload",nL=function(t){return"/iframe/"+t},f0={},rL=function(n,a,o){let l=Promise.resolve();if(a&&a.length>0){let h=function(v){return Promise.all(v.map(b=>Promise.resolve(b).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};var d=h;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),_=m?.nonce||m?.getAttribute("nonce");l=h(a.map(v=>{if(v=nL(v),v in f0)return;f0[v]=!0;const b=v.endsWith(".css"),N=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${N}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":tL,b||(w.as="script"),w.crossOrigin="",w.href=v,_&&w.setAttribute("nonce",_),document.head.appendChild(w),b)return new Promise((D,k)=>{w.addEventListener("load",D),w.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${v}`)))})}))}function f(m){const _=new Event("vite:preloadError",{cancelable:!0});if(_.payload=m,window.dispatchEvent(_),!_.defaultPrevented)throw m}return l.then(m=>{for(const _ of m||[])_.status==="rejected"&&f(_.reason);return n().catch(f)})};var Pf={};const aL="mock";function iL(){try{return typeof Pf<"u"&&Pf&&Pf.key||void 0}catch{return}}function oL(){const t=iL();if(!t||typeof window>"u"||!window.location)return!1;try{return new URLSearchParams(window.location.search).get(aL)===t}catch{return!1}}const sL=new Set(["/create-quote","/get-stages-for-quote","/get-questions-by-stage","/update-quote","/verify-quote","/is-supported-state","/get-rates","/get-quote","/get-vehicle-options","/request-bind"]);let d0=!1;function lL(t){try{if(typeof t=="string")return new URL(t,window.location.href).pathname;if(t instanceof URL)return t.pathname;if(t instanceof Request)return new URL(t.url,window.location.href).pathname}catch{return null}return null}async function cL(t,n){try{if(n?.body&&typeof n.body=="string")return JSON.parse(n.body);if(t instanceof Request){const a=await t.clone().text();return a?JSON.parse(a):{}}}catch{return{}}return{}}function m0(t,n=200){return new Response(JSON.stringify(t),{status:n,headers:{"Content-Type":"application/json"}})}function uL(){try{if(typeof document>"u"||document.getElementById("credify-mock-badge"))return;const t=()=>{const n=document.createElement("div");n.id="credify-mock-badge",n.textContent="MOCK MODE",n.setAttribute("aria-hidden","true"),n.style.cssText=["position:fixed","bottom:12px","left:12px","z-index:2147483647","background:#b91c1c","color:#fff","font:600 11px/1 system-ui,sans-serif","letter-spacing:0.08em","padding:6px 10px","border-radius:9999px","box-shadow:0 1px 4px rgba(0,0,0,0.3)","pointer-events:none","user-select:none"].join(";"),document.body.appendChild(n)};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}catch{}}function fL(){if(d0||typeof window>"u"||typeof window.fetch!="function"||!oL())return;d0=!0;const t=window.fetch.bind(window),n=rL(()=>import("./backend-V-MdQp2e.js"),[]);window.fetch=async(a,o)=>{const l=lL(a);if(!l||!sL.has(l))return t(a,o);const f=await cL(a,o),{handleMockRequest:d}=await n;await new Promise(m=>window.setTimeout(m,120));try{return m0(d(l,f))}catch(m){return m0({error:m instanceof Error?m.message:"Mock handler error"},404)}},uL(),typeof console<"u"&&console.info("[Credify] Mock mode active — all API calls are served from in-memory fixtures.")}fL();SE.createRoot(document.getElementById("root")).render(g.jsx(B.StrictMode,{children:g.jsx(eL,{})}));
|
|
146
|
-
//# sourceMappingURL=iframe-
|
|
145
|
+
`}),g.jsx("div",{style:{background:"#F8FAFC",display:"flex",alignItems:"center",justifyContent:"center",padding:"2rem",fontFamily:"'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",height:"100%",minHeight:400,overflowY:"auto"},children:g.jsxs("div",{style:{width:"100%",maxWidth:560},children:[g.jsxs("div",{style:{textAlign:"center",marginBottom:40},children:[g.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:f.accent+"12",border:`1px solid ${f.accent}30`,borderRadius:100,padding:"6px 16px",marginBottom:16},children:[g.jsx("span",{style:{fontSize:14},children:f.icon}),g.jsx("span",{style:{fontSize:12,fontWeight:700,color:f.accent,letterSpacing:"0.1em",textTransform:"uppercase"},children:f.label})]}),g.jsx("h1",{style:{fontSize:26,fontWeight:700,color:"#0F172A",margin:0,letterSpacing:"-0.02em",lineHeight:1.3},children:ae?"Connecting to top carriers":"Fetching your best rates"}),g.jsx("p",{style:{fontSize:14,color:"#64748B",marginTop:8,marginBottom:0},children:ae?"Identifying the carriers eligible for your quote...":Ee?"Still gathering — a few carriers are taking a little longer...":"We're reaching out to multiple insurers on your behalf"})]}),g.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:32},children:ae?g.jsx("div",{style:{display:"flex",gap:20},children:[0,1,2,3,4].map(Te=>g.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6},children:[g.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${Te*.12}s`}}),g.jsx("div",{style:{width:40,height:8,borderRadius:4,background:"#E2E8F0",animation:"skeletonPulse 1.4s ease-in-out infinite",animationDelay:`${Te*.12}s`}})]},`skeleton-${Te}`))}):ve?g.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[g.jsxs("div",{style:{width:64,height:64,borderRadius:18,background:ve.color+"18",border:`2px solid ${ve.color}`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:16,color:ve.color,position:"relative",animation:"providerPulse 1.8s ease-in-out infinite"},children:[ve.abbr,g.jsx("div",{style:{position:"absolute",inset:-5,borderRadius:22,border:`2px solid ${ve.color}`,pointerEvents:"none",animation:"ringPulse 1.6s ease-in-out infinite"}})]}),g.jsx("span",{style:{fontSize:13,fontWeight:600,color:ve.color,letterSpacing:"0.04em"},children:ve.name})]}):null}),g.jsxs("div",{className:`iq-card-fade ${ue?"iq-card-visible":"iq-card-hidden"}`,style:{background:"#FFFFFF",borderRadius:24,border:"1px solid #E2E8F0",padding:32},children:[g.jsx("div",{style:{display:"flex",alignItems:"center",gap:20,marginBottom:28},children:ae||!ve?g.jsxs("div",{style:{flex:1,textAlign:"center",padding:"8px 0"},children:[g.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 6px"},children:"Please wait"}),g.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:"Checking eligible providers"}),g.jsx("p",{style:{fontSize:13,color:"#64748B",margin:0},children:"Reviewing your details against our carrier network"})]}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{style:{position:"relative",flexShrink:0},children:[g.jsx(v2,{progress:N,color:ve.color,size:80}),g.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsxs("span",{style:{fontSize:14,fontWeight:700,color:ve.color},children:[Math.round(N),"%"]})})]}),g.jsxs("div",{style:{flex:1},children:[g.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.1em",textTransform:"uppercase",margin:"0 0 4px"},children:Ee?"Still checking":"Now checking"}),g.jsx("h2",{style:{fontSize:20,fontWeight:700,color:"#0F172A",margin:"0 0 6px",letterSpacing:"-0.02em"},children:ve.name}),g.jsx("p",{className:"iq-status-text",style:{fontSize:13,color:"#64748B",margin:0},children:Ff[D]},`${_}-${D}`)]})]})}),g.jsxs("div",{children:[g.jsx("p",{style:{fontSize:11,fontWeight:700,color:"#94A3B8",letterSpacing:"0.08em",textTransform:"uppercase",margin:"0 0 8px"},children:ae?"Initializing":"Gathering quotes"}),g.jsx("div",{style:{height:6,background:"#F1F5F9",borderRadius:100,overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",width:"35%",background:f.accent,borderRadius:100,animation:"shimmerSlide 1.4s ease-in-out infinite"}})})]})]})]})})]})}function Qv({onGoBack:t}){return g.jsxs("section",{className:"mt-4",children:[g.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-5",children:[g.jsx("h3",{className:"text-base font-semibold text-red-700",children:"Sorry, quote submission failed"}),g.jsx("p",{className:"mt-2 text-sm text-red-700",children:"We ran into an issue submitting your quote. Our team will investigate and get back to you soon."})]}),g.jsx("div",{className:"mt-5",children:g.jsx("button",{type:"button",onClick:t,className:"h-12 w-full rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",children:"Go back"})})]})}var Gf={};function S2(){try{return typeof Gf<"u"&&Gf?Gf:{}}catch{return{}}}function E2(t){const n=S2(),a=n.intercomAppId,o=n.cobrowseLicense;return{enabled:!!(a||o),intercomAppId:a||void 0,cobrowseLicense:o||void 0,proactiveOnError:!0}}const Yf=new Map;function Xv(t){if(typeof document>"u")return Promise.reject(new Error("loadScript called without a document"));const n=Yf.get(t);if(n)return n;const a=new Promise((o,l)=>{const f=document.createElement("script");f.src=t,f.async=!0,f.onload=()=>o(),f.onerror=()=>{Yf.delete(t),l(new Error(`Failed to load script: ${t}`))},document.head.appendChild(f)});return Yf.set(t,a),a}let Ad=!1;function A2(){if(typeof window.Intercom=="function")return window.Intercom;const t=function(...n){t.c?.(n)};return t.q=[],t.c=n=>{t.q.push(n)},window.Intercom=t,t}function T2(t){const n={app_id:t,hide_default_launcher:!0},a=ac();return a&&(n.quote_id=a),n}function Wv(t){if(typeof window>"u")return;A2();const n=T2(t);if(window.intercomSettings=n,Ad){window.Intercom("update",n);return}window.Intercom("boot",n),Ad=!0,Xv(`https://widget.intercom.io/widget/${t}`).catch(()=>{})}function C2(){typeof window?.Intercom=="function"&&window.Intercom("show")}function O2(t){typeof window?.Intercom=="function"&&window.Intercom("showNewMessage",t)}function N2(t){typeof window?.Intercom=="function"&&window.Intercom("update",t)}function w2(){if(typeof window?.Intercom=="function")try{window.Intercom("shutdown")}catch{}Ad=!1}const M2="https://js.cobrowse.io/CobrowseIO.js";let Td=!1;async function x2(t){await Xv(M2);const n=window.CobrowseIO;if(!n)return null;if(!Td){n.license=t,n.redactedViews=["input","select","textarea","[data-credify-redact]"],n.customData={quote_id:ac()??void 0,device_name:"Credify Insurance Widget"},n.confirmSession=()=>Promise.resolve(typeof window<"u"?window.confirm("Allow a Credify support agent to view your screen?"):!1);try{await n.client?.()}catch{}n.start?.(),Td=!0}return n}async function D2(t){if(typeof window>"u")return null;try{const n=await x2(t);return n?.createSessionCode?await n.createSessionCode():null}catch{return null}}function R2(){try{window.CobrowseIO?.stop?.()}catch{}Td=!1}const L2="Hi! It looks like something went wrong submitting your quote. We're here to help — tell us what you were trying to do and we'll jump in.";let Ln=null,xl=null,Cd=!1;function k2(t){I2();const n=E2();if(Ln=n,!!n.enabled&&n.proactiveOnError&&n.intercomAppId){const a=o=>{Cd||(Cd=!0,Wv(n.intercomAppId),N2({last_quote_error:o?.reason??"unknown"}),O2(L2))};Uv("submissionFailed",a),xl=a}}function Jv(){!Ln?.enabled||!Ln.intercomAppId||(Wv(Ln.intercomAppId),C2())}function z2(){return!Ln?.enabled||!Ln.cobrowseLicense?Promise.resolve(null):D2(Ln.cobrowseLicense)}function j2(){return!!(Ln?.enabled&&Ln.intercomAppId)}function B2(){return!!(Ln?.enabled&&Ln.cobrowseLicense)}function I2(){xl&&(Hv("submissionFailed",xl),xl=null),w2(),R2(),Cd=!1,Ln=null}const U2="Chat with our support team in real time — we'll help you finish your quote.",H2="Share your screen with a support agent so they can see what you see and guide you in real time. We'll generate a secure code — share it with your agent to begin. Your personal information stays hidden.",a0="inline-flex h-9 w-9 items-center justify-center rounded-full text-slate-500 hover:bg-slate-100 hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 disabled:opacity-60",i0="pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-60 -translate-x-1/2 rounded-lg bg-slate-800 px-3 py-2 text-center text-xs leading-snug text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100";function $2(){const t=j2(),n=B2(),[a,o]=B.useState(null),[l,f]=B.useState(!1),[d,m]=B.useState(!1),_=B.useCallback(async()=>{f(!0),m(!1);try{const h=await z2();h?o(h):m(!0)}finally{f(!1)}},[]);return!t&&!n?null:g.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-sm text-slate-500",children:[g.jsx("span",{className:"font-medium",children:"Need help?"}),g.jsxs("div",{className:"inline-flex items-center gap-1",children:[t&&g.jsxs("span",{className:"group relative inline-flex",children:[g.jsx("button",{type:"button",onClick:Jv,"aria-label":"Chat with support","aria-describedby":"credify-chat-tooltip",className:a0,children:g.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:g.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-8.5 8.5 9 9 0 0 1-3.8-.8L3 21l1.3-4.2A8.38 8.38 0 0 1 3.5 11.5 8.5 8.5 0 0 1 12 3a8.38 8.38 0 0 1 9 8.5Z",strokeLinejoin:"round"})})}),g.jsx("span",{id:"credify-chat-tooltip",role:"tooltip",className:i0,children:U2})]}),t&&n&&g.jsx("span",{className:"mx-1 h-6 w-px bg-slate-200","aria-hidden":"true"}),n&&g.jsxs("span",{className:"group relative inline-flex",children:[g.jsx("button",{type:"button",onClick:_,disabled:l,"aria-label":"Share your screen with an agent","aria-describedby":"credify-cobrowse-tooltip",className:a0,children:l?g.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-slate-600","aria-hidden":"true"}):g.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[g.jsx("rect",{x:"2.5",y:"4",width:"19",height:"13",rx:"2"}),g.jsx("path",{d:"M8 21h8M12 17v4",strokeLinecap:"round"}),g.jsx("path",{d:"M12 13V8m0 0-2 2m2-2 2 2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),g.jsx("span",{id:"credify-cobrowse-tooltip",role:"tooltip",className:i0,children:H2})]})]}),a&&g.jsxs("span",{children:["Read this code to your agent: ",g.jsx("strong",{className:"tracking-widest text-text-primary",children:a})]}),d&&g.jsx("span",{className:"text-red-600",children:"Couldn't start screen sharing. Please try chat instead."})]})}let o0=null;function F2(){const t=o0;return o0=null,t}let G2=!1;function Y2(){return G2}function be(t){if(t===!0)return"Yes";if(t===!1)return"No"}function an(t){if(t)try{const n=typeof t=="string"?new Date(t):t;return isNaN(n.getTime())?void 0:n.toISOString().split("T")[0]}catch{return}}function Z2(t){const n=t,a={};n.phone&&(a.phone=n.phone),n.first_name&&(a.first_name=n.first_name),n.last_name&&(a.last_name=n.last_name),n.email&&(a.email=n.email),n.date_of_birth&&(a.date_of_birth=an(n.date_of_birth)),n.product&&(a.product=n.product),n.state&&(a.state=n.state),n.postal_code&&(a.postal_code=n.postal_code);const o=[];n.line_1&&o.push(n.line_1),n.line_2&&o.push(n.line_2),n.city&&o.push(n.city),n.state&&o.push(n.state),n.postal_code&&o.push(n.postal_code),o.length>0&&(a.address=o.join(", ")),typeof n.ssn_display=="string"&&(a.ssn_display=n.ssn_display),n.years_at_address!==null&&n.years_at_address!==void 0&&(a.years_at_address=n.years_at_address),n.months_at_address!==null&&n.months_at_address!==void 0&&(a.months_at_address=n.months_at_address),n.move_in_date&&(a.move_in_date=an(n.move_in_date));const l=[];n.prior_line_1&&l.push(n.prior_line_1),n.prior_line_2&&l.push(n.prior_line_2),n.prior_city&&l.push(n.prior_city),n.prior_state&&l.push(n.prior_state),n.prior_postal_code&&l.push(n.prior_postal_code),l.length>0&&(a.prior_address=l.join(", ")),n.years_at_prior_address!==null&&n.years_at_prior_address!==void 0&&(a.years_at_prior_address=n.years_at_prior_address),n.is_mailing_address_different!==null&&n.is_mailing_address_different!==void 0&&(a.is_mailing_address_different=be(n.is_mailing_address_different)),n.mailing_address&&(a.mailing_address=n.mailing_address),n.effective_date&&(a.effective_date=an(n.effective_date)),n.auto_has_prior_insurance!==null&&n.auto_has_prior_insurance!==void 0&&(a.auto_has_prior_insurance=be(n.auto_has_prior_insurance)),n.auto_prior_expiration_date&&(a.auto_prior_expiration_date=an(n.auto_prior_expiration_date)),n.auto_prior_carrier_name&&(a.auto_prior_carrier_name=n.auto_prior_carrier_name),n.auto_prior_liability_limit&&(a.auto_prior_liability_limit=n.auto_prior_liability_limit),n.auto_reason_for_no_insurance&&(a.auto_reason_for_no_insurance=n.auto_reason_for_no_insurance),n.auto_prior_years!==null&&n.auto_prior_years!==void 0&&(a.auto_prior_years=n.auto_prior_years),n.auto_prior_months!==null&&n.auto_prior_months!==void 0&&(a.auto_prior_months=n.auto_prior_months),n.auto_continuous_coverage_years!==null&&n.auto_continuous_coverage_years!==void 0&&(a.auto_continuous_coverage_years=n.auto_continuous_coverage_years),n.auto_cancelled_declined_refused_to_renew!==null&&n.auto_cancelled_declined_refused_to_renew!==void 0&&(a.auto_cancelled_declined_refused_to_renew=be(n.auto_cancelled_declined_refused_to_renew)),n.auto_current_annual_premium_cents!==null&&n.auto_current_annual_premium_cents!==void 0&&(a.auto_current_annual_premium_cents=n.auto_current_annual_premium_cents),n.policy_bi&&(a.policy_bi=n.policy_bi),n.policy_um&&(a.policy_um=n.policy_um),n.policy_pd&&(a.policy_pd=n.policy_pd),n.policy_mp&&(a.policy_mp=n.policy_mp),n.policy_umpd&&(a.policy_umpd=n.policy_umpd),n.policy_pip&&(a.policy_pip=n.policy_pip),n.policy_auto_death_indemnity&&(a.policy_auto_death_indemnity=n.policy_auto_death_indemnity),n.driver_vehicle_assignments&&(a.driver_vehicle_assignments=n.driver_vehicle_assignments),n.home_has_prior_insurance!==null&&n.home_has_prior_insurance!==void 0&&(a.home_has_prior_insurance=be(n.home_has_prior_insurance)),n.home_prior_expiration_date&&(a.home_prior_expiration_date=an(n.home_prior_expiration_date)),n.home_prior_carrier_name&&(a.home_prior_carrier_name=n.home_prior_carrier_name),n.home_prior_years!==null&&n.home_prior_years!==void 0&&(a.home_prior_years=n.home_prior_years),n.home_continuous_coverage_years!==null&&n.home_continuous_coverage_years!==void 0&&(a.home_continuous_coverage_years=n.home_continuous_coverage_years),n.property_insurance_cancelled!==null&&n.property_insurance_cancelled!==void 0&&(a.property_insurance_cancelled=be(n.property_insurance_cancelled)),n.lapse_in_coverage!==null&&n.lapse_in_coverage!==void 0&&(a.lapse_in_coverage=be(n.lapse_in_coverage)),n.year_built!==null&&n.year_built!==void 0&&(a.year_built=n.year_built),n.number_of_units!==null&&n.number_of_units!==void 0&&(a.number_of_units=n.number_of_units),n.number_of_stories!==null&&n.number_of_stories!==void 0&&(a.number_of_stories=n.number_of_stories),n.number_of_beds!==null&&n.number_of_beds!==void 0&&(a.number_of_beds=n.number_of_beds),n.number_of_full_baths!==null&&n.number_of_full_baths!==void 0&&(a.number_of_full_baths=n.number_of_full_baths),n.number_of_partial_baths!==null&&n.number_of_partial_baths!==void 0&&(a.number_of_partial_baths=n.number_of_partial_baths),n.under_construction!==null&&n.under_construction!==void 0&&(a.under_construction=be(n.under_construction)),n.distance_from_fire_hydrant_ft&&(a.distance_from_fire_hydrant_ft=n.distance_from_fire_hydrant_ft),n.distance_from_fire_station_miles&&(a.distance_from_fire_station_miles=n.distance_from_fire_station_miles),n.architectural_style&&(a.architectural_style=n.architectural_style),n.dwelling_type&&(a.dwelling_type=n.dwelling_type),n.construction_quality&&(a.construction_quality=n.construction_quality),n.located_over_water!==null&&n.located_over_water!==void 0&&(a.located_over_water=n.located_over_water),n.construction_type&&(a.construction_type=n.construction_type),n.exterior_wall_type&&(a.exterior_wall_type=n.exterior_wall_type),n.foundation_type&&(a.foundation_type=n.foundation_type),n.roof_material_type&&(a.roof_material_type=n.roof_material_type),n.roof_shape&&(a.roof_shape=n.roof_shape),n.roof_updated_type&&(a.roof_updated_type=n.roof_updated_type),n.year_roof_updated!==null&&n.year_roof_updated!==void 0&&(a.year_roof_updated=n.year_roof_updated),n.mit_credit_form!==null&&n.mit_credit_form!==void 0&&(a.mit_credit_form=be(n.mit_credit_form)),n.storm_shutters!==null&&n.storm_shutters!==void 0&&(a.storm_shutters=be(n.storm_shutters)),n.heating_type&&(a.heating_type=n.heating_type),n.oil_tank_location&&(a.oil_tank_location=n.oil_tank_location),n.heating_fuel_type&&(a.heating_fuel_type=n.heating_fuel_type),n.number_of_fireplaces!==null&&n.number_of_fireplaces!==void 0&&(a.number_of_fireplaces=n.number_of_fireplaces),n.basement_type&&(a.basement_type=n.basement_type),n.parking_type&&(a.parking_type=n.parking_type),n.number_of_parking_spaces!==null&&n.number_of_parking_spaces!==void 0&&(a.number_of_parking_spaces=n.number_of_parking_spaces),n.plumbing_type&&(a.plumbing_type=n.plumbing_type),n.pool_type&&(a.pool_type=n.pool_type),n.total_area_sq_ft!==null&&n.total_area_sq_ft!==void 0&&(a.total_area_sq_ft=n.total_area_sq_ft),n.parcel_area_sq_ft!==null&&n.parcel_area_sq_ft!==void 0&&(a.parcel_area_sq_ft=n.parcel_area_sq_ft),n.residence_type&&(a.residence_type=n.residence_type),n.usage_type&&(a.usage_type=n.usage_type),n.household_size!==null&&n.household_size!==void 0&&(a.household_size=n.household_size),n.number_of_mortgagees!==null&&n.number_of_mortgagees!==void 0&&(a.number_of_mortgagees=n.number_of_mortgagees),n.has_dog!==null&&n.has_dog!==void 0&&(a.has_dog=be(n.has_dog)),n.dog_breed_type&&(a.dog_breed_type=n.dog_breed_type),n.number_of_dogs!==null&&n.number_of_dogs!==void 0&&(a.number_of_dogs=n.number_of_dogs),n.has_vicious_animals!==null&&n.has_vicious_animals!==void 0&&(a.has_vicious_animals=be(n.has_vicious_animals)),n.has_business_on_premises!==null&&n.has_business_on_premises!==void 0&&(a.has_business_on_premises=be(n.has_business_on_premises)),n.business_class&&(a.business_class=n.business_class),n.occupancy_type&&(a.occupancy_type=n.occupancy_type),n.short_term_rental!==null&&n.short_term_rental!==void 0&&(a.short_term_rental=be(n.short_term_rental)),n.sale_price_cents!==null&&n.sale_price_cents!==void 0&&(a.sale_price_cents=Math.round(Number(n.sale_price_cents)/100)),n.number_of_families!==null&&n.number_of_families!==void 0&&(a.number_of_families=n.number_of_families),n.number_of_units_in_firewall!==null&&n.number_of_units_in_firewall!==void 0&&(a.number_of_units_in_firewall=n.number_of_units_in_firewall),n.heating_update_yn!==null&&n.heating_update_yn!==void 0&&(a.heating_update_yn=be(n.heating_update_yn)),n.heating_update_type&&(a.heating_update_type=n.heating_update_type),n.heating_update_year!==null&&n.heating_update_year!==void 0&&(a.heating_update_year=n.heating_update_year),n.plumbing_update_yn!==null&&n.plumbing_update_yn!==void 0&&(a.plumbing_update_yn=be(n.plumbing_update_yn)),n.plumbing_update_type&&(a.plumbing_update_type=n.plumbing_update_type),n.plumbing_update_year!==null&&n.plumbing_update_year!==void 0&&(a.plumbing_update_year=n.plumbing_update_year),n.electrical_update_yn!==null&&n.electrical_update_yn!==void 0&&(a.electrical_update_yn=be(n.electrical_update_yn)),n.electrical_update_type&&(a.electrical_update_type=n.electrical_update_type),n.electrical_update_year!==null&&n.electrical_update_year!==void 0&&(a.electrical_update_year=n.electrical_update_year),n.electric_circuit_breaker!==null&&n.electric_circuit_breaker!==void 0&&(a.electric_circuit_breaker=be(n.electric_circuit_breaker)),n.dwelling_replacement_cost!==null&&n.dwelling_replacement_cost!==void 0&&(a.dwelling_replacement_cost=n.dwelling_replacement_cost),n.other_structures_coverage!==null&&n.other_structures_coverage!==void 0&&(a.other_structures_coverage=n.other_structures_coverage),n.personal_property_coverage!==null&&n.personal_property_coverage!==void 0&&(a.personal_property_coverage=n.personal_property_coverage),n.loss_of_use_coverage!==null&&n.loss_of_use_coverage!==void 0&&(a.loss_of_use_coverage=n.loss_of_use_coverage),n.personal_liability&&(a.personal_liability=n.personal_liability),n.dwelling_medical_payments&&(a.dwelling_medical_payments=n.dwelling_medical_payments),n.all_perils_deductible&&(a.all_perils_deductible=n.all_perils_deductible),n.windstorm_deductible&&(a.windstorm_deductible=n.windstorm_deductible),n.has_garage!==null&&n.has_garage!==void 0&&(a.has_garage=be(n.has_garage)),n.has_pool!==null&&n.has_pool!==void 0&&(a.has_pool=be(n.has_pool)),n.has_trampoline!==null&&n.has_trampoline!==void 0&&(a.has_trampoline=be(n.has_trampoline)),n.gender&&(a.gender=n.gender),n.marital_status&&(a.marital_status=n.marital_status),n.employment_industry&&(a.employment_industry=n.employment_industry),n.occupation&&(a.occupation=n.occupation),n.has_co_applicant!==null&&n.has_co_applicant!==void 0&&(a.has_co_applicant=be(n.has_co_applicant)),n.co_applicant_first_name&&(a.co_applicant_first_name=n.co_applicant_first_name),n.co_applicant_middle_name&&(a.co_applicant_middle_name=n.co_applicant_middle_name),n.co_applicant_last_name&&(a.co_applicant_last_name=n.co_applicant_last_name),n.co_applicant_gender&&(a.co_applicant_gender=n.co_applicant_gender),n.co_applicant_marital_status&&(a.co_applicant_marital_status=n.co_applicant_marital_status),n.co_applicant_relationship&&(a.co_applicant_relationship=n.co_applicant_relationship),n.co_applicant_date_of_birth&&(a.co_applicant_date_of_birth=an(n.co_applicant_date_of_birth)),n.co_applicant_employment_industry&&(a.co_applicant_employment_industry=n.co_applicant_employment_industry),n.co_applicant_occupation&&(a.co_applicant_occupation=n.co_applicant_occupation),n.retiree_discount!==null&&n.retiree_discount!==void 0&&(a.retiree_discount=be(n.retiree_discount)),n.gated_community_discount!==null&&n.gated_community_discount!==void 0&&(a.gated_community_discount=be(n.gated_community_discount)),n.multi_policy_discount!==null&&n.multi_policy_discount!==void 0&&(a.multi_policy_discount=be(n.multi_policy_discount)),n.non_smoker_discount!==null&&n.non_smoker_discount!==void 0&&(a.non_smoker_discount=be(n.non_smoker_discount)),n.first_time_buyer_discount!==null&&n.first_time_buyer_discount!==void 0&&(a.first_time_buyer_discount=be(n.first_time_buyer_discount)),n.fire_detection_system!==null&&n.fire_detection_system!==void 0&&(a.fire_detection_system=be(n.fire_detection_system)),n.burglar_alarm_system!==null&&n.burglar_alarm_system!==void 0&&(a.burglar_alarm_system=be(n.burglar_alarm_system)),n.burglar_alarm_system_type&&(a.burglar_alarm_system_type=n.burglar_alarm_system_type),n.smoke_detectors!==null&&n.smoke_detectors!==void 0&&(a.smoke_detectors=be(n.smoke_detectors)),n.sprinkler_system!==null&&n.sprinkler_system!==void 0&&(a.sprinkler_system=be(n.sprinkler_system)),n.sprinkler_system_type&&(a.sprinkler_system_type=n.sprinkler_system_type),n.gas_leakage_detector!==null&&n.gas_leakage_detector!==void 0&&(a.gas_leakage_detector=be(n.gas_leakage_detector)),n.deadbolt_locks!==null&&n.deadbolt_locks!==void 0&&(a.deadbolt_locks=be(n.deadbolt_locks)),n.fire_extinguisher!==null&&n.fire_extinguisher!==void 0&&(a.fire_extinguisher=be(n.fire_extinguisher)),n.order_credit_authorized!==null&&n.order_credit_authorized!==void 0&&(a.order_credit_authorized=be(n.order_credit_authorized)),n.has_health_insurance_auto_accident!==null&&n.has_health_insurance_auto_accident!==void 0&&(a.has_health_insurance_auto_accident=be(n.has_health_insurance_auto_accident)),n.is_corporation!==null&&n.is_corporation!==void 0&&(a.is_corporation=be(n.is_corporation)),n.named_insured_foreclosure_repo_bankruptcy!==null&&n.named_insured_foreclosure_repo_bankruptcy!==void 0&&(a.named_insured_foreclosure_repo_bankruptcy=be(n.named_insured_foreclosure_repo_bankruptcy)),n.named_insured_convicted_insurance_fraud!==null&&n.named_insured_convicted_insurance_fraud!==void 0&&(a.named_insured_convicted_insurance_fraud=be(n.named_insured_convicted_insurance_fraud));const f={};if(n.vehicles)for(const d of n.vehicles)d.quote_vehicle_id&&d.vin&&(f[d.quote_vehicle_id]=d.vin);return n.drivers&&n.drivers.length>0?(a.drivers="Yes",a.drivers__items=n.drivers.map(d=>{const m=d,_={};m.first_name&&(_.first_name=m.first_name),m.middle_name&&(_.middle_name=m.middle_name),m.last_name&&(_.last_name=m.last_name),m.date_of_birth&&(_.date_of_birth=an(m.date_of_birth)),m.gender&&(_.gender=m.gender),m.marital_status&&(_.marital_status=m.marital_status),m.relationship_to_insured&&(_.relationship_to_insured=m.relationship_to_insured),m.is_registered_owner!==null&&m.is_registered_owner!==void 0&&(_.is_registered_owner=m.is_registered_owner?"Yes":"No"),m.license_state&&(_.license_state=m.license_state),m.license_status&&(_.license_status=m.license_status),m.license_number&&(_.license_number=m.license_number),m.date_first_licensed&&(_.date_first_licensed=an(m.date_first_licensed)),m.education_level&&(_.education_level=Dv(m.education_level)),m.occupation&&(_.occupation=Rv(m.occupation)),m.industry&&(_.industry=Fl(m.industry)),m.employment_status&&(_.employment_status=m.employment_status),m.last_5_years_license_suspended_or_revoked!==null&&m.last_5_years_license_suspended_or_revoked!==void 0&&(_.last_5_years_license_suspended_or_revoked=be(m.last_5_years_license_suspended_or_revoked)),m.accident_prevention_course!==null&&m.accident_prevention_course!==void 0&&(_.accident_prevention_course=be(m.accident_prevention_course)),m.accident_prevention_course_date&&(_.accident_prevention_course_date=an(m.accident_prevention_course_date)),m.sr22!==null&&m.sr22!==void 0&&(_.sr22=be(m.sr22));const h=m.ssn_display;typeof h=="string"&&(_.ssn_display=h);const v=m.driver_violations;v&&v.length>0&&(_.driver_violations="Yes",_.driver_violations__items=v.map(w=>{const D={};return w.code&&(D.code=w.code),w.occurred_at&&(D.occurred_at=an(w.occurred_at)),D}));const b=m.driver_accidents;b&&b.length>0&&(_.driver_accidents="Yes",_.driver_accidents__items=b.map(w=>{const D={};return w.occurred_at&&(D.occurred_at=an(w.occurred_at)),w.description&&(D.description=w.description),w.quote_vehicle_id&&(D.quote_vehicle_id=f[w.quote_vehicle_id]??w.quote_vehicle_id),w.property_damage_amount_paid_cents!==null&&w.property_damage_amount_paid_cents!==void 0&&(D.property_damage_amount_paid_cents=w.property_damage_amount_paid_cents),w.personal_injury_amount_paid_cents!==null&&w.personal_injury_amount_paid_cents!==void 0&&(D.personal_injury_amount_paid_cents=w.personal_injury_amount_paid_cents),D}));const N=m.losses;return N&&N.length>0&&(_.losses="Yes",_.losses__items=N.map(w=>{const D={};return w.description&&(D.description=w.description),w.date_of_incident&&(D.date_of_incident=an(w.date_of_incident)),w.amount_paid_cents!==null&&w.amount_paid_cents!==void 0&&(D.amount_paid_cents=w.amount_paid_cents),w.quote_vehicle_id&&(D.quote_vehicle_id=f[w.quote_vehicle_id]??w.quote_vehicle_id),D})),_})):a.drivers="No",n.vehicles&&n.vehicles.length>0?(a.vehicles="Yes",a.vehicles__items=n.vehicles.map(d=>{const m=d,_={};m.vin&&(_.vin=m.vin),m.year!==null&&m.year!==void 0&&(_.year=String(m.year)),m.make&&(_.make=m.make),m.model&&(_.model=m.model),m.body_style&&(_.body_style=m.body_style),m.ownership_type&&(_.ownership_type=m.ownership_type),m.usage&&(_.usage=m.usage),m.annual_mileage!==null&&m.annual_mileage!==void 0&&(_.annual_mileage=m.annual_mileage),m.miles_to_work!==null&&m.miles_to_work!==void 0&&(_.miles_to_work=m.miles_to_work),m.percent_to_work!==null&&m.percent_to_work!==void 0&&(_.percent_to_work=m.percent_to_work);const h=[];return m.garaging_address_line_1&&h.push(m.garaging_address_line_1),m.garaging_address_line_2&&h.push(m.garaging_address_line_2),m.garaging_address_city&&h.push(m.garaging_address_city),m.garaging_address_state&&h.push(m.garaging_address_state),m.garaging_address_postal_code&&h.push(m.garaging_address_postal_code),h.length>0&&(_.garaging_address=h.join(", ")),m.new_when_purchased!==null&&m.new_when_purchased!==void 0&&(_.new_when_purchased=be(m.new_when_purchased)),m.purchase_date&&(_.purchase_date=an(m.purchase_date)),m.anti_theft_type&&(_.anti_theft_type=m.anti_theft_type),m.passive_restraint_type&&(_.passive_restraint_type=m.passive_restraint_type),m.anti_lock_brakes!==null&&m.anti_lock_brakes!==void 0&&(_.anti_lock_brakes=be(m.anti_lock_brakes)),m.daytime_running_lights!==null&&m.daytime_running_lights!==void 0&&(_.daytime_running_lights=be(m.daytime_running_lights)),m.custom_equipment_value_cents!==null&&m.custom_equipment_value_cents!==void 0&&(_.custom_equipment_value_cents=m.custom_equipment_value_cents),m.cost_new_value_cents!==null&&m.cost_new_value_cents!==void 0&&(_.cost_new_value_cents=m.cost_new_value_cents),m.stated_value_amount_cents!==null&&m.stated_value_amount_cents!==void 0&&(_.stated_value_amount_cents=m.stated_value_amount_cents),m.vehicle_has_modifications!==null&&m.vehicle_has_modifications!==void 0&&(_.vehicle_has_modifications=be(m.vehicle_has_modifications)),m.vehicle_garaged_at_residence!==null&&m.vehicle_garaged_at_residence!==void 0&&(_.vehicle_garaged_at_residence=be(m.vehicle_garaged_at_residence)),m.vehicle_comp_deductible&&(_.vehicle_comp_deductible=m.vehicle_comp_deductible),m.vehicle_coll_deductible&&(_.vehicle_coll_deductible=m.vehicle_coll_deductible),m.vehicle_towing_and_labor&&(_.vehicle_towing_and_labor=m.vehicle_towing_and_labor),m.vehicle_transportation_expense&&(_.vehicle_transportation_expense=m.vehicle_transportation_expense),m.vehicle_full_glass!==null&&m.vehicle_full_glass!==void 0&&(_.vehicle_full_glass=be(m.vehicle_full_glass)),m.vehicle_loan_lease!==null&&m.vehicle_loan_lease!==void 0&&(_.vehicle_loan_lease=be(m.vehicle_loan_lease)),m.coverages&&m.coverages.length>0&&(_.coverages__items=m.coverages.map(v=>{const b={};return v.type&&(b.type=v.type),v.per_person_limit_cents!==null&&v.per_person_limit_cents!==void 0&&(b.per_person_limit_cents=v.per_person_limit_cents),v.per_incident_limit_cents!==null&&v.per_incident_limit_cents!==void 0&&(b.per_incident_limit_cents=v.per_incident_limit_cents),v.per_incident_limit_percent!==null&&v.per_incident_limit_percent!==void 0&&(b.per_incident_limit_percent=v.per_incident_limit_percent),v.per_day_limit_cents!==null&&v.per_day_limit_cents!==void 0&&(b.per_day_limit_cents=v.per_day_limit_cents),v.deductible_cents!==null&&v.deductible_cents!==void 0&&(b.deductible_cents=v.deductible_cents),v.is_declined!==null&&v.is_declined!==void 0&&(b.is_declined=be(v.is_declined)),b})),m.vehicle_lienholders&&m.vehicle_lienholders.length>0&&(_.vehicle_lienholders__items=m.vehicle_lienholders.map(v=>{const b={};return v.name&&(b.name=v.name),v.type&&(b.type=v.type),v.line_1&&(b.line_1=v.line_1),v.line_2&&(b.line_2=v.line_2),v.city&&(b.city=v.city),v.state&&(b.state=v.state),v.postal_code&&(b.postal_code=v.postal_code),v.phone&&(b.phone=v.phone),v.fax&&(b.fax=v.fax),b})),_})):a.vehicles="No",n.losses&&n.losses.length>0?(a.home_losses="Yes",a.home_losses__items=n.losses.map(d=>{const m={};return d.description&&(m.description=d.description),d.date_of_incident&&(m.date_of_incident=an(d.date_of_incident)),d.amount_paid_cents!==null&&d.amount_paid_cents!==void 0&&(m.amount_paid_cents=Math.round(Number(d.amount_paid_cents)/100)),m})):a.home_losses="No",a}const s0=new Set(["Zip","Product","Driver","Vehicle"]);function P2(t){return t?Array.isArray(t.drivers__items)?t.drivers__items.length:Array.isArray(t.drivers)?t.drivers.length:null:null}function l0(t,n){const a=P2(n),o=t.filter(f=>f.key!=="AutoPolicy"),l=o.length>0?o:t;return l}function Dl(t){const n={},a=h=>{if(typeof h=="string"){if(h==="Yes")return!0;if(h==="No")return!1}return h},o=Object.keys(t).filter(h=>!h.includes("__items")),l=new Set,f=new Set;for(const[h,v]of Object.entries(t))if(h.endsWith("__items")&&Array.isArray(v)){const b=h.replace("__items","");f.add(b),o.includes(b)&&v.forEach(N=>{typeof N=="object"&&N!==null&&Object.keys(N).forEach(w=>{l.add(w)})})}for(const[h,v]of Object.entries(t))if(h.endsWith("__items")){const b=h.replace("__items","");if(o.includes(b)){const w=Array.isArray(v)?v.map(D=>Dl(D)):v;n[b]=w}}else if(!h.includes("__items")){if(f.has(h))continue;l.has(h)||(n[h]=a(v))}const d=n.auto_prior_carrier_name;if(typeof d=="string"&&d.trim()!==""){const h=d==="NoPriorInsurance";n.auto_has_prior_insurance=!h,h&&(delete n.auto_prior_years,delete n.auto_prior_months,delete n.auto_prior_expiration_date,delete n.auto_prior_liability_limit,delete n.auto_continuous_coverage_years,delete n.auto_cancelled_declined_refused_to_renew,delete n.auto_current_annual_premium_cents)}const m=n.home_prior_carrier_name;if(typeof m=="string"&&m.trim()!==""){const h=m==="NoPriorInsurance";n.home_has_prior_insurance=!h,h&&(delete n.home_prior_years,delete n.home_continuous_coverage_years,delete n.home_prior_expiration_date,delete n.property_insurance_cancelled)}Array.isArray(n.drivers)&&(n.drivers=n.drivers.map(h=>{if(!h||typeof h!="object")return h;const v={...h};return v.industry=Fl(v.industry),v.education_level=Dv(v.education_level),v.occupation=Rv(v.occupation),v}));const _=21474836;if("sale_price_cents"in n){const h=n.sale_price_cents;if(typeof h=="number"&&Number.isFinite(h)){const v=Math.trunc(h);if(v>=1){const b=Math.min(v,_);n.sale_price_cents=b*100}}}return Array.isArray(n.home_losses)&&(n.home_losses=n.home_losses.map(h=>{if(!h||typeof h!="object")return h;const v=h,b=v.amount_paid_cents;if(typeof b!="number"||!Number.isFinite(b))return v;const N=Math.trunc(b),w=Math.min(Math.max(N,0),_);return{...v,amount_paid_cents:w*100}})),n}function q2(t,n){const a=t.findIndex(l=>l.key===n);return a<0?n:t[a+1]?.key??n}function eb(t){return t.some(n=>String(n.key)==="BundlePolicy"||String(n.key)==="BundleCustomer")}function c0(t){return eb(t)?"Bundle":t.some(n=>String(n.key)==="Vehicle"||String(n.key)==="Driver")?"Auto":"Home"}const V2={Auto:45e3,Home:5e4,Bundle:1e5};function K2(t,n){if(t!=="AutoCurrentCarrier")return n;const a=n.some(f=>String(f.key)==="auto_cancelled_declined_refused_to_renew"),o=n.some(f=>String(f.key)==="vehicle_policy_selections"),l=[...n];return a||l.push({question:"Has any auto insurance company cancelled, declined or refused to renew you in the last 5 years?",inputType:"radio",options:["Yes","No"],key:"auto_cancelled_declined_refused_to_renew",required:!0}),o||l.push({question:"Vehicle coverage selections",inputType:"custom",key:"vehicle_policy_selections",required:!1}),l}function Q2(t,n){if(t!=="Vehicle")return n;const a=o=>o.map(l=>{const f=l.conditionals?.map(d=>{const m=d.conditionalQuestions??[];return m.length?{...d,conditionalQuestions:a(m)}:d});return String(l.key)!=="vin"?f?{...l,conditionals:f}:l:{...l,required:!1,...f?{conditionals:f}:{}}});return a(n)}function X2({isOpen:t,onClose:n}){const[a,o]=B.useState([]),[l,f]=B.useState(null),d=B.useRef(null);B.useEffect(()=>{d.current=l},[l]);const[m,_]=B.useState(null),[h,v]=B.useState(!1),[b,N]=B.useState(!1),[w,D]=B.useState([]),k=B.useRef(null),[ue,ne]=B.useState(null),[se,W]=B.useState(void 0),[oe,F]=B.useState(!1),[ie,te]=B.useState(null),[ae,ve]=B.useState(null),[Ee,Te]=B.useState(!1),[Le,it]=B.useState(!1),Ge=B.useRef(!1);B.useEffect(()=>{if(!h||b)return;const G=c0(a);let E=!1;const C=[];let A=0,S=0;const R=66,I=3,Y=5e3;let K=!1;const Q=async()=>{if(E)return;A++;try{const{quote:V}=await jy();if(E)return;if(S=0,!K){const ee=V?.appetites??null,de=f2(ee,G);de.length>0&&(D(de),K=!0)}const X=V?.rates_status??null;if(X==="completed"){const{rates:ee}=await If();if(E)return;k.current=ee,N(!0);return}if(X==="no_rates"){k.current=[],N(!0);return}if(X==="failed"){Ai(new Error("Quote failed: rate-generation worker reported rates_status=failed"),{quoteId:d.current??void 0,phase:"rates_status_failed"}),zo({reason:"submission"}),te({message:"submission_failed"}),v(!1);return}}catch(V){if(S++,console.warn("Provider polling: getQuote failed",{attempt:A,consecutiveFailures:S,error:V}),S>=I){V?.__sentryReported||Ai(V,{quoteId:d.current??void 0,phase:"rates_polling",message:`Quote failed: ${I} consecutive get-quote poll failures`}),zo({reason:"network"}),te({message:"submission_failed"}),v(!1);return}}if(E)return;if(A>=R){Ai(new Error(`Quote failed: rate-generation timed out after ${R} polls`),{quoteId:d.current??void 0,phase:"rates_polling_timeout"}),zo({reason:"timeout"}),te({message:"submission_failed"}),v(!1);return}const re=window.setTimeout(Q,Y);C.push(re)};return Q(),()=>{E=!0,C.forEach(re=>window.clearTimeout(re))}},[h,b,a]);function he(G){const E={Zip:"ZIP Code",Email:"Email",Product:"Product & Address",Home:"Home Details",Vehicle:"Vehicle",Name:"Name & DOB",Driver:"Operator",AutoCurrentCarrier:"Policy",HomeCurrentCarrier:"Policy",HomePolicy:"Policy",BundlePolicy:"Policy",Demographics:"Applicant",Ssn:"SSN",Phone:"Phone",SMSVerification:"Verify",AutoPolicy:"Policy",Customer:"Applicant",HomeCustomer:"Applicant",BundleCustomer:"Applicant",HomeConstruction:"Structure",HomeFeatures:"Features"};return G.map(A=>({key:A,title:E[A]||A,loadQuestions:async()=>{const S=await AR(A,d.current??void 0);let R=K2(A,S.questions);return R=Q2(A,R),R}}))}B.useEffect(()=>{const G=async()=>{try{const E=F2();if(E)try{const{token:A,quoteId:S}=await OR(E);A&&S&&(Bf(A),Cy(S))}catch(A){A.statusCode===401&&it(!0)}const C=ac();if(vd(),C){F(!0),f(C);try{const A=Ti(),S=await jy(A?void 0:C);if(!S||!S.quote)throw new Error("Invalid response from getQuote: missing quote data");const{quote:R}=S,{stages:I}=await El(C),Y=he(I);o(Y);let K;try{K=Z2(R),ne(K)}catch(V){throw new Error(`Failed to transform quote data: ${V instanceof Error?V.message:"Unknown error"}`)}const Q=l0(Y,K);o(Q);const re=R?.rates_status??null;if(Ti()){if(re==="completed")try{const{rates:V}=await If();_(V);return}catch(V){console.warn("Failed to fetch completed rates on resume",V)}else if(re==="no_rates"){_([]);return}else if(re==="processing"){D([]),N(!1),k.current=null,v(!0);return}}if(R.current_stage){const V=R.current_stage==="State"?"Product":R.current_stage,X=Q.findIndex(ee=>ee.key===V);X>=0?W(X):W(Q.length-1)}else W(Q.length-1)}catch(A){const S=A;if(S.statusCode===404)Lv(),f(null);else if(S.statusCode===401){Iv();try{const{stages:R}=await El(C),I=he(R);o(I);const Y=I.findIndex(K=>K.key==="SMSVerification");Y>=0&&W(Y)}catch{}}}finally{F(!1)}}else{const{stages:A}=await El();o(he(A))}}catch{F(!1)}};t&&!Ge.current&&(Ge.current=!0,G())},[t]),B.useEffect(()=>{if(!t)return;const{overflow:G}=document.body.style;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=G}},[t]);const x=B.useCallback(G=>{G.key==="Escape"&&(qy(),n())},[n]);B.useEffect(()=>{if(t)return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[t,x]),B.useEffect(()=>{t||(ne(null),W(void 0),F(!1),v(!1),ve(null),Te(!1))},[t]),B.useEffect(()=>{t&&WR()},[t]),B.useEffect(()=>{m&&Array.isArray(m)&&t2({rateCount:m.length})},[m]);const U=B.useCallback(()=>{te(null),W(Math.max(0,a.length-1))},[a.length]),J=B.useCallback(async G=>{if(!(!ae||!l||Ee)){Te(!0);try{const C={...Dl(ae.allValues),communications_consent:G};D([]),N(!1),k.current=null,v(!0),ve(null);let A;try{A=await Si(C,!0)}catch(I){throw v(!1),I}if(A.status==="submission_failed"){Ai(new Error(`Quote failed at submission: ${A.message}`),{quoteId:l??void 0,phase:"consent_submit"}),v(!1),N(!1),k.current=null,zo({reason:"submission"}),te({message:A.message});return}if(A.status==="success")try{const{rates:I}=await If();k.current=I,N(!0)}catch(I){throw v(!1),I}const S=a.length,R=a[S-1];Vy({stageKey:R?.key??"unknown",stageTitle:R?.title??"unknown",stepIndex:S,totalSteps:S}),e2()}catch(E){E?.__sentryReported||Ai(E,{quoteId:l??void 0,phase:"consent_submit"}),v(!1),zo({reason:"submission"}),te({message:"Oops, something went wrong. Please try again later."})}finally{Te(!1)}}},[ae,l,Ee,a]);if(!t)return null;const _e=()=>{qy(),n()};return g.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true","aria-labelledby":"insurance-modal-title",children:[g.jsx("div",{className:"backdrop","aria-hidden":"true"}),g.jsxs("div",{className:"modal-panel bg-white relative w-full max-w-2xl flex flex-col max-h-[90vh] overflow-hidden",role:"document",children:[g.jsx("button",{onClick:_e,className:"modal-close-btn absolute top-4 right-4 text-slate-400 hover:text-slate-600 text-xl","aria-label":"Close",type:"button",children:"×"}),!h&&!ie&&g.jsx("div",{className:"text-center mb-6",children:g.jsx("h2",{id:"insurance-modal-title",className:"h1-title",children:"Let's shop multiple leading carriers for you."})}),g.jsxs("div",{className:"panel-body flex-1 min-h-0 overflow-y-auto",children:[Le&&g.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-800",role:"alert",children:[g.jsx("span",{children:"This resume link has expired or is no longer valid. For your security, emailed links only work for a limited time — you can continue your quote below."}),g.jsx("button",{type:"button",onClick:()=>it(!1),className:"shrink-0 font-bold text-amber-800 hover:text-amber-900","aria-label":"Dismiss",children:"×"})]}),ie&&g.jsx(Qv,{onGoBack:U}),!ie&&h&&(()=>{const G=c0(a);return g.jsx(b2,{providers:w,totalTime:V2[G],flow:G,isComplete:b,onComplete:()=>{v(!1),N(!1),D([]),k.current&&(_(k.current),k.current=null)}})})(),!ie&&!h&&ae&&g.jsx(rO,{onChoose:J,isSubmitting:Ee}),!ie&&!m&&!h&&!ae&&g.jsx(g.Fragment,{children:oe||a.length===0?g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"text-slate-600",children:"Loading..."})}):g.jsx(l2,{stages:a,initialValues:ue??void 0,initialActive:se,quoteId:l??void 0,nonTerminalStageKeys:s0,onStageComplete:async(G,E)=>{try{const C=Dl(G);let A=l,S=a;const R=S.findIndex(K=>K.key===E),I=S[R],Y=q2(S,E);if(A)if(E==="Phone"){const K=C.phone;if(!K)throw new Error("Phone number is required.");const Q=Ti();await Si({...C,current_stage:Y},!1,Q?void 0:A),await CR(A,K)}else if(E==="SMSVerification"){const{isVerified:K,token:Q}=await zy(A,C.sms_code);if(!K)throw new Error("Invalid SMS code");Q&&Bf(Q),await Si({current_stage:Y},!1)}else if(E==="Product"){const K=Ti(),{isSupported:Q}=await NR(C.state,K?void 0:A??void 0);if(!Q)throw new Error("State is not supported");await Si({...C,current_stage:Y},!1,K?void 0:A)}else{const K=Ti();await Si({...C,current_stage:Y},!1,K?void 0:A||void 0)}else{const K=C.postal_code??"";if(!K)throw new Error("ZIP code is required to start a quote.");const re=(await TR(K,Y2()))?.quoteId;if(!re||typeof re!="string"||re.trim()==="")throw new Error(`Failed to create quote - invalid quoteId returned: ${re}`);A=re,f(re),Cy(re),await Si({...C,current_stage:Y},!1,re)}if(s0.has(E))try{const{stages:K}=await El(A||void 0);S=he(K),S=l0(S,G),o(S)}catch(K){console.warn("Unable to refresh stages after flow-shaping step",K)}return Vy({stageKey:E,stageTitle:I?.title??E,stepIndex:R+1,totalSteps:S.length}),{success:!0,latestStages:S}}catch(C){return{success:!1,error:C instanceof Error?C.message:"An error occurred"}}},onComplete:async(G,E)=>{if(!l)return{success:!1,error:"Oops, something went wrong. Please try again later."};ne(G);try{if(E==="SMSVerification"){const C=Dl(G),{isVerified:A,token:S}=await zy(l,C.sms_code);return A?(S&&Bf(S),ve({allValues:G}),{success:!0}):{success:!1,error:"Invalid SMS code"}}return ve({allValues:G}),{success:!0}}catch{const A="Oops, something went wrong. Please try again later.";return te({message:A}),{success:!1,error:A}}}})})," ",!ie&&m&&l&&g.jsx(y2,{rates:m,onBack:()=>_(null),isBundleFlow:eb(a)})]}),g.jsxs("div",{className:"mt-4 pt-4 border-t border-slate-200 space-y-2",children:[g.jsx($2,{}),g.jsx("p",{className:"text-center text-sm text-slate-500",children:"Insurance products offered through Credify Corporation, a licensed insurance agency."})]})]})]})}function W2({onClose:t}){return g.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",role:"dialog","aria-modal":"true",children:[g.jsx("div",{className:"backdrop","aria-hidden":"true"}),g.jsx("div",{className:"modal-panel bg-white relative w-full max-w-2xl p-6",children:g.jsx(Qv,{onGoBack:t})})]})}var Zf={};function J2(){try{return typeof Zf<"u"&&Zf?Zf:{}}catch{return{}}}let u0=!1;function eL(t,n){if(!t)return n;const a=Number(t);return Number.isFinite(a)&&a>=0&&a<=1?a:n}function tL(t={}){if(u0)return!0;if(typeof window>"u")return!1;const n=J2(),a=t.dsn??n.dsn;return!a||t.enabled===!1?!1:(dR({baseUrl:Zt}),$C({dsn:a,environment:t.environment??n.environment??"production",release:t.release??n.release,sendDefaultPii:!1,maxBreadcrumbs:50,tracesSampleRate:t.tracesSampleRate??eL(n.tracesSampleRate,.1),tracePropagationTargets:[Zt],replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSend:o=>xy(o),beforeBreadcrumb:o=>o&&(xy({breadcrumbs:[o]}),o)}),u0=!0,UC("replayIntegration").then(o=>{try{y1(o({maskAllText:!0,maskAllInputs:!0,blockAllMedia:!0,networkDetailAllowUrls:[Zt],networkCaptureBodies:!1}))}catch{}}).catch(()=>{}),!0)}function nL(){const[t,n]=B.useState(!1);B.useEffect(()=>{tL(),k2()},[]);const a=B.useCallback(l=>{window.parent&&window.parent!==window&&window.parent.postMessage({type:l,source:"credify-insurance-widget"},"*")},[]);B.useEffect(()=>{const l=(d,m,_)=>{window.parent&&window.parent!==window&&window.parent.postMessage({type:"event",source:"credify-insurance-widget",event:d,data:m,meta:_},"*")},f=QR.map(d=>{const m=(_,h)=>l(d,_,h);return Uv(d,m),[d,m]});return()=>{for(const[d,m]of f)Hv(d,m)}},[]),B.useEffect(()=>{const l=f=>{if(f.data?.source==="credify-insurance-widget")switch(f.data.type){case"open":n(!0),a("opened");break;case"close":n(!1),a("closed");break;case"init":a("ready");break;case"support-open":Jv();break}};return window.addEventListener("message",l),a("ready"),()=>{window.removeEventListener("message",l)}},[a]);const o=B.useCallback(()=>{n(!1),a("closed")},[a]);return g.jsx(Hd,{fallback:g.jsx(W2,{onClose:o}),children:g.jsx(X2,{isOpen:t,onClose:o})})}const rL="modulepreload",aL=function(t){return"/iframe/"+t},f0={},iL=function(n,a,o){let l=Promise.resolve();if(a&&a.length>0){let h=function(v){return Promise.all(v.map(b=>Promise.resolve(b).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};var d=h;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),_=m?.nonce||m?.getAttribute("nonce");l=h(a.map(v=>{if(v=aL(v),v in f0)return;f0[v]=!0;const b=v.endsWith(".css"),N=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${N}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":rL,b||(w.as="script"),w.crossOrigin="",w.href=v,_&&w.setAttribute("nonce",_),document.head.appendChild(w),b)return new Promise((D,k)=>{w.addEventListener("load",D),w.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${v}`)))})}))}function f(m){const _=new Event("vite:preloadError",{cancelable:!0});if(_.payload=m,window.dispatchEvent(_),!_.defaultPrevented)throw m}return l.then(m=>{for(const _ of m||[])_.status==="rejected"&&f(_.reason);return n().catch(f)})};var Pf={};const oL="mock";function sL(){try{return typeof Pf<"u"&&Pf&&Pf.key||void 0}catch{return}}function lL(){const t=sL();if(!t||typeof window>"u"||!window.location)return!1;try{return new URLSearchParams(window.location.search).get(oL)===t}catch{return!1}}const cL=new Set(["/create-quote","/get-stages-for-quote","/get-questions-by-stage","/update-quote","/verify-quote","/is-supported-state","/get-rates","/get-quote","/get-vehicle-options","/request-bind"]);let d0=!1;function uL(t){try{if(typeof t=="string")return new URL(t,window.location.href).pathname;if(t instanceof URL)return t.pathname;if(t instanceof Request)return new URL(t.url,window.location.href).pathname}catch{return null}return null}async function fL(t,n){try{if(n?.body&&typeof n.body=="string")return JSON.parse(n.body);if(t instanceof Request){const a=await t.clone().text();return a?JSON.parse(a):{}}}catch{return{}}return{}}function m0(t,n=200){return new Response(JSON.stringify(t),{status:n,headers:{"Content-Type":"application/json"}})}function dL(){try{if(typeof document>"u"||document.getElementById("credify-mock-badge"))return;const t=()=>{const n=document.createElement("div");n.id="credify-mock-badge",n.textContent="MOCK MODE",n.setAttribute("aria-hidden","true"),n.style.cssText=["position:fixed","bottom:12px","left:12px","z-index:2147483647","background:#b91c1c","color:#fff","font:600 11px/1 system-ui,sans-serif","letter-spacing:0.08em","padding:6px 10px","border-radius:9999px","box-shadow:0 1px 4px rgba(0,0,0,0.3)","pointer-events:none","user-select:none"].join(";"),document.body.appendChild(n)};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}catch{}}function mL(){if(d0||typeof window>"u"||typeof window.fetch!="function"||!lL())return;d0=!0;const t=window.fetch.bind(window),n=iL(()=>import("./backend-V-MdQp2e.js"),[]);window.fetch=async(a,o)=>{const l=uL(a);if(!l||!cL.has(l))return t(a,o);const f=await fL(a,o),{handleMockRequest:d}=await n;await new Promise(m=>window.setTimeout(m,120));try{return m0(d(l,f))}catch(m){return m0({error:m instanceof Error?m.message:"Mock handler error"},404)}},dL(),typeof console<"u"&&console.info("[Credify] Mock mode active — all API calls are served from in-memory fixtures.")}mL();SE.createRoot(document.getElementById("root")).render(g.jsx(B.StrictMode,{children:g.jsx(nL,{})}));
|
|
146
|
+
//# sourceMappingURL=iframe-ptnr6BX-.js.map
|