@insure-os/client 0.0.65 → 0.0.66
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/bundle-sizes.json +11 -11
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).InsureOSScripts={})}(this,function(e){"use strict";const t=()=>{globalThis.insureOSDebug};var n,r,i,o,s,a,l,c,u,d,h,m,f,p,g,y,v={},w=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,x=Array.isArray;function k(e,t){for(var n in t)e[n]=t[n];return e}function N(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function S(e,t,r){var i,o,s,a={};for(s in t)"key"==s?i=t[s]:"ref"==s?o=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?n.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return _(e,a,i,o,null)}function _(e,t,n,o,s){var a={type:e,props:t,key:n,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:null==s?++i:s,_:-1,C:0};return null==s&&null!=r.vnode&&r.vnode(a),a}function $(e){return e.children}function C(e,t){this.props=e,this.context=t}function I(e,t){if(null==t)return e.m?I(e.m,e._+1):null;for(var n;t<e.i.length;t++)if(null!=(n=e.i[t])&&null!=n.v)return n.v;return"function"==typeof e.type?I(e):null}function T(e){if(e.I&&e.P){var t=e.N,n=t.v,i=[],o=[],s=k({},t);s.N=t.N+1,r.vnode&&r.vnode(s),L(e.I,s,t,e.R,e.I.namespaceURI,32&t.C?[n]:null,i,null==n?I(t):n,!!(32&t.C),o),s.N=t.N,s.m.i[s._]=s,F(i,s,o),t.v=t.m=null,s.v!=n&&E(s)}}function E(e){if(null!=(e=e.m)&&null!=e.k)return e.v=e.k.base=null,e.i.some(function(t){if(null!=t&&null!=t.v)return e.v=e.k.base=t.v}),E(e)}function P(e){(!e.P&&(e.P=!0)&&o.push(e)&&!D.O++||s!=r.debounceRendering)&&((s=r.debounceRendering)||a)(D)}function D(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(l),e=o.shift(),t=o.length,T(e)}finally{o.length=D.O=0}}function z(e,t,n,r,i,o,s,a,l,c,u){var d,h,m,f,p,g,y,b=r&&r.i||w,x=t.length;for(l=R(n,t,b,l,x),d=0;d<x;d++)null!=(m=n.i[d])&&(h=-1!=m._&&b[m._]||v,m._=d,g=L(e,m,h,i,o,s,a,l,c,u),f=m.v,m.ref&&h.ref!=m.ref&&(h.ref&&U(h.ref,null,m),u.push(m.ref,m.k||f,m)),null==p&&null!=f&&(p=f),(y=!!(4&m.C))||h.i===m.i?(l=M(m,l,e,y),y&&h.v&&(h.v=null)):"function"==typeof m.type&&void 0!==g?l=g:f&&(l=f.nextSibling),m.C&=-7);return n.v=p,l}function R(e,t,n,r,i){var o,s,a,l,c,u=n.length,d=u,h=0;for(e.i=new Array(i),o=0;o<i;o++)null!=(s=t[o])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.i[o]=_(null,s,null,null,null):x(s)?s=e.i[o]=_($,{children:s},null,null,null):void 0===s.constructor&&s.p>0?s=e.i[o]=_(s.type,s.props,s.key,s.ref?s.ref:null,s.N):e.i[o]=s,l=o+h,s.m=e,s.p=e.p+1,a=null,-1!=(c=s._=O(s,n,l,d))&&(d--,(a=n[c])&&(a.C|=2)),null==a||null==a.N?(-1==c&&(i>u?h--:i<u&&h++),"function"!=typeof s.type&&(s.C|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,s.C|=4))):e.i[o]=null;if(d)for(o=0;o<u;o++)null!=(a=n[o])&&!(2&a.C)&&(a.v==r&&(r=I(a)),Y(a,a));return r}function M(e,t,n,r){var i,o;if("function"==typeof e.type){for(i=e.i,o=0;i&&o<i.length;o++)i[o]&&(i[o].m=e,t=M(i[o],t,n,r));return t}e.v!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=I(e)),n.insertBefore(e.v,t||null)),t=e.v);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function O(e,t,n,r){var i,o,s,a=e.key,l=e.type,c=t[n],u=null!=c&&!(2&c.C);if(null===c&&null==a||u&&a==c.key&&l==c.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(c=t[s=i>=0?i--:o++])&&!(2&c.C)&&a==c.key&&l==c.type)return s;return-1}function j(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function W(e,t,n,r,i){var o,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||j(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||j(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(h,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[d]=r[d]:(n[d]=m,e.addEventListener(t,o?p:f,o)):e.removeEventListener(t,o?p:f,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function A(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[u])t[u]=m++;else if(t[u]<n[d])return;return n(r.event?r.event(t):t)}}}function L(e,t,n,i,o,s,a,l,c,u){var d,h,m,f,p,g,y,v,b,S,_,I,T,E,P,D=t.type;if(void 0!==t.constructor)return null;128&n.C&&(c=!!(32&n.C),s=[l=t.v=n.v]),(d=r.p)&&d(t);e:if("function"==typeof D)try{if(v=t.props,b=D.prototype&&D.prototype.render,S=(d=D.contextType)&&i[d.k],_=d?S?S.props.value:d.m:i,n.k?y=(h=t.k=n.k).m=h.j:(b?t.k=h=new D(v,_):(t.k=h=new C(v,_),h.constructor=D,h.render=Z),S&&S.sub(h),h.state||(h.state={}),h.R=i,m=h.P=!0,h.W=[],h.A=[]),b&&null==h.L&&(h.L=h.state),b&&null!=D.getDerivedStateFromProps&&(h.L==h.state&&(h.L=k({},h.L)),k(h.L,D.getDerivedStateFromProps(v,h.L))),f=h.props,p=h.state,h.N=t,m)b&&null==D.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),b&&null!=h.componentDidMount&&h.W.push(h.componentDidMount);else{if(b&&null==D.getDerivedStateFromProps&&v!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(v,_),t.N==n.N||!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(v,h.L,_)){t.N!=n.N&&(h.props=v,h.state=h.L,h.P=!1),t.v=n.v,t.i=n.i,t.i.some(function(e){e&&(e.m=t)}),w.push.apply(h.W,h.A),h.A=[],h.W.length&&a.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(v,h.L,_),b&&null!=h.componentDidUpdate&&h.W.push(function(){h.componentDidUpdate(f,p,g)})}if(h.context=_,h.props=v,h.I=e,h.v=!1,I=r.O,T=0,b)h.state=h.L,h.P=!1,I&&I(t),d=h.render(h.props,h.state,h.context),w.push.apply(h.W,h.A),h.A=[];else do{h.P=!1,I&&I(t),d=h.render(h.props,h.state,h.context),h.state=h.L}while(h.P&&++T<25);h.state=h.L,null!=h.getChildContext&&(i=k(k({},i),h.getChildContext())),b&&!m&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(f,p)),E=null!=d&&d.type===$&&null==d.key?q(d.props.children):d,l=z(e,x(E)?E:[E],t,n,i,o,s,a,l,c,u),h.base=t.v,t.C&=-161,h.W.length&&a.push(h),y&&(h.j=h.m=null)}catch(e){if(t.N=null,c||null!=s)if(e.then){for(t.C|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;s[s.indexOf(l)]=null,t.v=l}else{for(P=s.length;P--;)N(s[P]);B(t)}else t.v=n.v,t.i=n.i,e.then||B(t);r.v(e,t,n)}else null==s&&t.N==n.N?(t.i=n.i,t.v=n.v):l=t.v=H(n.v,t,n,i,o,s,a,c,u);return(d=r.diffed)&&d(t),128&t.C?void 0:l}function B(e){e&&(e.k&&(e.k.v=!0),e.i&&e.i.some(B))}function F(e,t,n){for(var i=0;i<n.length;i++)U(n[i],n[++i],n[++i]);r.k&&r.k(t,e),e.some(function(t){try{e=t.W,t.W=[],e.some(function(e){e.call(t)})}catch(e){r.v(e,t.N)}})}function q(e){return"object"!=typeof e||null==e||e.p>0?e:x(e)?e.map(q):k({},e)}function H(e,t,i,o,s,a,l,c,u){var d,h,m,f,p,g,y,w=i.props||v,b=t.props,k=t.type;if("svg"==k?s="http://www.w3.org/2000/svg":"math"==k?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=a)for(d=0;d<a.length;d++)if((p=a[d])&&"setAttribute"in p==!!k&&(k?p.localName==k:3==p.nodeType)){e=p,a[d]=null;break}if(null==e){if(null==k)return document.createTextNode(b);e=document.createElementNS(s,k,b.is&&b),c&&(r.B&&r.B(t,a),c=!1),a=null}if(null==k)w===b||c&&e.data==b||(e.data=b);else{if(a=a&&n.call(e.childNodes),!c&&null!=a)for(w={},d=0;d<e.attributes.length;d++)w[(p=e.attributes[d]).name]=p.value;for(d in w)p=w[d],"dangerouslySetInnerHTML"==d?m=p:"children"==d||d in b||"value"==d&&"defaultValue"in b||"checked"==d&&"defaultChecked"in b||W(e,d,null,p,s);for(d in b)p=b[d],"children"==d?f=p:"dangerouslySetInnerHTML"==d?h=p:"value"==d?g=p:"checked"==d?y=p:c&&"function"!=typeof p||w[d]===p||W(e,d,p,w[d],s);if(h)c||m&&(h.H==m.H||h.H==e.innerHTML)||(e.innerHTML=h.H),t.i=[];else if(m&&(e.innerHTML=""),z("template"==t.type?e.content:e,x(f)?f:[f],t,i,o,"foreignObject"==k?"http://www.w3.org/1999/xhtml":s,a,l,a?a[0]:i.i&&I(i,0),c,u),null!=a)for(d=a.length;d--;)N(a[d]);c||(d="value","progress"==k&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[d]||"progress"==k&&!g||"option"==k&&g!=w[d])&&W(e,d,g,w[d],s),d="checked",null!=y&&y!=e[d]&&W(e,d,y,w[d],s))}return e}function U(e,t,n){try{if("function"==typeof e){var i="function"==typeof e.C;i&&e.C(),i&&null==t||(e.C=e(t))}else e.current=t}catch(e){r.v(e,n)}}function Y(e,t,n){var i,o;if(r.unmount&&r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||U(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){r.v(e,t)}i.base=i.I=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&Y(i[o],t,n||"function"!=typeof e.type);n||N(e.v),e.k=e.m=e.v=void 0}function Z(e,t,n){return this.constructor(e,n)}n=w.slice,r={v:function(e,t,n,r){for(var i,o,s;t=t.m;)if((i=t.k)&&!i.m)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.P),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.P),s)return i.j=i}catch(t){e=t}throw e}},i=0,C.prototype.setState=function(e,t){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=k({},this.state),"function"==typeof e&&(e=e(k({},n),this.props)),e&&k(n,e),null!=e&&this.N&&(t&&this.A.push(t),P(this))},C.prototype.forceUpdate=function(e){this.N&&(this.v=!0,e&&this.W.push(e),P(this))},C.prototype.render=$,o=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=function(e,t){return e.N.p-t.N.p},D.O=0,c=Math.random().toString(8),u="__d"+c,d="__a"+c,h=/(PointerCapture)$|Capture$/i,m=0,f=A(!1),p=A(!0),g=0,e.ErrorType=void 0,(y=e.ErrorType||(e.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",y.API_ERROR="API_ERROR",y.VALIDATION_ERROR="VALIDATION_ERROR",y.STORAGE_ERROR="STORAGE_ERROR",y.TIMEOUT_ERROR="TIMEOUT_ERROR",y.MAINTENANCE_ERROR="MAINTENANCE_ERROR";class G extends Error{constructor(e,t,n=!1,r,i,o){super(t),this.type=e,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.name="InsureOSError"}}class V{constructor(e){this.config=e}shouldRetry(e,t){return!(t>=this.config.maxRetries)&&this.isRetryableError(e)}getDelay(e,t){if(t){const e=parseInt(t,10);if(!isNaN(e))return 1e3*e}const n=this.config.baseDelay*Math.pow(2,e);return Math.min(n,this.config.maxDelay)}isRetryableError(e){return e instanceof G?e.retryable:!("TypeError"!==e.name||!e.message.includes("fetch"))||"AbortError"===e.name}}class Q{constructor(e){this.config=e,this.retryStrategy=new V(e.retryConfig)}getBaseUrl(){return this.config.apiBaseUrl||"https://api.os.insure"}async makeRequest({url:t,method:n,body:r,skipOrgHeader:i=!1}){return this.executeWithRetry(async()=>{const o=new AbortController,s=setTimeout(()=>o.abort(),this.config.timeout);try{const e={"Content-Type":"application/json"},a=t.includes("signed=");i||a||(e["X-Organisation-ID"]=this.config.orgId);const l={method:n,headers:e,signal:o.signal};r&&(l.body=JSON.stringify(r));const c=await fetch(t,l);if(clearTimeout(s),!c.ok)throw await this.handleApiError(c);const u=await c.json();return u.data||u}catch(t){if(clearTimeout(s),t instanceof G)throw t;if(t instanceof Error&&"AbortError"===t.name)throw new G(e.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(t instanceof TypeError&&t.message.includes("fetch"))throw new G(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw t}})}getQuoteIntent(e){return this.makeRequest({url:e,method:"GET"})}async fetchAvailableProducts(e){var n;const r=null==e?void 0:e.includes("*"),i=!e||0===e.length,o=`${this.config.apiBaseUrl}/products`,s=await this.makeRequest({url:o,method:"GET"}),a=s.products||[],l=null===(n=s.organisation)||void 0===n?void 0:n.client_settings;let c=a;if(r)t(),c=a;else if(e&&e.length>0)c=a.filter(t=>e.includes(t.code));else if(i&&(null==l?void 0:l.products)&&l.products.length>0){const e=l.products.map(e=>e.code);c=e.map(e=>a.find(t=>t.code===e)).filter(e=>void 0!==e),t((a.length,c.length))}else i&&(t(),c=a);return{products:c,organisation:s.organisation}}createQuoteIntent(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents`,method:"POST",body:e})}updateQuoteIntent(e,t){return this.makeRequest({url:e,method:"PUT",body:t})}deleteQuoteIntent(e){return this.makeRequest({url:e,method:"DELETE"})}calculateQuoteIntent(e){return this.makeRequest({url:e,method:"POST"})}calculateQuoteIntentV2(e){return this.makeRequest({url:e,method:"POST"})}repriceQuoteIntentV2(e,t){return this.makeRequest({url:e,method:"POST",body:t})}bindQuoteIntentV2(e,t){return this.makeRequest({url:e,method:"POST",body:t})}deleteCalculations(e){return this.makeRequest({url:e,method:"DELETE"})}initiatePayment(e,t){const n="string"==typeof t?t:t.code;return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/initiate`,method:"POST",body:{...e,gateway_code:n}})}getPaymentStatus(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/status/${e}`,method:"GET"})}createQuotePaymentLink(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/payment-link`,method:"POST",body:t})}continueLater(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/continue-later`,method:"POST",body:{email:t}})}getPaymentLinkDetails(e){return this.makeRequest({url:e,method:"GET",skipOrgHeader:!0})}getPaymentLinkById(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}`,method:"GET"})}initiateFixedPayment(e,t,n){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}/pay`,method:"POST",body:{gateway_code:t,client_name:n}})}validateCoverStartDate(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}/validate-cover-date`,method:"POST",body:{cover_start_date:t}})}validatePromoCode(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/validate-promo-code`,method:"POST",body:{code:t}})}async executeWithRetry(e){let n;for(let r=0;r<=this.config.retryConfig.maxRetries;r++)try{return t(this.config.retryConfig.maxRetries),await e()}catch(e){n=e;const i=this.retryStrategy.shouldRetry(n,r);if(t(e instanceof G&&(e.type,e.message)),t(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw t(),n;const o=e instanceof G?e.retryAfter:void 0,s=this.retryStrategy.getDelay(r,o);t(),await new Promise(e=>setTimeout(e,s))}throw n}async handleApiError(n){var r;const i=n.headers.get("retry-after"),o=await n.json().catch(()=>({}));if(t(),this.captureApiErrorToSentry(n,o),503===n.status)return new G(e.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,n.status);if(429===n.status)return new G(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,n.status,i||void 0);if(n.status>=500){const t=o.message||"Service temporarily unavailable. Please try again in a moment.";return new G(e.ErrorType.API_ERROR,t,!1,n.status)}if(422===n.status)try{const t=o;return t.error&&t.error.details&&t.error.details.form_data?new G(e.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.error.details):new G(e.ErrorType.VALIDATION_ERROR,t.message||"Validation failed. Please check your inputs.",!1,n.status,void 0,null===(r=t.error)||void 0===r?void 0:r.details)}catch(t){return new G(e.ErrorType.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,n.status)}if(400===n.status)try{const t=o;return t.errors?new G(e.ErrorType.VALIDATION_ERROR,t.message||"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.errors):new G(e.ErrorType.API_ERROR,t.message||"Invalid request. Please check your input and try again.",!1,n.status)}catch(t){return new G(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,n.status)}if(n.status>=400&&n.status<500){const t=o.message||"Invalid request. Please refresh the page and try again.";return new G(e.ErrorType.API_ERROR,t,!1,n.status)}return new G(e.ErrorType.API_ERROR,`Request failed: ${n.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(n.status),n.status)}captureApiErrorToSentry(e,t){try{(e.status>=500||429===e.status)&&Promise.resolve().then(function(){return fh}).then(({captureMessage:n,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:`API Error: ${e.status} ${e.statusText}`,category:"http",level:"error",data:{url:e.url,status:e.status,statusText:e.statusText}}),n(`API Error: ${e.status} - ${e.url}`,"error",{http:{status_code:e.status,url:e.url,method:"Unknown"},response:t}))}).catch(()=>{})}catch(e){}}}class J{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return localStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{localStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{localStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{localStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.localStorage)return!1;const e="__insure_os_storage_test__";return localStorage.setItem(e,"test"),localStorage.removeItem(e),!0}catch(e){return!1}}}class K{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return sessionStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{sessionStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{sessionStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{sessionStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const e="__insure_os_storage_test__";return sessionStorage.setItem(e,"test"),sessionStorage.removeItem(e),!0}catch(e){return!1}}}class X{static generateKey(e,t,n){const r=[this.KEY_PREFIX+e,t];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(e){try{return JSON.stringify({data:e,timestamp:Date.now(),version:"1.0"})}catch(e){throw new Error(`Failed to serialize data: ${e}`)}}static deserialize(e){try{const t=JSON.parse(e);return t&&"object"==typeof t&&t.data?t.data:null}catch(e){return null}}static getTimestamp(e){try{return JSON.parse(e).timestamp||null}catch(e){return null}}static isExpired(e,t){const n=this.getTimestamp(e);return!n||Date.now()-n>t}}X.KEY_PREFIX="insure_os_",X.SEPARATOR="_";class ee{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||ee.DEFAULT_EXPIRATION_MS,namespace:t.namespace||ee.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{t.payment_transactions&&t.payment_transactions.length;const n=this.generateStorageKey(e),r=X.serialize(t);this.storageAdapter.set(n,r)}catch(e){}}getQuoteIntent(e){if(!this.storageAdapter.isAvailable())return null;try{const t=this.generateStorageKey(e),n=this.storageAdapter.get(t);if(!n)return null;const r=X.deserialize(n);return(null==r?void 0:r.payment_transactions)&&r.payment_transactions.length,r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(e),null)}catch(e){return null}}removeQuoteIntent(e){if(this.storageAdapter.isAvailable())try{const t=this.generateStorageKey(e);this.storageAdapter.remove(t)}catch(e){}}isQuoteIntentValid(e){if(!e||"object"!=typeof e)return!1;if(!e.id||!e.url||!e.org_id)return!1;const t=Date.now();return!(e.expires_at&&t>e.expires_at||e.created_at&&t-e.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(e){return X.generateKey(this.config.namespace,e)}}ee.DEFAULT_EXPIRATION_MS=864e5,ee.DEFAULT_NAMESPACE="quote_intent";class te{constructor(e){this.stateManager=e}async getOrCreateQuoteIntent(e,t,n){const r=this.stateManager.getQuoteIntent(e);if(r&&this.stateManager.isQuoteIntentValid(r)){const t=await n(r.url);return this.stateManager.saveQuoteIntent(e,t),t}try{const n=await t();return this.stateManager.saveQuoteIntent(e,n),n}catch(t){throw r&&this.stateManager.removeQuoteIntent(e),t}}updateQuoteIntent(e,t){const n=this.stateManager.getQuoteIntent(e);if(!n)return null;const r={...n,...t};return this.stateManager.saveQuoteIntent(e,r),r}clearQuoteIntent(e){this.stateManager.removeQuoteIntent(e)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(e){const t=this.stateManager.getQuoteIntent(e);return null!==t&&this.stateManager.isQuoteIntentValid(t)}getQuoteIntentUrl(e){const t=this.stateManager.getQuoteIntent(e);return(null==t?void 0:t.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class ne{constructor(e,t){this.saveCallback=t,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=e}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.config.autoSave&&(this.intervalId=window.setInterval(()=>{this.isPaused||this.isUserTyping||!this.shouldAttemptSave()||this.saveCallback().catch(this.handleSaveError.bind(this))},this.config.autoSaveInterval))}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}pause(){this.isPaused=!0,setTimeout(()=>this.resume(),6e4)}resume(){this.isPaused=!1,this.consecutiveFailures=0}shouldAttemptSave(){return!!this.config.autoSave&&(0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1))}handleSaveError(e){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(e))}dispatchErrorEvent(e){if("undefined"!=typeof window){const t=new CustomEvent("form-autosave-error",{detail:{error:e,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(t)}}onSaveSuccess(){this.consecutiveFailures=0,this.lastErrorTime=0,this.isPaused&&this.resume()}startTyping(){this.isUserTyping=!0,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=window.setTimeout(()=>{this.stopTyping()},500)}stopTyping(){this.isUserTyping=!1,this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}get status(){return{isPaused:this.isPaused,consecutiveFailures:this.consecutiveFailures,isActive:!!this.intervalId,isUserTyping:this.isUserTyping}}}function re(e,t){const n=t.operator,r=t.value,i=null==r?"":String(r),o=null==e?"":String(e);switch(n){case"=":return o===i;case"!=":return o!==i;case"contains":return o.includes(i);case"not_contains":return!o.includes(i);case"starts_with":return o.startsWith(i);case"ends_with":return o.endsWith(i);case"is_empty":return void 0===e||null==e||""===e||""===e.trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function ie(e,t){const n=t.operator,r=null==t.value?0:Number(t.value),i=null==e?0:Number(e.toString().replace(/,/g,"").trim());switch(n){case">":return i>r;case">=":return i>=r;case"<":return i<r;case"<=":return i<=r;case"=":return i===r;case"!=":return i!==r;case"is_empty":return void 0===e||null==e||""===e||""===e.toString().trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function oe(e,t){const n=t.operator;switch(t.operator){case"true":return!0===e||"true"===e||1===e;case"false":return!1===e||"false"===e||0===e||void 0===e;case"=":return Boolean(e);case"!=":return!Boolean(e);default:throw new Error(`Unsupported boolean operator: ${n}`)}}function se(e,t){const n=t.operator,r=t.value,i=null==r?0:Number(t.value);if(null==e||""===e.toString().trim())return"is_empty"===n;const o=e.toString().trim(),s=/^\d{4}$/.test(o)&&Number(o)>=1900&&Number(o)<=2100?new Date(Number(o),0,1).getTime():Date.parse(o),a=Math.floor((Date.now()-s)/315576e5),l=Math.floor((Date.now()-s)/864e5),c=new Date(s),u=new Date,d=12*(u.getFullYear()-c.getFullYear())+(u.getMonth()-c.getMonth());switch(n){case">":return s>Date.parse(r);case">=":return s>=Date.parse(r);case"<":return s<Date.parse(r);case"<=":return s<=Date.parse(r);case"age_less_than":return a<i;case"age_less_than_or_equal":return a<=i;case"age_greater_than":return a>i;case"age_greater_than_or_equal":return a>=i;case"age_days_less_than":return l<i;case"age_days_less_than_or_equal":return l<=i;case"age_days_greater_than":return l>i;case"age_days_greater_than_or_equal":return l>=i;case"age_months_less_than":return d<i;case"age_months_less_than_or_equal":return d<=i;case"age_months_greater_than":return d>i;case"age_months_greater_than_or_equal":return d>=i;default:throw new Error(`Unsupported date operator: ${n}`)}}class ae{static create(e){switch(e){case"string":case"text":case"select":return re;case"numeric":return ie;case"boolean":return oe;case"date":return se;default:throw new Error(`Unsupported condition type: ${e}`)}}}function le(e,t){const n=t.condition_type||"and";if(!t.conditions||0===t.conditions.length)return{matched:!0,conditions:[]};const r={matched:!1,conditions:t.conditions.map(t=>{const n={...t,matched:ce(e,t),string:`${t.field} ${t.operator}`};return t.value&&(n.string+=` ${t.value}`),n})};return"none"===n&&(r.matched=!0),"and"===n&&(r.matched=r.conditions.every(e=>e.matched)),"or"===n&&(r.matched=r.conditions.some(e=>e.matched)),"not"===n&&(r.matched=r.conditions.every(e=>!e.matched)),r}function ce(e,t){if("expression"===t.type)throw new Error("Expression conditions should not be evaluated through matchesCondition");if(!t.field)throw new Error("Field is required for non-expression conditions");const n=e[t.field],r=ae.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var ue=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:ae,booleanMatchesCondition:oe,checkSimpleConditions:le,dateMatchesCondition:se,numericMatchesCondition:ie,textMatchesCondition:re});function de(e,t){var n;const r=[];if("checkbox"===e.type&&e.required&&!0!==t&&"true"!==t)return r.push({field:e.code||e.id,message:`${e.label} must be accepted`}),r;"boolean"===e.type&&(null===(n=e.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===e.boolean_config.show_details_on&&(!0===t||"true"===t)||e.boolean_config.show_details_on),"email"===e.type&&"string"==typeof t&&(t=t.trim());const i="boolean"===e.type?null==t:null==t||""===t;if(e.required&&i&&!0!==e.add_null_option)return r.push({field:e.code||e.id,message:`${e.label} is required`}),r;if(!e.required&&i)return r;const o=e.validation;if(!o)return r;const s=String(t),a="number"==typeof t?t:parseFloat(s);if(o.pattern&&("text"===e.type||"email"===e.type)){const t=new RegExp(o.pattern),n=s.trim();t.test(n)||r.push({field:e.code||e.id,message:`${e.label} format is invalid`})}if(o.minLength&&s.length<o.minLength&&r.push({field:e.code||e.id,message:`${e.label} must be at least ${o.minLength} characters`}),o.maxLength&&s.length>o.maxLength&&r.push({field:e.code||e.id,message:`${e.label} must be no more than ${o.maxLength} characters`}),"number"!==e.type||isNaN(a)||(void 0!==o.min&&a<o.min&&r.push({field:e.code||e.id,message:`${e.label} must be at least ${o.min}`}),void 0!==o.max&&a>o.max&&r.push({field:e.code||e.id,message:`${e.label} must be no more than ${o.max}`}),void 0!==o.step&&a%o.step!==0&&r.push({field:e.code||e.id,message:`${e.label} must be in increments of ${o.step}`})),("date"===e.type||"year"===e.type||"monthyear"===e.type)&&!1===o.canBeFuture){const t=new Date,n=t.getFullYear();let i=!1;if("year"===e.type){const e=parseInt(s,10);!isNaN(e)&&e>n&&(i=!0)}else if("date"===e.type){const e=new Date(s);if(!isNaN(e.getTime())){const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());new Date(e.getFullYear(),e.getMonth(),e.getDate())>n&&(i=!0)}}else if("monthyear"===e.type){const e=s.split("-");if(2===e.length){const n=parseInt(e[0],10),r=parseInt(e[1],10)-1;isNaN(n)||isNaN(r)||new Date(n,r,1)>new Date(t.getFullYear(),t.getMonth(),1)&&(i=!0)}}i&&r.push({field:e.code||e.id,message:`${e.label} cannot be in the future`})}return r}function he(e,t){var n,r;const i=[];for(const r of e.fields){const e=r.code||r.id;let o=!0;if(r.visibility){const e=le(t,{condition_type:r.visibility.condition_type,conditions:r.visibility.conditions});o="show"===r.visibility.action?e.matched:!e.matched}if(!o)continue;const s=t[e],a=de(r,s);if(i.push(...a),"boolean"===r.type&&(null===(n=r.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===r.boolean_config.show_details_on&&(!0===s||"true"===s)||"no"===r.boolean_config.show_details_on&&(!1===s||"false"===s))){const n=(t.U||{})[e];n&&""!==n.trim()||i.push({field:e,message:r.boolean_config.details_label||"Please provide details"})}}if(null===(r=e.validation)||void 0===r?void 0:r.required_fields)for(const n of e.validation.required_fields){const r=e.fields.find(e=>(e.code||e.id)===n),o=t[n];if(r){const e=r.code||r.id,n=i.find(t=>t.field===e);if(n)continue;let s=!0;if(r.visibility){const e=le(t,{condition_type:r.visibility.condition_type,conditions:r.visibility.conditions});s="show"===r.visibility.action?e.matched:!e.matched}if(!s)continue;if("checkbox"===r.type){!0!==o&&"true"!==o&&i.push({field:e,message:`${r.label} must be accepted`});continue}("boolean"===r.type?null==o:null==o||""===o)&&(!0===r.add_null_option||i.push({field:e,message:`${r.label} is required`}))}}return{isValid:0===i.length,errors:i}}function me(e){const t=[];let n;if("object"==typeof e&&null!==e&&("validation_errors"in e&&e.validation_errors&&"object"==typeof e.validation_errors?n=e.validation_errors:"errors"in e&&e.errors&&"object"==typeof e.errors?n=e.errors:"message"in e||"validation_errors"in e||"errors"in e||(n=e)),n)for(const[e,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)t.push({field:e,message:n});return t}class fe{constructor(e,t,n){this.httpClient=e,this.definition=t,this.quoteIntentStore=n}async load(e,t){if(this.quoteIntentStore&&this.quoteIntentStore.getQuoteIntentUrl(e)){const e=await this.httpClient.getQuoteIntent(t);if(e.quote_intent.form_data)return e.quote_intent.form_data}return(await this.httpClient.getQuoteIntent(t)).quote_intent.form_data||this.createEmptyFormData()}async save(e,t,n,r){try{const e=this.prepareSavePayload(n,r);return await this.httpClient.updateQuoteIntent(t,e),{success:!0}}catch(e){if(e&&"object"==typeof e&&"validationErrors"in e){const t=e.validationErrors;if(t&&"object"==typeof t)return{success:!1,validationErrors:me(t)}}throw e}}prepareSavePayload(e,t){const n=this.getCurrentPageId(e);return{current_page_index:e.current_page,current_page_id:n,page_data:e.page_data,save_type:t.saveType}}getCurrentPageId(e){const t=this.definition;if(!t||!e.page_data)return;const n=e.current_page;if(n<0||n>=t.pages.length)return;const r=t.pages[n];return r&&r.id?r.id:void 0}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}}class pe{constructor(e,t,n,r){this.formDefinition=e,this.getFormData=t,this.updateFormData=n,this.saveCallback=r}canNavigateToPage(e){const t=this.getFormData().current_page;if(e<=t)return!0;if(this.hasActiveBlocker(t))return!1;if(this.isStagingEnvironment())return!0;const n=this.getFormData().completed_pages;for(let r=0;r<e;r++)if(r!==t&&!n.includes(r))return!1;return!0}async navigateToPage(e){if(e<0||e>=this.getTotalPages())return!1;if(!this.canNavigateToPage(e))return!1;const t=this.getFormData().current_page;if(e>t)try{await this.saveCallback(!0,"page")}catch(e){return e&&"object"==typeof e&&e.isValidationError,!1}return e>t&&this.markPageCompleted(t),this.updateFormData({current_page:e,last_updated:(new Date).toISOString()}),!0}navigateToNext(){const e=this.getFormData().current_page;return this.navigateToPage(e+1)}navigateToPrevious(){const e=this.getFormData().current_page;return this.navigateToPage(e-1)}markPageCompleted(e){const t=this.getFormData();if(!t.completed_pages.includes(e)){const n=[...t.completed_pages,e].sort((e,t)=>e-t);this.updateFormData({completed_pages:n})}}getTotalPages(){return this.formDefinition.pages.length}getCompletionStatus(){const e=this.getFormData(),t=this.getTotalPages(),n=[...e.completed_pages];return{totalPages:t,currentPage:e.current_page,completedPages:n,percentComplete:n.length/t*100}}hasActiveBlocker(e){var t;const n=this.formDefinition.pages[e];if(!n)return!1;const r=(null===(t=this.getFormData().page_data)||void 0===t?void 0:t[n.id])||{};for(const e of n.fields)if(e.blocker)if(e.blocker.conditions&&e.blocker.conditions.length>0){if(le(r,{condition_type:e.blocker.condition_type||"or",conditions:e.blocker.conditions}).matched)return!0}else if(void 0!==e.blocker.trigger_value){const t=r[e.code||e.id];if(void 0!==t&&String(t)===String(e.blocker.trigger_value))return!0}return!1}isStagingEnvironment(){const e=window.location.hostname;return"localhost"===e||e.endsWith(".test")||e.includes("staging")}}class ge{constructor(e){this.httpClient=e}async calculateQuote(e){const n=await this.httpClient.calculateQuoteIntent(e);return t(),n}}class ye{constructor(e){this.httpClient=e}async calculate(e){const n=await this.httpClient.calculateQuoteIntentV2(e);return t(),n}async reprice(e,n){const r={selection:n},i=await this.httpClient.repriceQuoteIntentV2(e,r);return t(),i}async bind(e,n){const r=await this.httpClient.bindQuoteIntentV2(e,n);return t(),r}}function ve(e,t,n){var r,i,o,s;const a=Date.now(),l=`${e}-${a}`;if(function(e,t,n){try{Promise.resolve().then(function(){return fh}).then(({captureException:r,addBreadcrumb:i,isSentryInitialized:o})=>{o()&&(i({message:`Error occurred: ${t}`,category:"error",level:"error",data:{errorType:t,customMessage:n}}),r(e,{errorType:t,customMessage:n}))}).catch(()=>{})}catch(e){}}(t,e,n),t&&"object"==typeof t){if("statusCode"in t||"status"in t)return we(l,e,t.statusCode||t.status||500,t.message||(null===(r=t.data)||void 0===r?void 0:r.message)||"Server error occurred",n,a);if("response"in t)return we(l,e,(null===(i=t.response)||void 0===i?void 0:i.status)||500,(null===(s=null===(o=t.response)||void 0===o?void 0:o.data)||void 0===s?void 0:s.message)||t.message||"Network error occurred",n,a);if(t.message)return{id:l,type:e,severity:xe(e),title:be(e),message:n||Ne(e),details:t.message,retryable:Se(e,0),timestamp:a,trackingId:l}}const c="string"==typeof t?t:"An unexpected error occurred";return{id:l,type:e,severity:xe(e),title:be(e),message:n||c,retryable:Se(e,0),timestamp:a,trackingId:l}}function we(e,t,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=Se(t,n);return{id:e,type:t,severity:s,statusCode:n,title:be(t,n),message:i||ke(t,n,r),details:r,retryable:a,timestamp:o}}function be(e,t){if(t){if(404===t)return"Not Found";if(503===t)return"Under Maintenance";if(t>=500)return"Something Went Wrong";if(t>=400)return"Invalid Request"}switch(e){case"initialization":default:return"Something Went Wrong";case"calculation":return"Calculation Error";case"network":return"Connection Problem";case"validation":return"Please Check Your Details";case"maintenance":return"Under Maintenance"}}function xe(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ke(e,t,n){return"calculation"===e&&(n.toLowerCase().includes("no matching values found")||n.toLowerCase().includes("rating table")||n.toLowerCase().includes("not supported"))?n:n.toLowerCase().includes("no matching values found")?"The entered value is not supported by our calculator. Please try a different amount.":n.toLowerCase().includes("rating table")?"Unable to calculate with the provided information. Please check your entries and try again.":404===t?"initialization"===e?"The requested form could not be found. Please check the URL or contact support.":"The requested resource was not found.":503===t?"We're performing scheduled maintenance. Please check back in a few minutes.":t>=500?"calculation"===e?"We're experiencing technical difficulties with the calculation. Please try again in a moment.":"We're experiencing technical difficulties. Please try again in a moment.":429===t?"Too many requests. Please wait a moment and try again.":t>=400?"There was an issue with your request. Please adjust your details and re-submit.":"An unexpected error occurred. Please try again."}function Ne(e){switch(e){case"initialization":return"We're unable to load the application at this time. Please try again.";case"calculation":return"We couldn't complete the calculation. Please check your details and try again.";case"network":return"We're having trouble connecting. Please check your internet connection and try again.";case"validation":return"Please check your details and try again.";case"maintenance":return"We're performing scheduled maintenance. Please check back in a few minutes.";default:return"An unexpected error occurred. Please try again."}}function Se(e,t){return"validation"!==e&&"maintenance"!==e&&404!==t&&503!==t&&!(t>=400&&t<500&&429!==t)&&("network"===e||"calculation"===e||t>=500&&503!==t||429===t)}function _e(e){return"maintenance"===e.type||503===e.statusCode}function $e(e){return e.trackingId?`If this problem persists, please contact support and reference error ID: ${e.trackingId.slice(0,8).toUpperCase()}`:"critical"===e.severity?"If this problem persists, please contact support with the error details.":"If you continue to experience issues, please contact support."}let Ce=null;function Ie(e){Ce=e}function Te(e,t){var n,r;return{event:t,quote_id:e.id,organisation_slug:null===(n=e.organisation)||void 0===n?void 0:n.slug,organisation_name:null===(r=e.organisation)||void 0===r?void 0:r.name,timestamp:(new Date).toISOString()}}function Ee(e){var t,n;if(!(null==Ce?void 0:Ce.isEnabled()))return;const r={...Te(e,"quote_started"),quote_status:e.status,total_pages:null===(n=null===(t=e.form_definition)||void 0===t?void 0:t.pages)||void 0===n?void 0:n.length};Ce.push(r)}function Pe(e,t,n,r){var i,o;if(!(null==Ce?void 0:Ce.isEnabled()))return;const s=(null===(o=null===(i=e.form_definition)||void 0===i?void 0:i.pages)||void 0===o?void 0:o.length)||0,a=s>0?Math.round(n.length/s*100):0,l={...Te(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};Ce.push(l)}function De(e,t){if(!(null==Ce?void 0:Ce.isEnabled()))return;const n=t.calculations||[],r=t.payment_options||[],i=n.find(e=>e.id===t.default_excess_id),o=n.map(e=>e.premium_total),s=o.length>0?Math.min(...o):void 0,a=o.length>0?Math.max(...o):void 0,l=r.some(e=>"monthly"===e.amount.frequency),c={...Te(e,"quote_calculated"),excess_id:null==i?void 0:i.id,excess_amount:null==i?void 0:i.excess_amount,premium_subtotal:null==i?void 0:i.premium_subtotal,premium_total:null==i?void 0:i.premium_total,excess_options_count:n.length,payment_options_count:r.length,has_installments:l,min_premium:s,max_premium:a};Ce.push(c)}function ze(e,t,n,r,i){if(!(null==Ce?void 0:Ce.isEnabled()))return;const o={...Te(e,"quote_at_checkout"),excess_id:t.id,excess_amount:t.excess_amount,premium_subtotal:t.premium_subtotal,premium_total:t.premium_total,payment_options_count:n,has_installments:r,form_completion:i,fees:t.fees};Ce.push(o)}function Re(e,t){if(!(null==Ce?void 0:Ce.isEnabled()))return;const n=t.referrals||[],r={...Te(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};Ce.push(r)}function Me(e,t,n,r){if(!(null==Ce?void 0:Ce.isEnabled()))return;const i={...Te(e,"payment_initiated"),payment_amount:t.amount.dueToday,payment_gateway:t.gateway_id,payment_gateway_name:n,excess_amount:r||0,payment_frequency:t.amount.frequency,amount_due_today:t.amount.dueToday,installments_count:t.amount.numberOfInstallments};Ce.push(i)}function Oe(e,t,n,r,i,o){if(!(null==Ce?void 0:Ce.isEnabled()))return;const s={...Te(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};Ce.push(s)}function je(e,t,n,r,i,o){if(!(null==Ce?void 0:Ce.isEnabled()))return;const s={...Te(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};Ce.push(s)}class We{constructor(e,t,n,r={}){this.quoteIntent=e,this.httpClient=t,this.subscribers=new Set,this.pendingChanges={},this.isCalculating=!1,this.isRepricing=!1,this.isSaving=!1,this.selectedExcessId=null,this.selectedPaymentOption=null,this.selectionV2=null,this.validationErrors=[],this.serverValidationErrors=[],this.generalErrors=[],this.lastCalculationFailed=!1,this.config={autoSaveInterval:r.autoSaveInterval||1e3,autoSave:!1!==r.autoSave,maxRetryAttempts:r.maxRetryAttempts||3,retryDelay:r.retryDelay||2e3},this.formData=this.createEmptyFormData(),this.quoteIntentStore=n,this.lastCalculationFailed=this.getPersistedCalculationFailureState();const i=e.form_definition;this.persistenceManager=new fe(t,i,n),this.autoSaveManager=new ne(this.config,this.saveFormData.bind(this)),this.navigationManager=new pe(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new ge(t),this.calculationManagerV2=new ye(t),this.config.autoSave&&this.autoSaveManager.start()}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}async loadFormProgress(){var e,t;return this.formData=await this.persistenceManager.load(this.quoteIntent.id,this.quoteIntent.url),this.lastCalculationFailed=!0===(null===(t=null===(e=this.formData.page_data)||void 0===e?void 0:e.Y)||void 0===t?void 0:t.lastCalculationFailed),this.config.autoSave=!1,this.autoSaveManager.stop(),this.notify(),this.formData}updatePageData(e,t){this.pendingChanges[e]={...this.pendingChanges[e],...t},this.formData.page_data={...this.formData.page_data,[e]:{...this.formData.page_data[e],...t}},this.formData.last_updated=(new Date).toISOString(),this.notify()}updateFieldValue(e,t,n){if(this.autoSaveManager.startTyping(),"string"==typeof n){const r=this.getFormDefinition().pages.find(t=>t.id===e),i=null==r?void 0:r.fields.find(e=>(e.code||e.id)===t);i&&"email"===i.type&&(n=n.trim())}this.pendingChanges[e]||(this.pendingChanges[e]={}),this.pendingChanges[e][t]=n,this.formData.page_data[e]||(this.formData.page_data[e]={}),this.formData.page_data[e][t]=n,this.formData.last_updated=(new Date).toISOString(),this.validateField(e,t,n),this.notify()}updateFieldAnswer(e,n,r,i){if(this.autoSaveManager.startTyping(),this.formData.page_data[e]||(this.formData.page_data[e]={}),this.formData.page_data[e].U||(this.formData.page_data[e].U={}),this.formData.page_data[e].U[n]=r,i){const n=this.getRatingFactorCodeById(i);n&&(this.formData.page_data[e][n]=r,t())}this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(e){var n;if(this.isUserTyping())return;const r=e.completed_pages||[],i=(null===(n=this.quoteIntent.form_definition)||void 0===n?void 0:n.pages.length)||0;let o=0;for(let e=0;e<i;e++)if(!r.includes(e)){o=e;break}r.length===i&&i>0&&(o=i-1),t(e.current_page),this.formData={...e,current_page:o},this.notify()}restoreCalculationResult(e){t(),t(e.outcome_type),this.calculationResult=e,e.default_excess_id&&(this.selectedExcessId=e.default_excess_id),t(),this.notify(),t()}getRatingFactorCodeById(e){const n=this.getFormDefinition();for(const t of n.pages)for(const n of t.fields){if(n.rating_factor_id===e)return n.code||n.id;if(n.rating_factor_mappings)for(const t of n.rating_factor_mappings)if(t.rating_factor_id===e)return t.rating_factor_code||n.code||n.id}return t(),null}processRatingFactorMappings(e){const t=this.getFormDefinition(),n={};return t.pages.forEach(t=>{const r=e.page_data[t.id]||{};t.fields.forEach(e=>{const t=r[e.code||e.id];null!=t&&""!==t&&e.rating_factor_mappings&&e.rating_factor_mappings.length>0&&e.rating_factor_mappings.forEach(r=>{if("derived"===r.type&&r.derivation_rule){const i=this.applyDerivationRule(t,r.derivation_rule,r.metadata),o=r.rating_factor_code||`${e.code||e.id}_${r.derivation_rule}`;n[o]=i}})})}),n}applyDerivationRule(e,n,r){switch(t(JSON.stringify(r)),n){case"calculate_age":return this.calculateAge(e,r);case"invert_yes_no":return this.invertYesNo(e);default:return null}}invertYesNo(e){return"Yes"===e?"No":"Yes"}calculateAge(e,t){try{const n=new Date(e),r="current_date"===(null==t?void 0:t.reference_date)?new Date:new Date((null==t?void 0:t.reference_date)||Date.now());let i=r.getFullYear()-n.getFullYear();const o=r.getMonth()-n.getMonth();return(o<0||0===o&&r.getDate()<n.getDate())&&i--,i}catch(e){return null}}async saveFormData(e=!1,n="auto-save"){if(!e&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);t();const o={...this.formData,page_data:{...this.formData.page_data,V:i}};try{const t=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:e,saveType:n});if(!t.success){if(t.validationErrors){this.setServerValidationErrors(t.validationErrors),this.notify();const e=new Error("Validation failed");throw e.isValidationError=!0,e}throw new Error("Failed to save form data")}{this.pendingChanges={},this.autoSaveManager.onSaveSuccess(),this.clearServerValidationErrors(),this.clearGeneralErrors();const e=this.formData;r.current_page===e.current_page?this.formData=o:this.formData={...o,current_page:e.current_page,completed_pages:e.completed_pages,last_updated:e.last_updated},this.notify()}}catch(e){if(e&&"object"==typeof e&&"type"in e&&"message"in e){const t=e;if(!t.validationErrors||0===Object.keys(t.validationErrors).length){const e=ve("validation",t);this.addGeneralError(e),this.notify()}}throw e}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(e){return this.navigationManager.canNavigateToPage(e)}navigateToPage(e){return this.navigationManager.navigateToPage(e)}async navigateToNextPage(){var e,t;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(t=null===(e=this.quoteIntent.form_definition)||void 0===e?void 0:e.pages[n-1])||void 0===t?void 0:t.title;Pe(this.quoteIntent,n,r,i)}return n}navigateToPreviousPage(){return this.navigationManager.navigateToPrevious()}getPageCompletionStatus(){return this.navigationManager.getCompletionStatus()}getFormProgress(){return this.formData}getFormDefinition(){return this.quoteIntent.form_definition}getTotalPages(){return this.navigationManager.getTotalPages()}getCurrentPageIndex(){return this.formData.current_page}isAutoSavePaused(){return this.autoSaveManager.status.isPaused}isUserTyping(){return this.autoSaveManager.status.isUserTyping}getIsCalculating(){return this.isCalculating}getIsRepricing(){return this.isRepricing}getIsSaving(){return this.isSaving}hasCalculationResponse(){return Boolean(this.calculationResult)}getCalculationResult(){return this.calculationResult}getConsecutiveFailures(){return this.autoSaveManager.status.consecutiveFailures}getSelectedExcessId(){return this.selectedExcessId}setSelectedExcessId(e){this.selectedExcessId=e,this.selectedPaymentOption=null,this.notify()}getSelectedPaymentOption(){return this.selectedPaymentOption}setSelectedPaymentOption(e){this.selectedPaymentOption=e,this.notify()}hasPendingChanges(){return Object.keys(this.pendingChanges).length>0}validateCurrentPage(){const e=this.getCurrentPageIndex(),t=this.getFormDefinition().pages[e];if(!t)return[];const n=he(t,this.getAllFormDataFlattened());return this.validationErrors=n.errors,this.notify(),n.errors}validateField(e,t,n){const r=this.getFormDefinition().pages.find(t=>t.id===e),i=null==r?void 0:r.fields.find(e=>(e.code||e.id)===t);if(!i)return[];const o=de(i,n);return this.validationErrors=this.validationErrors.filter(e=>e.field!==t),this.validationErrors.push(...o),this.notify(),o}getValidationErrors(){return[...this.validationErrors,...this.serverValidationErrors]}getFieldErrors(e){return this.getValidationErrors().filter(t=>t.field===e)}hasErrors(){return this.validationErrors.length>0||this.serverValidationErrors.length>0}hasFieldErrors(e){return this.getFieldErrors(e).length>0}clearValidationErrors(){this.validationErrors=[],this.notify()}setServerValidationErrors(e){this.serverValidationErrors=e,this.notify()}clearServerValidationErrors(){this.serverValidationErrors=[],this.notify()}getGeneralErrors(){const e=this.generalErrors.filter(e=>!e.dismissed);return e.length>0?[e[e.length-1]]:[]}addGeneralError(e){this.generalErrors.push(e),this.notify()}dismissGeneralError(e){const t=this.generalErrors.find(t=>t.id===e);t&&(t.dismissed=!0,this.notify())}clearGeneralErrors(){this.generalErrors=[],this.notify()}hasGeneralErrors(){return this.getGeneralErrors().length>0}hasLastCalculationFailed(){return this.lastCalculationFailed}dispose(){this.autoSaveManager.stop(),Object.keys(this.pendingChanges).length>0&&!this.isAutoSavePaused()&&this.saveFormData(!0).catch(console.error),this.subscribers.clear()}async filterHiddenFieldsAndSave(){const e=this.getFormDefinition(),t={...this.formData},{checkSimpleConditions:n}=await Promise.resolve().then(function(){return ue}),r=this.getAllFormDataFlattened();e.pages.forEach(e=>{const i=this.formData.page_data[e.id]||{},o={};Object.keys(i).forEach(e=>{e.startsWith("__")&&e.endsWith("__")&&(o[e]=i[e])}),e.fields.forEach(e=>{const t=e.code||e.id,s=i[t];let a=!0;if(e.visibility){const t=n(r,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions});a="show"===e.visibility.action?t.matched:!t.matched}a&&void 0!==s&&(o[t]=s)}),t.page_data[e.id]=o});const i=this.processRatingFactorMappings(t),o={...t,page_data:{...t.page_data,V:i}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:!0,saveType:"full"})}async calculateQuote(){t();const e=this.getFormDefinition(),n=[],r=this.getAllFormDataFlattened();for(const i of e.pages){const e=he(i,r);t(i.title,e.errors.length>0&&e.errors),n.push(...e.errors)}if(n.length>0)throw t(),this.validationErrors=n,this.notify(),new Error("Form validation failed");t(),await this.filterHiddenFieldsAndSave();try{if(this.isCalculating=!0,this.notify(),2===this.quoteIntent.calculator_version&&this.quoteIntent.calculate_url_v2){const e=await this.calculationManagerV2.calculate(this.quoteIntent.calculate_url_v2);if("referral"===e.outcome_type){this.calculationResultV2=void 0,this.selectionV2=null,this.selectedExcessId=null;const t=this.buildV1CompatResponseFromV2(e);return this.calculationResult=t,this.lastCalculationFailed=!1,this.persistCalculationFailureState(),Re(this.quoteIntent,t),t}this.calculationResultV2=e,this.selectionV2=e.selection;const t=this.buildV1CompatResponseFromV2(e);this.calculationResult=t,this.selectedExcessId=e.selection.excess_id,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const n=this.generalErrors.filter(e=>"calculation"===e.type);return n.forEach(e=>this.dismissGeneralError(e.id)),"calculation"===t.outcome_type?De(this.quoteIntent,t):"referral"===t.outcome_type&&Re(this.quoteIntent,t),t}const e=await this.calculationManager.calculateQuote(this.quoteIntent.calculate_url);this.calculationResult=e,this.selectedExcessId=e.default_excess_id||null,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const t=this.generalErrors.filter(e=>"calculation"===e.type);return t.forEach(e=>this.dismissGeneralError(e.id)),"calculation"===e.outcome_type?De(this.quoteIntent,e):"referral"===e.outcome_type&&Re(this.quoteIntent,e),e}catch(e){this.lastCalculationFailed=!0,this.persistCalculationFailureState();const t={outcome_type:"referral",referral_reason:"Your quote requires further review.",quote_intent:this.quoteIntent};return this.calculationResult=t,t}finally{this.isCalculating=!1,this.notify()}}async clearCalculationResults(){t();try{await this.httpClient.deleteCalculations(this.quoteIntent.delete_calculations_url),this.calculationResult=void 0,this.calculationResultV2=void 0,this.selectionV2=null,this.selectedExcessId=null,this.selectedPaymentOption=null,this.notify(),t()}catch(e){throw t(),e}}getCalculationResultV2(){return this.calculationResultV2}getSelectionV2(){return this.selectionV2}setV2Selection(e){var t,n,r,i;if(!this.calculationResultV2||!this.selectionV2)return;const o={cover_type_id:null!==(t=e.cover_type_id)&&void 0!==t?t:this.selectionV2.cover_type_id,excess_id:null!==(n=e.excess_id)&&void 0!==n?n:this.selectionV2.excess_id,coverage_option_ids:null!==(r=e.coverage_option_ids)&&void 0!==r?r:this.selectionV2.coverage_option_ids};if(e.cover_type_id&&e.cover_type_id!==this.selectionV2.cover_type_id){const e=this.calculationResultV2.variants.filter(e=>e.cover_type_id===o.cover_type_id),t=e.some(e=>e.excess_id===o.excess_id);if(!t){const t=null!==(i=e.find(e=>e.excess_id===this.calculationResultV2.default_excess_id))&&void 0!==i?i:e[0];t&&(o.excess_id=t.excess_id)}}this.selectionV2=o,this.selectedExcessId=o.excess_id,this.calculationResult=this.buildV1CompatResponseFromV2(this.calculationResultV2),this.notify()}async toggleV2CoverageOption(e){if(!this.calculationResultV2||!this.selectionV2||!this.quoteIntent.reprice_url_v2)return;const t=this.calculationResultV2.policy_coverage_options.find(t=>t.id===e);if(!t)return;const n=this.selectionV2.coverage_option_ids,r=n.includes(e)?n.filter(t=>t!==e):[...n,e],i={...this.selectionV2,coverage_option_ids:r};try{this.isRepricing=!0,this.notify();const e=await this.calculationManagerV2.reprice(this.quoteIntent.reprice_url_v2,i);this.calculationResultV2={...this.calculationResultV2,variants:e.variants,policy_coverage_options:e.policy_coverage_options},this.selectionV2=e.selection,this.calculationResult=this.buildV1CompatResponseFromV2(this.calculationResultV2)}catch(e){}finally{this.isRepricing=!1,this.notify()}}getV2DisplayedTotal(){if(!this.calculationResultV2||!this.selectionV2)return 0;const e=this.calculationResultV2.variants.find(e=>e.cover_type_id===this.selectionV2.cover_type_id&&e.excess_id===this.selectionV2.excess_id);return e?Math.round(100*e.pricing.total_payable)/100:0}async bindV2(e){if(!this.quoteIntent.bind_url_v2||!this.selectionV2)throw new Error("v2 bind unavailable — missing bind URL or selection");const t=this.getV2DisplayedTotal();return this.calculationManagerV2.bind(this.quoteIntent.bind_url_v2,{selection:this.selectionV2,client_claimed_total:t,email:e})}buildV1CompatResponseFromV2(e){var t;const n=null!==(t=this.selectionV2)&&void 0!==t?t:e.selection,r=e.variants.filter(e=>e.cover_type_id===n.cover_type_id),i=r.map(t=>{var n;const r=e.excess_options.find(e=>e.id===t.excess_id);return{id:t.excess_id,calculation_id:e.id,excess_amount:null!==(n=null==r?void 0:r.excess_amount)&&void 0!==n?n:0,excess_label:null==r?void 0:r.excess_label,description:void 0,premium_base:t.pricing.subtotal-t.pricing.fees,premium_subtotal:t.pricing.subtotal,premium_total:t.pricing.total_payable,fees:[]}});return{quote_intent:e.quote_intent,product_name:e.product_name,default_excess_id:e.default_excess_id,default_coverage_options:n.coverage_option_ids,outcome_type:e.outcome_type,referral_reason:e.referral_reason,calculations:i,referrals:e.referrals.map(e=>({id:e.id,reason:e.reason})),clauses:e.clauses,payment_options:[],payment_gateways:e.payment_gateways}}notify(){this.subscribers.forEach(e=>e(this))}getAllFormDataFlattened(){const e={};return Object.values(this.formData.page_data).forEach(t=>{const{U:n,...r}=t;Object.assign(e,r),n&&Object.keys(n).length>0&&(e.U||(e.U={}),Object.assign(e.U,n))}),e}updateFormDataInternal(e){if(this.isUserTyping()&&e.page_data){const t={...e};delete t.page_data,this.formData={...this.formData,...t}}else this.formData={...this.formData,...e};this.notify()}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}getPersistedCalculationFailureState(){var e,t,n;return!!(null===(n=null===(t=null===(e=this.quoteIntent.form_data)||void 0===e?void 0:e.page_data)||void 0===t?void 0:t.Y)||void 0===n?void 0:n.lastCalculationFailed)&&!0===this.quoteIntent.form_data.page_data.Y.lastCalculationFailed}persistCalculationFailureState(){this.formData.page_data.Y||(this.formData.page_data.Y={}),this.formData.page_data.Y.lastCalculationFailed=this.lastCalculationFailed,this.formData.last_updated=(new Date).toISOString(),this.saveFormData(!0,"auto-save").catch(()=>{})}reset(){localStorage.clear();const e=new URL(window.location.href);e.searchParams.delete("url"),window.history.replaceState({},document.title,e.toString()),window.location.reload()}getQuoteIntent(){return this.quoteIntent}updateQuoteIntent(e){if(this.quoteIntentStore){const t=this.quoteIntentStore.updateQuoteIntent(this.quoteIntent.org_id,e);t&&(this.quoteIntent=t,this.notify())}}clearStoredQuoteIntent(){this.quoteIntentStore&&this.quoteIntentStore.clearQuoteIntent(this.quoteIntent.org_id)}async initiatePayment(e){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(t=>t.id===e.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");t();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(t=>t.gateway_id===e.gatewayId&&t.calculation_id===e.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(t=>t.id===e.calculationId);try{const t=await this.httpClient.initiatePayment(e,o);return s&&Me(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),t}catch(e){throw e}}async getPaymentStatus(e){var t;const n=this.getSelectedPaymentOption();if(!n)throw new Error("No payment option selected");const r=((null===(t=this.calculationResult)||void 0===t?void 0:t.payment_gateways)||[]).find(e=>e.id===n.gateway_id);if(!r)throw new Error("Selected payment gateway not found in calculation response");try{const t=await this.httpClient.getPaymentStatus(e,r);return this.notify(),t}catch(e){throw e}}startPaymentStatusPolling(e,t,n=30){let r=0,i=!1;const o=async()=>{if(!(i||r>=n))try{const s=await this.getPaymentStatus(e);t(s),"pending"!==s.status&&"initiated"!==s.status||(r++,r<n&&!i&&setTimeout(o,1e4))}catch(e){r++,r<n&&!i&&setTimeout(o,1e4)}};return o(),()=>{i=!0}}}class Ae{constructor(e,t){this.httpClient=e,this.response=t}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(e){var t;const n=this.response.product.form_definition,r={...this.response.quote_intent.form_data};r.page_data||(r.page_data={});for(const i of n.pages){const n=r.page_data[i.id]||{};for(const r of i.fields){const i=r.code||r.id;if(e.hasOwnProperty(i)?n[i]=e[i]:("text"===r.type&&(n[i]="sample"),"number"===r.type&&(n[i]=1),"checkbox"===r.type&&(n[i]=!0)),"boolean"===r.type&&(null===(t=r.boolean_config)||void 0===t?void 0:t.enable_details_textbox)){const e="yes"===r.boolean_config.show_details_on,t=n[i];(t===e||t===String(e))&&(n.U||(n.U={}),n.U[i]=`Sample details for: ${i}`)}}r.page_data[i.id]=n}const i={current_page_index:0,save_type:"full",page_data:{...r.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,i)}}class Le{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new Ae(this.httpClient,n)}}var Be=0;function Fe(e,t,n,i,o,s){t||(t={});var a,l,c=t;if("ref"in c)for(l in c={},t)"ref"==l?a=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:--Be,_:-1,C:0,J:o,K:s};if("function"==typeof e&&(a=e.defaultProps))for(l in a)void 0===c[l]&&(c[l]=a[l]);return r.vnode&&r.vnode(u),u}var qe,He,Ue,Ye,Ze=0,Ge=[],Ve=r,Qe=Ve.p,Je=Ve.O,Ke=Ve.diffed,Xe=Ve.k,et=Ve.unmount,tt=Ve.m;function nt(e,t){Ve.W&&Ve.W(He,e,Ze||t),Ze=0;var n=He.X||(He.X={m:[],W:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function rt(e){return Ze=1,function(e,t){var n=nt(qe++,2);if(n.t=e,!n.k&&(n.m=[ft(void 0,t),function(e){var t=n.ee?n.ee[0]:n.m[0],r=n.t(t,e);t!==r&&(n.ee=[r,n.m[1]],n.k.setState({}))}],n.k=He,!He.te)){var r=function(e,t,r){if(!n.k.X)return!0;var o=n.k.X.m.filter(function(e){return e.k});if(o.every(function(e){return!e.ee}))return!i||i.call(this,e,t,r);var s=n.k.props!==e;return o.some(function(e){if(e.ee){var t=e.m[0];e.m=e.ee,e.ee=void 0,t!==e.m[0]&&(s=!0)}}),i&&i.call(this,e,t,r)||s};He.te=!0;var i=He.shouldComponentUpdate,o=He.componentWillUpdate;He.componentWillUpdate=function(e,t,n){if(this.v){var s=i;i=void 0,r(e,t,n),i=s}o&&o.call(this,e,t,n)},He.shouldComponentUpdate=r}return n.ee||n.m}(ft,e)}function it(e,t){var n=nt(qe++,3);!Ve.L&&mt(n.X,t)&&(n.m=e,n.u=t,He.X.W.push(n))}function ot(e){return Ze=5,st(function(){return{current:e}},[])}function st(e,t){var n=nt(qe++,7);return mt(n.X,t)&&(n.m=e(),n.X=t,n.W=e),n.m}function at(e,t){return Ze=8,st(function(){return e},t)}function lt(){for(var e;e=Ge.shift();){var t=e.X;if(e.I&&t)try{t.W.some(dt),t.W.some(ht),t.W=[]}catch(n){t.W=[],Ve.v(n,e.N)}}}Ve.p=function(e){He=null,Qe&&Qe(e)},Ve.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),tt&&tt(e,t)},Ve.O=function(e){Je&&Je(e),qe=0;var t=(He=e.k).X;t&&(Ue===He?(t.W=[],He.W=[],t.m.some(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.W.some(dt),t.W.some(ht),t.W=[],qe=0)),Ue=He},Ve.diffed=function(e){Ke&&Ke(e);var t=e.k;t&&t.X&&(t.X.W.length&&(1!==Ge.push(t)&&Ye===Ve.requestAnimationFrame||((Ye=Ve.requestAnimationFrame)||ut)(lt)),t.X.m.some(function(e){e.u&&(e.X=e.u),e.u=void 0})),Ue=He=null},Ve.k=function(e,t){t.some(function(e){try{e.W.some(dt),e.W=e.W.filter(function(e){return!e.m||ht(e)})}catch(n){t.some(function(e){e.W&&(e.W=[])}),t=[],Ve.v(n,e.N)}}),Xe&&Xe(e,t)},Ve.unmount=function(e){et&&et(e);var t,n=e.k;n&&n.X&&(n.X.m.some(function(e){try{dt(e)}catch(e){t=e}}),n.X=void 0,t&&Ve.v(t,n.N))};var ct="function"==typeof requestAnimationFrame;function ut(e){var t,n=function(){clearTimeout(r),ct&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ct&&(t=requestAnimationFrame(n))}function dt(e){var t=He,n=e.k;"function"==typeof n&&(e.k=void 0,n()),He=t}function ht(e){var t=He;e.k=e.m(),He=t}function mt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ft(e,t){return"function"==typeof t?t(e):t}const pt="insure-os";let gt=!1;const yt=new Map,vt={[`--${pt}-radius`]:"0.75rem",[`--${pt}-radius-sm`]:"0.5rem",[`--${pt}-radius-lg`]:"1rem",[`--${pt}-background`]:"oklch(0.955 0 0)",[`--${pt}-foreground`]:"oklch(0.145 0 0)",[`--${pt}-card`]:"oklch(1 0 0)",[`--${pt}-card-foreground`]:"oklch(0.145 0 0)",[`--${pt}-popover`]:"oklch(1 0 0)",[`--${pt}-popover-foreground`]:"oklch(0.145 0 0)",[`--${pt}-primary`]:"oklch(0.205 0 0)",[`--${pt}-primary-foreground`]:"oklch(0.985 0 0)",[`--${pt}-secondary`]:"oklch(0.97 0 0)",[`--${pt}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${pt}-muted`]:"oklch(0.97 0 0)",[`--${pt}-muted-foreground`]:"oklch(0.556 0 0)",[`--${pt}-accent`]:"oklch(0.97 0 0)",[`--${pt}-accent-foreground`]:"oklch(0.205 0 0)",[`--${pt}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${pt}-border`]:"oklch(0.9 0 0)",[`--${pt}-input`]:"oklch(0.9 0 0)",[`--${pt}-ring`]:"oklch(0.708 0 0)",[`--${pt}-font-family`]:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${pt}-font-size-large`]:"18px",[`--${pt}-font-size-small`]:"14px",[`--${pt}-font-size`]:"16px",[`--${pt}-border-width`]:"1px",[`--${pt}-transition-duration`]:"200ms",[`--${pt}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${pt}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${pt}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${pt}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${pt}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${pt}-spacing-sm`]:"0.75rem",[`--${pt}-spacing`]:"1rem",[`--${pt}-spacing-md`]:"1.5rem",[`--${pt}-spacing-lg`]:"2rem",[`--${pt}-spacing-xl`]:"3rem"},wt={colors:{background:`var(--${pt}-background)`,foreground:`var(--${pt}-foreground)`,card:`var(--${pt}-card)`,popover:`var(--${pt}-popover)`,popoverForeground:`var(--${pt}-popover-foreground)`,primary:`var(--${pt}-primary)`,primaryForeground:`var(--${pt}-primary-foreground)`,secondary:`var(--${pt}-secondary)`,muted:`var(--${pt}-muted)`,mutedForeground:`var(--${pt}-muted-foreground)`,accent:`var(--${pt}-accent)`,accentForeground:`var(--${pt}-accent-foreground)`,destructive:`var(--${pt}-destructive)`,border:`var(--${pt}-border)`,input:`var(--${pt}-input)`},fontSize:{small:`var(--${pt}-font-size-small)`,default:`var(--${pt}-font-size)`,large:`var(--${pt}-font-size-large)`},radius:{small:`var(--${pt}-radius-sm)`,default:`var(--${pt}-radius)`,large:`var(--${pt}-radius-lg)`},shadow:{sm:`var(--${pt}-shadow-sm)`,md:`var(--${pt}-shadow-md)`},spacing:{sm:`var(--${pt}-spacing-sm)`,default:`var(--${pt}-spacing)`,md:`var(--${pt}-spacing-md)`,lg:`var(--${pt}-spacing-lg)`,xl:`var(--${pt}-spacing-xl)`},fontFamily:`var(--${pt}-font-family)`,borderWidth:`var(--${pt}-border-width)`,transition:`var(--${pt}-transition-duration) var(--${pt}-transition-timing-function)`},bt=new Set;let xt=!1;function kt(){xt||(Nt(`\n/* InsureOS Style Isolation Reset */\n.${pt}-root {\n all: revert;\n /* Re-apply our base styles after reset */\n font-family: var(--${pt}-font-family);\n background-color: var(--${pt}-background);\n color: var(--${pt}-foreground);\n font-size: var(--${pt}-font-size);\n line-height: 1.5;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.${pt}-root *,\n.${pt}-root *::before,\n.${pt}-root *::after {\n box-sizing: border-box;\n}\n\n.${pt}-root img,\n.${pt}-root picture,\n.${pt}-root video,\n.${pt}-root canvas,\n.${pt}-root svg {\n display: block;\n max-width: 100%;\n}\n\n.${pt}-root button,\n.${pt}-root input,\n.${pt}-root select,\n.${pt}-root textarea {\n font: inherit;\n color: inherit;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n}\n\n.${pt}-root button {\n cursor: pointer;\n}\n\n.${pt}-root a {\n color: inherit;\n text-decoration: inherit;\n}\n\n.${pt}-root h1,\n.${pt}-root h2,\n.${pt}-root h3,\n.${pt}-root h4,\n.${pt}-root h5,\n.${pt}-root h6 {\n font-size: inherit;\n font-weight: inherit;\n margin: 0;\n}\n\n.${pt}-root p,\n.${pt}-root ul,\n.${pt}-root ol,\n.${pt}-root blockquote,\n.${pt}-root figure {\n margin: 0;\n padding: 0;\n}\n\n.${pt}-root ul,\n.${pt}-root ol {\n list-style: none;\n}\n\n.${pt}-root table {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\n.${pt}-root hr {\n margin: 0;\n border: none;\n border-top: 1px solid var(--${pt}-border);\n height: 0;\n}\n`),xt=!0,t())}function Nt(e){if(!document.getElementById(`${pt}-styles`)){const e=document.createElement("style");e.id=`${pt}-styles`,document.head.appendChild(e)}document.getElementById(`${pt}-styles`).textContent+=e+"\n"}function St(e){return Object.entries(e).map(([e,t])=>{return`${n=e,n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${t}`;var n}).join("; ")}function _t(){gt||(Nt(`:root {\n${Object.entries(vt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),gt=!0)}const $t={name:e=>`${pt}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){_t();const r=St(t),i=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t).toString(36)}(`${e}:${r}:${n?JSON.stringify(n):""}`),o=`${e}-${i}`,s=yt.get(o);if(s)return s.fullClassName;let a=e;const l=this.name(a);return bt.has(a)||(Nt(`.${l} { ${r} }`),bt.add(a)),yt.set(o,{contentHash:i,fullClassName:l}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),l},keyframes(e,t){const n=`${pt}-${e}`;return bt.has(`keyframes-${e}`)||(Nt(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${St(t)} }`).join("\n")}\n}`),bt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;Nt(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${pt}-${e} { ${St(t)} }`).join("\n")}\n}`),bt.add(n)},pseudoElement(e,t,n){const r=`${pt}-${e}`,i=`${e}-${t}`;return bt.has(i)||(Nt(`.${r}${t} { ${St(n)} }`),bt.add(i)),r}};var Ct=Object.freeze({__proto__:null,baseVariables:vt,injectIsolationStyles:kt,styles:$t,theme:wt,updateBaseVariables:function(e){t(),Object.assign(vt,e);const n=document.getElementById(`${pt}-styles`);if(n){const e=n.textContent||"",r=`:root {\n${Object.entries(vt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,i=e.includes(":root {")?e.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+e;n.textContent=i,t()}else _t()}});function It(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var Tt,Et={exports:{}};function Pt(){return Tt||(Tt=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!=={}.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var r="";for(var o in e)t.call(e,o)&&e[o]&&(r=i(r,o));return r}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(Et)),Et.exports}var Dt=It(Pt());function zt({size:e="small"}){const t=$t.create("spinner-small",{width:"16px",height:"16px"}),n=$t.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return $t.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Fe("div",{className:$t.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:Dt(r),children:Fe("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function Rt({className:e,children:t,size:n="md"}){const r={sm:wt.spacing.sm,md:wt.spacing.md,lg:wt.spacing.lg,xl:wt.spacing.xl},i=$t.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?wt.spacing.lg:"lg"===n?wt.spacing.md:r[n]},"(max-width: 480px)":{padding:wt.spacing.sm}});return Fe("div",{className:Dt(i,e),children:t})}const Mt=function(){function e(t){var n,r;return this.getChildContext||(n=new Set,(r={})[e.k]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.v=!0,P(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),t.children}return e.k="__cC"+g++,e.m=null,e.Provider=e.re=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}();function Ot({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,urlPromoCode:l}){return Fe(Mt.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,urlPromoCode:l,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function jt(){const e=function(e){var t=He.context[e.k],n=nt(qe++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(He)),t.props.value):e.m}(Mt);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function Wt(e){const t=jt(),{formStateManager:n}=t;if(!n||"function"!=typeof n.subscribe)throw new Error("useQuoteForm can only be used in quote mode. If you're in payment link mode, use usePaymentLink instead.");const[r,i]=rt(()=>e(n));return it(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class At extends Error{}class Lt extends At{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Bt extends At{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Ft extends At{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class qt extends At{}class Ht extends At{constructor(e){super(`Invalid unit ${e}`)}}class Ut extends At{}class Yt extends At{constructor(){super("Zone is an abstract class")}}const Zt="numeric",Gt="short",Vt="long",Qt={year:Zt,month:Zt,day:Zt},Jt={year:Zt,month:Gt,day:Zt},Kt={year:Zt,month:Gt,day:Zt,weekday:Gt},Xt={year:Zt,month:Vt,day:Zt},en={year:Zt,month:Vt,day:Zt,weekday:Vt},tn={hour:Zt,minute:Zt},nn={hour:Zt,minute:Zt,second:Zt},rn={hour:Zt,minute:Zt,second:Zt,timeZoneName:Gt},on={hour:Zt,minute:Zt,second:Zt,timeZoneName:Vt},sn={hour:Zt,minute:Zt,hourCycle:"h23"},an={hour:Zt,minute:Zt,second:Zt,hourCycle:"h23"},ln={hour:Zt,minute:Zt,second:Zt,hourCycle:"h23",timeZoneName:Gt},cn={hour:Zt,minute:Zt,second:Zt,hourCycle:"h23",timeZoneName:Vt},un={year:Zt,month:Zt,day:Zt,hour:Zt,minute:Zt},dn={year:Zt,month:Zt,day:Zt,hour:Zt,minute:Zt,second:Zt},hn={year:Zt,month:Gt,day:Zt,hour:Zt,minute:Zt},mn={year:Zt,month:Gt,day:Zt,hour:Zt,minute:Zt,second:Zt},fn={year:Zt,month:Gt,day:Zt,weekday:Gt,hour:Zt,minute:Zt},pn={year:Zt,month:Vt,day:Zt,hour:Zt,minute:Zt,timeZoneName:Gt},gn={year:Zt,month:Vt,day:Zt,hour:Zt,minute:Zt,second:Zt,timeZoneName:Gt},yn={year:Zt,month:Vt,day:Zt,weekday:Vt,hour:Zt,minute:Zt,timeZoneName:Vt},vn={year:Zt,month:Vt,day:Zt,weekday:Vt,hour:Zt,minute:Zt,second:Zt,timeZoneName:Vt};class wn{get type(){throw new Yt}get name(){throw new Yt}get ianaName(){return this.name}get isUniversal(){throw new Yt}offsetName(e,t){throw new Yt}formatOffset(e,t){throw new Yt}offset(e){throw new Yt}equals(e){throw new Yt}get isValid(){throw new Yt}}let bn=null;class xn extends wn{static get instance(){return null===bn&&(bn=new xn),bn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Br(e,t,n)}formatOffset(e,t){return Ur(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const kn=new Map,Nn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},Sn=new Map;class _n extends wn{static create(e){let t=Sn.get(e);return void 0===t&&Sn.set(e,t=new _n(e)),t}static resetCache(){Sn.clear(),kn.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=_n.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Br(e,t,n,this.name)}formatOffset(e,t){return Ur(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=function(e){let t=kn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),kn.set(e,t)),t}(this.name);let[r,i,o,s,a,l,c]=n.formatToParts?function(e,t){const n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){const{type:t,value:i}=n[e],o=Nn[t];"era"===t?r[o]=i:br(o)||(r[o]=parseInt(i,10))}return r}(n,t):function(e,t){const n=e.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,o,s,a,l,c,u]=r;return[s,i,o,a,l,c,u]}(n,t);"BC"===s&&(r=1-Math.abs(r));let u=+t;const d=u%1e3;return u-=d>=0?d:1e3+d,(jr({year:r,month:i,day:o,hour:24===a?0:a,minute:l,second:c,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let $n={};const Cn=new Map;function In(e,t={}){const n=JSON.stringify([e,t]);let r=Cn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),Cn.set(n,r)),r}const Tn=new Map,En=new Map;let Pn=null;const Dn=new Map;function zn(e){let t=Dn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Dn.set(e,t)),t}const Rn=new Map;function Mn(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class On{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...o}=n;if(!t||Object.keys(o).length>0){const t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=function(e,t={}){const n=JSON.stringify([e,t]);let r=Tn.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),Tn.set(n,r)),r}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return Tr(this.floor?Math.floor(e):zr(e,3),this.padTo)}}class jn{constructor(e,t,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&_n.create(n).valid?(r=n,this.dt=e):(r="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=In(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Wn{constructor(e,t,n){this.opts={style:"long",...n},!t&&Nr()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=En.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),En.set(i,o)),o}(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):function(e,t,n="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===n&&o){const n="days"===e;switch(t){case 1:return n?"tomorrow":`next ${i[e][0]}`;case-1:return n?"yesterday":`last ${i[e][0]}`;case 0:return n?"today":`this ${i[e][0]}`}}const s=Object.is(t,-0)||t<0,a=Math.abs(t),l=1===a,c=i[e],u=r?l?c[1]:c[2]||c[1]:l?i[e][0]:e;return s?`${a} ${u} ago`:`in ${a} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const An={firstDay:1,minimalDays:4,weekend:[6,7]};class Ln{static fromOpts(e){return Ln.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||ir.defaultLocale,s=o||(i?"en-US":Pn||(Pn=(new Intl.DateTimeFormat).resolvedOptions().locale,Pn)),a=t||ir.defaultNumberingSystem,l=n||ir.defaultOutputCalendar,c=Cr(r)||ir.defaultWeekSettings;return new Ln(s,a,l,c,o)}static resetCache(){Pn=null,Cn.clear(),Tn.clear(),En.clear(),Dn.clear(),Rn.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return Ln.create(e,t,n,r)}constructor(e,t,n,r,i){const[o,s,a]=function(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const n=e.indexOf("-u-");if(-1===n)return[e];{let t,r;try{t=In(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=In(o).resolvedOptions(),r=o}const{numberingSystem:i,calendar:o}=t;return[r,i,o]}}(e);this.locale=o,this.numberingSystem=t||s||null,this.outputCalendar=n||a||null,this.weekSettings=r,this.intl=function(e,t,n){return n||t?(e.includes("-u-")||(e+="-u"),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){var e;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(e=this).numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===zn(e.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Ln.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Cr(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Mn(this,e,Qr,()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(t&=!n)?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,"month");this.monthsCache[i][e]=function(e){const t=[];for(let n=1;n<=12;n++){const r=Xo.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Mn(this,e,ei,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=function(e){const t=[];for(let n=1;n<=7;n++){const r=Xo.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return Mn(this,void 0,()=>ti,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Xo.utc(2016,11,13,9),Xo.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Mn(this,e,oi,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Xo.utc(-40,1,1),Xo.utc(2017,1,1)].map(e=>this.extract(e,t,"era"))),this.eraCache[e]})}extract(e,t,n){const r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new On(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new jn(e,this.intl,t)}relFormatter(e={}){return new Wn(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=$n[n];return r||(r=new Intl.ListFormat(e,t),$n[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||zn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Sr()?function(e){let t=Rn.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...An,...t}),Rn.set(e,t)}return t}(this.locale):An}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Bn=null;class Fn extends wn{static get utcInstance(){return null===Bn&&(Bn=new Fn(0)),Bn}static instance(e){return 0===e?Fn.utcInstance:new Fn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Fn(Fr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Ur(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Ur(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Ur(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class qn extends wn{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Hn(e,t){if(br(e)||null===e)return t;if(e instanceof wn)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?xn.instance:"utc"===n||"gmt"===n?Fn.utcInstance:Fn.parseSpecifier(n)||_n.create(e)}return xr(e)?Fn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new qn(e)}const Un={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Yn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Zn=Un.hanidec.replace(/[\[|\]]/g,"").split(""),Gn=new Map;function Vn({numberingSystem:e},t=""){const n=e||"latn";let r=Gn.get(n);void 0===r&&(r=new Map,Gn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${Un[n]}${t}`),r.set(t,i)),i}let Qn,Jn=()=>Date.now(),Kn="system",Xn=null,er=null,tr=null,nr=60,rr=null;class ir{static get now(){return Jn}static set now(e){Jn=e}static set defaultZone(e){Kn=e}static get defaultZone(){return Hn(Kn,xn.instance)}static get defaultLocale(){return Xn}static set defaultLocale(e){Xn=e}static get defaultNumberingSystem(){return er}static set defaultNumberingSystem(e){er=e}static get defaultOutputCalendar(){return tr}static set defaultOutputCalendar(e){tr=e}static get defaultWeekSettings(){return rr}static set defaultWeekSettings(e){rr=Cr(e)}static get twoDigitCutoffYear(){return nr}static set twoDigitCutoffYear(e){nr=e%100}static get throwOnInvalid(){return Qn}static set throwOnInvalid(e){Qn=e}static resetCaches(){Ln.resetCache(),_n.resetCache(),Xo.resetCache(),Gn.clear()}}class or{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const sr=[0,31,59,90,120,151,181,212,243,273,304,334],ar=[0,31,60,91,121,152,182,213,244,274,305,335];function lr(e,t){return new or("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function cr(e,t,n){const r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return 0===i?7:i}function ur(e,t,n){return n+(Rr(e)?ar:sr)[t-1]}function dr(e,t){const n=Rr(e)?ar:sr,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function hr(e,t){return(e-t+7)%7+1}function mr(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=ur(r,i,o),a=hr(cr(r,i,o),n);let l,c=Math.floor((s-a+14-t)/7);return c<1?(l=r-1,c=Ar(l,t,n)):c>Ar(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:a,...Yr(e)}}function fr(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=hr(cr(r,1,t),n),a=Mr(r);let l,c=7*i+o-s-7+t;c<1?(l=r-1,c+=Mr(l)):c>a?(l=r+1,c-=Mr(r)):l=r;const{month:u,day:d}=dr(l,c);return{year:l,month:u,day:d,...Yr(e)}}function pr(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:ur(t,n,r),...Yr(e)}}function gr(e){const{year:t,ordinal:n}=e,{month:r,day:i}=dr(t,n);return{year:t,month:r,day:i,...Yr(e)}}function yr(e,t){if(!br(e.localWeekday)||!br(e.localWeekNumber)||!br(e.localWeekYear)){if(!br(e.weekday)||!br(e.weekNumber)||!br(e.weekYear))throw new qt("Cannot mix locale-based week fields with ISO-based week fields");return br(e.localWeekday)||(e.weekday=e.localWeekday),br(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),br(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function vr(e){const t=kr(e.year),n=Ir(e.month,1,12),r=Ir(e.day,1,Or(e.year,e.month));return t?n?!r&&lr("day",e.day):lr("month",e.month):lr("year",e.year)}function wr(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=Ir(t,0,23)||24===t&&0===n&&0===r&&0===i,s=Ir(n,0,59),a=Ir(r,0,59),l=Ir(i,0,999);return o?s?a?!l&&lr("millisecond",i):lr("second",r):lr("minute",n):lr("hour",t)}function br(e){return void 0===e}function xr(e){return"number"==typeof e}function kr(e){return"number"==typeof e&&e%1==0}function Nr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function Sr(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function _r(e,t,n){if(0!==e.length)return e.reduce((e,r)=>{const i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function $r(e,t){return{}.hasOwnProperty.call(e,t)}function Cr(e){if(null==e)return null;if("object"!=typeof e)throw new Ut("Week settings must be an object");if(!Ir(e.firstDay,1,7)||!Ir(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!Ir(e,1,7)))throw new Ut("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Ir(e,t,n){return kr(e)&&e>=t&&e<=n}function Tr(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function Er(e){return br(e)||null===e||""===e?void 0:parseInt(e,10)}function Pr(e){return br(e)||null===e||""===e?void 0:parseFloat(e)}function Dr(e){if(!br(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function zr(e,t,n="round"){const r=10**t;switch(n){case"expand":return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case"trunc":return Math.trunc(e*r)/r;case"round":return Math.round(e*r)/r;case"floor":return Math.floor(e*r)/r;case"ceil":return Math.ceil(e*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function Rr(e){return e%4==0&&(e%100!=0||e%400==0)}function Mr(e){return Rr(e)?366:365}function Or(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?Rr(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function jr(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Wr(e,t,n){return-hr(cr(e,1,t),n)+t-1}function Ar(e,t=4,n=1){const r=Wr(e,t,n),i=Wr(e+1,t,n);return(Mr(e)-r+i)/7}function Lr(e){return e>99?e:e>ir.twoDigitCutoffYear?1900+e:2e3+e}function Br(e,t,n,r=null){const i=new Date(e),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:t,...o},a=new Intl.DateTimeFormat(n,s).formatToParts(i).find(e=>"timezonename"===e.type.toLowerCase());return a?a.value:null}function Fr(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const r=parseInt(t,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function qr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Ut(`Invalid unit value ${e}`);return t}function Hr(e,t){const n={};for(const r in e)if($r(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=qr(i)}return n}function Ur(e,t){const n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${Tr(n,2)}:${Tr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${Tr(n,2)}${Tr(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Yr(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const Zr=["January","February","March","April","May","June","July","August","September","October","November","December"],Gr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Vr=["J","F","M","A","M","J","J","A","S","O","N","D"];function Qr(e){switch(e){case"narrow":return[...Vr];case"short":return[...Gr];case"long":return[...Zr];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Jr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Kr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Xr=["M","T","W","T","F","S","S"];function ei(e){switch(e){case"narrow":return[...Xr];case"short":return[...Kr];case"long":return[...Jr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const ti=["AM","PM"],ni=["Before Christ","Anno Domini"],ri=["BC","AD"],ii=["B","A"];function oi(e){switch(e){case"narrow":return[...ii];case"short":return[...ri];case"long":return[...ni];default:return null}}function si(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const ai={D:Qt,DD:Jt,DDD:Xt,DDDD:en,t:tn,tt:nn,ttt:rn,tttt:on,T:sn,TT:an,TTT:ln,TTTT:cn,f:un,ff:hn,fff:pn,ffff:yn,F:dn,FF:mn,FFF:gn,FFFF:vn};class li{static create(e,t={}){return new li(e,t)}static parseFormat(e){let t=null,n="",r=!1;const i=[];for(let o=0;o<e.length;o++){const s=e.charAt(o);"'"===s?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),t=null,n="",r=!r):r||s===t?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,t=s)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return ai[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n){if(this.opts.forceSimple)return Tr(e,t);const r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,i=(t,n)=>this.loc.extract(e,t,n),o=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",s=(t,r)=>n?function(e,t){return Qr(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return ei(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),l=t=>{const n=li.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},c=t=>n?function(e,t){return oi(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return si(li.parseFormat(t),t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return n?function(e){return ti[e.hour<12?0:1]}(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?i({day:"numeric"},"day"):this.num(e.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return a("short",!0);case"cccc":return a("long",!0);case"ccccc":return a("narrow",!0);case"EEE":return a("short",!1);case"EEEE":return a("long",!1);case"EEEEE":return a("narrow",!1);case"L":return r?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return s("short",!0);case"LLLL":return s("long",!0);case"LLLLL":return s("narrow",!0);case"M":return r?i({month:"numeric"},"month"):this.num(e.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return s("short",!1);case"MMMM":return s("long",!1);case"MMMMM":return s("narrow",!1);case"y":return r?i({year:"numeric"},"year"):this.num(e.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(t)}})}formatDurationFromString(e,t){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=e=>{switch(e[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=li.parseFormat(t),o=i.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),s=e.shiftTo(...o.map(r).filter(e=>e));return si(i,((e,t)=>i=>{const o=r(i);if(o){const r=t.isNegativeDuration&&o!==t.largestUnit?n:1;let s;return s="negativeLargestOnly"===this.opts.signMode&&o!==t.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(e.get(o)*r,i.length,s)}return i})(s,{isNegativeDuration:s<0,largestUnit:Object.keys(s.values)[0]}))}}const ci=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ui(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function di(...e){return t=>e.reduce(([e,n,r],i)=>{const[o,s,a]=i(t,r);return[{...e,...o},s||n,a]},[{},null,1]).slice(0,2)}function hi(e,...t){if(null==e)return[null,null];for(const[n,r]of t){const t=n.exec(e);if(t)return r(t)}return[null,null]}function mi(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=Er(t[n+i]);return[r,null,n+i]}}const fi=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,pi=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,gi=RegExp(`${pi.source}(?:${fi.source}?(?:\\[(${ci.source})\\])?)?`),yi=RegExp(`(?:[Tt]${gi.source})?`),vi=mi("weekYear","weekNumber","weekDay"),wi=mi("year","ordinal"),bi=RegExp(`${pi.source} ?(?:${fi.source}|(${ci.source}))?`),xi=RegExp(`(?: ${bi.source})?`);function ki(e,t,n){const r=e[t];return br(r)?n:Er(r)}function Ni(e,t){return[{hours:ki(e,t,0),minutes:ki(e,t+1,0),seconds:ki(e,t+2,0),milliseconds:Dr(e[t+3])},null,t+4]}function Si(e,t){const n=!e[t]&&!e[t+1],r=Fr(e[t+1],e[t+2]);return[{},n?null:Fn.instance(r),t+3]}function _i(e,t){return[{},e[t]?_n.create(e[t]):null,t+1]}const $i=RegExp(`^T?${pi.source}$`),Ci=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Ii(e){const[t,n,r,i,o,s,a,l,c]=e,u="-"===t[0],d=l&&"-"===l[0],h=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:h(Pr(n)),months:h(Pr(r)),weeks:h(Pr(i)),days:h(Pr(o)),hours:h(Pr(s)),minutes:h(Pr(a)),seconds:h(Pr(l),"-0"===l),milliseconds:h(Dr(c),d)}]}const Ti={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ei(e,t,n,r,i,o,s){const a={year:2===t.length?Lr(Er(t)):Er(t),month:Gr.indexOf(n)+1,day:Er(r),hour:Er(i),minute:Er(o)};return s&&(a.second=Er(s)),e&&(a.weekday=e.length>3?Jr.indexOf(e)+1:Kr.indexOf(e)+1),a}const Pi=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Di(e){const[,t,n,r,i,o,s,a,l,c,u,d]=e,h=Ei(t,i,r,n,o,s,a);let m;return m=l?Ti[l]:c?0:Fr(u,d),[h,new Fn(m)]}const zi=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Ri=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Mi=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Oi(e){const[,t,n,r,i,o,s,a]=e;return[Ei(t,i,r,n,o,s,a),Fn.utcInstance]}function ji(e){const[,t,n,r,i,o,s,a]=e;return[Ei(t,a,n,r,i,o,s),Fn.utcInstance]}const Wi=ui(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,yi),Ai=ui(/(\d{4})-?W(\d\d)(?:-?(\d))?/,yi),Li=ui(/(\d{4})-?(\d{3})/,yi),Bi=ui(gi),Fi=di(function(e,t){return[{year:ki(e,t),month:ki(e,t+1,1),day:ki(e,t+2,1)},null,t+3]},Ni,Si,_i),qi=di(vi,Ni,Si,_i),Hi=di(wi,Ni,Si,_i),Ui=di(Ni,Si,_i),Yi=di(Ni),Zi=ui(/(\d{4})-(\d\d)-(\d\d)/,xi),Gi=ui(bi),Vi=di(Ni,Si,_i),Qi="Invalid Duration",Ji={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Ki={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...Ji},Xi={years:{quarters:4,months:12,weeks:52.1775,days:365.2425,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:30.436875,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...Ji},eo=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],to=eo.slice(0).reverse();function no(e,t,n=!1){const r={values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new so(r)}function ro(e,t){let n=t.milliseconds??0;for(const r of to.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function io(e,t){const n=ro(e,t)<0?-1:1;eo.reduceRight((r,i)=>{if(br(t[i]))return r;if(r){const o=t[r]*n,s=e[i][r],a=Math.floor(o/s);t[i]+=a*n,t[r]-=a*s*n}return i},null),eo.reduce((n,r)=>{if(br(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function oo(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class so{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?Xi:Ki;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Ln.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return so.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Ut("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new so({values:Hr(e,so.normalizeUnit),loc:Ln.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(xr(e))return so.fromMillis(e);if(so.isDuration(e))return e;if("object"==typeof e)return so.fromObject(e);throw new Ut(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return hi(e,[Ci,Ii])}(e);return n?so.fromObject(n,t):so.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return hi(e,[$i,Yi])}(e);return n?so.fromObject(n,t):so.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Ut("need to specify a reason the Duration is invalid");const n=e instanceof or?e:new or(e,t);if(ir.throwOnInvalid)throw new Ft(n);return new so({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e?e.toLowerCase():e];if(!t)throw new Ht(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?li.create(this.loc,n).formatDurationFromString(this,e):Qi}toHuman(e={}){if(!this.isValid)return Qi;const t=!1!==e.showZeros,n=eo.map(n=>{const r=this.values[n];return br(r)||0===r&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=zr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},Xo.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?ro(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=so.fromDurationLike(e),n={};for(const e of eo)($r(t.values,e)||$r(this.values,e))&&(n[e]=t.get(e)+this.get(e));return no(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=so.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=qr(e(this.values[n],n));return no(this,{values:t},!0)}get(e){return this[so.normalizeUnit(e)]}set(e){return this.isValid?no(this,{values:{...this.values,...Hr(e,so.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return no(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return io(this.matrix,e),no(this,{values:e},!0)}rescale(){return this.isValid?no(this,{values:oo(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>so.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of eo)if(e.indexOf(o)>=0){i=o;let e=0;for(const t in n)e+=this.matrix[t][o]*n[t],n[t]=0;xr(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else xr(r[o])&&(n[o]=r[o]);for(const e in n)0!==n[e]&&(t[i]+=e===i?n[e]:n[e]/this.matrix[i][e]);return io(this.matrix,t),no(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return no(this,{values:e},!0)}removeZeros(){return this.isValid?no(this,{values:oo(this.values)},!0):this}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid)return!1;if(!this.loc.equals(e.loc))return!1;function t(e,t){return void 0===e||0===e?void 0===t||0===t:e===t}for(const n of eo)if(!t(this.values[n],e.values[n]))return!1;return!0}}const ao="Invalid Interval";class lo{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Ut("need to specify a reason the Interval is invalid");const n=e instanceof or?e:new or(e,t);if(ir.throwOnInvalid)throw new Bt(n);return new lo({invalid:n})}static fromDateTimes(e,t){const n=es(e),r=es(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?lo.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null:lo.invalid("missing or invalid end"):lo.invalid("missing or invalid start")}(n,r);return null==i?new lo({start:n,end:r}):i}static after(e,t){const n=so.fromDurationLike(t),r=es(e);return lo.fromDateTimes(r,r.plus(n))}static before(e,t){const n=so.fromDurationLike(t),r=es(e);return lo.fromDateTimes(r.minus(n),r)}static fromISO(e,t){const[n,r]=(e||"").split("/",2);if(n&&r){let e,i,o,s;try{e=Xo.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=Xo.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return lo.fromDateTimes(e,o);if(i){const n=so.fromISO(r,t);if(n.isValid)return lo.after(e,n)}else if(s){const e=so.fromISO(n,t);if(e.isValid)return lo.before(o,e)}}return lo.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let r;return r=t?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&this.s<=e&&this.e>e}set({start:e,end:t}={}){return this.isValid?lo.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(es).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),n=[];let{s:r}=this,i=0;for(;r<this.e;){const e=t[i]||this.e,o=+e>+this.e?this.e:e;n.push(lo.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=so.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let n,{s:r}=this,i=1;const o=[];for(;r<this.e;){const e=this.start.plus(t.mapUnits(e=>e*i));n=+e>+this.e?this.e:e,o.push(lo.fromDateTimes(r,n)),r=n,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return!!this.isValid&&+this.e===+e.s}abutsEnd(e){return!!this.isValid&&+e.e===+this.s}engulfs(e){return!!this.isValid&&this.s<=e.s&&this.e>=e.e}equals(e){return!(!this.isValid||!e.isValid)&&this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:lo.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return lo.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const r=[],i=e.map(e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}]),o=[].concat(...i).sort((e,t)=>e.time-t.time);for(const e of o)n+="s"===e.type?1:-1,1===n?t=e.time:(t&&+t!==+e.time&&r.push(lo.fromDateTimes(t,e.time)),t=null);return lo.merge(r)}difference(...e){return lo.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ao}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Qt,t={}){return this.isValid?li.create(this.s.loc.clone(t),e).formatInterval(this):ao}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ao}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ao}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ao}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ao}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):so.invalid(this.invalidReason)}mapEndpoints(e){return lo.fromDateTimes(e(this.s),e(this.e))}}class co{static hasDST(e=ir.defaultZone){const t=Xo.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return _n.isValidZone(e)}static normalizeZone(e){return Hn(e,ir.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Ln.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Ln.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Ln.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Ln.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Ln.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Ln.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Ln.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Ln.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Ln.create(t,null,"gregory").eras(e)}static features(){return{relative:Nr(),localeWeek:Sr()}}}function uo(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(so.fromMillis(r).as("days"))}function ho(e,t=e=>e){return{regex:e,deser:([e])=>t(function(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);if(-1!==e[n].search(Un.hanidec))t+=Zn.indexOf(e[n]);else for(const e in Yn){const[n,i]=Yn[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const mo=`[ ${String.fromCharCode(160)}]`,fo=new RegExp(mo,"g");function po(e){return e.replace(/\./g,"\\.?").replace(fo,mo)}function go(e){return e.replace(/\./g,"").replace(fo," ").toLowerCase()}function yo(e,t){return null===e?null:{regex:RegExp(e.map(po).join("|")),deser:([n])=>e.findIndex(e=>go(n)===go(e))+t}}function vo(e,t){return{regex:e,deser:([,e,t])=>Fr(e,t),groups:t}}function wo(e){return{regex:e,deser:([e])=>e}}const bo={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let xo=null;function ko(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=_o(li.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class No{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=ko(li.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=Vn(t),r=Vn(t,"{2}"),i=Vn(t,"{3}"),o=Vn(t,"{4}"),s=Vn(t,"{6}"),a=Vn(t,"{1,2}"),l=Vn(t,"{1,3}"),c=Vn(t,"{1,6}"),u=Vn(t,"{1,9}"),d=Vn(t,"{2,4}"),h=Vn(t,"{4,6}"),m=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},f=(f=>{if(e.literal)return m(f);switch(f.val){case"G":return yo(t.eras("short"),0);case"GG":return yo(t.eras("long"),0);case"y":return ho(c);case"yy":case"kk":return ho(d,Lr);case"yyyy":case"kkkk":return ho(o);case"yyyyy":return ho(h);case"yyyyyy":return ho(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return ho(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return ho(r);case"MMM":return yo(t.months("short",!0),1);case"MMMM":return yo(t.months("long",!0),1);case"LLL":return yo(t.months("short",!1),1);case"LLLL":return yo(t.months("long",!1),1);case"o":case"S":return ho(l);case"ooo":case"SSS":return ho(i);case"u":return wo(u);case"uu":return wo(a);case"uuu":case"E":case"c":return ho(n);case"a":return yo(t.meridiems(),0);case"EEE":return yo(t.weekdays("short",!1),1);case"EEEE":return yo(t.weekdays("long",!1),1);case"ccc":return yo(t.weekdays("short",!0),1);case"cccc":return yo(t.weekdays("long",!0),1);case"Z":case"ZZ":return vo(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return vo(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return wo(/[a-z_+-/]{1,256}?/i);case" ":return wo(/[^\S\n\r]/);default:return m(f)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return f.token=e,f}(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){const[e,t]=function(e){const t=e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,"");return[`^${t}$`,e]}(this.units);this.regex=RegExp(e,"i"),this.handlers=t}}explainFromTokens(e){if(this.isValid){const[t,n]=function(e,t,n){const r=e.match(t);if(r){const e={};let t=1;for(const i in n)if($r(n,i)){const o=n[i],s=o.groups?o.groups+1:1;!o.literal&&o.token&&(e[o.token.val[0]]=o.deser(r.slice(t,t+s))),t+=s}return[r,e]}return[r,{}]}(e,this.regex,this.handlers),[r,i,o]=n?function(e){let t,n=null;br(e.z)||(n=_n.create(e.z)),br(e.Z)||(n||(n=new Fn(e.Z)),t=e.Z),br(e.q)||(e.M=3*(e.q-1)+1),br(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),br(e.u)||(e.S=Dr(e.u));const r=Object.keys(e).reduce((t,n)=>{const r=(e=>{switch(e){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(n);return r&&(t[r]=e[n]),t},{});return[r,n,t]}(n):[null,null,void 0];if($r(n,"a")&&$r(n,"H"))throw new qt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:o}}return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function So(e,t,n){return new No(e,n).explainFromTokens(t)}function _o(e,t){if(!e)return null;const n=li.create(t,e).dtFormatter((xo||(xo=Xo.fromMillis(1555555555555)),xo)),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>function(e,t,n){const{type:r,value:i}=e;if("literal"===r){const e=/^\s+$/.test(i);return{literal:!e,val:e?" ":i}}const o=t[r];let s=r;"hour"===r&&(s=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let a=bo[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const $o="Invalid DateTime",Co=864e13;function Io(e){return new or("unsupported zone",`the zone "${e.name}" is not supported`)}function To(e){return null===e.weekData&&(e.weekData=mr(e.c)),e.weekData}function Eo(e){return null===e.localWeekData&&(e.localWeekData=mr(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Po(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Xo({...n,...t,old:n})}function Do(e,t,n){let r=e-60*t*1e3;const i=n.offset(r);if(t===i)return[r,t];r-=60*(i-t)*1e3;const o=n.offset(r);return i===o?[r,i]:[e-60*Math.min(i,o)*1e3,Math.max(i,o)]}function zo(e,t){const n=new Date(e+=60*t*1e3);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Ro(e,t,n){return Do(jr(e),t,n)}function Mo(e,t){const n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),o={...e.c,year:r,month:i,day:Math.min(e.c.day,Or(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=so.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),a=jr(o);let[l,c]=Do(a,n,e.zone);return 0!==s&&(l+=s,c=e.zone.offset(l)),{ts:l,o:c}}function Oo(e,t,n,r,i,o){const{setZone:s,zone:a}=n;if(e&&0!==Object.keys(e).length||t){const r=t||a,i=Xo.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Xo.invalid(new or("unparsable",`the input "${i}" can't be parsed as ${r}`))}function jo(e,t,n=!0){return e.isValid?li.create(Ln.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Wo(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=Tr(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=Tr(e.c.month),"month"===n)return i;i+="-"}else if(i+=Tr(e.c.month),"month"===n)return i;return i+=Tr(e.c.day),i}function Ao(e,t,n,r,i,o,s){let a=!n||0!==e.c.millisecond||0!==e.c.second,l="";switch(s){case"day":case"month":case"year":break;default:if(l+=Tr(e.c.hour),"hour"===s)break;if(t){if(l+=":",l+=Tr(e.c.minute),"minute"===s)break;a&&(l+=":",l+=Tr(e.c.second))}else{if(l+=Tr(e.c.minute),"minute"===s)break;a&&(l+=Tr(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(l+=".",l+=Tr(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?l+="Z":e.o<0?(l+="-",l+=Tr(Math.trunc(-e.o/60)),l+=":",l+=Tr(Math.trunc(-e.o%60))):(l+="+",l+=Tr(Math.trunc(e.o/60)),l+=":",l+=Tr(Math.trunc(e.o%60)))),o&&(l+="["+e.zone.ianaName+"]"),l}const Lo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Bo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Fo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},qo=["year","month","day","hour","minute","second","millisecond"],Ho=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Uo=["year","ordinal","hour","minute","second","millisecond"];function Yo(e){const t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new Ht(e);return t}function Zo(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Yo(e)}}function Go(e,t){const n=Hn(t.zone,ir.defaultZone);if(!n.isValid)return Xo.invalid(Io(n));const r=Ln.fromObject(t);let i,o;if(br(e.year))i=ir.now();else{for(const t of qo)br(e[t])&&(e[t]=Lo[t]);const t=vr(e)||wr(e);if(t)return Xo.invalid(t);const r=function(e){if(void 0===Jo&&(Jo=ir.now()),"iana"!==e.type)return e.offset(Jo);const t=e.name;let n=Ko.get(t);return void 0===n&&(n=e.offset(Jo),Ko.set(t,n)),n}(n);[i,o]=Ro(e,r,n)}return new Xo({ts:i,zone:n,loc:r,o:o})}function Vo(e,t,n){const r=!!br(n.round)||n.round,i=br(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=zr(e,r||n.calendary?0:2,n.calendary?"round":i),t.loc.clone(n).relFormatter(n).format(e,o)),s=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return o(s(n.unit),n.unit);for(const e of n.units){const t=s(e);if(Math.abs(t)>=1)return o(t,e)}return o(e>t?-0:0,n.units[n.units.length-1])}function Qo(e){let t,n={};return e.length>0&&"object"==typeof e[e.length-1]?(n=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[n,t]}let Jo;const Ko=new Map;class Xo{constructor(e){const t=e.zone||ir.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new or("invalid input"):null)||(t.isValid?null:Io(t));this.ts=br(e.ts)?ir.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{const o=xr(e.o)&&!e.old?e.o:t.offset(this.ts);r=zo(this.ts,o),n=Number.isNaN(r.year)?new or("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||Ln.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Xo({})}static local(){const[e,t]=Qo(arguments),[n,r,i,o,s,a,l]=t;return Go({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:l},e)}static utc(){const[e,t]=Qo(arguments),[n,r,i,o,s,a,l]=t;return e.zone=Fn.utcInstance,Go({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:l},e)}static fromJSDate(e,t={}){const n=function(e){return"[object Date]"==={}.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(n))return Xo.invalid("invalid input");const r=Hn(t.zone,ir.defaultZone);return r.isValid?new Xo({ts:n,zone:r,loc:Ln.fromObject(t)}):Xo.invalid(Io(r))}static fromMillis(e,t={}){if(xr(e))return e<-Co||e>Co?Xo.invalid("Timestamp out of range"):new Xo({ts:e,zone:Hn(t.zone,ir.defaultZone),loc:Ln.fromObject(t)});throw new Ut(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(xr(e))return new Xo({ts:1e3*e,zone:Hn(t.zone,ir.defaultZone),loc:Ln.fromObject(t)});throw new Ut("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Hn(t.zone,ir.defaultZone);if(!n.isValid)return Xo.invalid(Io(n));const r=Ln.fromObject(t),i=Hr(e,Zo),{minDaysInFirstWeek:o,startOfWeek:s}=yr(i,r),a=ir.now(),l=br(t.specificOffset)?n.offset(a):t.specificOffset,c=!br(i.ordinal),u=!br(i.year),d=!br(i.month)||!br(i.day),h=u||d,m=i.weekYear||i.weekNumber;if((h||c)&&m)throw new qt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&c)throw new qt("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!h;let p,g,y=zo(a,l);f?(p=Ho,g=Bo,y=mr(y,o,s)):c?(p=Uo,g=Fo,y=pr(y)):(p=qo,g=Lo);let v=!1;for(const e of p)br(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=f?function(e,t=4,n=1){const r=kr(e.weekYear),i=Ir(e.weekNumber,1,Ar(e.weekYear,t,n)),o=Ir(e.weekday,1,7);return r?i?!o&&lr("weekday",e.weekday):lr("week",e.weekNumber):lr("weekYear",e.weekYear)}(i,o,s):c?function(e){const t=kr(e.year),n=Ir(e.ordinal,1,Mr(e.year));return t?!n&&lr("ordinal",e.ordinal):lr("year",e.year)}(i):vr(i),b=w||wr(i);if(b)return Xo.invalid(b);const x=f?fr(i,o,s):c?gr(i):i,[k,N]=Ro(x,l,n),S=new Xo({ts:k,zone:n,o:N,loc:r});return i.weekday&&h&&e.weekday!==S.weekday?Xo.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${S.toISO()}`):S.isValid?S:Xo.invalid(S.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return hi(e,[Wi,Fi],[Ai,qi],[Li,Hi],[Bi,Ui])}(e);return Oo(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return hi(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[Pi,Di])}(e);return Oo(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return hi(e,[zi,Oi],[Ri,Oi],[Mi,ji])}(e);return Oo(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(br(e)||br(t))throw new Ut("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Ln.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,l,c]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=So(e,t,n);return[r,i,o,s]}(o,e,t);return c?Xo.invalid(c):Oo(s,a,n,`format ${t}`,e,l)}static fromString(e,t,n={}){return Xo.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return hi(e,[Zi,Fi],[Gi,Vi])}(e);return Oo(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Ut("need to specify a reason the DateTime is invalid");const n=e instanceof or?e:new or(e,t);if(ir.throwOnInvalid)throw new Lt(n);return new Xo({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=_o(e,Ln.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return ko(li.parseFormat(e),Ln.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Jo=void 0,Ko.clear()}get(e){return this[e]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this.ie}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?To(this).weekYear:NaN}get weekNumber(){return this.isValid?To(this).weekNumber:NaN}get weekday(){return this.isValid?To(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Eo(this).weekday:NaN}get localWeekNumber(){return this.isValid?Eo(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Eo(this).weekYear:NaN}get ordinal(){return this.isValid?pr(this.c).ordinal:NaN}get monthShort(){return this.isValid?co.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?co.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?co.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?co.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=jr(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),o=this.zone.offset(n-r*t),s=this.zone.offset(n-i*t);if(o===s)return[this];const a=n-o*t,l=n-s*t,c=zo(a,o),u=zo(l,s);return c.hour===u.hour&&c.minute===u.minute&&c.second===u.second&&c.millisecond===u.millisecond?[Po(this,{ts:a}),Po(this,{ts:l})]:[this]}get isInLeapYear(){return Rr(this.year)}get daysInMonth(){return Or(this.year,this.month)}get daysInYear(){return this.isValid?Mr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Ar(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Ar(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=li.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(Fn.instance(e),t)}toLocal(){return this.setZone(ir.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=Hn(e,ir.defaultZone)).equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||n){const t=e.offset(this.ts),n=this.toObject();[r]=Ro(n,t,e)}return Po(this,{ts:r,zone:e})}return Xo.invalid(Io(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return Po(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Hr(e,Zo),{minDaysInFirstWeek:n,startOfWeek:r}=yr(t,this.loc),i=!br(t.weekYear)||!br(t.weekNumber)||!br(t.weekday),o=!br(t.ordinal),s=!br(t.year),a=!br(t.month)||!br(t.day),l=s||a,c=t.weekYear||t.weekNumber;if((l||o)&&c)throw new qt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new qt("Can't mix ordinal dates with month/day");let u;i?u=fr({...mr(this.c,n,r),...t},n,r):br(t.ordinal)?(u={...this.toObject(),...t},br(t.day)&&(u.day=Math.min(Or(u.year,u.month),u.day))):u=gr({...pr(this.c),...t});const[d,h]=Ro(u,this.o,this.zone);return Po(this,{ts:d,o:h})}plus(e){return this.isValid?Po(this,Mo(this,so.fromDurationLike(e))):this}minus(e){return this.isValid?Po(this,Mo(this,so.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=so.normalizeUnit(e);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0}if("weeks"===r)if(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;if("quarters"===r){const e=Math.ceil(this.month/3);n.month=3*(e-1)+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?li.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):$o}toLocaleString(e=Qt,t={}){return this.isValid?li.create(this.loc.clone(t),e).formatDateTime(this):$o}toLocaleParts(e={}){return this.isValid?li.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const s="extended"===e;let a=Wo(this,s,o=Yo(o));return qo.indexOf(o)>=3&&(a+="T"),a+=Ao(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Wo(this,"extended"===e,Yo(t)):null}toISOWeekDate(){return jo(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:s="milliseconds"}={}){return this.isValid?(s=Yo(s),(r&&qo.indexOf(s)>=3?"T":"")+Ao(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return jo(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return jo(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Wo(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(t||e)&&(n&&(r+=" "),t?r+="z":e&&(r+="ZZ")),jo(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():$o}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return so.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=(a=t,Array.isArray(a)?a:[a]).map(so.normalizeUnit),o=e.valueOf()>this.valueOf(),s=function(e,t,n,r){let[i,o,s,a]=function(e,t,n){const r=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const n=uo(e,t);return(n-n%7)/7}],["days",uo]],i={},o=e;let s,a;for(const[l,c]of r)n.indexOf(l)>=0&&(s=l,i[l]=c(e,t),a=o.plus(i),a>t?(i[l]--,(e=o.plus(i))>t&&(a=e,i[l]--,e=o.plus(i))):e=a);return[e,i,a,s]}(e,t,n);const l=t-i,c=n.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===c.length&&(s<t&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+l/(s-i)));const u=so.fromObject(o,r);return c.length>0?so.fromMillis(l,r).shiftTo(...c).plus(u):u}(o?this:e,o?e:this,i,r);var a;return o?s.negate():s}diffNow(e="milliseconds",t={}){return this.diff(Xo.now(),e,t)}until(e){return this.isValid?lo.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||Xo.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(r=e.unit,i=void 0),Vo(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Vo(e.base||Xo.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(Xo.isDateTime))throw new Ut("min requires all arguments be DateTimes");return _r(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(Xo.isDateTime))throw new Ut("max requires all arguments be DateTimes");return _r(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return So(Ln.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return Xo.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=Ln.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new No(i,e)}static fromFormatParser(e,t,n={}){if(br(e)||br(t))throw new Ut("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Ln.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new Ut(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:s,zone:a,specificOffset:l,invalidReason:c}=t.explainFromTokens(e);return c?Xo.invalid(c):Oo(s,a,n,`format ${t.format}`,e,l)}static get DATE_SHORT(){return Qt}static get DATE_MED(){return Jt}static get DATE_MED_WITH_WEEKDAY(){return Kt}static get DATE_FULL(){return Xt}static get DATE_HUGE(){return en}static get TIME_SIMPLE(){return tn}static get TIME_WITH_SECONDS(){return nn}static get TIME_WITH_SHORT_OFFSET(){return rn}static get TIME_WITH_LONG_OFFSET(){return on}static get TIME_24_SIMPLE(){return sn}static get TIME_24_WITH_SECONDS(){return an}static get TIME_24_WITH_SHORT_OFFSET(){return ln}static get TIME_24_WITH_LONG_OFFSET(){return cn}static get DATETIME_SHORT(){return un}static get DATETIME_SHORT_WITH_SECONDS(){return dn}static get DATETIME_MED(){return hn}static get DATETIME_MED_WITH_SECONDS(){return mn}static get DATETIME_MED_WITH_WEEKDAY(){return fn}static get DATETIME_FULL(){return pn}static get DATETIME_FULL_WITH_SECONDS(){return gn}static get DATETIME_HUGE(){return yn}static get DATETIME_HUGE_WITH_SECONDS(){return vn}}function es(e){if(Xo.isDateTime(e))return e;if(e&&e.valueOf&&xr(e.valueOf()))return Xo.fromJSDate(e);if(e&&"object"==typeof e)return Xo.fromObject(e);throw new Ut(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function ts({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return Fe("div",{className:$t.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:wt.colors.accent}),children:Fe("div",{className:$t.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1",boxSizing:"border-box",overflowX:"hidden"}),children:[!i&&Fe("div",{className:$t.create("page-heading-wrapper",{width:"100%",marginBottom:wt.spacing.lg}),children:Fe(Rt,{children:Fe("div",{className:$t.create("page-heading-container",{backgroundColor:wt.colors.primary,color:wt.colors.primaryForeground,borderRadius:wt.radius.large,padding:`${wt.spacing.lg} ${wt.spacing.xl}`,boxShadow:wt.shadow.md}),children:Fe("div",{className:$t.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:wt.spacing.lg}),children:Fe("div",{className:$t.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Fe("h1",{className:$t.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:wt.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&Fe("p",{className:$t.create("page-template-description",{margin:"0",marginTop:wt.spacing.sm,fontSize:wt.fontSize.small,lineHeight:"1.5",color:wt.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function ns({className:e,children:t}){const n=$t.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Fe("div",{className:Dt(n,e),children:t})}function rs({message:e}){return Fe(ts,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe(ns,{className:$t.name("loading-container"),children:Fe(zt,{size:"large"})})})})}function is({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const l={primary:{backgroundColor:wt.colors.primary,color:wt.colors.primaryForeground,boxShadow:wt.shadow.sm},outline:{border:`${wt.borderWidth} solid ${wt.colors.primary}`,backgroundColor:wt.colors.card,color:wt.colors.primary,boxShadow:wt.shadow.sm}},c=$t.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:wt.radius.default,cursor:"pointer",fontSize:wt.fontSize.default,fontWeight:"500",transition:wt.transition,fontFamily:wt.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"}),u=$t.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"});$t.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:wt.shadow.md}),$t.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:wt.shadow.sm});const d=$t.create(`button-${e}`,{...l[e]});return Fe("button",{type:t,className:Dt(c,u,d,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Fe(zt,{size:"small"}),o]})}function os({error:e}){const t=e||{title:"Something Went Wrong",message:"We're unable to load the application at this time."},n=t.trackingId?t.trackingId.replace(/[^a-zA-Z0-9]/g,"").slice(0,8).toUpperCase():null;return Fe(ts,{title:t.title,noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe("div",{className:$t.create("error-page-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Fe("div",{className:$t.create("error-page-card",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"500px"}),children:[Fe("div",{className:$t.create("error-page-header",{paddingInline:wt.spacing.xl,paddingTop:wt.spacing.xl,paddingBottom:wt.spacing.lg,textAlign:"center"},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingTop:wt.spacing.md}}),children:[Fe("div",{className:$t.create("error-page-icon-wrapper",{display:"flex",justifyContent:"center",marginBottom:wt.spacing.lg}),children:Fe("div",{className:$t.create("error-page-icon-circle",{width:"4rem",height:"4rem",borderRadius:"50%",backgroundColor:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center"}),children:Fe("svg",{className:$t.create("error-page-icon",{width:"2rem",height:"2rem",color:wt.colors.destructive}),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Fe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})})}),Fe("h2",{className:$t.create("error-page-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:t.title}),Fe("p",{className:$t.create("error-page-description",{margin:"0",marginTop:wt.spacing.sm,fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.mutedForeground}),children:t.message})]}),Fe("div",{className:$t.create("error-page-content",{paddingInline:wt.spacing.xl,paddingBottom:wt.spacing.xl},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingBottom:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingBottom:wt.spacing.md}}),children:[n&&Fe("p",{className:$t.create("error-page-support",{margin:"0",marginBottom:wt.spacing.lg,fontSize:wt.fontSize.small,lineHeight:"1.5",color:wt.colors.mutedForeground,textAlign:"center"}),children:["If this problem persists, please contact support with reference"," ",Fe("span",{className:$t.create("error-page-ref",{fontFamily:"monospace",fontWeight:"600",color:wt.colors.foreground}),children:n})]}),Fe(is,{onClick:()=>{window.location.reload()},className:$t.create("error-page-button",{width:"100%"}),children:"Try Again"})]})]})})})})}function ss({message:e,estimatedTime:t}){const n=$t.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=$t.create("maintenance-icon",{width:"4rem",height:"4rem",color:wt.colors.primary,marginBottom:"1.5rem"}),i=$t.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:wt.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=$t.create("maintenance-message",{fontSize:wt.fontSize.default,color:wt.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=$t.create("maintenance-info-box",{backgroundColor:wt.colors.muted,borderRadius:wt.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=$t.create("maintenance-info-title",{fontSize:wt.fontSize.default,fontWeight:"600",color:wt.colors.foreground,marginBottom:"0.5rem"}),l=$t.create("maintenance-info-text",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,lineHeight:"1.4"}),c=$t.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Fe(ts,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Fe(Rt,{children:Fe(ns,{children:Fe("div",{className:n,children:[Fe(()=>Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:r,children:Fe("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),{}),Fe("h1",{className:i,children:"We'll be right back"}),Fe("p",{className:o,children:e||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Fe("div",{className:s,children:[Fe("p",{className:a,children:"What's happening?"}),Fe("p",{className:l,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),t&&Fe("p",{className:l,style:{marginTop:"0.5rem"},children:[Fe("strong",{children:"Estimated time:"})," ",t]})]}),Fe("div",{className:c,children:Fe(is,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function as({size:e="default",style:t="normal",className:n,children:r}){const i=$t.create("text",{marginTop:"0",marginBottom:"0"}),o=$t.create("text-small",{fontSize:wt.fontSize.small}),s=$t.create("text-default",{fontSize:wt.fontSize.default}),a=$t.create("text-italic",{fontStyle:"italic"}),l=$t.create("text-bold",{fontWeight:"bold"}),c=$t.create("text-underline",{textDecoration:"underline"}),u=Dt({[a]:"italic"===t,[l]:"bold"===t,[c]:"underline"===t}),d=Dt({[o]:"small"===e,[s]:"default"===e});return Fe("p",{className:Dt(i,d,u,n),children:r})}function ls({title:e,description:t}){return Fe("div",{className:$t.create("section-header",{}),children:[Fe("h3",{className:$t.create("section-title",{fontSize:wt.fontSize.large,fontWeight:"600",margin:"0",color:wt.colors.foreground}),children:e}),t&&Fe(as,{className:$t.create("section-description",{color:wt.colors.mutedForeground,margin:"0.25rem 0 0 0"}),children:"Choose your excess amount - the amount you'll pay if you need to make a claim"})]})}function cs({selected:e}){return Fe("div",{className:Dt($t.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${wt.borderWidth} solid transparent`}),e?$t.create("selected-indicator-selected",{backgroundColor:wt.colors.primary}):$t.create("selected-indicator-unselected",{border:`${wt.borderWidth} solid ${wt.colors.border}`}))})}function us({excessOptions:e,selectedExcessId:t,onExcessSelect:n}){const r=[...e].sort((e,t)=>e.excess_amount-t.excess_amount),i=e.find(e=>e.id===t);return Fe("div",{className:$t.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Fe(ls,{title:1===e.length?"Excess":"Excess Options"}),Fe("div",{className:$t.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Fe("div",{className:Dt($t.create("excess-option-card",{borderRadius:wt.radius.default,minWidth:"125px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?$t.create("excess-option-card-selected",{border:`2px solid ${wt.colors.primary}`,backgroundColor:wt.colors.accent}):$t.create("excess-option-card-unselected",{border:`2px solid ${wt.colors.border}`,backgroundColor:wt.colors.card})),onClick:()=>n(e.id),children:[Fe(cs,{selected:r}),Fe("div",{className:$t.create("excess-amount",{color:wt.colors.foreground}),children:[e.excess_label||`$${Number(e.excess_amount).toFixed(0)}`,e.description?"*":""]})]},e.id)})}),(null==i?void 0:i.description)&&Fe("div",{className:$t.create("excess-description",{padding:"0.75rem",backgroundColor:wt.colors.muted,borderRadius:wt.radius.default,border:`1px solid ${wt.colors.border}`}),children:Fe(as,{className:$t.create("excess-description-text",{fontSize:wt.fontSize.small,color:wt.colors.foreground,margin:"0"}),children:i.description})})]})}function ds(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function hs(e,t){return"bank_transfer"===t?"Bank Transfer":"one-time"===e?"Online Payment":"monthly"===e?"Monthly Installments":`${e.charAt(0).toUpperCase()}${e.slice(1)} Installments`}function ms({paymentOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=st(()=>{if(!n)return[];const r=e.filter(e=>e.excess_id===n).map(e=>{const n=t.find(t=>t.id===e.gateway_id);if(!n)throw new Error(`Gateway not found for option: ${e.gateway_id}`);return{...e,gateway:n}});return r.sort((e,t)=>{var n,r;return e.amount.success!==t.amount.success?e.amount.success?-1:1:("one-time"===e.amount.frequency?Number(e.amount.dueToday):Number(null!==(n=e.amount.installmentAmount)&&void 0!==n?n:0))-("one-time"===t.amount.frequency?Number(t.amount.dueToday):Number(null!==(r=t.amount.installmentAmount)&&void 0!==r?r:0))})},[e,t,n]);return n?Fe(fs,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Fe("div",{className:$t.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Fe(fs,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function fs({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return Fe("div",{className:$t.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Fe(ls,{title:"Payment Options"}),Fe("div",r?{className:$t.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Fe(ps,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${e.excess_id}`))}:{className:$t.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${wt.colors.border}`,borderRadius:wt.radius.default,backgroundColor:wt.colors.muted}),children:Fe(as,{className:$t.create("placeholder-text",{color:wt.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function ps({option:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=(null==t?void 0:t.gateway_id)===e.gateway_id&&(null==t?void 0:t.excess_id)===e.excess_id,i=e.amount.success,o=()=>i?"one-time"===e.amount.frequency?ds(e.amount.dueToday):`${ds(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`:"Currently Unavailable",s=()=>e.gateway.description?e.gateway.description:"bank_transfer"===e.gateway.code?"Manual":`via ${e.gateway.name}`;return Fe("div",{className:Dt($t.create("payment-option-row",{borderRadius:wt.radius.default,padding:"0.75rem 1rem",cursor:i?"pointer":"not-allowed",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",opacity:i?"1":"0.6"},{"(max-width: 950px)":{padding:"0.75rem",flexDirection:"column",alignItems:"stretch",gap:"0.25rem"}}),r?$t.create("payment-option-row-selected",{border:`2px solid ${wt.colors.primary}`,backgroundColor:wt.colors.accent}):$t.create("payment-option-row-unselected",{border:`2px solid ${wt.colors.border}`,backgroundColor:wt.colors.card})),onClick:()=>i&&n(e),children:[Fe("div",{className:$t.create("payment-option-desktop-wrapper",{display:"flex",flexDirection:"column",flex:"1"},{"(max-width: 950px)":{display:"none"}}),children:[Fe("div",{className:$t.create("frequency-title",{fontSize:wt.fontSize.default,fontWeight:"500",color:wt.colors.foreground}),children:e.gateway.display_title||hs(e.amount.frequency,e.gateway.code)}),Fe("div",{className:$t.create("gateway-description",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground}),children:s()})]}),Fe("div",{className:$t.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 950px)":{display:"none"}}),children:[Fe(as,{className:i?$t.create("amount-text",{textAlign:"right",color:wt.colors.foreground,fontStyle:"normal"}):$t.create("amount-text-unavailable",{textAlign:"right",color:wt.colors.mutedForeground,fontStyle:"italic"}),children:o()}),i&&"bank_transfer"!==e.gateway.code&&Fe(as,{size:"small",className:$t.create("gateway-fee-text",{textAlign:"right",color:wt.colors.mutedForeground}),children:[ds(e.amount.gatewayFee)," fee"]}),i&&"bank_transfer"===e.gateway.code&&Fe(as,{size:"small",className:$t.create("no-fee-text",{textAlign:"right",color:wt.colors.mutedForeground}),children:"No fees"})]}),Fe("div",{className:$t.create("payment-option-mobile-wrapper",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:"0.125rem"}}),children:[Fe("div",{className:$t.create("payment-option-title-mobile",{fontSize:wt.fontSize.default,fontWeight:"500",color:wt.colors.foreground}),children:e.gateway.display_title||hs(e.amount.frequency,e.gateway.code)}),Fe(as,{className:i?$t.create("amount-text-mobile",{fontWeight:"500",color:wt.colors.foreground,fontStyle:"normal"}):$t.create("amount-text-mobile-unavailable",{fontWeight:"500",color:wt.colors.mutedForeground,fontStyle:"italic"}),children:[o(),i&&e.amount.gatewayFee>0&&Fe("span",{className:$t.create("gateway-fee-inline",{fontWeight:"400",fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,marginLeft:"0.375rem"}),children:["(",ds(e.amount.gatewayFee)," fee)"]})]}),Fe("div",{className:$t.create("gateway-description-mobile",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground}),children:s()})]})]})}const gs=e=>{try{return new Date(e).toLocaleDateString("en-NZ",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}};function ys({excessOptions:e,selectedExcessId:t,onEditQuote:n,isEditingQuote:r=!1,productName:i,quoteIntent:o,embedded:s=!1}){const a=st(()=>t?e.find(e=>e.id===t):null,[e,t]),l=(null==a?void 0:a.line_item_display)||[],{formProgress:c}=Wt(e=>({formProgress:e.getFormProgress()})),u=st(()=>{var e;const t=(null==c?void 0:c.page_data)||(null===(e=null==o?void 0:o.form_data)||void 0===e?void 0:e.page_data);if(!t)return null;let n={};for(const e in t){const r=t[e];r&&"object"==typeof r&&(r.client_first_name&&(n.firstName=r.client_first_name),r.client_last_name&&(n.lastName=r.client_last_name),r.client_email&&(n.email=r.client_email),r.client_phone&&(n.phone=r.client_phone),r.client_dob&&(n.dob=r.client_dob))}return Object.keys(n).length>0?n:null},[c,o]);return Fe("div",{className:$t.create(s?"cart-summary-container-embedded":"cart-summary-container",s?{}:{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.lg,boxShadow:wt.shadow.sm},s?{}:{"(max-width: 768px)":{padding:wt.spacing.md}}),children:[Fe("h3",{className:$t.create("cart-summary-title",{fontSize:wt.fontSize.large,fontWeight:"600",marginBottom:wt.spacing.md,color:wt.colors.foreground}),children:"Insurance Details"}),u&&Fe($,{children:[Fe("div",{className:$t.create("cart-client-details",{display:"flex",flexDirection:"column",gap:wt.spacing.sm,marginBottom:wt.spacing.md}),children:[u.firstName&&u.lastName&&Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Name"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:[u.firstName," ",u.lastName]})]}),u.email&&Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Email"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:u.email})]}),u.phone&&Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Phone"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:u.phone})]}),u.dob&&Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Date of Birth"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:gs(u.dob)})]})]}),Fe("hr",{className:$t.create("divider",{border:"none",borderTop:`1px solid ${wt.colors.border}`,margin:`${wt.spacing.md} 0`})})]}),Fe("div",{className:$t.create("cart-product-section",{display:"flex",flexDirection:"column",gap:wt.spacing.sm,marginBottom:wt.spacing.lg}),children:l.map((e,t)=>Fe("div",{className:$t.create("cart-item",{display:"flex",flexDirection:"column",gap:wt.spacing.sm}),children:[Fe("div",{className:$t.create("cart-item-description",{fontSize:wt.fontSize.small,fontWeight:"500",color:wt.colors.foreground}),children:e.description}),e.show_sum_insured&&e.sum_insured&&Fe("div",{className:$t.create("cart-item-sum-insured",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground}),children:["Sum Insured: ",ds(e.sum_insured)]})]},t))}),Fe(is,{onClick:n,disabled:r,variant:"outline",className:$t.create("edit-quote-button",{width:"100%"}),children:r?"Clearing quote...":"Edit details"})]})}function vs({clauses:e}){const[t,n]=rt(!0);return 0===e.length?null:Fe("div",{className:$t.create("policy-clauses-section",{borderRadius:wt.radius.default,border:`1px solid ${wt.colors.border}`,overflow:"hidden"}),children:[Fe("button",{type:"button",onClick:()=>n(!t),className:$t.create("policy-clauses-toggle",{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:`${wt.spacing.sm} ${wt.spacing.md}`,background:"none",border:"none",cursor:"pointer",fontFamily:"inherit",textAlign:"left"}),children:[Fe("div",{className:$t.create("policy-clauses-header",{display:"flex",alignItems:"center",gap:wt.spacing.sm}),children:[Fe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:wt.colors.mutedForeground,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[Fe("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Fe("polyline",{points:"14 2 14 8 20 8"}),Fe("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),Fe("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),Fe("polyline",{points:"10 9 9 9 8 9"})]}),Fe("span",{className:$t.create("policy-clauses-title",{fontSize:wt.fontSize.small,fontWeight:"500",color:wt.colors.foreground,opacity:"0.7"}),children:"Policy Clauses"})]}),Fe("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:wt.colors.mutedForeground,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{transition:"transform 0.2s ease",transform:t?"rotate(180deg)":"rotate(0deg)"},children:Fe("polyline",{points:"6 9 12 15 18 9"})})]}),t&&Fe("div",{className:$t.create("policy-clauses-content",{padding:`0 ${wt.spacing.md} ${wt.spacing.md}`,borderTop:`1px solid ${wt.colors.border}`,paddingTop:wt.spacing.md}),children:Fe("ul",{className:$t.create("policy-clauses-list",{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:wt.spacing.sm}),children:e.map((e,t)=>Fe("li",{className:$t.create("policy-clause-item",{fontSize:wt.fontSize.small,color:wt.colors.foreground,opacity:"0.7",lineHeight:"1.5",paddingLeft:wt.spacing.md,position:"relative"}),children:[Fe("span",{className:$t.create("policy-clause-bullet",{position:"absolute",left:"0",top:"0.6em",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:wt.colors.mutedForeground,opacity:"0.5"})}),e.note||e.reference||""]},t))})})]})}function ws({label:e,value:t,isTotal:n=!1,className:r}){return Fe("div",{className:Dt($t.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Fe("span",{className:$t.create("summary-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:e}),Fe("span",{className:$t.create("summary-value",{fontWeight:n?"600":"500",color:wt.colors.foreground,fontSize:n?wt.fontSize.large:"inherit"}),children:t})]})}function bs({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:l=!1}){var c;return st(()=>n?e.find(e=>e.id===n):null,[e,n]),st(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]),Fe("div",{className:$t.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[r&&Fe("div",{className:$t.create("summary-section",{paddingBottom:"1rem"}),children:Fe("div",{className:$t.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Fe($,{children:[r.amount.gatewayFee>0&&Fe(ws,{label:"Provider Fee:",value:ds(r.amount.gatewayFee)}),Fe(ws,{label:"Due Today:",value:ds(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0})]}):Fe($,{children:[r.amount.gatewayFee>0&&Fe(ws,{label:"Provider Fee:",value:ds(r.amount.gatewayFee)}),r.amount.totalRepayable&&Fe(ws,{label:"Total Payable:",value:ds(Number(r.amount.totalRepayable)+Number(null!==(c=r.amount.gatewayFee)&&void 0!==c?c:0))}),Fe(ws,{label:"Due Today:",value:ds(r.amount.dueToday)}),r.amount.installmentAmount&&r.amount.numberOfInstallments&&r.amount.numberOfInstallments>1&&Fe(ws,{label:"Remaining payments:",value:`${r.amount.numberOfInstallments-1} x ${ds(r.amount.installmentAmount)}`})]})})}),l&&Fe("div",{className:$t.create("continue-later-success",{backgroundColor:`${wt.colors.accent}`,padding:"12px 16px",borderRadius:wt.radius.default,borderLeft:`4px solid ${wt.colors.primary}`}),children:[Fe("h4",{className:$t.create("success-title",{margin:"0 0 4px 0",color:wt.colors.primary,fontSize:wt.fontSize.default,fontWeight:"600"}),children:"No problem!"}),Fe("p",{className:$t.create("success-text",{margin:"0",fontSize:wt.fontSize.small}),children:"A link will be sent to you by email. You can complete your purchase at any time using the link in the email."})]}),s&&Fe(is,{onClick:s,disabled:a,variant:"outline",className:$t.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:wt.fontSize.default,fontWeight:"500"},{"(max-width: 380px)":{fontSize:wt.fontSize.small,height:"2.5rem"}}),children:a?"Sending...":"Continue Later (Email Me)"}),Fe(is,{onClick:i,disabled:!o,className:$t.create("purchase-button",{width:"100%",height:"3rem",fontSize:wt.fontSize.default,fontWeight:"600"},{"(max-width: 380px)":{fontSize:wt.fontSize.small,height:"2.75rem"}}),children:o?"Go to Payment":n?"Select Payment Option":"Select Excess"})]})}function xs({details:e,onClose:t}){const n=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{})};return Fe("div",{className:$t.create("bank-transfer-container",{display:"flex",flexDirection:"column",gap:wt.spacing.lg}),children:[Fe("div",{className:$t.create("success-message",{backgroundColor:wt.colors.accent,border:`2px solid ${wt.colors.primary}`,borderRadius:wt.radius.default,padding:wt.spacing.lg,textAlign:"center"}),children:[Fe("div",{className:$t.create("success-icon",{fontSize:"3rem",marginBottom:wt.spacing.sm}),children:"✓"}),Fe("h3",{className:$t.create("success-title",{margin:"0",marginBottom:wt.spacing.sm,color:wt.colors.primary,fontSize:wt.fontSize.large,fontWeight:"600"}),children:"Quote Reserved"}),Fe(as,{className:$t.create("success-description",{margin:"0",color:wt.colors.foreground,opacity:"0.9"}),children:"Your quote has been reserved. Please complete the bank transfer to finalize your coverage."})]}),Fe("div",{className:$t.create("transfer-instructions",{backgroundColor:wt.colors.card,border:`1px solid ${wt.colors.border}`,borderRadius:wt.radius.default,padding:wt.spacing.lg}),children:[Fe("h4",{className:$t.create("instructions-title",{margin:"0",marginBottom:wt.spacing.md,fontSize:wt.fontSize.default,fontWeight:"600",color:wt.colors.foreground}),children:"Bank Transfer Instructions"}),Fe("div",{className:$t.create("instructions-grid",{display:"grid",gap:wt.spacing.md}),children:[Fe("div",{className:$t.create("detail-row-highlighted",{backgroundColor:wt.colors.accent,border:`2px solid ${wt.colors.primary}`,borderRadius:wt.radius.default,padding:wt.spacing.md}),children:[Fe("div",{className:$t.create("detail-label",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,marginBottom:"0.25rem",fontWeight:"500"}),children:"Reference Number (IMPORTANT)"}),Fe("div",{className:$t.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Fe("code",{className:$t.create("detail-value-code",{fontFamily:"monospace",fontSize:wt.fontSize.large,fontWeight:"700",color:wt.colors.primary,letterSpacing:"0.05em"}),children:e.reference}),Fe("button",{onClick:()=>n(e.reference,"Reference"),className:$t.create("copy-button",{background:"transparent",border:`1px solid ${wt.colors.primary}`,borderRadius:wt.radius.small,padding:"0.25rem 0.5rem",cursor:"pointer",fontSize:wt.fontSize.small,color:wt.colors.primary,transition:"all 150ms ease"}),children:"Copy"})]}),Fe(as,{size:"small",className:$t.create("reference-note",{marginTop:"0.5rem",marginBottom:"0",color:wt.colors.foreground,fontWeight:"500"}),children:"⚠️ Please include this reference in your transfer particulars"})]}),Fe("div",{className:$t.create("detail-row",{}),children:[Fe("div",{className:$t.create("detail-label",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Amount"}),Fe("div",{className:$t.create("detail-value",{fontSize:wt.fontSize.large,fontWeight:"600",color:wt.colors.foreground}),children:["$",e.amount.toFixed(2)," ",e.currency]})]}),Fe("div",{className:$t.create("detail-row",{}),children:[Fe("div",{className:$t.create("detail-label",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Name"}),Fe("div",{className:$t.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Fe("span",{className:$t.create("detail-value",{fontFamily:"monospace",fontSize:wt.fontSize.default,color:wt.colors.foreground}),children:e.bank_account_name}),Fe("button",{onClick:()=>n(e.bank_account_name,"Account name"),className:$t.create("copy-button-small",{background:"transparent",border:`1px solid ${wt.colors.border}`,borderRadius:wt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]}),Fe("div",{className:$t.create("detail-row",{}),children:[Fe("div",{className:$t.create("detail-label",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Number"}),Fe("div",{className:$t.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Fe("span",{className:$t.create("detail-value",{fontFamily:"monospace",fontSize:wt.fontSize.default,color:wt.colors.foreground}),children:e.bank_account_number}),Fe("button",{onClick:()=>n(e.bank_account_number,"Account number"),className:$t.create("copy-button-small",{background:"transparent",border:`1px solid ${wt.colors.border}`,borderRadius:wt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]})]}),e.instructions_html&&Fe("div",{className:$t.create("additional-instructions",{marginTop:wt.spacing.md,paddingTop:wt.spacing.md,borderTop:`1px solid ${wt.colors.border}`}),children:Fe("div",{className:$t.create("instructions-content",{fontSize:wt.fontSize.small,color:wt.colors.foreground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:e.instructions_html}})})]}),Fe("div",{className:$t.create("important-note",{backgroundColor:wt.colors.muted,border:`1px solid ${wt.colors.border}`,borderRadius:wt.radius.default,padding:wt.spacing.md}),children:Fe(as,{size:"small",className:$t.create("note-text",{margin:"0",color:wt.colors.foreground,lineHeight:"1.5"}),children:[Fe("strong",{children:"Important:"})," Your coverage will be activated once we verify receipt of your payment. This typically takes 1-2 business days. We'll send you a confirmation email once your payment is processed."]})}),Fe("div",{className:$t.create("actions",{display:"flex",justifyContent:"center"}),children:Fe(is,{onClick:t,variant:"primary",children:"I've Made the Transfer"})})]})}function ks({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r}){const{fsm:i}=Wt(()=>({})),[o,s]=rt("initiating"),[a,l]=rt(null),[c,u]=rt(null),[d,h]=rt(null),[m,f]=rt(null);it(()=>{e&&r&&p()},[e,r]);const p=async()=>{if(r)try{s("initiating"),l(null);const e={...r,returnUrl:window.location.href},t=await i.initiatePayment(e);if(h(t.transaction_id),t.bank_account_name&&t.reference){s("bank_transfer");const e=i.getQuoteIntent(),t=await i.httpClient.getQuoteIntent(e.url);i.updateQuoteIntent({status:t.quote_intent.status,payment_transactions:t.payment_transactions}),i.getQuoteIntent(),setTimeout(()=>{g()},500)}else{if(!t.gateway_acceptance_url)throw new Error("Invalid payment response");s("redirecting"),window.location.href=t.gateway_acceptance_url}}catch(e){l(e.message||"Failed to initiate payment"),s("failed")}},g=()=>{c&&!c.closed&&c.close(),s("initiating"),l(null),h(null),u(null),f(null),t()},y=()=>{g(),n()};return e?Fe("div","bank_transfer"===o&&m?{className:$t.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000",overflowY:"auto",padding:"1rem"}),onClick:e=>{e.target===e.currentTarget&&y()},children:Fe("div",{className:$t.create("modal-content",{backgroundColor:wt.colors.background,borderRadius:wt.radius.large,padding:"2rem",maxWidth:"600px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${wt.colors.border}`,margin:"auto"}),onClick:e=>e.stopPropagation(),children:Fe(xs,{details:m,onClose:y})})}:{className:$t.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),children:[Fe("div",{className:$t.create("modal-content",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${wt.colors.border}`}),children:[Fe("div",{className:$t.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Fe("div",{className:$t.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Fe("h2",{className:$t.create("modal-title",{margin:"0",color:wt.colors.foreground,fontSize:wt.fontSize.large}),children:"Payment Processing"})]}),Fe("div",{className:$t.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Fe(as,{className:$t.create("status-message",{fontSize:wt.fontSize.default,color:wt.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(o){case"initiating":return"Setting up your payment...";case"redirecting":return"Redirecting to payment portal...";case"processing":default:return"Processing payment...";case"polling":return"Checking payment status...";case"completed":return"Payment completed successfully!";case"cancelled":return"Payment was cancelled";case"failed":return"Payment failed"}})()}),a&&Fe(as,{className:$t.create("error-message",{color:wt.colors.destructive,fontSize:wt.fontSize.small,padding:"0.75rem",backgroundColor:wt.colors.destructive+"10",borderRadius:wt.radius.default,border:`1px solid ${wt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Fe("div",{className:$t.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${wt.colors.border}`,borderTop:`3px solid ${wt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Fe("div",{className:$t.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Fe($,{children:[Fe(is,{onClick:g,variant:"outline",children:"Close"}),"cancelled"===o&&Fe(is,{onClick:()=>{s("initiating"),l(null),p()},children:"Try Again"})]}):Fe(is,"completed"===o?{onClick:g,children:"Continue"}:{onClick:g,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Fe("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Ns({type:e,transactionId:t,isOpen:n,onClose:r}){if(!n)return null;const i=(()=>{switch(e){case"success":return{title:"Payment Successful!",message:"Your payment has been processed successfully and your policy is now active.",icon:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:wt.colors.primary||"#10b981"},children:Fe("path",{d:"M20 6 9 17l-5-5"})}),buttonText:"Close"};case"declined":return{title:"Payment Declined",message:"Your payment was declined by the payment processor. Please try a different payment method or contact your bank.",icon:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:wt.colors.destructive},children:[Fe("circle",{cx:"12",cy:"12",r:"10"}),Fe("path",{d:"m15 9-6 6"}),Fe("path",{d:"m9 9 6 6"})]}),buttonText:"Close"};case"cancelled":return{title:"Payment Cancelled",message:"You cancelled the payment process. You can try again when you're ready.",icon:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:wt.colors.secondary},children:[Fe("circle",{cx:"12",cy:"12",r:"10"}),Fe("path",{d:"m15 9-6 6"}),Fe("path",{d:"m9 9 6 6"})]}),buttonText:"Continue"};default:return{title:"Payment Error",message:"There was an issue processing your payment. Please try again or contact support if the problem persists.",icon:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:wt.colors.destructive},children:[Fe("circle",{cx:"12",cy:"12",r:"10"}),Fe("path",{d:"M12 8v4"}),Fe("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=$t.create("modal-overlay",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000",padding:"1rem"}),s=$t.create("modal-content",{backgroundColor:wt.colors.background,borderRadius:wt.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${wt.borderWidth} solid ${wt.colors.border}`}),a=$t.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),l=$t.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:wt.colors.foreground,margin:"0"}),c=$t.create("modal-message",{color:wt.colors.foreground,lineHeight:"1.5",margin:"0"});$t.create("transaction-info",{backgroundColor:wt.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:wt.radius.small,border:`${wt.borderWidth} solid ${wt.colors.border}`,fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,wordBreak:"break-all"});const u=$t.create("modal-button",{backgroundColor:wt.colors.primary,color:wt.colors.primaryForeground,border:"none",borderRadius:wt.radius.default,padding:"0.75rem 1.5rem",fontSize:wt.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=$t.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Fe("div",{className:o,onClick:r,children:Fe("div",{className:s,onClick:e=>e.stopPropagation(),children:Fe("div",{className:a,children:[i.icon,Fe("div",{className:d,children:[Fe("h2",{className:l,children:i.title}),Fe("p",{className:c,children:i.message})]}),Fe("button",{className:u,onClick:r,children:i.buttonText})]})})})}function Ss({results:e}){const{fsm:t,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=Wt(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[s,a]=rt(!1),[l,c]=rt(null),[u,d]=rt(!1),[h,m]=rt(!1),[f,p]=rt(!1),g=new URLSearchParams(window.location.search),y=g.get("status"),v=g.get("transactionId")||g.get("transaction_id"),[w,b]=rt(!(!y||"failed"!==y&&"declined"!==y&&"cancelled"!==y)),x=e.calculations,k=e.payment_options,N=e.payment_gateways;it(()=>{const e=x.find(e=>e.id===n);if(e&&i){const n=k.some(e=>"monthly"===e.amount.frequency),r=t.getPageCompletionStatus(),o=Math.round(r.completedPages.length/r.totalPages*100);ze(i,e,k.length,n,o)}},[]),it(()=>{if(!r||!n)return;const e=x.find(e=>e.id===n);if(!e)return;if(r.calculation_id===e.calculation_id)return;const i=k.find(t=>t.gateway_id===r.gateway_id&&t.calculation_id===e.calculation_id&&t.amount.frequency===r.amount.frequency);i?t.setSelectedPaymentOption(i):t.setSelectedPaymentOption(null)},[n,r,x,k,t]);const S=()=>{if(!n||!r)return void alert("Please select both an excess amount and payment option");const t={quoteIntentId:e.quote_intent.id,excessId:n,gatewayId:r.gateway_id,calculationId:r.calculation_id,clientDetails:{legalName:"Test"}};c(t),a(!0)},_=async()=>{try{p(!0),await t.clearCalculationResults(),t.navigateToPage(0)}catch(e){alert("Failed to edit quote. Please try again."),p(!1)}},$=async()=>{var t,s;try{let t;m(!0);const s=null==i?void 0:i.form_data;if(null==s?void 0:s.page_data)for(const e in s.page_data){const n=s.page_data[e];if(n&&"object"==typeof n&&n.client_email){t=n.client_email;break}}if(!t)return void alert("Email address not found. Please try again.");const a={source:"checkout_page"};n&&(a.selected_excess_id=n),(null==r?void 0:r.gateway_id)&&(a.selected_gateway_id=r.gateway_id),(null==r?void 0:r.calculation_id)&&(a.selected_calculation_id=r.calculation_id),await o.createQuotePaymentLink(e.quote_intent.id,{email:t,metadata:a}),d(!0)}catch(e){let n="Failed to send payment link. ";(null===(s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.message)?n+=e.response.data.message:(null==e?void 0:e.message)?n+=e.message:n+="Please try again.",alert(n)}finally{m(!1)}},C=Boolean(n&&r),I=null==i?void 0:i.payment_return,T=I&&("declined"===I.paymentStatus||"cancelled"===I.paymentStatus||"error"===I.paymentStatus)||w,E=(null==I?void 0:I.paymentStatus)||("failed"===y?"declined":"cancelled"===y?"cancelled":"error"),P=(null==I?void 0:I.paymentTransactionId)||v||void 0;return Fe(ts,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Fe(Rt,{children:[Fe("div",{className:$t.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:wt.spacing.lg},{"(max-width: 950px)":{display:"none"}}),children:[Fe("div",{className:$t.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,display:"flex",flexDirection:"column",alignSelf:"start"}),children:[Fe("div",{className:$t.create("checkout-header",{paddingInline:wt.spacing.xl,paddingTop:wt.spacing.xl,paddingBottom:wt.spacing.lg},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingTop:wt.spacing.md}}),children:[Fe("h2",{className:$t.create("checkout-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Fe("p",{className:$t.create("checkout-description",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9"}),children:x.length>1?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage."}),Fe("hr",{className:$t.create("checkout-header-border",{marginTop:wt.spacing.lg,border:"0",borderTop:`1px solid ${wt.colors.border}`,height:"0"})})]}),Fe("div",{className:$t.create("checkout-sections",{paddingInline:wt.spacing.xl,paddingBottom:wt.spacing.xl,display:"flex",flexDirection:"column",gap:wt.spacing.lg},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingBottom:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingBottom:wt.spacing.md}}),children:[e.clauses&&e.clauses.length>0&&Fe(vs,{clauses:e.clauses}),Fe(us,{excessOptions:x,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)}),Fe(ms,{paymentOptions:k,paymentGateways:N,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)})]})]}),Fe("div",{className:$t.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Fe("div",{className:$t.create("checkout-sidebar-sticky",{}),children:[Fe(ys,{excessOptions:x,selectedExcessId:n,onEditQuote:_,isEditingQuote:f,productName:e.product_name,quoteIntent:i}),Fe("div",{className:$t.create("checkout-sidebar-spacer",{height:wt.spacing.lg},{"(max-width: 950px)":{height:wt.spacing.md}})}),Fe("div",{className:$t.create("checkout-sidebar-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,boxShadow:wt.shadow.sm,padding:wt.spacing.lg},{"(max-width: 768px)":{padding:wt.spacing.md}}),children:Fe(bs,{excessOptions:x,paymentGateways:N,selectedExcessId:n,selectedPaymentOption:r,onPurchase:S,canPurchase:C,onContinueLater:$,continueLaterLoading:h,showContinueLaterSuccess:u})})]})})]}),Fe("div",{className:$t.create("checkout-mobile-layout",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:wt.spacing.md}}),children:[Fe("div",{className:$t.create("mobile-card-summary",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,padding:wt.spacing.md}),children:[Fe("h2",{className:$t.create("mobile-checkout-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.5rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Fe("p",{className:$t.create("mobile-checkout-description",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9"}),children:x.length>1?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage."}),Fe("hr",{className:$t.create("mobile-summary-divider",{marginTop:wt.spacing.md,marginBottom:wt.spacing.md,borderColor:wt.colors.border})}),Fe(ys,{excessOptions:x,selectedExcessId:n,onEditQuote:_,isEditingQuote:f,productName:e.product_name,quoteIntent:i,embedded:!0})]}),e.clauses&&e.clauses.length>0&&Fe("div",{className:$t.create("mobile-card-clauses",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,padding:wt.spacing.md}),children:Fe(vs,{clauses:e.clauses})}),Fe("div",{className:$t.create("mobile-card-options",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,padding:wt.spacing.md}),children:Fe(us,{excessOptions:x,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)})}),Fe("div",{className:$t.create("mobile-card-payment",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,padding:wt.spacing.md}),children:[Fe(ms,{paymentOptions:k,paymentGateways:N,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)}),Fe("hr",{className:$t.create("mobile-payment-divider",{border:"none",borderTop:`1px solid ${wt.colors.border}`,margin:`${wt.spacing.md} 0`})}),Fe(bs,{excessOptions:x,paymentGateways:N,selectedExcessId:n,selectedPaymentOption:r,onPurchase:S,canPurchase:C,onContinueLater:$,continueLaterLoading:h,showContinueLaterSuccess:u})]})]}),T&&Fe(Ns,{type:E,transactionId:P,isOpen:!0,onClose:()=>{t.updateQuoteIntent({payment_return:void 0}),b(!1);const e=new URL(window.location.href);e.searchParams.delete("status"),e.searchParams.delete("transactionId"),e.searchParams.delete("transaction_id"),window.history.replaceState({},"",e.toString())}}),Fe(ks,{isOpen:s,onClose:()=>{a(!1),c(null)},onSuccess:()=>{a(!1),c(null),alert("Payment completed successfully!")},onError:e=>{alert("Payment failed: "+e)},paymentRequest:l})]})})}function _s({coverTypes:e,selectedCoverTypeId:t,onCoverTypeSelect:n}){const r=[...e].sort((e,t)=>e.sort_order-t.sort_order),i=e.find(e=>e.id===t);return Fe("div",{className:$t.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Fe(ls,{title:"Cover Type"}),Fe("div",{className:$t.create("cover-type-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Fe("div",{className:Dt($t.create("cover-type-card",{borderRadius:wt.radius.default,minWidth:"180px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?$t.create("cover-type-card-selected",{border:`2px solid ${wt.colors.primary}`,backgroundColor:wt.colors.accent}):$t.create("cover-type-card-unselected",{border:`2px solid ${wt.colors.border}`,backgroundColor:wt.colors.card})),onClick:()=>n(e.id),children:[Fe(cs,{selected:r}),Fe("div",{className:$t.create("cover-type-label",{color:wt.colors.foreground}),children:[e.label,e.description?"*":""]})]},e.id)})}),(null==i?void 0:i.description)&&Fe("div",{className:$t.create("cover-type-description",{padding:"0.75rem",backgroundColor:wt.colors.muted,borderRadius:wt.radius.default,border:`1px solid ${wt.colors.border}`}),children:Fe(as,{className:$t.create("cover-type-description-text",{fontSize:wt.fontSize.small,color:wt.colors.foreground,margin:"0"}),children:i.description})})]})}function $s({offers:e,selectedIds:t,onToggle:n,isCalculating:r}){if(0===e.length)return null;const i=[...e].sort((e,t)=>e.sort_order-t.sort_order);return Fe("div",{className:$t.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Fe(ls,{title:"Add-ons"}),Fe("div",{className:$t.create("coverage-options-grid",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:i.map(e=>{const i=t.includes(e.id),o=null!=e.delta_total;return Fe("div",{onClick:()=>!r&&n(e.id),className:Dt($t.create("coverage-option-card",{borderRadius:wt.radius.default,padding:"0.75rem 1rem",cursor:r?"wait":"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"1rem",opacity:r?"0.6":"1"}),i?$t.create("coverage-option-card-selected",{border:`2px solid ${wt.colors.primary}`,backgroundColor:wt.colors.accent}):$t.create("coverage-option-card-unselected",{border:`2px solid ${wt.colors.border}`,backgroundColor:wt.colors.card})),children:[Fe("div",{className:$t.create("coverage-option-indicator",{marginTop:"0.125rem"}),children:Fe(cs,{selected:i})}),Fe("div",{className:$t.create("coverage-option-body",{flex:"1",display:"flex",flexDirection:"column",gap:"0.25rem",minWidth:"0"}),children:[Fe("div",{className:$t.create("coverage-option-label",{fontWeight:"600",color:wt.colors.foreground}),children:e.label}),e.description&&Fe(as,{className:$t.create("coverage-option-description",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,margin:"0"}),children:e.description}),!o&&Fe(as,{className:$t.create("coverage-option-roundtrip",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,fontStyle:"italic",margin:"0"}),children:"Price updates when you toggle this option."})]}),Fe("div",{className:$t.create("coverage-option-price",{fontWeight:"600",whiteSpace:"nowrap",color:wt.colors.foreground}),children:o?`+${ds(e.delta_total)}`:"See total"})]},e.id)})})]})}function Cs({value:e,className:t,durationMs:n=500}){const[r,i]=rt(e),o=ot(e),s=ot(null);return it(()=>{if(null!==s.current&&(cancelAnimationFrame(s.current),s.current=null),"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||o.current===e)return o.current=e,void i(e);const t=o.current,r=e,a=performance.now(),l=e=>{const c=e-a,u=Math.min(1,c/n);i(t+(r-t)*(1-(1-u)*(1-u))),u<1?s.current=requestAnimationFrame(l):(o.current=r,s.current=null)};return s.current=requestAnimationFrame(l),()=>{null!==s.current&&(cancelAnimationFrame(s.current),s.current=null)}},[e,n]),Fe("span",{className:t,children:ds(r)})}function Is(){var e,t;const{fsm:n,v2Result:r,selection:i,isCalculating:o,isRepricing:s,selectedExcessId:a,quoteIntent:l,calculationResult:c}=Wt(e=>({v2Result:e.getCalculationResultV2(),selection:e.getSelectionV2(),isCalculating:e.getIsCalculating(),isRepricing:e.getIsRepricing(),selectedExcessId:e.getSelectedExcessId(),quoteIntent:e.getQuoteIntent(),calculationResult:e.getCalculationResult()})),[u,d]=rt(null),[h,m]=rt(!1),[f,p]=rt(!1),g=st(()=>{var e;return null!==(e=null==c?void 0:c.calculations)&&void 0!==e?e:[]},[c]);if(it(()=>{d(null)},[null==i?void 0:i.cover_type_id,null==i?void 0:i.excess_id,null==i?void 0:i.coverage_option_ids.join(",")]),!r||!i)return Fe(ts,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Fe(Rt,{children:Fe("p",{style:{color:wt.colors.mutedForeground},children:"Loading calculation…"})})});const y=null!==(t=null!==(e=r.product_name)&&void 0!==e?e:null==l?void 0:l.product_name)&&void 0!==t?t:"Insurance",v=r.cover_types.length>1,w=g.length>1,b=!(!i.cover_type_id||!i.excess_id||o||s),x=async()=>{m(!0);try{const e=await n.bindV2();d(e)}catch(e){}finally{m(!1)}},k=async()=>{try{p(!0),await n.clearCalculationResults(),n.navigateToPage(0)}catch(e){p(!1)}};return Fe(ts,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Fe(Rt,{children:[Fe("div",{className:$t.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:wt.spacing.lg},{"(max-width: 950px)":{display:"none"}}),children:[Fe("div",{className:$t.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,display:"flex",flexDirection:"column",alignSelf:"start"}),children:[Fe(Ts,{showCoverType:v,showExcess:w}),Fe("div",{className:$t.create("checkout-sections",{paddingInline:wt.spacing.xl,paddingBottom:wt.spacing.xl,display:"flex",flexDirection:"column",gap:wt.spacing.lg},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingBottom:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingBottom:wt.spacing.md}}),children:[(null==c?void 0:c.clauses)&&c.clauses.length>0&&Fe(vs,{clauses:c.clauses}),v&&Fe(_s,{coverTypes:r.cover_types,selectedCoverTypeId:i.cover_type_id,onCoverTypeSelect:e=>n.setV2Selection({cover_type_id:e})}),w&&Fe(us,{excessOptions:g,selectedExcessId:a,onExcessSelect:e=>n.setV2Selection({excess_id:e})}),Fe($s,{offers:r.policy_coverage_options,selectedIds:i.coverage_option_ids,onToggle:e=>n.toggleV2CoverageOption(e),isCalculating:s})]})]}),Fe("div",{className:$t.create("checkout-sidebar",{display:"flex",flexDirection:"column"}),children:Fe("div",{className:$t.create("checkout-sidebar-sticky",{position:"sticky",top:wt.spacing.lg}),children:[Fe(ys,{excessOptions:g,selectedExcessId:a,onEditQuote:k,isEditingQuote:f,productName:y,quoteIntent:l}),Fe("div",{className:$t.create("checkout-sidebar-spacer",{height:wt.spacing.lg})}),Fe("div",{className:$t.create("checkout-sidebar-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,boxShadow:wt.shadow.sm,padding:wt.spacing.lg},{"(max-width: 768px)":{padding:wt.spacing.md}}),children:Fe(Es,{fsm:n,onBind:x,binding:h,canContinue:b,bindOutcome:u,isRepricing:s})})]})})]}),Fe("div",{className:$t.create("checkout-mobile-layout",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:wt.spacing.md}}),children:[Fe("div",{className:$t.create("mobile-card-summary",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,padding:wt.spacing.md}),children:[Fe("h2",{className:$t.create("mobile-checkout-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.5rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Fe("p",{className:$t.create("mobile-checkout-description",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9"}),children:v||w?"Choose your cover and add-ons to secure your policy.":"Review your cover and add-ons to secure your policy."}),Fe("hr",{className:$t.create("mobile-summary-divider",{marginTop:wt.spacing.md,marginBottom:wt.spacing.md,borderColor:wt.colors.border})}),Fe(ys,{excessOptions:g,selectedExcessId:a,onEditQuote:k,isEditingQuote:f,productName:y,quoteIntent:l,embedded:!0})]}),(null==c?void 0:c.clauses)&&c.clauses.length>0&&Fe("div",{className:$t.create("mobile-card-clauses",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,padding:wt.spacing.md}),children:Fe(vs,{clauses:c.clauses})}),Fe("div",{className:$t.create("mobile-card-options",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,padding:wt.spacing.md,display:"flex",flexDirection:"column",gap:wt.spacing.lg}),children:[v&&Fe(_s,{coverTypes:r.cover_types,selectedCoverTypeId:i.cover_type_id,onCoverTypeSelect:e=>n.setV2Selection({cover_type_id:e})}),w&&Fe(us,{excessOptions:g,selectedExcessId:a,onExcessSelect:e=>n.setV2Selection({excess_id:e})}),Fe($s,{offers:r.policy_coverage_options,selectedIds:i.coverage_option_ids,onToggle:e=>n.toggleV2CoverageOption(e),isCalculating:o})]}),Fe("div",{className:$t.create("mobile-card-payment",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,padding:wt.spacing.md}),children:Fe(Es,{fsm:n,onBind:x,binding:h,canContinue:b,bindOutcome:u,isRepricing:s})})]})]})})}function Ts({showCoverType:e,showExcess:t}){let n="Review your cover and add-ons to secure your policy.";return e&&t?n="Choose your cover type, excess amount, and add-ons to secure your policy.":e?n="Choose your cover type and add-ons to secure your policy.":t&&(n="Choose your excess amount and add-ons to secure your policy."),Fe("div",{className:$t.create("checkout-header",{paddingInline:wt.spacing.xl,paddingTop:wt.spacing.xl,paddingBottom:wt.spacing.lg},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingTop:wt.spacing.md}}),children:[Fe("h2",{className:$t.create("checkout-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Fe("p",{className:$t.create("checkout-description",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9"}),children:n}),Fe("hr",{className:$t.create("checkout-header-border",{marginTop:wt.spacing.lg,borderColor:wt.colors.border})})]})}function Es({fsm:e,onBind:t,binding:n,canContinue:r,bindOutcome:i,isRepricing:o}){const s=e.getV2DisplayedTotal();return Fe("div",{className:$t.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Fe(ls,{title:"Payment"}),Fe("div",{className:$t.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("summary-label",{display:"flex",alignItems:"center",gap:"0.5rem",color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:["Total payable",Fe("span",{className:$t.create("summary-label-spinner",{display:"inline-flex",color:wt.colors.mutedForeground,opacity:o?"1":"0",transition:"opacity 200ms ease"}),"aria-hidden":!o,children:Fe(zt,{size:"small"})})]}),Fe(Cs,{value:s,className:$t.create("summary-value-total",{fontWeight:"600",fontSize:wt.fontSize.large,color:wt.colors.foreground,fontVariantNumeric:"tabular-nums"})})]}),"verified"===(null==i?void 0:i.status)&&Fe("div",{className:$t.create("verified-banner",{padding:"0.75rem 1rem",border:`1px solid ${wt.colors.primary}`,borderRadius:wt.radius.default,backgroundColor:wt.colors.accent,fontSize:wt.fontSize.small}),children:["Verified at ",ds(i.server_total),". Payment gateway integration for v2 is pending — quote is ready."]}),"mismatch"===(null==i?void 0:i.status)&&Fe("div",{className:$t.create("mismatch-banner",{padding:"0.75rem 1rem",border:`1px solid ${wt.colors.destructive}`,borderRadius:wt.radius.default,color:wt.colors.destructive,fontSize:wt.fontSize.small}),children:[Fe("strong",{children:"Price updated."})," The server calculated ",ds(i.server_total),". Please review and try again."]}),Fe(is,{onClick:t,disabled:!r||n,children:n?"Verifying…":"verified"===(null==i?void 0:i.status)?"Continue to payment":"Verify & continue"}),Fe(as,{className:$t.create("payment-footer-note",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,margin:"0"}),children:'Payment gateway integration for v2 products is scoped for a later phase. The "verify" step confirms your selection against the server.'})]})}function Ps({results:e}){var t,n,r;const{quoteIntent:i,fsm:o}=Wt(e=>({quoteIntent:null==e?void 0:e.getQuoteIntent()})),s=null===(t=null==i?void 0:i.organisation)||void 0===t?void 0:t.admin_email,a=null===(n=null==i?void 0:i.organisation)||void 0===n?void 0:n.phone,l=s||a,c=$t.create("referral-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.xl,boxShadow:wt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:wt.spacing.lg},"(max-width: 480px)":{padding:wt.spacing.md}}),u=$t.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:wt.spacing.lg}),d=$t.create("referral-icon",{width:"4rem",height:"4rem",color:wt.colors.primary}),h=$t.create("referral-header",{textAlign:"center",marginBottom:wt.spacing.xl}),m=$t.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:wt.colors.primary,marginBottom:wt.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=$t.create("referral-subtitle",{fontSize:wt.fontSize.default,color:wt.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),p=$t.create("referral-process-box",{backgroundColor:wt.colors.accent,borderRadius:wt.radius.default,padding:wt.spacing.lg,marginBottom:wt.spacing.xl}),g=$t.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:wt.colors.accentForeground,marginBottom:wt.spacing.md,marginTop:"0"}),y=$t.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:wt.spacing.sm}),v=$t.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:wt.fontSize.small,color:wt.colors.accentForeground,lineHeight:"1.6"}),w=$t.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:wt.colors.primary,color:wt.colors.primaryForeground,borderRadius:"50%",marginRight:wt.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),b=$t.create("referral-contact-section",{borderTop:`1px solid ${wt.colors.border}`,paddingTop:wt.spacing.xl,marginTop:wt.spacing.xl,textAlign:"center"}),x=$t.create("referral-contact-text",{fontSize:wt.fontSize.default,color:wt.colors.foreground,marginBottom:wt.spacing.lg}),k=$t.create("referral-actions",{display:"flex",gap:wt.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:wt.spacing.lg}),N=$t.create("referral-reference",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,marginTop:wt.spacing.md}),S=$t.create("referral-new-request",{textAlign:"center",marginTop:wt.spacing.md}),_=$t.create("referral-new-request-link",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:"0",fontFamily:"inherit"});return Fe(ts,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Fe(Rt,{children:Fe(ns,{children:Fe("div",{className:c,children:[Fe("div",{className:u,children:Fe(()=>Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:d,children:[Fe("path",{d:"M7 10v12"}),Fe("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),{})}),Fe("div",{className:h,children:[Fe("h1",{className:m,children:"Thanks for your quote request!"}),Fe("p",{className:f,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Fe("div",{className:p,children:[Fe("h3",{className:g,children:"What happens next?"}),Fe("ul",{className:y,children:[Fe("li",{className:v,children:[Fe("span",{className:w,children:"1"}),Fe("span",{children:"Our team will review your application within 1-2 business days"})]}),Fe("li",{className:v,children:[Fe("span",{className:w,children:"2"}),Fe("span",{children:"We'll contact you with either approval or additional requirements"})]}),Fe("li",{className:v,children:[Fe("span",{className:w,children:"3"}),Fe("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),l&&Fe("div",{className:b,children:[Fe("p",{className:x,children:"Need to speak with someone about your quote?"}),Fe("div",{className:k,children:[a&&Fe(is,{variant:"outline",onClick:()=>window.open(`tel:${a}`),children:[Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:Fe("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),"Call Us"]}),s&&Fe(is,{variant:"outline",onClick:()=>window.open(`mailto:${s}`),children:[Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:[Fe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Fe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),(null===(r=e.quote_intent)||void 0===r?void 0:r.reference)&&Fe("div",{className:N,children:["Quote Reference: ",Fe("strong",{children:e.quote_intent.reference})]})]}),Fe("div",{className:S,children:Fe("button",{type:"button",className:_,onClick:()=>null==o?void 0:o.reset(),children:"Start a new quote"})})]})})})})}function Ds({results:e}){const{calculationResultV2:t}=Wt(e=>({calculationResultV2:e.getCalculationResultV2()}));return"referral"===e.outcome_type?Fe(Ps,{results:e}):t?Fe(Is,{}):Fe(Ss,{results:e})}function zs({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:l,prefix:c="$"}){const u=ot(null),[d,h]=rt("");function m(e){if(!e)return"";const t=e.replace(/[^\d.]/g,"");if(!t)return"";const n=t.split(".");let r=n[0];const i=n[1];r=r.replace(/^0+/,"")||"0";const o=r.replace(/\B(?=(\d{3})+(?!\d))/g,",");return void 0!==i?o+"."+i:o}it(()=>{h(null!=e&&""!==e?m(e):"")},[e]);const f=$t.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=$t.create("money-input-prefix",{position:"absolute",left:"1rem",color:wt.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=$t.create("money-input-with-prefix",{paddingLeft:c?"2rem":"1rem"});return Fe("div",{className:f,children:[c&&Fe("span",{className:p,children:c}),Fe("input",{ref:u,type:"text",inputMode:"decimal",name:n,id:r,value:d,onInput:function(e){const n=e.currentTarget,r=n.selectionStart||0,i=d,o=n.value.replace(/[^\d.]/g,""),s=m(o);h(s),t(o),requestAnimationFrame(()=>{if(u.current){const e=function(e,t,n){let r=n+(t.length-e.length);return r=Math.max(0,Math.min(r,t.length)),r}(i,s,r);u.current.setSelectionRange(e,e)}})},onBlur:function(){d&&d.includes(".")},placeholder:i,required:o,disabled:s,className:Dt(a,c&&g)})]})}function Rs(e,t){return n=(null==e?void 0:e.use_custom_options)?t||(null==e?void 0:e.options)||[]:(null==e?void 0:e.options)||t||[],(r=null==e?void 0:e.options_sort)&&"default"!==r?[...n].sort((e,t)=>e.label.localeCompare(t.label,void 0,"numerical"===r?{numeric:!0}:void 0)):[...n];var n,r}function Ms(e){var t,n;const r=$t.create("input",{width:"100%",maxWidth:"100%",minWidth:"0",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${wt.borderWidth} solid ${wt.colors.input}`,borderRadius:wt.radius.default,fontSize:wt.fontSize.default,backgroundColor:wt.colors.card,color:wt.colors.foreground,transition:wt.transition,outline:"none",boxShadow:"none"},{"(max-width: 480px)":{paddingLeft:"0.75rem",paddingRight:"0.75rem"}}),i=$t.create("input-error",{border:`${wt.borderWidth} solid ${wt.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${wt.colors.destructive} 20%, transparent)`}),o=e.hasError?`${r} ${i}`:r,s=$t.name("input");$t.pseudoElement("input",":focus",{border:`${wt.borderWidth} solid ${wt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${wt.colors.primary} 20%, transparent)`,borderRadius:wt.radius.default});const a=$t.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${wt.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"2.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",fontSize:wt.fontSize.default,backgroundColor:"transparent",color:wt.colors.foreground,outline:"none",WebkitAppearance:"none",appearance:"none"},{"(max-width: 480px)":{paddingLeft:"0.75rem",paddingRight:"2rem"}}),l=$t.create("select-wrapper",{position:"relative",border:`${wt.borderWidth} solid ${wt.colors.input}`,borderRadius:wt.radius.default,backgroundColor:wt.colors.card,transition:wt.transition,outline:"none",boxShadow:"none"}),c=$t.create("select-wrapper-error",{border:`${wt.borderWidth} solid ${wt.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${wt.colors.destructive} 20%, transparent)`}),u=e.hasError?`${l} ${c}`:l,d=$t.name("select-wrapper");$t.pseudoElement("select-wrapper",":focus-within",{border:`${wt.borderWidth} solid ${wt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${wt.colors.primary} 20%, transparent)`,borderRadius:wt.radius.default});const{onChange:h,onBlur:m,onKeyDown:f,className:p,validation:g,errors:y,suffix:v,...w}=e;function b(e){h(e.currentTarget.value)}function x(e){h(e.currentTarget.value)}function k(e){m&&m(e.currentTarget.value)}if("select"===e.type){const N=e.null_option_label||"N/A",S=Rs(e.validation,e.options),_=!w.value&&!e.add_null_option,$=$t.create("select-placeholder",{color:wt.colors.mutedForeground}),C=$t.create("select-chevron",{position:"absolute",right:"0.75rem",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:wt.colors.mutedForeground});return Fe("div",{className:Dt(u,d),children:[Fe("select",{...w,onChange:b,className:Dt(a,_&&$),children:[_&&Fe("option",{value:"",disabled:!0,selected:!0,children:"Select..."}),e.add_null_option&&Fe("option",{value:"",children:N}),S.map(e=>Fe("option",{value:e.value,children:e.label},e.value))]}),Fe("svg",{className:C,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Fe("path",{d:"M6 9l6 6 6-6"})})]})}if("radio"===e.type){const I=e.null_option_label||"N/A",T=Rs(e.validation,e.options),E=$t.create(e.inline?"radio-container-inline":"radio-container",{display:"flex",flexDirection:e.inline?"row":"column",gap:e.inline?"1rem":"0.5rem",flexWrap:e.inline?"wrap":"nowrap"}),P=$t.create("radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer",fontSize:wt.fontSize.default,color:wt.colors.foreground}),D=$t.create("radio-input",{accentColor:wt.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),z=$t.name("radio-input");return $t.pseudoElement("radio-input",":focus",{outline:`3px solid color-mix(in srgb, ${wt.colors.primary} 30%, transparent)`,outlineOffset:"2px"}),Fe("div",{className:E,children:[e.add_null_option&&Fe("label",{className:P,children:[Fe("input",{type:"radio",name:e.name,value:"",checked:""===e.value,onChange:()=>h(""),className:Dt(D,z)}),Fe("span",{children:I})]}),T.map(t=>Fe("label",{className:P,children:[Fe("input",{type:"radio",name:e.name,value:t.value,checked:e.value===t.value,onChange:()=>h(t.value),className:Dt(D,z)}),Fe("span",{children:t.label})]},t.value))]})}if("date"===e.type){const R=$t.create("input-date",{height:"2.75rem",minHeight:"2.75rem",maxHeight:"2.75rem",WebkitAppearance:"none",appearance:"none"});return Fe("input",{...w,type:"date",min:null===(t=e.validation)||void 0===t?void 0:t.minDate,max:null===(n=e.validation)||void 0===n?void 0:n.maxDate,onInput:x,onChange:b,className:Dt(o,s,R,p)})}if("monthyear"===e.type){function M(e){const t=e.currentTarget.value;h(t?`${t}-01`:"")}const O=e.value?e.value.substring(0,7):"";return Fe("input",{...w,type:"month",value:O,onInput:M,onChange:M,className:Dt(o,s,p)})}if("year"===e.type){const j=(new Date).getFullYear();return Fe("input",{...w,type:"number",min:j-100,max:j,placeholder:"YYYY",onInput:x,onChange:b,className:Dt(o,s,p)})}if("money"===e.type)return Fe(zs,{value:e.value,onChange:h,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:Dt(o,s,p),hasError:e.hasError});if("checkbox"===e.type){const W=!0===e.value||"true"===e.value||"true"===e.value,A=$t.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),L=$t.create("checkbox-"+(W?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${W?wt.colors.primary:e.hasError?wt.colors.destructive:wt.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:W?wt.colors.primary:wt.colors.card,transition:wt.transition,position:"absolute"}),B=$t.name("checkbox-"+(W?"checked":"unchecked"));function F(e){e.preventDefault(),h(W?"false":"true")}return $t.pseudoElement("checkbox-"+(W?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${wt.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),Fe("div",{className:A,children:[Fe("input",{type:"checkbox",id:e.id,name:e.name,checked:W,onClick:F,className:Dt(L,B,p),required:e.required,readOnly:!0}),W&&Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:wt.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Fe("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const q=$t.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),H=$t.create("boolean-radio-group",{display:"flex",gap:"1rem"}),U=$t.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),Y=$t.create("boolean-radio",{accentColor:wt.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),Z=$t.name("boolean-radio");$t.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${wt.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const G=$t.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${wt.borderWidth} solid ${wt.colors.input}`,borderRadius:wt.radius.default,fontSize:wt.fontSize.default,backgroundColor:wt.colors.card,color:wt.colors.foreground,transition:wt.transition,outline:"none",boxShadow:"none",resize:"vertical",fontFamily:wt.fontFamily}),V=$t.create("boolean-textarea-error",{border:`${wt.borderWidth} solid ${wt.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${wt.colors.destructive} 20%, transparent)`}),Q=e.hasError?`${G} ${V}`:G,J=$t.name("boolean-textarea");$t.pseudoElement("boolean-textarea",":focus",{border:`${wt.borderWidth} solid ${wt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${wt.colors.primary} 20%, transparent)`,borderRadius:wt.radius.default});const K=!0===e.value||"true"===e.value,X=!1===e.value||"false"===e.value,ee=e.answer||"",te=e.booleanConfig,ne=(null==te?void 0:te.enable_details_textbox)&&("yes"===te.show_details_on&&K||"no"===te.show_details_on&&X);function re(t){h(t),(!(null==te?void 0:te.enable_details_textbox)||!("yes"===te.show_details_on&&"true"===t||"no"===te.show_details_on&&"false"===t))&&e.onAnswerChange&&ee&&e.onAnswerChange("")}return Fe("div",{className:Dt(q,p),children:[Fe("div",{className:H,children:[Fe("label",{className:U,children:[Fe("input",{type:"radio",name:e.name,checked:K,onChange:()=>re("true"),className:Dt(Y,Z)}),Fe("span",{children:"Yes"})]}),Fe("label",{className:U,children:[Fe("input",{type:"radio",name:e.name,checked:X,onChange:()=>re("false"),className:Dt(Y,Z)}),Fe("span",{children:"No"})]})]}),ne&&Fe("textarea",{placeholder:(null==te?void 0:te.details_placeholder)||"Please provide details",value:ee,required:!0,onInput:t=>{return n=t.target.value,void(e.onAnswerChange&&e.onAnswerChange(n));var n},className:Dt(Q,J)})]})}return v?Fe("div",{className:$t.create("input-with-suffix",{display:"flex",alignItems:"center",gap:wt.spacing.sm,minWidth:"0",maxWidth:"100%"}),children:[Fe("input",{...w,onInput:x,onChange:b,onBlur:k,onKeyDown:f,className:Dt(o,s,p),style:{flex:1,minWidth:0}}),v]}):Fe("input",{...w,onInput:x,onChange:b,onBlur:k,onKeyDown:f,className:Dt(o,s,p)})}function Os({pages:e,currentPageIndex:n,completedPages:r}){const{fsm:i,lastUpdated:o,isSaving:s}=Wt(e=>{var t,n;return{lastUpdated:null!==(n=null===(t=e.getFormProgress())||void 0===t?void 0:t.last_updated)&&void 0!==n?n:null,isSaving:e.getIsSaving()}}),[a,l]=rt(!1),[c,u]=rt(!1),d=ot(null),h=ot(null);t(e.length),t(e.map((e,t)=>({index:t,id:e.id,title:e.title})));const m=st(()=>{var t;for(let n=0;n<e.length;n++)if((null!==(t=e[n].fields)&&void 0!==t?t:[]).some(e=>"client_email"===e.code))return n;return-1},[e]),f=m>=0&&r.includes(m);it(()=>{if(d.current&&h.current){const e=h.current,t=d.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}},[n]);const p=Math.round((n+1)/e.length*100),g=$t.create("sidebar-nav-item-base",{display:"flex",alignItems:"flex-start",gap:wt.spacing.sm,padding:`${wt.spacing.sm} ${wt.spacing.sm}`,borderRadius:wt.radius.default,border:"none",backgroundColor:"transparent",color:wt.colors.foreground,cursor:"pointer",transition:wt.transition,textAlign:"left",width:"100%",fontFamily:wt.fontFamily,fontSize:wt.fontSize.small,opacity:"1"}),y=$t.create("sidebar-nav-item-active",{backgroundColor:wt.colors.accent,color:wt.colors.accentForeground}),v=$t.create("sidebar-nav-item-disabled",{cursor:"not-allowed",opacity:"0.5"});$t.pseudoElement("sidebar-nav-item-base",":hover",{backgroundColor:wt.colors.muted}),$t.pseudoElement("sidebar-nav-item-active",":hover",{backgroundColor:wt.colors.accent});const w=$t.create("sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:wt.colors.muted,color:wt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),b=$t.create("sidebar-indicator-active",{backgroundColor:wt.colors.accentForeground,color:wt.colors.accent}),x=$t.create("sidebar-indicator-completed",{backgroundColor:wt.colors.primary,color:wt.colors.primaryForeground}),k=$t.create("sidebar-page-title-base",{fontWeight:"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),N=$t.create("sidebar-page-title-active",{fontWeight:"600"});return Fe("div",{className:$t.create("sidebar-navigation",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.lg,boxShadow:wt.shadow.sm,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:wt.spacing.lg}),children:[Fe("div",{className:$t.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:wt.spacing.sm}),children:[Fe("span",{className:$t.create("sidebar-progress-text",{fontSize:wt.fontSize.small,fontWeight:"600",color:wt.colors.foreground}),children:["Step ",n+1," of ",e.length]}),Fe("div",{className:$t.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:wt.colors.muted,borderRadius:wt.radius.small,overflow:"hidden"}),children:Fe("div",{className:$t.create("sidebar-progress-fill",{height:"100%",backgroundColor:wt.colors.primary,borderRadius:wt.radius.small,transition:wt.transition}),style:{width:`${p}%`}})})]}),Fe("hr",{className:$t.create("sidebar-divider",{borderColor:wt.colors.border})}),Fe("nav",{ref:h,className:$t.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:wt.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:wt.spacing.sm}),children:e.map((e,o)=>{const a=o===n,l=r.includes(o),c=i.canNavigateToPage(o);o===n&&t(e.title);const u=[g];a&&u.push(y),c&&!s||u.push(v);const h=u.join(" "),m=[w];l?m.push(x):a&&m.push(b);const f=m.join(" ");return Fe("button",{ref:a?d:null,onClick:()=>{return e=o,void((null==i?void 0:i.canNavigateToPage(e))&&i.navigateToPage(e));var e},disabled:!c||s,className:h,children:[Fe("div",{className:f,children:l?Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:Fe("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Fe("div",{className:$t.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:Fe("span",{className:a?`${k} ${N}`:k,children:e.title})})]},e.id)})}),f&&!a&&Fe("button",{onClick:async()=>{var e,t;const n=(()=>{const e=null==i?void 0:i.getFormProgress(),t=null==e?void 0:e.page_data;if(!t)return null;for(const e in t){const n=t[e];if(null==n?void 0:n.client_email)return n.client_email}return null})();if(!n)return void alert("Email address not found. Please fill in your email first.");const r=null===(e=null==i?void 0:i.getQuoteIntent())||void 0===e?void 0:e.id;if(r)try{u(!0),await(null===(t=null==i?void 0:i.httpClient)||void 0===t?void 0:t.continueLater(r,n)),l(!0)}catch(e){alert("Failed to send link. Please try again.")}finally{u(!1)}},disabled:c,className:$t.create("sidebar-continue-later-button",{padding:`${wt.spacing.sm} ${wt.spacing.md}`,border:`${wt.borderWidth} solid ${wt.colors.border}`,borderRadius:wt.radius.default,backgroundColor:"transparent",color:wt.colors.mutedForeground,fontSize:wt.fontSize.small,fontFamily:wt.fontFamily,cursor:"pointer",transition:wt.transition,textAlign:"center",width:"100%"}),children:c?"Sending...":"Continue Later"}),a&&Fe("div",{className:$t.create("sidebar-continue-later-sent",{fontSize:wt.fontSize.small,color:wt.colors.primary,textAlign:"center",padding:`${wt.spacing.sm} 0`}),children:"A link has been sent to your email."}),o&&Fe("div",{className:$t.create("sidebar-footer",{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"}),children:[Fe("div",{className:$t.create("sidebar-last-saved",{fontSize:"0.6875rem",color:wt.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Xo.fromJSDate(new Date(o)).toFormat("T")]}),Fe("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&(null==i||i.reset())},className:$t.create("sidebar-reset-link",{background:"none",border:"none",padding:"0",fontSize:"0.6875rem",color:wt.colors.mutedForeground,opacity:"0.5",cursor:"pointer",textDecoration:"underline",fontFamily:wt.fontFamily}),children:"Reset progress"})]})]})}function js({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=Wt(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=rt(!1),a=Math.round((t+1)/e.length*100),l=$t.create("mobile-sidebar-item-base",{display:"flex",alignItems:"center",gap:wt.spacing.sm,padding:wt.spacing.sm,border:"none",borderRadius:wt.radius.default,backgroundColor:"transparent",color:wt.colors.foreground,cursor:"pointer",opacity:"1",transition:wt.transition,width:"100%",textAlign:"left",fontFamily:wt.fontFamily}),c=$t.create("mobile-sidebar-item-active",{backgroundColor:wt.colors.accent,color:wt.colors.accentForeground}),u=$t.create("mobile-sidebar-item-disabled",{cursor:"not-allowed",opacity:"0.5"}),d=$t.create("mobile-sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:wt.colors.muted,color:wt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),h=$t.create("mobile-sidebar-indicator-active",{backgroundColor:wt.colors.accentForeground,color:wt.colors.accent}),m=$t.create("mobile-sidebar-indicator-completed",{backgroundColor:wt.colors.primary,color:wt.colors.primaryForeground}),f=$t.create("mobile-sidebar-page-title-base",{fontSize:wt.fontSize.small,fontWeight:"500"}),p=$t.create("mobile-sidebar-page-title-active",{fontWeight:"600"});return Fe("div",{className:$t.create("mobile-sidebar",{overflow:"hidden"}),children:[Fe("button",{onClick:()=>s(!o),className:$t.create("mobile-sidebar-header",{width:"100%",padding:wt.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:wt.spacing.sm}),children:[Fe("div",{className:$t.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Fe("span",{className:$t.create("mobile-sidebar-step-text",{fontSize:wt.fontSize.small,fontWeight:"600",color:wt.colors.foreground}),children:["Step ",t+1," of ",e.length]}),Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:$t.create("mobile-sidebar-chevron",{transition:wt.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:wt.colors.mutedForeground}),children:Fe("path",{d:"m6 9 6 6 6-6"})})]}),Fe("div",{className:$t.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:wt.colors.muted,borderRadius:wt.radius.small,overflow:"hidden"}),children:Fe("div",{className:$t.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:wt.colors.primary,borderRadius:wt.radius.small,transition:wt.transition}),style:{width:`${a}%`}})})]}),Fe("hr",{className:$t.create("mobile-sidebar-border",{borderColor:wt.colors.border})}),o&&Fe("div",{className:$t.create("mobile-sidebar-content",{padding:wt.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:e.map((e,o)=>{const a=o===t,g=n.includes(o),y=r.canNavigateToPage(o),v=[l];a&&v.push(c),y&&!i||v.push(u);const w=v.join(" "),b=[d];g?b.push(m):a&&b.push(h);const x=b.join(" ");return Fe("button",{onClick:()=>{return e=o,void((null==r?void 0:r.canNavigateToPage(e))&&(r.navigateToPage(e),s(!1)));var e},disabled:!y||i,className:w,children:[Fe("div",{className:x,children:g?Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:Fe("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Fe("span",{className:a?`${f} ${p}`:f,children:e.title})]},e.id)})})]})}function Ws({organisation:e}){return Fe("div",{className:$t.create("welcome-card",{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},{"(max-width: 950px)":{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingTop:wt.spacing.md}}),children:[Fe("h2",{className:$t.create("welcome-title",{margin:"0",marginBottom:wt.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:wt.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),Fe("p",{className:$t.create("welcome-text",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9"}),children:"Getting a quote online is quick and easy. Simply complete the form below with your details, and we'll provide you with a personalied quote. Our secure platform ensures your information is protected every step of the way."}),Fe("hr",{className:$t.create("welcome-border",{marginTop:wt.spacing.lg,borderColor:wt.colors.border})})]})}function As({title:e,description:t}){return Fe(ts,{title:e,description:t,children:Fe(Rt,{children:Fe(ns,{className:$t.name("error-container"),children:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-ban-icon lucide-ban",children:[Fe("path",{d:"M4.929 4.929 19.07 19.071"}),Fe("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function Ls({errors:e,className:t}){return e&&0!==e.length?Fe("div",{className:$t.create("field-error",{color:wt.colors.destructive,fontSize:wt.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>Fe("span",{className:$t.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function Bs({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=rt({visible:!1,top:0,left:0,flipped:!1}),l=ot(null),c=at(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect(),n=!(t.top>68),r=n?t.bottom+8:t.top-8,i=t.left+t.width/2;a({visible:!0,top:r,left:i,flipped:n})},[]),u=at(()=>{a(e=>({...e,visible:!1}))},[]);return Fe("label",{for:e,className:$t.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Fe("span",{className:$t.create("label-text",{marginBottom:wt.spacing.sm,fontSize:wt.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:wt.spacing.sm,color:wt.colors.foreground}),children:[Fe("span",{children:r?Fe($,{children:[t.includes(" ")?t.substring(0,t.lastIndexOf(" ")+1):"",Fe("span",{style:{whiteSpace:"nowrap"},children:[t.includes(" ")?t.substring(t.lastIndexOf(" ")+1):t,Fe("span",{className:$t.create("label-required-indicator",{color:wt.colors.destructive}),children:"*"})]})]}):t}),i&&Fe("span",{ref:l,className:$t.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:c,onMouseLeave:u,children:[Fe("svg",{className:$t.create("tooltip-icon",{width:"1rem",height:"1rem",color:wt.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Fe("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Fe("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Fe("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s.visible&&Fe("span",{style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,transform:s.flipped?"translateX(-50%)":"translateX(-50%) translateY(-100%)",padding:"0.5rem 0.75rem",backgroundColor:wt.colors.popover,color:wt.colors.popoverForeground,fontSize:"0.875rem",borderRadius:wt.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e4,minWidth:"200px",maxWidth:"300px",pointerEvents:"none"},children:[i,Fe("span",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...s.flipped?{bottom:"100%",borderBottom:`6px solid ${wt.colors.popover}`}:{top:"100%",borderTop:`6px solid ${wt.colors.popover}`}}})]})]})]}),n]})}function Fs(e){const t={"(max-width: 600px)":{gridColumn:"span 12 / span 12"}};switch(null!=e?e:100){case 25:return $t.create("field-wrapper-25",{gridColumn:"span 3 / span 3"},t);case 33:return $t.create("field-wrapper-33",{gridColumn:"span 4 / span 4"},t);case 50:return $t.create("field-wrapper-50",{gridColumn:"span 6 / span 6"},t);case 66:return $t.create("field-wrapper-66",{gridColumn:"span 8 / span 8"},t);case 75:return $t.create("field-wrapper-75",{gridColumn:"span 9 / span 9"},t);default:return $t.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function qs(e){return e?e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{const r=n.trim();return r.match(/^(https?:\/\/|mailto:)/i)?`<a href="${r}" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 underline">${t}</a>`:e}):""}function Hs({field:e,errors:t,children:n,className:r}){const i=e.code||e.id,o=(null==t?void 0:t.filter(e=>e.field===i))||[],s=$t.create("validated-field",{display:"flex",flexDirection:"column",gap:wt.spacing.sm,minWidth:"0"});if("notice"===e.type){const t=$t.create("notice-field",{display:"flex",gap:wt.spacing.sm,padding:wt.spacing.md,backgroundColor:wt.colors.accent,borderRadius:wt.radius.default,border:`1px solid ${wt.colors.border}`}),n=$t.create("notice-icon",{flexShrink:"0",fontSize:wt.fontSize.default,lineHeight:"1.6"}),r=$t.create("notice-text",{fontSize:wt.fontSize.small,color:wt.colors.foreground,lineHeight:"1.6"});return Fe("div",{className:Dt(Fs(e.width)),children:Fe("div",{className:t,children:[Fe("span",{className:n,children:"ⓘ"}),Fe("div",{className:r,children:[e.label&&Fe("strong",{children:e.label}),e.label&&e.description&&Fe("br",{}),e.description&&Fe("span",{children:e.description})]})]})})}if("section"===e.type){const t=$t.create("section-separator",{display:"flex",alignItems:"center",gap:wt.spacing.md}),n=$t.create("section-line",{flex:"1",height:"1px",backgroundColor:wt.colors.border}),r=$t.create("section-title",{fontSize:wt.fontSize.small,fontWeight:"600",color:wt.colors.mutedForeground,whiteSpace:"nowrap"});return Fe("div",{className:Dt(Fs(e.width)),children:Fe("div",{className:t,children:e.label?Fe($,{children:[Fe("div",{className:n}),Fe("span",{className:r,children:e.label}),Fe("div",{className:n})]}):Fe("div",{className:n})})})}if("checkbox"===e.type){const t=$t.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:wt.spacing.sm}),a=$t.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),l=$t.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),c=$t.create("checkbox-label-text",{fontSize:wt.fontSize.default,fontWeight:"600",color:wt.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Fe("div",{className:Dt(s,Fs(e.width),r),children:[Fe("div",{className:t,children:Fe("div",{className:a,children:[Fe("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Fe("label",{htmlFor:i,className:l,children:[Fe("span",{className:c,children:[e.label,e.required&&Fe("span",{className:$t.create("checkbox-required-indicator",{color:wt.colors.destructive}),children:"*"})]}),e.description&&Fe("div",{className:$t.create("checkbox-field-description",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:qs(e.description)}})]})]})}),Fe(Ls,{errors:o})]})}return Fe("div",{className:Dt(s,Fs(e.width),r),children:[Fe(Bs,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&Fe("div",{className:$t.create("field-description",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,marginBottom:wt.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:qs(e.description)}}),n]}),Fe(Ls,{errors:o})]})}function Us({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:wt.colors.secondary+"08",borderColor:wt.colors.secondary+"30",iconColor:wt.colors.secondary,titleColor:wt.colors.foreground},error:{backgroundColor:wt.colors.destructive+"08",borderColor:wt.colors.destructive,iconColor:wt.colors.destructive,titleColor:wt.colors.destructive},critical:{backgroundColor:wt.colors.destructive+"10",borderColor:wt.colors.destructive,iconColor:wt.colors.destructive,titleColor:wt.colors.destructive}}[e.severity],o=$t.create("error-card",{padding:wt.spacing.md,borderRadius:wt.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:wt.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=$t.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=$t.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),l=$t.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),c=$t.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=$t.create("error-card-title",{fontSize:wt.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=$t.create("error-card-message",{fontSize:wt.fontSize.small,color:wt.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=$t.create("error-card-details",{fontSize:"0.8125rem",color:wt.colors.mutedForeground,fontFamily:"monospace",backgroundColor:wt.colors.muted,padding:"0.625rem",borderRadius:wt.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),m=$t.create("error-card-support",{fontSize:"0.8125rem",color:wt.colors.mutedForeground,lineHeight:"1.4"}),f=$t.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:wt.colors.mutedForeground,cursor:"pointer",borderRadius:wt.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:wt.transition});return $t.pseudoElement("error-card-dismiss",":hover",{backgroundColor:wt.colors.muted,color:wt.colors.foreground}),Fe("div",{className:Dt(o,n),children:Fe("div",{className:s,children:[Fe(()=>"warning"===e.severity?Fe("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Fe("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}):Fe("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Fe("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),{}),Fe("div",{className:l,children:[Fe("div",{className:c,children:[Fe("div",{className:u,children:e.title}),Fe("div",{className:d,children:e.message}),r&&e.details&&Fe("div",{className:h,children:e.details}),Fe("div",{className:m,children:$e(e)})]}),t&&Fe("button",{className:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none"},children:[Fe("path",{d:"M18 6 6 18"}),Fe("path",{d:"m6 6 12 12"})]})})]})]})})}function Ys(){const{definition:e,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:l}=Wt(e=>({definition:e.getFormDefinition(),currentPageIndex:e.getCurrentPageIndex(),totalPages:e.getTotalPages(),results:e.getCalculationResult(),validationErrors:e.getValidationErrors(),generalErrors:e.getGeneralErrors(),quoteIntent:e.getQuoteIntent(),isSaving:e.getIsSaving()})),{httpClient:c,urlPromoCode:u}=jt(),[d,h]=rt({status:"idle"}),[m,f]=rt(""),p=at(async e=>{const n=null!=e?e:m;if(n&&n.trim()){if((null==s?void 0:s.id)&&c){h({status:"validating"});try{const e=await c.validatePromoCode(s.id,n.trim());e.valid?h({status:"valid",name:e.name||n}):h({status:"invalid",message:e.message})}catch(e){t(),h({status:"invalid",message:"Unable to validate promo code"})}}}else h({status:"idle"})},[null==s?void 0:s.id,c,m]),g=at(e=>{"Enter"===e.key&&(e.preventDefault(),p())},[p]),y=ot(!1);it(()=>{u&&!y.current&&(null==s?void 0:s.id)&&c&&(y.current=!0,f(u),(async()=>{try{const e=await c.validatePromoCode(s.id,u.trim());if(e.valid){h({status:"valid",name:e.name||u});const t=l.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));t&&l.updateFieldValue(t.id,"promo_code",u)}else{f("");const e=l.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));e&&l.updateFieldValue(e.id,"promo_code","")}}catch(e){f("")}})())},[u,null==s?void 0:s.id,c]);const v=e.pages[n];if(!v)return Fe(As,{title:"Unexpected Error",description:"No page available"});const w=ot(new Map),b=(e,t)=>{var n;const r=l.getFormProgress().page_data[v.id],i=null==r?void 0:r[e];if(null!=i&&""!==i)return i;if(t&&("date"===t.type||"monthyear"===t.type)&&(null===(n=t.validation)||void 0===n?void 0:n.defaultDate)){const n=x(t.validation.defaultDate,"monthyear"===t.type);if(n)return l.updateFieldValue(v.id,e,n),n}return""},x=(e,t)=>{var n;const r=(null===(n=null==s?void 0:s.organisation)||void 0===n?void 0:n.timezone)||"Pacific/Auckland",i=(new Date).toLocaleString("en-US",{timeZone:r}),o=new Date(i);let a=new Date(i);switch(e){case"today":a=o;break;case"+1week":a.setDate(o.getDate()+7);break;case"+1month":a.setMonth(o.getMonth()+1);break;case"+1year":a.setFullYear(o.getFullYear()+1);break;default:return""}const l=a.getFullYear(),c=String(a.getMonth()+1).padStart(2,"0"),u=String(a.getDate()).padStart(2,"0");return t?`${l}-${c}-01`:`${l}-${c}-${u}`},k=e=>{const t=l.getFormProgress().page_data[v.id];return((null==t?void 0:t.U)||{})[e]||""},N=l.getFormProgress(),S={};Object.values(N.page_data).forEach(e=>{const{U:t,...n}=e;Object.assign(S,n),t&&Object.keys(t).length>0&&(S.U||(S.U={}),Object.assign(S.U,t))});const _=e=>{if(!e.visibility)return!0;const n=e.visibility.conditions.map(e=>"field"in e?e.field:null).filter(Boolean);n.length>0&&(t((e.label,e.code)),t(Object.keys(S)),n.forEach(e=>{e&&t((S[e],S[e]))}));const r=le(S,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions}),i="show"===e.visibility.action?r.matched:!r.matched;return w.current.get(e.id)!==i&&(t((e.label,e.code)),t(),w.current.set(e.id,i)),i},$=(()=>{for(const e of v.fields)if(e.blocker&&_(e))if(e.blocker.conditions&&e.blocker.conditions.length>0){if(le(S,{condition_type:e.blocker.condition_type||"or",conditions:e.blocker.conditions}).matched)return{field:e,config:e.blocker}}else if(void 0!==e.blocker.trigger_value){const t=e.code||e.id,n=b(t,e);if(String(n)===String(e.blocker.trigger_value))return{field:e,config:e.blocker}}return null})(),C=null==s?void 0:s.payment_return,I=C&&("declined"===C.paymentStatus||"cancelled"===C.paymentStatus||"error"===C.paymentStatus),T=l.getFormProgress().completed_pages||[];return Fe(ts,{title:v.title,description:v.description,hideHeader:!0,children:Fe("div",{children:[I&&Fe(Ns,{type:C.paymentStatus,transactionId:C.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{l.updateQuoteIntent({payment_return:void 0})}}),Fe(Rt,{children:Fe("div",{className:$t.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:wt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Fe("div",{className:$t.create("form-content-wrapper",{minWidth:"0",backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"},{"(max-width: 950px)":{minHeight:"auto"}}),children:[Fe("div",{className:$t.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Fe(js,{pages:e.pages,currentPageIndex:n,completedPages:T})}),n>0&&Fe("div",{className:$t.create("page-heading-container",{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},{"(max-width: 950px)":{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingTop:wt.spacing.md}}),children:[Fe("div",{className:$t.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:wt.spacing.lg}),children:Fe("div",{className:$t.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Fe("h1",{className:$t.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:wt.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:v.title}),v.description&&Fe("p",{className:$t.create("page-template-description",{margin:"0",marginTop:wt.spacing.sm,fontSize:wt.fontSize.small,lineHeight:"1.5",color:wt.colors.foreground,opacity:"0.7"}),children:v.description})]})}),Fe("hr",{className:$t.create("page-heading-border",{marginTop:wt.spacing.lg,borderColor:wt.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Fe(Ws,{organisation:s.organisation}),o.length>0&&o.map(e=>Fe(Us,{error:e,onDismiss:()=>l.dismissGeneralError(e.id)},e.id)),Fe("div",{className:$t.create("form-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.lg,boxShadow:wt.shadow.sm,display:"flex",flexDirection:"column",gap:wt.spacing.xl,flex:"1",minWidth:"0",overflow:"hidden"},{"(max-width: 950px)":{padding:wt.spacing.md,gap:wt.spacing.lg,flex:"initial"},"(max-width: 480px)":{padding:wt.spacing.md,gap:wt.spacing.md}}),children:[Fe("form",{onSubmit:e=>e.preventDefault(),className:$t.create("form-fields-container",{flex:"1"},{"(max-width: 950px)":{flex:"initial"}}),children:Fe("div",{className:$t.create("form-content-page",{display:"grid",gap:wt.spacing.md,rowGap:wt.spacing.lg,gridTemplateColumns:"repeat(12, minmax(0, 1fr))",minWidth:"0"},{"(max-width: 600px)":{gridTemplateColumns:"1fr"}}),children:v.fields.map(e=>{const t=e.code||e.id,n="promo_code"===t;if(!_(e))return null;if("section"===e.type)return Fe(Hs,{field:e,errors:[],children:Fe("span",{})},e.id);if("notice"===e.type)return Fe(Hs,{field:e,errors:[],children:Fe("span",{})},e.id);const r="validating"===d.status,o=n?Fe("button",{type:"button",onClick:()=>p(),disabled:!m.trim()||r,style:{height:"2.75rem",minWidth:"5rem",padding:"0 1rem",fontSize:wt.fontSize.small,backgroundColor:wt.colors.primary,color:wt.colors.primaryForeground,border:"none",borderRadius:wt.radius.default,cursor:m.trim()&&!r?"pointer":"not-allowed",opacity:m.trim()&&!r?1:.5,whiteSpace:"nowrap"},children:r?Fe(zt,{size:"small"}):"Apply"}):void 0,s=!n||"valid"!==d.status&&"invalid"!==d.status?null:Fe("div",{style:{marginTop:"0.5rem"},children:["valid"===d.status&&Fe("span",{style:{color:"#22c55e",fontSize:wt.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Fe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Fe("path",{d:"M20 6 9 17l-5-5"})}),'Promo code "',d.name,'" applied']}),"invalid"===d.status&&Fe("span",{style:{color:wt.colors.destructive,fontSize:wt.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Fe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Fe("circle",{cx:"12",cy:"12",r:"10"}),Fe("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),Fe("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),d.message]})]});return Fe(Hs,{field:e,errors:i,children:[Fe(Ms,{value:b(t,e).toString(),onChange:r=>{let i=r;"boolean"!==e.type&&"checkbox"!==e.type||(i="true"===r),l.updateFieldValue(v.id,t,i),n&&(f(r),h({status:"idle"}))},onKeyDown:n?g:void 0,answer:k(t),onAnswerChange:n=>{var r;l.updateFieldAnswer(v.id,t,n,null===(r=e.boolean_config)||void 0===r?void 0:r.details_rating_factor_id)},id:t,name:t,type:e.type,placeholder:e.placeholder,options:e.options,validation:e.validation,booleanConfig:e.boolean_config,add_null_option:e.add_null_option,null_option_label:e.null_option_label,inline:e.inline,hasError:l.hasFieldErrors(t),errors:l.getFieldErrors(t),suffix:o}),s]},e.id)})})}),$&&Fe("div",{className:$t.create("form-blocker",{backgroundColor:wt.colors.accent,borderRadius:wt.radius.default,padding:wt.spacing.lg,borderLeft:`4px solid ${wt.colors.primary}`}),children:[Fe("h3",{className:$t.create("form-blocker-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.125rem",fontWeight:"600",color:wt.colors.accentForeground}),children:$.config.title}),Fe("p",{className:$t.create("form-blocker-message",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.accentForeground,opacity:"0.9"}),children:$.config.message}),$.config.link&&Fe("a",{href:$.config.link.url,target:"_blank",rel:"noopener noreferrer",className:$t.create("form-blocker-link",{display:"inline-flex",alignItems:"center",gap:"0.375rem",marginTop:wt.spacing.md,fontSize:wt.fontSize.default,fontWeight:"600",color:wt.colors.primary,textDecoration:"none"}),children:[$.config.link.label,Fe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Fe("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),Fe("polyline",{points:"15 3 21 3 21 9"}),Fe("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),Fe("hr",{className:$t.create("form-navigation-border",{borderColor:wt.colors.border})}),Fe("div",{className:0===n?$t.create("form-navigation-inline-first",{paddingTop:wt.spacing.lg,display:"flex",alignItems:"center",justifyContent:"flex-end"}):$t.create("form-navigation-inline",{paddingTop:wt.spacing.lg,display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[n>0&&Fe(is,{onClick:()=>null==l?void 0:l.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Back"}),!$&&Fe(is,{onClick:async function(){l.validateCurrentPage().length>0||(n===r-1?await(null==l?void 0:l.calculateQuote()):await(null==l?void 0:l.navigateToNextPage()))},disabled:a,loading:a,children:n===r-1?"Get Quote":"Continue"})]})]})]}),Fe("div",{className:$t.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Fe(Os,{pages:e.pages,currentPageIndex:n,completedPages:T})})]})})]})})}function Zs(){var e,t,n;const{quoteIntent:r,fsm:i}=Wt(e=>({quoteIntent:e.getQuoteIntent(),fsm:e})),o=null==r?void 0:r.payment_return,s=null==o?void 0:o.paymentTransactionId,a=null==o?void 0:o.transactionStatus,l=null===(e=null==r?void 0:r.organisation)||void 0===e?void 0:e.name,c=null===(t=null==r?void 0:r.organisation)||void 0===t?void 0:t.admin_email,u=null===(n=null==r?void 0:r.organisation)||void 0===n?void 0:n.phone,d=c||u;it(()=>{if(s&&r){const e=null==o?void 0:o.paymentStatus,t=null==a?void 0:a.amount;"success"===e&&a?Oe(r,s,t||0,a.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&je(r,s,t,null==a?void 0:a.gateway_code,e,null==a?void 0:a.status)}const e=setTimeout(()=>{null==i||i.clearStoredQuoteIntent()},2e3);return()=>clearTimeout(e)},[i,s,o,r]);const h=$t.create("success-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.xl,boxShadow:wt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:wt.spacing.lg},"(max-width: 480px)":{padding:wt.spacing.md}}),m=$t.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:wt.spacing.lg}),f=$t.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=$t.create("success-header",{textAlign:"center",marginBottom:wt.spacing.xl}),g=$t.create("success-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=$t.create("success-message",{fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9",margin:"0"}),v=$t.create("success-contact-section",{borderTop:`1px solid ${wt.colors.border}`,paddingTop:wt.spacing.xl,marginTop:wt.spacing.xl}),w=$t.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:wt.colors.foreground,marginBottom:wt.spacing.md,textAlign:"center"}),b=$t.create("success-contact-details",{backgroundColor:wt.colors.accent,borderRadius:wt.radius.default,padding:wt.spacing.md,display:"flex",flexDirection:"column",gap:wt.spacing.sm,marginBottom:wt.spacing.lg}),x=$t.create("success-contact-item",{display:"flex",alignItems:"center",gap:wt.spacing.sm,fontSize:wt.fontSize.small,color:wt.colors.accentForeground}),k=$t.create("success-actions",{display:"flex",gap:wt.spacing.md,flexWrap:"wrap",justifyContent:"center"}),N=$t.create("success-reference",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,textAlign:"center",marginTop:wt.spacing.md});return Fe(ts,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe(ns,{children:Fe("div",{className:h,children:[Fe("div",{className:m,children:Fe("div",{className:f,children:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Fe("path",{d:"M20 6 9 17l-5-5"})})})}),Fe("div",{className:p,children:[Fe("h1",{className:g,children:"Payment Complete!"}),Fe("p",{className:y,children:["Your payment has been processed successfully and your policy is being set up. You will receive your policy documentation by email."," ","For now, you can relax knowing you're ",l?`covered by ${l}`:"covered","."]})]}),d&&Fe("div",{className:v,children:[Fe("h3",{className:w,children:"Need assistance?"}),Fe("div",{className:b,children:[c&&Fe("div",{className:x,children:[Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[Fe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Fe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Fe("span",{children:c})]}),u&&Fe("div",{className:x,children:[Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Fe("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),Fe("span",{children:u})]})]}),Fe("div",{className:k,children:[u&&Fe(is,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:Fe("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),"Call Us"]}),c&&Fe(is,{variant:"outline",onClick:()=>window.open(`mailto:${c}`),children:[Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:[Fe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Fe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),r.reference&&Fe("div",{className:N,children:["Quote Reference: ",Fe("strong",{children:r.reference})]})]})})})})}function Gs({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,s]=rt("initiating"),[a,l]=rt(null),[c,u]=rt(null),[d,h]=rt(null);it(()=>{e&&r&&m()},[e,r]);const m=async()=>{var e;if(r)try{s("initiating"),l(null);const t={...r,returnUrl:window.location.href},n=null===(e=r.metadata)||void 0===e?void 0:e.gateway;if(!n)throw new Error("Payment gateway not found");const o=await i.initiatePayment(t,n);h(o.transaction_id),s("redirecting"),window.location.href=o.gateway_acceptance_url}catch(e){l(e.message||"Failed to initiate payment"),s("failed")}},f=()=>{c&&!c.closed&&c.close(),s("initiating"),l(null),h(null),u(null),t()};return e?Fe("div",{className:$t.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),children:[Fe("div",{className:$t.create("modal-content",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${wt.colors.border}`}),children:[Fe("div",{className:$t.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Fe("div",{className:$t.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Fe("h2",{className:$t.create("modal-title",{margin:"0",color:wt.colors.foreground,fontSize:wt.fontSize.large}),children:"Payment Processing"})]}),Fe("div",{className:$t.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Fe(as,{className:$t.create("status-message",{fontSize:wt.fontSize.default,color:wt.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(o){case"initiating":return"Setting up your payment...";case"redirecting":return"Redirecting to payment portal...";case"processing":default:return"Processing payment...";case"polling":return"Checking payment status...";case"completed":return"Payment completed successfully!";case"cancelled":return"Payment was cancelled";case"failed":return"Payment failed"}})()}),a&&Fe(as,{className:$t.create("error-message",{color:wt.colors.destructive,fontSize:wt.fontSize.small,padding:"0.75rem",backgroundColor:wt.colors.destructive+"10",borderRadius:wt.radius.default,border:`1px solid ${wt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Fe("div",{className:$t.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${wt.colors.border}`,borderTop:`3px solid ${wt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Fe("div",{className:$t.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Fe($,{children:[Fe(is,{onClick:f,variant:"outline",children:"Close"}),"cancelled"===o&&Fe(is,{onClick:()=>{s("initiating"),l(null),m()},children:"Try Again"})]}):Fe(is,"completed"===o?{onClick:f,children:"Continue"}:{onClick:f,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Fe("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Vs({transactionId:e,organisationId:t,allowCancel:n=!0}){const{httpClient:r}=jt(),[i,o]=rt(!0),[s,a]=rt(null),[l,c]=rt(null),[u,d]=rt(!1),[h,m]=rt(!1),[f,p]=rt(!1);it(()=>{g()},[e]);const g=async()=>{try{if(o(!0),a(null),!r)throw new Error("HTTP client not available");const n=r.getBaseUrl(),i=await fetch(`${n}/payments/bank-transfer/${e}?orgId=${t}`);if(!i.ok)throw new Error(`Failed to load bank transfer details: ${i.statusText}`);const s=await i.json(),l=s.data||s;c({bank_account_name:l.bank_account_name,bank_account_number:l.bank_account_number,instructions_html:l.instructions_html,reference:l.reference,amount:Number(l.amount),currency:l.currency})}catch(e){a(e.message||"Failed to load bank transfer details")}finally{o(!1)}};return i?Fe(rs,{message:"Loading payment details..."}):s?Fe(ts,{title:"Error",description:"Failed to load bank transfer details",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe(ns,{children:Fe("div",{className:$t.create("error-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.xl,boxShadow:wt.shadow.sm,maxWidth:"42rem",margin:"0 auto",textAlign:"center"},{"(max-width: 480px)":{padding:wt.spacing.lg}}),children:[Fe("div",{className:$t.create("error-icon",{fontSize:"3rem",marginBottom:wt.spacing.md,color:wt.colors.destructive}),children:"⚠️"}),Fe("h2",{className:$t.create("error-title",{margin:"0",marginBottom:wt.spacing.sm,color:wt.colors.foreground}),children:"Error Loading Payment Details"}),Fe("p",{className:$t.create("error-message",{color:wt.colors.mutedForeground}),children:s})]})})})}):l?Fe(ts,{title:"Bank Transfer Payment",description:"Complete your payment via bank transfer",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:[Fe(ns,{children:Fe("div",{className:$t.create("bank-transfer-container",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,maxWidth:"42rem",margin:"0 auto",overflow:"hidden",boxShadow:"0 20px 60px rgba(0,0,0,0.1)"}),children:[Fe("div",{style:{backgroundColor:wt.colors.primary},className:$t.create("bank-transfer-header",{color:"white",padding:"2.5rem 2rem",textAlign:"center"},{"(max-width: 480px)":{padding:"1.5rem 1rem"}}),children:[Fe("h1",{className:$t.create("header-title",{fontSize:"1.75rem",fontWeight:"700",margin:"0",marginBottom:"0.5rem"},{"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:"0.25rem"}}),children:"Bank Transfer Payment"}),Fe("p",{className:$t.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:wt.fontSize.small}}),children:"Complete your payment using the details below"})]}),Fe("div",{className:$t.create("bank-transfer-content",{padding:"2rem"},{"(max-width: 480px)":{padding:"1rem"}}),children:[Fe("div",{className:$t.create("payment-details-card",{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:wt.radius.default,padding:"1.5rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Fe("div",{className:$t.create("detail-row-amount",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.5rem"}}),children:[Fe("span",{className:$t.create("detail-label",{color:"#6b7280",fontSize:wt.fontSize.default}),children:"Amount to Transfer"}),Fe("span",{className:$t.create("detail-value-amount",{color:wt.colors.primary,fontSize:"1.5rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:["$",l.amount.toFixed(2)," ",l.currency]})]}),Fe("div",{className:$t.create("detail-row-name",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Fe("span",{className:$t.create("detail-label-name",{color:"#6b7280",fontSize:wt.fontSize.default}),children:"Account Name"}),Fe("span",{className:$t.create("detail-value-name",{color:wt.colors.foreground,fontSize:wt.fontSize.default,fontWeight:"600"}),children:l.bank_account_name})]}),Fe("div",{className:$t.create("detail-row-number",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Fe("span",{className:$t.create("detail-label-number",{color:"#6b7280",fontSize:wt.fontSize.default}),children:"Account Number"}),Fe("span",{className:$t.create("detail-value-number",{color:wt.colors.foreground,fontSize:wt.fontSize.default,fontWeight:"600"}),children:l.bank_account_number})]}),Fe("div",{className:$t.create("detail-row-ref",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Fe("span",{className:$t.create("detail-label-ref",{color:"#6b7280",fontSize:wt.fontSize.default}),children:"Payment Reference"}),Fe("span",{className:$t.create("detail-value-ref",{color:wt.colors.foreground,fontSize:wt.fontSize.default,fontWeight:"600"}),children:l.reference})]})]}),Fe("div",{className:$t.create("instructions-card",{backgroundColor:"#eff6ff",borderLeft:`4px solid ${wt.colors.primary}`,borderRadius:wt.radius.default,padding:"1.25rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Fe("h3",{className:$t.create("instructions-title",{margin:"0 0 0.75rem 0",fontSize:wt.fontSize.default,fontWeight:"600",color:wt.colors.foreground}),children:"Payment Instructions"}),Fe("p",{className:$t.create("instructions-text",{margin:"0 0 0.75rem 0",fontSize:wt.fontSize.small,lineHeight:"1.6",color:wt.colors.foreground}),children:[Fe("strong",{children:"Important:"})," Please include the payment reference when making your transfer to ensure your payment is processed correctly."]}),Fe("p",{className:$t.create("instructions-text",{margin:"0",fontSize:wt.fontSize.small,lineHeight:"1.6",color:wt.colors.foreground}),children:"Once we receive your payment, we'll process your quote and send you a confirmation email."})]}),Fe("div",{className:$t.create("button-wrapper",{textAlign:"center",marginBottom:"1.5rem",display:"flex",gap:"1rem",justifyContent:"center",flexWrap:"wrap"},{"(max-width: 480px)":{flexDirection:"column",gap:"0.75rem",marginBottom:"1rem"}}),children:[Fe("button",{onClick:()=>{d(!0)},style:{backgroundColor:wt.colors.primary},className:$t.create("confirm-button",{color:"white",border:"none",borderRadius:wt.radius.default,padding:"0.75rem 2rem",fontSize:wt.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"opacity 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"I've Made the Transfer"}),n&&Fe("button",{onClick:()=>{m(!0)},className:$t.create("cancel-button",{color:"#6b7280",backgroundColor:"white",border:"2px solid #e5e7eb",borderRadius:wt.radius.default,padding:"0.75rem 2rem",fontSize:wt.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"all 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"Cancel"})]}),Fe("p",{className:$t.create("footer-text",{textAlign:"center",color:"#6b7280",fontSize:wt.fontSize.small,margin:"0"}),children:"Your quote has been saved. We'll process it once payment is received."})]})]})}),h&&Fe("div",{className:$t.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),onClick:()=>!f&&m(!1),children:Fe("div",{className:$t.create("modal-content",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${wt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:wt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Fe("div",{className:$t.create("warning-icon",{fontSize:"4rem",marginBottom:wt.spacing.md}),children:"⚠️"}),Fe("h3",{className:$t.create("modal-title",{margin:"0",marginBottom:wt.spacing.sm,color:wt.colors.foreground,fontSize:wt.fontSize.large,fontWeight:"600"}),children:"Are you sure?"}),Fe("p",{className:$t.create("modal-message",{margin:"0",marginBottom:wt.spacing.lg,color:wt.colors.foreground,lineHeight:"1.6"}),children:"This will take you back to the checkout page."}),Fe("div",{className:$t.create("modal-buttons",{display:"flex",flexDirection:"column-reverse",gap:"0.75rem",justifyContent:"center"}),children:[Fe("button",{onClick:()=>m(!1),disabled:f,className:$t.create("no-button",{backgroundColor:"#f3f4f6",color:wt.colors.foreground,border:"none",borderRadius:wt.radius.default,padding:`${wt.spacing.sm} ${wt.spacing.lg}`,fontSize:wt.fontSize.default,fontWeight:"500",cursor:f?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:f?"0.5":"1",width:"100%"}),children:"No, Go Back"}),Fe("button",{onClick:async()=>{if(r)try{p(!0);const n=r.getBaseUrl();if(!(await fetch(`${n}/payments/${e}/cancel-bank-transfer?orgId=${t}`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to cancel payment");window.location.reload()}catch(e){a("Failed to cancel payment. Please try again."),m(!1),p(!1)}},disabled:f,className:$t.create("yes-button",{backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:wt.radius.default,padding:`${wt.spacing.sm} ${wt.spacing.lg}`,fontSize:wt.fontSize.default,fontWeight:"500",cursor:f?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:f?"0.5":"1",width:"100%"}),children:f?"Cancelling...":"Yes, Cancel Payment"})]})]})}),u&&Fe("div",{className:$t.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),onClick:()=>d(!1),children:Fe("div",{className:$t.create("modal-content",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${wt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:wt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Fe("div",{className:$t.create("success-icon",{fontSize:"4rem",marginBottom:wt.spacing.md}),children:"✓"}),Fe("h3",{className:$t.create("modal-title",{margin:"0",marginBottom:wt.spacing.sm,color:wt.colors.primary,fontSize:wt.fontSize.large,fontWeight:"600"}),children:"Thank You!"}),Fe("p",{className:$t.create("modal-message",{margin:"0",marginBottom:wt.spacing.lg,color:wt.colors.foreground,lineHeight:"1.6"}),children:"We'll process your payment as soon as we receive it. You'll receive a confirmation email once your coverage is activated."}),Fe("button",{onClick:()=>d(!1),className:$t.create("close-button",{backgroundColor:wt.colors.primary,color:"white",border:"none",borderRadius:wt.radius.default,padding:`${wt.spacing.sm} ${wt.spacing.lg}`,fontSize:wt.fontSize.default,fontWeight:"500",cursor:"pointer",transition:"opacity 150ms ease"}),children:"Close"})]})})]})}):null}$t.pseudoElement("sidebar-continue-later-button",":hover",{backgroundColor:wt.colors.muted,borderColor:wt.colors.primary,color:wt.colors.primary});class Qs{static async loadTheme(e){try{if(t(e.slug),t(e.theme_url),this.loadedThemes.has(e.slug))return void t(e.slug);const n=await fetch(e.theme_url,{method:"GET",headers:{Accept:"text/css"}});if(!n.ok)throw new Error(`Failed to load theme: ${n.status} ${n.statusText}`);const r=await n.text();t(r.substring(0,200));const i=this.parseCSSContent(r);t(i.mappedVariables),t(i.classRules.length),this.applyParsedTheme(e.slug,i),this.loadedThemes.add(e.slug),t(e.slug)}catch(n){throw t(e.slug),n}}static parseCSSContent(e){t();const n={},r={};let i="";const o=e.match(/:root\s*\{([^}]+)\}/);if(o){const e=o[1];t(null==e||e.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(e));){const e=`--${s[1]}`,i=s[2].trim();n[e]=i;const o=this.variableMapping[e];o?(r[o]=i,t()):t()}}else t();return i=e.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&t(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(e,n){t(),Promise.resolve().then(function(){return Ct}).then(({updateBaseVariables:e})=>{Object.keys(n.mappedVariables).length>0&&(t(n.mappedVariables),e(n.mappedVariables))}).catch(()=>{t()}),n.classRules&&this.applyClassRules(e,n.classRules),this.injectOriginalCSS(e,n)}static applyClassRules(e,n){const r=document.getElementById(`insure-os-theme-classes-${e}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static injectOriginalCSS(e,n){const r=document.getElementById(`insure-os-theme-original-${e}`);r&&r.remove();const i={};for(const[e,t]of Object.entries(n.variables))this.variableMapping[e]||(i[e]=t);if(Object.keys(i).length>0){const n=`:root {\n${Object.entries(i).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,r=document.createElement("style");r.id=`insure-os-theme-original-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static removeTheme(e){let n=!1;[`insure-os-theme-classes-${e}`,`insure-os-theme-original-${e}`].forEach(e=>{const t=document.getElementById(e);t&&(t.remove(),n=!0)}),n&&(this.loadedThemes.delete(e),t())}static isThemeLoaded(e){return this.loadedThemes.has(e)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}Qs.loadedThemes=new Set,Qs.variableMapping={"--color-primary":"--insure-os-primary","--color-primary-foreground":"--insure-os-primary-foreground","--color-secondary":"--insure-os-secondary","--color-secondary-foreground":"--insure-os-secondary-foreground","--color-accent":"--insure-os-accent","--color-accent-foreground":"--insure-os-accent-foreground","--color-background":"--insure-os-background","--color-foreground":"--insure-os-foreground","--color-card":"--insure-os-card","--color-card-foreground":"--insure-os-card-foreground","--color-popover":"--insure-os-popover","--color-popover-foreground":"--insure-os-popover-foreground","--color-muted":"--insure-os-muted","--color-muted-foreground":"--insure-os-muted-foreground","--color-destructive":"--insure-os-destructive","--color-border":"--insure-os-border","--color-input":"--insure-os-input","--color-ring":"--insure-os-ring","--font-sans":"--insure-os-font-family","--radius":"--insure-os-radius","--radius-sm":"--insure-os-radius-sm","--radius-lg":"--insure-os-radius-lg"};var Js=Object.freeze({__proto__:null,ThemeLoader:Qs});function Ks({paymentLinkId:e,signedUrl:n}){var r,i,o,s,a,l,c,u,d,h;const m=jt().httpClient,[f,p]=rt(null),[g,y]=rt(!0),[v,w]=rt(null),[b,x]=rt(!1),[k,N]=rt(null),[S,_]=rt(null),[C,I]=rt(null),[T,E]=rt(!1),[P,D]=rt(null),[z,R]=rt(null),[M,O]=rt(!0),[j,W]=rt(()=>{var e;return null!==(e=(new Date).toISOString().split("T")[0])&&void 0!==e?e:""}),[A,L]=rt(null),[B,F]=rt(!1),[q,H]=rt(null),[U,Y]=rt(null),[Z,G]=rt(null);it(()=>{V()},[e]);const V=async()=>{var r,i,o;try{y(!0);const s=new URLSearchParams(window.location.search),a=s.get("transactionId"),l=s.get("status"),c=s.get("gateway_code"),u=s.get("excess_id");a&&l&&(E(!0),D(l),R(a)),c&&I(c);const d=n?await m.getPaymentLinkDetails(n):await m.getPaymentLinkById(e);if(d.organisation&&d.organisation.theme)try{await Qs.loadTheme({slug:d.organisation.slug,theme_url:d.organisation.theme.css_url})}catch(e){t()}if("paid"===d.status&&!T&&(!a||"completed"!==l&&"success"!==l))return p(d),void w("This payment link has already been used.");if("superseded"===d.status)return p(d),void w("This payment link has been replaced by a newer one. Please use the latest link you received.");if("confirmed"===d.status)return p(d),void Y({message:"Your renewal is confirmed. Your premium funding will continue automatically on the policy start date.",effectiveDate:null===(r=d.metadata)||void 0===r?void 0:r.effective_date});if("expired"===d.status)return p(d),void w("This payment link has expired.");if("cancelled"===d.status)return p(d),void w("This payment link has been cancelled.");if("outdated"===d.status)return p(d),void w("This payment link is no longer valid because the quote has been updated. Please request a new payment link.");if("awaiting_payment"===d.status&&d.pending_bank_transfer){const e=d.pending_bank_transfer;return t(),void G({transactionId:e.transaction_id,organisationId:(null===(i=d.organisation)||void 0===i?void 0:i.id)||""})}if(u){const e=d.calculations.find(e=>e.excess_id===u);e?_(e.id):1===d.calculations.length&&d.calculations[0]&&_(d.calculations[0].id)}else 1===d.calculations.length&&d.calculations[0]&&_(d.calculations[0].id);!c&&1===d.payment_options.length&&d.payment_options[0]&&I(d.payment_options[0].gateway_code),p(d),(null===(o=d.organisation)||void 0===o?void 0:o.quote_page_url)&&H(d.organisation.quote_page_url)}catch(e){w("Failed to load payment details. Please check your link.")}finally{y(!1)}},Q=st(()=>f&&S?f.calculations.find(e=>e.id===S):null,[f,S]),J=st(()=>f&&C?f.payment_options.find(e=>e.gateway_code===C):null,[f,C]);if(Z)return Fe(Vs,{transactionId:Z.transactionId,organisationId:Z.organisationId,allowCancel:!1});if(U){const e=null==f?void 0:f.organisation,t=null==e?void 0:e.admin_email,n=null==e?void 0:e.phone,r=t||n;return Fe(ts,{title:"Renewal Confirmed",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe("div",{className:$t.create("auto-renew-success-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.xl,boxShadow:wt.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Fe("div",{className:$t.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:wt.spacing.lg}),children:Fe("div",{className:$t.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Fe("path",{d:"M20 6 9 17l-5-5"})})})}),Fe("div",{className:$t.create("success-header",{textAlign:"center",marginBottom:wt.spacing.xl}),children:[Fe("h1",{className:$t.create("success-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Renewal Confirmed"}),Fe("p",{className:$t.create("success-message",{fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9",margin:"0"}),children:U.message})]}),U.effectiveDate&&Fe("div",{className:$t.create("payment-date-box",{backgroundColor:wt.colors.accent,borderRadius:wt.radius.default,padding:wt.spacing.lg,marginBottom:wt.spacing.lg,textAlign:"center"}),children:[Fe("p",{className:$t.create("payment-date-label",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,margin:"0",marginBottom:wt.spacing.sm}),children:"Your first payment will be on"}),Fe("p",{className:$t.create("payment-date-value",{fontSize:"1.25rem",fontWeight:"600",color:wt.colors.foreground,margin:"0"}),children:new Date(U.effectiveDate).toLocaleDateString("en-NZ",{weekday:"long",year:"numeric",month:"long",day:"numeric"})})]}),Fe("div",{className:$t.create("info-box",{backgroundColor:wt.colors.muted,borderRadius:wt.radius.default,padding:wt.spacing.md,marginBottom:wt.spacing.lg}),children:Fe("p",{className:$t.create("info-text",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,margin:"0",textAlign:"center"}),children:"No further action is required. Your monthly payments will continue as normal."})}),r&&Fe("div",{className:$t.create("contact-section",{borderTop:`1px solid ${wt.colors.border}`,paddingTop:wt.spacing.xl,marginTop:wt.spacing.xl}),children:[Fe("h3",{className:$t.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:wt.colors.foreground,marginBottom:wt.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Fe("div",{className:$t.create("contact-details",{backgroundColor:wt.colors.accent,borderRadius:wt.radius.default,padding:wt.spacing.md,display:"flex",flexDirection:"column",gap:wt.spacing.sm}),children:[t&&Fe("div",{className:$t.create("contact-item",{display:"flex",alignItems:"center",gap:wt.spacing.sm,fontSize:wt.fontSize.small,color:wt.colors.accentForeground}),children:Fe("span",{children:["Email: ",t]})}),n&&Fe("div",{className:$t.create("contact-item",{display:"flex",alignItems:"center",gap:wt.spacing.sm,fontSize:wt.fontSize.small,color:wt.colors.accentForeground}),children:Fe("span",{children:["Phone: ",n]})})]})]})]})})})}if(g)return Fe(ts,{title:"Loading...",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe("div",{className:$t.create("payment-link-loading-card",{textAlign:"center",padding:wt.spacing.xl,backgroundColor:wt.colors.card,borderRadius:wt.radius.large,boxShadow:wt.shadow.sm,maxWidth:"600px",margin:"0 auto"}),children:Fe("p",{className:$t.create("loading-text",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.default}),children:"Loading payment details..."})})})});if(v){const e=null==f?void 0:f.organisation,t=null==e?void 0:e.quote_page_url,n=null==e?void 0:e.name,r=null==e?void 0:e.admin_email,i=null==e?void 0:e.phone,o=r||i,s=$t.create("pl-error-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.xl,boxShadow:wt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:wt.spacing.lg},"(max-width: 480px)":{padding:wt.spacing.md}}),a=$t.create("pl-error-icon-container",{display:"flex",justifyContent:"center",marginBottom:wt.spacing.lg}),l=$t.create("pl-error-icon",{width:"4rem",height:"4rem",color:wt.colors.primary}),c=$t.create("pl-error-header",{textAlign:"center",marginBottom:wt.spacing.xl}),u=$t.create("pl-error-title",{fontSize:"2rem",fontWeight:"700",color:wt.colors.primary,marginBottom:wt.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),d=$t.create("pl-error-subtitle",{fontSize:wt.fontSize.default,color:wt.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),h=$t.create("pl-error-contact-section",{borderTop:`1px solid ${wt.colors.border}`,paddingTop:wt.spacing.xl,marginTop:wt.spacing.xl,textAlign:"center"}),m=$t.create("pl-error-contact-text",{fontSize:wt.fontSize.default,color:wt.colors.foreground,marginBottom:wt.spacing.lg}),p=$t.create("pl-error-actions",{display:"flex",gap:wt.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:wt.spacing.lg}),g=()=>Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:l,children:[Fe("circle",{cx:"12",cy:"12",r:"10"}),Fe("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),Fe("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]});return Fe(ts,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe(ns,{children:Fe("div",{className:s,children:[Fe("div",{className:a,children:Fe(g,{})}),Fe("div",{className:c,children:[Fe("h1",{className:u,children:"Payment Link Unavailable"}),Fe("p",{className:d,children:v})]}),t&&Fe("div",{className:$t.create("pl-error-quote-action",{display:"flex",justifyContent:"center",marginBottom:o?"0":wt.spacing.sm}),children:Fe(is,{variant:"primary",onClick:()=>{window.location.href=t},children:"Start a New Quote"})}),o&&Fe("div",{className:h,children:[Fe("p",{className:m,children:n?`Need assistance? Contact ${n}`:"Need assistance? Contact us"}),Fe("div",{className:p,children:[i&&Fe(is,{variant:"outline",onClick:()=>window.open(`tel:${i}`),children:[Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:Fe("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),"Call Us"]}),r&&Fe(is,{variant:"outline",onClick:()=>window.open(`mailto:${r}`),children:[Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:[Fe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Fe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]})]})})})})}if(!f)return null;const K=new URLSearchParams(window.location.search),X=K.get("transactionId"),ee=K.get("status"),te=X&ⅇif("paid"===f.status&&("completed"===ee||"success"===ee||te||T||"completed"===P)){const e=null===(r=f.organisation)||void 0===r?void 0:r.admin_email,t=null===(i=f.organisation)||void 0===i?void 0:i.phone,n=e||t;return Fe(ts,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe("div",{className:$t.create("payment-success-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.xl,boxShadow:wt.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Fe("div",{className:$t.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:wt.spacing.lg}),children:Fe("div",{className:$t.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Fe("path",{d:"M20 6 9 17l-5-5"})})})}),Fe("div",{className:$t.create("success-header",{textAlign:"center",marginBottom:wt.spacing.xl}),children:[Fe("h1",{className:$t.create("success-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Payment Complete!"}),Fe("p",{className:$t.create("success-message",{fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&Fe("div",{className:$t.create("contact-section",{borderTop:`1px solid ${wt.colors.border}`,paddingTop:wt.spacing.xl,marginTop:wt.spacing.xl}),children:[Fe("h3",{className:$t.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:wt.colors.foreground,marginBottom:wt.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Fe("div",{className:$t.create("contact-details",{backgroundColor:wt.colors.accent,borderRadius:wt.radius.default,padding:wt.spacing.md,display:"flex",flexDirection:"column",gap:wt.spacing.sm,marginBottom:wt.spacing.lg}),children:[e&&Fe("div",{className:$t.create("contact-item",{display:"flex",alignItems:"center",gap:wt.spacing.sm,fontSize:wt.fontSize.small,color:wt.colors.accentForeground}),children:Fe("span",{children:["Email: ",e]})}),t&&Fe("div",{className:$t.create("contact-item",{display:"flex",alignItems:"center",gap:wt.spacing.sm,fontSize:wt.fontSize.small,color:wt.colors.accentForeground}),children:Fe("span",{children:["Phone: ",t]})})]}),(z||X)&&Fe("div",{className:$t.create("reference",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,textAlign:"center",marginTop:wt.spacing.md}),children:["Transaction ID: ",Fe("strong",{children:null===(o=z||X)||void 0===o?void 0:o.slice(0,8).toUpperCase()})]})]})]})})})}const ne=M&&te&&("failed"===ee||"cancelled"===ee||"failed"===P||"cancelled"===P),re="cancelled"===ee||"cancelled"===P?"cancelled":"failed"===ee||"failed"===P?"declined":"error",ie=f.calculations,oe=ie.length>1,se=ie.length>0,ae=se,le=(null===(s=f.metadata)||void 0===s?void 0:s.product_name)||"Payment",ce=new Date(f.expires_at),ue=Boolean(null===(a=null==f?void 0:f.metadata)||void 0===a?void 0:a.quote_intent_id),de=Boolean((!se||S)&&C&&!A&&!B),he=st(()=>{var e;const t=null===(e=null==f?void 0:f.metadata)||void 0===e?void 0:e.client_details;return t?{firstName:t.first_name,lastName:t.last_name,email:t.email,phone:t.phone}:null},[f]),me=st(()=>Q&&Q.line_item_display||null,[Q]);return Fe(ts,{title:"Complete Your Purchase",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:[Fe("div",{className:$t.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:wt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:wt.spacing.md}}),children:[Fe("div",{className:$t.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,display:"flex",flexDirection:"column"}),children:[Fe("div",{className:$t.create("checkout-header",{paddingInline:wt.spacing.xl,paddingTop:wt.spacing.xl,paddingBottom:wt.spacing.lg},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingTop:wt.spacing.md}}),children:[Fe("h2",{className:$t.create("checkout-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Fe("p",{className:$t.create("checkout-description",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9"}),children:se?oe?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage.":"Choose your payment option to complete your purchase."}),Fe("hr",{className:$t.create("checkout-header-border",{marginTop:wt.spacing.lg,border:"0",borderTop:`1px solid ${wt.colors.border}`,height:"0"})})]}),Fe("div",{className:$t.create("checkout-sections",{paddingInline:wt.spacing.xl,paddingBottom:wt.spacing.xl,display:"flex",flexDirection:"column",gap:wt.spacing.lg},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingBottom:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingBottom:wt.spacing.md}}),children:[ue&&Fe("div",{className:$t.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Fe(ls,{title:"Cover Start Date"}),Fe("div",{className:$t.create("cover-date-container",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:[Fe("input",{type:"date",value:j,onChange:e=>{return t=e.target.value,W(t),void(async e=>{var t;if(f&&m&&(null===(t=f.metadata)||void 0===t?void 0:t.quote_intent_id)){F(!0),L(null);try{const t=await m.validateCoverStartDate(f.payment_link_id,e);t.valid?L(null):(L(t.message||"This cover start date is not valid."),t.quote_page_url&&H(t.quote_page_url))}catch(e){L("Failed to validate cover date. Please try again.")}finally{F(!1)}}})(t);var t},min:(new Date).toISOString().split("T")[0],max:(()=>{const e=new Date;return e.setDate(e.getDate()+30),e.toISOString().split("T")[0]})(),disabled:B,className:$t.create("cover-date-input",{padding:"0.75rem 1rem",fontSize:wt.fontSize.default,border:`2px solid ${A?wt.colors.destructive:wt.colors.border}`,borderRadius:wt.radius.default,backgroundColor:wt.colors.background,color:wt.colors.foreground,width:"auto",maxWidth:"200px",cursor:B?"wait":"pointer"})}),B&&Fe("p",{className:$t.create("validating-text",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,margin:"0"}),children:"Validating..."}),A&&Fe("div",{className:$t.create("cover-date-error",{backgroundColor:`${wt.colors.destructive}10`,border:`1px solid ${wt.colors.destructive}`,borderRadius:wt.radius.default,padding:"1rem"}),children:[Fe("p",{className:$t.create("error-message",{color:wt.colors.destructive,fontSize:wt.fontSize.small,margin:"0",marginBottom:q?wt.spacing.md:"0"}),children:A}),q&&Fe("a",{href:q,className:$t.create("new-quote-link",{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:wt.colors.primary,fontSize:wt.fontSize.small,fontWeight:"500",textDecoration:"none"}),children:["Start New Quote",Fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[Fe("path",{d:"M5 12h14"}),Fe("path",{d:"m12 5 7 7-7 7"})]})]})]})]})]}),ae&&se&&Fe("div",{className:$t.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Fe(ls,{title:1===ie.length?"Excess":"Excess Options"}),Fe("div",{className:$t.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:[...ie].sort((e,t)=>e.excess_amount-t.excess_amount).map(e=>{const t=e.id===S;return Fe("div",{className:Dt($t.create("excess-option-card",{borderRadius:wt.radius.default,minWidth:"125px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),t?$t.create("excess-option-card-selected",{border:`2px solid ${wt.colors.primary}`,backgroundColor:wt.colors.accent}):$t.create("excess-option-card-unselected",{border:`2px solid ${wt.colors.border}`,backgroundColor:wt.colors.card})),onClick:()=>_(e.id),children:[Fe(cs,{selected:t}),Fe("div",{className:$t.create("excess-amount",{color:wt.colors.foreground}),children:[e.excess_label||`$${Number(e.excess_amount).toFixed(0)}`,e.description?"*":""]})]},e.id)})}),(null==Q?void 0:Q.description)&&Fe("div",{className:$t.create("excess-description",{padding:"0.75rem",backgroundColor:wt.colors.muted,borderRadius:wt.radius.default,border:`1px solid ${wt.colors.border}`}),children:Fe(as,{className:$t.create("excess-description-text",{fontSize:wt.fontSize.small,color:wt.colors.foreground,margin:"0"}),children:Q.description})})]}),f.payment_options.length>0&&Fe("div",{className:$t.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Fe(ls,{title:"Payment Options"}),Fe("div",{className:$t.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:f.payment_options.map(e=>{const t=C===e.gateway_code,n="monthly"===e.payment_frequency,r=()=>{var t;return n&&e.amount.monthly?`${ds(parseFloat(e.amount.monthly))} x ${(null===(t=e.metadata)||void 0===t?void 0:t.number_of_instalments)||12}`:ds(parseFloat(e.amount.due_today))},i=()=>e.description?e.description:"bank_transfer"===e.gateway_code?"Manual":`via ${e.gateway_name}`;return Fe("div",{className:Dt($t.create("payment-option-row",{borderRadius:wt.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"},{"(max-width: 480px)":{padding:"0.625rem 0.75rem",gap:"0.25rem",flexWrap:"wrap",alignItems:"flex-start"}}),t?$t.create("payment-option-row-selected",{border:`2px solid ${wt.colors.primary}`,backgroundColor:wt.colors.accent}):$t.create("payment-option-row-unselected",{border:`2px solid ${wt.colors.border}`,backgroundColor:wt.colors.card})),onClick:()=>I(e.gateway_code),children:[Fe("div",{className:$t.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Fe(cs,{selected:t}),Fe("div",{className:$t.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Fe("div",{className:$t.create("frequency-title",{fontSize:wt.fontSize.default,fontWeight:"500",color:wt.colors.foreground}),children:e.display_title||hs(n?"monthly":"one-time",e.gateway_code)}),Fe("div",{className:$t.create("gateway-description",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground}),children:i()})]})]}),Fe("div",{className:$t.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Fe(as,{className:$t.create("amount-text",{textAlign:"right",color:wt.colors.foreground}),children:r()}),"bank_transfer"!==e.gateway_code&&Fe(as,{size:"small",className:$t.create("gateway-fee-text",{textAlign:"right",color:wt.colors.mutedForeground}),children:["bank_transfer"===e.gateway_code?null:(null===(o=e.metadata)||void 0===o?void 0:o.gateway_fee)?ds(parseFloat(e.metadata.gateway_fee)):ds(0)," fee"]}),"bank_transfer"===e.gateway_code&&Fe(as,{size:"small",className:$t.create("no-fee-text",{textAlign:"right",color:wt.colors.mutedForeground}),children:"No fees"})]}),Fe("div",{className:$t.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Fe(cs,{selected:t}),Fe("div",{className:$t.create("payment-option-title-mobile",{fontSize:wt.fontSize.default,fontWeight:"500",color:wt.colors.foreground}),children:e.display_title||hs(n?"monthly":"one-time",e.gateway_code)})]}),Fe("div",{className:$t.create("payment-option-bottom-mobile",{display:"none"},{"(max-width: 480px)":{display:"flex",flex:"1 1 100%",justifyContent:"space-between",alignItems:"center",paddingLeft:"1.5rem"}}),children:[Fe("div",{className:$t.create("gateway-description-mobile",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground}),children:i()}),Fe(as,{className:$t.create("amount-text-mobile",{fontWeight:"500",color:wt.colors.foreground}),children:r()})]})]},e.gateway_code);var o})})]})]})]}),Fe("div",{className:$t.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Fe("div",{className:$t.create("checkout-sidebar-sticky",{}),children:[(he||me&&me.length>0)&&Fe("div",{className:$t.create("insurance-details-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,padding:wt.spacing.lg,boxShadow:wt.shadow.sm},{"(max-width: 768px)":{padding:wt.spacing.md}}),children:[Fe("h3",{className:$t.create("cart-summary-title",{fontSize:wt.fontSize.large,fontWeight:"600",marginBottom:wt.spacing.md,color:wt.colors.foreground}),children:ae?"Insurance Details":"Payment Details"}),he&&Fe($,{children:[Fe("div",{className:$t.create("client-details",{display:"flex",flexDirection:"column",gap:wt.spacing.sm,marginBottom:wt.spacing.md}),children:[he.firstName&&he.lastName&&Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Name"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:[he.firstName," ",he.lastName]})]}),he.email&&Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Email"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:he.email})]}),he.phone&&Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Phone"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:he.phone})]}),"Payment"!==le&&Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Product"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:le})]}),Fe("div",{className:$t.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("detail-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:"Link Expires"}),Fe("span",{className:$t.create("detail-value",{fontWeight:"500",color:wt.colors.foreground,fontSize:wt.fontSize.small}),children:ce.toLocaleDateString()})]})]}),Fe("hr",{className:$t.create("divider",{border:"none",borderTop:`1px solid ${wt.colors.border}`,margin:`${wt.spacing.md} 0`})})]}),me&&me.length>0&&Fe("div",{className:$t.create("line-items-section",{display:"flex",flexDirection:"column",gap:wt.spacing.md}),children:me.map((e,t)=>Fe("div",{className:$t.create("line-item",{}),children:[Fe("div",{className:$t.create("line-item-description",{fontSize:wt.fontSize.small,fontWeight:"500",color:wt.colors.foreground}),children:e.description}),e.show_sum_insured&&null!=e.sum_insured&&Fe("div",{className:$t.create("line-item-sum-insured",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground,marginTop:wt.spacing.sm}),children:["Sum Insured: ",ds(e.sum_insured)]})]},t))})]}),(he||me&&me.length>0)&&Fe("div",{className:$t.create("checkout-sidebar-spacer",{height:wt.spacing.lg},{"(max-width: 950px)":{height:wt.spacing.md}})}),Fe("div",{className:$t.create("checkout-sidebar-card",{backgroundColor:wt.colors.card,borderRadius:wt.radius.large,boxShadow:wt.shadow.sm,padding:wt.spacing.lg},{"(max-width: 768px)":{padding:wt.spacing.md}}),children:Fe("div",{className:$t.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Fe("h3",{className:$t.create("cart-summary-title",{fontSize:wt.fontSize.large,fontWeight:"600",marginBottom:wt.spacing.sm,color:wt.colors.foreground}),children:"Payment Details"}),J&&Fe("div",{className:$t.create("summary-section",{paddingBottom:"1rem"}),children:Fe("div",{className:$t.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"monthly"!==J.payment_frequency?Fe($,{children:[(null===(l=J.metadata)||void 0===l?void 0:l.gateway_fee)&&parseFloat(J.metadata.gateway_fee)>0&&Fe(Xs,{label:"Provider Fee:",value:ds(parseFloat(J.metadata.gateway_fee))}),Fe(Xs,{label:"Total Due Today:",value:ds(parseFloat(J.amount.due_today)),isTotal:!0})]}):Fe($,{children:[(null===(c=J.metadata)||void 0===c?void 0:c.gateway_fee)&&parseFloat(J.metadata.gateway_fee)>0&&Fe(Xs,{label:"Provider Fee:",value:ds(parseFloat(J.metadata.gateway_fee))}),J.amount.total&&Fe(Xs,{label:"Total Payable:",value:ds(parseFloat(J.amount.total)+parseFloat(null!==(d=null===(u=J.metadata)||void 0===u?void 0:u.gateway_fee)&&void 0!==d?d:"0"))}),Fe(Xs,{label:"Due Today:",value:ds(parseFloat(J.amount.due_today))}),J.amount.monthly&&(null===(h=J.metadata)||void 0===h?void 0:h.number_of_instalments)&&J.metadata.number_of_instalments>1&&Fe(Xs,{label:"Remaining payments:",value:`${J.metadata.number_of_instalments-1} x ${ds(parseFloat(J.amount.monthly))}`})]})})}),Fe(is,{onClick:async()=>{var e,t,n,r,i;if(!f)return;const o=f.calculations.length>0,s=!o;if(o&&!S)return void alert("Please select an excess amount before proceeding.");if(!C)return void alert("Please select a payment method before proceeding.");const a=o?f.calculations.find(e=>e.id===S):null;if(o&&!a)return void alert("Payment configuration error. Please try again.");if(!f.payment_options.find(e=>e.gateway_code===C))return void alert("Payment method not available. Please try again.");let l="Customer";if(null===(e=f.metadata)||void 0===e?void 0:e.client_name)l=f.metadata.client_name;else if(null===(t=f.metadata)||void 0===t?void 0:t.client_details){const e=f.metadata.client_details;e.first_name&&(l=`${e.first_name} ${e.last_name||""}`.trim())}if(s){if(!m)return void alert("Payment service not available. Please try again.");try{y(!0);const e=await m.initiateFixedPayment(f.payment_link_id,C,l);if("auto_renew_confirmed"===e.status)return void Y({message:e.message||"Your renewal is confirmed. Your premium funding will continue automatically on the policy start date.",effectiveDate:e.effective_date});if("bank_transfer"===C&&e.transaction_id)return void G({transactionId:e.transaction_id,organisationId:(null===(n=f.organisation)||void 0===n?void 0:n.id)||""});e.gateway_acceptance_url?window.location.href=e.gateway_acceptance_url:alert("Payment initiated successfully")}catch(e){alert(e.message||"Failed to initiate payment")}finally{y(!1)}return}const c=null===(r=f.metadata)||void 0===r?void 0:r.quote_intent_id,u={...c?{quoteIntentId:c}:{paymentLinkId:f.payment_link_id},paymentLinkId:f.payment_link_id,excessId:(null==a?void 0:a.excess_id)||"",gatewayId:C,calculationId:S||"",clientDetails:{legalName:l},metadata:{payment_link_id:f.payment_link_id,payment_type:c?"quote":"rate",gateway_code:C,gateway:C},...ue&&j?{coverStartDate:j}:{}};if("bank_transfer"!==C)N(u),x(!0);else{if(!m)return void alert("Payment service not available. Please try again.");try{y(!0);const e={...u,returnUrl:window.location.href},t=await m.initiatePayment(e,C);if(!(t.bank_account_name&&t.reference&&t.transaction_id))throw new Error("Invalid bank transfer response");G({transactionId:t.transaction_id,organisationId:(null===(i=f.organisation)||void 0===i?void 0:i.id)||""})}catch(e){alert(e.message||"Failed to initiate bank transfer")}finally{y(!1)}}},disabled:!de,className:$t.create("purchase-button",{width:"100%",height:"3rem",fontSize:wt.fontSize.default,fontWeight:"600"}),children:de?"Go to Payment":"Select Options to Continue"})]})})]})})]}),b&&k&&m&&Fe(Gs,{isOpen:b,onClose:()=>{x(!1),N(null)},onSuccess:()=>{x(!1),N(null),alert("Payment completed successfully!")},paymentRequest:k,httpClient:m}),ne&&Fe(Ns,{type:re,transactionId:X||z||void 0,isOpen:!0,onClose:()=>{O(!1);const e=new URL(window.location.href);e.searchParams.delete("status"),e.searchParams.delete("transactionId"),e.searchParams.delete("transaction_id"),window.history.replaceState({},"",e.toString())}})]})})}function Xs({label:e,value:t,isTotal:n=!1,className:r}){return Fe("div",{className:Dt($t.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Fe("span",{className:$t.create("summary-label",{color:wt.colors.mutedForeground,fontSize:wt.fontSize.small}),children:e}),Fe("span",{className:$t.create("summary-value",{fontWeight:n?"600":"500",color:wt.colors.foreground,fontSize:n?wt.fontSize.large:"inherit"}),children:t})]})}function ea({products:e,onSelectProduct:t}){const[n,r]=rt(null),i=(e,t)=>{t&&(t.preventDefault(),t.stopPropagation()),r(e)};return Fe(ts,{title:"Select cover",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe("div",{className:$t.create("product-selection-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Fe("div",{className:$t.create("product-selection-card",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Fe("div",{className:$t.create("product-selection-header",{paddingInline:wt.spacing.xl,paddingTop:wt.spacing.xl,paddingBottom:wt.spacing.lg},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingTop:wt.spacing.md}}),children:[Fe("h2",{className:$t.create("product-selection-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Select Your Cover"}),Fe("p",{className:$t.create("product-selection-description",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9"}),children:"What type of vessel are you insuring?"}),Fe("hr",{className:$t.create("product-selection-header-border",{marginTop:wt.spacing.lg,borderColor:wt.colors.border})})]}),Fe("div",{className:$t.create("product-selection-content",{paddingInline:wt.spacing.xl,paddingBottom:wt.spacing.xl},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingBottom:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingBottom:wt.spacing.md}}),children:[0===e.length?Fe("div",{className:$t.create("no-products-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${wt.colors.border}`,borderRadius:wt.radius.default,backgroundColor:wt.colors.muted}),children:[Fe("div",{style:{marginBottom:wt.spacing.default},children:Fe("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{margin:"0 auto",opacity:.5},children:[Fe("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Fe("polyline",{points:"14 2 14 8 20 8"})]})}),Fe("p",{className:$t.create("placeholder-text",{color:wt.colors.mutedForeground,margin:"0"}),children:"No products available for quoting."})]}):Fe("div",{className:$t.create("product-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Fe(ta,{product:e,isSelected:(null==n?void 0:n.id)===e.id,onSelect:i},e.id))}),e.length>0&&Fe("div",{className:$t.create("product-selection-actions",{marginTop:wt.spacing.lg}),children:Fe(is,{onClick:()=>{n&&t(n)},disabled:!n,className:$t.create("product-selection-continue-button",{width:"100%"}),children:"Continue"})})]})]})})})})}function ta({product:e,isSelected:t,onSelect:n}){return Fe("div",{className:Dt($t.create("product-option-row",{borderRadius:wt.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",gap:"1rem"},{"(max-width: 480px)":{padding:"0.625rem 0.75rem"}}),t?$t.create("product-option-row-selected",{border:`2px solid ${wt.colors.primary}`,backgroundColor:wt.colors.accent}):$t.create("product-option-row-unselected",{border:`2px solid ${wt.colors.border}`,backgroundColor:wt.colors.card})),onClick:t=>n(e,t),role:"button",tabIndex:0,onKeyPress:t=>{"Enter"!==t.key&&" "!==t.key||n(e,t)},children:[Fe(cs,{selected:t}),Fe("div",{className:$t.create("product-option-content",{display:"flex",alignItems:"center",justifyContent:"space-between",flex:"1",gap:"1rem"}),children:[Fe("div",{className:$t.create("product-option-info",{display:"flex",flexDirection:"column"}),children:[e.description&&Fe("div",{className:$t.create("product-option-description",{fontSize:wt.fontSize.default,fontWeight:"500",color:wt.colors.foreground}),children:e.description}),Fe("div",{className:$t.create("product-option-name",{fontSize:wt.fontSize.small,color:wt.colors.mutedForeground}),children:e.name})]}),e.icon_svg&&Fe("div",{className:$t.create("product-option-icon",{width:"2.5rem",height:"2.5rem",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",color:t?wt.colors.primary:wt.colors.mutedForeground,transition:"color 150ms ease"}),dangerouslySetInnerHTML:{H:e.icon_svg.replace(/^<svg(?![^>]*\bwidth\b)/,'<svg width="100%" height="100%"')}})]})]})}function na(){var e,t;const n=jt(),{paymentLinkConfig:r,availableProducts:i,formStateManager:o}=n;if(i&&!o)return Fe(ea,{products:i,onSelectProduct:()=>{}});if(r)return Fe(Ks,{paymentLinkId:r.paymentLinkId,signedUrl:r.signedUrl});const s=new URLSearchParams(window.location.search),a=s.get("p")||s.get("pl_ref");if(a)return Fe(Ks,{paymentLinkId:a});const l=window.location.pathname,c=l.match(/\/pay\/([a-f0-9-]+)/);if(c&&c[1])return Fe(Ks,{paymentLinkId:c[1],signedUrl:window.location.href});const u=l.match(/\/payments\/bank-transfer\/([a-f0-9-]+)/),d=s.get("orgId");if(u&&u[1]&&d)return Fe(Vs,{transactionId:u[1],organisationId:d});const{isCalculating:h,results:m,quoteIntent:f}=Wt(e=>({isCalculating:null==e?void 0:e.getIsCalculating(),results:null==e?void 0:e.getCalculationResult(),quoteIntent:null==e?void 0:e.getQuoteIntent(),fsm:e})),p="hold"===(null==f?void 0:f.status),g=null===(e=null==f?void 0:f.payment_transactions)||void 0===e?void 0:e.find(e=>"bank_transfer"===e.gateway_code&&"pending"===e.status),y="paid"===(null==f?void 0:f.status)||"completed"===(null==f?void 0:f.status);return h?Fe(rs,{message:"Processing your quote, please wait..."}):p&&g&&(null===(t=null==f?void 0:f.organisation)||void 0===t?void 0:t.id)?Fe(Vs,{transactionId:g.id,organisationId:f.organisation.id,allowCancel:!0}):y?Fe(Zs,{}):m?Fe(Ds,{results:m}):Fe(Ys,{})}function ra(e){return Fe(Ot,{...e,children:Fe(na,{})})}function ia({reference:e,productName:t,firstName:n,lastUpdated:r,onContinue:i,onStartFresh:o}){const[s,a]=rt(null);return Fe(ts,{title:"Resume Quote",noSubscription:!0,hideHeader:!0,children:Fe(Rt,{children:Fe("div",{className:$t.create("resume-prompt-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Fe("div",{className:$t.create("resume-prompt-card",{backgroundColor:wt.colors.card,boxShadow:wt.shadow.sm,borderRadius:wt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Fe("div",{className:$t.create("resume-prompt-header",{paddingInline:wt.spacing.xl,paddingTop:wt.spacing.xl,paddingBottom:wt.spacing.lg},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingTop:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingTop:wt.spacing.md}}),children:[Fe("h2",{className:$t.create("resume-prompt-title",{margin:"0",marginBottom:wt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:wt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Existing Quote Found"}),Fe("p",{className:$t.create("resume-prompt-description",{margin:"0",fontSize:wt.fontSize.default,lineHeight:"1.6",color:wt.colors.foreground,opacity:"0.9"}),children:"There is a quote in progress. Would you like to continue where you left off or start a new quote?"}),(e||t||n||r)&&Fe("div",{className:$t.create("resume-prompt-details",{marginTop:wt.spacing.md,padding:wt.spacing.md,backgroundColor:wt.colors.background,borderRadius:wt.radius.default,display:"flex",flexDirection:"column",gap:wt.spacing.sm}),children:[t&&Fe("div",{className:$t.create("resume-prompt-detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("resume-prompt-detail-label",{fontSize:wt.fontSize.small,color:wt.colors.foreground,opacity:"0.6"}),children:"Product"}),Fe("span",{className:$t.create("resume-prompt-detail-value",{fontSize:wt.fontSize.small,fontWeight:"600",color:wt.colors.foreground}),children:t})]}),n&&Fe("div",{className:$t.create("resume-prompt-detail-row-name",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("resume-prompt-detail-label-name",{fontSize:wt.fontSize.small,color:wt.colors.foreground,opacity:"0.6"}),children:"Client"}),Fe("span",{className:$t.create("resume-prompt-detail-value-name",{fontSize:wt.fontSize.small,fontWeight:"600",color:wt.colors.foreground}),children:n})]}),e&&Fe("div",{className:$t.create("resume-prompt-detail-row-ref",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("resume-prompt-detail-label-ref",{fontSize:wt.fontSize.small,color:wt.colors.foreground,opacity:"0.6"}),children:"Reference"}),Fe("span",{className:$t.create("resume-prompt-detail-value-ref",{fontSize:wt.fontSize.small,fontWeight:"600",color:wt.colors.foreground}),children:e})]}),r&&Fe("div",{className:$t.create("resume-prompt-detail-row-date",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Fe("span",{className:$t.create("resume-prompt-detail-label-date",{fontSize:wt.fontSize.small,color:wt.colors.foreground,opacity:"0.6"}),children:"Last updated"}),Fe("span",{className:$t.create("resume-prompt-detail-value-date",{fontSize:wt.fontSize.small,fontWeight:"600",color:wt.colors.foreground}),children:r})]})]}),Fe("hr",{className:$t.create("resume-prompt-header-border",{marginTop:wt.spacing.lg,borderColor:wt.colors.border})})]}),Fe("div",{className:$t.create("resume-prompt-content",{paddingInline:wt.spacing.xl,paddingBottom:wt.spacing.xl,display:"flex",flexDirection:"column",gap:wt.spacing.md},{"(max-width: 768px)":{paddingInline:wt.spacing.lg,paddingBottom:wt.spacing.lg},"(max-width: 480px)":{paddingInline:wt.spacing.md,paddingBottom:wt.spacing.md}}),children:[Fe(is,{onClick:()=>{a("continue"),i()},loading:"continue"===s,disabled:null!==s,className:$t.create("resume-prompt-continue-btn",{width:"100%"}),children:"Continue where I left off"}),Fe(is,{variant:"outline",onClick:()=>{a("fresh"),o()},loading:"fresh"===s,disabled:null!==s,className:$t.create("resume-prompt-fresh-btn",{width:"100%"}),children:"Start a new quote"})]})]})})})})}class oa extends C{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(e,n){t();try{Promise.resolve().then(function(){return fh}).then(({captureException:t,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),t(e,{componentStack:n.componentStack}))}).catch(()=>{})}catch(e){}const r=ve("initialization",e,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return _e(e)?Fe(ss,{message:e.message}):Fe(os,{error:e})}return this.props.children}}function sa({config:e,initializeFormContext:n}){const[r,i]=rt({type:"loading",message:"Loading application..."}),o=n=>{if(n.resumePrompt)return t(),void i({type:"resume_prompt",resumeData:n.resumePrompt});const r=n.availableProducts&&n.availableProducts.length>0;if(r&&!n.formStateManager)return t(),void i({type:"product_selection",products:n.availableProducts});if(!("payment"===e.mode||n.paymentLinkConfig||r||n.formStateManager&&"function"==typeof n.formStateManager.getFormProgress))throw new Error("FormStateManager was not properly initialized");t(),i({type:"success",formContextProps:n})},s=async(r="Loading application...")=>{i({type:"loading",message:r});try{t();const r=await n(e);o(r)}catch(e){let n;t(),n=e&&"object"==typeof e&&"type"in e&&"MAINTENANCE_ERROR"===e.type||e&&"object"==typeof e&&"statusCode"in e&&503===e.statusCode||e&&"object"==typeof e&&"status"in e&&503===e.status?ve("maintenance",e):ve("initialization",e),t((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}};it(()=>{e.isolateStyles&&kt(),s()},[e,n]);const a=async e=>{if("resume_prompt"!==r.type)return;const{onContinue:n,onStartFresh:s}=r.resumeData;i({type:"loading",message:"continue"===e?"Loading your quote...":"Starting a new quote..."});try{const t="continue"===e?await n():await s();o(t)}catch(e){t();const n=ve("initialization",e);i({type:"error",error:n})}},l=async e=>{t(e.code),localStorage.setItem("insure-os-selected-product",e.code),await s("Loading...")};return Fe(oa,{children:Fe("div",{className:$t.create("root",{fontFamily:wt.fontFamily,backgroundColor:wt.colors.background,minHeight:"100vh",color:wt.colors.foreground,maxWidth:"100vw",overflowX:"hidden",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"}),children:function(){switch(r.type){case"loading":return Fe(rs,{message:r.message});case"error":return _e(r.error)?Fe(ss,{message:r.error.message}):Fe(os,{error:r.error});case"product_selection":return Fe(ea,{products:r.products,onSelectProduct:l});case"resume_prompt":return Fe(ia,{reference:r.resumeData.reference,productName:r.resumeData.productName,firstName:r.resumeData.firstName,lastUpdated:r.resumeData.lastUpdated,onContinue:()=>a("continue"),onStartFresh:()=>a("fresh")});case"success":return Fe(ra,{...r.formContextProps});default:return Fe(os,{})}}()})})}const aa="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,la=globalThis,ca="10.48.0";function ua(){return da(la),la}function da(e){const t=e.oe=e.oe||{};return t.version=t.version||ca,t[ca]=t[ca]||{}}function ha(e,t,n=la){const r=n.oe=n.oe||{},i=r[ca]=r[ca]||{};return i[e]||(i[e]=t())}const ma=["debug","info","warn","error","log","assert","trace"],fa={};function pa(e){if(!("console"in la))return e();const t=la.console,n={},r=Object.keys(fa);r.forEach(e=>{const r=fa[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function ga(){return va().enabled}function ya(e,...t){aa&&ga()&&pa(()=>{la.console[e](`Sentry Logger [${e}]:`,...t)})}function va(){return aa?ha("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const wa=function(){va().enabled=!0},ba=function(...e){ya("log",...e)},xa=function(...e){ya("warn",...e)},ka=function(...e){ya("error",...e)},Na="?",Sa=/\(error: (.*)\)/,_a=/captureMessage|captureException/;function $a(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{const i=[],o=e.split("\n");for(let e=n;e<o.length;e++){let n=o[e];n.length>1024&&(n=n.slice(0,1024));const s=Sa.test(n)?n.replace(Sa,"$1"):n;if(!s.includes("Error: ")){for(const e of t){const t=e(s);if(t){i.push(t);break}}if(i.length>=50+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(Ca(t).function||"")&&t.pop(),t.reverse(),_a.test(Ca(t).function||"")&&(t.pop(),_a.test(Ca(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Ca(t).filename,function:e.function||Na}))}(i.slice(r))}}function Ca(e){return e[e.length-1]||{}}const Ia="<anonymous>";function Ta(e){try{return e&&"function"==typeof e&&e.name||Ia}catch{return Ia}}function Ea(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}function Pa(e){return"se"in e&&e.se?"[VueVNode]":"[VueViewModel]"}const Da={},za={};function Ra(e,t){Da[e]=Da[e]||[],Da[e].push(t)}function Ma(e,t){if(!za[e]){za[e]=!0;try{t()}catch(t){aa&&ka(`Error while instrumenting ${e}`,t)}}}function Oa(e,t){const n=e&&Da[e];if(n)for(const r of n)try{r(t)}catch(t){aa&&ka(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Ta(r)}\nError:`,t)}}let ja=null;function Wa(){ja=la.onerror,la.onerror=function(e,t,n,r,i){return Oa("error",{column:r,error:i,line:n,msg:e,url:t}),!!ja&&ja.apply(this,arguments)},la.onerror.ae=!0}let Aa=null;function La(){Aa=la.onunhandledrejection,la.onunhandledrejection=function(e){return Oa("unhandledrejection",e),!Aa||Aa.apply(this,arguments)},la.onunhandledrejection.ae=!0}const Ba={}.toString;function Fa(e){switch(Ba.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Ka(e,Error)}}function qa(e,t){return Ba.call(e)===`[object ${t}]`}function Ha(e){return qa(e,"ErrorEvent")}function Ua(e){return qa(e,"DOMError")}function Ya(e){return qa(e,"String")}function Za(e){return"object"==typeof e&&null!==e&&"le"in e&&"ce"in e}function Ga(e){return null===e||Za(e)||"object"!=typeof e&&"function"!=typeof e}function Va(e){return qa(e,"Object")}function Qa(e){return"undefined"!=typeof Event&&Ka(e,Event)}function Ja(e){return Boolean(e?.then&&"function"==typeof e.then)}function Ka(e,t){try{return e instanceof t}catch{return!1}}function Xa(e){return!("object"!=typeof e||null===e||!(e.ue||e.de||e.se))}function el(e){return"undefined"!=typeof Request&&Ka(e,Request)}const tl=la;function nl(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,s=0;const a=" > ",l=a.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(c=rl(n,u),!("html"===c||o>1&&s+i.length*l+c.length>=d));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function rl(e,t){const n=e,r=[];if(!n?.tagName)return"";if(tl.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&Ya(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}for(const e of["aria-label","type","name","title","alt"]){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}function il(){try{return tl.document.location.href}catch{return""}}function ol(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&al(i,r);try{e[t]=i}catch{aa&&ba(`Failed to replace method "${t}" in object`,e)}}function sl(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{aa&&ba(`Failed to add non-enumerable property "${t}" to object`,e)}}function al(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,sl(e,"__sentry_original__",t)}catch{}}function ll(e){return e.he}function cl(e){if(Fa(e))return{message:e.message,name:e.name,stack:e.stack,...dl(e)};if(Qa(e)){const t={type:e.type,target:ul(e.target),currentTarget:ul(e.currentTarget),...dl(e)};return"undefined"!=typeof CustomEvent&&Ka(e,CustomEvent)&&(t.detail=e.detail),t}return e}function ul(e){try{return"undefined"!=typeof Element&&Ka(e,Element)?nl(e):{}.toString.call(e)}catch{return"<unknown>"}}function dl(e){return"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e)):{}}let hl,ml,fl;function pl(e){if(void 0!==hl)return hl?hl(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=la;return t in n&&"function"==typeof n[t]?(hl=n[t],hl(e)):(hl=null,e())}function gl(){return pl(()=>Math.random())}function yl(){return pl(()=>Date.now())}function vl(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function wl(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{Xa(r)?n.push(Pa(r)):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function bl(e,t,n=!1){return!!Ya(e)&&(qa(t,"RegExp")?t.test(e):Ya(t)?n?e===t:e.includes(t):"function"==typeof t&&t(e))}function xl(e,t=[],n=!1){return t.some(t=>bl(e,t,n))}function kl(e=function(){const e=la;return e.crypto||e.msCrypto}()){try{if(e?.randomUUID)return pl(()=>e.randomUUID()).replace(/-/g,"")}catch{}return ml||(ml=[1e7]+1e3+4e3+8e3+1e11),ml.replace(/[018]/g,e=>(e^(16*gl()&15)>>e/4).toString(16))}function Nl(e){return e.exception?.values?.[0]}function Sl(e){const{message:t,event_id:n}=e;if(t)return t;const r=Nl(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function _l(e,t){const n=e.exception=e.exception||{},r=n.values=n.values||[],i=r[0]=r[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function $l(e,t){const n=Nl(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r?.data,...t.data};n.mechanism.data=e}}function Cl(e){if(function(e){try{return e.me}catch{}}(e))return!0;try{sl(e,"__sentry_captured__",!0)}catch{}return!1}function Il(){return yl()/1e3}function Tl(){return(fl??(fl=function(){const{performance:e}=la;if(!e?.now||!e.timeOrigin)return Il;const t=e.timeOrigin;return()=>(t+pl(()=>e.now()))/1e3}()))()}function El(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Tl(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:kl()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Pl(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)({}).hasOwnProperty.call(t,e)&&(r[e]=Pl(r[e],t[e],n-1));return r}function Dl(){return kl()}function zl(){return kl().substring(16)}const Rl="_sentrySpan";function Ml(e,t){t?sl(e,Rl,t):delete e[Rl]}function Ol(e){return e[Rl]}class jl{constructor(){this.fe=!1,this.pe=[],this.ge=[],this.ye=[],this.ve=[],this.we={},this.be={},this.xe={},this.ke={},this.Ne={},this.Se={},this._e={traceId:Dl(),sampleRand:gl()}}clone(){const e=new jl;return e.ye=[...this.ye],e.be={...this.be},e.xe={...this.xe},e.ke={...this.ke},e.Ne={...this.Ne},this.Ne.flags&&(e.Ne.flags={values:[...this.Ne.flags.values]}),e.we=this.we,e.$e=this.$e,e.Ce=this.Ce,e.Ie=this.Ie,e.Te=this.Te,e.ge=[...this.ge],e.ve=[...this.ve],e.Se={...this.Se},e._e={...this._e},e.Ee=this.Ee,e.Pe=this.Pe,e.De=this.De,Ml(e,Ol(this)),e}setClient(e){this.Ee=e}setLastEventId(e){this.Pe=e}getClient(){return this.Ee}lastEventId(){return this.Pe}addScopeListener(e){this.pe.push(e)}addEventProcessor(e){return this.ge.push(e),this}setUser(e){return this.we=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.Ce&&El(this.Ce,{user:e}),this.ze(),this}getUser(){return this.we}setConversationId(e){return this.De=e||void 0,this.ze(),this}setTags(e){return this.be={...this.be,...e},this.ze(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this.xe={...this.xe,...e},this.ze(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this.xe&&(delete this.xe[e],this.ze()),this}setExtras(e){return this.ke={...this.ke,...e},this.ze(),this}setExtra(e,t){return this.ke={...this.ke,[e]:t},this.ze(),this}setFingerprint(e){return this.Te=e,this.ze(),this}setLevel(e){return this.$e=e,this.ze(),this}setTransactionName(e){return this.Ie=e,this.ze(),this}setContext(e,t){return null===t?delete this.Ne[e]:this.Ne[e]=t,this.ze(),this}setSession(e){return e?this.Ce=e:delete this.Ce,this.ze(),this}getSession(){return this.Ce}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof jl?t.getScopeData():Va(t)?e:void 0,{tags:r,attributes:i,extra:o,user:s,contexts:a,level:l,fingerprint:c=[],propagationContext:u,conversationId:d}=n||{};return this.be={...this.be,...r},this.xe={...this.xe,...i},this.ke={...this.ke,...o},this.Ne={...this.Ne,...a},s&&Object.keys(s).length&&(this.we=s),l&&(this.$e=l),c.length&&(this.Te=c),u&&(this._e=u),d&&(this.De=d),this}clear(){return this.ye=[],this.be={},this.xe={},this.ke={},this.we={},this.Ne={},this.$e=void 0,this.Ie=void 0,this.Te=void 0,this.Ce=void 0,this.De=void 0,Ml(this,void 0),this.ve=[],this.setPropagationContext({traceId:Dl(),sampleRand:gl()}),this.ze(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:Il(),...e,message:e.message?vl(e.message,2048):e.message};return this.ye.push(r),this.ye.length>n&&(this.ye=this.ye.slice(-n),this.Ee?.recordDroppedEvent("buffer_overflow","log_item")),this.ze(),this}getLastBreadcrumb(){return this.ye[this.ye.length-1]}clearBreadcrumbs(){return this.ye=[],this.ze(),this}addAttachment(e){return this.ve.push(e),this}clearAttachments(){return this.ve=[],this}getScopeData(){return{breadcrumbs:this.ye,attachments:this.ve,contexts:this.Ne,tags:this.be,attributes:this.xe,extra:this.ke,user:this.we,level:this.$e,fingerprint:this.Te||[],eventProcessors:this.ge,propagationContext:this._e,sdkProcessingMetadata:this.Se,transactionName:this.Ie,span:Ol(this),conversationId:this.De}}setSDKProcessingMetadata(e){return this.Se=Pl(this.Se,e,2),this}setPropagationContext(e){return this._e=e,this}getPropagationContext(){return this._e}captureException(e,t){const n=t?.event_id||kl();if(!this.Ee)return aa&&xa("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Ee.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||kl();if(!this.Ee)return aa&&xa("No client configured on scope - will not capture message!"),r;const i=n?.syntheticException??new Error(e);return this.Ee.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=e.event_id||t?.event_id||kl();return this.Ee?(this.Ee.captureEvent(e,{...t,event_id:n},this),n):(aa&&xa("No client configured on scope - will not capture event!"),n)}ze(){this.fe||(this.fe=!0,this.pe.forEach(e=>{e(this)}),this.fe=!1)}}const Wl=e=>e instanceof Promise&&!e[Al],Al=Symbol("chained PromiseLike");class Ll{constructor(e,t){let n,r;n=e||new jl,r=t||new jl,this.Re=[{scope:n}],this.Me=r}withScope(e){const t=this.Oe();let n;try{n=e(t)}catch(e){throw this.je(),e}return Ja(n)?((e,t,n)=>{const r=e.then(e=>(t(),e),e=>{throw n(),e});return Wl(r)&&Wl(e)?r:((e,t)=>{let n=!1;for(const r in e){if(r in t)continue;n=!0;const i=e[r];"function"==typeof i?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[Al]:!0}),t})(e,r)})(n,()=>this.je(),()=>this.je()):(this.je(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.Me}getStackTop(){return this.Re[this.Re.length-1]}Oe(){const e=this.getScope().clone();return this.Re.push({client:this.getClient(),scope:e}),e}je(){return!(this.Re.length<=1||!this.Re.pop())}}function Bl(){const e=da(ua());return e.stack=e.stack||new Ll(ha("defaultCurrentScope",()=>new jl),ha("defaultIsolationScope",()=>new jl))}function Fl(e){return Bl().withScope(e)}function ql(e,t){const n=Bl();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Hl(e){return Bl().withScope(()=>e(Bl().getIsolationScope()))}function Ul(e){const t=da(e);return t.acs?t.acs:{withIsolationScope:Hl,withScope:Fl,withSetScope:ql,withSetIsolationScope:(e,t)=>Hl(t),getCurrentScope:()=>Bl().getScope(),getIsolationScope:()=>Bl().getIsolationScope()}}function Yl(){return Ul(ua()).getCurrentScope()}function Zl(){return Ul(ua()).getIsolationScope()}function Gl(...e){const t=Ul(ua());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Vl(){return Yl().getClient()}function Ql(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||zl()};return r&&(o.parent_span_id=r),o}const Jl="sentry.profile_id",Kl="sentry.exclusive_time";function Xl(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function ec(e){const t=e;return{scope:t.We,isolationScope:Xl(t.Ae)}}function tc(e){return e.split(",").map(e=>{const t=e.indexOf("=");return-1===t?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const nc=/^o(\d+)\./,rc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function ic(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=e;return`${a}://${l}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function oc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function sc(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(nc);return t?.[1]}(n)),r}let ac=!1;function lc(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:hc(e).parent_span_id,o=ec(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||zl():t,trace_id:n}}function cc(e){return e&&e.length>0?e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:1===n,attributes:i,...r})):void 0}function uc(e){return"number"==typeof e?dc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?dc(e.getTime()):Tl()}function dc(e){return e>9999999999?e/1e3:e}function hc(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:i,name:o,endTime:s,status:a,links:l}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:mc(e),start_timestamp:uc(i),timestamp:uc(s)||void 0,status:fc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:cc(l)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function mc(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function fc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"internal_error"}const pc=function(e){return e.Le||e};function gc(){ac||(pa(()=>{}),ac=!0)}function yc(e){ba(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function vc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(bc(n)){if(bl(e.description,n))return aa&&yc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||bl(e.description,n.name),r=!n.op||e.op&&bl(e.op,n.op);if(t&&r)return aa&&yc(e),!0}return!1}function wc(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function bc(e){return"string"==typeof e||e instanceof RegExp}const xc="production";function kc(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||xc,release:n.release,public_key:r,trace_id:e,org_id:sc(t)};return t.emit("createDsc",i),i}function Nc(e){const t=Vl();if(!t)return{};const n=pc(e),r=hc(n),i=r.data,o=n.spanContext().traceState,s=o?.get("sentry.sample_rate")??i["sentry.sample_rate"]??i["sentry.previous_trace_sample_rate"];function a(e){return"number"!=typeof s&&"string"!=typeof s||(e.sample_rate=`${s}`),e}const l=n.Be;if(l)return a(l);const c=o?.get("sentry.dsc"),u=c&&function(e){const t=function(e){if(e&&(Ya(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=tc(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):tc(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.startsWith("sentry-")&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(c);if(u)return a(u);const d=kc(e.spanContext().traceId,t),h=i["sentry.source"]??i["sentry.span.source"],m=r.description;return"url"!==h&&m&&(d.transaction=m),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const e=Vl()?.getOptions();return!(!e||null==e.tracesSampleRate&&!e.tracesSampler)}()&&(d.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return 1===t}(n)),d.sample_rand=o?.get("sentry.sample_rand")??ec(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}function Sc(e,t=100,n=1/0){try{return $c("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function _c(e,t=3,n=102400){const r=Sc(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?_c(e,t-1,n):r;var i}function $c(e,t,n=1/0,r=1/0,i=function(){const e=new WeakSet;return[function(t){return!!e.has(t)||(e.add(t),!1)},function(t){e.delete(t)}]}()){const[o,s]=i;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const a=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t.Fe)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(Xa(t))return Pa(t);if(Va(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${Ta(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}var n}(e,t);if(!a.startsWith("[object "))return a;if(t.qe)return t;const l="number"==typeof t.He?t.He:n;if(0===l)return a.replace("object ","");if(o(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return $c("",c.toJSON(),l-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=cl(t);for(const e in h){if(!{}.hasOwnProperty.call(h,e))continue;if(d>=r){u[e]="[MaxProperties ~]";break}const t=h[e];u[e]=$c(e,t,l-1,r,i),d++}return s(t),u}function Cc(e,t=[]){return[e,t]}function Ic(e,t){const[n,r]=e;return[n,[...r,t]]}function Tc(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function Ec(e){const t=da(la);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function Pc(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[Ec(r),e]:r.push("string"==typeof e?Ec(e):e)}for(const e of n){const[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(Sc(n))}i(e)}}return"string"==typeof r?r:function(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(r)}function Dc(e){const t="string"==typeof e.data?Ec(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const zc={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function Rc(e){return function(e){return e in zc}(e)?zc[e]:e}function Mc(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function Oc(e,t){const{extra:n,tags:r,attributes:i,user:o,contexts:s,level:a,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:u,eventProcessors:d,attachments:h,propagationContext:m,transactionName:f,span:p}=t;jc(e,"extra",n),jc(e,"tags",r),jc(e,"attributes",i),jc(e,"user",o),jc(e,"contexts",s),e.sdkProcessingMetadata=Pl(e.sdkProcessingMetadata,l,2),a&&(e.level=a),f&&(e.transactionName=f),p&&(e.span=p),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),h.length&&(e.attachments=[...e.attachments,...h]),e.propagationContext={...e.propagationContext,...m}}function jc(e,t,n){e[t]=Pl(e[t],n,1)}function Wc(e,t){const n=ha("globalScope",()=>new jl).getScopeData();return e&&Oc(n,e.getScopeData()),t&&Oc(n,t.getScopeData()),n}function Ac(e){return new Bc(t=>{t(e)})}function Lc(e){return new Bc((t,n)=>{n(e)})}class Bc{constructor(e){this.Ue=0,this.Ye=[],this.Ze(e)}then(e,t){return new Bc((n,r)=>{this.Ye.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this.Ge()})}catch(e){return this.then(e=>e,e)}finally(e){return new Bc((t,n)=>{let r,i;return this.then(t=>{i=!1,r=t,e&&e()},t=>{i=!0,r=t,e&&e()}).then(()=>{i?n(r):t(r)})})}Ge(){if(0===this.Ue)return;const e=this.Ye.slice();this.Ye=[],e.forEach(e=>{e[0]||(1===this.Ue&&e[1](this.Ve),2===this.Ue&&e[2](this.Ve),e[0]=!0)})}Ze(e){const t=(e,t)=>{0===this.Ue&&(Ja(t)?t.then(n,r):(this.Ue=e,this.Ve=t,this.Ge()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}}function Fc(e,t,n,r=0){try{const i=qc(t,n,e,r);return Ja(i)?i:Ac(i)}catch(e){return Lc(e)}}function qc(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return aa&&null===o&&ba(`Event processor "${i.id||"?"}" dropped event`),Ja(o)?o.then(e=>qc(e,t,n,r+1)):qc(o,t,n,r+1)}let Hc,Uc,Yc,Zc;function Gc(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,l={...t,event_id:t.event_id||n.event_id||kl(),timestamp:t.timestamp||Il()},c=n.integrations||e.integrations.map(e=>e.name);!function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o}=t;e.environment=e.environment||n||xc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&o&&(s.url=vl(s.url,o)),o&&e.exception?.values?.forEach(e=>{e.value&&(e.value=vl(e.value,o))})}(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),i&&i.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=la.Qe,n=la.Je;if(!t&&!n)return{};const r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Zc&&r.length===Uc&&i.length===Yc)return Zc;Uc=r.length,Yc=i.length,Zc={},Hc||(Hc={});const o=(t,n)=>{for(const r of t){const t=n[r],i=Hc?.[r];if(i&&Zc&&t)Zc[i[0]]=t,Hc&&(Hc[r]=[i[0],t]);else if(t){const n=e(r);for(let e=n.length-1;e>=0;e--){const i=n[e],o=i?.filename;if(o&&Zc&&Hc){Zc[o]=t,Hc[r]=[o,t];break}}}}};return t&&o(r,t),n&&o(i,n),Zc}(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}(l,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new jl;return n.update(t),n}(r,n.captureContext);n.mechanism&&$l(l,n.mechanism);const d=i?i.getEventProcessors():[],h=Wc(o,u),m=[...n.attachments||[],...h.attachments];m.length&&(n.attachments=m),function(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),s&&(e.level=s),a&&"transaction"!==e.type&&(e.transaction=a)}(e,t),r&&function(e,t){e.contexts={trace:lc(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Nc(t),...e.sdkProcessingMetadata};const n=hc(pc(t)).description;n&&!e.transaction&&"transaction"===e.type&&(e.transaction=n)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}(l,h);const f=[...d,...h.eventProcessors];return(n.data&&!0===n.data.Ke?Ac(l):Fc(f,l,n)).then(e=>(e&&function(e){const t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})})}(e),"number"==typeof s&&s>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Sc(e.data,t,n)}}))},...e.user&&{user:Sc(e.user,t,n)},...e.contexts&&{contexts:Sc(e.contexts,t,n)},...e.extra&&{extra:Sc(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Sc(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Sc(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Sc(e.contexts.flags,3,n)),r}(e,s,a):e))}function Vc(e){return Yl().captureException(e,void 0)}function Qc(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return Yl().captureMessage(e,n,r)}function Jc(e,t){return Yl().captureEvent(e,t)}function Kc(e){const t=Zl(),{user:n}=Wc(t,Yl()),{userAgent:r}=la.navigator||{},i=function(e){const t=Tl(),n={sid:kl(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return{sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}(n)};return e&&El(n,e),n}({user:n,...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&El(o,{status:"exited"}),Xc(),t.setSession(i),i}function Xc(){const e=Zl(),t=Yl().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),El(e,t)}(t),eu(),e.setSession()}function eu(){const e=Zl(),t=Vl(),n=e.getSession();n&&t&&t.captureSession(n)}function tu(e=!1){e?Xc():eu()}const nu=[];function ru(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach(e=>{e.isDefaultInstance=!0}),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return function(e){const t={};return e.forEach(e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}(r)}function iu(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function ou(e,t,n){if(n[t.name])aa&&ba(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,nu.includes(t.name)||"function"!=typeof t.setupOnce||(t.setupOnce(),nu.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,r)=>n(t,r,e))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}aa&&ba(`Integration installed: ${t.name}`)}}function su(e,t){const n=t??function(e){return au().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),i=function(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=ic(r)),Cc(i,[(o=e,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(n,r.Xe,r.tunnel,e.getDsn());au().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function au(){return ha("clientToLogBufferMap",()=>new WeakMap)}function lu(e,t){const n=t??function(e){return cu().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),i=function(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=ic(r)),Cc(i,[(o=e,[{type:"trace_metric",item_count:o.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:o}])]);var o}(n,r.Xe,r.tunnel,e.getDsn());cu().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function cu(){return ha("clientToMetricBufferMap",()=>new WeakMap)}function uu(e){return"object"==typeof e&&"function"==typeof e.unref&&e.unref(),e}const du=Symbol.for("SentryBufferFullError");function hu(e=100){const t=new Set;function n(e){t.delete(e)}return{get $(){return Array.from(t)},add:function(r){if(!(t.size<e))return Lc(du);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return Ac(!0);const n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;const r=[n,new Promise(t=>uu(setTimeout(()=>t(!1),e)))];return Promise.race(r)}}}function mu(e,t,n=hu(e.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Tc(i,(t,n)=>{const i=Rc(n);!function(e,t,n=yl()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,i)?o.push(t):e.recordDroppedEvent("ratelimit_backoff",i)}),0===o.length)return Promise.resolve({});const s=Cc(i[0],o),a=t=>{!function(e,t){return Tc(e,(e,n)=>t.includes(n))}(s,["client_report"])?Tc(s,(n,r)=>{e.recordDroppedEvent(t,Rc(r))}):aa&&xa(`Dropping client report. Will not send outcomes (reason: ${t}).`)};return n.add(()=>t({body:Pc(s)}).then(e=>413===e.statusCode?(aa&&ka("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),a("send_error"),e):(aa&&void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&xa(`Sentry responded with status code ${e.statusCode} to sent event.`),r=function(e,{statusCode:t,headers:n},r=yl()){const i={...e},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,n,,,o]=e.split(":",5),s=parseInt(t,10),a=1e3*(isNaN(s)?60:s);if(n)for(const e of n.split(";"))"metric_bucket"===e&&o&&!o.split(";").includes("custom")||(i[e]=r+a);else i.all=r+a}else s?i.all=r+function(e,t=yl()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(s,r):429===t&&(i.all=r+6e4);return i}(r,e),e),e=>{throw a("network_error"),aa&&ka("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===du)return aa&&ka("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function fu(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}const pu="Not capturing exception because it's already been captured.",gu="Discarded session because of missing or non-string release",yu=Symbol.for("SentryInternalError"),vu=Symbol.for("SentryDoNotSendEventError");function wu(e){return{message:e,[yu]:!0}}function bu(e){return{message:e,[vu]:!0}}function xu(e){return!!e&&"object"==typeof e&&yu in e}function ku(e){return!!e&&"object"==typeof e&&vu in e}function Nu(e,t,n,r,i){let o,s=0,a=!1;e.on(n,()=>{s=0,clearTimeout(o),a=!1}),e.on(t,t=>{s+=r(t),s>=8e5?i(e):a||(a=!0,o=uu(setTimeout(()=>{i(e)},5e3)))}),e.on("flush",()=>{i(e)})}class Su{constructor(e){if(this.et=e,this.nt={},this.rt=0,this.it={},this.ot={},this.ge=[],this.st=hu(e.transportOptions?.bufferSize??64),e.dsn?this.lt=function(e){const t="string"==typeof e?function(e){const t=rc.exec(e);if(!t)return void pa(()=>{});const[n,r,i="",o="",s="",a=""]=t.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return oc({host:o,pass:i,path:l,projectId:c,port:s,protocol:n,publicKey:r})}(e):oc(e);if(t&&function(e){if(!aa)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(ka(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(ka(`Invalid Sentry Dsn: Invalid port ${t}`),1):(ka(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(ka(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):aa&&xa("No DSN provided, client will not send events."),this.lt){const i=(t=this.lt,n=e.tunnel,r=e.Xe?e.Xe.sdk:void 0,n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(t)}?${function(e,t){const n={sentry_version:"7"};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(t,r)}`);this.ct=e.transport({tunnel:this.et.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:i})}var t,n,r;this.et.enableLogs=this.et.enableLogs??this.et.ut?.enableLogs,this.et.enableLogs&&Nu(this,"afterCaptureLog","flushLogs",Tu,su),(this.et.enableMetrics??this.et.ut?.enableMetrics??1)&&Nu(this,"afterCaptureMetric","flushMetrics",Iu,lu)}captureException(e,t,n){const r=kl();if(Cl(e))return aa&&ba(pu),r;const i={event_id:r,...t};return this.ht(()=>this.eventFromException(e,i).then(e=>this.ft(e,i,n)).then(e=>e),"error"),i.event_id}captureMessage(e,t,n,r){const i={event_id:kl(),...n},o=Za(e)?e:String(e),s=Ga(e),a=s?this.eventFromMessage(o,t,i):this.eventFromException(e,i);return this.ht(()=>a.then(e=>this.ft(e,i,r)),s?"unknown":"error"),i.event_id}captureEvent(e,t,n){const r=kl();if(t?.originalException&&Cl(t.originalException))return aa&&ba(pu),r;const i={event_id:r,...t},o=e.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope,l=_u(e.type);return this.ht(()=>this.ft(e,i,s||n,a),l),i.event_id}captureSession(e){this.sendSession(e),El(e,{init:!1})}getDsn(){return this.lt}getOptions(){return this.et}getSdkMetadata(){return this.et.Xe}getTransport(){return this.ct}async flush(e){const t=this.ct;if(!t)return!0;this.emit("flush");const n=await this.gt(e),r=await t.flush(e);return n&&r}async close(e){su(this);const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this.ge}addEventProcessor(e){this.ge.push(e)}init(){(this.yt()||this.et.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this.vt()}getIntegrationByName(e){return this.nt[e]}addIntegration(e){const t=this.nt[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),ou(this,e,this.nt),t||iu(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=Mc(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const n=e.sdk||{};e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,n?.sdk);const s=function(e,t,n,r){const i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:ic(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,Cc(s,[[{type:o},e]])}(e,this.lt,this.et.Xe,this.et.tunnel);for(const e of t.attachments||[])n=Ic(n,Dc(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=xc}=this.et;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(aa&&xa(gu));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(aa&&xa(gu));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=Mc(n);return Cc({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:ic(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.lt,this.et.Xe,this.et.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.et.sendClientReports){const r=`${e}:${t}`;aa&&ba(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.it[r]=(this.it[r]||0)+n}}on(e,t){const n=this.ot[e]=this.ot[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this.ot[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this.yt()&&this.ct)try{return await this.ct.send(e)}catch(e){return aa&&ka("Error while sending envelope:",e),{}}return aa&&ka("Transport disabled"),{}}dispose(){}vt(){const{integrations:e}=this.et;this.nt=function(e,t){const n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&ou(e,t,n)}),n}(this,e),iu(this,e)}wt(e,t){let n="fatal"===t.level,r=!1;const i=t.exception?.values;if(i){r=!0,n=!1;for(const e of i)if(!1===e.mechanism?.handled){n=!0;break}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(El(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}async gt(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this.rt)return!0;t++}return!1}yt(){return!1!==this.getOptions().enabled&&void 0!==this.ct}bt(e,t,n,r){const i=this.getOptions(),o=Object.keys(this.nt);return!t.integrations&&o?.length&&(t.integrations=o),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Gc(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:{...e.contexts?.trace,...Ql(n)},...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||kc(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}ft(e,t={},n=Yl(),r=Zl()){return aa&&$u(e)&&ba(`Captured error event \`${fu(e)[0]||"<unknown>"}\``),this.xt(e,t,n,r).then(e=>e.event_id,e=>{aa&&(ku(e)?ba(e.message):xu(e)?xa(e.message):xa(e))})}xt(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Cu(e),a=$u(e),l=`before send for type \`${e.type||"error"}\``,c=void 0===o?void 0:function(e){if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t}(o);if(a&&"number"==typeof c&&gl()>c)return this.recordDroppedEvent("sample_rate","error"),Lc(bu(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const u=_u(e.type);return this.bt(e,t,n,r).then(e=>{if(null===e)throw this.recordDroppedEvent("event_processor",u),bu("An event processor returned `null`, will not send event.");if(!0===t.data?.Ke)return e;const n=function(e,t,n,r){const{beforeSend:i,beforeSendTransaction:o,ignoreSpans:s}=t,a=!((l=t.beforeSendSpan)&&"function"==typeof l&&"kt"in l&&l.kt)&&t.beforeSendSpan;var l;let c=n;if($u(c)&&i)return i(c,r);if(Cu(c)){if(a||s){const t=function(e){const{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:a}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:s?.[Jl],exclusive_time:s?.[Kl],measurements:e.measurements,is_segment:!0}}(c);if(s?.length&&vc(t,s))return null;if(a){const e=a(t);e?c=Pl(n,{type:"transaction",timestamp:(u=e).timestamp,start_timestamp:u.start_timestamp,transaction:u.description,contexts:{trace:{trace_id:u.trace_id,span_id:u.span_id,parent_span_id:u.parent_span_id,op:u.op,status:u.status,origin:u.origin,data:{...u.data,...u.profile_id&&{[Jl]:u.profile_id},...u.exclusive_time&&{[Kl]:u.exclusive_time}}}},measurements:u.measurements}):gc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(s?.length&&vc(e,s))wc(n,e);else if(a){const n=a(e);n?t.push(n):(gc(),t.push(e))}else t.push(e);const r=c.spans.length-t.length;r&&e.recordDroppedEvent("before_send","span",r),c.spans=t}}if(o){if(c.spans){const e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return o(c,r)}}var u;return c}(this,i,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Ja(e))return e.then(e=>{if(!Va(e)&&null!==e)throw wu(n);return e},e=>{throw wu(`${t} rejected with ${e}`)});if(!Va(e)&&null!==e)throw wu(n);return e}(n,l)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",u),s){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw bu(`${l} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.wt(o,i),s){const e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const c=i.transaction_info;if(s&&c&&i.transaction!==e.transaction){const e="custom";i.transaction_info={...c,source:e}}return this.sendEvent(i,t),i}).then(null,e=>{if(ku(e)||xu(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{Ke:!0},originalException:e}),wu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)})}ht(e,t){this.rt++,this.st.add(e).then(e=>(this.rt--,e),e=>(this.rt--,e===du&&this.recordDroppedEvent("queue_overflow",t),e))}Nt(){const e=this.it;return this.it={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}St(){aa&&ba("Flushing outcomes...");const e=this.Nt();if(0===e.length)return void(aa&&ba("No outcomes to send"));if(!this.lt)return void(aa&&ba("No dsn provided, will not send outcomes"));aa&&ba("Sending outcomes:",e);const t=(n=e,Cc((r=this.et.tunnel&&ic(this.lt))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Il(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function _u(e){return"replay_event"===e?"replay":e||"error"}function $u(e){return void 0===e.type}function Cu(e){return"transaction"===e.type}function Iu(e){let t=0;return e.name&&(t+=2*e.name.length),t+=8,t+Eu(e.attributes)}function Tu(e){let t=0;return e.message&&(t+=2*e.message.length),t+Eu(e.attributes)}function Eu(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Pu(e[0]):Ga(e)?t+=Pu(e):t+=100}),t}function Pu(e){return"string"==typeof e?2*e.length:"number"==typeof e?8:"boolean"==typeof e?4:0}function Du(e){return function(e){return Fa(e)&&"_t"in e&&"string"==typeof e._t}(e)?`${e.message} (${e._t})`:e.message}function zu(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function Ru(e){"aggregates"in e?void 0===e.attrs?.ip_address&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):void 0===e.ipAddress&&(e.ipAddress="{{auto}}")}const Mu=100;function Ou(e,t){const n=Vl(),r=Zl();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Mu}=n.getOptions();if(o<=0)return;const s={timestamp:Il(),...e},a=i?pa(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let ju;const Wu=new WeakMap,Au=()=>({name:"FunctionToString",setupOnce(){ju=function(){}.toString;try{Function.prototype.toString=function(...e){const t=ll(this),n=Wu.has(Vl())&&void 0!==t?t:this;return ju.apply(n,e)}}catch{}},setup(e){Wu.set(e,!0)}}),Lu=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Bu=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=qu(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=qu(e,n)}return function(e,t){if(e.type){if("transaction"===e.type&&function(e,t){if(!t?.length)return!1;const n=e.transaction;return!!n&&xl(n,t)}(e,t.ignoreTransactions))return aa&&xa(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Sl(e)}`),!0}else{if(function(e,t){return!!t?.length&&fu(e).some(e=>xl(e,t))}(e,t.ignoreErrors))return aa&&xa(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Sl(e)}`),!0;if(function(e){return!!e.exception?.values?.length&&(!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&"Error"!==e.type||e.value))}(e))return aa&&xa(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Sl(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=Hu(e);return!!n&&xl(n,t)}(e,t.denyUrls))return aa&&xa(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Sl(e)}.\nUrl: ${Hu(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=Hu(e);return!n||xl(n,t)}(e,t.allowUrls))return aa&&xa(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Sl(e)}.\nUrl: ${Hu(e)}`),!0}return!1}(n,t)?null:n}}},Fu=(e={})=>({...Bu(e),name:"InboundFilters"});function qu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Lu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Hu(e){try{const t=[...e.exception?.values??[]].reverse().find(e=>void 0===e.mechanism?.parent_id&&e.stacktrace?.frames?.length),n=t?.stacktrace?.frames;return n?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return aa&&ka(`Cannot extract url for event ${Sl(e)}`),null}}function Uu(e,t,n,r,i,o){if(!i.exception?.values||!o||!Ka(o.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=Yu(e,t,r,o.originalException,n,i.exception.values,s,0))}function Yu(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(Ka(r[i],Error)){Gu(s,a,r);const o=e(t,r[i]),c=l.length;Vu(o,i,c,a),l=Yu(e,t,n,r[i],i,[o,...l],o,c)}return Zu(r)&&r.errors.forEach((o,c)=>{if(Ka(o,Error)){Gu(s,a,r);const u=e(t,o),d=l.length;Vu(u,`errors[${c}]`,d,a),l=Yu(e,t,n,o,i,[u,...l],u,d)}}),l}function Zu(e){return Array.isArray(e.errors)}function Gu(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...Zu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Vu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Qu(){"console"in la&&ma.forEach(function(e){e in la.console&&ol(la.console,e,function(t){return fa[e]=t,function(...t){Oa("console",{args:t,level:e});const n=fa[e];n?.apply(la.console,t)}})})}const Ju=()=>{let e;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const n=e.message,r=t.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!Xu(e,t)&&!!Ku(e,t))))}(e,t)||!!function(e,t){const n=ed(t),r=ed(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!Xu(e,t)&&!!Ku(e,t)))}(e,t))}(t,e))return aa&&xa("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function Ku(e,t){let n=Ea(e),r=Ea(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Xu(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function ed(e){return e.exception?.values?.[0]}function td(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const nd=la;function rd(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function id(e,t){const n="fetch";Ra(n,e),Ma(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in nd))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}())return!1;if(rd(nd.fetch))return!0;let e=!1;const t=nd.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=rd(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){aa&&xa("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||ol(la,"fetch",function(e){return function(...t){const n=new Error,{method:r,url:i}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:sd(t),method:od(n,"method")?String(n.method).toUpperCase():el(t)&&od(t,"method")?String(t.method).toUpperCase():"GET"}}const t=e[0];return{url:sd(t),method:od(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*Tl(),virtualError:n,headers:ad(t)};return Oa("fetch",{...o}),e.apply(la,t).then(async e=>(Oa("fetch",{...o,endTimestamp:1e3*Tl(),response:e}),e),e=>{Oa("fetch",{...o,endTimestamp:1e3*Tl(),error:e}),Fa(e)&&void 0===e.stack&&(e.stack=n.stack,sl(e,"framesToPop",1));const t=Vl(),r=t?.getOptions().enhanceFetchErrorMessages??"always";if(!1!==r&&e instanceof TypeError&&("Failed to fetch"===e.message||"Load failed"===e.message||"NetworkError when attempting to fetch resource."===e.message))try{const t=new URL(o.fetchData.url).host;"always"===r?e.message=`${e.message} (${t})`:sl(e,"__sentry_fetch_url_host__",t)}catch{}throw e})}})}(0,t))}function od(e,t){return!!e&&"object"==typeof e&&!!e[t]}function sd(e){return"string"==typeof e?e:e?od(e,"url")?e.url:e.toString?e.toString():"":""}function ad(e){const[t,n]=e;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if(el(t))return new Headers(t.headers)}catch{}}const ld=la;let cd=0;function ud(){return cd>0}function dd(e,t={}){if(!function(e){return"function"==typeof e}(e))return e;try{const t=e.$t;if(t)return"function"==typeof t?t:e;if(ll(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>dd(e,t));return e.apply(this,r)}catch(e){throw cd++,setTimeout(()=>{cd--}),Gl(r=>{r.addEventProcessor(e=>(t.mechanism&&(_l(e,void 0),$l(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),Vc(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}al(n,e),sl(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function hd(e,t){const n=fd(e,t),r={type:yd(t),value:vd(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function md(e,t){return{exception:{values:[hd(e,t)]}}}function fd(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&pd.test(e.message)?1:0}(t),i=function(e){return"number"==typeof e.framesToPop?e.framesToPop:0}(t);try{return e(n,r,i)}catch{}return[]}const pd=/Minified React error #\d+;/i;function gd(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function yd(e){const t=e?.name;return!t&&gd(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function vd(e){const t=e?.message;return gd(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?Du(t.error):Du(e):"No error message"}function wd(e,t,n,r,i){let o;if(Ha(t)&&t.error)return md(e,t.error);if(Ua(t)||qa(t,"DOMException")){const i=t;if("stack"in t)o=md(e,t);else{const t=i.name||(Ua(i)?"DOMError":"DOMException"),s=i.message?`${t}: ${i.message}`:t;o=bd(e,s,n,r),_l(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Fa(t)?md(e,t):Va(t)||Qa(t)?(o=function(e,t,n,r){const i=Vl(),o=i?.getOptions().normalizeDepth,s=(a=t,Object.values(a).find(e=>e instanceof Error));var a;const l={Ct:_c(t,o)};if(s)return{exception:{values:[hd(e,s)]},extra:l};const c={exception:{values:[{type:Qa(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:xd(t,{isUnhandledRejection:r})}]},extra:l};if(n){const t=fd(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),$l(o,{synthetic:!0}),o):(o=bd(e,t,n,r),_l(o,`${t}`),$l(o,{synthetic:!0}),o)}function bd(e,t,n,r){const i={};if(r&&n){const r=fd(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),$l(i,{synthetic:!0})}if(Za(t)){const{le:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function xd(e,{isUnhandledRejection:t}){const n=function(e){const t=Object.keys(cl(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}(e),r=t?"promise rejection":"exception";return Ha(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Qa(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class kd extends Su{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:ld.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(e,t,n=[t],r="npm"){const i=(e.Xe=e.Xe||{}).sdk=e.Xe.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:ca})),i.version=ca)}(t,"browser",["browser"],ld.SENTRY_SDK_SOURCE||"npm"),t.Xe?.sdk&&(t.Xe.sdk.settings={infer_ip:t.sendDefaultPii?"auto":"never",...t.Xe.sdk.settings}),super(t);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o,ut:s,enableMetrics:a}=this.et,l=a??s?.enableMetrics??!0;ld.document&&(i||o||l)&&ld.document.addEventListener("visibilitychange",()=>{"hidden"===ld.document.visibilityState&&(i&&this.St(),o&&su(this),l&&lu(this))}),r&&this.on("beforeSendSession",Ru)}eventFromException(e,t){return function(e,t,n,r){const i=wd(e,t,n?.syntheticException||void 0,r);return $l(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),Ac(i)}(this.et.stackParser,e,t,this.et.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=bd(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),Ac(o)}(this.et.stackParser,e,t,n,this.et.attachStacktrace)}bt(e,t,n,r){return e.platform=e.platform||"javascript",super.bt(e,t,n,r)}}const Nd="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Sd=la;let _d,$d,Cd,Id;function Td(){if(!Sd.document)return;const e=Oa.bind(null,"dom"),t=Ed(e,!0);Sd.document.addEventListener("click",t,!1),Sd.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=Sd,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(ol(r,"addEventListener",function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.It=this.It||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=Ed(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),ol(r,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this.It||{},i=n[t];i&&(i.refCount--,i.refCount<=0&&(e.call(this,t,i.handler,r),i.handler=void 0,delete n[t]),0===Object.keys(n).length&&delete this.It)}catch{}return e.call(this,t,n,r)}}))})}function Ed(e,t=!1){return n=>{if(!n||n.Tt)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return"keypress"===e&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;sl(n,"_sentryCaptured",!0),r&&!r.Et&&sl(r,"_sentryId",kl());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==$d)return!1;try{if(!e.target||e.target.Et!==Cd)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),$d=n.type,Cd=r?r.Et:void 0),clearTimeout(_d),_d=Sd.setTimeout(()=>{Cd=void 0,$d=void 0},1e3)}}function Pd(e){const t="history";Ra(t,e),Ma(t,Dd)}function Dd(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Id,i=function(e){try{return new URL(e,Sd.location.origin).toString()}catch{return e}}(String(n));if(Id=i,r===i)return e.apply(this,t);Oa("history",{from:r,to:i})}return e.apply(this,t)}}Sd.addEventListener("popstate",()=>{const e=Sd.location.href,t=Id;Id=e,t!==e&&Oa("history",{from:t,to:e})}),"history"in nd&&nd.history&&(ol(Sd.history,"pushState",e),ol(Sd.history,"replaceState",e))}const zd={},Rd="__sentry_xhr_v3__";function Md(){if(!Sd.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*Tl(),o=Ya(n[0])?n[0].toUpperCase():void 0,s=function(e){if(Ya(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[Rd]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.Pt=!0);const a=()=>{const e=t[Rd];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}Oa("xhr",{endTimestamp:1e3*Tl(),startTimestamp:i,xhr:t,virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(a(),e.apply(t,n))}):t.addEventListener("readystatechange",a),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,i]=n,o=t[Rd];return o&&Ya(r)&&Ya(i)&&(o.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[Rd];return r?(void 0!==n[0]&&(r.body=n[0]),Oa("xhr",{startTimestamp:1e3*Tl(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function Od(e,t=function(e){const t=zd[e];if(t)return t;let n=Sd[e];if(rd(n))return zd[e]=n.bind(Sd);const r=Sd.document;if(r&&"function"==typeof r.createElement)try{const t=r.createElement("iframe");t.hidden=!0,r.head.appendChild(t);const i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){Nd&&xa(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?zd[e]=n.bind(Sd):n}("fetch")){let n=0,r=0;return mu(e,async function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.url,s);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(e){throw zd.fetch=void 0,e}finally{n-=o,r--}},hu(e.bufferSize||40))}const jd="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function Wd(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?Na:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Ad=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ld=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Bd=/\((\S*)(?::(\d+))(?::(\d+))\)/,Fd=/at (.+?) ?\(data:(.+?),/,qd=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Hd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ud=$a([30,e=>{const t=e.match(Fd);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=Ad.exec(e);if(n){const[,e,t,r]=n;return Wd(e,Na,+t,+r)}const r=Ld.exec(e);if(r){if(0===r[2]?.indexOf("eval")){const e=Bd.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=Yd(r[1]||Na,r[2]);return Wd(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=qd.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Hd.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Na;return[n,e]=Yd(n,e),Wd(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Yd=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Na,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Zd=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:"Breadcrumbs",setup(e){var n;t.console&&function(e){const t="console";Ra(t,e),Ma(t,Qu)}(function(e){return function(t){if(Vl()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:(r=t.level,"warn"===r?"warning":["fatal","error","warning","log","info","debug"].includes(r)?r:"log"),message:wl(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${wl(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Ou(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(Vl()!==e)return;let r,i,o="object"==typeof t?t.serializeAttribute:void 0,s="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;s&&s>1024&&(jd&&xa(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=1024),"string"==typeof o&&(o=[o]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=nl(t,{keyAttrs:o,maxStringLength:s}),i=function(e){if(!tl.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}(t)}catch{r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),Ou(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),Ra("dom",n),Ma("dom",Td)),t.xhr&&function(e){Ra("xhr",e),Ma("xhr",Md)}(function(e){return function(t){if(Vl()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Rd];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:l}=i,c={method:o,url:s,status_code:a},u={xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:c,type:"http",level:td(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),Ou(d,u)}}(e)),t.fetch&&id(function(e){return function(t){if(Vl()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){const i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},o={category:"fetch",data:t.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",o,i),Ou(o,i)}else{const i=t.response,o={...t.fetchData,status_code:i?.status},s={input:t.args,response:i,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,type:"http",level:td(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),Ou(a,s)}}}(e)),t.history&&Pd(function(e){return function(t){if(Vl()!==e)return;let n=t.from,r=t.to;const i=zu(ld.location.href);let o=n?zu(n):void 0;const s=zu(r);o?.path||(o=i),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),Ou({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){Vl()===e&&Ou({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Sl(t)},{event:t})}}(e))}}},Gd="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),Vd=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&ol(ld,"setTimeout",Qd),t.setInterval&&ol(ld,"setInterval",Qd),t.requestAnimationFrame&&ol(ld,"requestAnimationFrame",Jd),t.XMLHttpRequest&&"XMLHttpRequest"in ld&&ol(XMLHttpRequest.prototype,"send",Kd);const e=t.eventTarget;e&&(Array.isArray(e)?e:Gd).forEach(e=>function(e,t){const n=ld,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(ol(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=dd(i.handleEvent,{mechanism:{data:{handler:Ta(i),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,i),n.apply(this,[r,dd(i,{mechanism:{data:{handler:Ta(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),ol(r,"removeEventListener",function(e){return function(t,n,r){try{const i=n.$t;i&&e.call(this,t,i,r)}catch{}return e.call(this,t,n,r)}}))}(e,t))}}};function Qd(e){return function(...t){const n=t[0];return t[0]=dd(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Ta(e)}`}}),e.apply(this,t)}}function Jd(e){return function(t){return e.apply(this,[dd(t,{mechanism:{data:{handler:Ta(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function Kd(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&ol(n,e,function(t){const n={mechanism:{data:{handler:Ta(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=ll(t);return r&&(n.mechanism.data.handler=Ta(r)),dd(t,n)})}),e.apply(this,t)}}const Xd=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(void 0===ld.document)return void(jd&&xa("Using the `browserSessionIntegration` in non-browser environments is not supported."));Kc({ignoreDuration:!0}),tu();const e=Zl();let n=e.getUser();e.addScopeListener(e=>{const t=e.getUser();n?.id===t?.id&&n?.ip_address===t?.ip_address||(tu(),n=t)}),"route"===t&&Pd(({from:e,to:t})=>{e!==t&&(Kc({ignoreDuration:!0}),tu())})}}},eh=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(){const t="error";Ra(t,t=>{const{stackParser:n,attachStacktrace:r}=nh();if(Vl()!==e||ud())return;const{msg:i,url:o,line:s,column:a,error:l}=t,c=function(e,t,n,r){const i=e.exception=e.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[];return 0===l.length&&l.push({colno:r,lineno:n,filename:rh(t)??il(),function:Na,in_app:!0}),e}(wd(n,l||i,void 0,r,!1),o,s,a);c.level="error",Jc(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),Ma(t,Wa)}()}(e),th("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";Ra(t,t=>{const{stackParser:n,attachStacktrace:r}=nh();if(Vl()!==e||ud())return;const i=function(e){if(Ga(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),o=Ga(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:wd(n,i,void 0,r,!0);o.level="error",Jc(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),Ma(t,La)}()}(e),th("onunhandledrejection"))}}};function th(e){jd&&ba(`Global Handler attached: ${e}`)}function nh(){const e=Vl();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function rh(e){if(Ya(e)&&0!==e.length)return e.startsWith("data:")?`<${function(e,t=!0){if(e.startsWith("data:")){const n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=e.includes(";base64,"),o=e.indexOf(",");let s="";if(t&&-1!==o){const t=e.slice(o+1);s=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?",base64":""}${s?`,${s}`:""}`}return e}(e,!1)}>`:e}const ih=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){Uu(hd,i.getOptions().stackParser,n,t,e,r)}}};function oh(e={}){const t=!e.skipBrowserExtensionCheck&&!!function(){if(void 0===ld.window)return!1;const e=ld;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=il();return!(ld===ld.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}()&&(jd&&pa(()=>{}),!0);let n=null==e.defaultIntegrations?[Fu(),Au(),{name:"ConversationId",setup(e){e.on("spanStart",e=>{const t=Yl().getScopeData(),n=Zl().getScopeData(),r=t.conversationId||n.conversationId;r&&e.setAttribute("gen_ai.conversation.id",r)})}},Vd(),Zd(),eh(),ih(),Ju(),{name:"HttpContext",preprocessEvent(e){if(!ld.navigator&&!ld.location&&!ld.document)return;const t=function(){const e=il(),{referrer:t}=ld.document||{},{userAgent:n}=ld.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}},{name:"CultureContext",preprocessEvent(e){const t=function(){try{const e=ld.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})}},Xd()]:e.defaultIntegrations;const r={...e,enabled:!t&&e.enabled,stackParser:(i=e.stackParser||Ud,Array.isArray(i)?$a(...i):i),integrations:ru({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||Od};var i;return function(e,t){!0===t.debug&&(aa?wa():pa(()=>{})),Yl().update(t.initialScope);const n=new e(t);return function(e){Yl().setClient(e)}(n),n.init(),n}(kd,r)}let sh=!1;function ah(e){if(sh)t();else if(e.enabled&&e.dsn)try{const n=e.bundleUrlPatterns||[/cdn\.insure-os\.com/,/api\.os\.insure.*\/dist/,/localhost:\d+\/dist/,/index\.(esm|umd|cjs)\.js/];oh({dsn:e.dsn,environment:e.environment||"production",release:e.release,beforeSend:e=>function(e,t){var n,r,i,o;const s=null===(o=null===(i=null===(r=null===(n=e.exception)||void 0===n?void 0:n.values)||void 0===r?void 0:r[0])||void 0===i?void 0:i.stacktrace)||void 0===o?void 0:o.frames;if(!s||0===s.length)return!0;return s.some(e=>!!e.filename&&t.some(t=>t.test(e.filename||"")))}(e,n)?(e.tags={...e.tags,source:"insureos-widget"},t(e.exception),e):(t(e.exception),null),allowUrls:n,sampleRate:e.sampleRate||1,tracesSampleRate:e.tracesSampleRate||.1,integrations:[Zd({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),Ju()],ignoreErrors:["top.GLOBALS","originalCreateNotification","canvas.contentDocument","MyApp_RemoveAllHighlights","atomicFindClose","Can't find variable: ZiteReader","jigsaw is not defined","ComboSearch is not defined","ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"]}),sh=!0,t()}catch(e){}else t()}function lh(e,n){if(sh)try{n?Gl(t=>{Object.entries(n).forEach(([e,n])=>{t.setContext(e,n)}),Vc(e)}):Vc(e)}catch(e){t()}}function ch(e,n="info",r){if(sh)try{r?Gl(t=>{Object.entries(r).forEach(([e,n])=>{t.setContext(e,n)}),Qc(e,n)}):Qc(e,n)}catch(e){t()}}function uh(e){if(sh)try{!function(e){Zl().setUser(e)}(e)}catch(e){t()}}function dh(e){if(sh)try{Ou(e)}catch(e){t()}}function hh(e,n){if(sh)try{!function(e,t){Zl().setTag(e,t)}(e,n)}catch(e){t()}}function mh(){return sh}var fh=Object.freeze({__proto__:null,addBreadcrumb:dh,captureException:lh,captureMessage:ch,initializeSentry:ah,isSentryInitialized:mh,setTag:hh,setUser:uh});const ph="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",gh="production",yh="insureos-scripts",vh=!0,wh=1,bh=.1;class xh{constructor(e={}){var t,n,r,i;this.dataLayerAvailable=!1,this.config={enabled:null===(t=e.enabled)||void 0===t||t,customDataLayer:null!==(n=e.customDataLayer)&&void 0!==n?n:"dataLayer",includePersonalData:null!==(r=e.includePersonalData)&&void 0!==r&&r,debug:null!==(i=e.debug)&&void 0!==i&&i},"undefined"!=typeof window?this.initializeDataLayer():this.dataLayerAvailable=!1}initializeDataLayer(){try{const e=this.config.customDataLayer;window[e]||(window[e]=[],this.logDebug(`Created new ${e} array`)),Array.isArray(window[e])?(this.dataLayerAvailable=!0,this.logDebug(`✅ Data layer '${e}' is available and ready`)):(this.dataLayerAvailable=!1,this.logDebug(`⚠️ Data layer '${e}' exists but is not an array`))}catch(e){this.dataLayerAvailable=!1,this.logDebug("⚠️ Failed to initialize data layer:",e)}}isEnabled(){return this.config.enabled&&this.dataLayerAvailable}getDataLayer(){if(!this.isEnabled())return null;try{const e=window[this.config.customDataLayer];return Array.isArray(e)?e:null}catch(e){return this.logDebug("Failed to get data layer:",e),null}}push(e){if(!this.isEnabled())return void this.logDebug("📊 Analytics disabled or data layer not available, skipping event:",e.event);const t=this.getDataLayer();if(t)try{const n=this.config.includePersonalData?e:this.removePII(e);t.push(n),this.logDebug("📊 Pushed event to data layer:",n)}catch(e){this.logDebug("❌ Failed to push event to data layer:",e)}else this.logDebug("⚠️ Data layer not available, skipping event:",e.event)}removePII(e){const t={...e},n=["email","phone","name","address","client_name","client_email"];for(const e of n)e in t&&delete t[e];return t}logDebug(...e){this.config.debug&&t("[Analytics]",...e)}clear(){if(this.dataLayerAvailable)try{window[this.config.customDataLayer]=[],this.logDebug("🧹 Cleared data layer")}catch(e){this.logDebug("Failed to clear data layer:",e)}}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e},(e.customDataLayer||void 0!==e.enabled)&&this.initializeDataLayer(),this.logDebug("Updated analytics configuration:",this.config)}}class kh{constructor(){this.sentryInitialized=!1,this.analyticsManager=null,this.pendingPromoCodes=new Map}initializeSentryOnce(){if(!this.sentryInitialized)try{ah({dsn:ph,environment:gh,release:yh,enabled:vh,sampleRate:wh,tracesSampleRate:bh}),this.sentryInitialized=!0,t()}catch(e){t()}}validateConfig(e){if(!e.orgId)throw new Error("orgId is required");if("payment"===e.mode&&!e.paymentLinkId)throw new Error("paymentLinkId is required when mode is 'payment'")}initializeAnalyticsOnce(e){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new xh({enabled:null===(n=e.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=e.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=e.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=e.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:e.debug}),Ie(this.analyticsManager),t()}catch(e){t()}}async mount(e,t){t.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(t),this.initializeSentryOnce(),this.initializeAnalyticsOnce(t),function(e,t){var i,o,s;t==document&&(t=document.documentElement),r.m&&r.m(e,t),i=t.i,o=[],s=[],L(t,e=t.i=S($,null,[e]),i||v,v,t.namespaceURI,i?null:t.firstChild?n.call(t.childNodes):null,o,i?i.v:t.firstChild,!1,s),F(o,e,s)}(S(sa,{config:t,initializeFormContext:this.initializeFormContext.bind(this)}),e)}createHttpClient(e){var t,n,r,i,o,s,a,l,c,u;if(!e.orgId)throw new Error("orgId is required");const d=e.apiBaseUrl||"https://api.os.insure";return new Q({orgId:e.orgId,apiBaseUrl:d,timeout:(null===(t=e.httpConfig)||void 0===t?void 0:t.timeout)||1e4,retryConfig:{maxRetries:(null===(r=null===(n=e.httpConfig)||void 0===n?void 0:n.retryConfig)||void 0===r?void 0:r.maxRetries)||3,baseDelay:(null===(o=null===(i=e.httpConfig)||void 0===i?void 0:i.retryConfig)||void 0===o?void 0:o.baseDelay)||1e3,maxDelay:(null===(a=null===(s=e.httpConfig)||void 0===s?void 0:s.retryConfig)||void 0===a?void 0:a.maxDelay)||1e4,retryableStatusCodes:(null===(c=null===(l=e.httpConfig)||void 0===l?void 0:l.retryConfig)||void 0===c?void 0:c.retryableStatusCodes)||[429,500,502,503,504],...null===(u=e.httpConfig)||void 0===u?void 0:u.retryConfig}})}createClient(e){const t=this.createHttpClient(e);return new Le(t)}async initializeFormContext(e){var n,r,i,o,s;const a=this.createHttpClient(e),l=new URLSearchParams(window.location.search),c=l.get("qi");c&&(t(),e.quoteIntentUrl=`${e.apiBaseUrl}/quote-intents/${c}`);const u=l.get("p")||l.get("pl_ref");if(u)return t(),{httpClient:a,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:u,signedUrl:void 0}};if("payment"===e.mode)return t(),{httpClient:a,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:e.paymentLinkId,signedUrl:e.signedUrl}};const d="sessionStorage"===e.storageType?new K:new J;d.isAvailable()?t(d.constructor.name):t();const h=new ee(d),m=new te(h),f=e.products,p=null==f?void 0:f.includes("*"),g=!f||0===f.length,y=g||p||f&&f.length>1,v=f&&1===f.length&&!p,w=localStorage.getItem("insure-os-selected-product"),b=new URLSearchParams(window.location.search),x=!!(b.get("transactionId")||b.get("transaction_id")||b.get("payment_id")),k=b.get("code");if("1"===b.get("clear")){t(),localStorage.clear(),b.delete("clear");const e=b.toString()?`${window.location.pathname}?${b.toString()}`:window.location.pathname;window.history.replaceState({},"",e),t()}const N=`insure-os-pending-promo-${e.orgId}`,S="skipPendingPromoCode"in e&&!0===e.skipPendingPromoCode;if(k&&!x&&!S){const n={code:k,ts:Date.now()};localStorage.setItem(N,JSON.stringify(n)),this.pendingPromoCodes.set(e.orgId,k),t(),b.delete("code");const r=b.toString()?`${window.location.pathname}?${b.toString()}`:window.location.pathname;window.history.replaceState({},"",r)}const _="promoCode"in e?e.promoCode:void 0;let $=null;if(!S)try{const e=localStorage.getItem(N);if(e){const t=JSON.parse(e);"object"==typeof t&&t.code&&Date.now()-t.ts<36e5?$=t.code:"string"==typeof t?$=t:localStorage.removeItem(N)}}catch(e){localStorage.removeItem(N)}const C=S?void 0:this.pendingPromoCodes.get(e.orgId),I=k||_||$||C||null;if(t(),I&&!x){const i=h.getQuoteIntent(e.orgId);if(null===(n=null==i?void 0:i.form_data)||void 0===n?void 0:n.page_data){const n=i.form_data.page_data,o=null===(r=Object.values(n).find(e=>e&&"object"==typeof e&&"promo_code"in e))||void 0===r?void 0:r.promo_code;o&&o!==I&&(t(),m.clearQuoteIntent(e.orgId))}}const T=async n=>{var r;t(n.id);const i=new We(n,a,m,{autoSave:!1,autoSaveInterval:n.form_definition.settings.autoSaveInterval});if("prefillFormData"in e&&e.prefillFormData){const o=(null===(r=n.form_definition)||void 0===r?void 0:r.pages.length)||0,s=Array.from({length:o},(e,t)=>t);i.restoreFormProgress({page_data:e.prefillFormData,current_page:o-1,completed_pages:s,last_updated:(new Date).toISOString()}),t()}else n.form_data&&i.restoreFormProgress(n.form_data);if(I){const e=i.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));e?(i.updateFieldValue(e.id,"promo_code",I),t(e.id)):t()}if(n.cached_result&&(t(),i.restoreCalculationResult(n.cached_result)),n.organisation&&n.organisation.theme)try{await Qs.loadTheme({slug:n.organisation.slug,theme_url:n.organisation.theme.css_url})}catch(e){t()}const o="skipAutoCalculation"in e&&!!e.skipAutoCalculation;return await this.handleAutoCalculationIfComplete(i,o),{httpClient:a,stateManager:h,quoteIntent:n,quoteIntentStore:m,formStateManager:i,urlPromoCode:I||void 0}};if(y&&!e.quoteIntentUrl&&!w){const n=x?null:h.getQuoteIntent(e.orgId);if(n)try{const r=await a.getQuoteIntent(n.url),l={id:r.quote_intent.id,url:r.url,calculate_url:r.calculate_url,delete_calculations_url:r.delete_calculations_url,expires_at:new Date(r.quote_intent.expires_at).getTime(),updated_at:new Date(r.quote_intent.updated_at).getTime(),created_at:new Date(r.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:r.product.id,product_name:r.product.description||r.product.name,form_definition:r.product.form_definition,form_data:r.quote_intent.form_data,status:r.quote_intent.status,reference:r.quote_intent.reference,organisation:r.organisation,cached_result:r.cached_result};if(h.saveQuoteIntent(e.orgId,l),null===(o=null===(i=l.form_data)||void 0===i?void 0:i.completed_pages)||void 0===o?void 0:o.length){if(t(),null===(s=l.organisation)||void 0===s?void 0:s.theme)try{await Qs.loadTheme({slug:l.organisation.slug,theme_url:l.organisation.theme.css_url})}catch(e){t()}const{firstName:n,lastUpdated:r}=(e=>{var t;const n=["client_first_name","first_name","firstName","fname","given_name"],r=null===(t=e.form_data)||void 0===t?void 0:t.page_data;let i=null;if(r)for(const e of Object.values(r)){if(!e||"object"!=typeof e)continue;const t=e;for(const e of n)if(t[e]){i=String(t[e]);break}if(i)break}return{firstName:i,lastUpdated:e.updated_at?new Date(e.updated_at).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):null}})(l);return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,resumePrompt:{reference:l.reference||null,productName:l.product_name||null,firstName:n,lastUpdated:r,onContinue:async()=>T(l),onStartFresh:async()=>{m.clearQuoteIntent(e.orgId);const t=await a.fetchAvailableProducts(g?void 0:f);return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,availableProducts:t.products,productCodes:f}}}}}}catch(n){t(),m.clearQuoteIntent(e.orgId)}t();const r=await a.fetchAvailableProducts(g?void 0:f);if(t(),r.organisation&&r.organisation.theme)try{const e=await Promise.resolve().then(function(){return Js}).then(e=>e.ThemeLoader);await e.loadTheme({slug:r.organisation.slug,theme_url:r.organisation.theme.css_url}),t()}catch(e){t()}return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,availableProducts:r.products,productCodes:f}}let E;w?(t(),E=w,localStorage.removeItem("insure-os-selected-product")):v&&(E=f[0]);const P=async()=>{t();const n=e.quoteIntentUrl?await a.getQuoteIntent(e.quoteIntentUrl):await a.createQuoteIntent({code:E,...e.dealerOrganisationId&&{dealer_organisation_id:e.dealerOrganisationId}});return t(),{id:n.quote_intent.id,url:n.url,calculate_url:n.calculate_url,delete_calculations_url:n.delete_calculations_url,calculate_url_v2:n.calculate_url_v2,reprice_url_v2:n.reprice_url_v2,bind_url_v2:n.bind_url_v2,calculator_version:n.product.calculator_version,expires_at:new Date(n.quote_intent.expires_at).getTime(),updated_at:new Date(n.quote_intent.updated_at).getTime(),created_at:new Date(n.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:n.product.id,product_name:n.product.description||n.product.name,form_definition:n.product.form_definition,form_data:n.quote_intent.form_data,status:n.quote_intent.status,reference:n.quote_intent.reference,organisation:n.organisation,cached_result:n.cached_result}},D=async t=>{var n;const r=new URLSearchParams(window.location.search),i=r.get("transaction_id")||r.get("payment_id")||r.get("transactionId"),o=await a.getQuoteIntent(t);let s;const l=r.get("status");if(i){const e=null===(n=o.payment_transactions)||void 0===n?void 0:n.find(e=>e.id===i);if(e){let t="unknown";switch(e.status){case"completed":t="success";break;case"failed":t="declined";break;case"cancelled":t="cancelled";break;default:t="error"}s={paymentTransactionId:e.id,paymentStatus:t,transactionStatus:e}}else if(l){let e="error";switch(l.toLowerCase()){case"success":case"completed":e="success";break;case"failed":case"declined":e="declined";break;case"cancelled":case"canceled":e="cancelled";break;default:e="error"}s={paymentTransactionId:i,paymentStatus:e,transactionStatus:void 0}}}const c={id:o.quote_intent.id,url:o.url,calculate_url:o.calculate_url,delete_calculations_url:o.delete_calculations_url,calculate_url_v2:o.calculate_url_v2,reprice_url_v2:o.reprice_url_v2,bind_url_v2:o.bind_url_v2,calculator_version:o.product.calculator_version,expires_at:new Date(o.quote_intent.expires_at).getTime(),updated_at:new Date(o.quote_intent.updated_at).getTime(),created_at:new Date(o.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:o.product.id,product_name:o.product.description||o.product.name,form_definition:o.product.form_definition,form_data:o.quote_intent.form_data,status:o.quote_intent.status,reference:o.quote_intent.reference,organisation:o.organisation,payment_return:s,payment_transactions:o.payment_transactions,cached_result:o.cached_result};return s&&h.saveQuoteIntent(e.orgId,c),c};return(async()=>{let t=null,n=!1;try{const r=h.getQuoteIntent(e.orgId),i=await m.getOrCreateQuoteIntent(e.orgId,P,D);i.payment_return&&h.saveQuoteIntent(e.orgId,i),t=i,n=!r}catch(r){if(!(r instanceof G&&404===r.statusCode))throw r;m.clearQuoteIntent(e.orgId),t=await m.getOrCreateQuoteIntent(e.orgId,P,D),n=!0}if(n&&t&&Ee(t),!t)throw new Error("Failed to initialize quote intent state");return T(t)})()}async handleAutoCalculationIfComplete(e,n=!1){try{if(n)return void t();const r=e.getQuoteIntent();if("paid"===r.status||"completed"===r.status)return void t();if(e.hasCalculationResponse())return void t();if(e.hasLastCalculationFailed())return void t();const i=e.getPageCompletionStatus(),{totalPages:o,completedPages:s}=i,a=s.length===o;t((s.length,e.getIsCalculating(),e.hasLastCalculationFailed())),a&&!e.getIsCalculating()&&(t(),await e.calculateQuote(),t())}catch(e){t()}}}const Nh=new kh;"undefined"!=typeof window&&(window.InsureOS=Nh,function(){const e=document.querySelectorAll('script[src*="insureos"]'),t=e[e.length-1];if(t&&t.src){const e=new URL(t.src),n=e.searchParams.get("orgId"),r=e.searchParams.get("productCode"),i=e.searchParams.get("productCodes"),o=i?i.split(","):r?[r]:null;if(n&&o){const t=e.searchParams.get("container"),r=t?document.getElementById(t):document.body;if(r){const e={orgId:n,products:o};r.dataset.insureosConfig=JSON.stringify(e);const t=async()=>{try{await Nh.mount(r,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class Sh{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,Sh.instance)return Sh.instance;Sh.instance=this}startMeasurement(e){this.measurements.set(e,this.now())}endMeasurement(e){const t=this.measurements.get(e);if(void 0===t)throw new Error(`No measurement started for: ${e}`);const n=this.now()-t;return this.measurements.delete(e),this.completedMeasurements.has(e)||this.completedMeasurements.set(e,[]),this.completedMeasurements.get(e).push(n),"initialization"===e&&(this.initializationTime=n),n}async measureApiCall(e,t){const n=this.now();let r,i=!1;try{const e=await t();return i=!0,e}catch(e){throw i=!1,r=e instanceof Error?e.message:"Unknown error",e}finally{const t=this.now()-n;this.apiCallMetrics.push({operation:e,duration:t,timestamp:Date.now(),success:i,error:r})}}measureMemoryUsage(){return"undefined"!=typeof performance&&"memory"in performance&&performance.memory.usedJSHeapSize||0}getDetailedMemoryInfo(){if("undefined"!=typeof performance&&"memory"in performance){const e=performance.memory;return{usedJSHeapSize:e.usedJSHeapSize||0,totalJSHeapSize:e.totalJSHeapSize||0,jsHeapSizeLimit:e.jsHeapSizeLimit||0}}return null}getMetrics(){var e;const t=this.apiCallMetrics.filter(e=>e.success).map(e=>e.duration),n=t.length>0?t.reduce((e,t)=>e+t,0)/t.length:0,r={};return this.completedMeasurements.forEach((e,t)=>{r[t]=[...e]}),{bundleSize:{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}},runtime:{initializationTime:this.initializationTime,apiCallTime:t.length>0&&null!==(e=t[t.length-1])&&void 0!==e?e:0,memoryUsage:this.measureMemoryUsage(),averageApiCallTime:n,totalApiCalls:this.apiCallMetrics.length},measurements:r}}getApiCallMetrics(){return[...this.apiCallMetrics]}clearMetrics(){this.completedMeasurements.clear(),this.apiCallMetrics=[],this.initializationTime=0}generateReport(){const e=this.getMetrics(),t=this.getDetailedMemoryInfo();let n="=== Performance Report ===\n\n";if(n+="Runtime Performance:\n",n+=` Initialization Time: ${e.runtime.initializationTime.toFixed(2)}ms\n`,n+=` Total API Calls: ${e.runtime.totalApiCalls}\n`,n+=` Average API Call Time: ${e.runtime.averageApiCallTime.toFixed(2)}ms\n`,n+=` Current Memory Usage: ${(e.runtime.memoryUsage/1024/1024).toFixed(2)}MB\n\n`,t&&(n+="Memory Details:\n",n+=` Used Heap: ${(t.usedJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Total Heap: ${(t.totalJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Heap Limit: ${(t.jsHeapSizeLimit/1024/1024).toFixed(2)}MB\n\n`),this.apiCallMetrics.length>0){n+="API Call Breakdown:\n";const e=new Map;this.apiCallMetrics.forEach(t=>{e.has(t.operation)||e.set(t.operation,{count:0,totalTime:0,errors:0});const n=e.get(t.operation);n.count++,n.totalTime+=t.duration,t.success||n.errors++}),e.forEach((e,t)=>{const r=e.totalTime/e.count,i=(e.errors/e.count*100).toFixed(1);n+=` ${t}: ${e.count} calls, ${r.toFixed(2)}ms avg, ${i}% errors\n`})}return n}static async getBundleSizes(){return{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}}}now(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()}static startMeasurement(e){(new Sh).startMeasurement(e)}static endMeasurement(e){return(new Sh).endMeasurement(e)}static measureMemoryUsage(){return(new Sh).measureMemoryUsage()}static async measureApiCall(e,t){return(new Sh).measureApiCall(e,t)}static getMetrics(){return(new Sh).getMetrics()}static generateReport(){return(new Sh).generateReport()}}let _h=class e{constructor(t){this.headers=new Map,t&&(Array.isArray(t)?t.forEach(([e,t])=>this.set(e,t)):t instanceof e?t.forEach((e,t)=>this.set(t,e)):Object.entries(t).forEach(([e,t])=>this.set(e,t)))}append(e,t){const n=this.get(e);this.set(e,n?`${n}, ${t}`:t)}delete(e){this.headers.delete(e.toLowerCase())}get(e){return this.headers.get(e.toLowerCase())||null}has(e){return this.headers.has(e.toLowerCase())}set(e,t){this.headers.set(e.toLowerCase(),t)}forEach(e){this.headers.forEach(e)}},$h=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new _h(t.headers),this.body=t.body||null,this.signal=t.signal||void 0):(this.url=e.url,this.method=t.method||e.method,this.headers=new _h(t.headers||e.headers),this.body=void 0!==t.body?t.body:e.body,this.signal=void 0!==t.signal?null!==(n=t.signal)&&void 0!==n?n:void 0:e.signal)}},Ch=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new _h(t.headers),this.ok=this.status>=200&&this.status<300,this.Dt=e}async text(){return this.Dt}async json(){return JSON.parse(this.Dt)}};var Ih=Object.freeze({__proto__:null,Headers:_h,Request:$h,Response:Ch,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new $h(e,t),o=new XMLHttpRequest;i.signal&&i.signal.addEventListener("abort",()=>{o.abort(),r(new Error("Request aborted"))}),o.open(i.method,i.url),i.headers.forEach((e,t)=>{o.setRequestHeader(t,e)}),o.onload=()=>{const e=new _h;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new Ch(o.responseText,{status:o.status,statusText:o.statusText,headers:e});n(t)},o.onerror=()=>{r(new TypeError("Network request failed"))},o.ontimeout=()=>{r(new TypeError("Network request timed out"))},o.send(i.body)})}});class Th{constructor(e){this.state="pending",this.onFulfilledCallbacks=[],this.onRejectedCallbacks=[];try{e(this.resolve.bind(this),this.reject.bind(this))}catch(e){this.reject(e)}}resolve(e){"pending"===this.state&&(this.state="fulfilled",this.value=e,this.onFulfilledCallbacks.forEach(t=>{setTimeout(()=>t(e),0)}))}reject(e){"pending"===this.state&&(this.state="rejected",this.reason=e,this.onRejectedCallbacks.forEach(t=>{setTimeout(()=>t(e),0)}))}then(e,t){return new Th((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof Th?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof Th?i.then(n,r):n(i)}else r(e)}catch(e){r(e)}};"fulfilled"===this.state?setTimeout(()=>i(this.value),0):"rejected"===this.state?setTimeout(()=>o(this.reason),0):(this.onFulfilledCallbacks.push(i),this.onRejectedCallbacks.push(o))})}catch(e){return this.then(void 0,e)}static resolve(e){return new Th(t=>t(e))}static reject(e){return new Th((t,n)=>n(e))}static all(e){return new Th((t,n)=>{if(0===e.length)return void t([]);const r=[];let i=0;e.forEach((o,s)=>{o.then(n=>{r[s]=n,i++,i===e.length&&t(r)},n)})})}}var Eh=Object.freeze({__proto__:null,PromisePolyfill:Th});class Ph{constructor(e){this.params=new Map,"string"==typeof e?this.parseString(e):e&&"object"==typeof e&&"forEach"in e&&"function"==typeof e.forEach?e.forEach((e,t)=>this.append(t,e)):e&&"object"==typeof e&&Object.entries(e).forEach(([e,t])=>this.set(e,t))}parseString(e){const t=e.startsWith("?")?e.slice(1):e;t&&t.split("&").forEach(e=>{if(!e)return;const t=e.indexOf("=");let n,r;-1===t?(n=e,r=""):(n=e.substring(0,t),r=e.substring(t+1)),n&&this.append(decodeURIComponent(n),decodeURIComponent(r))})}append(e,t){const n=this.params.get(e)||[];n.push(t),this.params.set(e,n)}delete(e){this.params.delete(e)}get(e){var t;const n=this.params.get(e);return n&&n.length>0&&null!==(t=n[0])&&void 0!==t?t:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,t){this.params.set(e,[t])}forEach(e){this.params.forEach((t,n)=>{t.forEach(t=>e(t,n))})}toString(){const e=[];return this.params.forEach((t,n)=>{t.forEach(t=>{e.push(`${encodeURIComponent(n)}=${encodeURIComponent(t)}`)})}),e.join("&")}}var Dh=Object.freeze({__proto__:null,URLPolyfill:class{constructor(e,t){const n=this.parseUrl(e,t);this.protocol=n.protocol,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.hash=n.hash,this.host=this.port?`${this.hostname}:${this.port}`:this.hostname,this.origin=`${this.protocol}//${this.host}`,this.href=this.toString(),this.searchParams=new Ph(this.search)}parseUrl(e,t){const n=document.createElement("a");if(t){const r=document.createElement("a");r.href=t,n.href=this.resolveUrl(e,r.href)}else n.href=e;return{protocol:n.protocol,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash}}resolveUrl(e,t){if(e.includes("://"))return e;if(e.startsWith("/")){const n=document.createElement("a");return n.href=t,`${n.protocol}//${n.host}${e}`}return`${t.split("/").slice(0,-1).join("/")}/${e}`}toString(){return`${this.protocol}//${this.host}${this.pathname}${this.search}${this.hash}`}},URLSearchParamsPolyfill:Ph});e.DataLayerManager=xh,e.EnhancedHttpClient=Q,e.ErrorHandlingStrategy=class{handleNetworkError(t){return new G(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(t){if(503===t.status)return new G(e.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);const n=t.status>=500||429===t.status;return 429===t.status?new G(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,t.status):t.status>=400&&t.status<500?new G(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status):t.status>=500?new G(e.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,t.status):new G(e.ErrorType.API_ERROR,`Request failed: ${t.statusText}`,n,t.status)}handleStorageError(t){return new G(e.ErrorType.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(e){return e.retryable}getUserFriendlyMessage(t){switch(t.type){case e.ErrorType.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case e.ErrorType.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case e.ErrorType.API_ERROR:return 429===t.statusCode?"Too many requests. Please wait a moment and try again.":t.statusCode&&t.statusCode>=400&&t.statusCode<500?"Invalid request. Please refresh the page and try again.":t.statusCode&&t.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case e.ErrorType.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case e.ErrorType.TIMEOUT_ERROR:return"Request timed out. Please try again.";case e.ErrorType.VALIDATION_ERROR:return t.validationErrors&&Object.keys(t.validationErrors).length>0?"There were validation errors in your form. Please check your inputs and try again.":"Invalid data provided. Please check your input and try again.";default:return"An unexpected error occurred. Please try again."}}},e.FormStateManager=We,e.InsureOS=Nh,e.InsureOSClient=kh,e.InsureOSError=G,e.LocalStateManager=ee,e.LocalStorageAdapter=J,e.MemoryStorageAdapter=class{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||null}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}clear(){this.storage.clear()}isAvailable(){return!0}},e.PerformanceMonitor=Sh,e.PolyfillManager=class{constructor(e={}){var t,n,r;this.detectionResults=null,this.config={fetch:null===(t=e.fetch)||void 0===t||t,promise:null===(n=e.promise)||void 0===n||n,url:null===(r=e.url)||void 0===r||r}}async loadPolyfills(){this.detectionResults=this.detectFeatures(),this.config.fetch&&this.detectionResults.fetch&&await this.loadFetchPolyfill(),this.config.promise&&this.detectionResults.promise&&await this.loadPromisePolyfill(),this.config.url&&this.detectionResults.url&&await this.loadUrlPolyfill()}getDetectionResults(){return this.detectionResults}detectFeatures(){return{fetch:this.needsFetchPolyfill(),promise:this.needsPromisePolyfill(),url:this.needsUrlPolyfill()}}needsFetchPolyfill(){if("undefined"==typeof fetch)return!0;if("undefined"==typeof Headers||"undefined"==typeof Request||"undefined"==typeof Response)return!0;try{return new Headers,new Request("http://example.com"),new Response,!1}catch(e){return!0}}needsPromisePolyfill(){if("undefined"==typeof Promise)return!0;if("function"!=typeof Promise.resolve||"function"!=typeof Promise.reject||"function"!=typeof Promise.all)return!0;try{const e=Promise.resolve(42);return"function"!=typeof e.then||"function"!=typeof e.catch}catch(e){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const e=new URL("http://example.com/path?param=value#hash");if("string"!=typeof e.protocol||"string"!=typeof e.hostname||"string"!=typeof e.pathname||"string"!=typeof e.search||"string"!=typeof e.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const t=new URLSearchParams("param=value");return"function"!=typeof t.get||"function"!=typeof t.set}catch(e){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:e,Headers:t,Request:n,Response:r}=await Promise.resolve().then(function(){return Ih});void 0===globalThis.fetch&&(globalThis.fetch=e),void 0===globalThis.Headers&&(globalThis.Headers=t),void 0===globalThis.Request&&(globalThis.Request=n),void 0===globalThis.Response&&(globalThis.Response=r)}catch(e){}}async loadPromisePolyfill(){if(this.needsPromisePolyfill())try{const{PromisePolyfill:e}=await Promise.resolve().then(function(){return Eh});void 0===globalThis.Promise&&(globalThis.Promise=e)}catch(e){}}async loadUrlPolyfill(){if(this.needsUrlPolyfill())try{const{URLPolyfill:e,URLSearchParamsPolyfill:t}=await Promise.resolve().then(function(){return Dh});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}},e.RetryStrategy=V,e.SessionStorageAdapter=K,e.ThemeLoader=Qs,e.addBreadcrumb=dh,e.captureException=lh,e.captureMessage=ch,e.createAppError=ve,e.getAnalytics=function(){return Ce},e.getSupportMessage=$e,e.groupErrorsByField=function(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})},e.initializeAnalytics=Ie,e.initializeSentry=ah,e.isSentryInitialized=mh,e.parseServerValidationErrors=me,e.setTag=hh,e.setUser=uh,e.shouldShowErrorPage=function(e){return"initialization"===e.type&&"critical"===e.severity},e.shouldShowMaintenancePage=_e,e.trackFormProgress=Pe,e.trackPaymentCompleted=Oe,e.trackPaymentFailed=je,e.trackPaymentInitiated=Me,e.trackQuoteAtCheckout=ze,e.trackQuoteCalculated=De,e.trackQuoteReferred=Re,e.trackQuoteStarted=Ee,e.validateField=de,e.validatePage=he});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).InsureOSScripts={})}(this,function(e){"use strict";const t=()=>{globalThis.insureOSDebug};var n,r,i,o,s,a,l,c,u,d,h,m,f,p,g,y,v={},w=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,x=Array.isArray;function k(e,t){for(var n in t)e[n]=t[n];return e}function N(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function S(e,t,r){var i,o,s,a={};for(s in t)"key"==s?i=t[s]:"ref"==s?o=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?n.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return _(e,a,i,o,null)}function _(e,t,n,o,s){var a={type:e,props:t,key:n,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:null==s?++i:s,_:-1,C:0};return null==s&&null!=r.vnode&&r.vnode(a),a}function $(e){return e.children}function C(e,t){this.props=e,this.context=t}function I(e,t){if(null==t)return e.m?I(e.m,e._+1):null;for(var n;t<e.i.length;t++)if(null!=(n=e.i[t])&&null!=n.v)return n.v;return"function"==typeof e.type?I(e):null}function T(e){if(e.I&&e.P){var t=e.N,n=t.v,i=[],o=[],s=k({},t);s.N=t.N+1,r.vnode&&r.vnode(s),L(e.I,s,t,e.R,e.I.namespaceURI,32&t.C?[n]:null,i,null==n?I(t):n,!!(32&t.C),o),s.N=t.N,s.m.i[s._]=s,F(i,s,o),t.v=t.m=null,s.v!=n&&E(s)}}function E(e){if(null!=(e=e.m)&&null!=e.k)return e.v=e.k.base=null,e.i.some(function(t){if(null!=t&&null!=t.v)return e.v=e.k.base=t.v}),E(e)}function P(e){(!e.P&&(e.P=!0)&&o.push(e)&&!D.O++||s!=r.debounceRendering)&&((s=r.debounceRendering)||a)(D)}function D(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(l),e=o.shift(),t=o.length,T(e)}finally{o.length=D.O=0}}function z(e,t,n,r,i,o,s,a,l,c,u){var d,h,m,f,p,g,y,b=r&&r.i||w,x=t.length;for(l=R(n,t,b,l,x),d=0;d<x;d++)null!=(m=n.i[d])&&(h=-1!=m._&&b[m._]||v,m._=d,g=L(e,m,h,i,o,s,a,l,c,u),f=m.v,m.ref&&h.ref!=m.ref&&(h.ref&&U(h.ref,null,m),u.push(m.ref,m.k||f,m)),null==p&&null!=f&&(p=f),(y=!!(4&m.C))||h.i===m.i?(l=M(m,l,e,y),y&&h.v&&(h.v=null)):"function"==typeof m.type&&void 0!==g?l=g:f&&(l=f.nextSibling),m.C&=-7);return n.v=p,l}function R(e,t,n,r,i){var o,s,a,l,c,u=n.length,d=u,h=0;for(e.i=new Array(i),o=0;o<i;o++)null!=(s=t[o])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.i[o]=_(null,s,null,null,null):x(s)?s=e.i[o]=_($,{children:s},null,null,null):void 0===s.constructor&&s.p>0?s=e.i[o]=_(s.type,s.props,s.key,s.ref?s.ref:null,s.N):e.i[o]=s,l=o+h,s.m=e,s.p=e.p+1,a=null,-1!=(c=s._=O(s,n,l,d))&&(d--,(a=n[c])&&(a.C|=2)),null==a||null==a.N?(-1==c&&(i>u?h--:i<u&&h++),"function"!=typeof s.type&&(s.C|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,s.C|=4))):e.i[o]=null;if(d)for(o=0;o<u;o++)null!=(a=n[o])&&!(2&a.C)&&(a.v==r&&(r=I(a)),Y(a,a));return r}function M(e,t,n,r){var i,o;if("function"==typeof e.type){for(i=e.i,o=0;i&&o<i.length;o++)i[o]&&(i[o].m=e,t=M(i[o],t,n,r));return t}e.v!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=I(e)),n.insertBefore(e.v,t||null)),t=e.v);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function O(e,t,n,r){var i,o,s,a=e.key,l=e.type,c=t[n],u=null!=c&&!(2&c.C);if(null===c&&null==a||u&&a==c.key&&l==c.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(c=t[s=i>=0?i--:o++])&&!(2&c.C)&&a==c.key&&l==c.type)return s;return-1}function j(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function W(e,t,n,r,i){var o,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||j(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||j(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(h,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[d]=r[d]:(n[d]=m,e.addEventListener(t,o?p:f,o)):e.removeEventListener(t,o?p:f,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function A(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[u])t[u]=m++;else if(t[u]<n[d])return;return n(r.event?r.event(t):t)}}}function L(e,t,n,i,o,s,a,l,c,u){var d,h,m,f,p,g,y,v,b,S,_,I,T,E,P,D=t.type;if(void 0!==t.constructor)return null;128&n.C&&(c=!!(32&n.C),s=[l=t.v=n.v]),(d=r.p)&&d(t);e:if("function"==typeof D)try{if(v=t.props,b=D.prototype&&D.prototype.render,S=(d=D.contextType)&&i[d.k],_=d?S?S.props.value:d.m:i,n.k?y=(h=t.k=n.k).m=h.j:(b?t.k=h=new D(v,_):(t.k=h=new C(v,_),h.constructor=D,h.render=Z),S&&S.sub(h),h.state||(h.state={}),h.R=i,m=h.P=!0,h.W=[],h.A=[]),b&&null==h.L&&(h.L=h.state),b&&null!=D.getDerivedStateFromProps&&(h.L==h.state&&(h.L=k({},h.L)),k(h.L,D.getDerivedStateFromProps(v,h.L))),f=h.props,p=h.state,h.N=t,m)b&&null==D.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),b&&null!=h.componentDidMount&&h.W.push(h.componentDidMount);else{if(b&&null==D.getDerivedStateFromProps&&v!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(v,_),t.N==n.N||!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(v,h.L,_)){t.N!=n.N&&(h.props=v,h.state=h.L,h.P=!1),t.v=n.v,t.i=n.i,t.i.some(function(e){e&&(e.m=t)}),w.push.apply(h.W,h.A),h.A=[],h.W.length&&a.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(v,h.L,_),b&&null!=h.componentDidUpdate&&h.W.push(function(){h.componentDidUpdate(f,p,g)})}if(h.context=_,h.props=v,h.I=e,h.v=!1,I=r.O,T=0,b)h.state=h.L,h.P=!1,I&&I(t),d=h.render(h.props,h.state,h.context),w.push.apply(h.W,h.A),h.A=[];else do{h.P=!1,I&&I(t),d=h.render(h.props,h.state,h.context),h.state=h.L}while(h.P&&++T<25);h.state=h.L,null!=h.getChildContext&&(i=k(k({},i),h.getChildContext())),b&&!m&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(f,p)),E=null!=d&&d.type===$&&null==d.key?q(d.props.children):d,l=z(e,x(E)?E:[E],t,n,i,o,s,a,l,c,u),h.base=t.v,t.C&=-161,h.W.length&&a.push(h),y&&(h.j=h.m=null)}catch(e){if(t.N=null,c||null!=s)if(e.then){for(t.C|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;s[s.indexOf(l)]=null,t.v=l}else{for(P=s.length;P--;)N(s[P]);B(t)}else t.v=n.v,t.i=n.i,e.then||B(t);r.v(e,t,n)}else null==s&&t.N==n.N?(t.i=n.i,t.v=n.v):l=t.v=H(n.v,t,n,i,o,s,a,c,u);return(d=r.diffed)&&d(t),128&t.C?void 0:l}function B(e){e&&(e.k&&(e.k.v=!0),e.i&&e.i.some(B))}function F(e,t,n){for(var i=0;i<n.length;i++)U(n[i],n[++i],n[++i]);r.k&&r.k(t,e),e.some(function(t){try{e=t.W,t.W=[],e.some(function(e){e.call(t)})}catch(e){r.v(e,t.N)}})}function q(e){return"object"!=typeof e||null==e||e.p>0?e:x(e)?e.map(q):k({},e)}function H(e,t,i,o,s,a,l,c,u){var d,h,m,f,p,g,y,w=i.props||v,b=t.props,k=t.type;if("svg"==k?s="http://www.w3.org/2000/svg":"math"==k?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=a)for(d=0;d<a.length;d++)if((p=a[d])&&"setAttribute"in p==!!k&&(k?p.localName==k:3==p.nodeType)){e=p,a[d]=null;break}if(null==e){if(null==k)return document.createTextNode(b);e=document.createElementNS(s,k,b.is&&b),c&&(r.B&&r.B(t,a),c=!1),a=null}if(null==k)w===b||c&&e.data==b||(e.data=b);else{if(a=a&&n.call(e.childNodes),!c&&null!=a)for(w={},d=0;d<e.attributes.length;d++)w[(p=e.attributes[d]).name]=p.value;for(d in w)p=w[d],"dangerouslySetInnerHTML"==d?m=p:"children"==d||d in b||"value"==d&&"defaultValue"in b||"checked"==d&&"defaultChecked"in b||W(e,d,null,p,s);for(d in b)p=b[d],"children"==d?f=p:"dangerouslySetInnerHTML"==d?h=p:"value"==d?g=p:"checked"==d?y=p:c&&"function"!=typeof p||w[d]===p||W(e,d,p,w[d],s);if(h)c||m&&(h.H==m.H||h.H==e.innerHTML)||(e.innerHTML=h.H),t.i=[];else if(m&&(e.innerHTML=""),z("template"==t.type?e.content:e,x(f)?f:[f],t,i,o,"foreignObject"==k?"http://www.w3.org/1999/xhtml":s,a,l,a?a[0]:i.i&&I(i,0),c,u),null!=a)for(d=a.length;d--;)N(a[d]);c||(d="value","progress"==k&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[d]||"progress"==k&&!g||"option"==k&&g!=w[d])&&W(e,d,g,w[d],s),d="checked",null!=y&&y!=e[d]&&W(e,d,y,w[d],s))}return e}function U(e,t,n){try{if("function"==typeof e){var i="function"==typeof e.C;i&&e.C(),i&&null==t||(e.C=e(t))}else e.current=t}catch(e){r.v(e,n)}}function Y(e,t,n){var i,o;if(r.unmount&&r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||U(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){r.v(e,t)}i.base=i.I=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&Y(i[o],t,n||"function"!=typeof e.type);n||N(e.v),e.k=e.m=e.v=void 0}function Z(e,t,n){return this.constructor(e,n)}n=w.slice,r={v:function(e,t,n,r){for(var i,o,s;t=t.m;)if((i=t.k)&&!i.m)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.P),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.P),s)return i.j=i}catch(t){e=t}throw e}},i=0,C.prototype.setState=function(e,t){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=k({},this.state),"function"==typeof e&&(e=e(k({},n),this.props)),e&&k(n,e),null!=e&&this.N&&(t&&this.A.push(t),P(this))},C.prototype.forceUpdate=function(e){this.N&&(this.v=!0,e&&this.W.push(e),P(this))},C.prototype.render=$,o=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=function(e,t){return e.N.p-t.N.p},D.O=0,c=Math.random().toString(8),u="__d"+c,d="__a"+c,h=/(PointerCapture)$|Capture$/i,m=0,f=A(!1),p=A(!0),g=0,e.ErrorType=void 0,(y=e.ErrorType||(e.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",y.API_ERROR="API_ERROR",y.VALIDATION_ERROR="VALIDATION_ERROR",y.STORAGE_ERROR="STORAGE_ERROR",y.TIMEOUT_ERROR="TIMEOUT_ERROR",y.MAINTENANCE_ERROR="MAINTENANCE_ERROR";class G extends Error{constructor(e,t,n=!1,r,i,o){super(t),this.type=e,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.name="InsureOSError"}}class V{constructor(e){this.config=e}shouldRetry(e,t){return!(t>=this.config.maxRetries)&&this.isRetryableError(e)}getDelay(e,t){if(t){const e=parseInt(t,10);if(!isNaN(e))return 1e3*e}const n=this.config.baseDelay*Math.pow(2,e);return Math.min(n,this.config.maxDelay)}isRetryableError(e){return e instanceof G?e.retryable:!("TypeError"!==e.name||!e.message.includes("fetch"))||"AbortError"===e.name}}class Q{constructor(e){this.config=e,this.retryStrategy=new V(e.retryConfig)}getBaseUrl(){return this.config.apiBaseUrl||"https://api.os.insure"}async makeRequest({url:t,method:n,body:r,skipOrgHeader:i=!1}){return this.executeWithRetry(async()=>{const o=new AbortController,s=setTimeout(()=>o.abort(),this.config.timeout);try{const e={"Content-Type":"application/json"},a=t.includes("signed=");i||a||(e["X-Organisation-ID"]=this.config.orgId);const l={method:n,headers:e,signal:o.signal};r&&(l.body=JSON.stringify(r));const c=await fetch(t,l);if(clearTimeout(s),!c.ok)throw await this.handleApiError(c);const u=await c.json();return u.data||u}catch(t){if(clearTimeout(s),t instanceof G)throw t;if(t instanceof Error&&"AbortError"===t.name)throw new G(e.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(t instanceof TypeError&&t.message.includes("fetch"))throw new G(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw t}})}getQuoteIntent(e){return this.makeRequest({url:e,method:"GET"})}async fetchAvailableProducts(e){var n;const r=null==e?void 0:e.includes("*"),i=!e||0===e.length,o=`${this.config.apiBaseUrl}/products`,s=await this.makeRequest({url:o,method:"GET"}),a=s.products||[],l=null===(n=s.organisation)||void 0===n?void 0:n.client_settings;let c=a;if(r)t(),c=a;else if(e&&e.length>0)c=a.filter(t=>e.includes(t.code));else if(i&&(null==l?void 0:l.products)&&l.products.length>0){const e=l.products.map(e=>e.code);c=e.map(e=>a.find(t=>t.code===e)).filter(e=>void 0!==e),t((a.length,c.length))}else i&&(t(),c=a);return{products:c,organisation:s.organisation}}createQuoteIntent(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents`,method:"POST",body:e})}updateQuoteIntent(e,t){return this.makeRequest({url:e,method:"PUT",body:t})}deleteQuoteIntent(e){return this.makeRequest({url:e,method:"DELETE"})}calculateQuoteIntent(e){return this.makeRequest({url:e,method:"POST"})}calculateQuoteIntentV2(e){return this.makeRequest({url:e,method:"POST"})}repriceQuoteIntentV2(e,t){return this.makeRequest({url:e,method:"POST",body:t})}bindQuoteIntentV2(e,t){return this.makeRequest({url:e,method:"POST",body:t})}deleteCalculations(e){return this.makeRequest({url:e,method:"DELETE"})}initiatePayment(e,t){const n="string"==typeof t?t:t.code;return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/initiate`,method:"POST",body:{...e,gateway_code:n}})}getPaymentStatus(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/status/${e}`,method:"GET"})}createQuotePaymentLink(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/payment-link`,method:"POST",body:t})}continueLater(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/continue-later`,method:"POST",body:{email:t}})}getPaymentLinkDetails(e){return this.makeRequest({url:e,method:"GET",skipOrgHeader:!0})}getPaymentLinkById(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}`,method:"GET"})}initiateFixedPayment(e,t,n){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}/pay`,method:"POST",body:{gateway_code:t,client_name:n}})}validateCoverStartDate(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}/validate-cover-date`,method:"POST",body:{cover_start_date:t}})}validatePromoCode(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/validate-promo-code`,method:"POST",body:{code:t}})}async executeWithRetry(e){let n;for(let r=0;r<=this.config.retryConfig.maxRetries;r++)try{return t(this.config.retryConfig.maxRetries),await e()}catch(e){n=e;const i=this.retryStrategy.shouldRetry(n,r);if(t(e instanceof G&&(e.type,e.message)),t(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw t(),n;const o=e instanceof G?e.retryAfter:void 0,s=this.retryStrategy.getDelay(r,o);t(),await new Promise(e=>setTimeout(e,s))}throw n}async handleApiError(n){var r;const i=n.headers.get("retry-after"),o=await n.json().catch(()=>({}));if(t(),this.captureApiErrorToSentry(n,o),503===n.status)return new G(e.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,n.status);if(429===n.status)return new G(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,n.status,i||void 0);if(n.status>=500){const t=o.message||"Service temporarily unavailable. Please try again in a moment.";return new G(e.ErrorType.API_ERROR,t,!1,n.status)}if(422===n.status)try{const t=o;return t.error&&t.error.details&&t.error.details.form_data?new G(e.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.error.details):new G(e.ErrorType.VALIDATION_ERROR,t.message||"Validation failed. Please check your inputs.",!1,n.status,void 0,null===(r=t.error)||void 0===r?void 0:r.details)}catch(t){return new G(e.ErrorType.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,n.status)}if(400===n.status)try{const t=o;return t.errors?new G(e.ErrorType.VALIDATION_ERROR,t.message||"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.errors):new G(e.ErrorType.API_ERROR,t.message||"Invalid request. Please check your input and try again.",!1,n.status)}catch(t){return new G(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,n.status)}if(n.status>=400&&n.status<500){const t=o.message||"Invalid request. Please refresh the page and try again.";return new G(e.ErrorType.API_ERROR,t,!1,n.status)}return new G(e.ErrorType.API_ERROR,`Request failed: ${n.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(n.status),n.status)}captureApiErrorToSentry(e,t){try{(e.status>=500||429===e.status)&&Promise.resolve().then(function(){return ph}).then(({captureMessage:n,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:`API Error: ${e.status} ${e.statusText}`,category:"http",level:"error",data:{url:e.url,status:e.status,statusText:e.statusText}}),n(`API Error: ${e.status} - ${e.url}`,"error",{http:{status_code:e.status,url:e.url,method:"Unknown"},response:t}))}).catch(()=>{})}catch(e){}}}class J{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return localStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{localStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{localStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{localStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.localStorage)return!1;const e="__insure_os_storage_test__";return localStorage.setItem(e,"test"),localStorage.removeItem(e),!0}catch(e){return!1}}}class K{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return sessionStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{sessionStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{sessionStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{sessionStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const e="__insure_os_storage_test__";return sessionStorage.setItem(e,"test"),sessionStorage.removeItem(e),!0}catch(e){return!1}}}class X{static generateKey(e,t,n){const r=[this.KEY_PREFIX+e,t];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(e){try{return JSON.stringify({data:e,timestamp:Date.now(),version:"1.0"})}catch(e){throw new Error(`Failed to serialize data: ${e}`)}}static deserialize(e){try{const t=JSON.parse(e);return t&&"object"==typeof t&&t.data?t.data:null}catch(e){return null}}static getTimestamp(e){try{return JSON.parse(e).timestamp||null}catch(e){return null}}static isExpired(e,t){const n=this.getTimestamp(e);return!n||Date.now()-n>t}}X.KEY_PREFIX="insure_os_",X.SEPARATOR="_";class ee{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||ee.DEFAULT_EXPIRATION_MS,namespace:t.namespace||ee.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{t.payment_transactions&&t.payment_transactions.length;const n=this.generateStorageKey(e),r=X.serialize(t);this.storageAdapter.set(n,r)}catch(e){}}getQuoteIntent(e){if(!this.storageAdapter.isAvailable())return null;try{const t=this.generateStorageKey(e),n=this.storageAdapter.get(t);if(!n)return null;const r=X.deserialize(n);return(null==r?void 0:r.payment_transactions)&&r.payment_transactions.length,r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(e),null)}catch(e){return null}}removeQuoteIntent(e){if(this.storageAdapter.isAvailable())try{const t=this.generateStorageKey(e);this.storageAdapter.remove(t)}catch(e){}}isQuoteIntentValid(e){if(!e||"object"!=typeof e)return!1;if(!e.id||!e.url||!e.org_id)return!1;const t=Date.now();return!(e.expires_at&&t>e.expires_at||e.created_at&&t-e.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(e){return X.generateKey(this.config.namespace,e)}}ee.DEFAULT_EXPIRATION_MS=864e5,ee.DEFAULT_NAMESPACE="quote_intent";class te{constructor(e){this.stateManager=e}async getOrCreateQuoteIntent(e,t,n){const r=this.stateManager.getQuoteIntent(e);if(r&&this.stateManager.isQuoteIntentValid(r)){const t=await n(r.url);return this.stateManager.saveQuoteIntent(e,t),t}try{const n=await t();return this.stateManager.saveQuoteIntent(e,n),n}catch(t){throw r&&this.stateManager.removeQuoteIntent(e),t}}updateQuoteIntent(e,t){const n=this.stateManager.getQuoteIntent(e);if(!n)return null;const r={...n,...t};return this.stateManager.saveQuoteIntent(e,r),r}clearQuoteIntent(e){this.stateManager.removeQuoteIntent(e)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(e){const t=this.stateManager.getQuoteIntent(e);return null!==t&&this.stateManager.isQuoteIntentValid(t)}getQuoteIntentUrl(e){const t=this.stateManager.getQuoteIntent(e);return(null==t?void 0:t.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class ne{constructor(e,t){this.saveCallback=t,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=e}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.config.autoSave&&(this.intervalId=window.setInterval(()=>{this.isPaused||this.isUserTyping||!this.shouldAttemptSave()||this.saveCallback().catch(this.handleSaveError.bind(this))},this.config.autoSaveInterval))}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}pause(){this.isPaused=!0,setTimeout(()=>this.resume(),6e4)}resume(){this.isPaused=!1,this.consecutiveFailures=0}shouldAttemptSave(){return!!this.config.autoSave&&(0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1))}handleSaveError(e){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(e))}dispatchErrorEvent(e){if("undefined"!=typeof window){const t=new CustomEvent("form-autosave-error",{detail:{error:e,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(t)}}onSaveSuccess(){this.consecutiveFailures=0,this.lastErrorTime=0,this.isPaused&&this.resume()}startTyping(){this.isUserTyping=!0,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=window.setTimeout(()=>{this.stopTyping()},500)}stopTyping(){this.isUserTyping=!1,this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}get status(){return{isPaused:this.isPaused,consecutiveFailures:this.consecutiveFailures,isActive:!!this.intervalId,isUserTyping:this.isUserTyping}}}function re(e,t){const n=t.operator,r=t.value,i=null==r?"":String(r),o=null==e?"":String(e);switch(n){case"=":return o===i;case"!=":return o!==i;case"contains":return o.includes(i);case"not_contains":return!o.includes(i);case"starts_with":return o.startsWith(i);case"ends_with":return o.endsWith(i);case"is_empty":return void 0===e||null==e||""===e||""===e.trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function ie(e,t){const n=t.operator,r=null==t.value?0:Number(t.value),i=null==e?0:Number(e.toString().replace(/,/g,"").trim());switch(n){case">":return i>r;case">=":return i>=r;case"<":return i<r;case"<=":return i<=r;case"=":return i===r;case"!=":return i!==r;case"is_empty":return void 0===e||null==e||""===e||""===e.toString().trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function oe(e){if(!0===e||1===e)return!0;if("string"==typeof e){const t=e.toLowerCase();return"true"===t||"yes"===t}return!1}function se(e,t){const n=t.operator;switch(t.operator){case"true":case"=":return oe(e);case"false":return function(e){if(!1===e||0===e||void 0===e)return!0;if("string"==typeof e){const t=e.toLowerCase();return"false"===t||"no"===t}return!1}(e);case"!=":return!oe(e);default:throw new Error(`Unsupported boolean operator: ${n}`)}}function ae(e,t){const n=t.operator,r=t.value,i=null==r?0:Number(t.value);if(null==e||""===e.toString().trim())return"is_empty"===n;const o=e.toString().trim(),s=/^\d{4}$/.test(o)&&Number(o)>=1900&&Number(o)<=2100?new Date(Number(o),0,1).getTime():Date.parse(o),a=Math.floor((Date.now()-s)/315576e5),l=Math.floor((Date.now()-s)/864e5),c=new Date(s),u=new Date,d=12*(u.getFullYear()-c.getFullYear())+(u.getMonth()-c.getMonth());switch(n){case">":return s>Date.parse(r);case">=":return s>=Date.parse(r);case"<":return s<Date.parse(r);case"<=":return s<=Date.parse(r);case"age_less_than":return a<i;case"age_less_than_or_equal":return a<=i;case"age_greater_than":return a>i;case"age_greater_than_or_equal":return a>=i;case"age_days_less_than":return l<i;case"age_days_less_than_or_equal":return l<=i;case"age_days_greater_than":return l>i;case"age_days_greater_than_or_equal":return l>=i;case"age_months_less_than":return d<i;case"age_months_less_than_or_equal":return d<=i;case"age_months_greater_than":return d>i;case"age_months_greater_than_or_equal":return d>=i;default:throw new Error(`Unsupported date operator: ${n}`)}}class le{static create(e){switch(e){case"string":case"text":case"select":return re;case"numeric":return ie;case"boolean":return se;case"date":return ae;default:throw new Error(`Unsupported condition type: ${e}`)}}}function ce(e,t){const n=t.condition_type||"and";if(!t.conditions||0===t.conditions.length)return{matched:!0,conditions:[]};const r={matched:!1,conditions:t.conditions.map(t=>{const n={...t,matched:ue(e,t),string:`${t.field} ${t.operator}`};return t.value&&(n.string+=` ${t.value}`),n})};return"none"===n&&(r.matched=!0),"and"===n&&(r.matched=r.conditions.every(e=>e.matched)),"or"===n&&(r.matched=r.conditions.some(e=>e.matched)),"not"===n&&(r.matched=r.conditions.every(e=>!e.matched)),r}function ue(e,t){if("expression"===t.type)throw new Error("Expression conditions should not be evaluated through matchesCondition");if(!t.field)throw new Error("Field is required for non-expression conditions");const n=e[t.field],r=le.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var de=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:le,booleanMatchesCondition:se,checkSimpleConditions:ce,dateMatchesCondition:ae,numericMatchesCondition:ie,textMatchesCondition:re});function he(e,t){var n;const r=[];if("checkbox"===e.type&&e.required&&!0!==t&&"true"!==t)return r.push({field:e.code||e.id,message:`${e.label} must be accepted`}),r;"boolean"===e.type&&(null===(n=e.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===e.boolean_config.show_details_on&&(!0===t||"true"===t)||e.boolean_config.show_details_on),"email"===e.type&&"string"==typeof t&&(t=t.trim());const i="boolean"===e.type?null==t:null==t||""===t;if(e.required&&i&&!0!==e.add_null_option)return r.push({field:e.code||e.id,message:`${e.label} is required`}),r;if(!e.required&&i)return r;const o=e.validation;if(!o)return r;const s=String(t),a="number"==typeof t?t:parseFloat(s);if(o.pattern&&("text"===e.type||"email"===e.type)){const t=new RegExp(o.pattern),n=s.trim();t.test(n)||r.push({field:e.code||e.id,message:`${e.label} format is invalid`})}if(o.minLength&&s.length<o.minLength&&r.push({field:e.code||e.id,message:`${e.label} must be at least ${o.minLength} characters`}),o.maxLength&&s.length>o.maxLength&&r.push({field:e.code||e.id,message:`${e.label} must be no more than ${o.maxLength} characters`}),"number"!==e.type||isNaN(a)||(void 0!==o.min&&a<o.min&&r.push({field:e.code||e.id,message:`${e.label} must be at least ${o.min}`}),void 0!==o.max&&a>o.max&&r.push({field:e.code||e.id,message:`${e.label} must be no more than ${o.max}`}),void 0!==o.step&&a%o.step!==0&&r.push({field:e.code||e.id,message:`${e.label} must be in increments of ${o.step}`})),("date"===e.type||"year"===e.type||"monthyear"===e.type)&&!1===o.canBeFuture){const t=new Date,n=t.getFullYear();let i=!1;if("year"===e.type){const e=parseInt(s,10);!isNaN(e)&&e>n&&(i=!0)}else if("date"===e.type){const e=new Date(s);if(!isNaN(e.getTime())){const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());new Date(e.getFullYear(),e.getMonth(),e.getDate())>n&&(i=!0)}}else if("monthyear"===e.type){const e=s.split("-");if(2===e.length){const n=parseInt(e[0],10),r=parseInt(e[1],10)-1;isNaN(n)||isNaN(r)||new Date(n,r,1)>new Date(t.getFullYear(),t.getMonth(),1)&&(i=!0)}}i&&r.push({field:e.code||e.id,message:`${e.label} cannot be in the future`})}return r}function me(e,t){var n,r;const i=[];for(const r of e.fields){const e=r.code||r.id;let o=!0;if(r.visibility){const e=ce(t,{condition_type:r.visibility.condition_type,conditions:r.visibility.conditions});o="show"===r.visibility.action?e.matched:!e.matched}if(!o)continue;const s=t[e],a=he(r,s);if(i.push(...a),"boolean"===r.type&&(null===(n=r.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===r.boolean_config.show_details_on&&(!0===s||"true"===s)||"no"===r.boolean_config.show_details_on&&(!1===s||"false"===s))){const n=(t.U||{})[e];n&&""!==n.trim()||i.push({field:e,message:r.boolean_config.details_label||"Please provide details"})}}if(null===(r=e.validation)||void 0===r?void 0:r.required_fields)for(const n of e.validation.required_fields){const r=e.fields.find(e=>(e.code||e.id)===n),o=t[n];if(r){const e=r.code||r.id,n=i.find(t=>t.field===e);if(n)continue;let s=!0;if(r.visibility){const e=ce(t,{condition_type:r.visibility.condition_type,conditions:r.visibility.conditions});s="show"===r.visibility.action?e.matched:!e.matched}if(!s)continue;if("checkbox"===r.type){!0!==o&&"true"!==o&&i.push({field:e,message:`${r.label} must be accepted`});continue}("boolean"===r.type?null==o:null==o||""===o)&&(!0===r.add_null_option||i.push({field:e,message:`${r.label} is required`}))}}return{isValid:0===i.length,errors:i}}function fe(e){const t=[];let n;if("object"==typeof e&&null!==e&&("validation_errors"in e&&e.validation_errors&&"object"==typeof e.validation_errors?n=e.validation_errors:"errors"in e&&e.errors&&"object"==typeof e.errors?n=e.errors:"message"in e||"validation_errors"in e||"errors"in e||(n=e)),n)for(const[e,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)t.push({field:e,message:n});return t}class pe{constructor(e,t,n){this.httpClient=e,this.definition=t,this.quoteIntentStore=n}async load(e,t){if(this.quoteIntentStore&&this.quoteIntentStore.getQuoteIntentUrl(e)){const e=await this.httpClient.getQuoteIntent(t);if(e.quote_intent.form_data)return e.quote_intent.form_data}return(await this.httpClient.getQuoteIntent(t)).quote_intent.form_data||this.createEmptyFormData()}async save(e,t,n,r){try{const e=this.prepareSavePayload(n,r);return await this.httpClient.updateQuoteIntent(t,e),{success:!0}}catch(e){if(e&&"object"==typeof e&&"validationErrors"in e){const t=e.validationErrors;if(t&&"object"==typeof t)return{success:!1,validationErrors:fe(t)}}throw e}}prepareSavePayload(e,t){const n=this.getCurrentPageId(e);return{current_page_index:e.current_page,current_page_id:n,page_data:e.page_data,save_type:t.saveType}}getCurrentPageId(e){const t=this.definition;if(!t||!e.page_data)return;const n=e.current_page;if(n<0||n>=t.pages.length)return;const r=t.pages[n];return r&&r.id?r.id:void 0}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}}class ge{constructor(e,t,n,r){this.formDefinition=e,this.getFormData=t,this.updateFormData=n,this.saveCallback=r}canNavigateToPage(e){const t=this.getFormData().current_page;if(e<=t)return!0;if(this.hasActiveBlocker(t))return!1;if(this.isStagingEnvironment())return!0;const n=this.getFormData().completed_pages;for(let r=0;r<e;r++)if(r!==t&&!n.includes(r))return!1;return!0}async navigateToPage(e){if(e<0||e>=this.getTotalPages())return!1;if(!this.canNavigateToPage(e))return!1;const t=this.getFormData().current_page;if(e>t)try{await this.saveCallback(!0,"page")}catch(e){return e&&"object"==typeof e&&e.isValidationError,!1}return e>t&&this.markPageCompleted(t),this.updateFormData({current_page:e,last_updated:(new Date).toISOString()}),!0}navigateToNext(){const e=this.getFormData().current_page;return this.navigateToPage(e+1)}navigateToPrevious(){const e=this.getFormData().current_page;return this.navigateToPage(e-1)}markPageCompleted(e){const t=this.getFormData();if(!t.completed_pages.includes(e)){const n=[...t.completed_pages,e].sort((e,t)=>e-t);this.updateFormData({completed_pages:n})}}getTotalPages(){return this.formDefinition.pages.length}getCompletionStatus(){const e=this.getFormData(),t=this.getTotalPages(),n=[...e.completed_pages];return{totalPages:t,currentPage:e.current_page,completedPages:n,percentComplete:n.length/t*100}}hasActiveBlocker(e){var t;const n=this.formDefinition.pages[e];if(!n)return!1;const r=(null===(t=this.getFormData().page_data)||void 0===t?void 0:t[n.id])||{};for(const e of n.fields)if(e.blocker)if(e.blocker.conditions&&e.blocker.conditions.length>0){if(ce(r,{condition_type:e.blocker.condition_type||"or",conditions:e.blocker.conditions}).matched)return!0}else if(void 0!==e.blocker.trigger_value){const t=r[e.code||e.id];if(void 0!==t&&String(t)===String(e.blocker.trigger_value))return!0}return!1}isStagingEnvironment(){const e=window.location.hostname;return"localhost"===e||e.endsWith(".test")||e.includes("staging")}}class ye{constructor(e){this.httpClient=e}async calculateQuote(e){const n=await this.httpClient.calculateQuoteIntent(e);return t(),n}}class ve{constructor(e){this.httpClient=e}async calculate(e){const n=await this.httpClient.calculateQuoteIntentV2(e);return t(),n}async reprice(e,n){const r={selection:n},i=await this.httpClient.repriceQuoteIntentV2(e,r);return t(),i}async bind(e,n){const r=await this.httpClient.bindQuoteIntentV2(e,n);return t(),r}}function we(e,t,n){var r,i,o,s;const a=Date.now(),l=`${e}-${a}`;if(function(e,t,n){try{Promise.resolve().then(function(){return ph}).then(({captureException:r,addBreadcrumb:i,isSentryInitialized:o})=>{o()&&(i({message:`Error occurred: ${t}`,category:"error",level:"error",data:{errorType:t,customMessage:n}}),r(e,{errorType:t,customMessage:n}))}).catch(()=>{})}catch(e){}}(t,e,n),t&&"object"==typeof t){if("statusCode"in t||"status"in t)return be(l,e,t.statusCode||t.status||500,t.message||(null===(r=t.data)||void 0===r?void 0:r.message)||"Server error occurred",n,a);if("response"in t)return be(l,e,(null===(i=t.response)||void 0===i?void 0:i.status)||500,(null===(s=null===(o=t.response)||void 0===o?void 0:o.data)||void 0===s?void 0:s.message)||t.message||"Network error occurred",n,a);if(t.message)return{id:l,type:e,severity:ke(e),title:xe(e),message:n||Se(e),details:t.message,retryable:_e(e,0),timestamp:a,trackingId:l}}const c="string"==typeof t?t:"An unexpected error occurred";return{id:l,type:e,severity:ke(e),title:xe(e),message:n||c,retryable:_e(e,0),timestamp:a,trackingId:l}}function be(e,t,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=_e(t,n);return{id:e,type:t,severity:s,statusCode:n,title:xe(t,n),message:i||Ne(t,n,r),details:r,retryable:a,timestamp:o}}function xe(e,t){if(t){if(404===t)return"Not Found";if(503===t)return"Under Maintenance";if(t>=500)return"Something Went Wrong";if(t>=400)return"Invalid Request"}switch(e){case"initialization":default:return"Something Went Wrong";case"calculation":return"Calculation Error";case"network":return"Connection Problem";case"validation":return"Please Check Your Details";case"maintenance":return"Under Maintenance"}}function ke(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function Ne(e,t,n){return"calculation"===e&&(n.toLowerCase().includes("no matching values found")||n.toLowerCase().includes("rating table")||n.toLowerCase().includes("not supported"))?n:n.toLowerCase().includes("no matching values found")?"The entered value is not supported by our calculator. Please try a different amount.":n.toLowerCase().includes("rating table")?"Unable to calculate with the provided information. Please check your entries and try again.":404===t?"initialization"===e?"The requested form could not be found. Please check the URL or contact support.":"The requested resource was not found.":503===t?"We're performing scheduled maintenance. Please check back in a few minutes.":t>=500?"calculation"===e?"We're experiencing technical difficulties with the calculation. Please try again in a moment.":"We're experiencing technical difficulties. Please try again in a moment.":429===t?"Too many requests. Please wait a moment and try again.":t>=400?"There was an issue with your request. Please adjust your details and re-submit.":"An unexpected error occurred. Please try again."}function Se(e){switch(e){case"initialization":return"We're unable to load the application at this time. Please try again.";case"calculation":return"We couldn't complete the calculation. Please check your details and try again.";case"network":return"We're having trouble connecting. Please check your internet connection and try again.";case"validation":return"Please check your details and try again.";case"maintenance":return"We're performing scheduled maintenance. Please check back in a few minutes.";default:return"An unexpected error occurred. Please try again."}}function _e(e,t){return"validation"!==e&&"maintenance"!==e&&404!==t&&503!==t&&!(t>=400&&t<500&&429!==t)&&("network"===e||"calculation"===e||t>=500&&503!==t||429===t)}function $e(e){return"maintenance"===e.type||503===e.statusCode}function Ce(e){return e.trackingId?`If this problem persists, please contact support and reference error ID: ${e.trackingId.slice(0,8).toUpperCase()}`:"critical"===e.severity?"If this problem persists, please contact support with the error details.":"If you continue to experience issues, please contact support."}let Ie=null;function Te(e){Ie=e}function Ee(e,t){var n,r;return{event:t,quote_id:e.id,organisation_slug:null===(n=e.organisation)||void 0===n?void 0:n.slug,organisation_name:null===(r=e.organisation)||void 0===r?void 0:r.name,timestamp:(new Date).toISOString()}}function Pe(e){var t,n;if(!(null==Ie?void 0:Ie.isEnabled()))return;const r={...Ee(e,"quote_started"),quote_status:e.status,total_pages:null===(n=null===(t=e.form_definition)||void 0===t?void 0:t.pages)||void 0===n?void 0:n.length};Ie.push(r)}function De(e,t,n,r){var i,o;if(!(null==Ie?void 0:Ie.isEnabled()))return;const s=(null===(o=null===(i=e.form_definition)||void 0===i?void 0:i.pages)||void 0===o?void 0:o.length)||0,a=s>0?Math.round(n.length/s*100):0,l={...Ee(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};Ie.push(l)}function ze(e,t){if(!(null==Ie?void 0:Ie.isEnabled()))return;const n=t.calculations||[],r=t.payment_options||[],i=n.find(e=>e.id===t.default_excess_id),o=n.map(e=>e.premium_total),s=o.length>0?Math.min(...o):void 0,a=o.length>0?Math.max(...o):void 0,l=r.some(e=>"monthly"===e.amount.frequency),c={...Ee(e,"quote_calculated"),excess_id:null==i?void 0:i.id,excess_amount:null==i?void 0:i.excess_amount,premium_subtotal:null==i?void 0:i.premium_subtotal,premium_total:null==i?void 0:i.premium_total,excess_options_count:n.length,payment_options_count:r.length,has_installments:l,min_premium:s,max_premium:a};Ie.push(c)}function Re(e,t,n,r,i){if(!(null==Ie?void 0:Ie.isEnabled()))return;const o={...Ee(e,"quote_at_checkout"),excess_id:t.id,excess_amount:t.excess_amount,premium_subtotal:t.premium_subtotal,premium_total:t.premium_total,payment_options_count:n,has_installments:r,form_completion:i,fees:t.fees};Ie.push(o)}function Me(e,t){if(!(null==Ie?void 0:Ie.isEnabled()))return;const n=t.referrals||[],r={...Ee(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};Ie.push(r)}function Oe(e,t,n,r){if(!(null==Ie?void 0:Ie.isEnabled()))return;const i={...Ee(e,"payment_initiated"),payment_amount:t.amount.dueToday,payment_gateway:t.gateway_id,payment_gateway_name:n,excess_amount:r||0,payment_frequency:t.amount.frequency,amount_due_today:t.amount.dueToday,installments_count:t.amount.numberOfInstallments};Ie.push(i)}function je(e,t,n,r,i,o){if(!(null==Ie?void 0:Ie.isEnabled()))return;const s={...Ee(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};Ie.push(s)}function We(e,t,n,r,i,o){if(!(null==Ie?void 0:Ie.isEnabled()))return;const s={...Ee(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};Ie.push(s)}class Ae{constructor(e,t,n,r={}){this.quoteIntent=e,this.httpClient=t,this.subscribers=new Set,this.pendingChanges={},this.isCalculating=!1,this.isRepricing=!1,this.isSaving=!1,this.selectedExcessId=null,this.selectedPaymentOption=null,this.selectionV2=null,this.validationErrors=[],this.serverValidationErrors=[],this.generalErrors=[],this.lastCalculationFailed=!1,this.config={autoSaveInterval:r.autoSaveInterval||1e3,autoSave:!1!==r.autoSave,maxRetryAttempts:r.maxRetryAttempts||3,retryDelay:r.retryDelay||2e3},this.formData=this.createEmptyFormData(),this.quoteIntentStore=n,this.lastCalculationFailed=this.getPersistedCalculationFailureState();const i=e.form_definition;this.persistenceManager=new pe(t,i,n),this.autoSaveManager=new ne(this.config,this.saveFormData.bind(this)),this.navigationManager=new ge(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new ye(t),this.calculationManagerV2=new ve(t),this.config.autoSave&&this.autoSaveManager.start()}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}async loadFormProgress(){var e,t;return this.formData=await this.persistenceManager.load(this.quoteIntent.id,this.quoteIntent.url),this.lastCalculationFailed=!0===(null===(t=null===(e=this.formData.page_data)||void 0===e?void 0:e.Y)||void 0===t?void 0:t.lastCalculationFailed),this.config.autoSave=!1,this.autoSaveManager.stop(),this.notify(),this.formData}updatePageData(e,t){this.pendingChanges[e]={...this.pendingChanges[e],...t},this.formData.page_data={...this.formData.page_data,[e]:{...this.formData.page_data[e],...t}},this.formData.last_updated=(new Date).toISOString(),this.notify()}updateFieldValue(e,t,n){if(this.autoSaveManager.startTyping(),"string"==typeof n){const r=this.getFormDefinition().pages.find(t=>t.id===e),i=null==r?void 0:r.fields.find(e=>(e.code||e.id)===t);i&&"email"===i.type&&(n=n.trim())}this.pendingChanges[e]||(this.pendingChanges[e]={}),this.pendingChanges[e][t]=n,this.formData.page_data[e]||(this.formData.page_data[e]={}),this.formData.page_data[e][t]=n,this.formData.last_updated=(new Date).toISOString(),this.validateField(e,t,n),this.notify()}updateFieldAnswer(e,n,r,i){if(this.autoSaveManager.startTyping(),this.formData.page_data[e]||(this.formData.page_data[e]={}),this.formData.page_data[e].U||(this.formData.page_data[e].U={}),this.formData.page_data[e].U[n]=r,i){const n=this.getRatingFactorCodeById(i);n&&(this.formData.page_data[e][n]=r,t())}this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(e){var n;if(this.isUserTyping())return;const r=e.completed_pages||[],i=(null===(n=this.quoteIntent.form_definition)||void 0===n?void 0:n.pages.length)||0;let o=0;for(let e=0;e<i;e++)if(!r.includes(e)){o=e;break}r.length===i&&i>0&&(o=i-1),t(e.current_page),this.formData={...e,current_page:o},this.notify()}restoreCalculationResult(e){t(),t(e.outcome_type),this.calculationResult=e,e.default_excess_id&&(this.selectedExcessId=e.default_excess_id),t(),this.notify(),t()}getRatingFactorCodeById(e){const n=this.getFormDefinition();for(const t of n.pages)for(const n of t.fields){if(n.rating_factor_id===e)return n.code||n.id;if(n.rating_factor_mappings)for(const t of n.rating_factor_mappings)if(t.rating_factor_id===e)return t.rating_factor_code||n.code||n.id}return t(),null}processRatingFactorMappings(e){const t=this.getFormDefinition(),n={};return t.pages.forEach(t=>{const r=e.page_data[t.id]||{};t.fields.forEach(e=>{const t=r[e.code||e.id];null!=t&&""!==t&&e.rating_factor_mappings&&e.rating_factor_mappings.length>0&&e.rating_factor_mappings.forEach(r=>{if("derived"===r.type&&r.derivation_rule){const i=this.applyDerivationRule(t,r.derivation_rule,r.metadata),o=r.rating_factor_code||`${e.code||e.id}_${r.derivation_rule}`;n[o]=i}})})}),n}applyDerivationRule(e,n,r){switch(t(JSON.stringify(r)),n){case"calculate_age":return this.calculateAge(e,r);case"invert_yes_no":return this.invertYesNo(e);default:return null}}invertYesNo(e){return"Yes"===e?"No":"Yes"}calculateAge(e,t){try{const n=new Date(e),r="current_date"===(null==t?void 0:t.reference_date)?new Date:new Date((null==t?void 0:t.reference_date)||Date.now());let i=r.getFullYear()-n.getFullYear();const o=r.getMonth()-n.getMonth();return(o<0||0===o&&r.getDate()<n.getDate())&&i--,i}catch(e){return null}}async saveFormData(e=!1,n="auto-save"){if(!e&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);t();const o={...this.formData,page_data:{...this.formData.page_data,V:i}};try{const t=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:e,saveType:n});if(!t.success){if(t.validationErrors){this.setServerValidationErrors(t.validationErrors),this.notify();const e=new Error("Validation failed");throw e.isValidationError=!0,e}throw new Error("Failed to save form data")}{this.pendingChanges={},this.autoSaveManager.onSaveSuccess(),this.clearServerValidationErrors(),this.clearGeneralErrors();const e=this.formData;r.current_page===e.current_page?this.formData=o:this.formData={...o,current_page:e.current_page,completed_pages:e.completed_pages,last_updated:e.last_updated},this.notify()}}catch(e){if(e&&"object"==typeof e&&"type"in e&&"message"in e){const t=e;if(!t.validationErrors||0===Object.keys(t.validationErrors).length){const e=we("validation",t);this.addGeneralError(e),this.notify()}}throw e}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(e){return this.navigationManager.canNavigateToPage(e)}navigateToPage(e){return this.navigationManager.navigateToPage(e)}async navigateToNextPage(){var e,t;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(t=null===(e=this.quoteIntent.form_definition)||void 0===e?void 0:e.pages[n-1])||void 0===t?void 0:t.title;De(this.quoteIntent,n,r,i)}return n}navigateToPreviousPage(){return this.navigationManager.navigateToPrevious()}getPageCompletionStatus(){return this.navigationManager.getCompletionStatus()}getFormProgress(){return this.formData}getFormDefinition(){return this.quoteIntent.form_definition}getTotalPages(){return this.navigationManager.getTotalPages()}getCurrentPageIndex(){return this.formData.current_page}isAutoSavePaused(){return this.autoSaveManager.status.isPaused}isUserTyping(){return this.autoSaveManager.status.isUserTyping}getIsCalculating(){return this.isCalculating}getIsRepricing(){return this.isRepricing}getIsSaving(){return this.isSaving}hasCalculationResponse(){return Boolean(this.calculationResult)}getCalculationResult(){return this.calculationResult}getConsecutiveFailures(){return this.autoSaveManager.status.consecutiveFailures}getSelectedExcessId(){return this.selectedExcessId}setSelectedExcessId(e){this.selectedExcessId=e,this.selectedPaymentOption=null,this.notify()}getSelectedPaymentOption(){return this.selectedPaymentOption}setSelectedPaymentOption(e){this.selectedPaymentOption=e,this.notify()}hasPendingChanges(){return Object.keys(this.pendingChanges).length>0}validateCurrentPage(){const e=this.getCurrentPageIndex(),t=this.getFormDefinition().pages[e];if(!t)return[];const n=me(t,this.getAllFormDataFlattened());return this.validationErrors=n.errors,this.notify(),n.errors}validateField(e,t,n){const r=this.getFormDefinition().pages.find(t=>t.id===e),i=null==r?void 0:r.fields.find(e=>(e.code||e.id)===t);if(!i)return[];const o=he(i,n);return this.validationErrors=this.validationErrors.filter(e=>e.field!==t),this.validationErrors.push(...o),this.notify(),o}getValidationErrors(){return[...this.validationErrors,...this.serverValidationErrors]}getFieldErrors(e){return this.getValidationErrors().filter(t=>t.field===e)}hasErrors(){return this.validationErrors.length>0||this.serverValidationErrors.length>0}hasFieldErrors(e){return this.getFieldErrors(e).length>0}clearValidationErrors(){this.validationErrors=[],this.notify()}setServerValidationErrors(e){this.serverValidationErrors=e,this.notify()}clearServerValidationErrors(){this.serverValidationErrors=[],this.notify()}getGeneralErrors(){const e=this.generalErrors.filter(e=>!e.dismissed);return e.length>0?[e[e.length-1]]:[]}addGeneralError(e){this.generalErrors.push(e),this.notify()}dismissGeneralError(e){const t=this.generalErrors.find(t=>t.id===e);t&&(t.dismissed=!0,this.notify())}clearGeneralErrors(){this.generalErrors=[],this.notify()}hasGeneralErrors(){return this.getGeneralErrors().length>0}hasLastCalculationFailed(){return this.lastCalculationFailed}dispose(){this.autoSaveManager.stop(),Object.keys(this.pendingChanges).length>0&&!this.isAutoSavePaused()&&this.saveFormData(!0).catch(console.error),this.subscribers.clear()}async filterHiddenFieldsAndSave(){const e=this.getFormDefinition(),t={...this.formData},{checkSimpleConditions:n}=await Promise.resolve().then(function(){return de}),r=this.getAllFormDataFlattened();e.pages.forEach(e=>{const i=this.formData.page_data[e.id]||{},o={};Object.keys(i).forEach(e=>{e.startsWith("__")&&e.endsWith("__")&&(o[e]=i[e])}),e.fields.forEach(e=>{const t=e.code||e.id,s=i[t];let a=!0;if(e.visibility){const t=n(r,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions});a="show"===e.visibility.action?t.matched:!t.matched}a&&void 0!==s&&(o[t]=s)}),t.page_data[e.id]=o});const i=this.processRatingFactorMappings(t),o={...t,page_data:{...t.page_data,V:i}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:!0,saveType:"full"})}async calculateQuote(){t();const e=this.getFormDefinition(),n=[],r=this.getAllFormDataFlattened();for(const i of e.pages){const e=me(i,r);t(i.title,e.errors.length>0&&e.errors),n.push(...e.errors)}if(n.length>0)throw t(),this.validationErrors=n,this.notify(),new Error("Form validation failed");t(),await this.filterHiddenFieldsAndSave();try{if(this.isCalculating=!0,this.notify(),2===this.quoteIntent.calculator_version&&this.quoteIntent.calculate_url_v2){const e=await this.calculationManagerV2.calculate(this.quoteIntent.calculate_url_v2);if("referral"===e.outcome_type){this.calculationResultV2=void 0,this.selectionV2=null,this.selectedExcessId=null;const t=this.buildV1CompatResponseFromV2(e);return this.calculationResult=t,this.lastCalculationFailed=!1,this.persistCalculationFailureState(),Me(this.quoteIntent,t),t}this.calculationResultV2=e,this.selectionV2=e.selection;const t=this.buildV1CompatResponseFromV2(e);this.calculationResult=t,this.selectedExcessId=e.selection.excess_id,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const n=this.generalErrors.filter(e=>"calculation"===e.type);return n.forEach(e=>this.dismissGeneralError(e.id)),"calculation"===t.outcome_type?ze(this.quoteIntent,t):"referral"===t.outcome_type&&Me(this.quoteIntent,t),t}const e=await this.calculationManager.calculateQuote(this.quoteIntent.calculate_url);this.calculationResult=e,this.selectedExcessId=e.default_excess_id||null,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const t=this.generalErrors.filter(e=>"calculation"===e.type);return t.forEach(e=>this.dismissGeneralError(e.id)),"calculation"===e.outcome_type?ze(this.quoteIntent,e):"referral"===e.outcome_type&&Me(this.quoteIntent,e),e}catch(e){this.lastCalculationFailed=!0,this.persistCalculationFailureState();const t={outcome_type:"referral",referral_reason:"Your quote requires further review.",quote_intent:this.quoteIntent};return this.calculationResult=t,t}finally{this.isCalculating=!1,this.notify()}}async clearCalculationResults(){t();try{await this.httpClient.deleteCalculations(this.quoteIntent.delete_calculations_url),this.calculationResult=void 0,this.calculationResultV2=void 0,this.selectionV2=null,this.selectedExcessId=null,this.selectedPaymentOption=null,this.notify(),t()}catch(e){throw t(),e}}getCalculationResultV2(){return this.calculationResultV2}getSelectionV2(){return this.selectionV2}setV2Selection(e){var t,n,r,i;if(!this.calculationResultV2||!this.selectionV2)return;const o={cover_type_id:null!==(t=e.cover_type_id)&&void 0!==t?t:this.selectionV2.cover_type_id,excess_id:null!==(n=e.excess_id)&&void 0!==n?n:this.selectionV2.excess_id,coverage_option_ids:null!==(r=e.coverage_option_ids)&&void 0!==r?r:this.selectionV2.coverage_option_ids};if(e.cover_type_id&&e.cover_type_id!==this.selectionV2.cover_type_id){const e=this.calculationResultV2.variants.filter(e=>e.cover_type_id===o.cover_type_id),t=e.some(e=>e.excess_id===o.excess_id);if(!t){const t=null!==(i=e.find(e=>e.excess_id===this.calculationResultV2.default_excess_id))&&void 0!==i?i:e[0];t&&(o.excess_id=t.excess_id)}}this.selectionV2=o,this.selectedExcessId=o.excess_id,this.calculationResult=this.buildV1CompatResponseFromV2(this.calculationResultV2),this.notify()}async toggleV2CoverageOption(e){if(!this.calculationResultV2||!this.selectionV2||!this.quoteIntent.reprice_url_v2)return;const t=this.calculationResultV2.policy_coverage_options.find(t=>t.id===e);if(!t)return;const n=this.selectionV2.coverage_option_ids,r=n.includes(e)?n.filter(t=>t!==e):[...n,e],i={...this.selectionV2,coverage_option_ids:r};try{this.isRepricing=!0,this.notify();const e=await this.calculationManagerV2.reprice(this.quoteIntent.reprice_url_v2,i);this.calculationResultV2={...this.calculationResultV2,variants:e.variants,policy_coverage_options:e.policy_coverage_options},this.selectionV2=e.selection,this.calculationResult=this.buildV1CompatResponseFromV2(this.calculationResultV2)}catch(e){}finally{this.isRepricing=!1,this.notify()}}getV2DisplayedTotal(){if(!this.calculationResultV2||!this.selectionV2)return 0;const e=this.calculationResultV2.variants.find(e=>e.cover_type_id===this.selectionV2.cover_type_id&&e.excess_id===this.selectionV2.excess_id);return e?Math.round(100*e.pricing.total_payable)/100:0}async bindV2(e){if(!this.quoteIntent.bind_url_v2||!this.selectionV2)throw new Error("v2 bind unavailable — missing bind URL or selection");const t=this.getV2DisplayedTotal();return this.calculationManagerV2.bind(this.quoteIntent.bind_url_v2,{selection:this.selectionV2,client_claimed_total:t,email:e})}buildV1CompatResponseFromV2(e){var t;const n=null!==(t=this.selectionV2)&&void 0!==t?t:e.selection,r=e.variants.filter(e=>e.cover_type_id===n.cover_type_id),i=r.map(t=>{var n;const r=e.excess_options.find(e=>e.id===t.excess_id);return{id:t.excess_id,calculation_id:e.id,excess_amount:null!==(n=null==r?void 0:r.excess_amount)&&void 0!==n?n:0,excess_label:null==r?void 0:r.excess_label,description:void 0,premium_base:t.pricing.subtotal-t.pricing.fees,premium_subtotal:t.pricing.subtotal,premium_total:t.pricing.total_payable,fees:[]}});return{quote_intent:e.quote_intent,product_name:e.product_name,default_excess_id:e.default_excess_id,default_coverage_options:n.coverage_option_ids,outcome_type:e.outcome_type,referral_reason:e.referral_reason,calculations:i,referrals:e.referrals.map(e=>({id:e.id,reason:e.reason})),clauses:e.clauses,payment_options:[],payment_gateways:e.payment_gateways}}notify(){this.subscribers.forEach(e=>e(this))}getAllFormDataFlattened(){const e={};return Object.values(this.formData.page_data).forEach(t=>{const{U:n,...r}=t;Object.assign(e,r),n&&Object.keys(n).length>0&&(e.U||(e.U={}),Object.assign(e.U,n))}),e}updateFormDataInternal(e){if(this.isUserTyping()&&e.page_data){const t={...e};delete t.page_data,this.formData={...this.formData,...t}}else this.formData={...this.formData,...e};this.notify()}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}getPersistedCalculationFailureState(){var e,t,n;return!!(null===(n=null===(t=null===(e=this.quoteIntent.form_data)||void 0===e?void 0:e.page_data)||void 0===t?void 0:t.Y)||void 0===n?void 0:n.lastCalculationFailed)&&!0===this.quoteIntent.form_data.page_data.Y.lastCalculationFailed}persistCalculationFailureState(){this.formData.page_data.Y||(this.formData.page_data.Y={}),this.formData.page_data.Y.lastCalculationFailed=this.lastCalculationFailed,this.formData.last_updated=(new Date).toISOString(),this.saveFormData(!0,"auto-save").catch(()=>{})}reset(){localStorage.clear();const e=new URL(window.location.href);e.searchParams.delete("url"),window.history.replaceState({},document.title,e.toString()),window.location.reload()}getQuoteIntent(){return this.quoteIntent}updateQuoteIntent(e){if(this.quoteIntentStore){const t=this.quoteIntentStore.updateQuoteIntent(this.quoteIntent.org_id,e);t&&(this.quoteIntent=t,this.notify())}}clearStoredQuoteIntent(){this.quoteIntentStore&&this.quoteIntentStore.clearQuoteIntent(this.quoteIntent.org_id)}async initiatePayment(e){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(t=>t.id===e.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");t();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(t=>t.gateway_id===e.gatewayId&&t.calculation_id===e.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(t=>t.id===e.calculationId);try{const t=await this.httpClient.initiatePayment(e,o);return s&&Oe(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),t}catch(e){throw e}}async getPaymentStatus(e){var t;const n=this.getSelectedPaymentOption();if(!n)throw new Error("No payment option selected");const r=((null===(t=this.calculationResult)||void 0===t?void 0:t.payment_gateways)||[]).find(e=>e.id===n.gateway_id);if(!r)throw new Error("Selected payment gateway not found in calculation response");try{const t=await this.httpClient.getPaymentStatus(e,r);return this.notify(),t}catch(e){throw e}}startPaymentStatusPolling(e,t,n=30){let r=0,i=!1;const o=async()=>{if(!(i||r>=n))try{const s=await this.getPaymentStatus(e);t(s),"pending"!==s.status&&"initiated"!==s.status||(r++,r<n&&!i&&setTimeout(o,1e4))}catch(e){r++,r<n&&!i&&setTimeout(o,1e4)}};return o(),()=>{i=!0}}}class Le{constructor(e,t){this.httpClient=e,this.response=t}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(e){var t;const n=this.response.product.form_definition,r={...this.response.quote_intent.form_data};r.page_data||(r.page_data={});for(const i of n.pages){const n=r.page_data[i.id]||{};for(const r of i.fields){const i=r.code||r.id;if(e.hasOwnProperty(i)?n[i]=e[i]:("text"===r.type&&(n[i]="sample"),"number"===r.type&&(n[i]=1),"checkbox"===r.type&&(n[i]=!0)),"boolean"===r.type&&(null===(t=r.boolean_config)||void 0===t?void 0:t.enable_details_textbox)){const e="yes"===r.boolean_config.show_details_on,t=n[i];(t===e||t===String(e))&&(n.U||(n.U={}),n.U[i]=`Sample details for: ${i}`)}}r.page_data[i.id]=n}const i={current_page_index:0,save_type:"full",page_data:{...r.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,i)}}class Be{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new Le(this.httpClient,n)}}var Fe=0;function qe(e,t,n,i,o,s){t||(t={});var a,l,c=t;if("ref"in c)for(l in c={},t)"ref"==l?a=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:--Fe,_:-1,C:0,J:o,K:s};if("function"==typeof e&&(a=e.defaultProps))for(l in a)void 0===c[l]&&(c[l]=a[l]);return r.vnode&&r.vnode(u),u}var He,Ue,Ye,Ze,Ge=0,Ve=[],Qe=r,Je=Qe.p,Ke=Qe.O,Xe=Qe.diffed,et=Qe.k,tt=Qe.unmount,nt=Qe.m;function rt(e,t){Qe.W&&Qe.W(Ue,e,Ge||t),Ge=0;var n=Ue.X||(Ue.X={m:[],W:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function it(e){return Ge=1,function(e,t){var n=rt(He++,2);if(n.t=e,!n.k&&(n.m=[pt(void 0,t),function(e){var t=n.ee?n.ee[0]:n.m[0],r=n.t(t,e);t!==r&&(n.ee=[r,n.m[1]],n.k.setState({}))}],n.k=Ue,!Ue.te)){var r=function(e,t,r){if(!n.k.X)return!0;var o=n.k.X.m.filter(function(e){return e.k});if(o.every(function(e){return!e.ee}))return!i||i.call(this,e,t,r);var s=n.k.props!==e;return o.some(function(e){if(e.ee){var t=e.m[0];e.m=e.ee,e.ee=void 0,t!==e.m[0]&&(s=!0)}}),i&&i.call(this,e,t,r)||s};Ue.te=!0;var i=Ue.shouldComponentUpdate,o=Ue.componentWillUpdate;Ue.componentWillUpdate=function(e,t,n){if(this.v){var s=i;i=void 0,r(e,t,n),i=s}o&&o.call(this,e,t,n)},Ue.shouldComponentUpdate=r}return n.ee||n.m}(pt,e)}function ot(e,t){var n=rt(He++,3);!Qe.L&&ft(n.X,t)&&(n.m=e,n.u=t,Ue.X.W.push(n))}function st(e){return Ge=5,at(function(){return{current:e}},[])}function at(e,t){var n=rt(He++,7);return ft(n.X,t)&&(n.m=e(),n.X=t,n.W=e),n.m}function lt(e,t){return Ge=8,at(function(){return e},t)}function ct(){for(var e;e=Ve.shift();){var t=e.X;if(e.I&&t)try{t.W.some(ht),t.W.some(mt),t.W=[]}catch(n){t.W=[],Qe.v(n,e.N)}}}Qe.p=function(e){Ue=null,Je&&Je(e)},Qe.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),nt&&nt(e,t)},Qe.O=function(e){Ke&&Ke(e),He=0;var t=(Ue=e.k).X;t&&(Ye===Ue?(t.W=[],Ue.W=[],t.m.some(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.W.some(ht),t.W.some(mt),t.W=[],He=0)),Ye=Ue},Qe.diffed=function(e){Xe&&Xe(e);var t=e.k;t&&t.X&&(t.X.W.length&&(1!==Ve.push(t)&&Ze===Qe.requestAnimationFrame||((Ze=Qe.requestAnimationFrame)||dt)(ct)),t.X.m.some(function(e){e.u&&(e.X=e.u),e.u=void 0})),Ye=Ue=null},Qe.k=function(e,t){t.some(function(e){try{e.W.some(ht),e.W=e.W.filter(function(e){return!e.m||mt(e)})}catch(n){t.some(function(e){e.W&&(e.W=[])}),t=[],Qe.v(n,e.N)}}),et&&et(e,t)},Qe.unmount=function(e){tt&&tt(e);var t,n=e.k;n&&n.X&&(n.X.m.some(function(e){try{ht(e)}catch(e){t=e}}),n.X=void 0,t&&Qe.v(t,n.N))};var ut="function"==typeof requestAnimationFrame;function dt(e){var t,n=function(){clearTimeout(r),ut&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ut&&(t=requestAnimationFrame(n))}function ht(e){var t=Ue,n=e.k;"function"==typeof n&&(e.k=void 0,n()),Ue=t}function mt(e){var t=Ue;e.k=e.m(),Ue=t}function ft(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function pt(e,t){return"function"==typeof t?t(e):t}const gt="insure-os";let yt=!1;const vt=new Map,wt={[`--${gt}-radius`]:"0.75rem",[`--${gt}-radius-sm`]:"0.5rem",[`--${gt}-radius-lg`]:"1rem",[`--${gt}-background`]:"oklch(0.955 0 0)",[`--${gt}-foreground`]:"oklch(0.145 0 0)",[`--${gt}-card`]:"oklch(1 0 0)",[`--${gt}-card-foreground`]:"oklch(0.145 0 0)",[`--${gt}-popover`]:"oklch(1 0 0)",[`--${gt}-popover-foreground`]:"oklch(0.145 0 0)",[`--${gt}-primary`]:"oklch(0.205 0 0)",[`--${gt}-primary-foreground`]:"oklch(0.985 0 0)",[`--${gt}-secondary`]:"oklch(0.97 0 0)",[`--${gt}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${gt}-muted`]:"oklch(0.97 0 0)",[`--${gt}-muted-foreground`]:"oklch(0.556 0 0)",[`--${gt}-accent`]:"oklch(0.97 0 0)",[`--${gt}-accent-foreground`]:"oklch(0.205 0 0)",[`--${gt}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${gt}-border`]:"oklch(0.9 0 0)",[`--${gt}-input`]:"oklch(0.9 0 0)",[`--${gt}-ring`]:"oklch(0.708 0 0)",[`--${gt}-font-family`]:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${gt}-font-size-large`]:"18px",[`--${gt}-font-size-small`]:"14px",[`--${gt}-font-size`]:"16px",[`--${gt}-border-width`]:"1px",[`--${gt}-transition-duration`]:"200ms",[`--${gt}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${gt}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${gt}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${gt}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${gt}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${gt}-spacing-sm`]:"0.75rem",[`--${gt}-spacing`]:"1rem",[`--${gt}-spacing-md`]:"1.5rem",[`--${gt}-spacing-lg`]:"2rem",[`--${gt}-spacing-xl`]:"3rem"},bt={colors:{background:`var(--${gt}-background)`,foreground:`var(--${gt}-foreground)`,card:`var(--${gt}-card)`,popover:`var(--${gt}-popover)`,popoverForeground:`var(--${gt}-popover-foreground)`,primary:`var(--${gt}-primary)`,primaryForeground:`var(--${gt}-primary-foreground)`,secondary:`var(--${gt}-secondary)`,muted:`var(--${gt}-muted)`,mutedForeground:`var(--${gt}-muted-foreground)`,accent:`var(--${gt}-accent)`,accentForeground:`var(--${gt}-accent-foreground)`,destructive:`var(--${gt}-destructive)`,border:`var(--${gt}-border)`,input:`var(--${gt}-input)`},fontSize:{small:`var(--${gt}-font-size-small)`,default:`var(--${gt}-font-size)`,large:`var(--${gt}-font-size-large)`},radius:{small:`var(--${gt}-radius-sm)`,default:`var(--${gt}-radius)`,large:`var(--${gt}-radius-lg)`},shadow:{sm:`var(--${gt}-shadow-sm)`,md:`var(--${gt}-shadow-md)`},spacing:{sm:`var(--${gt}-spacing-sm)`,default:`var(--${gt}-spacing)`,md:`var(--${gt}-spacing-md)`,lg:`var(--${gt}-spacing-lg)`,xl:`var(--${gt}-spacing-xl)`},fontFamily:`var(--${gt}-font-family)`,borderWidth:`var(--${gt}-border-width)`,transition:`var(--${gt}-transition-duration) var(--${gt}-transition-timing-function)`},xt=new Set;let kt=!1;function Nt(){kt||(St(`\n/* InsureOS Style Isolation Reset */\n.${gt}-root {\n all: revert;\n /* Re-apply our base styles after reset */\n font-family: var(--${gt}-font-family);\n background-color: var(--${gt}-background);\n color: var(--${gt}-foreground);\n font-size: var(--${gt}-font-size);\n line-height: 1.5;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.${gt}-root *,\n.${gt}-root *::before,\n.${gt}-root *::after {\n box-sizing: border-box;\n}\n\n.${gt}-root img,\n.${gt}-root picture,\n.${gt}-root video,\n.${gt}-root canvas,\n.${gt}-root svg {\n display: block;\n max-width: 100%;\n}\n\n.${gt}-root button,\n.${gt}-root input,\n.${gt}-root select,\n.${gt}-root textarea {\n font: inherit;\n color: inherit;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n}\n\n.${gt}-root button {\n cursor: pointer;\n}\n\n.${gt}-root a {\n color: inherit;\n text-decoration: inherit;\n}\n\n.${gt}-root h1,\n.${gt}-root h2,\n.${gt}-root h3,\n.${gt}-root h4,\n.${gt}-root h5,\n.${gt}-root h6 {\n font-size: inherit;\n font-weight: inherit;\n margin: 0;\n}\n\n.${gt}-root p,\n.${gt}-root ul,\n.${gt}-root ol,\n.${gt}-root blockquote,\n.${gt}-root figure {\n margin: 0;\n padding: 0;\n}\n\n.${gt}-root ul,\n.${gt}-root ol {\n list-style: none;\n}\n\n.${gt}-root table {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\n.${gt}-root hr {\n margin: 0;\n border: none;\n border-top: 1px solid var(--${gt}-border);\n height: 0;\n}\n`),kt=!0,t())}function St(e){if(!document.getElementById(`${gt}-styles`)){const e=document.createElement("style");e.id=`${gt}-styles`,document.head.appendChild(e)}document.getElementById(`${gt}-styles`).textContent+=e+"\n"}function _t(e){return Object.entries(e).map(([e,t])=>{return`${n=e,n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${t}`;var n}).join("; ")}function $t(){yt||(St(`:root {\n${Object.entries(wt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),yt=!0)}const Ct={name:e=>`${gt}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){$t();const r=_t(t),i=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t).toString(36)}(`${e}:${r}:${n?JSON.stringify(n):""}`),o=`${e}-${i}`,s=vt.get(o);if(s)return s.fullClassName;let a=e;const l=this.name(a);return xt.has(a)||(St(`.${l} { ${r} }`),xt.add(a)),vt.set(o,{contentHash:i,fullClassName:l}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),l},keyframes(e,t){const n=`${gt}-${e}`;return xt.has(`keyframes-${e}`)||(St(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${_t(t)} }`).join("\n")}\n}`),xt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;St(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${gt}-${e} { ${_t(t)} }`).join("\n")}\n}`),xt.add(n)},pseudoElement(e,t,n){const r=`${gt}-${e}`,i=`${e}-${t}`;return xt.has(i)||(St(`.${r}${t} { ${_t(n)} }`),xt.add(i)),r}};var It=Object.freeze({__proto__:null,baseVariables:wt,injectIsolationStyles:Nt,styles:Ct,theme:bt,updateBaseVariables:function(e){t(),Object.assign(wt,e);const n=document.getElementById(`${gt}-styles`);if(n){const e=n.textContent||"",r=`:root {\n${Object.entries(wt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,i=e.includes(":root {")?e.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+e;n.textContent=i,t()}else $t()}});function Tt(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var Et,Pt={exports:{}};function Dt(){return Et||(Et=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!=={}.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var r="";for(var o in e)t.call(e,o)&&e[o]&&(r=i(r,o));return r}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(Pt)),Pt.exports}var zt=Tt(Dt());function Rt({size:e="small"}){const t=Ct.create("spinner-small",{width:"16px",height:"16px"}),n=Ct.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return Ct.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),qe("div",{className:Ct.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:qe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:zt(r),children:qe("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function Mt({className:e,children:t,size:n="md"}){const r={sm:bt.spacing.sm,md:bt.spacing.md,lg:bt.spacing.lg,xl:bt.spacing.xl},i=Ct.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?bt.spacing.lg:"lg"===n?bt.spacing.md:r[n]},"(max-width: 480px)":{padding:bt.spacing.sm}});return qe("div",{className:zt(i,e),children:t})}const Ot=function(){function e(t){var n,r;return this.getChildContext||(n=new Set,(r={})[e.k]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.v=!0,P(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),t.children}return e.k="__cC"+g++,e.m=null,e.Provider=e.re=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}();function jt({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,urlPromoCode:l}){return qe(Ot.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,urlPromoCode:l,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function Wt(){const e=function(e){var t=Ue.context[e.k],n=rt(He++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(Ue)),t.props.value):e.m}(Ot);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function At(e){const t=Wt(),{formStateManager:n}=t;if(!n||"function"!=typeof n.subscribe)throw new Error("useQuoteForm can only be used in quote mode. If you're in payment link mode, use usePaymentLink instead.");const[r,i]=it(()=>e(n));return ot(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class Lt extends Error{}class Bt extends Lt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Ft extends Lt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class qt extends Lt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Ht extends Lt{}class Ut extends Lt{constructor(e){super(`Invalid unit ${e}`)}}class Yt extends Lt{}class Zt extends Lt{constructor(){super("Zone is an abstract class")}}const Gt="numeric",Vt="short",Qt="long",Jt={year:Gt,month:Gt,day:Gt},Kt={year:Gt,month:Vt,day:Gt},Xt={year:Gt,month:Vt,day:Gt,weekday:Vt},en={year:Gt,month:Qt,day:Gt},tn={year:Gt,month:Qt,day:Gt,weekday:Qt},nn={hour:Gt,minute:Gt},rn={hour:Gt,minute:Gt,second:Gt},on={hour:Gt,minute:Gt,second:Gt,timeZoneName:Vt},sn={hour:Gt,minute:Gt,second:Gt,timeZoneName:Qt},an={hour:Gt,minute:Gt,hourCycle:"h23"},ln={hour:Gt,minute:Gt,second:Gt,hourCycle:"h23"},cn={hour:Gt,minute:Gt,second:Gt,hourCycle:"h23",timeZoneName:Vt},un={hour:Gt,minute:Gt,second:Gt,hourCycle:"h23",timeZoneName:Qt},dn={year:Gt,month:Gt,day:Gt,hour:Gt,minute:Gt},hn={year:Gt,month:Gt,day:Gt,hour:Gt,minute:Gt,second:Gt},mn={year:Gt,month:Vt,day:Gt,hour:Gt,minute:Gt},fn={year:Gt,month:Vt,day:Gt,hour:Gt,minute:Gt,second:Gt},pn={year:Gt,month:Vt,day:Gt,weekday:Vt,hour:Gt,minute:Gt},gn={year:Gt,month:Qt,day:Gt,hour:Gt,minute:Gt,timeZoneName:Vt},yn={year:Gt,month:Qt,day:Gt,hour:Gt,minute:Gt,second:Gt,timeZoneName:Vt},vn={year:Gt,month:Qt,day:Gt,weekday:Qt,hour:Gt,minute:Gt,timeZoneName:Qt},wn={year:Gt,month:Qt,day:Gt,weekday:Qt,hour:Gt,minute:Gt,second:Gt,timeZoneName:Qt};class bn{get type(){throw new Zt}get name(){throw new Zt}get ianaName(){return this.name}get isUniversal(){throw new Zt}offsetName(e,t){throw new Zt}formatOffset(e,t){throw new Zt}offset(e){throw new Zt}equals(e){throw new Zt}get isValid(){throw new Zt}}let xn=null;class kn extends bn{static get instance(){return null===xn&&(xn=new kn),xn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Fr(e,t,n)}formatOffset(e,t){return Yr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const Nn=new Map,Sn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},_n=new Map;class $n extends bn{static create(e){let t=_n.get(e);return void 0===t&&_n.set(e,t=new $n(e)),t}static resetCache(){_n.clear(),Nn.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=$n.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Fr(e,t,n,this.name)}formatOffset(e,t){return Yr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=function(e){let t=Nn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Nn.set(e,t)),t}(this.name);let[r,i,o,s,a,l,c]=n.formatToParts?function(e,t){const n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){const{type:t,value:i}=n[e],o=Sn[t];"era"===t?r[o]=i:xr(o)||(r[o]=parseInt(i,10))}return r}(n,t):function(e,t){const n=e.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,o,s,a,l,c,u]=r;return[s,i,o,a,l,c,u]}(n,t);"BC"===s&&(r=1-Math.abs(r));let u=+t;const d=u%1e3;return u-=d>=0?d:1e3+d,(Wr({year:r,month:i,day:o,hour:24===a?0:a,minute:l,second:c,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let Cn={};const In=new Map;function Tn(e,t={}){const n=JSON.stringify([e,t]);let r=In.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),In.set(n,r)),r}const En=new Map,Pn=new Map;let Dn=null;const zn=new Map;function Rn(e){let t=zn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),zn.set(e,t)),t}const Mn=new Map;function On(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class jn{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...o}=n;if(!t||Object.keys(o).length>0){const t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=function(e,t={}){const n=JSON.stringify([e,t]);let r=En.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),En.set(n,r)),r}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return Er(this.floor?Math.floor(e):Rr(e,3),this.padTo)}}class Wn{constructor(e,t,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&$n.create(n).valid?(r=n,this.dt=e):(r="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=Tn(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class An{constructor(e,t,n){this.opts={style:"long",...n},!t&&Sr()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=Pn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),Pn.set(i,o)),o}(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):function(e,t,n="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=-1===["hours","minutes","seconds"].indexOf(e);if("auto"===n&&o){const n="days"===e;switch(t){case 1:return n?"tomorrow":`next ${i[e][0]}`;case-1:return n?"yesterday":`last ${i[e][0]}`;case 0:return n?"today":`this ${i[e][0]}`}}const s=Object.is(t,-0)||t<0,a=Math.abs(t),l=1===a,c=i[e],u=r?l?c[1]:c[2]||c[1]:l?i[e][0]:e;return s?`${a} ${u} ago`:`in ${a} ${u}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Ln={firstDay:1,minimalDays:4,weekend:[6,7]};class Bn{static fromOpts(e){return Bn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||or.defaultLocale,s=o||(i?"en-US":Dn||(Dn=(new Intl.DateTimeFormat).resolvedOptions().locale,Dn)),a=t||or.defaultNumberingSystem,l=n||or.defaultOutputCalendar,c=Ir(r)||or.defaultWeekSettings;return new Bn(s,a,l,c,o)}static resetCache(){Dn=null,In.clear(),En.clear(),Pn.clear(),zn.clear(),Mn.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return Bn.create(e,t,n,r)}constructor(e,t,n,r,i){const[o,s,a]=function(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const n=e.indexOf("-u-");if(-1===n)return[e];{let t,r;try{t=Tn(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=Tn(o).resolvedOptions(),r=o}const{numberingSystem:i,calendar:o}=t;return[r,i,o]}}(e);this.locale=o,this.numberingSystem=t||s||null,this.outputCalendar=n||a||null,this.weekSettings=r,this.intl=function(e,t,n){return n||t?(e.includes("-u-")||(e+="-u"),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){var e;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(e=this).numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===Rn(e.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Bn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Ir(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return On(this,e,Jr,()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(t&=!n)?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,"month");this.monthsCache[i][e]=function(e){const t=[];for(let n=1;n<=12;n++){const r=es.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return On(this,e,ti,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=function(e){const t=[];for(let n=1;n<=7;n++){const r=es.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return On(this,void 0,()=>ni,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[es.utc(2016,11,13,9),es.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return On(this,e,si,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[es.utc(-40,1,1),es.utc(2017,1,1)].map(e=>this.extract(e,t,"era"))),this.eraCache[e]})}extract(e,t,n){const r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new jn(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Wn(e,this.intl,t)}relFormatter(e={}){return new An(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=Cn[n];return r||(r=new Intl.ListFormat(e,t),Cn[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||Rn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:_r()?function(e){let t=Mn.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...Ln,...t}),Mn.set(e,t)}return t}(this.locale):Ln}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Fn=null;class qn extends bn{static get utcInstance(){return null===Fn&&(Fn=new qn(0)),Fn}static instance(e){return 0===e?qn.utcInstance:new qn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new qn(qr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Yr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Yr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Yr(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class Hn extends bn{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Un(e,t){if(xr(e)||null===e)return t;if(e instanceof bn)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?kn.instance:"utc"===n||"gmt"===n?qn.utcInstance:qn.parseSpecifier(n)||$n.create(e)}return kr(e)?qn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Hn(e)}const Yn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Zn={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Gn=Yn.hanidec.replace(/[\[|\]]/g,"").split(""),Vn=new Map;function Qn({numberingSystem:e},t=""){const n=e||"latn";let r=Vn.get(n);void 0===r&&(r=new Map,Vn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${Yn[n]}${t}`),r.set(t,i)),i}let Jn,Kn=()=>Date.now(),Xn="system",er=null,tr=null,nr=null,rr=60,ir=null;class or{static get now(){return Kn}static set now(e){Kn=e}static set defaultZone(e){Xn=e}static get defaultZone(){return Un(Xn,kn.instance)}static get defaultLocale(){return er}static set defaultLocale(e){er=e}static get defaultNumberingSystem(){return tr}static set defaultNumberingSystem(e){tr=e}static get defaultOutputCalendar(){return nr}static set defaultOutputCalendar(e){nr=e}static get defaultWeekSettings(){return ir}static set defaultWeekSettings(e){ir=Ir(e)}static get twoDigitCutoffYear(){return rr}static set twoDigitCutoffYear(e){rr=e%100}static get throwOnInvalid(){return Jn}static set throwOnInvalid(e){Jn=e}static resetCaches(){Bn.resetCache(),$n.resetCache(),es.resetCache(),Vn.clear()}}class sr{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const ar=[0,31,59,90,120,151,181,212,243,273,304,334],lr=[0,31,60,91,121,152,182,213,244,274,305,335];function cr(e,t){return new sr("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function ur(e,t,n){const r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return 0===i?7:i}function dr(e,t,n){return n+(Mr(e)?lr:ar)[t-1]}function hr(e,t){const n=Mr(e)?lr:ar,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function mr(e,t){return(e-t+7)%7+1}function fr(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=dr(r,i,o),a=mr(ur(r,i,o),n);let l,c=Math.floor((s-a+14-t)/7);return c<1?(l=r-1,c=Lr(l,t,n)):c>Lr(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:a,...Zr(e)}}function pr(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=mr(ur(r,1,t),n),a=Or(r);let l,c=7*i+o-s-7+t;c<1?(l=r-1,c+=Or(l)):c>a?(l=r+1,c-=Or(r)):l=r;const{month:u,day:d}=hr(l,c);return{year:l,month:u,day:d,...Zr(e)}}function gr(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:dr(t,n,r),...Zr(e)}}function yr(e){const{year:t,ordinal:n}=e,{month:r,day:i}=hr(t,n);return{year:t,month:r,day:i,...Zr(e)}}function vr(e,t){if(!xr(e.localWeekday)||!xr(e.localWeekNumber)||!xr(e.localWeekYear)){if(!xr(e.weekday)||!xr(e.weekNumber)||!xr(e.weekYear))throw new Ht("Cannot mix locale-based week fields with ISO-based week fields");return xr(e.localWeekday)||(e.weekday=e.localWeekday),xr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),xr(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function wr(e){const t=Nr(e.year),n=Tr(e.month,1,12),r=Tr(e.day,1,jr(e.year,e.month));return t?n?!r&&cr("day",e.day):cr("month",e.month):cr("year",e.year)}function br(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=Tr(t,0,23)||24===t&&0===n&&0===r&&0===i,s=Tr(n,0,59),a=Tr(r,0,59),l=Tr(i,0,999);return o?s?a?!l&&cr("millisecond",i):cr("second",r):cr("minute",n):cr("hour",t)}function xr(e){return void 0===e}function kr(e){return"number"==typeof e}function Nr(e){return"number"==typeof e&&e%1==0}function Sr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function _r(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function $r(e,t,n){if(0!==e.length)return e.reduce((e,r)=>{const i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function Cr(e,t){return{}.hasOwnProperty.call(e,t)}function Ir(e){if(null==e)return null;if("object"!=typeof e)throw new Yt("Week settings must be an object");if(!Tr(e.firstDay,1,7)||!Tr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!Tr(e,1,7)))throw new Yt("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Tr(e,t,n){return Nr(e)&&e>=t&&e<=n}function Er(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function Pr(e){return xr(e)||null===e||""===e?void 0:parseInt(e,10)}function Dr(e){return xr(e)||null===e||""===e?void 0:parseFloat(e)}function zr(e){if(!xr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function Rr(e,t,n="round"){const r=10**t;switch(n){case"expand":return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case"trunc":return Math.trunc(e*r)/r;case"round":return Math.round(e*r)/r;case"floor":return Math.floor(e*r)/r;case"ceil":return Math.ceil(e*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function Mr(e){return e%4==0&&(e%100!=0||e%400==0)}function Or(e){return Mr(e)?366:365}function jr(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?Mr(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Wr(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Ar(e,t,n){return-mr(ur(e,1,t),n)+t-1}function Lr(e,t=4,n=1){const r=Ar(e,t,n),i=Ar(e+1,t,n);return(Or(e)-r+i)/7}function Br(e){return e>99?e:e>or.twoDigitCutoffYear?1900+e:2e3+e}function Fr(e,t,n,r=null){const i=new Date(e),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:t,...o},a=new Intl.DateTimeFormat(n,s).formatToParts(i).find(e=>"timezonename"===e.type.toLowerCase());return a?a.value:null}function qr(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const r=parseInt(t,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function Hr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Yt(`Invalid unit value ${e}`);return t}function Ur(e,t){const n={};for(const r in e)if(Cr(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=Hr(i)}return n}function Yr(e,t){const n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${Er(n,2)}:${Er(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${Er(n,2)}${Er(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Zr(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const Gr=["January","February","March","April","May","June","July","August","September","October","November","December"],Vr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Qr=["J","F","M","A","M","J","J","A","S","O","N","D"];function Jr(e){switch(e){case"narrow":return[...Qr];case"short":return[...Vr];case"long":return[...Gr];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Kr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Xr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ei=["M","T","W","T","F","S","S"];function ti(e){switch(e){case"narrow":return[...ei];case"short":return[...Xr];case"long":return[...Kr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const ni=["AM","PM"],ri=["Before Christ","Anno Domini"],ii=["BC","AD"],oi=["B","A"];function si(e){switch(e){case"narrow":return[...oi];case"short":return[...ii];case"long":return[...ri];default:return null}}function ai(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const li={D:Jt,DD:Kt,DDD:en,DDDD:tn,t:nn,tt:rn,ttt:on,tttt:sn,T:an,TT:ln,TTT:cn,TTTT:un,f:dn,ff:mn,fff:gn,ffff:vn,F:hn,FF:fn,FFF:yn,FFFF:wn};class ci{static create(e,t={}){return new ci(e,t)}static parseFormat(e){let t=null,n="",r=!1;const i=[];for(let o=0;o<e.length;o++){const s=e.charAt(o);"'"===s?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),t=null,n="",r=!r):r||s===t?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,t=s)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return li[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n){if(this.opts.forceSimple)return Er(e,t);const r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,i=(t,n)=>this.loc.extract(e,t,n),o=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",s=(t,r)=>n?function(e,t){return Jr(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return ti(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),l=t=>{const n=ci.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},c=t=>n?function(e,t){return si(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return ai(ci.parseFormat(t),t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return n?function(e){return ni[e.hour<12?0:1]}(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?i({day:"numeric"},"day"):this.num(e.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return a("short",!0);case"cccc":return a("long",!0);case"ccccc":return a("narrow",!0);case"EEE":return a("short",!1);case"EEEE":return a("long",!1);case"EEEEE":return a("narrow",!1);case"L":return r?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return s("short",!0);case"LLLL":return s("long",!0);case"LLLLL":return s("narrow",!0);case"M":return r?i({month:"numeric"},"month"):this.num(e.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return s("short",!1);case"MMMM":return s("long",!1);case"MMMMM":return s("narrow",!1);case"y":return r?i({year:"numeric"},"year"):this.num(e.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(t)}})}formatDurationFromString(e,t){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=e=>{switch(e[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=ci.parseFormat(t),o=i.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),s=e.shiftTo(...o.map(r).filter(e=>e));return ai(i,((e,t)=>i=>{const o=r(i);if(o){const r=t.isNegativeDuration&&o!==t.largestUnit?n:1;let s;return s="negativeLargestOnly"===this.opts.signMode&&o!==t.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(e.get(o)*r,i.length,s)}return i})(s,{isNegativeDuration:s<0,largestUnit:Object.keys(s.values)[0]}))}}const ui=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function di(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function hi(...e){return t=>e.reduce(([e,n,r],i)=>{const[o,s,a]=i(t,r);return[{...e,...o},s||n,a]},[{},null,1]).slice(0,2)}function mi(e,...t){if(null==e)return[null,null];for(const[n,r]of t){const t=n.exec(e);if(t)return r(t)}return[null,null]}function fi(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=Pr(t[n+i]);return[r,null,n+i]}}const pi=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,gi=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,yi=RegExp(`${gi.source}(?:${pi.source}?(?:\\[(${ui.source})\\])?)?`),vi=RegExp(`(?:[Tt]${yi.source})?`),wi=fi("weekYear","weekNumber","weekDay"),bi=fi("year","ordinal"),xi=RegExp(`${gi.source} ?(?:${pi.source}|(${ui.source}))?`),ki=RegExp(`(?: ${xi.source})?`);function Ni(e,t,n){const r=e[t];return xr(r)?n:Pr(r)}function Si(e,t){return[{hours:Ni(e,t,0),minutes:Ni(e,t+1,0),seconds:Ni(e,t+2,0),milliseconds:zr(e[t+3])},null,t+4]}function _i(e,t){const n=!e[t]&&!e[t+1],r=qr(e[t+1],e[t+2]);return[{},n?null:qn.instance(r),t+3]}function $i(e,t){return[{},e[t]?$n.create(e[t]):null,t+1]}const Ci=RegExp(`^T?${gi.source}$`),Ii=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Ti(e){const[t,n,r,i,o,s,a,l,c]=e,u="-"===t[0],d=l&&"-"===l[0],h=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:h(Dr(n)),months:h(Dr(r)),weeks:h(Dr(i)),days:h(Dr(o)),hours:h(Dr(s)),minutes:h(Dr(a)),seconds:h(Dr(l),"-0"===l),milliseconds:h(zr(c),d)}]}const Ei={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Pi(e,t,n,r,i,o,s){const a={year:2===t.length?Br(Pr(t)):Pr(t),month:Vr.indexOf(n)+1,day:Pr(r),hour:Pr(i),minute:Pr(o)};return s&&(a.second=Pr(s)),e&&(a.weekday=e.length>3?Kr.indexOf(e)+1:Xr.indexOf(e)+1),a}const Di=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function zi(e){const[,t,n,r,i,o,s,a,l,c,u,d]=e,h=Pi(t,i,r,n,o,s,a);let m;return m=l?Ei[l]:c?0:qr(u,d),[h,new qn(m)]}const Ri=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Mi=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Oi=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function ji(e){const[,t,n,r,i,o,s,a]=e;return[Pi(t,i,r,n,o,s,a),qn.utcInstance]}function Wi(e){const[,t,n,r,i,o,s,a]=e;return[Pi(t,a,n,r,i,o,s),qn.utcInstance]}const Ai=di(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,vi),Li=di(/(\d{4})-?W(\d\d)(?:-?(\d))?/,vi),Bi=di(/(\d{4})-?(\d{3})/,vi),Fi=di(yi),qi=hi(function(e,t){return[{year:Ni(e,t),month:Ni(e,t+1,1),day:Ni(e,t+2,1)},null,t+3]},Si,_i,$i),Hi=hi(wi,Si,_i,$i),Ui=hi(bi,Si,_i,$i),Yi=hi(Si,_i,$i),Zi=hi(Si),Gi=di(/(\d{4})-(\d\d)-(\d\d)/,ki),Vi=di(xi),Qi=hi(Si,_i,$i),Ji="Invalid Duration",Ki={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Xi={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...Ki},eo={years:{quarters:4,months:12,weeks:52.1775,days:365.2425,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:30.436875,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...Ki},to=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],no=to.slice(0).reverse();function ro(e,t,n=!1){const r={values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new ao(r)}function io(e,t){let n=t.milliseconds??0;for(const r of no.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function oo(e,t){const n=io(e,t)<0?-1:1;to.reduceRight((r,i)=>{if(xr(t[i]))return r;if(r){const o=t[r]*n,s=e[i][r],a=Math.floor(o/s);t[i]+=a*n,t[r]-=a*s*n}return i},null),to.reduce((n,r)=>{if(xr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function so(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class ao{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?eo:Xi;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Bn.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return ao.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Yt("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new ao({values:Ur(e,ao.normalizeUnit),loc:Bn.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(kr(e))return ao.fromMillis(e);if(ao.isDuration(e))return e;if("object"==typeof e)return ao.fromObject(e);throw new Yt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return mi(e,[Ii,Ti])}(e);return n?ao.fromObject(n,t):ao.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return mi(e,[Ci,Zi])}(e);return n?ao.fromObject(n,t):ao.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Yt("need to specify a reason the Duration is invalid");const n=e instanceof sr?e:new sr(e,t);if(or.throwOnInvalid)throw new qt(n);return new ao({invalid:n})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e?e.toLowerCase():e];if(!t)throw new Ut(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?ci.create(this.loc,n).formatDurationFromString(this,e):Ji}toHuman(e={}){if(!this.isValid)return Ji;const t=!1!==e.showZeros,n=to.map(n=>{const r=this.values[n];return xr(r)||0===r&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=Rr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},es.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?io(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ao.fromDurationLike(e),n={};for(const e of to)(Cr(t.values,e)||Cr(this.values,e))&&(n[e]=t.get(e)+this.get(e));return ro(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=ao.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=Hr(e(this.values[n],n));return ro(this,{values:t},!0)}get(e){return this[ao.normalizeUnit(e)]}set(e){return this.isValid?ro(this,{values:{...this.values,...Ur(e,ao.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return ro(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return oo(this.matrix,e),ro(this,{values:e},!0)}rescale(){return this.isValid?ro(this,{values:so(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>ao.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of to)if(e.indexOf(o)>=0){i=o;let e=0;for(const t in n)e+=this.matrix[t][o]*n[t],n[t]=0;kr(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else kr(r[o])&&(n[o]=r[o]);for(const e in n)0!==n[e]&&(t[i]+=e===i?n[e]:n[e]/this.matrix[i][e]);return oo(this.matrix,t),ro(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return ro(this,{values:e},!0)}removeZeros(){return this.isValid?ro(this,{values:so(this.values)},!0):this}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid)return!1;if(!this.loc.equals(e.loc))return!1;function t(e,t){return void 0===e||0===e?void 0===t||0===t:e===t}for(const n of to)if(!t(this.values[n],e.values[n]))return!1;return!0}}const lo="Invalid Interval";class co{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Yt("need to specify a reason the Interval is invalid");const n=e instanceof sr?e:new sr(e,t);if(or.throwOnInvalid)throw new Ft(n);return new co({invalid:n})}static fromDateTimes(e,t){const n=ts(e),r=ts(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?co.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null:co.invalid("missing or invalid end"):co.invalid("missing or invalid start")}(n,r);return null==i?new co({start:n,end:r}):i}static after(e,t){const n=ao.fromDurationLike(t),r=ts(e);return co.fromDateTimes(r,r.plus(n))}static before(e,t){const n=ao.fromDurationLike(t),r=ts(e);return co.fromDateTimes(r.minus(n),r)}static fromISO(e,t){const[n,r]=(e||"").split("/",2);if(n&&r){let e,i,o,s;try{e=es.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=es.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return co.fromDateTimes(e,o);if(i){const n=ao.fromISO(r,t);if(n.isValid)return co.after(e,n)}else if(s){const e=ao.fromISO(n,t);if(e.isValid)return co.before(o,e)}}return co.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let r;return r=t?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&this.s<=e&&this.e>e}set({start:e,end:t}={}){return this.isValid?co.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(ts).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),n=[];let{s:r}=this,i=0;for(;r<this.e;){const e=t[i]||this.e,o=+e>+this.e?this.e:e;n.push(co.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=ao.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let n,{s:r}=this,i=1;const o=[];for(;r<this.e;){const e=this.start.plus(t.mapUnits(e=>e*i));n=+e>+this.e?this.e:e,o.push(co.fromDateTimes(r,n)),r=n,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return!!this.isValid&&+this.e===+e.s}abutsEnd(e){return!!this.isValid&&+e.e===+this.s}engulfs(e){return!!this.isValid&&this.s<=e.s&&this.e>=e.e}equals(e){return!(!this.isValid||!e.isValid)&&this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:co.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return co.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const r=[],i=e.map(e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}]),o=[].concat(...i).sort((e,t)=>e.time-t.time);for(const e of o)n+="s"===e.type?1:-1,1===n?t=e.time:(t&&+t!==+e.time&&r.push(co.fromDateTimes(t,e.time)),t=null);return co.merge(r)}difference(...e){return co.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:lo}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Jt,t={}){return this.isValid?ci.create(this.s.loc.clone(t),e).formatInterval(this):lo}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:lo}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:lo}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:lo}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:lo}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ao.invalid(this.invalidReason)}mapEndpoints(e){return co.fromDateTimes(e(this.s),e(this.e))}}class uo{static hasDST(e=or.defaultZone){const t=es.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return $n.isValidZone(e)}static normalizeZone(e){return Un(e,or.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Bn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Bn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Bn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Bn.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Bn.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Bn.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Bn.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Bn.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Bn.create(t,null,"gregory").eras(e)}static features(){return{relative:Sr(),localeWeek:_r()}}}function ho(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(ao.fromMillis(r).as("days"))}function mo(e,t=e=>e){return{regex:e,deser:([e])=>t(function(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);if(-1!==e[n].search(Yn.hanidec))t+=Gn.indexOf(e[n]);else for(const e in Zn){const[n,i]=Zn[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const fo=`[ ${String.fromCharCode(160)}]`,po=new RegExp(fo,"g");function go(e){return e.replace(/\./g,"\\.?").replace(po,fo)}function yo(e){return e.replace(/\./g,"").replace(po," ").toLowerCase()}function vo(e,t){return null===e?null:{regex:RegExp(e.map(go).join("|")),deser:([n])=>e.findIndex(e=>yo(n)===yo(e))+t}}function wo(e,t){return{regex:e,deser:([,e,t])=>qr(e,t),groups:t}}function bo(e){return{regex:e,deser:([e])=>e}}const xo={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let ko=null;function No(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=$o(ci.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class So{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=No(ci.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=Qn(t),r=Qn(t,"{2}"),i=Qn(t,"{3}"),o=Qn(t,"{4}"),s=Qn(t,"{6}"),a=Qn(t,"{1,2}"),l=Qn(t,"{1,3}"),c=Qn(t,"{1,6}"),u=Qn(t,"{1,9}"),d=Qn(t,"{2,4}"),h=Qn(t,"{4,6}"),m=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},f=(f=>{if(e.literal)return m(f);switch(f.val){case"G":return vo(t.eras("short"),0);case"GG":return vo(t.eras("long"),0);case"y":return mo(c);case"yy":case"kk":return mo(d,Br);case"yyyy":case"kkkk":return mo(o);case"yyyyy":return mo(h);case"yyyyyy":return mo(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return mo(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return mo(r);case"MMM":return vo(t.months("short",!0),1);case"MMMM":return vo(t.months("long",!0),1);case"LLL":return vo(t.months("short",!1),1);case"LLLL":return vo(t.months("long",!1),1);case"o":case"S":return mo(l);case"ooo":case"SSS":return mo(i);case"u":return bo(u);case"uu":return bo(a);case"uuu":case"E":case"c":return mo(n);case"a":return vo(t.meridiems(),0);case"EEE":return vo(t.weekdays("short",!1),1);case"EEEE":return vo(t.weekdays("long",!1),1);case"ccc":return vo(t.weekdays("short",!0),1);case"cccc":return vo(t.weekdays("long",!0),1);case"Z":case"ZZ":return wo(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return wo(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return bo(/[a-z_+-/]{1,256}?/i);case" ":return bo(/[^\S\n\r]/);default:return m(f)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return f.token=e,f}(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){const[e,t]=function(e){const t=e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,"");return[`^${t}$`,e]}(this.units);this.regex=RegExp(e,"i"),this.handlers=t}}explainFromTokens(e){if(this.isValid){const[t,n]=function(e,t,n){const r=e.match(t);if(r){const e={};let t=1;for(const i in n)if(Cr(n,i)){const o=n[i],s=o.groups?o.groups+1:1;!o.literal&&o.token&&(e[o.token.val[0]]=o.deser(r.slice(t,t+s))),t+=s}return[r,e]}return[r,{}]}(e,this.regex,this.handlers),[r,i,o]=n?function(e){let t,n=null;xr(e.z)||(n=$n.create(e.z)),xr(e.Z)||(n||(n=new qn(e.Z)),t=e.Z),xr(e.q)||(e.M=3*(e.q-1)+1),xr(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),xr(e.u)||(e.S=zr(e.u));const r=Object.keys(e).reduce((t,n)=>{const r=(e=>{switch(e){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(n);return r&&(t[r]=e[n]),t},{});return[r,n,t]}(n):[null,null,void 0];if(Cr(n,"a")&&Cr(n,"H"))throw new Ht("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:o}}return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function _o(e,t,n){return new So(e,n).explainFromTokens(t)}function $o(e,t){if(!e)return null;const n=ci.create(t,e).dtFormatter((ko||(ko=es.fromMillis(1555555555555)),ko)),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>function(e,t,n){const{type:r,value:i}=e;if("literal"===r){const e=/^\s+$/.test(i);return{literal:!e,val:e?" ":i}}const o=t[r];let s=r;"hour"===r&&(s=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let a=xo[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const Co="Invalid DateTime",Io=864e13;function To(e){return new sr("unsupported zone",`the zone "${e.name}" is not supported`)}function Eo(e){return null===e.weekData&&(e.weekData=fr(e.c)),e.weekData}function Po(e){return null===e.localWeekData&&(e.localWeekData=fr(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Do(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new es({...n,...t,old:n})}function zo(e,t,n){let r=e-60*t*1e3;const i=n.offset(r);if(t===i)return[r,t];r-=60*(i-t)*1e3;const o=n.offset(r);return i===o?[r,i]:[e-60*Math.min(i,o)*1e3,Math.max(i,o)]}function Ro(e,t){const n=new Date(e+=60*t*1e3);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Mo(e,t,n){return zo(Wr(e),t,n)}function Oo(e,t){const n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),o={...e.c,year:r,month:i,day:Math.min(e.c.day,jr(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=ao.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),a=Wr(o);let[l,c]=zo(a,n,e.zone);return 0!==s&&(l+=s,c=e.zone.offset(l)),{ts:l,o:c}}function jo(e,t,n,r,i,o){const{setZone:s,zone:a}=n;if(e&&0!==Object.keys(e).length||t){const r=t||a,i=es.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return es.invalid(new sr("unparsable",`the input "${i}" can't be parsed as ${r}`))}function Wo(e,t,n=!0){return e.isValid?ci.create(Bn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Ao(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=Er(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=Er(e.c.month),"month"===n)return i;i+="-"}else if(i+=Er(e.c.month),"month"===n)return i;return i+=Er(e.c.day),i}function Lo(e,t,n,r,i,o,s){let a=!n||0!==e.c.millisecond||0!==e.c.second,l="";switch(s){case"day":case"month":case"year":break;default:if(l+=Er(e.c.hour),"hour"===s)break;if(t){if(l+=":",l+=Er(e.c.minute),"minute"===s)break;a&&(l+=":",l+=Er(e.c.second))}else{if(l+=Er(e.c.minute),"minute"===s)break;a&&(l+=Er(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(l+=".",l+=Er(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?l+="Z":e.o<0?(l+="-",l+=Er(Math.trunc(-e.o/60)),l+=":",l+=Er(Math.trunc(-e.o%60))):(l+="+",l+=Er(Math.trunc(e.o/60)),l+=":",l+=Er(Math.trunc(e.o%60)))),o&&(l+="["+e.zone.ianaName+"]"),l}const Bo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Fo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},qo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ho=["year","month","day","hour","minute","second","millisecond"],Uo=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Yo=["year","ordinal","hour","minute","second","millisecond"];function Zo(e){const t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new Ut(e);return t}function Go(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Zo(e)}}function Vo(e,t){const n=Un(t.zone,or.defaultZone);if(!n.isValid)return es.invalid(To(n));const r=Bn.fromObject(t);let i,o;if(xr(e.year))i=or.now();else{for(const t of Ho)xr(e[t])&&(e[t]=Bo[t]);const t=wr(e)||br(e);if(t)return es.invalid(t);const r=function(e){if(void 0===Ko&&(Ko=or.now()),"iana"!==e.type)return e.offset(Ko);const t=e.name;let n=Xo.get(t);return void 0===n&&(n=e.offset(Ko),Xo.set(t,n)),n}(n);[i,o]=Mo(e,r,n)}return new es({ts:i,zone:n,loc:r,o:o})}function Qo(e,t,n){const r=!!xr(n.round)||n.round,i=xr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=Rr(e,r||n.calendary?0:2,n.calendary?"round":i),t.loc.clone(n).relFormatter(n).format(e,o)),s=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return o(s(n.unit),n.unit);for(const e of n.units){const t=s(e);if(Math.abs(t)>=1)return o(t,e)}return o(e>t?-0:0,n.units[n.units.length-1])}function Jo(e){let t,n={};return e.length>0&&"object"==typeof e[e.length-1]?(n=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[n,t]}let Ko;const Xo=new Map;class es{constructor(e){const t=e.zone||or.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new sr("invalid input"):null)||(t.isValid?null:To(t));this.ts=xr(e.ts)?or.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{const o=kr(e.o)&&!e.old?e.o:t.offset(this.ts);r=Ro(this.ts,o),n=Number.isNaN(r.year)?new sr("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||Bn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new es({})}static local(){const[e,t]=Jo(arguments),[n,r,i,o,s,a,l]=t;return Vo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:l},e)}static utc(){const[e,t]=Jo(arguments),[n,r,i,o,s,a,l]=t;return e.zone=qn.utcInstance,Vo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:l},e)}static fromJSDate(e,t={}){const n=function(e){return"[object Date]"==={}.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(n))return es.invalid("invalid input");const r=Un(t.zone,or.defaultZone);return r.isValid?new es({ts:n,zone:r,loc:Bn.fromObject(t)}):es.invalid(To(r))}static fromMillis(e,t={}){if(kr(e))return e<-Io||e>Io?es.invalid("Timestamp out of range"):new es({ts:e,zone:Un(t.zone,or.defaultZone),loc:Bn.fromObject(t)});throw new Yt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(kr(e))return new es({ts:1e3*e,zone:Un(t.zone,or.defaultZone),loc:Bn.fromObject(t)});throw new Yt("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Un(t.zone,or.defaultZone);if(!n.isValid)return es.invalid(To(n));const r=Bn.fromObject(t),i=Ur(e,Go),{minDaysInFirstWeek:o,startOfWeek:s}=vr(i,r),a=or.now(),l=xr(t.specificOffset)?n.offset(a):t.specificOffset,c=!xr(i.ordinal),u=!xr(i.year),d=!xr(i.month)||!xr(i.day),h=u||d,m=i.weekYear||i.weekNumber;if((h||c)&&m)throw new Ht("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&c)throw new Ht("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!h;let p,g,y=Ro(a,l);f?(p=Uo,g=Fo,y=fr(y,o,s)):c?(p=Yo,g=qo,y=gr(y)):(p=Ho,g=Bo);let v=!1;for(const e of p)xr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=f?function(e,t=4,n=1){const r=Nr(e.weekYear),i=Tr(e.weekNumber,1,Lr(e.weekYear,t,n)),o=Tr(e.weekday,1,7);return r?i?!o&&cr("weekday",e.weekday):cr("week",e.weekNumber):cr("weekYear",e.weekYear)}(i,o,s):c?function(e){const t=Nr(e.year),n=Tr(e.ordinal,1,Or(e.year));return t?!n&&cr("ordinal",e.ordinal):cr("year",e.year)}(i):wr(i),b=w||br(i);if(b)return es.invalid(b);const x=f?pr(i,o,s):c?yr(i):i,[k,N]=Mo(x,l,n),S=new es({ts:k,zone:n,o:N,loc:r});return i.weekday&&h&&e.weekday!==S.weekday?es.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${S.toISO()}`):S.isValid?S:es.invalid(S.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return mi(e,[Ai,qi],[Li,Hi],[Bi,Ui],[Fi,Yi])}(e);return jo(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return mi(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[Di,zi])}(e);return jo(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return mi(e,[Ri,ji],[Mi,ji],[Oi,Wi])}(e);return jo(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(xr(e)||xr(t))throw new Yt("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Bn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,l,c]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=_o(e,t,n);return[r,i,o,s]}(o,e,t);return c?es.invalid(c):jo(s,a,n,`format ${t}`,e,l)}static fromString(e,t,n={}){return es.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return mi(e,[Gi,qi],[Vi,Qi])}(e);return jo(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Yt("need to specify a reason the DateTime is invalid");const n=e instanceof sr?e:new sr(e,t);if(or.throwOnInvalid)throw new Bt(n);return new es({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=$o(e,Bn.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return No(ci.parseFormat(e),Bn.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Ko=void 0,Xo.clear()}get(e){return this[e]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this.ie}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Eo(this).weekYear:NaN}get weekNumber(){return this.isValid?Eo(this).weekNumber:NaN}get weekday(){return this.isValid?Eo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Po(this).weekday:NaN}get localWeekNumber(){return this.isValid?Po(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Po(this).weekYear:NaN}get ordinal(){return this.isValid?gr(this.c).ordinal:NaN}get monthShort(){return this.isValid?uo.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?uo.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?uo.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?uo.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=Wr(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),o=this.zone.offset(n-r*t),s=this.zone.offset(n-i*t);if(o===s)return[this];const a=n-o*t,l=n-s*t,c=Ro(a,o),u=Ro(l,s);return c.hour===u.hour&&c.minute===u.minute&&c.second===u.second&&c.millisecond===u.millisecond?[Do(this,{ts:a}),Do(this,{ts:l})]:[this]}get isInLeapYear(){return Mr(this.year)}get daysInMonth(){return jr(this.year,this.month)}get daysInYear(){return this.isValid?Or(this.year):NaN}get weeksInWeekYear(){return this.isValid?Lr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Lr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=ci.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(qn.instance(e),t)}toLocal(){return this.setZone(or.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=Un(e,or.defaultZone)).equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||n){const t=e.offset(this.ts),n=this.toObject();[r]=Mo(n,t,e)}return Do(this,{ts:r,zone:e})}return es.invalid(To(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return Do(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Ur(e,Go),{minDaysInFirstWeek:n,startOfWeek:r}=vr(t,this.loc),i=!xr(t.weekYear)||!xr(t.weekNumber)||!xr(t.weekday),o=!xr(t.ordinal),s=!xr(t.year),a=!xr(t.month)||!xr(t.day),l=s||a,c=t.weekYear||t.weekNumber;if((l||o)&&c)throw new Ht("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Ht("Can't mix ordinal dates with month/day");let u;i?u=pr({...fr(this.c,n,r),...t},n,r):xr(t.ordinal)?(u={...this.toObject(),...t},xr(t.day)&&(u.day=Math.min(jr(u.year,u.month),u.day))):u=yr({...gr(this.c),...t});const[d,h]=Mo(u,this.o,this.zone);return Do(this,{ts:d,o:h})}plus(e){return this.isValid?Do(this,Oo(this,ao.fromDurationLike(e))):this}minus(e){return this.isValid?Do(this,Oo(this,ao.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=ao.normalizeUnit(e);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0}if("weeks"===r)if(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;if("quarters"===r){const e=Math.ceil(this.month/3);n.month=3*(e-1)+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?ci.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Co}toLocaleString(e=Jt,t={}){return this.isValid?ci.create(this.loc.clone(t),e).formatDateTime(this):Co}toLocaleParts(e={}){return this.isValid?ci.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const s="extended"===e;let a=Ao(this,s,o=Zo(o));return Ho.indexOf(o)>=3&&(a+="T"),a+=Lo(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Ao(this,"extended"===e,Zo(t)):null}toISOWeekDate(){return Wo(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:s="milliseconds"}={}){return this.isValid?(s=Zo(s),(r&&Ho.indexOf(s)>=3?"T":"")+Lo(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return Wo(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Wo(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Ao(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(t||e)&&(n&&(r+=" "),t?r+="z":e&&(r+="ZZ")),Wo(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Co}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return ao.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=(a=t,Array.isArray(a)?a:[a]).map(ao.normalizeUnit),o=e.valueOf()>this.valueOf(),s=function(e,t,n,r){let[i,o,s,a]=function(e,t,n){const r=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const n=ho(e,t);return(n-n%7)/7}],["days",ho]],i={},o=e;let s,a;for(const[l,c]of r)n.indexOf(l)>=0&&(s=l,i[l]=c(e,t),a=o.plus(i),a>t?(i[l]--,(e=o.plus(i))>t&&(a=e,i[l]--,e=o.plus(i))):e=a);return[e,i,a,s]}(e,t,n);const l=t-i,c=n.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===c.length&&(s<t&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+l/(s-i)));const u=ao.fromObject(o,r);return c.length>0?ao.fromMillis(l,r).shiftTo(...c).plus(u):u}(o?this:e,o?e:this,i,r);var a;return o?s.negate():s}diffNow(e="milliseconds",t={}){return this.diff(es.now(),e,t)}until(e){return this.isValid?co.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||es.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(r=e.unit,i=void 0),Qo(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Qo(e.base||es.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(es.isDateTime))throw new Yt("min requires all arguments be DateTimes");return $r(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(es.isDateTime))throw new Yt("max requires all arguments be DateTimes");return $r(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return _o(Bn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return es.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=Bn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new So(i,e)}static fromFormatParser(e,t,n={}){if(xr(e)||xr(t))throw new Yt("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Bn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new Yt(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:s,zone:a,specificOffset:l,invalidReason:c}=t.explainFromTokens(e);return c?es.invalid(c):jo(s,a,n,`format ${t.format}`,e,l)}static get DATE_SHORT(){return Jt}static get DATE_MED(){return Kt}static get DATE_MED_WITH_WEEKDAY(){return Xt}static get DATE_FULL(){return en}static get DATE_HUGE(){return tn}static get TIME_SIMPLE(){return nn}static get TIME_WITH_SECONDS(){return rn}static get TIME_WITH_SHORT_OFFSET(){return on}static get TIME_WITH_LONG_OFFSET(){return sn}static get TIME_24_SIMPLE(){return an}static get TIME_24_WITH_SECONDS(){return ln}static get TIME_24_WITH_SHORT_OFFSET(){return cn}static get TIME_24_WITH_LONG_OFFSET(){return un}static get DATETIME_SHORT(){return dn}static get DATETIME_SHORT_WITH_SECONDS(){return hn}static get DATETIME_MED(){return mn}static get DATETIME_MED_WITH_SECONDS(){return fn}static get DATETIME_MED_WITH_WEEKDAY(){return pn}static get DATETIME_FULL(){return gn}static get DATETIME_FULL_WITH_SECONDS(){return yn}static get DATETIME_HUGE(){return vn}static get DATETIME_HUGE_WITH_SECONDS(){return wn}}function ts(e){if(es.isDateTime(e))return e;if(e&&e.valueOf&&kr(e.valueOf()))return es.fromJSDate(e);if(e&&"object"==typeof e)return es.fromObject(e);throw new Yt(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function ns({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return qe("div",{className:Ct.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:bt.colors.accent}),children:qe("div",{className:Ct.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1",boxSizing:"border-box",overflowX:"hidden"}),children:[!i&&qe("div",{className:Ct.create("page-heading-wrapper",{width:"100%",marginBottom:bt.spacing.lg}),children:qe(Mt,{children:qe("div",{className:Ct.create("page-heading-container",{backgroundColor:bt.colors.primary,color:bt.colors.primaryForeground,borderRadius:bt.radius.large,padding:`${bt.spacing.lg} ${bt.spacing.xl}`,boxShadow:bt.shadow.md}),children:qe("div",{className:Ct.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:bt.spacing.lg}),children:qe("div",{className:Ct.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[qe("h1",{className:Ct.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:bt.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&qe("p",{className:Ct.create("page-template-description",{margin:"0",marginTop:bt.spacing.sm,fontSize:bt.fontSize.small,lineHeight:"1.5",color:bt.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function rs({className:e,children:t}){const n=Ct.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return qe("div",{className:zt(n,e),children:t})}function is({message:e}){return qe(ns,{title:"Loading",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe(rs,{className:Ct.name("loading-container"),children:qe(Rt,{size:"large"})})})})}function os({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const l={primary:{backgroundColor:bt.colors.primary,color:bt.colors.primaryForeground,boxShadow:bt.shadow.sm},outline:{border:`${bt.borderWidth} solid ${bt.colors.primary}`,backgroundColor:bt.colors.card,color:bt.colors.primary,boxShadow:bt.shadow.sm}},c=Ct.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:bt.radius.default,cursor:"pointer",fontSize:bt.fontSize.default,fontWeight:"500",transition:bt.transition,fontFamily:bt.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"}),u=Ct.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"});Ct.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:bt.shadow.md}),Ct.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:bt.shadow.sm});const d=Ct.create(`button-${e}`,{...l[e]});return qe("button",{type:t,className:zt(c,u,d,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&qe(Rt,{size:"small"}),o]})}function ss({error:e}){const t=e||{title:"Something Went Wrong",message:"We're unable to load the application at this time."},n=t.trackingId?t.trackingId.replace(/[^a-zA-Z0-9]/g,"").slice(0,8).toUpperCase():null;return qe(ns,{title:t.title,noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe("div",{className:Ct.create("error-page-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:qe("div",{className:Ct.create("error-page-card",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"500px"}),children:[qe("div",{className:Ct.create("error-page-header",{paddingInline:bt.spacing.xl,paddingTop:bt.spacing.xl,paddingBottom:bt.spacing.lg,textAlign:"center"},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingTop:bt.spacing.md}}),children:[qe("div",{className:Ct.create("error-page-icon-wrapper",{display:"flex",justifyContent:"center",marginBottom:bt.spacing.lg}),children:qe("div",{className:Ct.create("error-page-icon-circle",{width:"4rem",height:"4rem",borderRadius:"50%",backgroundColor:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center"}),children:qe("svg",{className:Ct.create("error-page-icon",{width:"2rem",height:"2rem",color:bt.colors.destructive}),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:qe("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})})}),qe("h2",{className:Ct.create("error-page-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:t.title}),qe("p",{className:Ct.create("error-page-description",{margin:"0",marginTop:bt.spacing.sm,fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.mutedForeground}),children:t.message})]}),qe("div",{className:Ct.create("error-page-content",{paddingInline:bt.spacing.xl,paddingBottom:bt.spacing.xl},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingBottom:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingBottom:bt.spacing.md}}),children:[n&&qe("p",{className:Ct.create("error-page-support",{margin:"0",marginBottom:bt.spacing.lg,fontSize:bt.fontSize.small,lineHeight:"1.5",color:bt.colors.mutedForeground,textAlign:"center"}),children:["If this problem persists, please contact support with reference"," ",qe("span",{className:Ct.create("error-page-ref",{fontFamily:"monospace",fontWeight:"600",color:bt.colors.foreground}),children:n})]}),qe(os,{onClick:()=>{window.location.reload()},className:Ct.create("error-page-button",{width:"100%"}),children:"Try Again"})]})]})})})})}function as({message:e,estimatedTime:t}){const n=Ct.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=Ct.create("maintenance-icon",{width:"4rem",height:"4rem",color:bt.colors.primary,marginBottom:"1.5rem"}),i=Ct.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:bt.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=Ct.create("maintenance-message",{fontSize:bt.fontSize.default,color:bt.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=Ct.create("maintenance-info-box",{backgroundColor:bt.colors.muted,borderRadius:bt.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=Ct.create("maintenance-info-title",{fontSize:bt.fontSize.default,fontWeight:"600",color:bt.colors.foreground,marginBottom:"0.5rem"}),l=Ct.create("maintenance-info-text",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,lineHeight:"1.4"}),c=Ct.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return qe(ns,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:qe(Mt,{children:qe(rs,{children:qe("div",{className:n,children:[qe(()=>qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:r,children:qe("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),{}),qe("h1",{className:i,children:"We'll be right back"}),qe("p",{className:o,children:e||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),qe("div",{className:s,children:[qe("p",{className:a,children:"What's happening?"}),qe("p",{className:l,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),t&&qe("p",{className:l,style:{marginTop:"0.5rem"},children:[qe("strong",{children:"Estimated time:"})," ",t]})]}),qe("div",{className:c,children:qe(os,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function ls({size:e="default",style:t="normal",className:n,children:r}){const i=Ct.create("text",{marginTop:"0",marginBottom:"0"}),o=Ct.create("text-small",{fontSize:bt.fontSize.small}),s=Ct.create("text-default",{fontSize:bt.fontSize.default}),a=Ct.create("text-italic",{fontStyle:"italic"}),l=Ct.create("text-bold",{fontWeight:"bold"}),c=Ct.create("text-underline",{textDecoration:"underline"}),u=zt({[a]:"italic"===t,[l]:"bold"===t,[c]:"underline"===t}),d=zt({[o]:"small"===e,[s]:"default"===e});return qe("p",{className:zt(i,d,u,n),children:r})}function cs({title:e,description:t}){return qe("div",{className:Ct.create("section-header",{}),children:[qe("h3",{className:Ct.create("section-title",{fontSize:bt.fontSize.large,fontWeight:"600",margin:"0",color:bt.colors.foreground}),children:e}),t&&qe(ls,{className:Ct.create("section-description",{color:bt.colors.mutedForeground,margin:"0.25rem 0 0 0"}),children:"Choose your excess amount - the amount you'll pay if you need to make a claim"})]})}function us({selected:e}){return qe("div",{className:zt(Ct.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${bt.borderWidth} solid transparent`}),e?Ct.create("selected-indicator-selected",{backgroundColor:bt.colors.primary}):Ct.create("selected-indicator-unselected",{border:`${bt.borderWidth} solid ${bt.colors.border}`}))})}function ds({excessOptions:e,selectedExcessId:t,onExcessSelect:n}){const r=[...e].sort((e,t)=>e.excess_amount-t.excess_amount),i=e.find(e=>e.id===t);return qe("div",{className:Ct.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[qe(cs,{title:1===e.length?"Excess":"Excess Options"}),qe("div",{className:Ct.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return qe("div",{className:zt(Ct.create("excess-option-card",{borderRadius:bt.radius.default,minWidth:"125px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?Ct.create("excess-option-card-selected",{border:`2px solid ${bt.colors.primary}`,backgroundColor:bt.colors.accent}):Ct.create("excess-option-card-unselected",{border:`2px solid ${bt.colors.border}`,backgroundColor:bt.colors.card})),onClick:()=>n(e.id),children:[qe(us,{selected:r}),qe("div",{className:Ct.create("excess-amount",{color:bt.colors.foreground}),children:[e.excess_label||`$${Number(e.excess_amount).toFixed(0)}`,e.description?"*":""]})]},e.id)})}),(null==i?void 0:i.description)&&qe("div",{className:Ct.create("excess-description",{padding:"0.75rem",backgroundColor:bt.colors.muted,borderRadius:bt.radius.default,border:`1px solid ${bt.colors.border}`}),children:qe(ls,{className:Ct.create("excess-description-text",{fontSize:bt.fontSize.small,color:bt.colors.foreground,margin:"0"}),children:i.description})})]})}function hs(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function ms(e,t){return"bank_transfer"===t?"Bank Transfer":"one-time"===e?"Online Payment":"monthly"===e?"Monthly Installments":`${e.charAt(0).toUpperCase()}${e.slice(1)} Installments`}function fs({paymentOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=at(()=>{if(!n)return[];const r=e.filter(e=>e.excess_id===n).map(e=>{const n=t.find(t=>t.id===e.gateway_id);if(!n)throw new Error(`Gateway not found for option: ${e.gateway_id}`);return{...e,gateway:n}});return r.sort((e,t)=>{var n,r;return e.amount.success!==t.amount.success?e.amount.success?-1:1:("one-time"===e.amount.frequency?Number(e.amount.dueToday):Number(null!==(n=e.amount.installmentAmount)&&void 0!==n?n:0))-("one-time"===t.amount.frequency?Number(t.amount.dueToday):Number(null!==(r=t.amount.installmentAmount)&&void 0!==r?r:0))})},[e,t,n]);return n?qe(ps,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):qe("div",{className:Ct.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:qe(ps,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function ps({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return qe("div",{className:Ct.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[qe(cs,{title:"Payment Options"}),qe("div",r?{className:Ct.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>qe(gs,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${e.excess_id}`))}:{className:Ct.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${bt.colors.border}`,borderRadius:bt.radius.default,backgroundColor:bt.colors.muted}),children:qe(ls,{className:Ct.create("placeholder-text",{color:bt.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function gs({option:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=(null==t?void 0:t.gateway_id)===e.gateway_id&&(null==t?void 0:t.excess_id)===e.excess_id,i=e.amount.success,o=()=>i?"one-time"===e.amount.frequency?hs(e.amount.dueToday):`${hs(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`:"Currently Unavailable",s=()=>e.gateway.description?e.gateway.description:"bank_transfer"===e.gateway.code?"Manual":`via ${e.gateway.name}`;return qe("div",{className:zt(Ct.create("payment-option-row",{borderRadius:bt.radius.default,padding:"0.75rem 1rem",cursor:i?"pointer":"not-allowed",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",opacity:i?"1":"0.6"},{"(max-width: 950px)":{padding:"0.75rem",flexDirection:"column",alignItems:"stretch",gap:"0.25rem"}}),r?Ct.create("payment-option-row-selected",{border:`2px solid ${bt.colors.primary}`,backgroundColor:bt.colors.accent}):Ct.create("payment-option-row-unselected",{border:`2px solid ${bt.colors.border}`,backgroundColor:bt.colors.card})),onClick:()=>i&&n(e),children:[qe("div",{className:Ct.create("payment-option-desktop-wrapper",{display:"flex",flexDirection:"column",flex:"1"},{"(max-width: 950px)":{display:"none"}}),children:[qe("div",{className:Ct.create("frequency-title",{fontSize:bt.fontSize.default,fontWeight:"500",color:bt.colors.foreground}),children:e.gateway.display_title||ms(e.amount.frequency,e.gateway.code)}),qe("div",{className:Ct.create("gateway-description",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground}),children:s()})]}),qe("div",{className:Ct.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 950px)":{display:"none"}}),children:[qe(ls,{className:i?Ct.create("amount-text",{textAlign:"right",color:bt.colors.foreground,fontStyle:"normal"}):Ct.create("amount-text-unavailable",{textAlign:"right",color:bt.colors.mutedForeground,fontStyle:"italic"}),children:o()}),i&&"bank_transfer"!==e.gateway.code&&qe(ls,{size:"small",className:Ct.create("gateway-fee-text",{textAlign:"right",color:bt.colors.mutedForeground}),children:[hs(e.amount.gatewayFee)," fee"]}),i&&"bank_transfer"===e.gateway.code&&qe(ls,{size:"small",className:Ct.create("no-fee-text",{textAlign:"right",color:bt.colors.mutedForeground}),children:"No fees"})]}),qe("div",{className:Ct.create("payment-option-mobile-wrapper",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:"0.125rem"}}),children:[qe("div",{className:Ct.create("payment-option-title-mobile",{fontSize:bt.fontSize.default,fontWeight:"500",color:bt.colors.foreground}),children:e.gateway.display_title||ms(e.amount.frequency,e.gateway.code)}),qe(ls,{className:i?Ct.create("amount-text-mobile",{fontWeight:"500",color:bt.colors.foreground,fontStyle:"normal"}):Ct.create("amount-text-mobile-unavailable",{fontWeight:"500",color:bt.colors.mutedForeground,fontStyle:"italic"}),children:[o(),i&&e.amount.gatewayFee>0&&qe("span",{className:Ct.create("gateway-fee-inline",{fontWeight:"400",fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,marginLeft:"0.375rem"}),children:["(",hs(e.amount.gatewayFee)," fee)"]})]}),qe("div",{className:Ct.create("gateway-description-mobile",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground}),children:s()})]})]})}const ys=e=>{try{return new Date(e).toLocaleDateString("en-NZ",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}};function vs({excessOptions:e,selectedExcessId:t,onEditQuote:n,isEditingQuote:r=!1,productName:i,quoteIntent:o,embedded:s=!1}){const a=at(()=>t?e.find(e=>e.id===t):null,[e,t]),l=(null==a?void 0:a.line_item_display)||[],{formProgress:c}=At(e=>({formProgress:e.getFormProgress()})),u=at(()=>{var e;const t=(null==c?void 0:c.page_data)||(null===(e=null==o?void 0:o.form_data)||void 0===e?void 0:e.page_data);if(!t)return null;let n={};for(const e in t){const r=t[e];r&&"object"==typeof r&&(r.client_first_name&&(n.firstName=r.client_first_name),r.client_last_name&&(n.lastName=r.client_last_name),r.client_email&&(n.email=r.client_email),r.client_phone&&(n.phone=r.client_phone),r.client_dob&&(n.dob=r.client_dob))}return Object.keys(n).length>0?n:null},[c,o]);return qe("div",{className:Ct.create(s?"cart-summary-container-embedded":"cart-summary-container",s?{}:{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.lg,boxShadow:bt.shadow.sm},s?{}:{"(max-width: 768px)":{padding:bt.spacing.md}}),children:[qe("h3",{className:Ct.create("cart-summary-title",{fontSize:bt.fontSize.large,fontWeight:"600",marginBottom:bt.spacing.md,color:bt.colors.foreground}),children:"Insurance Details"}),u&&qe($,{children:[qe("div",{className:Ct.create("cart-client-details",{display:"flex",flexDirection:"column",gap:bt.spacing.sm,marginBottom:bt.spacing.md}),children:[u.firstName&&u.lastName&&qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Name"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:[u.firstName," ",u.lastName]})]}),u.email&&qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Email"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:u.email})]}),u.phone&&qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Phone"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:u.phone})]}),u.dob&&qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Date of Birth"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:ys(u.dob)})]})]}),qe("hr",{className:Ct.create("divider",{border:"none",borderTop:`1px solid ${bt.colors.border}`,margin:`${bt.spacing.md} 0`})})]}),qe("div",{className:Ct.create("cart-product-section",{display:"flex",flexDirection:"column",gap:bt.spacing.sm,marginBottom:bt.spacing.lg}),children:l.map((e,t)=>qe("div",{className:Ct.create("cart-item",{display:"flex",flexDirection:"column",gap:bt.spacing.sm}),children:[qe("div",{className:Ct.create("cart-item-description",{fontSize:bt.fontSize.small,fontWeight:"500",color:bt.colors.foreground}),children:e.description}),e.show_sum_insured&&e.sum_insured&&qe("div",{className:Ct.create("cart-item-sum-insured",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground}),children:["Sum Insured: ",hs(e.sum_insured)]})]},t))}),qe(os,{onClick:n,disabled:r,variant:"outline",className:Ct.create("edit-quote-button",{width:"100%"}),children:r?"Clearing quote...":"Edit details"})]})}function ws({clauses:e}){const[t,n]=it(!0);return 0===e.length?null:qe("div",{className:Ct.create("policy-clauses-section",{borderRadius:bt.radius.default,border:`1px solid ${bt.colors.border}`,overflow:"hidden"}),children:[qe("button",{type:"button",onClick:()=>n(!t),className:Ct.create("policy-clauses-toggle",{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:`${bt.spacing.sm} ${bt.spacing.md}`,background:"none",border:"none",cursor:"pointer",fontFamily:"inherit",textAlign:"left"}),children:[qe("div",{className:Ct.create("policy-clauses-header",{display:"flex",alignItems:"center",gap:bt.spacing.sm}),children:[qe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:bt.colors.mutedForeground,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[qe("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),qe("polyline",{points:"14 2 14 8 20 8"}),qe("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),qe("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),qe("polyline",{points:"10 9 9 9 8 9"})]}),qe("span",{className:Ct.create("policy-clauses-title",{fontSize:bt.fontSize.small,fontWeight:"500",color:bt.colors.foreground,opacity:"0.7"}),children:"Policy Clauses"})]}),qe("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:bt.colors.mutedForeground,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{transition:"transform 0.2s ease",transform:t?"rotate(180deg)":"rotate(0deg)"},children:qe("polyline",{points:"6 9 12 15 18 9"})})]}),t&&qe("div",{className:Ct.create("policy-clauses-content",{padding:`0 ${bt.spacing.md} ${bt.spacing.md}`,borderTop:`1px solid ${bt.colors.border}`,paddingTop:bt.spacing.md}),children:qe("ul",{className:Ct.create("policy-clauses-list",{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:bt.spacing.sm}),children:e.map((e,t)=>qe("li",{className:Ct.create("policy-clause-item",{fontSize:bt.fontSize.small,color:bt.colors.foreground,opacity:"0.7",lineHeight:"1.5",paddingLeft:bt.spacing.md,position:"relative"}),children:[qe("span",{className:Ct.create("policy-clause-bullet",{position:"absolute",left:"0",top:"0.6em",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:bt.colors.mutedForeground,opacity:"0.5"})}),e.note||e.reference||""]},t))})})]})}function bs({label:e,value:t,isTotal:n=!1,className:r}){return qe("div",{className:zt(Ct.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[qe("span",{className:Ct.create("summary-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:e}),qe("span",{className:Ct.create("summary-value",{fontWeight:n?"600":"500",color:bt.colors.foreground,fontSize:n?bt.fontSize.large:"inherit"}),children:t})]})}function xs({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:l=!1}){var c;at(()=>n?e.find(e=>e.id===n):null,[e,n]);const u=at(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]);return qe("div",{className:Ct.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[r&&qe("div",{className:Ct.create("summary-section",{paddingBottom:"1rem"}),children:qe("div",{className:Ct.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?qe($,{children:[r.amount.gatewayFee>0&&qe(bs,{label:"windcave"===(null==u?void 0:u.code)?"Credit card surcharge:":"Provider Fee:",value:hs(r.amount.gatewayFee)}),qe(bs,{label:"Due Today:",value:hs(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0})]}):qe($,{children:[r.amount.gatewayFee>0&&qe(bs,{label:"windcave"===(null==u?void 0:u.code)?"Credit card surcharge:":"Provider Fee:",value:hs(r.amount.gatewayFee)}),r.amount.totalRepayable&&qe(bs,{label:"Total Payable:",value:hs(Number(r.amount.totalRepayable)+Number(null!==(c=r.amount.gatewayFee)&&void 0!==c?c:0))}),qe(bs,{label:"Due Today:",value:hs(r.amount.dueToday)}),r.amount.installmentAmount&&r.amount.numberOfInstallments&&r.amount.numberOfInstallments>1&&qe(bs,{label:"Remaining payments:",value:`${r.amount.numberOfInstallments-1} x ${hs(r.amount.installmentAmount)}`})]})})}),l&&qe("div",{className:Ct.create("continue-later-success",{backgroundColor:`${bt.colors.accent}`,padding:"12px 16px",borderRadius:bt.radius.default,borderLeft:`4px solid ${bt.colors.primary}`}),children:[qe("h4",{className:Ct.create("success-title",{margin:"0 0 4px 0",color:bt.colors.primary,fontSize:bt.fontSize.default,fontWeight:"600"}),children:"No problem!"}),qe("p",{className:Ct.create("success-text",{margin:"0",fontSize:bt.fontSize.small}),children:"A link will be sent to you by email. You can complete your purchase at any time using the link in the email."})]}),s&&qe(os,{onClick:s,disabled:a,variant:"outline",className:Ct.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:bt.fontSize.default,fontWeight:"500"},{"(max-width: 380px)":{fontSize:bt.fontSize.small,height:"2.5rem"}}),children:a?"Sending...":"Continue Later (Email Me)"}),qe(os,{onClick:i,disabled:!o,className:Ct.create("purchase-button",{width:"100%",height:"3rem",fontSize:bt.fontSize.default,fontWeight:"600"},{"(max-width: 380px)":{fontSize:bt.fontSize.small,height:"2.75rem"}}),children:o?"Go to Payment":n?"Select Payment Option":"Select Excess"})]})}function ks({details:e,onClose:t}){const n=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{})};return qe("div",{className:Ct.create("bank-transfer-container",{display:"flex",flexDirection:"column",gap:bt.spacing.lg}),children:[qe("div",{className:Ct.create("success-message",{backgroundColor:bt.colors.accent,border:`2px solid ${bt.colors.primary}`,borderRadius:bt.radius.default,padding:bt.spacing.lg,textAlign:"center"}),children:[qe("div",{className:Ct.create("success-icon",{fontSize:"3rem",marginBottom:bt.spacing.sm}),children:"✓"}),qe("h3",{className:Ct.create("success-title",{margin:"0",marginBottom:bt.spacing.sm,color:bt.colors.primary,fontSize:bt.fontSize.large,fontWeight:"600"}),children:"Quote Reserved"}),qe(ls,{className:Ct.create("success-description",{margin:"0",color:bt.colors.foreground,opacity:"0.9"}),children:"Your quote has been reserved. Please complete the bank transfer to finalize your coverage."})]}),qe("div",{className:Ct.create("transfer-instructions",{backgroundColor:bt.colors.card,border:`1px solid ${bt.colors.border}`,borderRadius:bt.radius.default,padding:bt.spacing.lg}),children:[qe("h4",{className:Ct.create("instructions-title",{margin:"0",marginBottom:bt.spacing.md,fontSize:bt.fontSize.default,fontWeight:"600",color:bt.colors.foreground}),children:"Bank Transfer Instructions"}),qe("div",{className:Ct.create("instructions-grid",{display:"grid",gap:bt.spacing.md}),children:[qe("div",{className:Ct.create("detail-row-highlighted",{backgroundColor:bt.colors.accent,border:`2px solid ${bt.colors.primary}`,borderRadius:bt.radius.default,padding:bt.spacing.md}),children:[qe("div",{className:Ct.create("detail-label",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,marginBottom:"0.25rem",fontWeight:"500"}),children:"Reference Number (IMPORTANT)"}),qe("div",{className:Ct.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[qe("code",{className:Ct.create("detail-value-code",{fontFamily:"monospace",fontSize:bt.fontSize.large,fontWeight:"700",color:bt.colors.primary,letterSpacing:"0.05em"}),children:e.reference}),qe("button",{onClick:()=>n(e.reference,"Reference"),className:Ct.create("copy-button",{background:"transparent",border:`1px solid ${bt.colors.primary}`,borderRadius:bt.radius.small,padding:"0.25rem 0.5rem",cursor:"pointer",fontSize:bt.fontSize.small,color:bt.colors.primary,transition:"all 150ms ease"}),children:"Copy"})]}),qe(ls,{size:"small",className:Ct.create("reference-note",{marginTop:"0.5rem",marginBottom:"0",color:bt.colors.foreground,fontWeight:"500"}),children:"⚠️ Please include this reference in your transfer particulars"})]}),qe("div",{className:Ct.create("detail-row",{}),children:[qe("div",{className:Ct.create("detail-label",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Amount"}),qe("div",{className:Ct.create("detail-value",{fontSize:bt.fontSize.large,fontWeight:"600",color:bt.colors.foreground}),children:["$",e.amount.toFixed(2)," ",e.currency]})]}),qe("div",{className:Ct.create("detail-row",{}),children:[qe("div",{className:Ct.create("detail-label",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Name"}),qe("div",{className:Ct.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[qe("span",{className:Ct.create("detail-value",{fontFamily:"monospace",fontSize:bt.fontSize.default,color:bt.colors.foreground}),children:e.bank_account_name}),qe("button",{onClick:()=>n(e.bank_account_name,"Account name"),className:Ct.create("copy-button-small",{background:"transparent",border:`1px solid ${bt.colors.border}`,borderRadius:bt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]}),qe("div",{className:Ct.create("detail-row",{}),children:[qe("div",{className:Ct.create("detail-label",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Number"}),qe("div",{className:Ct.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[qe("span",{className:Ct.create("detail-value",{fontFamily:"monospace",fontSize:bt.fontSize.default,color:bt.colors.foreground}),children:e.bank_account_number}),qe("button",{onClick:()=>n(e.bank_account_number,"Account number"),className:Ct.create("copy-button-small",{background:"transparent",border:`1px solid ${bt.colors.border}`,borderRadius:bt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]})]}),e.instructions_html&&qe("div",{className:Ct.create("additional-instructions",{marginTop:bt.spacing.md,paddingTop:bt.spacing.md,borderTop:`1px solid ${bt.colors.border}`}),children:qe("div",{className:Ct.create("instructions-content",{fontSize:bt.fontSize.small,color:bt.colors.foreground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:e.instructions_html}})})]}),qe("div",{className:Ct.create("important-note",{backgroundColor:bt.colors.muted,border:`1px solid ${bt.colors.border}`,borderRadius:bt.radius.default,padding:bt.spacing.md}),children:qe(ls,{size:"small",className:Ct.create("note-text",{margin:"0",color:bt.colors.foreground,lineHeight:"1.5"}),children:[qe("strong",{children:"Important:"})," Your coverage will be activated once we verify receipt of your payment. This typically takes 1-2 business days. We'll send you a confirmation email once your payment is processed."]})}),qe("div",{className:Ct.create("actions",{display:"flex",justifyContent:"center"}),children:qe(os,{onClick:t,variant:"primary",children:"I've Made the Transfer"})})]})}function Ns({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r}){const{fsm:i}=At(()=>({})),[o,s]=it("initiating"),[a,l]=it(null),[c,u]=it(null),[d,h]=it(null),[m,f]=it(null);ot(()=>{e&&r&&p()},[e,r]);const p=async()=>{if(r)try{s("initiating"),l(null);const e={...r,returnUrl:window.location.href},t=await i.initiatePayment(e);if(h(t.transaction_id),t.bank_account_name&&t.reference){s("bank_transfer");const e=i.getQuoteIntent(),t=await i.httpClient.getQuoteIntent(e.url);i.updateQuoteIntent({status:t.quote_intent.status,payment_transactions:t.payment_transactions}),i.getQuoteIntent(),setTimeout(()=>{g()},500)}else{if(!t.gateway_acceptance_url)throw new Error("Invalid payment response");s("redirecting"),window.location.href=t.gateway_acceptance_url}}catch(e){l(e.message||"Failed to initiate payment"),s("failed")}},g=()=>{c&&!c.closed&&c.close(),s("initiating"),l(null),h(null),u(null),f(null),t()},y=()=>{g(),n()};return e?qe("div","bank_transfer"===o&&m?{className:Ct.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000",overflowY:"auto",padding:"1rem"}),onClick:e=>{e.target===e.currentTarget&&y()},children:qe("div",{className:Ct.create("modal-content",{backgroundColor:bt.colors.background,borderRadius:bt.radius.large,padding:"2rem",maxWidth:"600px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${bt.colors.border}`,margin:"auto"}),onClick:e=>e.stopPropagation(),children:qe(ks,{details:m,onClose:y})})}:{className:Ct.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),children:[qe("div",{className:Ct.create("modal-content",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${bt.colors.border}`}),children:[qe("div",{className:Ct.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[qe("div",{className:Ct.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),qe("h2",{className:Ct.create("modal-title",{margin:"0",color:bt.colors.foreground,fontSize:bt.fontSize.large}),children:"Payment Processing"})]}),qe("div",{className:Ct.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[qe(ls,{className:Ct.create("status-message",{fontSize:bt.fontSize.default,color:bt.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(o){case"initiating":return"Setting up your payment...";case"redirecting":return"Redirecting to payment portal...";case"processing":default:return"Processing payment...";case"polling":return"Checking payment status...";case"completed":return"Payment completed successfully!";case"cancelled":return"Payment was cancelled";case"failed":return"Payment failed"}})()}),a&&qe(ls,{className:Ct.create("error-message",{color:bt.colors.destructive,fontSize:bt.fontSize.small,padding:"0.75rem",backgroundColor:bt.colors.destructive+"10",borderRadius:bt.radius.default,border:`1px solid ${bt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&qe("div",{className:Ct.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${bt.colors.border}`,borderTop:`3px solid ${bt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),qe("div",{className:Ct.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?qe($,{children:[qe(os,{onClick:g,variant:"outline",children:"Close"}),"cancelled"===o&&qe(os,{onClick:()=>{s("initiating"),l(null),p()},children:"Try Again"})]}):qe(os,"completed"===o?{onClick:g,children:"Continue"}:{onClick:g,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),qe("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Ss({type:e,transactionId:t,isOpen:n,onClose:r}){if(!n)return null;const i=(()=>{switch(e){case"success":return{title:"Payment Successful!",message:"Your payment has been processed successfully and your policy is now active.",icon:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:bt.colors.primary||"#10b981"},children:qe("path",{d:"M20 6 9 17l-5-5"})}),buttonText:"Close"};case"declined":return{title:"Payment Declined",message:"Your payment was declined by the payment processor. Please try a different payment method or contact your bank.",icon:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:bt.colors.destructive},children:[qe("circle",{cx:"12",cy:"12",r:"10"}),qe("path",{d:"m15 9-6 6"}),qe("path",{d:"m9 9 6 6"})]}),buttonText:"Close"};case"cancelled":return{title:"Payment Cancelled",message:"You cancelled the payment process. You can try again when you're ready.",icon:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:bt.colors.secondary},children:[qe("circle",{cx:"12",cy:"12",r:"10"}),qe("path",{d:"m15 9-6 6"}),qe("path",{d:"m9 9 6 6"})]}),buttonText:"Continue"};default:return{title:"Payment Error",message:"There was an issue processing your payment. Please try again or contact support if the problem persists.",icon:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:bt.colors.destructive},children:[qe("circle",{cx:"12",cy:"12",r:"10"}),qe("path",{d:"M12 8v4"}),qe("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=Ct.create("modal-overlay",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000",padding:"1rem"}),s=Ct.create("modal-content",{backgroundColor:bt.colors.background,borderRadius:bt.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${bt.borderWidth} solid ${bt.colors.border}`}),a=Ct.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),l=Ct.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:bt.colors.foreground,margin:"0"}),c=Ct.create("modal-message",{color:bt.colors.foreground,lineHeight:"1.5",margin:"0"});Ct.create("transaction-info",{backgroundColor:bt.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:bt.radius.small,border:`${bt.borderWidth} solid ${bt.colors.border}`,fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,wordBreak:"break-all"});const u=Ct.create("modal-button",{backgroundColor:bt.colors.primary,color:bt.colors.primaryForeground,border:"none",borderRadius:bt.radius.default,padding:"0.75rem 1.5rem",fontSize:bt.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=Ct.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return qe("div",{className:o,onClick:r,children:qe("div",{className:s,onClick:e=>e.stopPropagation(),children:qe("div",{className:a,children:[i.icon,qe("div",{className:d,children:[qe("h2",{className:l,children:i.title}),qe("p",{className:c,children:i.message})]}),qe("button",{className:u,onClick:r,children:i.buttonText})]})})})}function _s({results:e}){const{fsm:t,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=At(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[s,a]=it(!1),[l,c]=it(null),[u,d]=it(!1),[h,m]=it(!1),[f,p]=it(!1),g=new URLSearchParams(window.location.search),y=g.get("status"),v=g.get("transactionId")||g.get("transaction_id"),[w,b]=it(!(!y||"failed"!==y&&"declined"!==y&&"cancelled"!==y)),x=e.calculations,k=e.payment_options,N=e.payment_gateways;ot(()=>{const e=x.find(e=>e.id===n);if(e&&i){const n=k.some(e=>"monthly"===e.amount.frequency),r=t.getPageCompletionStatus(),o=Math.round(r.completedPages.length/r.totalPages*100);Re(i,e,k.length,n,o)}},[]),ot(()=>{if(!r||!n)return;const e=x.find(e=>e.id===n);if(!e)return;if(r.calculation_id===e.calculation_id)return;const i=k.find(t=>t.gateway_id===r.gateway_id&&t.calculation_id===e.calculation_id&&t.amount.frequency===r.amount.frequency);i?t.setSelectedPaymentOption(i):t.setSelectedPaymentOption(null)},[n,r,x,k,t]);const S=()=>{if(!n||!r)return void alert("Please select both an excess amount and payment option");const t={quoteIntentId:e.quote_intent.id,excessId:n,gatewayId:r.gateway_id,calculationId:r.calculation_id,clientDetails:{legalName:"Test"}};c(t),a(!0)},_=async()=>{try{p(!0),await t.clearCalculationResults(),t.navigateToPage(0)}catch(e){alert("Failed to edit quote. Please try again."),p(!1)}},$=async()=>{var t,s;try{let t;m(!0);const s=null==i?void 0:i.form_data;if(null==s?void 0:s.page_data)for(const e in s.page_data){const n=s.page_data[e];if(n&&"object"==typeof n&&n.client_email){t=n.client_email;break}}if(!t)return void alert("Email address not found. Please try again.");const a={source:"checkout_page"};n&&(a.selected_excess_id=n),(null==r?void 0:r.gateway_id)&&(a.selected_gateway_id=r.gateway_id),(null==r?void 0:r.calculation_id)&&(a.selected_calculation_id=r.calculation_id),await o.createQuotePaymentLink(e.quote_intent.id,{email:t,metadata:a}),d(!0)}catch(e){let n="Failed to send payment link. ";(null===(s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.message)?n+=e.response.data.message:(null==e?void 0:e.message)?n+=e.message:n+="Please try again.",alert(n)}finally{m(!1)}},C=Boolean(n&&r),I=null==i?void 0:i.payment_return,T=I&&("declined"===I.paymentStatus||"cancelled"===I.paymentStatus||"error"===I.paymentStatus)||w,E=(null==I?void 0:I.paymentStatus)||("failed"===y?"declined":"cancelled"===y?"cancelled":"error"),P=(null==I?void 0:I.paymentTransactionId)||v||void 0;return qe(ns,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:qe(Mt,{children:[qe("div",{className:Ct.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:bt.spacing.lg},{"(max-width: 950px)":{display:"none"}}),children:[qe("div",{className:Ct.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,display:"flex",flexDirection:"column",alignSelf:"start"}),children:[qe("div",{className:Ct.create("checkout-header",{paddingInline:bt.spacing.xl,paddingTop:bt.spacing.xl,paddingBottom:bt.spacing.lg},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingTop:bt.spacing.md}}),children:[qe("h2",{className:Ct.create("checkout-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),qe("p",{className:Ct.create("checkout-description",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9"}),children:x.length>1?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage."}),qe("hr",{className:Ct.create("checkout-header-border",{marginTop:bt.spacing.lg,border:"0",borderTop:`1px solid ${bt.colors.border}`,height:"0"})})]}),qe("div",{className:Ct.create("checkout-sections",{paddingInline:bt.spacing.xl,paddingBottom:bt.spacing.xl,display:"flex",flexDirection:"column",gap:bt.spacing.lg},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingBottom:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingBottom:bt.spacing.md}}),children:[e.clauses&&e.clauses.length>0&&qe(ws,{clauses:e.clauses}),qe(ds,{excessOptions:x,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)}),qe(fs,{paymentOptions:k,paymentGateways:N,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)})]})]}),qe("div",{className:Ct.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:qe("div",{className:Ct.create("checkout-sidebar-sticky",{}),children:[qe(vs,{excessOptions:x,selectedExcessId:n,onEditQuote:_,isEditingQuote:f,productName:e.product_name,quoteIntent:i}),qe("div",{className:Ct.create("checkout-sidebar-spacer",{height:bt.spacing.lg},{"(max-width: 950px)":{height:bt.spacing.md}})}),qe("div",{className:Ct.create("checkout-sidebar-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,boxShadow:bt.shadow.sm,padding:bt.spacing.lg},{"(max-width: 768px)":{padding:bt.spacing.md}}),children:qe(xs,{excessOptions:x,paymentGateways:N,selectedExcessId:n,selectedPaymentOption:r,onPurchase:S,canPurchase:C,onContinueLater:$,continueLaterLoading:h,showContinueLaterSuccess:u})})]})})]}),qe("div",{className:Ct.create("checkout-mobile-layout",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:bt.spacing.md}}),children:[qe("div",{className:Ct.create("mobile-card-summary",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,padding:bt.spacing.md}),children:[qe("h2",{className:Ct.create("mobile-checkout-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.5rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),qe("p",{className:Ct.create("mobile-checkout-description",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9"}),children:x.length>1?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage."}),qe("hr",{className:Ct.create("mobile-summary-divider",{marginTop:bt.spacing.md,marginBottom:bt.spacing.md,borderColor:bt.colors.border})}),qe(vs,{excessOptions:x,selectedExcessId:n,onEditQuote:_,isEditingQuote:f,productName:e.product_name,quoteIntent:i,embedded:!0})]}),e.clauses&&e.clauses.length>0&&qe("div",{className:Ct.create("mobile-card-clauses",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,padding:bt.spacing.md}),children:qe(ws,{clauses:e.clauses})}),qe("div",{className:Ct.create("mobile-card-options",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,padding:bt.spacing.md}),children:qe(ds,{excessOptions:x,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)})}),qe("div",{className:Ct.create("mobile-card-payment",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,padding:bt.spacing.md}),children:[qe(fs,{paymentOptions:k,paymentGateways:N,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)}),qe("hr",{className:Ct.create("mobile-payment-divider",{border:"none",borderTop:`1px solid ${bt.colors.border}`,margin:`${bt.spacing.md} 0`})}),qe(xs,{excessOptions:x,paymentGateways:N,selectedExcessId:n,selectedPaymentOption:r,onPurchase:S,canPurchase:C,onContinueLater:$,continueLaterLoading:h,showContinueLaterSuccess:u})]})]}),T&&qe(Ss,{type:E,transactionId:P,isOpen:!0,onClose:()=>{t.updateQuoteIntent({payment_return:void 0}),b(!1);const e=new URL(window.location.href);e.searchParams.delete("status"),e.searchParams.delete("transactionId"),e.searchParams.delete("transaction_id"),window.history.replaceState({},"",e.toString())}}),qe(Ns,{isOpen:s,onClose:()=>{a(!1),c(null)},onSuccess:()=>{a(!1),c(null),alert("Payment completed successfully!")},onError:e=>{alert("Payment failed: "+e)},paymentRequest:l})]})})}function $s({coverTypes:e,selectedCoverTypeId:t,onCoverTypeSelect:n}){const r=[...e].sort((e,t)=>e.sort_order-t.sort_order),i=e.find(e=>e.id===t);return qe("div",{className:Ct.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[qe(cs,{title:"Cover Type"}),qe("div",{className:Ct.create("cover-type-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return qe("div",{className:zt(Ct.create("cover-type-card",{borderRadius:bt.radius.default,minWidth:"180px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?Ct.create("cover-type-card-selected",{border:`2px solid ${bt.colors.primary}`,backgroundColor:bt.colors.accent}):Ct.create("cover-type-card-unselected",{border:`2px solid ${bt.colors.border}`,backgroundColor:bt.colors.card})),onClick:()=>n(e.id),children:[qe(us,{selected:r}),qe("div",{className:Ct.create("cover-type-label",{color:bt.colors.foreground}),children:[e.label,e.description?"*":""]})]},e.id)})}),(null==i?void 0:i.description)&&qe("div",{className:Ct.create("cover-type-description",{padding:"0.75rem",backgroundColor:bt.colors.muted,borderRadius:bt.radius.default,border:`1px solid ${bt.colors.border}`}),children:qe(ls,{className:Ct.create("cover-type-description-text",{fontSize:bt.fontSize.small,color:bt.colors.foreground,margin:"0"}),children:i.description})})]})}function Cs({offers:e,selectedIds:t,onToggle:n,isCalculating:r}){if(0===e.length)return null;const i=[...e].sort((e,t)=>e.sort_order-t.sort_order);return qe("div",{className:Ct.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[qe(cs,{title:"Add-ons"}),qe("div",{className:Ct.create("coverage-options-grid",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:i.map(e=>{const i=t.includes(e.id),o=null!=e.delta_total;return qe("div",{onClick:()=>!r&&n(e.id),className:zt(Ct.create("coverage-option-card",{borderRadius:bt.radius.default,padding:"0.75rem 1rem",cursor:r?"wait":"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"1rem",opacity:r?"0.6":"1"}),i?Ct.create("coverage-option-card-selected",{border:`2px solid ${bt.colors.primary}`,backgroundColor:bt.colors.accent}):Ct.create("coverage-option-card-unselected",{border:`2px solid ${bt.colors.border}`,backgroundColor:bt.colors.card})),children:[qe("div",{className:Ct.create("coverage-option-indicator",{marginTop:"0.125rem"}),children:qe(us,{selected:i})}),qe("div",{className:Ct.create("coverage-option-body",{flex:"1",display:"flex",flexDirection:"column",gap:"0.25rem",minWidth:"0"}),children:[qe("div",{className:Ct.create("coverage-option-label",{fontWeight:"600",color:bt.colors.foreground}),children:e.label}),e.description&&qe(ls,{className:Ct.create("coverage-option-description",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,margin:"0"}),children:e.description}),!o&&qe(ls,{className:Ct.create("coverage-option-roundtrip",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,fontStyle:"italic",margin:"0"}),children:"Price updates when you toggle this option."})]}),qe("div",{className:Ct.create("coverage-option-price",{fontWeight:"600",whiteSpace:"nowrap",color:bt.colors.foreground}),children:o?`+${hs(e.delta_total)}`:"See total"})]},e.id)})})]})}function Is({value:e,className:t,durationMs:n=500}){const[r,i]=it(e),o=st(e),s=st(null);return ot(()=>{if(null!==s.current&&(cancelAnimationFrame(s.current),s.current=null),"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||o.current===e)return o.current=e,void i(e);const t=o.current,r=e,a=performance.now(),l=e=>{const c=e-a,u=Math.min(1,c/n);i(t+(r-t)*(1-(1-u)*(1-u))),u<1?s.current=requestAnimationFrame(l):(o.current=r,s.current=null)};return s.current=requestAnimationFrame(l),()=>{null!==s.current&&(cancelAnimationFrame(s.current),s.current=null)}},[e,n]),qe("span",{className:t,children:hs(r)})}function Ts(){var e,t;const{fsm:n,v2Result:r,selection:i,isCalculating:o,isRepricing:s,selectedExcessId:a,quoteIntent:l,calculationResult:c}=At(e=>({v2Result:e.getCalculationResultV2(),selection:e.getSelectionV2(),isCalculating:e.getIsCalculating(),isRepricing:e.getIsRepricing(),selectedExcessId:e.getSelectedExcessId(),quoteIntent:e.getQuoteIntent(),calculationResult:e.getCalculationResult()})),[u,d]=it(null),[h,m]=it(!1),[f,p]=it(!1),g=at(()=>{var e;return null!==(e=null==c?void 0:c.calculations)&&void 0!==e?e:[]},[c]);if(ot(()=>{d(null)},[null==i?void 0:i.cover_type_id,null==i?void 0:i.excess_id,null==i?void 0:i.coverage_option_ids.join(",")]),!r||!i)return qe(ns,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:qe(Mt,{children:qe("p",{style:{color:bt.colors.mutedForeground},children:"Loading calculation…"})})});const y=null!==(t=null!==(e=r.product_name)&&void 0!==e?e:null==l?void 0:l.product_name)&&void 0!==t?t:"Insurance",v=r.cover_types.length>1,w=g.length>1,b=!(!i.cover_type_id||!i.excess_id||o||s),x=async()=>{m(!0);try{const e=await n.bindV2();d(e)}catch(e){}finally{m(!1)}},k=async()=>{try{p(!0),await n.clearCalculationResults(),n.navigateToPage(0)}catch(e){p(!1)}};return qe(ns,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:qe(Mt,{children:[qe("div",{className:Ct.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:bt.spacing.lg},{"(max-width: 950px)":{display:"none"}}),children:[qe("div",{className:Ct.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,display:"flex",flexDirection:"column",alignSelf:"start"}),children:[qe(Es,{showCoverType:v,showExcess:w}),qe("div",{className:Ct.create("checkout-sections",{paddingInline:bt.spacing.xl,paddingBottom:bt.spacing.xl,display:"flex",flexDirection:"column",gap:bt.spacing.lg},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingBottom:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingBottom:bt.spacing.md}}),children:[(null==c?void 0:c.clauses)&&c.clauses.length>0&&qe(ws,{clauses:c.clauses}),v&&qe($s,{coverTypes:r.cover_types,selectedCoverTypeId:i.cover_type_id,onCoverTypeSelect:e=>n.setV2Selection({cover_type_id:e})}),w&&qe(ds,{excessOptions:g,selectedExcessId:a,onExcessSelect:e=>n.setV2Selection({excess_id:e})}),qe(Cs,{offers:r.policy_coverage_options,selectedIds:i.coverage_option_ids,onToggle:e=>n.toggleV2CoverageOption(e),isCalculating:s})]})]}),qe("div",{className:Ct.create("checkout-sidebar",{display:"flex",flexDirection:"column"}),children:qe("div",{className:Ct.create("checkout-sidebar-sticky",{position:"sticky",top:bt.spacing.lg}),children:[qe(vs,{excessOptions:g,selectedExcessId:a,onEditQuote:k,isEditingQuote:f,productName:y,quoteIntent:l}),qe("div",{className:Ct.create("checkout-sidebar-spacer",{height:bt.spacing.lg})}),qe("div",{className:Ct.create("checkout-sidebar-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,boxShadow:bt.shadow.sm,padding:bt.spacing.lg},{"(max-width: 768px)":{padding:bt.spacing.md}}),children:qe(Ps,{fsm:n,onBind:x,binding:h,canContinue:b,bindOutcome:u,isRepricing:s})})]})})]}),qe("div",{className:Ct.create("checkout-mobile-layout",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:bt.spacing.md}}),children:[qe("div",{className:Ct.create("mobile-card-summary",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,padding:bt.spacing.md}),children:[qe("h2",{className:Ct.create("mobile-checkout-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.5rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),qe("p",{className:Ct.create("mobile-checkout-description",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9"}),children:v||w?"Choose your cover and add-ons to secure your policy.":"Review your cover and add-ons to secure your policy."}),qe("hr",{className:Ct.create("mobile-summary-divider",{marginTop:bt.spacing.md,marginBottom:bt.spacing.md,borderColor:bt.colors.border})}),qe(vs,{excessOptions:g,selectedExcessId:a,onEditQuote:k,isEditingQuote:f,productName:y,quoteIntent:l,embedded:!0})]}),(null==c?void 0:c.clauses)&&c.clauses.length>0&&qe("div",{className:Ct.create("mobile-card-clauses",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,padding:bt.spacing.md}),children:qe(ws,{clauses:c.clauses})}),qe("div",{className:Ct.create("mobile-card-options",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,padding:bt.spacing.md,display:"flex",flexDirection:"column",gap:bt.spacing.lg}),children:[v&&qe($s,{coverTypes:r.cover_types,selectedCoverTypeId:i.cover_type_id,onCoverTypeSelect:e=>n.setV2Selection({cover_type_id:e})}),w&&qe(ds,{excessOptions:g,selectedExcessId:a,onExcessSelect:e=>n.setV2Selection({excess_id:e})}),qe(Cs,{offers:r.policy_coverage_options,selectedIds:i.coverage_option_ids,onToggle:e=>n.toggleV2CoverageOption(e),isCalculating:o})]}),qe("div",{className:Ct.create("mobile-card-payment",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,padding:bt.spacing.md}),children:qe(Ps,{fsm:n,onBind:x,binding:h,canContinue:b,bindOutcome:u,isRepricing:s})})]})]})})}function Es({showCoverType:e,showExcess:t}){let n="Review your cover and add-ons to secure your policy.";return e&&t?n="Choose your cover type, excess amount, and add-ons to secure your policy.":e?n="Choose your cover type and add-ons to secure your policy.":t&&(n="Choose your excess amount and add-ons to secure your policy."),qe("div",{className:Ct.create("checkout-header",{paddingInline:bt.spacing.xl,paddingTop:bt.spacing.xl,paddingBottom:bt.spacing.lg},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingTop:bt.spacing.md}}),children:[qe("h2",{className:Ct.create("checkout-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),qe("p",{className:Ct.create("checkout-description",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9"}),children:n}),qe("hr",{className:Ct.create("checkout-header-border",{marginTop:bt.spacing.lg,borderColor:bt.colors.border})})]})}function Ps({fsm:e,onBind:t,binding:n,canContinue:r,bindOutcome:i,isRepricing:o}){const s=e.getV2DisplayedTotal();return qe("div",{className:Ct.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[qe(cs,{title:"Payment"}),qe("div",{className:Ct.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("summary-label",{display:"flex",alignItems:"center",gap:"0.5rem",color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:["Total payable",qe("span",{className:Ct.create("summary-label-spinner",{display:"inline-flex",color:bt.colors.mutedForeground,opacity:o?"1":"0",transition:"opacity 200ms ease"}),"aria-hidden":!o,children:qe(Rt,{size:"small"})})]}),qe(Is,{value:s,className:Ct.create("summary-value-total",{fontWeight:"600",fontSize:bt.fontSize.large,color:bt.colors.foreground,fontVariantNumeric:"tabular-nums"})})]}),"verified"===(null==i?void 0:i.status)&&qe("div",{className:Ct.create("verified-banner",{padding:"0.75rem 1rem",border:`1px solid ${bt.colors.primary}`,borderRadius:bt.radius.default,backgroundColor:bt.colors.accent,fontSize:bt.fontSize.small}),children:["Verified at ",hs(i.server_total),". Payment gateway integration for v2 is pending — quote is ready."]}),"mismatch"===(null==i?void 0:i.status)&&qe("div",{className:Ct.create("mismatch-banner",{padding:"0.75rem 1rem",border:`1px solid ${bt.colors.destructive}`,borderRadius:bt.radius.default,color:bt.colors.destructive,fontSize:bt.fontSize.small}),children:[qe("strong",{children:"Price updated."})," The server calculated ",hs(i.server_total),". Please review and try again."]}),qe(os,{onClick:t,disabled:!r||n,children:n?"Verifying…":"verified"===(null==i?void 0:i.status)?"Continue to payment":"Verify & continue"}),qe(ls,{className:Ct.create("payment-footer-note",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,margin:"0"}),children:'Payment gateway integration for v2 products is scoped for a later phase. The "verify" step confirms your selection against the server.'})]})}function Ds({results:e}){var t,n,r;const{quoteIntent:i,fsm:o}=At(e=>({quoteIntent:null==e?void 0:e.getQuoteIntent()})),s=null===(t=null==i?void 0:i.organisation)||void 0===t?void 0:t.admin_email,a=null===(n=null==i?void 0:i.organisation)||void 0===n?void 0:n.phone,l=s||a,c=Ct.create("referral-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.xl,boxShadow:bt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:bt.spacing.lg},"(max-width: 480px)":{padding:bt.spacing.md}}),u=Ct.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:bt.spacing.lg}),d=Ct.create("referral-icon",{width:"4rem",height:"4rem",color:bt.colors.primary}),h=Ct.create("referral-header",{textAlign:"center",marginBottom:bt.spacing.xl}),m=Ct.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:bt.colors.primary,marginBottom:bt.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=Ct.create("referral-subtitle",{fontSize:bt.fontSize.default,color:bt.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),p=Ct.create("referral-process-box",{backgroundColor:bt.colors.accent,borderRadius:bt.radius.default,padding:bt.spacing.lg,marginBottom:bt.spacing.xl}),g=Ct.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:bt.colors.accentForeground,marginBottom:bt.spacing.md,marginTop:"0"}),y=Ct.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:bt.spacing.sm}),v=Ct.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:bt.fontSize.small,color:bt.colors.accentForeground,lineHeight:"1.6"}),w=Ct.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:bt.colors.primary,color:bt.colors.primaryForeground,borderRadius:"50%",marginRight:bt.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),b=Ct.create("referral-contact-section",{borderTop:`1px solid ${bt.colors.border}`,paddingTop:bt.spacing.xl,marginTop:bt.spacing.xl,textAlign:"center"}),x=Ct.create("referral-contact-text",{fontSize:bt.fontSize.default,color:bt.colors.foreground,marginBottom:bt.spacing.lg}),k=Ct.create("referral-actions",{display:"flex",gap:bt.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:bt.spacing.lg}),N=Ct.create("referral-reference",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,marginTop:bt.spacing.md}),S=Ct.create("referral-new-request",{textAlign:"center",marginTop:bt.spacing.md}),_=Ct.create("referral-new-request-link",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:"0",fontFamily:"inherit"});return qe(ns,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:qe(Mt,{children:qe(rs,{children:qe("div",{className:c,children:[qe("div",{className:u,children:qe(()=>qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:d,children:[qe("path",{d:"M7 10v12"}),qe("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),{})}),qe("div",{className:h,children:[qe("h1",{className:m,children:"Thanks for your quote request!"}),qe("p",{className:f,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),qe("div",{className:p,children:[qe("h3",{className:g,children:"What happens next?"}),qe("ul",{className:y,children:[qe("li",{className:v,children:[qe("span",{className:w,children:"1"}),qe("span",{children:"Our team will review your application within 1-2 business days"})]}),qe("li",{className:v,children:[qe("span",{className:w,children:"2"}),qe("span",{children:"We'll contact you with either approval or additional requirements"})]}),qe("li",{className:v,children:[qe("span",{className:w,children:"3"}),qe("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),l&&qe("div",{className:b,children:[qe("p",{className:x,children:"Need to speak with someone about your quote?"}),qe("div",{className:k,children:[a&&qe(os,{variant:"outline",onClick:()=>window.open(`tel:${a}`),children:[qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:qe("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),"Call Us"]}),s&&qe(os,{variant:"outline",onClick:()=>window.open(`mailto:${s}`),children:[qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:[qe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),qe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),(null===(r=e.quote_intent)||void 0===r?void 0:r.reference)&&qe("div",{className:N,children:["Quote Reference: ",qe("strong",{children:e.quote_intent.reference})]})]}),qe("div",{className:S,children:qe("button",{type:"button",className:_,onClick:()=>null==o?void 0:o.reset(),children:"Start a new quote"})})]})})})})}function zs({results:e}){const{calculationResultV2:t}=At(e=>({calculationResultV2:e.getCalculationResultV2()}));return"referral"===e.outcome_type?qe(Ds,{results:e}):t?qe(Ts,{}):qe(_s,{results:e})}function Rs({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:l,prefix:c="$"}){const u=st(null),[d,h]=it("");function m(e){if(!e)return"";const t=e.replace(/[^\d.]/g,"");if(!t)return"";const n=t.split(".");let r=n[0];const i=n[1];r=r.replace(/^0+/,"")||"0";const o=r.replace(/\B(?=(\d{3})+(?!\d))/g,",");return void 0!==i?o+"."+i:o}ot(()=>{h(null!=e&&""!==e?m(e):"")},[e]);const f=Ct.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=Ct.create("money-input-prefix",{position:"absolute",left:"1rem",color:bt.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=Ct.create("money-input-with-prefix",{paddingLeft:c?"2rem":"1rem"});return qe("div",{className:f,children:[c&&qe("span",{className:p,children:c}),qe("input",{ref:u,type:"text",inputMode:"decimal",name:n,id:r,value:d,onInput:function(e){const n=e.currentTarget,r=n.selectionStart||0,i=d,o=n.value.replace(/[^\d.]/g,""),s=m(o);h(s),t(o),requestAnimationFrame(()=>{if(u.current){const e=function(e,t,n){let r=n+(t.length-e.length);return r=Math.max(0,Math.min(r,t.length)),r}(i,s,r);u.current.setSelectionRange(e,e)}})},onBlur:function(){d&&d.includes(".")},placeholder:i,required:o,disabled:s,className:zt(a,c&&g)})]})}function Ms(e,t){return n=(null==e?void 0:e.use_custom_options)?t||(null==e?void 0:e.options)||[]:(null==e?void 0:e.options)||t||[],(r=null==e?void 0:e.options_sort)&&"default"!==r?[...n].sort((e,t)=>e.label.localeCompare(t.label,void 0,"numerical"===r?{numeric:!0}:void 0)):[...n];var n,r}function Os(e){var t,n;const r=Ct.create("input",{width:"100%",maxWidth:"100%",minWidth:"0",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${bt.borderWidth} solid ${bt.colors.input}`,borderRadius:bt.radius.default,fontSize:bt.fontSize.default,backgroundColor:bt.colors.card,color:bt.colors.foreground,transition:bt.transition,outline:"none",boxShadow:"none"},{"(max-width: 480px)":{paddingLeft:"0.75rem",paddingRight:"0.75rem"}}),i=Ct.create("input-error",{border:`${bt.borderWidth} solid ${bt.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${bt.colors.destructive} 20%, transparent)`}),o=e.hasError?`${r} ${i}`:r,s=Ct.name("input");Ct.pseudoElement("input",":focus",{border:`${bt.borderWidth} solid ${bt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${bt.colors.primary} 20%, transparent)`,borderRadius:bt.radius.default});const a=Ct.create("select",{width:"100%",minWidth:"0",boxSizing:"border-box",height:`calc(2.75rem - (${bt.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"2.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",fontSize:bt.fontSize.default,backgroundColor:"transparent",color:bt.colors.foreground,outline:"none",WebkitAppearance:"none",appearance:"none",textOverflow:"ellipsis"},{"(max-width: 480px)":{paddingLeft:"0.75rem",paddingRight:"2rem"}}),l=Ct.create("select-wrapper",{position:"relative",minWidth:"0",border:`${bt.borderWidth} solid ${bt.colors.input}`,borderRadius:bt.radius.default,backgroundColor:bt.colors.card,transition:bt.transition,outline:"none",boxShadow:"none"}),c=Ct.create("select-wrapper-error",{border:`${bt.borderWidth} solid ${bt.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${bt.colors.destructive} 20%, transparent)`}),u=e.hasError?`${l} ${c}`:l,d=Ct.name("select-wrapper");Ct.pseudoElement("select-wrapper",":focus-within",{border:`${bt.borderWidth} solid ${bt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${bt.colors.primary} 20%, transparent)`,borderRadius:bt.radius.default});const{onChange:h,onBlur:m,onKeyDown:f,className:p,validation:g,errors:y,suffix:v,...w}=e;function b(e){h(e.currentTarget.value)}function x(e){h(e.currentTarget.value)}function k(e){m&&m(e.currentTarget.value)}if("select"===e.type){const N=e.null_option_label||"N/A",S=Ms(e.validation,e.options),_=!w.value&&!e.add_null_option,$=Ct.create("select-placeholder",{color:bt.colors.mutedForeground}),C=Ct.create("select-chevron",{position:"absolute",right:"0.75rem",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:bt.colors.mutedForeground});return qe("div",{className:zt(u,d),children:[qe("select",{...w,onChange:b,className:zt(a,_&&$),children:[_&&qe("option",{value:"",disabled:!0,selected:!0,children:"Select..."}),e.add_null_option&&qe("option",{value:"",children:N}),S.map(e=>qe("option",{value:e.value,children:e.label},e.value))]}),qe("svg",{className:C,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:qe("path",{d:"M6 9l6 6 6-6"})})]})}if("radio"===e.type){const I=e.null_option_label||"N/A",T=Ms(e.validation,e.options),E=Ct.create(e.inline?"radio-container-inline":"radio-container",{display:"flex",flexDirection:e.inline?"row":"column",gap:e.inline?"1rem":"0.5rem",flexWrap:e.inline?"wrap":"nowrap"}),P=Ct.create("radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer",fontSize:bt.fontSize.default,color:bt.colors.foreground}),D=Ct.create("radio-input",{accentColor:bt.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),z=Ct.name("radio-input");return Ct.pseudoElement("radio-input",":focus",{outline:`3px solid color-mix(in srgb, ${bt.colors.primary} 30%, transparent)`,outlineOffset:"2px"}),qe("div",{className:E,children:[e.add_null_option&&qe("label",{className:P,children:[qe("input",{type:"radio",name:e.name,value:"",checked:""===e.value,onChange:()=>h(""),className:zt(D,z)}),qe("span",{children:I})]}),T.map(t=>qe("label",{className:P,children:[qe("input",{type:"radio",name:e.name,value:t.value,checked:e.value===t.value,onChange:()=>h(t.value),className:zt(D,z)}),qe("span",{children:t.label})]},t.value))]})}if("date"===e.type){const R=Ct.create("input-date",{height:"2.75rem",minHeight:"2.75rem",maxHeight:"2.75rem",WebkitAppearance:"none",appearance:"none"});return qe("input",{...w,type:"date",min:null===(t=e.validation)||void 0===t?void 0:t.minDate,max:null===(n=e.validation)||void 0===n?void 0:n.maxDate,onInput:x,onChange:b,className:zt(o,s,R,p)})}if("monthyear"===e.type){function M(e){const t=e.currentTarget.value;h(t?`${t}-01`:"")}const O=e.value?e.value.substring(0,7):"";return qe("input",{...w,type:"month",value:O,onInput:M,onChange:M,className:zt(o,s,p)})}if("year"===e.type){const j=(new Date).getFullYear();return qe("input",{...w,type:"number",min:j-100,max:j,placeholder:"YYYY",onInput:x,onChange:b,className:zt(o,s,p)})}if("money"===e.type)return qe(Rs,{value:e.value,onChange:h,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:zt(o,s,p),hasError:e.hasError});if("checkbox"===e.type){const W=!0===e.value||"true"===e.value||"true"===e.value,A=Ct.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),L=Ct.create("checkbox-"+(W?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${W?bt.colors.primary:e.hasError?bt.colors.destructive:bt.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:W?bt.colors.primary:bt.colors.card,transition:bt.transition,position:"absolute"}),B=Ct.name("checkbox-"+(W?"checked":"unchecked"));function F(e){e.preventDefault(),h(W?"false":"true")}return Ct.pseudoElement("checkbox-"+(W?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${bt.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),qe("div",{className:A,children:[qe("input",{type:"checkbox",id:e.id,name:e.name,checked:W,onClick:F,className:zt(L,B,p),required:e.required,readOnly:!0}),W&&qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:bt.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:qe("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const q=Ct.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),H=Ct.create("boolean-radio-group",{display:"flex",gap:"1rem"}),U=Ct.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),Y=Ct.create("boolean-radio",{accentColor:bt.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),Z=Ct.name("boolean-radio");Ct.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${bt.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const G=Ct.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${bt.borderWidth} solid ${bt.colors.input}`,borderRadius:bt.radius.default,fontSize:bt.fontSize.default,backgroundColor:bt.colors.card,color:bt.colors.foreground,transition:bt.transition,outline:"none",boxShadow:"none",resize:"vertical",fontFamily:bt.fontFamily}),V=Ct.create("boolean-textarea-error",{border:`${bt.borderWidth} solid ${bt.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${bt.colors.destructive} 20%, transparent)`}),Q=e.hasError?`${G} ${V}`:G,J=Ct.name("boolean-textarea");Ct.pseudoElement("boolean-textarea",":focus",{border:`${bt.borderWidth} solid ${bt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${bt.colors.primary} 20%, transparent)`,borderRadius:bt.radius.default});const K=!0===e.value||"true"===e.value,X=!1===e.value||"false"===e.value,ee=e.answer||"",te=e.booleanConfig,ne=(null==te?void 0:te.enable_details_textbox)&&("yes"===te.show_details_on&&K||"no"===te.show_details_on&&X);function re(t){h(t),(!(null==te?void 0:te.enable_details_textbox)||!("yes"===te.show_details_on&&"true"===t||"no"===te.show_details_on&&"false"===t))&&e.onAnswerChange&&ee&&e.onAnswerChange("")}return qe("div",{className:zt(q,p),children:[qe("div",{className:H,children:[qe("label",{className:U,children:[qe("input",{type:"radio",name:e.name,checked:K,onChange:()=>re("true"),className:zt(Y,Z)}),qe("span",{children:"Yes"})]}),qe("label",{className:U,children:[qe("input",{type:"radio",name:e.name,checked:X,onChange:()=>re("false"),className:zt(Y,Z)}),qe("span",{children:"No"})]})]}),ne&&qe("textarea",{placeholder:(null==te?void 0:te.details_placeholder)||"Please provide details",value:ee,required:!0,onInput:t=>{return n=t.target.value,void(e.onAnswerChange&&e.onAnswerChange(n));var n},className:zt(Q,J)})]})}return v?qe("div",{className:Ct.create("input-with-suffix",{display:"flex",alignItems:"center",gap:bt.spacing.sm,minWidth:"0",maxWidth:"100%"}),children:[qe("input",{...w,onInput:x,onChange:b,onBlur:k,onKeyDown:f,className:zt(o,s,p),style:{flex:1,minWidth:0}}),v]}):qe("input",{...w,onInput:x,onChange:b,onBlur:k,onKeyDown:f,className:zt(o,s,p)})}function js({pages:e,currentPageIndex:n,completedPages:r}){const{fsm:i,lastUpdated:o,isSaving:s}=At(e=>{var t,n;return{lastUpdated:null!==(n=null===(t=e.getFormProgress())||void 0===t?void 0:t.last_updated)&&void 0!==n?n:null,isSaving:e.getIsSaving()}}),[a,l]=it(!1),[c,u]=it(!1),d=st(null),h=st(null);t(e.length),t(e.map((e,t)=>({index:t,id:e.id,title:e.title})));const m=at(()=>{var t;for(let n=0;n<e.length;n++)if((null!==(t=e[n].fields)&&void 0!==t?t:[]).some(e=>"client_email"===e.code))return n;return-1},[e]),f=m>=0&&r.includes(m);ot(()=>{if(d.current&&h.current){const e=h.current,t=d.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}},[n]);const p=Math.round((n+1)/e.length*100),g=Ct.create("sidebar-nav-item-base",{display:"flex",alignItems:"flex-start",gap:bt.spacing.sm,padding:`${bt.spacing.sm} ${bt.spacing.sm}`,borderRadius:bt.radius.default,border:"none",backgroundColor:"transparent",color:bt.colors.foreground,cursor:"pointer",transition:bt.transition,textAlign:"left",width:"100%",fontFamily:bt.fontFamily,fontSize:bt.fontSize.small,opacity:"1"}),y=Ct.create("sidebar-nav-item-active",{backgroundColor:bt.colors.accent,color:bt.colors.accentForeground}),v=Ct.create("sidebar-nav-item-disabled",{cursor:"not-allowed",opacity:"0.5"});Ct.pseudoElement("sidebar-nav-item-base",":hover",{backgroundColor:bt.colors.muted}),Ct.pseudoElement("sidebar-nav-item-active",":hover",{backgroundColor:bt.colors.accent});const w=Ct.create("sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:bt.colors.muted,color:bt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),b=Ct.create("sidebar-indicator-active",{backgroundColor:bt.colors.accentForeground,color:bt.colors.accent}),x=Ct.create("sidebar-indicator-completed",{backgroundColor:bt.colors.primary,color:bt.colors.primaryForeground}),k=Ct.create("sidebar-page-title-base",{fontWeight:"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),N=Ct.create("sidebar-page-title-active",{fontWeight:"600"});return qe("div",{className:Ct.create("sidebar-navigation",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.lg,boxShadow:bt.shadow.sm,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:bt.spacing.lg}),children:[qe("div",{className:Ct.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:bt.spacing.sm}),children:[qe("span",{className:Ct.create("sidebar-progress-text",{fontSize:bt.fontSize.small,fontWeight:"600",color:bt.colors.foreground}),children:["Step ",n+1," of ",e.length]}),qe("div",{className:Ct.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:bt.colors.muted,borderRadius:bt.radius.small,overflow:"hidden"}),children:qe("div",{className:Ct.create("sidebar-progress-fill",{height:"100%",backgroundColor:bt.colors.primary,borderRadius:bt.radius.small,transition:bt.transition}),style:{width:`${p}%`}})})]}),qe("hr",{className:Ct.create("sidebar-divider",{borderColor:bt.colors.border})}),qe("nav",{ref:h,className:Ct.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:bt.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:bt.spacing.sm}),children:e.map((e,o)=>{const a=o===n,l=r.includes(o),c=i.canNavigateToPage(o);o===n&&t(e.title);const u=[g];a&&u.push(y),c&&!s||u.push(v);const h=u.join(" "),m=[w];l?m.push(x):a&&m.push(b);const f=m.join(" ");return qe("button",{ref:a?d:null,onClick:()=>{return e=o,void((null==i?void 0:i.canNavigateToPage(e))&&i.navigateToPage(e));var e},disabled:!c||s,className:h,children:[qe("div",{className:f,children:l?qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:qe("path",{d:"M20 6 9 17l-5-5"})}):o+1}),qe("div",{className:Ct.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:qe("span",{className:a?`${k} ${N}`:k,children:e.title})})]},e.id)})}),f&&!a&&qe("button",{onClick:async()=>{var e,t;const n=(()=>{const e=null==i?void 0:i.getFormProgress(),t=null==e?void 0:e.page_data;if(!t)return null;for(const e in t){const n=t[e];if(null==n?void 0:n.client_email)return n.client_email}return null})();if(!n)return void alert("Email address not found. Please fill in your email first.");const r=null===(e=null==i?void 0:i.getQuoteIntent())||void 0===e?void 0:e.id;if(r)try{u(!0),await(null===(t=null==i?void 0:i.httpClient)||void 0===t?void 0:t.continueLater(r,n)),l(!0)}catch(e){alert("Failed to send link. Please try again.")}finally{u(!1)}},disabled:c,className:Ct.create("sidebar-continue-later-button",{padding:`${bt.spacing.sm} ${bt.spacing.md}`,border:`${bt.borderWidth} solid ${bt.colors.border}`,borderRadius:bt.radius.default,backgroundColor:"transparent",color:bt.colors.mutedForeground,fontSize:bt.fontSize.small,fontFamily:bt.fontFamily,cursor:"pointer",transition:bt.transition,textAlign:"center",width:"100%"}),children:c?"Sending...":"Continue Later"}),a&&qe("div",{className:Ct.create("sidebar-continue-later-sent",{fontSize:bt.fontSize.small,color:bt.colors.primary,textAlign:"center",padding:`${bt.spacing.sm} 0`}),children:"A link has been sent to your email."}),o&&qe("div",{className:Ct.create("sidebar-footer",{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"}),children:[qe("div",{className:Ct.create("sidebar-last-saved",{fontSize:"0.6875rem",color:bt.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",es.fromJSDate(new Date(o)).toFormat("T")]}),qe("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&(null==i||i.reset())},className:Ct.create("sidebar-reset-link",{background:"none",border:"none",padding:"0",fontSize:"0.6875rem",color:bt.colors.mutedForeground,opacity:"0.5",cursor:"pointer",textDecoration:"underline",fontFamily:bt.fontFamily}),children:"Reset progress"})]})]})}function Ws({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=At(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=it(!1),a=Math.round((t+1)/e.length*100),l=Ct.create("mobile-sidebar-item-base",{display:"flex",alignItems:"center",gap:bt.spacing.sm,padding:bt.spacing.sm,border:"none",borderRadius:bt.radius.default,backgroundColor:"transparent",color:bt.colors.foreground,cursor:"pointer",opacity:"1",transition:bt.transition,width:"100%",textAlign:"left",fontFamily:bt.fontFamily}),c=Ct.create("mobile-sidebar-item-active",{backgroundColor:bt.colors.accent,color:bt.colors.accentForeground}),u=Ct.create("mobile-sidebar-item-disabled",{cursor:"not-allowed",opacity:"0.5"}),d=Ct.create("mobile-sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:bt.colors.muted,color:bt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),h=Ct.create("mobile-sidebar-indicator-active",{backgroundColor:bt.colors.accentForeground,color:bt.colors.accent}),m=Ct.create("mobile-sidebar-indicator-completed",{backgroundColor:bt.colors.primary,color:bt.colors.primaryForeground}),f=Ct.create("mobile-sidebar-page-title-base",{fontSize:bt.fontSize.small,fontWeight:"500"}),p=Ct.create("mobile-sidebar-page-title-active",{fontWeight:"600"});return qe("div",{className:Ct.create("mobile-sidebar",{overflow:"hidden"}),children:[qe("button",{onClick:()=>s(!o),className:Ct.create("mobile-sidebar-header",{width:"100%",padding:bt.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:bt.spacing.sm}),children:[qe("div",{className:Ct.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[qe("span",{className:Ct.create("mobile-sidebar-step-text",{fontSize:bt.fontSize.small,fontWeight:"600",color:bt.colors.foreground}),children:["Step ",t+1," of ",e.length]}),qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:Ct.create("mobile-sidebar-chevron",{transition:bt.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:bt.colors.mutedForeground}),children:qe("path",{d:"m6 9 6 6 6-6"})})]}),qe("div",{className:Ct.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:bt.colors.muted,borderRadius:bt.radius.small,overflow:"hidden"}),children:qe("div",{className:Ct.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:bt.colors.primary,borderRadius:bt.radius.small,transition:bt.transition}),style:{width:`${a}%`}})})]}),qe("hr",{className:Ct.create("mobile-sidebar-border",{borderColor:bt.colors.border})}),o&&qe("div",{className:Ct.create("mobile-sidebar-content",{padding:bt.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:e.map((e,o)=>{const a=o===t,g=n.includes(o),y=r.canNavigateToPage(o),v=[l];a&&v.push(c),y&&!i||v.push(u);const w=v.join(" "),b=[d];g?b.push(m):a&&b.push(h);const x=b.join(" ");return qe("button",{onClick:()=>{return e=o,void((null==r?void 0:r.canNavigateToPage(e))&&(r.navigateToPage(e),s(!1)));var e},disabled:!y||i,className:w,children:[qe("div",{className:x,children:g?qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:qe("path",{d:"M20 6 9 17l-5-5"})}):o+1}),qe("span",{className:a?`${f} ${p}`:f,children:e.title})]},e.id)})})]})}function As({organisation:e}){return qe("div",{className:Ct.create("welcome-card",{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},{"(max-width: 950px)":{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingTop:bt.spacing.md}}),children:[qe("h2",{className:Ct.create("welcome-title",{margin:"0",marginBottom:bt.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:bt.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),qe("p",{className:Ct.create("welcome-text",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9"}),children:"Getting a quote online is quick and easy. Simply complete the form below with your details, and we'll provide you with a personalied quote. Our secure platform ensures your information is protected every step of the way."}),qe("hr",{className:Ct.create("welcome-border",{marginTop:bt.spacing.lg,borderColor:bt.colors.border})})]})}function Ls({title:e,description:t}){return qe(ns,{title:e,description:t,children:qe(Mt,{children:qe(rs,{className:Ct.name("error-container"),children:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-ban-icon lucide-ban",children:[qe("path",{d:"M4.929 4.929 19.07 19.071"}),qe("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function Bs({errors:e,className:t}){return e&&0!==e.length?qe("div",{className:Ct.create("field-error",{color:bt.colors.destructive,fontSize:bt.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>qe("span",{className:Ct.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function Fs({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=it({visible:!1,top:0,left:0,flipped:!1}),l=st(null),c=lt(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect(),n=!(t.top>68),r=n?t.bottom+8:t.top-8,i=t.left+t.width/2;a({visible:!0,top:r,left:i,flipped:n})},[]),u=lt(()=>{a(e=>({...e,visible:!1}))},[]);return qe("label",{for:e,className:Ct.create("label",{display:"flex",flexDirection:"column",minWidth:"0"}),...o,children:[qe("span",{className:Ct.create("label-text",{marginBottom:bt.spacing.sm,fontSize:bt.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:bt.spacing.sm,color:bt.colors.foreground}),children:[qe("span",{children:r?qe($,{children:[t.includes(" ")?t.substring(0,t.lastIndexOf(" ")+1):"",qe("span",{style:{whiteSpace:"nowrap"},children:[t.includes(" ")?t.substring(t.lastIndexOf(" ")+1):t,qe("span",{className:Ct.create("label-required-indicator",{color:bt.colors.destructive}),children:"*"})]})]}):t}),i&&qe("span",{ref:l,className:Ct.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:c,onMouseLeave:u,children:[qe("svg",{className:Ct.create("tooltip-icon",{width:"1rem",height:"1rem",color:bt.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[qe("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),qe("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),qe("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s.visible&&qe("span",{style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,transform:s.flipped?"translateX(-50%)":"translateX(-50%) translateY(-100%)",padding:"0.5rem 0.75rem",backgroundColor:bt.colors.popover,color:bt.colors.popoverForeground,fontSize:"0.875rem",borderRadius:bt.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e4,minWidth:"200px",maxWidth:"300px",pointerEvents:"none"},children:[i,qe("span",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...s.flipped?{bottom:"100%",borderBottom:`6px solid ${bt.colors.popover}`}:{top:"100%",borderTop:`6px solid ${bt.colors.popover}`}}})]})]})]}),n]})}function qs(e){const t={"(max-width: 600px)":{gridColumn:"span 12 / span 12"}};switch(null!=e?e:100){case 25:return Ct.create("field-wrapper-25",{gridColumn:"span 3 / span 3"},t);case 33:return Ct.create("field-wrapper-33",{gridColumn:"span 4 / span 4"},t);case 50:return Ct.create("field-wrapper-50",{gridColumn:"span 6 / span 6"},t);case 66:return Ct.create("field-wrapper-66",{gridColumn:"span 8 / span 8"},t);case 75:return Ct.create("field-wrapper-75",{gridColumn:"span 9 / span 9"},t);default:return Ct.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function Hs(e){return e?e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,n)=>{const r=n.trim();return r.match(/^(https?:\/\/|mailto:)/i)?`<a href="${r}" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 underline">${t}</a>`:e}):""}function Us({field:e,errors:t,children:n,className:r}){const i=e.code||e.id,o=(null==t?void 0:t.filter(e=>e.field===i))||[],s=Ct.create("validated-field",{display:"flex",flexDirection:"column",gap:bt.spacing.sm,minWidth:"0"});if("notice"===e.type){const t=Ct.create("notice-field",{display:"flex",gap:bt.spacing.sm,padding:bt.spacing.md,backgroundColor:bt.colors.accent,borderRadius:bt.radius.default,border:`1px solid ${bt.colors.border}`}),n=Ct.create("notice-icon",{flexShrink:"0",fontSize:bt.fontSize.default,lineHeight:"1.6"}),r=Ct.create("notice-text",{fontSize:bt.fontSize.small,color:bt.colors.foreground,lineHeight:"1.6"});return qe("div",{className:zt(qs(e.width)),children:qe("div",{className:t,children:[qe("span",{className:n,children:"ⓘ"}),qe("div",{className:r,children:[e.label&&qe("strong",{children:e.label}),e.label&&e.description&&qe("br",{}),e.description&&qe("span",{children:e.description})]})]})})}if("section"===e.type){const t=Ct.create("section-separator",{display:"flex",alignItems:"center",gap:bt.spacing.md}),n=Ct.create("section-line",{flex:"1",height:"1px",backgroundColor:bt.colors.border}),r=Ct.create("section-title",{fontSize:bt.fontSize.small,fontWeight:"600",color:bt.colors.mutedForeground,whiteSpace:"nowrap"});return qe("div",{className:zt(qs(e.width)),children:qe("div",{className:t,children:e.label?qe($,{children:[qe("div",{className:n}),qe("span",{className:r,children:e.label}),qe("div",{className:n})]}):qe("div",{className:n})})})}if("checkbox"===e.type){const t=Ct.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:bt.spacing.sm}),a=Ct.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),l=Ct.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),c=Ct.create("checkbox-label-text",{fontSize:bt.fontSize.default,fontWeight:"600",color:bt.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return qe("div",{className:zt(s,qs(e.width),r),children:[qe("div",{className:t,children:qe("div",{className:a,children:[qe("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),qe("label",{htmlFor:i,className:l,children:[qe("span",{className:c,children:[e.label,e.required&&qe("span",{className:Ct.create("checkbox-required-indicator",{color:bt.colors.destructive}),children:"*"})]}),e.description&&qe("div",{className:Ct.create("checkbox-field-description",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:Hs(e.description)}})]})]})}),qe(Bs,{errors:o})]})}return qe("div",{className:zt(s,qs(e.width),r),children:[qe(Fs,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&qe("div",{className:Ct.create("field-description",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,marginBottom:bt.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:Hs(e.description)}}),n]}),qe(Bs,{errors:o})]})}function Ys({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:bt.colors.secondary+"08",borderColor:bt.colors.secondary+"30",iconColor:bt.colors.secondary,titleColor:bt.colors.foreground},error:{backgroundColor:bt.colors.destructive+"08",borderColor:bt.colors.destructive,iconColor:bt.colors.destructive,titleColor:bt.colors.destructive},critical:{backgroundColor:bt.colors.destructive+"10",borderColor:bt.colors.destructive,iconColor:bt.colors.destructive,titleColor:bt.colors.destructive}}[e.severity],o=Ct.create("error-card",{padding:bt.spacing.md,borderRadius:bt.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:bt.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=Ct.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=Ct.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),l=Ct.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),c=Ct.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=Ct.create("error-card-title",{fontSize:bt.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=Ct.create("error-card-message",{fontSize:bt.fontSize.small,color:bt.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=Ct.create("error-card-details",{fontSize:"0.8125rem",color:bt.colors.mutedForeground,fontFamily:"monospace",backgroundColor:bt.colors.muted,padding:"0.625rem",borderRadius:bt.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),m=Ct.create("error-card-support",{fontSize:"0.8125rem",color:bt.colors.mutedForeground,lineHeight:"1.4"}),f=Ct.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:bt.colors.mutedForeground,cursor:"pointer",borderRadius:bt.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:bt.transition});return Ct.pseudoElement("error-card-dismiss",":hover",{backgroundColor:bt.colors.muted,color:bt.colors.foreground}),qe("div",{className:zt(o,n),children:qe("div",{className:s,children:[qe(()=>"warning"===e.severity?qe("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:qe("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}):qe("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:qe("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),{}),qe("div",{className:l,children:[qe("div",{className:c,children:[qe("div",{className:u,children:e.title}),qe("div",{className:d,children:e.message}),r&&e.details&&qe("div",{className:h,children:e.details}),qe("div",{className:m,children:Ce(e)})]}),t&&qe("button",{className:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none"},children:[qe("path",{d:"M18 6 6 18"}),qe("path",{d:"m6 6 12 12"})]})})]})]})})}function Zs(){const{definition:e,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:l}=At(e=>({definition:e.getFormDefinition(),currentPageIndex:e.getCurrentPageIndex(),totalPages:e.getTotalPages(),results:e.getCalculationResult(),validationErrors:e.getValidationErrors(),generalErrors:e.getGeneralErrors(),quoteIntent:e.getQuoteIntent(),isSaving:e.getIsSaving()})),{httpClient:c,urlPromoCode:u}=Wt(),[d,h]=it({status:"idle"}),[m,f]=it(""),p=lt(async e=>{const n=null!=e?e:m;if(n&&n.trim()){if((null==s?void 0:s.id)&&c){h({status:"validating"});try{const e=await c.validatePromoCode(s.id,n.trim());e.valid?h({status:"valid",name:e.name||n}):h({status:"invalid",message:e.message})}catch(e){t(),h({status:"invalid",message:"Unable to validate promo code"})}}}else h({status:"idle"})},[null==s?void 0:s.id,c,m]),g=lt(e=>{"Enter"===e.key&&(e.preventDefault(),p())},[p]),y=st(!1);ot(()=>{u&&!y.current&&(null==s?void 0:s.id)&&c&&(y.current=!0,f(u),(async()=>{try{const e=await c.validatePromoCode(s.id,u.trim());if(e.valid){h({status:"valid",name:e.name||u});const t=l.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));t&&l.updateFieldValue(t.id,"promo_code",u)}else{f("");const e=l.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));e&&l.updateFieldValue(e.id,"promo_code","")}}catch(e){f("")}})())},[u,null==s?void 0:s.id,c]);const v=e.pages[n];if(!v)return qe(Ls,{title:"Unexpected Error",description:"No page available"});const w=st(new Map),b=(e,t)=>{var n;const r=l.getFormProgress().page_data[v.id],i=null==r?void 0:r[e];if(null!=i&&""!==i)return i;if(t&&("date"===t.type||"monthyear"===t.type)&&(null===(n=t.validation)||void 0===n?void 0:n.defaultDate)){const n=x(t.validation.defaultDate,"monthyear"===t.type);if(n)return l.updateFieldValue(v.id,e,n),n}return""},x=(e,t)=>{var n;const r=(null===(n=null==s?void 0:s.organisation)||void 0===n?void 0:n.timezone)||"Pacific/Auckland",i=(new Date).toLocaleString("en-US",{timeZone:r}),o=new Date(i);let a=new Date(i);switch(e){case"today":a=o;break;case"+1week":a.setDate(o.getDate()+7);break;case"+1month":a.setMonth(o.getMonth()+1);break;case"+1year":a.setFullYear(o.getFullYear()+1);break;default:return""}const l=a.getFullYear(),c=String(a.getMonth()+1).padStart(2,"0"),u=String(a.getDate()).padStart(2,"0");return t?`${l}-${c}-01`:`${l}-${c}-${u}`},k=e=>{const t=l.getFormProgress().page_data[v.id];return((null==t?void 0:t.U)||{})[e]||""},N=l.getFormProgress(),S={};Object.values(N.page_data).forEach(e=>{const{U:t,...n}=e;Object.assign(S,n),t&&Object.keys(t).length>0&&(S.U||(S.U={}),Object.assign(S.U,t))});const _=e=>{if(!e.visibility)return!0;const n=e.visibility.conditions.map(e=>"field"in e?e.field:null).filter(Boolean);n.length>0&&(t((e.label,e.code)),t(Object.keys(S)),n.forEach(e=>{e&&t((S[e],S[e]))}));const r=ce(S,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions}),i="show"===e.visibility.action?r.matched:!r.matched;return w.current.get(e.id)!==i&&(t((e.label,e.code)),t(),w.current.set(e.id,i)),i},$=(()=>{for(const e of v.fields)if(e.blocker&&_(e))if(e.blocker.conditions&&e.blocker.conditions.length>0){if(ce(S,{condition_type:e.blocker.condition_type||"or",conditions:e.blocker.conditions}).matched)return{field:e,config:e.blocker}}else if(void 0!==e.blocker.trigger_value){const t=e.code||e.id,n=b(t,e);if(String(n)===String(e.blocker.trigger_value))return{field:e,config:e.blocker}}return null})(),C=null==s?void 0:s.payment_return,I=C&&("declined"===C.paymentStatus||"cancelled"===C.paymentStatus||"error"===C.paymentStatus),T=l.getFormProgress().completed_pages||[];return qe(ns,{title:v.title,description:v.description,hideHeader:!0,children:qe("div",{children:[I&&qe(Ss,{type:C.paymentStatus,transactionId:C.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{l.updateQuoteIntent({payment_return:void 0})}}),qe(Mt,{children:qe("div",{className:Ct.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:bt.spacing.lg},{"(max-width: 950px)":{display:"flex",flexDirection:"column"}}),children:[qe("div",{className:Ct.create("form-content-wrapper",{minWidth:"0",backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"},{"(max-width: 950px)":{minHeight:"auto"}}),children:[qe("div",{className:Ct.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:qe(Ws,{pages:e.pages,currentPageIndex:n,completedPages:T})}),n>0&&qe("div",{className:Ct.create("page-heading-container",{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},{"(max-width: 950px)":{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingTop:bt.spacing.md}}),children:[qe("div",{className:Ct.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:bt.spacing.lg}),children:qe("div",{className:Ct.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[qe("h1",{className:Ct.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:bt.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:v.title}),v.description&&qe("p",{className:Ct.create("page-template-description",{margin:"0",marginTop:bt.spacing.sm,fontSize:bt.fontSize.small,lineHeight:"1.5",color:bt.colors.foreground,opacity:"0.7"}),children:v.description})]})}),qe("hr",{className:Ct.create("page-heading-border",{marginTop:bt.spacing.lg,borderColor:bt.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&qe(As,{organisation:s.organisation}),o.length>0&&o.map(e=>qe(Ys,{error:e,onDismiss:()=>l.dismissGeneralError(e.id)},e.id)),qe("div",{className:Ct.create("form-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.lg,boxShadow:bt.shadow.sm,display:"flex",flexDirection:"column",gap:bt.spacing.xl,flex:"1",minWidth:"0",overflow:"hidden"},{"(max-width: 950px)":{padding:bt.spacing.md,gap:bt.spacing.lg,flex:"initial"},"(max-width: 480px)":{padding:bt.spacing.md,gap:bt.spacing.md}}),children:[qe("form",{onSubmit:e=>e.preventDefault(),className:Ct.create("form-fields-container",{flex:"1"},{"(max-width: 950px)":{flex:"initial"}}),children:qe("div",{className:Ct.create("form-content-page",{display:"grid",gap:bt.spacing.md,rowGap:bt.spacing.lg,gridTemplateColumns:"repeat(12, minmax(0, 1fr))",minWidth:"0"},{"(max-width: 600px)":{display:"flex",flexDirection:"column"}}),children:v.fields.map(e=>{const t=e.code||e.id,n="promo_code"===t;if(!_(e))return null;if("section"===e.type)return qe(Us,{field:e,errors:[],children:qe("span",{})},e.id);if("notice"===e.type)return qe(Us,{field:e,errors:[],children:qe("span",{})},e.id);const r="validating"===d.status,o=n?qe("button",{type:"button",onClick:()=>p(),disabled:!m.trim()||r,style:{height:"2.75rem",minWidth:"5rem",padding:"0 1rem",fontSize:bt.fontSize.small,backgroundColor:bt.colors.primary,color:bt.colors.primaryForeground,border:"none",borderRadius:bt.radius.default,cursor:m.trim()&&!r?"pointer":"not-allowed",opacity:m.trim()&&!r?1:.5,whiteSpace:"nowrap"},children:r?qe(Rt,{size:"small"}):"Apply"}):void 0,s=!n||"valid"!==d.status&&"invalid"!==d.status?null:qe("div",{style:{marginTop:"0.5rem"},children:["valid"===d.status&&qe("span",{style:{color:"#22c55e",fontSize:bt.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[qe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:qe("path",{d:"M20 6 9 17l-5-5"})}),'Promo code "',d.name,'" applied']}),"invalid"===d.status&&qe("span",{style:{color:bt.colors.destructive,fontSize:bt.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[qe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[qe("circle",{cx:"12",cy:"12",r:"10"}),qe("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),qe("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),d.message]})]});return qe(Us,{field:e,errors:i,children:[qe(Os,{value:b(t,e).toString(),onChange:r=>{let i=r;"boolean"!==e.type&&"checkbox"!==e.type||(i="true"===r),l.updateFieldValue(v.id,t,i),n&&(f(r),h({status:"idle"}))},onKeyDown:n?g:void 0,answer:k(t),onAnswerChange:n=>{var r;l.updateFieldAnswer(v.id,t,n,null===(r=e.boolean_config)||void 0===r?void 0:r.details_rating_factor_id)},id:t,name:t,type:e.type,placeholder:e.placeholder,options:e.options,validation:e.validation,booleanConfig:e.boolean_config,add_null_option:e.add_null_option,null_option_label:e.null_option_label,inline:e.inline,hasError:l.hasFieldErrors(t),errors:l.getFieldErrors(t),suffix:o}),s]},e.id)})})}),$&&qe("div",{className:Ct.create("form-blocker",{backgroundColor:bt.colors.accent,borderRadius:bt.radius.default,padding:bt.spacing.lg,borderLeft:`4px solid ${bt.colors.primary}`}),children:[qe("h3",{className:Ct.create("form-blocker-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.125rem",fontWeight:"600",color:bt.colors.accentForeground}),children:$.config.title}),qe("p",{className:Ct.create("form-blocker-message",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.accentForeground,opacity:"0.9"}),children:$.config.message}),$.config.link&&qe("a",{href:$.config.link.url,target:"_blank",rel:"noopener noreferrer",className:Ct.create("form-blocker-link",{display:"inline-flex",alignItems:"center",gap:"0.375rem",marginTop:bt.spacing.md,fontSize:bt.fontSize.default,fontWeight:"600",color:bt.colors.primary,textDecoration:"none"}),children:[$.config.link.label,qe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[qe("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),qe("polyline",{points:"15 3 21 3 21 9"}),qe("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),qe("hr",{className:Ct.create("form-navigation-border",{borderColor:bt.colors.border})}),qe("div",{className:0===n?Ct.create("form-navigation-inline-first",{paddingTop:bt.spacing.lg,display:"flex",alignItems:"center",justifyContent:"flex-end"}):Ct.create("form-navigation-inline",{paddingTop:bt.spacing.lg,display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[n>0&&qe(os,{onClick:()=>null==l?void 0:l.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Back"}),!$&&qe(os,{onClick:async function(){l.validateCurrentPage().length>0||(n===r-1?await(null==l?void 0:l.calculateQuote()):await(null==l?void 0:l.navigateToNextPage()))},disabled:a,loading:a,children:n===r-1?"Get Quote":"Continue"})]})]})]}),qe("div",{className:Ct.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:qe(js,{pages:e.pages,currentPageIndex:n,completedPages:T})})]})})]})})}function Gs(){var e,t,n;const{quoteIntent:r,fsm:i}=At(e=>({quoteIntent:e.getQuoteIntent(),fsm:e})),o=null==r?void 0:r.payment_return,s=null==o?void 0:o.paymentTransactionId,a=null==o?void 0:o.transactionStatus,l=null===(e=null==r?void 0:r.organisation)||void 0===e?void 0:e.name,c=null===(t=null==r?void 0:r.organisation)||void 0===t?void 0:t.admin_email,u=null===(n=null==r?void 0:r.organisation)||void 0===n?void 0:n.phone,d=c||u;ot(()=>{if(s&&r){const e=null==o?void 0:o.paymentStatus,t=null==a?void 0:a.amount;"success"===e&&a?je(r,s,t||0,a.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&We(r,s,t,null==a?void 0:a.gateway_code,e,null==a?void 0:a.status)}const e=setTimeout(()=>{null==i||i.clearStoredQuoteIntent()},2e3);return()=>clearTimeout(e)},[i,s,o,r]);const h=Ct.create("success-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.xl,boxShadow:bt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:bt.spacing.lg},"(max-width: 480px)":{padding:bt.spacing.md}}),m=Ct.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:bt.spacing.lg}),f=Ct.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=Ct.create("success-header",{textAlign:"center",marginBottom:bt.spacing.xl}),g=Ct.create("success-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=Ct.create("success-message",{fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9",margin:"0"}),v=Ct.create("success-contact-section",{borderTop:`1px solid ${bt.colors.border}`,paddingTop:bt.spacing.xl,marginTop:bt.spacing.xl}),w=Ct.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:bt.colors.foreground,marginBottom:bt.spacing.md,textAlign:"center"}),b=Ct.create("success-contact-details",{backgroundColor:bt.colors.accent,borderRadius:bt.radius.default,padding:bt.spacing.md,display:"flex",flexDirection:"column",gap:bt.spacing.sm,marginBottom:bt.spacing.lg}),x=Ct.create("success-contact-item",{display:"flex",alignItems:"center",gap:bt.spacing.sm,fontSize:bt.fontSize.small,color:bt.colors.accentForeground}),k=Ct.create("success-actions",{display:"flex",gap:bt.spacing.md,flexWrap:"wrap",justifyContent:"center"}),N=Ct.create("success-reference",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,textAlign:"center",marginTop:bt.spacing.md});return qe(ns,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe(rs,{children:qe("div",{className:h,children:[qe("div",{className:m,children:qe("div",{className:f,children:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:qe("path",{d:"M20 6 9 17l-5-5"})})})}),qe("div",{className:p,children:[qe("h1",{className:g,children:"Payment Complete!"}),qe("p",{className:y,children:["Your payment has been processed successfully and your policy is being set up. You will receive your policy documentation by email."," ","For now, you can relax knowing you're ",l?`covered by ${l}`:"covered","."]})]}),d&&qe("div",{className:v,children:[qe("h3",{className:w,children:"Need assistance?"}),qe("div",{className:b,children:[c&&qe("div",{className:x,children:[qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[qe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),qe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),qe("span",{children:c})]}),u&&qe("div",{className:x,children:[qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:qe("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),qe("span",{children:u})]})]}),qe("div",{className:k,children:[u&&qe(os,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:qe("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),"Call Us"]}),c&&qe(os,{variant:"outline",onClick:()=>window.open(`mailto:${c}`),children:[qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:[qe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),qe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),r.reference&&qe("div",{className:N,children:["Quote Reference: ",qe("strong",{children:r.reference})]})]})})})})}function Vs({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,s]=it("initiating"),[a,l]=it(null),[c,u]=it(null),[d,h]=it(null);ot(()=>{e&&r&&m()},[e,r]);const m=async()=>{var e;if(r)try{s("initiating"),l(null);const t={...r,returnUrl:window.location.href},n=null===(e=r.metadata)||void 0===e?void 0:e.gateway;if(!n)throw new Error("Payment gateway not found");const o=await i.initiatePayment(t,n);h(o.transaction_id),s("redirecting"),window.location.href=o.gateway_acceptance_url}catch(e){l(e.message||"Failed to initiate payment"),s("failed")}},f=()=>{c&&!c.closed&&c.close(),s("initiating"),l(null),h(null),u(null),t()};return e?qe("div",{className:Ct.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),children:[qe("div",{className:Ct.create("modal-content",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${bt.colors.border}`}),children:[qe("div",{className:Ct.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[qe("div",{className:Ct.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),qe("h2",{className:Ct.create("modal-title",{margin:"0",color:bt.colors.foreground,fontSize:bt.fontSize.large}),children:"Payment Processing"})]}),qe("div",{className:Ct.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[qe(ls,{className:Ct.create("status-message",{fontSize:bt.fontSize.default,color:bt.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(o){case"initiating":return"Setting up your payment...";case"redirecting":return"Redirecting to payment portal...";case"processing":default:return"Processing payment...";case"polling":return"Checking payment status...";case"completed":return"Payment completed successfully!";case"cancelled":return"Payment was cancelled";case"failed":return"Payment failed"}})()}),a&&qe(ls,{className:Ct.create("error-message",{color:bt.colors.destructive,fontSize:bt.fontSize.small,padding:"0.75rem",backgroundColor:bt.colors.destructive+"10",borderRadius:bt.radius.default,border:`1px solid ${bt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&qe("div",{className:Ct.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${bt.colors.border}`,borderTop:`3px solid ${bt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),qe("div",{className:Ct.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?qe($,{children:[qe(os,{onClick:f,variant:"outline",children:"Close"}),"cancelled"===o&&qe(os,{onClick:()=>{s("initiating"),l(null),m()},children:"Try Again"})]}):qe(os,"completed"===o?{onClick:f,children:"Continue"}:{onClick:f,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),qe("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Qs({transactionId:e,organisationId:t,allowCancel:n=!0}){const{httpClient:r}=Wt(),[i,o]=it(!0),[s,a]=it(null),[l,c]=it(null),[u,d]=it(!1),[h,m]=it(!1),[f,p]=it(!1);ot(()=>{g()},[e]);const g=async()=>{try{if(o(!0),a(null),!r)throw new Error("HTTP client not available");const n=r.getBaseUrl(),i=await fetch(`${n}/payments/bank-transfer/${e}?orgId=${t}`);if(!i.ok)throw new Error(`Failed to load bank transfer details: ${i.statusText}`);const s=await i.json(),l=s.data||s;c({bank_account_name:l.bank_account_name,bank_account_number:l.bank_account_number,instructions_html:l.instructions_html,reference:l.reference,amount:Number(l.amount),currency:l.currency})}catch(e){a(e.message||"Failed to load bank transfer details")}finally{o(!1)}};return i?qe(is,{message:"Loading payment details..."}):s?qe(ns,{title:"Error",description:"Failed to load bank transfer details",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe(rs,{children:qe("div",{className:Ct.create("error-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.xl,boxShadow:bt.shadow.sm,maxWidth:"42rem",margin:"0 auto",textAlign:"center"},{"(max-width: 480px)":{padding:bt.spacing.lg}}),children:[qe("div",{className:Ct.create("error-icon",{fontSize:"3rem",marginBottom:bt.spacing.md,color:bt.colors.destructive}),children:"⚠️"}),qe("h2",{className:Ct.create("error-title",{margin:"0",marginBottom:bt.spacing.sm,color:bt.colors.foreground}),children:"Error Loading Payment Details"}),qe("p",{className:Ct.create("error-message",{color:bt.colors.mutedForeground}),children:s})]})})})}):l?qe(ns,{title:"Bank Transfer Payment",description:"Complete your payment via bank transfer",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:[qe(rs,{children:qe("div",{className:Ct.create("bank-transfer-container",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,maxWidth:"42rem",margin:"0 auto",overflow:"hidden",boxShadow:"0 20px 60px rgba(0,0,0,0.1)"}),children:[qe("div",{style:{backgroundColor:bt.colors.primary},className:Ct.create("bank-transfer-header",{color:"white",padding:"2.5rem 2rem",textAlign:"center"},{"(max-width: 480px)":{padding:"1.5rem 1rem"}}),children:[qe("h1",{className:Ct.create("header-title",{fontSize:"1.75rem",fontWeight:"700",margin:"0",marginBottom:"0.5rem"},{"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:"0.25rem"}}),children:"Bank Transfer Payment"}),qe("p",{className:Ct.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:bt.fontSize.small}}),children:"Complete your payment using the details below"})]}),qe("div",{className:Ct.create("bank-transfer-content",{padding:"2rem"},{"(max-width: 480px)":{padding:"1rem"}}),children:[qe("div",{className:Ct.create("payment-details-card",{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:bt.radius.default,padding:"1.5rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[qe("div",{className:Ct.create("detail-row-amount",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.5rem"}}),children:[qe("span",{className:Ct.create("detail-label",{color:"#6b7280",fontSize:bt.fontSize.default}),children:"Amount to Transfer"}),qe("span",{className:Ct.create("detail-value-amount",{color:bt.colors.primary,fontSize:"1.5rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:["$",l.amount.toFixed(2)," ",l.currency]})]}),qe("div",{className:Ct.create("detail-row-name",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[qe("span",{className:Ct.create("detail-label-name",{color:"#6b7280",fontSize:bt.fontSize.default}),children:"Account Name"}),qe("span",{className:Ct.create("detail-value-name",{color:bt.colors.foreground,fontSize:bt.fontSize.default,fontWeight:"600"}),children:l.bank_account_name})]}),qe("div",{className:Ct.create("detail-row-number",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[qe("span",{className:Ct.create("detail-label-number",{color:"#6b7280",fontSize:bt.fontSize.default}),children:"Account Number"}),qe("span",{className:Ct.create("detail-value-number",{color:bt.colors.foreground,fontSize:bt.fontSize.default,fontWeight:"600"}),children:l.bank_account_number})]}),qe("div",{className:Ct.create("detail-row-ref",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[qe("span",{className:Ct.create("detail-label-ref",{color:"#6b7280",fontSize:bt.fontSize.default}),children:"Payment Reference"}),qe("span",{className:Ct.create("detail-value-ref",{color:bt.colors.foreground,fontSize:bt.fontSize.default,fontWeight:"600"}),children:l.reference})]})]}),qe("div",{className:Ct.create("instructions-card",{backgroundColor:"#eff6ff",borderLeft:`4px solid ${bt.colors.primary}`,borderRadius:bt.radius.default,padding:"1.25rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[qe("h3",{className:Ct.create("instructions-title",{margin:"0 0 0.75rem 0",fontSize:bt.fontSize.default,fontWeight:"600",color:bt.colors.foreground}),children:"Payment Instructions"}),qe("p",{className:Ct.create("instructions-text",{margin:"0 0 0.75rem 0",fontSize:bt.fontSize.small,lineHeight:"1.6",color:bt.colors.foreground}),children:[qe("strong",{children:"Important:"})," Please include the payment reference when making your transfer to ensure your payment is processed correctly."]}),qe("p",{className:Ct.create("instructions-text",{margin:"0",fontSize:bt.fontSize.small,lineHeight:"1.6",color:bt.colors.foreground}),children:"Once we receive your payment, we'll process your quote and send you a confirmation email."})]}),qe("div",{className:Ct.create("button-wrapper",{textAlign:"center",marginBottom:"1.5rem",display:"flex",gap:"1rem",justifyContent:"center",flexWrap:"wrap"},{"(max-width: 480px)":{flexDirection:"column",gap:"0.75rem",marginBottom:"1rem"}}),children:[qe("button",{onClick:()=>{d(!0)},style:{backgroundColor:bt.colors.primary},className:Ct.create("confirm-button",{color:"white",border:"none",borderRadius:bt.radius.default,padding:"0.75rem 2rem",fontSize:bt.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"opacity 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"I've Made the Transfer"}),n&&qe("button",{onClick:()=>{m(!0)},className:Ct.create("cancel-button",{color:"#6b7280",backgroundColor:"white",border:"2px solid #e5e7eb",borderRadius:bt.radius.default,padding:"0.75rem 2rem",fontSize:bt.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"all 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"Cancel"})]}),qe("p",{className:Ct.create("footer-text",{textAlign:"center",color:"#6b7280",fontSize:bt.fontSize.small,margin:"0"}),children:"Your quote has been saved. We'll process it once payment is received."})]})]})}),h&&qe("div",{className:Ct.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),onClick:()=>!f&&m(!1),children:qe("div",{className:Ct.create("modal-content",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${bt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:bt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[qe("div",{className:Ct.create("warning-icon",{fontSize:"4rem",marginBottom:bt.spacing.md}),children:"⚠️"}),qe("h3",{className:Ct.create("modal-title",{margin:"0",marginBottom:bt.spacing.sm,color:bt.colors.foreground,fontSize:bt.fontSize.large,fontWeight:"600"}),children:"Are you sure?"}),qe("p",{className:Ct.create("modal-message",{margin:"0",marginBottom:bt.spacing.lg,color:bt.colors.foreground,lineHeight:"1.6"}),children:"This will take you back to the checkout page."}),qe("div",{className:Ct.create("modal-buttons",{display:"flex",flexDirection:"column-reverse",gap:"0.75rem",justifyContent:"center"}),children:[qe("button",{onClick:()=>m(!1),disabled:f,className:Ct.create("no-button",{backgroundColor:"#f3f4f6",color:bt.colors.foreground,border:"none",borderRadius:bt.radius.default,padding:`${bt.spacing.sm} ${bt.spacing.lg}`,fontSize:bt.fontSize.default,fontWeight:"500",cursor:f?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:f?"0.5":"1",width:"100%"}),children:"No, Go Back"}),qe("button",{onClick:async()=>{if(r)try{p(!0);const n=r.getBaseUrl();if(!(await fetch(`${n}/payments/${e}/cancel-bank-transfer?orgId=${t}`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to cancel payment");window.location.reload()}catch(e){a("Failed to cancel payment. Please try again."),m(!1),p(!1)}},disabled:f,className:Ct.create("yes-button",{backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:bt.radius.default,padding:`${bt.spacing.sm} ${bt.spacing.lg}`,fontSize:bt.fontSize.default,fontWeight:"500",cursor:f?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:f?"0.5":"1",width:"100%"}),children:f?"Cancelling...":"Yes, Cancel Payment"})]})]})}),u&&qe("div",{className:Ct.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),onClick:()=>d(!1),children:qe("div",{className:Ct.create("modal-content",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${bt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:bt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[qe("div",{className:Ct.create("success-icon",{fontSize:"4rem",marginBottom:bt.spacing.md}),children:"✓"}),qe("h3",{className:Ct.create("modal-title",{margin:"0",marginBottom:bt.spacing.sm,color:bt.colors.primary,fontSize:bt.fontSize.large,fontWeight:"600"}),children:"Thank You!"}),qe("p",{className:Ct.create("modal-message",{margin:"0",marginBottom:bt.spacing.lg,color:bt.colors.foreground,lineHeight:"1.6"}),children:"We'll process your payment as soon as we receive it. You'll receive a confirmation email once your coverage is activated."}),qe("button",{onClick:()=>d(!1),className:Ct.create("close-button",{backgroundColor:bt.colors.primary,color:"white",border:"none",borderRadius:bt.radius.default,padding:`${bt.spacing.sm} ${bt.spacing.lg}`,fontSize:bt.fontSize.default,fontWeight:"500",cursor:"pointer",transition:"opacity 150ms ease"}),children:"Close"})]})})]})}):null}Ct.pseudoElement("sidebar-continue-later-button",":hover",{backgroundColor:bt.colors.muted,borderColor:bt.colors.primary,color:bt.colors.primary});class Js{static async loadTheme(e){try{if(t(e.slug),t(e.theme_url),this.loadedThemes.has(e.slug))return void t(e.slug);const n=await fetch(e.theme_url,{method:"GET",headers:{Accept:"text/css"}});if(!n.ok)throw new Error(`Failed to load theme: ${n.status} ${n.statusText}`);const r=await n.text();t(r.substring(0,200));const i=this.parseCSSContent(r);t(i.mappedVariables),t(i.classRules.length),this.applyParsedTheme(e.slug,i),this.loadedThemes.add(e.slug),t(e.slug)}catch(n){throw t(e.slug),n}}static parseCSSContent(e){t();const n={},r={};let i="";const o=e.match(/:root\s*\{([^}]+)\}/);if(o){const e=o[1];t(null==e||e.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(e));){const e=`--${s[1]}`,i=s[2].trim();n[e]=i;const o=this.variableMapping[e];o?(r[o]=i,t()):t()}}else t();return i=e.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&t(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(e,n){t(),Promise.resolve().then(function(){return It}).then(({updateBaseVariables:e})=>{Object.keys(n.mappedVariables).length>0&&(t(n.mappedVariables),e(n.mappedVariables))}).catch(()=>{t()}),n.classRules&&this.applyClassRules(e,n.classRules),this.injectOriginalCSS(e,n)}static applyClassRules(e,n){const r=document.getElementById(`insure-os-theme-classes-${e}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static injectOriginalCSS(e,n){const r=document.getElementById(`insure-os-theme-original-${e}`);r&&r.remove();const i={};for(const[e,t]of Object.entries(n.variables))this.variableMapping[e]||(i[e]=t);if(Object.keys(i).length>0){const n=`:root {\n${Object.entries(i).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,r=document.createElement("style");r.id=`insure-os-theme-original-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static removeTheme(e){let n=!1;[`insure-os-theme-classes-${e}`,`insure-os-theme-original-${e}`].forEach(e=>{const t=document.getElementById(e);t&&(t.remove(),n=!0)}),n&&(this.loadedThemes.delete(e),t())}static isThemeLoaded(e){return this.loadedThemes.has(e)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}Js.loadedThemes=new Set,Js.variableMapping={"--color-primary":"--insure-os-primary","--color-primary-foreground":"--insure-os-primary-foreground","--color-secondary":"--insure-os-secondary","--color-secondary-foreground":"--insure-os-secondary-foreground","--color-accent":"--insure-os-accent","--color-accent-foreground":"--insure-os-accent-foreground","--color-background":"--insure-os-background","--color-foreground":"--insure-os-foreground","--color-card":"--insure-os-card","--color-card-foreground":"--insure-os-card-foreground","--color-popover":"--insure-os-popover","--color-popover-foreground":"--insure-os-popover-foreground","--color-muted":"--insure-os-muted","--color-muted-foreground":"--insure-os-muted-foreground","--color-destructive":"--insure-os-destructive","--color-border":"--insure-os-border","--color-input":"--insure-os-input","--color-ring":"--insure-os-ring","--font-sans":"--insure-os-font-family","--radius":"--insure-os-radius","--radius-sm":"--insure-os-radius-sm","--radius-lg":"--insure-os-radius-lg"};var Ks=Object.freeze({__proto__:null,ThemeLoader:Js});function Xs({paymentLinkId:e,signedUrl:n}){var r,i,o,s,a,l,c,u,d,h;const m=Wt().httpClient,[f,p]=it(null),[g,y]=it(!0),[v,w]=it(null),[b,x]=it(!1),[k,N]=it(null),[S,_]=it(null),[C,I]=it(null),[T,E]=it(!1),[P,D]=it(null),[z,R]=it(null),[M,O]=it(!0),[j,W]=it(()=>{var e;return null!==(e=(new Date).toISOString().split("T")[0])&&void 0!==e?e:""}),[A,L]=it(null),[B,F]=it(!1),[q,H]=it(null),[U,Y]=it(null),[Z,G]=it(null);ot(()=>{V()},[e]);const V=async()=>{var r,i,o;try{y(!0);const s=new URLSearchParams(window.location.search),a=s.get("transactionId"),l=s.get("status"),c=s.get("gateway_code"),u=s.get("excess_id");a&&l&&(E(!0),D(l),R(a)),c&&I(c);const d=n?await m.getPaymentLinkDetails(n):await m.getPaymentLinkById(e);if(d.organisation&&d.organisation.theme)try{await Js.loadTheme({slug:d.organisation.slug,theme_url:d.organisation.theme.css_url})}catch(e){t()}if("paid"===d.status&&!T&&(!a||"completed"!==l&&"success"!==l))return p(d),void w("This payment link has already been used.");if("superseded"===d.status)return p(d),void w("This payment link has been replaced by a newer one. Please use the latest link you received.");if("confirmed"===d.status)return p(d),void Y({message:"Your renewal is confirmed. Your premium funding will continue automatically on the policy start date.",effectiveDate:null===(r=d.metadata)||void 0===r?void 0:r.effective_date});if("expired"===d.status)return p(d),void w("This payment link has expired.");if("cancelled"===d.status)return p(d),void w("This payment link has been cancelled.");if("outdated"===d.status)return p(d),void w("This payment link is no longer valid because the quote has been updated. Please request a new payment link.");if("awaiting_payment"===d.status&&d.pending_bank_transfer){const e=d.pending_bank_transfer;return t(),void G({transactionId:e.transaction_id,organisationId:(null===(i=d.organisation)||void 0===i?void 0:i.id)||""})}if(u){const e=d.calculations.find(e=>e.excess_id===u);e?_(e.id):1===d.calculations.length&&d.calculations[0]&&_(d.calculations[0].id)}else 1===d.calculations.length&&d.calculations[0]&&_(d.calculations[0].id);!c&&1===d.payment_options.length&&d.payment_options[0]&&I(d.payment_options[0].gateway_code),p(d),(null===(o=d.organisation)||void 0===o?void 0:o.quote_page_url)&&H(d.organisation.quote_page_url)}catch(e){w("Failed to load payment details. Please check your link.")}finally{y(!1)}},Q=at(()=>f&&S?f.calculations.find(e=>e.id===S):null,[f,S]),J=at(()=>f&&C?f.payment_options.find(e=>e.gateway_code===C):null,[f,C]);if(Z)return qe(Qs,{transactionId:Z.transactionId,organisationId:Z.organisationId,allowCancel:!1});if(U){const e=null==f?void 0:f.organisation,t=null==e?void 0:e.admin_email,n=null==e?void 0:e.phone,r=t||n;return qe(ns,{title:"Renewal Confirmed",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe("div",{className:Ct.create("auto-renew-success-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.xl,boxShadow:bt.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[qe("div",{className:Ct.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:bt.spacing.lg}),children:qe("div",{className:Ct.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:qe("path",{d:"M20 6 9 17l-5-5"})})})}),qe("div",{className:Ct.create("success-header",{textAlign:"center",marginBottom:bt.spacing.xl}),children:[qe("h1",{className:Ct.create("success-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Renewal Confirmed"}),qe("p",{className:Ct.create("success-message",{fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9",margin:"0"}),children:U.message})]}),U.effectiveDate&&qe("div",{className:Ct.create("payment-date-box",{backgroundColor:bt.colors.accent,borderRadius:bt.radius.default,padding:bt.spacing.lg,marginBottom:bt.spacing.lg,textAlign:"center"}),children:[qe("p",{className:Ct.create("payment-date-label",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,margin:"0",marginBottom:bt.spacing.sm}),children:"Your first payment will be on"}),qe("p",{className:Ct.create("payment-date-value",{fontSize:"1.25rem",fontWeight:"600",color:bt.colors.foreground,margin:"0"}),children:new Date(U.effectiveDate).toLocaleDateString("en-NZ",{weekday:"long",year:"numeric",month:"long",day:"numeric"})})]}),qe("div",{className:Ct.create("info-box",{backgroundColor:bt.colors.muted,borderRadius:bt.radius.default,padding:bt.spacing.md,marginBottom:bt.spacing.lg}),children:qe("p",{className:Ct.create("info-text",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,margin:"0",textAlign:"center"}),children:"No further action is required. Your monthly payments will continue as normal."})}),r&&qe("div",{className:Ct.create("contact-section",{borderTop:`1px solid ${bt.colors.border}`,paddingTop:bt.spacing.xl,marginTop:bt.spacing.xl}),children:[qe("h3",{className:Ct.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:bt.colors.foreground,marginBottom:bt.spacing.md,textAlign:"center"}),children:"Need assistance?"}),qe("div",{className:Ct.create("contact-details",{backgroundColor:bt.colors.accent,borderRadius:bt.radius.default,padding:bt.spacing.md,display:"flex",flexDirection:"column",gap:bt.spacing.sm}),children:[t&&qe("div",{className:Ct.create("contact-item",{display:"flex",alignItems:"center",gap:bt.spacing.sm,fontSize:bt.fontSize.small,color:bt.colors.accentForeground}),children:qe("span",{children:["Email: ",t]})}),n&&qe("div",{className:Ct.create("contact-item",{display:"flex",alignItems:"center",gap:bt.spacing.sm,fontSize:bt.fontSize.small,color:bt.colors.accentForeground}),children:qe("span",{children:["Phone: ",n]})})]})]})]})})})}if(g)return qe(ns,{title:"Loading...",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe("div",{className:Ct.create("payment-link-loading-card",{textAlign:"center",padding:bt.spacing.xl,backgroundColor:bt.colors.card,borderRadius:bt.radius.large,boxShadow:bt.shadow.sm,maxWidth:"600px",margin:"0 auto"}),children:qe("p",{className:Ct.create("loading-text",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.default}),children:"Loading payment details..."})})})});if(v){const e=null==f?void 0:f.organisation,t=null==e?void 0:e.quote_page_url,n=null==e?void 0:e.name,r=null==e?void 0:e.admin_email,i=null==e?void 0:e.phone,o=r||i,s=Ct.create("pl-error-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.xl,boxShadow:bt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:bt.spacing.lg},"(max-width: 480px)":{padding:bt.spacing.md}}),a=Ct.create("pl-error-icon-container",{display:"flex",justifyContent:"center",marginBottom:bt.spacing.lg}),l=Ct.create("pl-error-icon",{width:"4rem",height:"4rem",color:bt.colors.primary}),c=Ct.create("pl-error-header",{textAlign:"center",marginBottom:bt.spacing.xl}),u=Ct.create("pl-error-title",{fontSize:"2rem",fontWeight:"700",color:bt.colors.primary,marginBottom:bt.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),d=Ct.create("pl-error-subtitle",{fontSize:bt.fontSize.default,color:bt.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),h=Ct.create("pl-error-contact-section",{borderTop:`1px solid ${bt.colors.border}`,paddingTop:bt.spacing.xl,marginTop:bt.spacing.xl,textAlign:"center"}),m=Ct.create("pl-error-contact-text",{fontSize:bt.fontSize.default,color:bt.colors.foreground,marginBottom:bt.spacing.lg}),p=Ct.create("pl-error-actions",{display:"flex",gap:bt.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:bt.spacing.lg}),g=()=>qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:l,children:[qe("circle",{cx:"12",cy:"12",r:"10"}),qe("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),qe("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]});return qe(ns,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe(rs,{children:qe("div",{className:s,children:[qe("div",{className:a,children:qe(g,{})}),qe("div",{className:c,children:[qe("h1",{className:u,children:"Payment Link Unavailable"}),qe("p",{className:d,children:v})]}),t&&qe("div",{className:Ct.create("pl-error-quote-action",{display:"flex",justifyContent:"center",marginBottom:o?"0":bt.spacing.sm}),children:qe(os,{variant:"primary",onClick:()=>{window.location.href=t},children:"Start a New Quote"})}),o&&qe("div",{className:h,children:[qe("p",{className:m,children:n?`Need assistance? Contact ${n}`:"Need assistance? Contact us"}),qe("div",{className:p,children:[i&&qe(os,{variant:"outline",onClick:()=>window.open(`tel:${i}`),children:[qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:qe("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),"Call Us"]}),r&&qe(os,{variant:"outline",onClick:()=>window.open(`mailto:${r}`),children:[qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:[qe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),qe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]})]})})})})}if(!f)return null;const K=new URLSearchParams(window.location.search),X=K.get("transactionId"),ee=K.get("status"),te=X&ⅇif("paid"===f.status&&("completed"===ee||"success"===ee||te||T||"completed"===P)){const e=null===(r=f.organisation)||void 0===r?void 0:r.admin_email,t=null===(i=f.organisation)||void 0===i?void 0:i.phone,n=e||t;return qe(ns,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe("div",{className:Ct.create("payment-success-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.xl,boxShadow:bt.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[qe("div",{className:Ct.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:bt.spacing.lg}),children:qe("div",{className:Ct.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:qe("path",{d:"M20 6 9 17l-5-5"})})})}),qe("div",{className:Ct.create("success-header",{textAlign:"center",marginBottom:bt.spacing.xl}),children:[qe("h1",{className:Ct.create("success-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Payment Complete!"}),qe("p",{className:Ct.create("success-message",{fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&qe("div",{className:Ct.create("contact-section",{borderTop:`1px solid ${bt.colors.border}`,paddingTop:bt.spacing.xl,marginTop:bt.spacing.xl}),children:[qe("h3",{className:Ct.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:bt.colors.foreground,marginBottom:bt.spacing.md,textAlign:"center"}),children:"Need assistance?"}),qe("div",{className:Ct.create("contact-details",{backgroundColor:bt.colors.accent,borderRadius:bt.radius.default,padding:bt.spacing.md,display:"flex",flexDirection:"column",gap:bt.spacing.sm,marginBottom:bt.spacing.lg}),children:[e&&qe("div",{className:Ct.create("contact-item",{display:"flex",alignItems:"center",gap:bt.spacing.sm,fontSize:bt.fontSize.small,color:bt.colors.accentForeground}),children:qe("span",{children:["Email: ",e]})}),t&&qe("div",{className:Ct.create("contact-item",{display:"flex",alignItems:"center",gap:bt.spacing.sm,fontSize:bt.fontSize.small,color:bt.colors.accentForeground}),children:qe("span",{children:["Phone: ",t]})})]}),(z||X)&&qe("div",{className:Ct.create("reference",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,textAlign:"center",marginTop:bt.spacing.md}),children:["Transaction ID: ",qe("strong",{children:null===(o=z||X)||void 0===o?void 0:o.slice(0,8).toUpperCase()})]})]})]})})})}const ne=M&&te&&("failed"===ee||"cancelled"===ee||"failed"===P||"cancelled"===P),re="cancelled"===ee||"cancelled"===P?"cancelled":"failed"===ee||"failed"===P?"declined":"error",ie=f.calculations,oe=ie.length>1,se=ie.length>0,ae=se,le=(null===(s=f.metadata)||void 0===s?void 0:s.product_name)||"Payment",ce=new Date(f.expires_at),ue=Boolean(null===(a=null==f?void 0:f.metadata)||void 0===a?void 0:a.quote_intent_id),de=Boolean((!se||S)&&C&&!A&&!B),he=at(()=>{var e;const t=null===(e=null==f?void 0:f.metadata)||void 0===e?void 0:e.client_details;return t?{firstName:t.first_name,lastName:t.last_name,email:t.email,phone:t.phone}:null},[f]),me=at(()=>Q&&Q.line_item_display||null,[Q]);return qe(ns,{title:"Complete Your Purchase",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:[qe("div",{className:Ct.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:bt.spacing.lg},{"(max-width: 950px)":{display:"flex",flexDirection:"column"},"(max-width: 480px)":{gap:bt.spacing.md}}),children:[qe("div",{className:Ct.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,display:"flex",flexDirection:"column"}),children:[qe("div",{className:Ct.create("checkout-header",{paddingInline:bt.spacing.xl,paddingTop:bt.spacing.xl,paddingBottom:bt.spacing.lg},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingTop:bt.spacing.md}}),children:[qe("h2",{className:Ct.create("checkout-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),qe("p",{className:Ct.create("checkout-description",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9"}),children:se?oe?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage.":"Choose your payment option to complete your purchase."}),qe("hr",{className:Ct.create("checkout-header-border",{marginTop:bt.spacing.lg,border:"0",borderTop:`1px solid ${bt.colors.border}`,height:"0"})})]}),qe("div",{className:Ct.create("checkout-sections",{paddingInline:bt.spacing.xl,paddingBottom:bt.spacing.xl,display:"flex",flexDirection:"column",gap:bt.spacing.lg},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingBottom:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingBottom:bt.spacing.md}}),children:[ue&&qe("div",{className:Ct.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[qe(cs,{title:"Cover Start Date"}),qe("div",{className:Ct.create("cover-date-container",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:[qe("input",{type:"date",value:j,onChange:e=>{return t=e.target.value,W(t),void(async e=>{var t;if(f&&m&&(null===(t=f.metadata)||void 0===t?void 0:t.quote_intent_id)){F(!0),L(null);try{const t=await m.validateCoverStartDate(f.payment_link_id,e);t.valid?L(null):(L(t.message||"This cover start date is not valid."),t.quote_page_url&&H(t.quote_page_url))}catch(e){L("Failed to validate cover date. Please try again.")}finally{F(!1)}}})(t);var t},min:(new Date).toISOString().split("T")[0],max:(()=>{const e=new Date;return e.setDate(e.getDate()+30),e.toISOString().split("T")[0]})(),disabled:B,className:Ct.create("cover-date-input",{padding:"0.75rem 1rem",fontSize:bt.fontSize.default,border:`2px solid ${A?bt.colors.destructive:bt.colors.border}`,borderRadius:bt.radius.default,backgroundColor:bt.colors.background,color:bt.colors.foreground,width:"auto",maxWidth:"200px",cursor:B?"wait":"pointer"})}),B&&qe("p",{className:Ct.create("validating-text",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,margin:"0"}),children:"Validating..."}),A&&qe("div",{className:Ct.create("cover-date-error",{backgroundColor:`${bt.colors.destructive}10`,border:`1px solid ${bt.colors.destructive}`,borderRadius:bt.radius.default,padding:"1rem"}),children:[qe("p",{className:Ct.create("error-message",{color:bt.colors.destructive,fontSize:bt.fontSize.small,margin:"0",marginBottom:q?bt.spacing.md:"0"}),children:A}),q&&qe("a",{href:q,className:Ct.create("new-quote-link",{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:bt.colors.primary,fontSize:bt.fontSize.small,fontWeight:"500",textDecoration:"none"}),children:["Start New Quote",qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[qe("path",{d:"M5 12h14"}),qe("path",{d:"m12 5 7 7-7 7"})]})]})]})]})]}),ae&&se&&qe("div",{className:Ct.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[qe(cs,{title:1===ie.length?"Excess":"Excess Options"}),qe("div",{className:Ct.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:[...ie].sort((e,t)=>e.excess_amount-t.excess_amount).map(e=>{const t=e.id===S;return qe("div",{className:zt(Ct.create("excess-option-card",{borderRadius:bt.radius.default,minWidth:"125px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),t?Ct.create("excess-option-card-selected",{border:`2px solid ${bt.colors.primary}`,backgroundColor:bt.colors.accent}):Ct.create("excess-option-card-unselected",{border:`2px solid ${bt.colors.border}`,backgroundColor:bt.colors.card})),onClick:()=>_(e.id),children:[qe(us,{selected:t}),qe("div",{className:Ct.create("excess-amount",{color:bt.colors.foreground}),children:[e.excess_label||`$${Number(e.excess_amount).toFixed(0)}`,e.description?"*":""]})]},e.id)})}),(null==Q?void 0:Q.description)&&qe("div",{className:Ct.create("excess-description",{padding:"0.75rem",backgroundColor:bt.colors.muted,borderRadius:bt.radius.default,border:`1px solid ${bt.colors.border}`}),children:qe(ls,{className:Ct.create("excess-description-text",{fontSize:bt.fontSize.small,color:bt.colors.foreground,margin:"0"}),children:Q.description})})]}),f.payment_options.length>0&&qe("div",{className:Ct.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[qe(cs,{title:"Payment Options"}),qe("div",{className:Ct.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:f.payment_options.map(e=>{const t=C===e.gateway_code,n="monthly"===e.payment_frequency,r=()=>{var t;return n&&e.amount.monthly?`${hs(parseFloat(e.amount.monthly))} x ${(null===(t=e.metadata)||void 0===t?void 0:t.number_of_instalments)||12}`:hs(parseFloat(e.amount.due_today))},i=()=>e.description?e.description:"bank_transfer"===e.gateway_code?"Manual":`via ${e.gateway_name}`;return qe("div",{className:zt(Ct.create("payment-option-row",{borderRadius:bt.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"},{"(max-width: 480px)":{padding:"0.625rem 0.75rem",gap:"0.25rem",flexWrap:"wrap",alignItems:"flex-start"}}),t?Ct.create("payment-option-row-selected",{border:`2px solid ${bt.colors.primary}`,backgroundColor:bt.colors.accent}):Ct.create("payment-option-row-unselected",{border:`2px solid ${bt.colors.border}`,backgroundColor:bt.colors.card})),onClick:()=>I(e.gateway_code),children:[qe("div",{className:Ct.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[qe(us,{selected:t}),qe("div",{className:Ct.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[qe("div",{className:Ct.create("frequency-title",{fontSize:bt.fontSize.default,fontWeight:"500",color:bt.colors.foreground}),children:e.display_title||ms(n?"monthly":"one-time",e.gateway_code)}),qe("div",{className:Ct.create("gateway-description",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground}),children:i()})]})]}),qe("div",{className:Ct.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[qe(ls,{className:Ct.create("amount-text",{textAlign:"right",color:bt.colors.foreground}),children:r()}),"bank_transfer"!==e.gateway_code&&qe(ls,{size:"small",className:Ct.create("gateway-fee-text",{textAlign:"right",color:bt.colors.mutedForeground}),children:["bank_transfer"===e.gateway_code?null:(null===(o=e.metadata)||void 0===o?void 0:o.gateway_fee)?hs(parseFloat(e.metadata.gateway_fee)):hs(0)," fee"]}),"bank_transfer"===e.gateway_code&&qe(ls,{size:"small",className:Ct.create("no-fee-text",{textAlign:"right",color:bt.colors.mutedForeground}),children:"No fees"})]}),qe("div",{className:Ct.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[qe(us,{selected:t}),qe("div",{className:Ct.create("payment-option-title-mobile",{fontSize:bt.fontSize.default,fontWeight:"500",color:bt.colors.foreground}),children:e.display_title||ms(n?"monthly":"one-time",e.gateway_code)})]}),qe("div",{className:Ct.create("payment-option-bottom-mobile",{display:"none"},{"(max-width: 480px)":{display:"flex",flex:"1 1 100%",justifyContent:"space-between",alignItems:"center",paddingLeft:"1.5rem"}}),children:[qe("div",{className:Ct.create("gateway-description-mobile",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground}),children:i()}),qe(ls,{className:Ct.create("amount-text-mobile",{fontWeight:"500",color:bt.colors.foreground}),children:r()})]})]},e.gateway_code);var o})})]})]})]}),qe("div",{className:Ct.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:qe("div",{className:Ct.create("checkout-sidebar-sticky",{}),children:[(he||me&&me.length>0)&&qe("div",{className:Ct.create("insurance-details-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,padding:bt.spacing.lg,boxShadow:bt.shadow.sm},{"(max-width: 768px)":{padding:bt.spacing.md}}),children:[qe("h3",{className:Ct.create("cart-summary-title",{fontSize:bt.fontSize.large,fontWeight:"600",marginBottom:bt.spacing.md,color:bt.colors.foreground}),children:ae?"Insurance Details":"Payment Details"}),he&&qe($,{children:[qe("div",{className:Ct.create("client-details",{display:"flex",flexDirection:"column",gap:bt.spacing.sm,marginBottom:bt.spacing.md}),children:[he.firstName&&he.lastName&&qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Name"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:[he.firstName," ",he.lastName]})]}),he.email&&qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Email"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:he.email})]}),he.phone&&qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Phone"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:he.phone})]}),"Payment"!==le&&qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Product"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:le})]}),qe("div",{className:Ct.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("detail-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:"Link Expires"}),qe("span",{className:Ct.create("detail-value",{fontWeight:"500",color:bt.colors.foreground,fontSize:bt.fontSize.small}),children:ce.toLocaleDateString()})]})]}),qe("hr",{className:Ct.create("divider",{border:"none",borderTop:`1px solid ${bt.colors.border}`,margin:`${bt.spacing.md} 0`})})]}),me&&me.length>0&&qe("div",{className:Ct.create("line-items-section",{display:"flex",flexDirection:"column",gap:bt.spacing.md}),children:me.map((e,t)=>qe("div",{className:Ct.create("line-item",{}),children:[qe("div",{className:Ct.create("line-item-description",{fontSize:bt.fontSize.small,fontWeight:"500",color:bt.colors.foreground}),children:e.description}),e.show_sum_insured&&null!=e.sum_insured&&qe("div",{className:Ct.create("line-item-sum-insured",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground,marginTop:bt.spacing.sm}),children:["Sum Insured: ",hs(e.sum_insured)]})]},t))})]}),(he||me&&me.length>0)&&qe("div",{className:Ct.create("checkout-sidebar-spacer",{height:bt.spacing.lg},{"(max-width: 950px)":{height:bt.spacing.md}})}),qe("div",{className:Ct.create("checkout-sidebar-card",{backgroundColor:bt.colors.card,borderRadius:bt.radius.large,boxShadow:bt.shadow.sm,padding:bt.spacing.lg},{"(max-width: 768px)":{padding:bt.spacing.md}}),children:qe("div",{className:Ct.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[qe("h3",{className:Ct.create("cart-summary-title",{fontSize:bt.fontSize.large,fontWeight:"600",marginBottom:bt.spacing.sm,color:bt.colors.foreground}),children:"Payment Details"}),J&&qe("div",{className:Ct.create("summary-section",{paddingBottom:"1rem"}),children:qe("div",{className:Ct.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"monthly"!==J.payment_frequency?qe($,{children:[(null===(l=J.metadata)||void 0===l?void 0:l.gateway_fee)&&parseFloat(J.metadata.gateway_fee)>0&&qe(ea,{label:"windcave"===J.gateway_code?"Credit card surcharge:":"Provider Fee:",value:hs(parseFloat(J.metadata.gateway_fee))}),qe(ea,{label:"Total Due Today:",value:hs(parseFloat(J.amount.due_today)),isTotal:!0})]}):qe($,{children:[(null===(c=J.metadata)||void 0===c?void 0:c.gateway_fee)&&parseFloat(J.metadata.gateway_fee)>0&&qe(ea,{label:"windcave"===J.gateway_code?"Credit card surcharge:":"Provider Fee:",value:hs(parseFloat(J.metadata.gateway_fee))}),J.amount.total&&qe(ea,{label:"Total Payable:",value:hs(parseFloat(J.amount.total)+parseFloat(null!==(d=null===(u=J.metadata)||void 0===u?void 0:u.gateway_fee)&&void 0!==d?d:"0"))}),qe(ea,{label:"Due Today:",value:hs(parseFloat(J.amount.due_today))}),J.amount.monthly&&(null===(h=J.metadata)||void 0===h?void 0:h.number_of_instalments)&&J.metadata.number_of_instalments>1&&qe(ea,{label:"Remaining payments:",value:`${J.metadata.number_of_instalments-1} x ${hs(parseFloat(J.amount.monthly))}`})]})})}),qe(os,{onClick:async()=>{var e,t,n,r,i;if(!f)return;const o=f.calculations.length>0,s=!o;if(o&&!S)return void alert("Please select an excess amount before proceeding.");if(!C)return void alert("Please select a payment method before proceeding.");const a=o?f.calculations.find(e=>e.id===S):null;if(o&&!a)return void alert("Payment configuration error. Please try again.");if(!f.payment_options.find(e=>e.gateway_code===C))return void alert("Payment method not available. Please try again.");let l="Customer";if(null===(e=f.metadata)||void 0===e?void 0:e.client_name)l=f.metadata.client_name;else if(null===(t=f.metadata)||void 0===t?void 0:t.client_details){const e=f.metadata.client_details;e.first_name&&(l=`${e.first_name} ${e.last_name||""}`.trim())}if(s){if(!m)return void alert("Payment service not available. Please try again.");try{y(!0);const e=await m.initiateFixedPayment(f.payment_link_id,C,l);if("auto_renew_confirmed"===e.status)return void Y({message:e.message||"Your renewal is confirmed. Your premium funding will continue automatically on the policy start date.",effectiveDate:e.effective_date});if("bank_transfer"===C&&e.transaction_id)return void G({transactionId:e.transaction_id,organisationId:(null===(n=f.organisation)||void 0===n?void 0:n.id)||""});e.gateway_acceptance_url?window.location.href=e.gateway_acceptance_url:alert("Payment initiated successfully")}catch(e){alert(e.message||"Failed to initiate payment")}finally{y(!1)}return}const c=null===(r=f.metadata)||void 0===r?void 0:r.quote_intent_id,u={...c?{quoteIntentId:c}:{paymentLinkId:f.payment_link_id},paymentLinkId:f.payment_link_id,excessId:(null==a?void 0:a.excess_id)||"",gatewayId:C,calculationId:S||"",clientDetails:{legalName:l},metadata:{payment_link_id:f.payment_link_id,payment_type:c?"quote":"rate",gateway_code:C,gateway:C},...ue&&j?{coverStartDate:j}:{}};if("bank_transfer"!==C)N(u),x(!0);else{if(!m)return void alert("Payment service not available. Please try again.");try{y(!0);const e={...u,returnUrl:window.location.href},t=await m.initiatePayment(e,C);if(!(t.bank_account_name&&t.reference&&t.transaction_id))throw new Error("Invalid bank transfer response");G({transactionId:t.transaction_id,organisationId:(null===(i=f.organisation)||void 0===i?void 0:i.id)||""})}catch(e){alert(e.message||"Failed to initiate bank transfer")}finally{y(!1)}}},disabled:!de,className:Ct.create("purchase-button",{width:"100%",height:"3rem",fontSize:bt.fontSize.default,fontWeight:"600"}),children:de?"Go to Payment":"Select Options to Continue"})]})})]})})]}),b&&k&&m&&qe(Vs,{isOpen:b,onClose:()=>{x(!1),N(null)},onSuccess:()=>{x(!1),N(null),alert("Payment completed successfully!")},paymentRequest:k,httpClient:m}),ne&&qe(Ss,{type:re,transactionId:X||z||void 0,isOpen:!0,onClose:()=>{O(!1);const e=new URL(window.location.href);e.searchParams.delete("status"),e.searchParams.delete("transactionId"),e.searchParams.delete("transaction_id"),window.history.replaceState({},"",e.toString())}})]})})}function ea({label:e,value:t,isTotal:n=!1,className:r}){return qe("div",{className:zt(Ct.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[qe("span",{className:Ct.create("summary-label",{color:bt.colors.mutedForeground,fontSize:bt.fontSize.small}),children:e}),qe("span",{className:Ct.create("summary-value",{fontWeight:n?"600":"500",color:bt.colors.foreground,fontSize:n?bt.fontSize.large:"inherit"}),children:t})]})}function ta({products:e,onSelectProduct:t}){const[n,r]=it(null),i=(e,t)=>{t&&(t.preventDefault(),t.stopPropagation()),r(e)};return qe(ns,{title:"Select cover",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe("div",{className:Ct.create("product-selection-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:qe("div",{className:Ct.create("product-selection-card",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[qe("div",{className:Ct.create("product-selection-header",{paddingInline:bt.spacing.xl,paddingTop:bt.spacing.xl,paddingBottom:bt.spacing.lg},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingTop:bt.spacing.md}}),children:[qe("h2",{className:Ct.create("product-selection-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Select Your Cover"}),qe("p",{className:Ct.create("product-selection-description",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9"}),children:"What type of vessel are you insuring?"}),qe("hr",{className:Ct.create("product-selection-header-border",{marginTop:bt.spacing.lg,borderColor:bt.colors.border})})]}),qe("div",{className:Ct.create("product-selection-content",{paddingInline:bt.spacing.xl,paddingBottom:bt.spacing.xl},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingBottom:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingBottom:bt.spacing.md}}),children:[0===e.length?qe("div",{className:Ct.create("no-products-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${bt.colors.border}`,borderRadius:bt.radius.default,backgroundColor:bt.colors.muted}),children:[qe("div",{style:{marginBottom:bt.spacing.default},children:qe("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{margin:"0 auto",opacity:.5},children:[qe("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),qe("polyline",{points:"14 2 14 8 20 8"})]})}),qe("p",{className:Ct.create("placeholder-text",{color:bt.colors.mutedForeground,margin:"0"}),children:"No products available for quoting."})]}):qe("div",{className:Ct.create("product-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>qe(na,{product:e,isSelected:(null==n?void 0:n.id)===e.id,onSelect:i},e.id))}),e.length>0&&qe("div",{className:Ct.create("product-selection-actions",{marginTop:bt.spacing.lg}),children:qe(os,{onClick:()=>{n&&t(n)},disabled:!n,className:Ct.create("product-selection-continue-button",{width:"100%"}),children:"Continue"})})]})]})})})})}function na({product:e,isSelected:t,onSelect:n}){return qe("div",{className:zt(Ct.create("product-option-row",{borderRadius:bt.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",gap:"1rem"},{"(max-width: 480px)":{padding:"0.625rem 0.75rem"}}),t?Ct.create("product-option-row-selected",{border:`2px solid ${bt.colors.primary}`,backgroundColor:bt.colors.accent}):Ct.create("product-option-row-unselected",{border:`2px solid ${bt.colors.border}`,backgroundColor:bt.colors.card})),onClick:t=>n(e,t),role:"button",tabIndex:0,onKeyPress:t=>{"Enter"!==t.key&&" "!==t.key||n(e,t)},children:[qe(us,{selected:t}),qe("div",{className:Ct.create("product-option-content",{display:"flex",alignItems:"center",justifyContent:"space-between",flex:"1",gap:"1rem"}),children:[qe("div",{className:Ct.create("product-option-info",{display:"flex",flexDirection:"column"}),children:[e.description&&qe("div",{className:Ct.create("product-option-description",{fontSize:bt.fontSize.default,fontWeight:"500",color:bt.colors.foreground}),children:e.description}),qe("div",{className:Ct.create("product-option-name",{fontSize:bt.fontSize.small,color:bt.colors.mutedForeground}),children:e.name})]}),e.icon_svg&&qe("div",{className:Ct.create("product-option-icon",{width:"2.5rem",height:"2.5rem",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",color:t?bt.colors.primary:bt.colors.mutedForeground,transition:"color 150ms ease"}),dangerouslySetInnerHTML:{H:e.icon_svg.replace(/^<svg(?![^>]*\bwidth\b)/,'<svg width="100%" height="100%"')}})]})]})}function ra(){var e,t;const n=Wt(),{paymentLinkConfig:r,availableProducts:i,formStateManager:o}=n;if(i&&!o)return qe(ta,{products:i,onSelectProduct:()=>{}});if(r)return qe(Xs,{paymentLinkId:r.paymentLinkId,signedUrl:r.signedUrl});const s=new URLSearchParams(window.location.search),a=s.get("p")||s.get("pl_ref");if(a)return qe(Xs,{paymentLinkId:a});const l=window.location.pathname,c=l.match(/\/pay\/([a-f0-9-]+)/);if(c&&c[1])return qe(Xs,{paymentLinkId:c[1],signedUrl:window.location.href});const u=l.match(/\/payments\/bank-transfer\/([a-f0-9-]+)/),d=s.get("orgId");if(u&&u[1]&&d)return qe(Qs,{transactionId:u[1],organisationId:d});const{isCalculating:h,results:m,quoteIntent:f}=At(e=>({isCalculating:null==e?void 0:e.getIsCalculating(),results:null==e?void 0:e.getCalculationResult(),quoteIntent:null==e?void 0:e.getQuoteIntent(),fsm:e})),p="hold"===(null==f?void 0:f.status),g=null===(e=null==f?void 0:f.payment_transactions)||void 0===e?void 0:e.find(e=>"bank_transfer"===e.gateway_code&&"pending"===e.status),y="paid"===(null==f?void 0:f.status)||"completed"===(null==f?void 0:f.status);return h?qe(is,{message:"Processing your quote, please wait..."}):p&&g&&(null===(t=null==f?void 0:f.organisation)||void 0===t?void 0:t.id)?qe(Qs,{transactionId:g.id,organisationId:f.organisation.id,allowCancel:!0}):y?qe(Gs,{}):m?qe(zs,{results:m}):qe(Zs,{})}function ia(e){return qe(jt,{...e,children:qe(ra,{})})}function oa({reference:e,productName:t,firstName:n,lastUpdated:r,onContinue:i,onStartFresh:o}){const[s,a]=it(null);return qe(ns,{title:"Resume Quote",noSubscription:!0,hideHeader:!0,children:qe(Mt,{children:qe("div",{className:Ct.create("resume-prompt-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:qe("div",{className:Ct.create("resume-prompt-card",{backgroundColor:bt.colors.card,boxShadow:bt.shadow.sm,borderRadius:bt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[qe("div",{className:Ct.create("resume-prompt-header",{paddingInline:bt.spacing.xl,paddingTop:bt.spacing.xl,paddingBottom:bt.spacing.lg},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingTop:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingTop:bt.spacing.md}}),children:[qe("h2",{className:Ct.create("resume-prompt-title",{margin:"0",marginBottom:bt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:bt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Existing Quote Found"}),qe("p",{className:Ct.create("resume-prompt-description",{margin:"0",fontSize:bt.fontSize.default,lineHeight:"1.6",color:bt.colors.foreground,opacity:"0.9"}),children:"There is a quote in progress. Would you like to continue where you left off or start a new quote?"}),(e||t||n||r)&&qe("div",{className:Ct.create("resume-prompt-details",{marginTop:bt.spacing.md,padding:bt.spacing.md,backgroundColor:bt.colors.background,borderRadius:bt.radius.default,display:"flex",flexDirection:"column",gap:bt.spacing.sm}),children:[t&&qe("div",{className:Ct.create("resume-prompt-detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("resume-prompt-detail-label",{fontSize:bt.fontSize.small,color:bt.colors.foreground,opacity:"0.6"}),children:"Product"}),qe("span",{className:Ct.create("resume-prompt-detail-value",{fontSize:bt.fontSize.small,fontWeight:"600",color:bt.colors.foreground}),children:t})]}),n&&qe("div",{className:Ct.create("resume-prompt-detail-row-name",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("resume-prompt-detail-label-name",{fontSize:bt.fontSize.small,color:bt.colors.foreground,opacity:"0.6"}),children:"Client"}),qe("span",{className:Ct.create("resume-prompt-detail-value-name",{fontSize:bt.fontSize.small,fontWeight:"600",color:bt.colors.foreground}),children:n})]}),e&&qe("div",{className:Ct.create("resume-prompt-detail-row-ref",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("resume-prompt-detail-label-ref",{fontSize:bt.fontSize.small,color:bt.colors.foreground,opacity:"0.6"}),children:"Reference"}),qe("span",{className:Ct.create("resume-prompt-detail-value-ref",{fontSize:bt.fontSize.small,fontWeight:"600",color:bt.colors.foreground}),children:e})]}),r&&qe("div",{className:Ct.create("resume-prompt-detail-row-date",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[qe("span",{className:Ct.create("resume-prompt-detail-label-date",{fontSize:bt.fontSize.small,color:bt.colors.foreground,opacity:"0.6"}),children:"Last updated"}),qe("span",{className:Ct.create("resume-prompt-detail-value-date",{fontSize:bt.fontSize.small,fontWeight:"600",color:bt.colors.foreground}),children:r})]})]}),qe("hr",{className:Ct.create("resume-prompt-header-border",{marginTop:bt.spacing.lg,borderColor:bt.colors.border})})]}),qe("div",{className:Ct.create("resume-prompt-content",{paddingInline:bt.spacing.xl,paddingBottom:bt.spacing.xl,display:"flex",flexDirection:"column",gap:bt.spacing.md},{"(max-width: 768px)":{paddingInline:bt.spacing.lg,paddingBottom:bt.spacing.lg},"(max-width: 480px)":{paddingInline:bt.spacing.md,paddingBottom:bt.spacing.md}}),children:[qe(os,{onClick:()=>{a("continue"),i()},loading:"continue"===s,disabled:null!==s,className:Ct.create("resume-prompt-continue-btn",{width:"100%"}),children:"Continue where I left off"}),qe(os,{variant:"outline",onClick:()=>{a("fresh"),o()},loading:"fresh"===s,disabled:null!==s,className:Ct.create("resume-prompt-fresh-btn",{width:"100%"}),children:"Start a new quote"})]})]})})})})}class sa extends C{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(e,n){t();try{Promise.resolve().then(function(){return ph}).then(({captureException:t,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),t(e,{componentStack:n.componentStack}))}).catch(()=>{})}catch(e){}const r=we("initialization",e,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return $e(e)?qe(as,{message:e.message}):qe(ss,{error:e})}return this.props.children}}function aa({config:e,initializeFormContext:n}){const[r,i]=it({type:"loading",message:"Loading application..."}),o=n=>{if(n.resumePrompt)return t(),void i({type:"resume_prompt",resumeData:n.resumePrompt});const r=n.availableProducts&&n.availableProducts.length>0;if(r&&!n.formStateManager)return t(),void i({type:"product_selection",products:n.availableProducts});if(!("payment"===e.mode||n.paymentLinkConfig||r||n.formStateManager&&"function"==typeof n.formStateManager.getFormProgress))throw new Error("FormStateManager was not properly initialized");t(),i({type:"success",formContextProps:n})},s=async(r="Loading application...")=>{i({type:"loading",message:r});try{t();const r=await n(e);o(r)}catch(e){let n;t(),n=e&&"object"==typeof e&&"type"in e&&"MAINTENANCE_ERROR"===e.type||e&&"object"==typeof e&&"statusCode"in e&&503===e.statusCode||e&&"object"==typeof e&&"status"in e&&503===e.status?we("maintenance",e):we("initialization",e),t((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}};ot(()=>{e.isolateStyles&&Nt(),s()},[e,n]);const a=async e=>{if("resume_prompt"!==r.type)return;const{onContinue:n,onStartFresh:s}=r.resumeData;i({type:"loading",message:"continue"===e?"Loading your quote...":"Starting a new quote..."});try{const t="continue"===e?await n():await s();o(t)}catch(e){t();const n=we("initialization",e);i({type:"error",error:n})}},l=async e=>{t(e.code),localStorage.setItem("insure-os-selected-product",e.code),await s("Loading...")};return qe(sa,{children:qe("div",{className:Ct.create("root",{fontFamily:bt.fontFamily,backgroundColor:bt.colors.background,minHeight:"100vh",color:bt.colors.foreground,maxWidth:"100vw",overflowX:"hidden",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"}),children:function(){switch(r.type){case"loading":return qe(is,{message:r.message});case"error":return $e(r.error)?qe(as,{message:r.error.message}):qe(ss,{error:r.error});case"product_selection":return qe(ta,{products:r.products,onSelectProduct:l});case"resume_prompt":return qe(oa,{reference:r.resumeData.reference,productName:r.resumeData.productName,firstName:r.resumeData.firstName,lastUpdated:r.resumeData.lastUpdated,onContinue:()=>a("continue"),onStartFresh:()=>a("fresh")});case"success":return qe(ia,{...r.formContextProps});default:return qe(ss,{})}}()})})}const la="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ca=globalThis,ua="10.48.0";function da(){return ha(ca),ca}function ha(e){const t=e.oe=e.oe||{};return t.version=t.version||ua,t[ua]=t[ua]||{}}function ma(e,t,n=ca){const r=n.oe=n.oe||{},i=r[ua]=r[ua]||{};return i[e]||(i[e]=t())}const fa=["debug","info","warn","error","log","assert","trace"],pa={};function ga(e){if(!("console"in ca))return e();const t=ca.console,n={},r=Object.keys(pa);r.forEach(e=>{const r=pa[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function ya(){return wa().enabled}function va(e,...t){la&&ya()&&ga(()=>{ca.console[e](`Sentry Logger [${e}]:`,...t)})}function wa(){return la?ma("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const ba=function(){wa().enabled=!0},xa=function(...e){va("log",...e)},ka=function(...e){va("warn",...e)},Na=function(...e){va("error",...e)},Sa="?",_a=/\(error: (.*)\)/,$a=/captureMessage|captureException/;function Ca(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{const i=[],o=e.split("\n");for(let e=n;e<o.length;e++){let n=o[e];n.length>1024&&(n=n.slice(0,1024));const s=_a.test(n)?n.replace(_a,"$1"):n;if(!s.includes("Error: ")){for(const e of t){const t=e(s);if(t){i.push(t);break}}if(i.length>=50+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(Ia(t).function||"")&&t.pop(),t.reverse(),$a.test(Ia(t).function||"")&&(t.pop(),$a.test(Ia(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||Ia(t).filename,function:e.function||Sa}))}(i.slice(r))}}function Ia(e){return e[e.length-1]||{}}const Ta="<anonymous>";function Ea(e){try{return e&&"function"==typeof e&&e.name||Ta}catch{return Ta}}function Pa(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}function Da(e){return"se"in e&&e.se?"[VueVNode]":"[VueViewModel]"}const za={},Ra={};function Ma(e,t){za[e]=za[e]||[],za[e].push(t)}function Oa(e,t){if(!Ra[e]){Ra[e]=!0;try{t()}catch(t){la&&Na(`Error while instrumenting ${e}`,t)}}}function ja(e,t){const n=e&&za[e];if(n)for(const r of n)try{r(t)}catch(t){la&&Na(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Ea(r)}\nError:`,t)}}let Wa=null;function Aa(){Wa=ca.onerror,ca.onerror=function(e,t,n,r,i){return ja("error",{column:r,error:i,line:n,msg:e,url:t}),!!Wa&&Wa.apply(this,arguments)},ca.onerror.ae=!0}let La=null;function Ba(){La=ca.onunhandledrejection,ca.onunhandledrejection=function(e){return ja("unhandledrejection",e),!La||La.apply(this,arguments)},ca.onunhandledrejection.ae=!0}const Fa={}.toString;function qa(e){switch(Fa.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Xa(e,Error)}}function Ha(e,t){return Fa.call(e)===`[object ${t}]`}function Ua(e){return Ha(e,"ErrorEvent")}function Ya(e){return Ha(e,"DOMError")}function Za(e){return Ha(e,"String")}function Ga(e){return"object"==typeof e&&null!==e&&"le"in e&&"ce"in e}function Va(e){return null===e||Ga(e)||"object"!=typeof e&&"function"!=typeof e}function Qa(e){return Ha(e,"Object")}function Ja(e){return"undefined"!=typeof Event&&Xa(e,Event)}function Ka(e){return Boolean(e?.then&&"function"==typeof e.then)}function Xa(e,t){try{return e instanceof t}catch{return!1}}function el(e){return!("object"!=typeof e||null===e||!(e.ue||e.de||e.se))}function tl(e){return"undefined"!=typeof Request&&Xa(e,Request)}const nl=ca;function rl(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,s=0;const a=" > ",l=a.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(c=il(n,u),!("html"===c||o>1&&s+i.length*l+c.length>=d));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function il(e,t){const n=e,r=[];if(!n?.tagName)return"";if(nl.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&Za(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}for(const e of["aria-label","type","name","title","alt"]){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}function ol(){try{return nl.document.location.href}catch{return""}}function sl(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&ll(i,r);try{e[t]=i}catch{la&&xa(`Failed to replace method "${t}" in object`,e)}}function al(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{la&&xa(`Failed to add non-enumerable property "${t}" to object`,e)}}function ll(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,al(e,"__sentry_original__",t)}catch{}}function cl(e){return e.he}function ul(e){if(qa(e))return{message:e.message,name:e.name,stack:e.stack,...hl(e)};if(Ja(e)){const t={type:e.type,target:dl(e.target),currentTarget:dl(e.currentTarget),...hl(e)};return"undefined"!=typeof CustomEvent&&Xa(e,CustomEvent)&&(t.detail=e.detail),t}return e}function dl(e){try{return"undefined"!=typeof Element&&Xa(e,Element)?rl(e):{}.toString.call(e)}catch{return"<unknown>"}}function hl(e){return"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e)):{}}let ml,fl,pl;function gl(e){if(void 0!==ml)return ml?ml(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=ca;return t in n&&"function"==typeof n[t]?(ml=n[t],ml(e)):(ml=null,e())}function yl(){return gl(()=>Math.random())}function vl(){return gl(()=>Date.now())}function wl(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function bl(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{el(r)?n.push(Da(r)):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function xl(e,t,n=!1){return!!Za(e)&&(Ha(t,"RegExp")?t.test(e):Za(t)?n?e===t:e.includes(t):"function"==typeof t&&t(e))}function kl(e,t=[],n=!1){return t.some(t=>xl(e,t,n))}function Nl(e=function(){const e=ca;return e.crypto||e.msCrypto}()){try{if(e?.randomUUID)return gl(()=>e.randomUUID()).replace(/-/g,"")}catch{}return fl||(fl=[1e7]+1e3+4e3+8e3+1e11),fl.replace(/[018]/g,e=>(e^(16*yl()&15)>>e/4).toString(16))}function Sl(e){return e.exception?.values?.[0]}function _l(e){const{message:t,event_id:n}=e;if(t)return t;const r=Sl(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function $l(e,t){const n=e.exception=e.exception||{},r=n.values=n.values||[],i=r[0]=r[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function Cl(e,t){const n=Sl(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r?.data,...t.data};n.mechanism.data=e}}function Il(e){if(function(e){try{return e.me}catch{}}(e))return!0;try{al(e,"__sentry_captured__",!0)}catch{}return!1}function Tl(){return vl()/1e3}function El(){return(pl??(pl=function(){const{performance:e}=ca;if(!e?.now||!e.timeOrigin)return Tl;const t=e.timeOrigin;return()=>(t+gl(()=>e.now()))/1e3}()))()}function Pl(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||El(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Nl()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Dl(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)({}).hasOwnProperty.call(t,e)&&(r[e]=Dl(r[e],t[e],n-1));return r}function zl(){return Nl()}function Rl(){return Nl().substring(16)}const Ml="_sentrySpan";function Ol(e,t){t?al(e,Ml,t):delete e[Ml]}function jl(e){return e[Ml]}class Wl{constructor(){this.fe=!1,this.pe=[],this.ge=[],this.ye=[],this.ve=[],this.we={},this.be={},this.xe={},this.ke={},this.Ne={},this.Se={},this._e={traceId:zl(),sampleRand:yl()}}clone(){const e=new Wl;return e.ye=[...this.ye],e.be={...this.be},e.xe={...this.xe},e.ke={...this.ke},e.Ne={...this.Ne},this.Ne.flags&&(e.Ne.flags={values:[...this.Ne.flags.values]}),e.we=this.we,e.$e=this.$e,e.Ce=this.Ce,e.Ie=this.Ie,e.Te=this.Te,e.ge=[...this.ge],e.ve=[...this.ve],e.Se={...this.Se},e._e={...this._e},e.Ee=this.Ee,e.Pe=this.Pe,e.De=this.De,Ol(e,jl(this)),e}setClient(e){this.Ee=e}setLastEventId(e){this.Pe=e}getClient(){return this.Ee}lastEventId(){return this.Pe}addScopeListener(e){this.pe.push(e)}addEventProcessor(e){return this.ge.push(e),this}setUser(e){return this.we=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.Ce&&Pl(this.Ce,{user:e}),this.ze(),this}getUser(){return this.we}setConversationId(e){return this.De=e||void 0,this.ze(),this}setTags(e){return this.be={...this.be,...e},this.ze(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this.xe={...this.xe,...e},this.ze(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this.xe&&(delete this.xe[e],this.ze()),this}setExtras(e){return this.ke={...this.ke,...e},this.ze(),this}setExtra(e,t){return this.ke={...this.ke,[e]:t},this.ze(),this}setFingerprint(e){return this.Te=e,this.ze(),this}setLevel(e){return this.$e=e,this.ze(),this}setTransactionName(e){return this.Ie=e,this.ze(),this}setContext(e,t){return null===t?delete this.Ne[e]:this.Ne[e]=t,this.ze(),this}setSession(e){return e?this.Ce=e:delete this.Ce,this.ze(),this}getSession(){return this.Ce}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof Wl?t.getScopeData():Qa(t)?e:void 0,{tags:r,attributes:i,extra:o,user:s,contexts:a,level:l,fingerprint:c=[],propagationContext:u,conversationId:d}=n||{};return this.be={...this.be,...r},this.xe={...this.xe,...i},this.ke={...this.ke,...o},this.Ne={...this.Ne,...a},s&&Object.keys(s).length&&(this.we=s),l&&(this.$e=l),c.length&&(this.Te=c),u&&(this._e=u),d&&(this.De=d),this}clear(){return this.ye=[],this.be={},this.xe={},this.ke={},this.we={},this.Ne={},this.$e=void 0,this.Ie=void 0,this.Te=void 0,this.Ce=void 0,this.De=void 0,Ol(this,void 0),this.ve=[],this.setPropagationContext({traceId:zl(),sampleRand:yl()}),this.ze(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:Tl(),...e,message:e.message?wl(e.message,2048):e.message};return this.ye.push(r),this.ye.length>n&&(this.ye=this.ye.slice(-n),this.Ee?.recordDroppedEvent("buffer_overflow","log_item")),this.ze(),this}getLastBreadcrumb(){return this.ye[this.ye.length-1]}clearBreadcrumbs(){return this.ye=[],this.ze(),this}addAttachment(e){return this.ve.push(e),this}clearAttachments(){return this.ve=[],this}getScopeData(){return{breadcrumbs:this.ye,attachments:this.ve,contexts:this.Ne,tags:this.be,attributes:this.xe,extra:this.ke,user:this.we,level:this.$e,fingerprint:this.Te||[],eventProcessors:this.ge,propagationContext:this._e,sdkProcessingMetadata:this.Se,transactionName:this.Ie,span:jl(this),conversationId:this.De}}setSDKProcessingMetadata(e){return this.Se=Dl(this.Se,e,2),this}setPropagationContext(e){return this._e=e,this}getPropagationContext(){return this._e}captureException(e,t){const n=t?.event_id||Nl();if(!this.Ee)return la&&ka("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Ee.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||Nl();if(!this.Ee)return la&&ka("No client configured on scope - will not capture message!"),r;const i=n?.syntheticException??new Error(e);return this.Ee.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=e.event_id||t?.event_id||Nl();return this.Ee?(this.Ee.captureEvent(e,{...t,event_id:n},this),n):(la&&ka("No client configured on scope - will not capture event!"),n)}ze(){this.fe||(this.fe=!0,this.pe.forEach(e=>{e(this)}),this.fe=!1)}}const Al=e=>e instanceof Promise&&!e[Ll],Ll=Symbol("chained PromiseLike");class Bl{constructor(e,t){let n,r;n=e||new Wl,r=t||new Wl,this.Re=[{scope:n}],this.Me=r}withScope(e){const t=this.Oe();let n;try{n=e(t)}catch(e){throw this.je(),e}return Ka(n)?((e,t,n)=>{const r=e.then(e=>(t(),e),e=>{throw n(),e});return Al(r)&&Al(e)?r:((e,t)=>{let n=!1;for(const r in e){if(r in t)continue;n=!0;const i=e[r];"function"==typeof i?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[Ll]:!0}),t})(e,r)})(n,()=>this.je(),()=>this.je()):(this.je(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.Me}getStackTop(){return this.Re[this.Re.length-1]}Oe(){const e=this.getScope().clone();return this.Re.push({client:this.getClient(),scope:e}),e}je(){return!(this.Re.length<=1||!this.Re.pop())}}function Fl(){const e=ha(da());return e.stack=e.stack||new Bl(ma("defaultCurrentScope",()=>new Wl),ma("defaultIsolationScope",()=>new Wl))}function ql(e){return Fl().withScope(e)}function Hl(e,t){const n=Fl();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Ul(e){return Fl().withScope(()=>e(Fl().getIsolationScope()))}function Yl(e){const t=ha(e);return t.acs?t.acs:{withIsolationScope:Ul,withScope:ql,withSetScope:Hl,withSetIsolationScope:(e,t)=>Ul(t),getCurrentScope:()=>Fl().getScope(),getIsolationScope:()=>Fl().getIsolationScope()}}function Zl(){return Yl(da()).getCurrentScope()}function Gl(){return Yl(da()).getIsolationScope()}function Vl(...e){const t=Yl(da());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Ql(){return Zl().getClient()}function Jl(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||Rl()};return r&&(o.parent_span_id=r),o}const Kl="sentry.profile_id",Xl="sentry.exclusive_time";function ec(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function tc(e){const t=e;return{scope:t.We,isolationScope:ec(t.Ae)}}function nc(e){return e.split(",").map(e=>{const t=e.indexOf("=");return-1===t?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const rc=/^o(\d+)\./,ic=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function oc(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=e;return`${a}://${l}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function sc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function ac(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(rc);return t?.[1]}(n)),r}let lc=!1;function cc(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:mc(e).parent_span_id,o=tc(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||Rl():t,trace_id:n}}function uc(e){return e&&e.length>0?e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:1===n,attributes:i,...r})):void 0}function dc(e){return"number"==typeof e?hc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?hc(e.getTime()):El()}function hc(e){return e>9999999999?e/1e3:e}function mc(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:i,name:o,endTime:s,status:a,links:l}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:fc(e),start_timestamp:dc(i),timestamp:dc(s)||void 0,status:pc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:uc(l)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function fc(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function pc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"internal_error"}const gc=function(e){return e.Le||e};function yc(){lc||(ga(()=>{}),lc=!0)}function vc(e){xa(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function wc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(xc(n)){if(xl(e.description,n))return la&&vc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||xl(e.description,n.name),r=!n.op||e.op&&xl(e.op,n.op);if(t&&r)return la&&vc(e),!0}return!1}function bc(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function xc(e){return"string"==typeof e||e instanceof RegExp}const kc="production";function Nc(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||kc,release:n.release,public_key:r,trace_id:e,org_id:ac(t)};return t.emit("createDsc",i),i}function Sc(e){const t=Ql();if(!t)return{};const n=gc(e),r=mc(n),i=r.data,o=n.spanContext().traceState,s=o?.get("sentry.sample_rate")??i["sentry.sample_rate"]??i["sentry.previous_trace_sample_rate"];function a(e){return"number"!=typeof s&&"string"!=typeof s||(e.sample_rate=`${s}`),e}const l=n.Be;if(l)return a(l);const c=o?.get("sentry.dsc"),u=c&&function(e){const t=function(e){if(e&&(Za(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=nc(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):nc(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.startsWith("sentry-")&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(c);if(u)return a(u);const d=Nc(e.spanContext().traceId,t),h=i["sentry.source"]??i["sentry.span.source"],m=r.description;return"url"!==h&&m&&(d.transaction=m),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const e=Ql()?.getOptions();return!(!e||null==e.tracesSampleRate&&!e.tracesSampler)}()&&(d.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return 1===t}(n)),d.sample_rand=o?.get("sentry.sample_rand")??tc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}function _c(e,t=100,n=1/0){try{return Cc("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function $c(e,t=3,n=102400){const r=_c(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?$c(e,t-1,n):r;var i}function Cc(e,t,n=1/0,r=1/0,i=function(){const e=new WeakSet;return[function(t){return!!e.has(t)||(e.add(t),!1)},function(t){e.delete(t)}]}()){const[o,s]=i;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const a=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t.Fe)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(el(t))return Da(t);if(Qa(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${Ea(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}var n}(e,t);if(!a.startsWith("[object "))return a;if(t.qe)return t;const l="number"==typeof t.He?t.He:n;if(0===l)return a.replace("object ","");if(o(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return Cc("",c.toJSON(),l-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=ul(t);for(const e in h){if(!{}.hasOwnProperty.call(h,e))continue;if(d>=r){u[e]="[MaxProperties ~]";break}const t=h[e];u[e]=Cc(e,t,l-1,r,i),d++}return s(t),u}function Ic(e,t=[]){return[e,t]}function Tc(e,t){const[n,r]=e;return[n,[...r,t]]}function Ec(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function Pc(e){const t=ha(ca);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function Dc(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[Pc(r),e]:r.push("string"==typeof e?Pc(e):e)}for(const e of n){const[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(_c(n))}i(e)}}return"string"==typeof r?r:function(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(r)}function zc(e){const t="string"==typeof e.data?Pc(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const Rc={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function Mc(e){return function(e){return e in Rc}(e)?Rc[e]:e}function Oc(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function jc(e,t){const{extra:n,tags:r,attributes:i,user:o,contexts:s,level:a,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:u,eventProcessors:d,attachments:h,propagationContext:m,transactionName:f,span:p}=t;Wc(e,"extra",n),Wc(e,"tags",r),Wc(e,"attributes",i),Wc(e,"user",o),Wc(e,"contexts",s),e.sdkProcessingMetadata=Dl(e.sdkProcessingMetadata,l,2),a&&(e.level=a),f&&(e.transactionName=f),p&&(e.span=p),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),h.length&&(e.attachments=[...e.attachments,...h]),e.propagationContext={...e.propagationContext,...m}}function Wc(e,t,n){e[t]=Dl(e[t],n,1)}function Ac(e,t){const n=ma("globalScope",()=>new Wl).getScopeData();return e&&jc(n,e.getScopeData()),t&&jc(n,t.getScopeData()),n}function Lc(e){return new Fc(t=>{t(e)})}function Bc(e){return new Fc((t,n)=>{n(e)})}class Fc{constructor(e){this.Ue=0,this.Ye=[],this.Ze(e)}then(e,t){return new Fc((n,r)=>{this.Ye.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this.Ge()})}catch(e){return this.then(e=>e,e)}finally(e){return new Fc((t,n)=>{let r,i;return this.then(t=>{i=!1,r=t,e&&e()},t=>{i=!0,r=t,e&&e()}).then(()=>{i?n(r):t(r)})})}Ge(){if(0===this.Ue)return;const e=this.Ye.slice();this.Ye=[],e.forEach(e=>{e[0]||(1===this.Ue&&e[1](this.Ve),2===this.Ue&&e[2](this.Ve),e[0]=!0)})}Ze(e){const t=(e,t)=>{0===this.Ue&&(Ka(t)?t.then(n,r):(this.Ue=e,this.Ve=t,this.Ge()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}}function qc(e,t,n,r=0){try{const i=Hc(t,n,e,r);return Ka(i)?i:Lc(i)}catch(e){return Bc(e)}}function Hc(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return la&&null===o&&xa(`Event processor "${i.id||"?"}" dropped event`),Ka(o)?o.then(e=>Hc(e,t,n,r+1)):Hc(o,t,n,r+1)}let Uc,Yc,Zc,Gc;function Vc(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,l={...t,event_id:t.event_id||n.event_id||Nl(),timestamp:t.timestamp||Tl()},c=n.integrations||e.integrations.map(e=>e.name);!function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o}=t;e.environment=e.environment||n||kc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&o&&(s.url=wl(s.url,o)),o&&e.exception?.values?.forEach(e=>{e.value&&(e.value=wl(e.value,o))})}(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),i&&i.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=ca.Qe,n=ca.Je;if(!t&&!n)return{};const r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Gc&&r.length===Yc&&i.length===Zc)return Gc;Yc=r.length,Zc=i.length,Gc={},Uc||(Uc={});const o=(t,n)=>{for(const r of t){const t=n[r],i=Uc?.[r];if(i&&Gc&&t)Gc[i[0]]=t,Uc&&(Uc[r]=[i[0],t]);else if(t){const n=e(r);for(let e=n.length-1;e>=0;e--){const i=n[e],o=i?.filename;if(o&&Gc&&Uc){Gc[o]=t,Uc[r]=[o,t];break}}}}};return t&&o(r,t),n&&o(i,n),Gc}(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}(l,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new Wl;return n.update(t),n}(r,n.captureContext);n.mechanism&&Cl(l,n.mechanism);const d=i?i.getEventProcessors():[],h=Ac(o,u),m=[...n.attachments||[],...h.attachments];m.length&&(n.attachments=m),function(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),s&&(e.level=s),a&&"transaction"!==e.type&&(e.transaction=a)}(e,t),r&&function(e,t){e.contexts={trace:cc(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Sc(t),...e.sdkProcessingMetadata};const n=mc(gc(t)).description;n&&!e.transaction&&"transaction"===e.type&&(e.transaction=n)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}(l,h);const f=[...d,...h.eventProcessors];return(n.data&&!0===n.data.Ke?Lc(l):qc(f,l,n)).then(e=>(e&&function(e){const t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})})}(e),"number"==typeof s&&s>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:_c(e.data,t,n)}}))},...e.user&&{user:_c(e.user,t,n)},...e.contexts&&{contexts:_c(e.contexts,t,n)},...e.extra&&{extra:_c(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=_c(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:_c(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=_c(e.contexts.flags,3,n)),r}(e,s,a):e))}function Qc(e){return Zl().captureException(e,void 0)}function Jc(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return Zl().captureMessage(e,n,r)}function Kc(e,t){return Zl().captureEvent(e,t)}function Xc(e){const t=Gl(),{user:n}=Ac(t,Zl()),{userAgent:r}=ca.navigator||{},i=function(e){const t=El(),n={sid:Nl(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return{sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}(n)};return e&&Pl(n,e),n}({user:n,...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&Pl(o,{status:"exited"}),eu(),t.setSession(i),i}function eu(){const e=Gl(),t=Zl().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),Pl(e,t)}(t),tu(),e.setSession()}function tu(){const e=Gl(),t=Ql(),n=e.getSession();n&&t&&t.captureSession(n)}function nu(e=!1){e?eu():tu()}const ru=[];function iu(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach(e=>{e.isDefaultInstance=!0}),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return function(e){const t={};return e.forEach(e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}(r)}function ou(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function su(e,t,n){if(n[t.name])la&&xa(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,ru.includes(t.name)||"function"!=typeof t.setupOnce||(t.setupOnce(),ru.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,r)=>n(t,r,e))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}la&&xa(`Integration installed: ${t.name}`)}}function au(e,t){const n=t??function(e){return lu().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),i=function(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=oc(r)),Ic(i,[(o=e,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(n,r.Xe,r.tunnel,e.getDsn());lu().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function lu(){return ma("clientToLogBufferMap",()=>new WeakMap)}function cu(e,t){const n=t??function(e){return uu().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),i=function(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=oc(r)),Ic(i,[(o=e,[{type:"trace_metric",item_count:o.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:o}])]);var o}(n,r.Xe,r.tunnel,e.getDsn());uu().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function uu(){return ma("clientToMetricBufferMap",()=>new WeakMap)}function du(e){return"object"==typeof e&&"function"==typeof e.unref&&e.unref(),e}const hu=Symbol.for("SentryBufferFullError");function mu(e=100){const t=new Set;function n(e){t.delete(e)}return{get $(){return Array.from(t)},add:function(r){if(!(t.size<e))return Bc(hu);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return Lc(!0);const n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;const r=[n,new Promise(t=>du(setTimeout(()=>t(!1),e)))];return Promise.race(r)}}}function fu(e,t,n=mu(e.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Ec(i,(t,n)=>{const i=Mc(n);!function(e,t,n=vl()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,i)?o.push(t):e.recordDroppedEvent("ratelimit_backoff",i)}),0===o.length)return Promise.resolve({});const s=Ic(i[0],o),a=t=>{!function(e,t){return Ec(e,(e,n)=>t.includes(n))}(s,["client_report"])?Ec(s,(n,r)=>{e.recordDroppedEvent(t,Mc(r))}):la&&ka(`Dropping client report. Will not send outcomes (reason: ${t}).`)};return n.add(()=>t({body:Dc(s)}).then(e=>413===e.statusCode?(la&&Na("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),a("send_error"),e):(la&&void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&ka(`Sentry responded with status code ${e.statusCode} to sent event.`),r=function(e,{statusCode:t,headers:n},r=vl()){const i={...e},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,n,,,o]=e.split(":",5),s=parseInt(t,10),a=1e3*(isNaN(s)?60:s);if(n)for(const e of n.split(";"))"metric_bucket"===e&&o&&!o.split(";").includes("custom")||(i[e]=r+a);else i.all=r+a}else s?i.all=r+function(e,t=vl()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(s,r):429===t&&(i.all=r+6e4);return i}(r,e),e),e=>{throw a("network_error"),la&&Na("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===hu)return la&&Na("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function pu(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}const gu="Not capturing exception because it's already been captured.",yu="Discarded session because of missing or non-string release",vu=Symbol.for("SentryInternalError"),wu=Symbol.for("SentryDoNotSendEventError");function bu(e){return{message:e,[vu]:!0}}function xu(e){return{message:e,[wu]:!0}}function ku(e){return!!e&&"object"==typeof e&&vu in e}function Nu(e){return!!e&&"object"==typeof e&&wu in e}function Su(e,t,n,r,i){let o,s=0,a=!1;e.on(n,()=>{s=0,clearTimeout(o),a=!1}),e.on(t,t=>{s+=r(t),s>=8e5?i(e):a||(a=!0,o=du(setTimeout(()=>{i(e)},5e3)))}),e.on("flush",()=>{i(e)})}class _u{constructor(e){if(this.et=e,this.nt={},this.rt=0,this.it={},this.ot={},this.ge=[],this.st=mu(e.transportOptions?.bufferSize??64),e.dsn?this.lt=function(e){const t="string"==typeof e?function(e){const t=ic.exec(e);if(!t)return void ga(()=>{});const[n,r,i="",o="",s="",a=""]=t.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return sc({host:o,pass:i,path:l,projectId:c,port:s,protocol:n,publicKey:r})}(e):sc(e);if(t&&function(e){if(!la)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(Na(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Na(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Na(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Na(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):la&&ka("No DSN provided, client will not send events."),this.lt){const i=(t=this.lt,n=e.tunnel,r=e.Xe?e.Xe.sdk:void 0,n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(t)}?${function(e,t){const n={sentry_version:"7"};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(t,r)}`);this.ct=e.transport({tunnel:this.et.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:i})}var t,n,r;this.et.enableLogs=this.et.enableLogs??this.et.ut?.enableLogs,this.et.enableLogs&&Su(this,"afterCaptureLog","flushLogs",Eu,au),(this.et.enableMetrics??this.et.ut?.enableMetrics??1)&&Su(this,"afterCaptureMetric","flushMetrics",Tu,cu)}captureException(e,t,n){const r=Nl();if(Il(e))return la&&xa(gu),r;const i={event_id:r,...t};return this.ht(()=>this.eventFromException(e,i).then(e=>this.ft(e,i,n)).then(e=>e),"error"),i.event_id}captureMessage(e,t,n,r){const i={event_id:Nl(),...n},o=Ga(e)?e:String(e),s=Va(e),a=s?this.eventFromMessage(o,t,i):this.eventFromException(e,i);return this.ht(()=>a.then(e=>this.ft(e,i,r)),s?"unknown":"error"),i.event_id}captureEvent(e,t,n){const r=Nl();if(t?.originalException&&Il(t.originalException))return la&&xa(gu),r;const i={event_id:r,...t},o=e.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope,l=$u(e.type);return this.ht(()=>this.ft(e,i,s||n,a),l),i.event_id}captureSession(e){this.sendSession(e),Pl(e,{init:!1})}getDsn(){return this.lt}getOptions(){return this.et}getSdkMetadata(){return this.et.Xe}getTransport(){return this.ct}async flush(e){const t=this.ct;if(!t)return!0;this.emit("flush");const n=await this.gt(e),r=await t.flush(e);return n&&r}async close(e){au(this);const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this.ge}addEventProcessor(e){this.ge.push(e)}init(){(this.yt()||this.et.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this.vt()}getIntegrationByName(e){return this.nt[e]}addIntegration(e){const t=this.nt[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),su(this,e,this.nt),t||ou(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=Oc(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const n=e.sdk||{};e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,n?.sdk);const s=function(e,t,n,r){const i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:oc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,Ic(s,[[{type:o},e]])}(e,this.lt,this.et.Xe,this.et.tunnel);for(const e of t.attachments||[])n=Tc(n,zc(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=kc}=this.et;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(la&&ka(yu));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(la&&ka(yu));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=Oc(n);return Ic({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:oc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.lt,this.et.Xe,this.et.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.et.sendClientReports){const r=`${e}:${t}`;la&&xa(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.it[r]=(this.it[r]||0)+n}}on(e,t){const n=this.ot[e]=this.ot[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this.ot[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this.yt()&&this.ct)try{return await this.ct.send(e)}catch(e){return la&&Na("Error while sending envelope:",e),{}}return la&&Na("Transport disabled"),{}}dispose(){}vt(){const{integrations:e}=this.et;this.nt=function(e,t){const n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&su(e,t,n)}),n}(this,e),ou(this,e)}wt(e,t){let n="fatal"===t.level,r=!1;const i=t.exception?.values;if(i){r=!0,n=!1;for(const e of i)if(!1===e.mechanism?.handled){n=!0;break}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(Pl(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}async gt(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this.rt)return!0;t++}return!1}yt(){return!1!==this.getOptions().enabled&&void 0!==this.ct}bt(e,t,n,r){const i=this.getOptions(),o=Object.keys(this.nt);return!t.integrations&&o?.length&&(t.integrations=o),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Vc(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:{...e.contexts?.trace,...Jl(n)},...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||Nc(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}ft(e,t={},n=Zl(),r=Gl()){return la&&Cu(e)&&xa(`Captured error event \`${pu(e)[0]||"<unknown>"}\``),this.xt(e,t,n,r).then(e=>e.event_id,e=>{la&&(Nu(e)?xa(e.message):ku(e)?ka(e.message):ka(e))})}xt(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Iu(e),a=Cu(e),l=`before send for type \`${e.type||"error"}\``,c=void 0===o?void 0:function(e){if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t}(o);if(a&&"number"==typeof c&&yl()>c)return this.recordDroppedEvent("sample_rate","error"),Bc(xu(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const u=$u(e.type);return this.bt(e,t,n,r).then(e=>{if(null===e)throw this.recordDroppedEvent("event_processor",u),xu("An event processor returned `null`, will not send event.");if(!0===t.data?.Ke)return e;const n=function(e,t,n,r){const{beforeSend:i,beforeSendTransaction:o,ignoreSpans:s}=t,a=!((l=t.beforeSendSpan)&&"function"==typeof l&&"kt"in l&&l.kt)&&t.beforeSendSpan;var l;let c=n;if(Cu(c)&&i)return i(c,r);if(Iu(c)){if(a||s){const t=function(e){const{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:a}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:s?.[Kl],exclusive_time:s?.[Xl],measurements:e.measurements,is_segment:!0}}(c);if(s?.length&&wc(t,s))return null;if(a){const e=a(t);e?c=Dl(n,{type:"transaction",timestamp:(u=e).timestamp,start_timestamp:u.start_timestamp,transaction:u.description,contexts:{trace:{trace_id:u.trace_id,span_id:u.span_id,parent_span_id:u.parent_span_id,op:u.op,status:u.status,origin:u.origin,data:{...u.data,...u.profile_id&&{[Kl]:u.profile_id},...u.exclusive_time&&{[Xl]:u.exclusive_time}}}},measurements:u.measurements}):yc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(s?.length&&wc(e,s))bc(n,e);else if(a){const n=a(e);n?t.push(n):(yc(),t.push(e))}else t.push(e);const r=c.spans.length-t.length;r&&e.recordDroppedEvent("before_send","span",r),c.spans=t}}if(o){if(c.spans){const e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return o(c,r)}}var u;return c}(this,i,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Ka(e))return e.then(e=>{if(!Qa(e)&&null!==e)throw bu(n);return e},e=>{throw bu(`${t} rejected with ${e}`)});if(!Qa(e)&&null!==e)throw bu(n);return e}(n,l)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",u),s){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw xu(`${l} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.wt(o,i),s){const e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const c=i.transaction_info;if(s&&c&&i.transaction!==e.transaction){const e="custom";i.transaction_info={...c,source:e}}return this.sendEvent(i,t),i}).then(null,e=>{if(Nu(e)||ku(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{Ke:!0},originalException:e}),bu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)})}ht(e,t){this.rt++,this.st.add(e).then(e=>(this.rt--,e),e=>(this.rt--,e===hu&&this.recordDroppedEvent("queue_overflow",t),e))}Nt(){const e=this.it;return this.it={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}St(){la&&xa("Flushing outcomes...");const e=this.Nt();if(0===e.length)return void(la&&xa("No outcomes to send"));if(!this.lt)return void(la&&xa("No dsn provided, will not send outcomes"));la&&xa("Sending outcomes:",e);const t=(n=e,Ic((r=this.et.tunnel&&oc(this.lt))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Tl(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function $u(e){return"replay_event"===e?"replay":e||"error"}function Cu(e){return void 0===e.type}function Iu(e){return"transaction"===e.type}function Tu(e){let t=0;return e.name&&(t+=2*e.name.length),t+=8,t+Pu(e.attributes)}function Eu(e){let t=0;return e.message&&(t+=2*e.message.length),t+Pu(e.attributes)}function Pu(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*Du(e[0]):Va(e)?t+=Du(e):t+=100}),t}function Du(e){return"string"==typeof e?2*e.length:"number"==typeof e?8:"boolean"==typeof e?4:0}function zu(e){return function(e){return qa(e)&&"_t"in e&&"string"==typeof e._t}(e)?`${e.message} (${e._t})`:e.message}function Ru(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function Mu(e){"aggregates"in e?void 0===e.attrs?.ip_address&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):void 0===e.ipAddress&&(e.ipAddress="{{auto}}")}const Ou=100;function ju(e,t){const n=Ql(),r=Gl();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Ou}=n.getOptions();if(o<=0)return;const s={timestamp:Tl(),...e},a=i?ga(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let Wu;const Au=new WeakMap,Lu=()=>({name:"FunctionToString",setupOnce(){Wu=function(){}.toString;try{Function.prototype.toString=function(...e){const t=cl(this),n=Au.has(Ql())&&void 0!==t?t:this;return Wu.apply(n,e)}}catch{}},setup(e){Au.set(e,!0)}}),Bu=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Fu=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=Hu(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=Hu(e,n)}return function(e,t){if(e.type){if("transaction"===e.type&&function(e,t){if(!t?.length)return!1;const n=e.transaction;return!!n&&kl(n,t)}(e,t.ignoreTransactions))return la&&ka(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${_l(e)}`),!0}else{if(function(e,t){return!!t?.length&&pu(e).some(e=>kl(e,t))}(e,t.ignoreErrors))return la&&ka(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${_l(e)}`),!0;if(function(e){return!!e.exception?.values?.length&&(!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&"Error"!==e.type||e.value))}(e))return la&&ka(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${_l(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=Uu(e);return!!n&&kl(n,t)}(e,t.denyUrls))return la&&ka(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${_l(e)}.\nUrl: ${Uu(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=Uu(e);return!n||kl(n,t)}(e,t.allowUrls))return la&&ka(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${_l(e)}.\nUrl: ${Uu(e)}`),!0}return!1}(n,t)?null:n}}},qu=(e={})=>({...Fu(e),name:"InboundFilters"});function Hu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Bu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Uu(e){try{const t=[...e.exception?.values??[]].reverse().find(e=>void 0===e.mechanism?.parent_id&&e.stacktrace?.frames?.length),n=t?.stacktrace?.frames;return n?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return la&&Na(`Cannot extract url for event ${_l(e)}`),null}}function Yu(e,t,n,r,i,o){if(!i.exception?.values||!o||!Xa(o.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=Zu(e,t,r,o.originalException,n,i.exception.values,s,0))}function Zu(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(Xa(r[i],Error)){Vu(s,a,r);const o=e(t,r[i]),c=l.length;Qu(o,i,c,a),l=Zu(e,t,n,r[i],i,[o,...l],o,c)}return Gu(r)&&r.errors.forEach((o,c)=>{if(Xa(o,Error)){Vu(s,a,r);const u=e(t,o),d=l.length;Qu(u,`errors[${c}]`,d,a),l=Zu(e,t,n,o,i,[u,...l],u,d)}}),l}function Gu(e){return Array.isArray(e.errors)}function Vu(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...Gu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Qu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Ju(){"console"in ca&&fa.forEach(function(e){e in ca.console&&sl(ca.console,e,function(t){return pa[e]=t,function(...t){ja("console",{args:t,level:e});const n=pa[e];n?.apply(ca.console,t)}})})}const Ku=()=>{let e;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const n=e.message,r=t.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!ed(e,t)&&!!Xu(e,t))))}(e,t)||!!function(e,t){const n=td(t),r=td(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!ed(e,t)&&!!Xu(e,t)))}(e,t))}(t,e))return la&&ka("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function Xu(e,t){let n=Pa(e),r=Pa(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function ed(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function td(e){return e.exception?.values?.[0]}function nd(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const rd=ca;function id(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function od(e,t){const n="fetch";Ma(n,e),Oa(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in rd))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}())return!1;if(id(rd.fetch))return!0;let e=!1;const t=rd.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=id(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){la&&ka("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||sl(ca,"fetch",function(e){return function(...t){const n=new Error,{method:r,url:i}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:ad(t),method:sd(n,"method")?String(n.method).toUpperCase():tl(t)&&sd(t,"method")?String(t.method).toUpperCase():"GET"}}const t=e[0];return{url:ad(t),method:sd(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*El(),virtualError:n,headers:ld(t)};return ja("fetch",{...o}),e.apply(ca,t).then(async e=>(ja("fetch",{...o,endTimestamp:1e3*El(),response:e}),e),e=>{ja("fetch",{...o,endTimestamp:1e3*El(),error:e}),qa(e)&&void 0===e.stack&&(e.stack=n.stack,al(e,"framesToPop",1));const t=Ql(),r=t?.getOptions().enhanceFetchErrorMessages??"always";if(!1!==r&&e instanceof TypeError&&("Failed to fetch"===e.message||"Load failed"===e.message||"NetworkError when attempting to fetch resource."===e.message))try{const t=new URL(o.fetchData.url).host;"always"===r?e.message=`${e.message} (${t})`:al(e,"__sentry_fetch_url_host__",t)}catch{}throw e})}})}(0,t))}function sd(e,t){return!!e&&"object"==typeof e&&!!e[t]}function ad(e){return"string"==typeof e?e:e?sd(e,"url")?e.url:e.toString?e.toString():"":""}function ld(e){const[t,n]=e;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if(tl(t))return new Headers(t.headers)}catch{}}const cd=ca;let ud=0;function dd(){return ud>0}function hd(e,t={}){if(!function(e){return"function"==typeof e}(e))return e;try{const t=e.$t;if(t)return"function"==typeof t?t:e;if(cl(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>hd(e,t));return e.apply(this,r)}catch(e){throw ud++,setTimeout(()=>{ud--}),Vl(r=>{r.addEventProcessor(e=>(t.mechanism&&($l(e,void 0),Cl(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),Qc(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}ll(n,e),al(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function md(e,t){const n=pd(e,t),r={type:vd(t),value:wd(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function fd(e,t){return{exception:{values:[md(e,t)]}}}function pd(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&gd.test(e.message)?1:0}(t),i=function(e){return"number"==typeof e.framesToPop?e.framesToPop:0}(t);try{return e(n,r,i)}catch{}return[]}const gd=/Minified React error #\d+;/i;function yd(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function vd(e){const t=e?.name;return!t&&yd(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function wd(e){const t=e?.message;return yd(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?zu(t.error):zu(e):"No error message"}function bd(e,t,n,r,i){let o;if(Ua(t)&&t.error)return fd(e,t.error);if(Ya(t)||Ha(t,"DOMException")){const i=t;if("stack"in t)o=fd(e,t);else{const t=i.name||(Ya(i)?"DOMError":"DOMException"),s=i.message?`${t}: ${i.message}`:t;o=xd(e,s,n,r),$l(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return qa(t)?fd(e,t):Qa(t)||Ja(t)?(o=function(e,t,n,r){const i=Ql(),o=i?.getOptions().normalizeDepth,s=(a=t,Object.values(a).find(e=>e instanceof Error));var a;const l={Ct:$c(t,o)};if(s)return{exception:{values:[md(e,s)]},extra:l};const c={exception:{values:[{type:Ja(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:kd(t,{isUnhandledRejection:r})}]},extra:l};if(n){const t=pd(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),Cl(o,{synthetic:!0}),o):(o=xd(e,t,n,r),$l(o,`${t}`),Cl(o,{synthetic:!0}),o)}function xd(e,t,n,r){const i={};if(r&&n){const r=pd(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),Cl(i,{synthetic:!0})}if(Ga(t)){const{le:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function kd(e,{isUnhandledRejection:t}){const n=function(e){const t=Object.keys(ul(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}(e),r=t?"promise rejection":"exception";return Ua(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Ja(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class Nd extends _u{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:cd.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(e,t,n=[t],r="npm"){const i=(e.Xe=e.Xe||{}).sdk=e.Xe.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:ua})),i.version=ua)}(t,"browser",["browser"],cd.SENTRY_SDK_SOURCE||"npm"),t.Xe?.sdk&&(t.Xe.sdk.settings={infer_ip:t.sendDefaultPii?"auto":"never",...t.Xe.sdk.settings}),super(t);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o,ut:s,enableMetrics:a}=this.et,l=a??s?.enableMetrics??!0;cd.document&&(i||o||l)&&cd.document.addEventListener("visibilitychange",()=>{"hidden"===cd.document.visibilityState&&(i&&this.St(),o&&au(this),l&&cu(this))}),r&&this.on("beforeSendSession",Mu)}eventFromException(e,t){return function(e,t,n,r){const i=bd(e,t,n?.syntheticException||void 0,r);return Cl(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),Lc(i)}(this.et.stackParser,e,t,this.et.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=xd(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),Lc(o)}(this.et.stackParser,e,t,n,this.et.attachStacktrace)}bt(e,t,n,r){return e.platform=e.platform||"javascript",super.bt(e,t,n,r)}}const Sd="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,_d=ca;let $d,Cd,Id,Td;function Ed(){if(!_d.document)return;const e=ja.bind(null,"dom"),t=Pd(e,!0);_d.document.addEventListener("click",t,!1),_d.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=_d,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(sl(r,"addEventListener",function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.It=this.It||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=Pd(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),sl(r,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this.It||{},i=n[t];i&&(i.refCount--,i.refCount<=0&&(e.call(this,t,i.handler,r),i.handler=void 0,delete n[t]),0===Object.keys(n).length&&delete this.It)}catch{}return e.call(this,t,n,r)}}))})}function Pd(e,t=!1){return n=>{if(!n||n.Tt)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return"keypress"===e&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;al(n,"_sentryCaptured",!0),r&&!r.Et&&al(r,"_sentryId",Nl());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==Cd)return!1;try{if(!e.target||e.target.Et!==Id)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),Cd=n.type,Id=r?r.Et:void 0),clearTimeout($d),$d=_d.setTimeout(()=>{Id=void 0,Cd=void 0},1e3)}}function Dd(e){const t="history";Ma(t,e),Oa(t,zd)}function zd(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Td,i=function(e){try{return new URL(e,_d.location.origin).toString()}catch{return e}}(String(n));if(Td=i,r===i)return e.apply(this,t);ja("history",{from:r,to:i})}return e.apply(this,t)}}_d.addEventListener("popstate",()=>{const e=_d.location.href,t=Td;Td=e,t!==e&&ja("history",{from:t,to:e})}),"history"in rd&&rd.history&&(sl(_d.history,"pushState",e),sl(_d.history,"replaceState",e))}const Rd={},Md="__sentry_xhr_v3__";function Od(){if(!_d.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*El(),o=Za(n[0])?n[0].toUpperCase():void 0,s=function(e){if(Za(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[Md]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.Pt=!0);const a=()=>{const e=t[Md];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}ja("xhr",{endTimestamp:1e3*El(),startTimestamp:i,xhr:t,virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(a(),e.apply(t,n))}):t.addEventListener("readystatechange",a),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,i]=n,o=t[Md];return o&&Za(r)&&Za(i)&&(o.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[Md];return r?(void 0!==n[0]&&(r.body=n[0]),ja("xhr",{startTimestamp:1e3*El(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function jd(e,t=function(e){const t=Rd[e];if(t)return t;let n=_d[e];if(id(n))return Rd[e]=n.bind(_d);const r=_d.document;if(r&&"function"==typeof r.createElement)try{const t=r.createElement("iframe");t.hidden=!0,r.head.appendChild(t);const i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){Sd&&ka(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?Rd[e]=n.bind(_d):n}("fetch")){let n=0,r=0;return fu(e,async function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.url,s);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(e){throw Rd.fetch=void 0,e}finally{n-=o,r--}},mu(e.bufferSize||40))}const Wd="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function Ad(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?Sa:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Ld=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Bd=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Fd=/\((\S*)(?::(\d+))(?::(\d+))\)/,qd=/at (.+?) ?\(data:(.+?),/,Hd=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ud=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Yd=Ca([30,e=>{const t=e.match(qd);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=Ld.exec(e);if(n){const[,e,t,r]=n;return Ad(e,Sa,+t,+r)}const r=Bd.exec(e);if(r){if(0===r[2]?.indexOf("eval")){const e=Fd.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=Zd(r[1]||Sa,r[2]);return Ad(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=Hd.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Ud.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Sa;return[n,e]=Zd(n,e),Ad(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Zd=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Sa,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Gd=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:"Breadcrumbs",setup(e){var n;t.console&&function(e){const t="console";Ma(t,e),Oa(t,Ju)}(function(e){return function(t){if(Ql()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:(r=t.level,"warn"===r?"warning":["fatal","error","warning","log","info","debug"].includes(r)?r:"log"),message:bl(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${bl(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}ju(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(Ql()!==e)return;let r,i,o="object"==typeof t?t.serializeAttribute:void 0,s="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;s&&s>1024&&(Wd&&ka(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=1024),"string"==typeof o&&(o=[o]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=rl(t,{keyAttrs:o,maxStringLength:s}),i=function(e){if(!nl.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}(t)}catch{r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),ju(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),Ma("dom",n),Oa("dom",Ed)),t.xhr&&function(e){Ma("xhr",e),Oa("xhr",Od)}(function(e){return function(t){if(Ql()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Md];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:l}=i,c={method:o,url:s,status_code:a},u={xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:c,type:"http",level:nd(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),ju(d,u)}}(e)),t.fetch&&od(function(e){return function(t){if(Ql()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){const i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},o={category:"fetch",data:t.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",o,i),ju(o,i)}else{const i=t.response,o={...t.fetchData,status_code:i?.status},s={input:t.args,response:i,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,type:"http",level:nd(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),ju(a,s)}}}(e)),t.history&&Dd(function(e){return function(t){if(Ql()!==e)return;let n=t.from,r=t.to;const i=Ru(cd.location.href);let o=n?Ru(n):void 0;const s=Ru(r);o?.path||(o=i),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),ju({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){Ql()===e&&ju({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:_l(t)},{event:t})}}(e))}}},Vd="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),Qd=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&sl(cd,"setTimeout",Jd),t.setInterval&&sl(cd,"setInterval",Jd),t.requestAnimationFrame&&sl(cd,"requestAnimationFrame",Kd),t.XMLHttpRequest&&"XMLHttpRequest"in cd&&sl(XMLHttpRequest.prototype,"send",Xd);const e=t.eventTarget;e&&(Array.isArray(e)?e:Vd).forEach(e=>function(e,t){const n=cd,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(sl(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=hd(i.handleEvent,{mechanism:{data:{handler:Ea(i),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,i),n.apply(this,[r,hd(i,{mechanism:{data:{handler:Ea(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),sl(r,"removeEventListener",function(e){return function(t,n,r){try{const i=n.$t;i&&e.call(this,t,i,r)}catch{}return e.call(this,t,n,r)}}))}(e,t))}}};function Jd(e){return function(...t){const n=t[0];return t[0]=hd(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Ea(e)}`}}),e.apply(this,t)}}function Kd(e){return function(t){return e.apply(this,[hd(t,{mechanism:{data:{handler:Ea(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function Xd(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&sl(n,e,function(t){const n={mechanism:{data:{handler:Ea(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=cl(t);return r&&(n.mechanism.data.handler=Ea(r)),hd(t,n)})}),e.apply(this,t)}}const eh=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(void 0===cd.document)return void(Wd&&ka("Using the `browserSessionIntegration` in non-browser environments is not supported."));Xc({ignoreDuration:!0}),nu();const e=Gl();let n=e.getUser();e.addScopeListener(e=>{const t=e.getUser();n?.id===t?.id&&n?.ip_address===t?.ip_address||(nu(),n=t)}),"route"===t&&Dd(({from:e,to:t})=>{e!==t&&(Xc({ignoreDuration:!0}),nu())})}}},th=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(){const t="error";Ma(t,t=>{const{stackParser:n,attachStacktrace:r}=rh();if(Ql()!==e||dd())return;const{msg:i,url:o,line:s,column:a,error:l}=t,c=function(e,t,n,r){const i=e.exception=e.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[];return 0===l.length&&l.push({colno:r,lineno:n,filename:ih(t)??ol(),function:Sa,in_app:!0}),e}(bd(n,l||i,void 0,r,!1),o,s,a);c.level="error",Kc(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),Oa(t,Aa)}()}(e),nh("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";Ma(t,t=>{const{stackParser:n,attachStacktrace:r}=rh();if(Ql()!==e||dd())return;const i=function(e){if(Va(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),o=Va(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:bd(n,i,void 0,r,!0);o.level="error",Kc(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),Oa(t,Ba)}()}(e),nh("onunhandledrejection"))}}};function nh(e){Wd&&xa(`Global Handler attached: ${e}`)}function rh(){const e=Ql();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function ih(e){if(Za(e)&&0!==e.length)return e.startsWith("data:")?`<${function(e,t=!0){if(e.startsWith("data:")){const n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=e.includes(";base64,"),o=e.indexOf(",");let s="";if(t&&-1!==o){const t=e.slice(o+1);s=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?",base64":""}${s?`,${s}`:""}`}return e}(e,!1)}>`:e}const oh=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){Yu(md,i.getOptions().stackParser,n,t,e,r)}}};function sh(e={}){const t=!e.skipBrowserExtensionCheck&&!!function(){if(void 0===cd.window)return!1;const e=cd;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=ol();return!(cd===cd.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}()&&(Wd&&ga(()=>{}),!0);let n=null==e.defaultIntegrations?[qu(),Lu(),{name:"ConversationId",setup(e){e.on("spanStart",e=>{const t=Zl().getScopeData(),n=Gl().getScopeData(),r=t.conversationId||n.conversationId;r&&e.setAttribute("gen_ai.conversation.id",r)})}},Qd(),Gd(),th(),oh(),Ku(),{name:"HttpContext",preprocessEvent(e){if(!cd.navigator&&!cd.location&&!cd.document)return;const t=function(){const e=ol(),{referrer:t}=cd.document||{},{userAgent:n}=cd.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}},{name:"CultureContext",preprocessEvent(e){const t=function(){try{const e=cd.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})}},eh()]:e.defaultIntegrations;const r={...e,enabled:!t&&e.enabled,stackParser:(i=e.stackParser||Yd,Array.isArray(i)?Ca(...i):i),integrations:iu({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||jd};var i;return function(e,t){!0===t.debug&&(la?ba():ga(()=>{})),Zl().update(t.initialScope);const n=new e(t);return function(e){Zl().setClient(e)}(n),n.init(),n}(Nd,r)}let ah=!1;function lh(e){if(ah)t();else if(e.enabled&&e.dsn)try{const n=e.bundleUrlPatterns||[/cdn\.insure-os\.com/,/api\.os\.insure.*\/dist/,/localhost:\d+\/dist/,/index\.(esm|umd|cjs)\.js/];sh({dsn:e.dsn,environment:e.environment||"production",release:e.release,beforeSend:e=>function(e,t){var n,r,i,o;const s=null===(o=null===(i=null===(r=null===(n=e.exception)||void 0===n?void 0:n.values)||void 0===r?void 0:r[0])||void 0===i?void 0:i.stacktrace)||void 0===o?void 0:o.frames;if(!s||0===s.length)return!0;return s.some(e=>!!e.filename&&t.some(t=>t.test(e.filename||"")))}(e,n)?(e.tags={...e.tags,source:"insureos-widget"},t(e.exception),e):(t(e.exception),null),allowUrls:n,sampleRate:e.sampleRate||1,tracesSampleRate:e.tracesSampleRate||.1,integrations:[Gd({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),Ku()],ignoreErrors:["top.GLOBALS","originalCreateNotification","canvas.contentDocument","MyApp_RemoveAllHighlights","atomicFindClose","Can't find variable: ZiteReader","jigsaw is not defined","ComboSearch is not defined","ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"]}),ah=!0,t()}catch(e){}else t()}function ch(e,n){if(ah)try{n?Vl(t=>{Object.entries(n).forEach(([e,n])=>{t.setContext(e,n)}),Qc(e)}):Qc(e)}catch(e){t()}}function uh(e,n="info",r){if(ah)try{r?Vl(t=>{Object.entries(r).forEach(([e,n])=>{t.setContext(e,n)}),Jc(e,n)}):Jc(e,n)}catch(e){t()}}function dh(e){if(ah)try{!function(e){Gl().setUser(e)}(e)}catch(e){t()}}function hh(e){if(ah)try{ju(e)}catch(e){t()}}function mh(e,n){if(ah)try{!function(e,t){Gl().setTag(e,t)}(e,n)}catch(e){t()}}function fh(){return ah}var ph=Object.freeze({__proto__:null,addBreadcrumb:hh,captureException:ch,captureMessage:uh,initializeSentry:lh,isSentryInitialized:fh,setTag:mh,setUser:dh});const gh="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",yh="production",vh="insureos-scripts",wh=!0,bh=1,xh=.1;class kh{constructor(e={}){var t,n,r,i;this.dataLayerAvailable=!1,this.config={enabled:null===(t=e.enabled)||void 0===t||t,customDataLayer:null!==(n=e.customDataLayer)&&void 0!==n?n:"dataLayer",includePersonalData:null!==(r=e.includePersonalData)&&void 0!==r&&r,debug:null!==(i=e.debug)&&void 0!==i&&i},"undefined"!=typeof window?this.initializeDataLayer():this.dataLayerAvailable=!1}initializeDataLayer(){try{const e=this.config.customDataLayer;window[e]||(window[e]=[],this.logDebug(`Created new ${e} array`)),Array.isArray(window[e])?(this.dataLayerAvailable=!0,this.logDebug(`✅ Data layer '${e}' is available and ready`)):(this.dataLayerAvailable=!1,this.logDebug(`⚠️ Data layer '${e}' exists but is not an array`))}catch(e){this.dataLayerAvailable=!1,this.logDebug("⚠️ Failed to initialize data layer:",e)}}isEnabled(){return this.config.enabled&&this.dataLayerAvailable}getDataLayer(){if(!this.isEnabled())return null;try{const e=window[this.config.customDataLayer];return Array.isArray(e)?e:null}catch(e){return this.logDebug("Failed to get data layer:",e),null}}push(e){if(!this.isEnabled())return void this.logDebug("📊 Analytics disabled or data layer not available, skipping event:",e.event);const t=this.getDataLayer();if(t)try{const n=this.config.includePersonalData?e:this.removePII(e);t.push(n),this.logDebug("📊 Pushed event to data layer:",n)}catch(e){this.logDebug("❌ Failed to push event to data layer:",e)}else this.logDebug("⚠️ Data layer not available, skipping event:",e.event)}removePII(e){const t={...e},n=["email","phone","name","address","client_name","client_email"];for(const e of n)e in t&&delete t[e];return t}logDebug(...e){this.config.debug&&t("[Analytics]",...e)}clear(){if(this.dataLayerAvailable)try{window[this.config.customDataLayer]=[],this.logDebug("🧹 Cleared data layer")}catch(e){this.logDebug("Failed to clear data layer:",e)}}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e},(e.customDataLayer||void 0!==e.enabled)&&this.initializeDataLayer(),this.logDebug("Updated analytics configuration:",this.config)}}class Nh{constructor(){this.sentryInitialized=!1,this.analyticsManager=null,this.pendingPromoCodes=new Map}initializeSentryOnce(){if(!this.sentryInitialized)try{lh({dsn:gh,environment:yh,release:vh,enabled:wh,sampleRate:bh,tracesSampleRate:xh}),this.sentryInitialized=!0,t()}catch(e){t()}}validateConfig(e){if(!e.orgId)throw new Error("orgId is required");if("payment"===e.mode&&!e.paymentLinkId)throw new Error("paymentLinkId is required when mode is 'payment'")}initializeAnalyticsOnce(e){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new kh({enabled:null===(n=e.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=e.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=e.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=e.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:e.debug}),Te(this.analyticsManager),t()}catch(e){t()}}async mount(e,t){t.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(t),this.initializeSentryOnce(),this.initializeAnalyticsOnce(t),function(e,t){var i,o,s;t==document&&(t=document.documentElement),r.m&&r.m(e,t),i=t.i,o=[],s=[],L(t,e=t.i=S($,null,[e]),i||v,v,t.namespaceURI,i?null:t.firstChild?n.call(t.childNodes):null,o,i?i.v:t.firstChild,!1,s),F(o,e,s)}(S(aa,{config:t,initializeFormContext:this.initializeFormContext.bind(this)}),e)}createHttpClient(e){var t,n,r,i,o,s,a,l,c,u;if(!e.orgId)throw new Error("orgId is required");const d=e.apiBaseUrl||"https://api.os.insure";return new Q({orgId:e.orgId,apiBaseUrl:d,timeout:(null===(t=e.httpConfig)||void 0===t?void 0:t.timeout)||1e4,retryConfig:{maxRetries:(null===(r=null===(n=e.httpConfig)||void 0===n?void 0:n.retryConfig)||void 0===r?void 0:r.maxRetries)||3,baseDelay:(null===(o=null===(i=e.httpConfig)||void 0===i?void 0:i.retryConfig)||void 0===o?void 0:o.baseDelay)||1e3,maxDelay:(null===(a=null===(s=e.httpConfig)||void 0===s?void 0:s.retryConfig)||void 0===a?void 0:a.maxDelay)||1e4,retryableStatusCodes:(null===(c=null===(l=e.httpConfig)||void 0===l?void 0:l.retryConfig)||void 0===c?void 0:c.retryableStatusCodes)||[429,500,502,503,504],...null===(u=e.httpConfig)||void 0===u?void 0:u.retryConfig}})}createClient(e){const t=this.createHttpClient(e);return new Be(t)}async initializeFormContext(e){var n,r,i,o,s;const a=this.createHttpClient(e),l=new URLSearchParams(window.location.search),c=l.get("qi");c&&(t(),e.quoteIntentUrl=`${e.apiBaseUrl}/quote-intents/${c}`);const u=l.get("p")||l.get("pl_ref");if(u)return t(),{httpClient:a,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:u,signedUrl:void 0}};if("payment"===e.mode)return t(),{httpClient:a,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:e.paymentLinkId,signedUrl:e.signedUrl}};const d="sessionStorage"===e.storageType?new K:new J;d.isAvailable()?t(d.constructor.name):t();const h=new ee(d),m=new te(h),f=e.products,p=null==f?void 0:f.includes("*"),g=!f||0===f.length,y=g||p||f&&f.length>1,v=f&&1===f.length&&!p,w=localStorage.getItem("insure-os-selected-product"),b=new URLSearchParams(window.location.search),x=!!(b.get("transactionId")||b.get("transaction_id")||b.get("payment_id")),k=b.get("code");if("1"===b.get("clear")){t(),localStorage.clear(),b.delete("clear");const e=b.toString()?`${window.location.pathname}?${b.toString()}`:window.location.pathname;window.history.replaceState({},"",e),t()}const N=`insure-os-pending-promo-${e.orgId}`,S="skipPendingPromoCode"in e&&!0===e.skipPendingPromoCode;if(k&&!x&&!S){const n={code:k,ts:Date.now()};localStorage.setItem(N,JSON.stringify(n)),this.pendingPromoCodes.set(e.orgId,k),t(),b.delete("code");const r=b.toString()?`${window.location.pathname}?${b.toString()}`:window.location.pathname;window.history.replaceState({},"",r)}const _="promoCode"in e?e.promoCode:void 0;let $=null;if(!S)try{const e=localStorage.getItem(N);if(e){const t=JSON.parse(e);"object"==typeof t&&t.code&&Date.now()-t.ts<36e5?$=t.code:"string"==typeof t?$=t:localStorage.removeItem(N)}}catch(e){localStorage.removeItem(N)}const C=S?void 0:this.pendingPromoCodes.get(e.orgId),I=k||_||$||C||null;if(t(),I&&!x){const i=h.getQuoteIntent(e.orgId);if(null===(n=null==i?void 0:i.form_data)||void 0===n?void 0:n.page_data){const n=i.form_data.page_data,o=null===(r=Object.values(n).find(e=>e&&"object"==typeof e&&"promo_code"in e))||void 0===r?void 0:r.promo_code;o&&o!==I&&(t(),m.clearQuoteIntent(e.orgId))}}const T=async n=>{var r;t(n.id);const i=new Ae(n,a,m,{autoSave:!1,autoSaveInterval:n.form_definition.settings.autoSaveInterval});if("prefillFormData"in e&&e.prefillFormData){const o=(null===(r=n.form_definition)||void 0===r?void 0:r.pages.length)||0,s=Array.from({length:o},(e,t)=>t);i.restoreFormProgress({page_data:e.prefillFormData,current_page:o-1,completed_pages:s,last_updated:(new Date).toISOString()}),t()}else n.form_data&&i.restoreFormProgress(n.form_data);if(I){const e=i.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));e?(i.updateFieldValue(e.id,"promo_code",I),t(e.id)):t()}if(n.cached_result&&(t(),i.restoreCalculationResult(n.cached_result)),n.organisation&&n.organisation.theme)try{await Js.loadTheme({slug:n.organisation.slug,theme_url:n.organisation.theme.css_url})}catch(e){t()}const o="skipAutoCalculation"in e&&!!e.skipAutoCalculation;return await this.handleAutoCalculationIfComplete(i,o),{httpClient:a,stateManager:h,quoteIntent:n,quoteIntentStore:m,formStateManager:i,urlPromoCode:I||void 0}};if(y&&!e.quoteIntentUrl&&!w){const n=x?null:h.getQuoteIntent(e.orgId);if(n)try{const r=await a.getQuoteIntent(n.url),l={id:r.quote_intent.id,url:r.url,calculate_url:r.calculate_url,delete_calculations_url:r.delete_calculations_url,expires_at:new Date(r.quote_intent.expires_at).getTime(),updated_at:new Date(r.quote_intent.updated_at).getTime(),created_at:new Date(r.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:r.product.id,product_name:r.product.description||r.product.name,form_definition:r.product.form_definition,form_data:r.quote_intent.form_data,status:r.quote_intent.status,reference:r.quote_intent.reference,organisation:r.organisation,cached_result:r.cached_result};if(h.saveQuoteIntent(e.orgId,l),null===(o=null===(i=l.form_data)||void 0===i?void 0:i.completed_pages)||void 0===o?void 0:o.length){if(t(),null===(s=l.organisation)||void 0===s?void 0:s.theme)try{await Js.loadTheme({slug:l.organisation.slug,theme_url:l.organisation.theme.css_url})}catch(e){t()}const{firstName:n,lastUpdated:r}=(e=>{var t;const n=["client_first_name","first_name","firstName","fname","given_name"],r=null===(t=e.form_data)||void 0===t?void 0:t.page_data;let i=null;if(r)for(const e of Object.values(r)){if(!e||"object"!=typeof e)continue;const t=e;for(const e of n)if(t[e]){i=String(t[e]);break}if(i)break}return{firstName:i,lastUpdated:e.updated_at?new Date(e.updated_at).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):null}})(l);return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,resumePrompt:{reference:l.reference||null,productName:l.product_name||null,firstName:n,lastUpdated:r,onContinue:async()=>T(l),onStartFresh:async()=>{m.clearQuoteIntent(e.orgId);const t=await a.fetchAvailableProducts(g?void 0:f);return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,availableProducts:t.products,productCodes:f}}}}}}catch(n){t(),m.clearQuoteIntent(e.orgId)}t();const r=await a.fetchAvailableProducts(g?void 0:f);if(t(),r.organisation&&r.organisation.theme)try{const e=await Promise.resolve().then(function(){return Ks}).then(e=>e.ThemeLoader);await e.loadTheme({slug:r.organisation.slug,theme_url:r.organisation.theme.css_url}),t()}catch(e){t()}return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,availableProducts:r.products,productCodes:f}}let E;w?(t(),E=w,localStorage.removeItem("insure-os-selected-product")):v&&(E=f[0]);const P=async()=>{t();const n=e.quoteIntentUrl?await a.getQuoteIntent(e.quoteIntentUrl):await a.createQuoteIntent({code:E,...e.dealerOrganisationId&&{dealer_organisation_id:e.dealerOrganisationId}});return t(),{id:n.quote_intent.id,url:n.url,calculate_url:n.calculate_url,delete_calculations_url:n.delete_calculations_url,calculate_url_v2:n.calculate_url_v2,reprice_url_v2:n.reprice_url_v2,bind_url_v2:n.bind_url_v2,calculator_version:n.product.calculator_version,expires_at:new Date(n.quote_intent.expires_at).getTime(),updated_at:new Date(n.quote_intent.updated_at).getTime(),created_at:new Date(n.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:n.product.id,product_name:n.product.description||n.product.name,form_definition:n.product.form_definition,form_data:n.quote_intent.form_data,status:n.quote_intent.status,reference:n.quote_intent.reference,organisation:n.organisation,cached_result:n.cached_result}},D=async t=>{var n;const r=new URLSearchParams(window.location.search),i=r.get("transaction_id")||r.get("payment_id")||r.get("transactionId"),o=await a.getQuoteIntent(t);let s;const l=r.get("status");if(i){const e=null===(n=o.payment_transactions)||void 0===n?void 0:n.find(e=>e.id===i);if(e){let t="unknown";switch(e.status){case"completed":t="success";break;case"failed":t="declined";break;case"cancelled":t="cancelled";break;default:t="error"}s={paymentTransactionId:e.id,paymentStatus:t,transactionStatus:e}}else if(l){let e="error";switch(l.toLowerCase()){case"success":case"completed":e="success";break;case"failed":case"declined":e="declined";break;case"cancelled":case"canceled":e="cancelled";break;default:e="error"}s={paymentTransactionId:i,paymentStatus:e,transactionStatus:void 0}}}const c={id:o.quote_intent.id,url:o.url,calculate_url:o.calculate_url,delete_calculations_url:o.delete_calculations_url,calculate_url_v2:o.calculate_url_v2,reprice_url_v2:o.reprice_url_v2,bind_url_v2:o.bind_url_v2,calculator_version:o.product.calculator_version,expires_at:new Date(o.quote_intent.expires_at).getTime(),updated_at:new Date(o.quote_intent.updated_at).getTime(),created_at:new Date(o.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:o.product.id,product_name:o.product.description||o.product.name,form_definition:o.product.form_definition,form_data:o.quote_intent.form_data,status:o.quote_intent.status,reference:o.quote_intent.reference,organisation:o.organisation,payment_return:s,payment_transactions:o.payment_transactions,cached_result:o.cached_result};return s&&h.saveQuoteIntent(e.orgId,c),c};return(async()=>{let t=null,n=!1;try{const r=h.getQuoteIntent(e.orgId),i=await m.getOrCreateQuoteIntent(e.orgId,P,D);i.payment_return&&h.saveQuoteIntent(e.orgId,i),t=i,n=!r}catch(r){if(!(r instanceof G&&404===r.statusCode))throw r;m.clearQuoteIntent(e.orgId),t=await m.getOrCreateQuoteIntent(e.orgId,P,D),n=!0}if(n&&t&&Pe(t),!t)throw new Error("Failed to initialize quote intent state");return T(t)})()}async handleAutoCalculationIfComplete(e,n=!1){try{if(n)return void t();const r=e.getQuoteIntent();if("paid"===r.status||"completed"===r.status)return void t();if(e.hasCalculationResponse())return void t();if(e.hasLastCalculationFailed())return void t();const i=e.getPageCompletionStatus(),{totalPages:o,completedPages:s}=i,a=s.length===o;t((s.length,e.getIsCalculating(),e.hasLastCalculationFailed())),a&&!e.getIsCalculating()&&(t(),await e.calculateQuote(),t())}catch(e){t()}}}const Sh=new Nh;"undefined"!=typeof window&&(window.InsureOS=Sh,function(){const e=document.querySelectorAll('script[src*="insureos"]'),t=e[e.length-1];if(t&&t.src){const e=new URL(t.src),n=e.searchParams.get("orgId"),r=e.searchParams.get("productCode"),i=e.searchParams.get("productCodes"),o=i?i.split(","):r?[r]:null;if(n&&o){const t=e.searchParams.get("container"),r=t?document.getElementById(t):document.body;if(r){const e={orgId:n,products:o};r.dataset.insureosConfig=JSON.stringify(e);const t=async()=>{try{await Sh.mount(r,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class _h{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,_h.instance)return _h.instance;_h.instance=this}startMeasurement(e){this.measurements.set(e,this.now())}endMeasurement(e){const t=this.measurements.get(e);if(void 0===t)throw new Error(`No measurement started for: ${e}`);const n=this.now()-t;return this.measurements.delete(e),this.completedMeasurements.has(e)||this.completedMeasurements.set(e,[]),this.completedMeasurements.get(e).push(n),"initialization"===e&&(this.initializationTime=n),n}async measureApiCall(e,t){const n=this.now();let r,i=!1;try{const e=await t();return i=!0,e}catch(e){throw i=!1,r=e instanceof Error?e.message:"Unknown error",e}finally{const t=this.now()-n;this.apiCallMetrics.push({operation:e,duration:t,timestamp:Date.now(),success:i,error:r})}}measureMemoryUsage(){return"undefined"!=typeof performance&&"memory"in performance&&performance.memory.usedJSHeapSize||0}getDetailedMemoryInfo(){if("undefined"!=typeof performance&&"memory"in performance){const e=performance.memory;return{usedJSHeapSize:e.usedJSHeapSize||0,totalJSHeapSize:e.totalJSHeapSize||0,jsHeapSizeLimit:e.jsHeapSizeLimit||0}}return null}getMetrics(){var e;const t=this.apiCallMetrics.filter(e=>e.success).map(e=>e.duration),n=t.length>0?t.reduce((e,t)=>e+t,0)/t.length:0,r={};return this.completedMeasurements.forEach((e,t)=>{r[t]=[...e]}),{bundleSize:{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}},runtime:{initializationTime:this.initializationTime,apiCallTime:t.length>0&&null!==(e=t[t.length-1])&&void 0!==e?e:0,memoryUsage:this.measureMemoryUsage(),averageApiCallTime:n,totalApiCalls:this.apiCallMetrics.length},measurements:r}}getApiCallMetrics(){return[...this.apiCallMetrics]}clearMetrics(){this.completedMeasurements.clear(),this.apiCallMetrics=[],this.initializationTime=0}generateReport(){const e=this.getMetrics(),t=this.getDetailedMemoryInfo();let n="=== Performance Report ===\n\n";if(n+="Runtime Performance:\n",n+=` Initialization Time: ${e.runtime.initializationTime.toFixed(2)}ms\n`,n+=` Total API Calls: ${e.runtime.totalApiCalls}\n`,n+=` Average API Call Time: ${e.runtime.averageApiCallTime.toFixed(2)}ms\n`,n+=` Current Memory Usage: ${(e.runtime.memoryUsage/1024/1024).toFixed(2)}MB\n\n`,t&&(n+="Memory Details:\n",n+=` Used Heap: ${(t.usedJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Total Heap: ${(t.totalJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Heap Limit: ${(t.jsHeapSizeLimit/1024/1024).toFixed(2)}MB\n\n`),this.apiCallMetrics.length>0){n+="API Call Breakdown:\n";const e=new Map;this.apiCallMetrics.forEach(t=>{e.has(t.operation)||e.set(t.operation,{count:0,totalTime:0,errors:0});const n=e.get(t.operation);n.count++,n.totalTime+=t.duration,t.success||n.errors++}),e.forEach((e,t)=>{const r=e.totalTime/e.count,i=(e.errors/e.count*100).toFixed(1);n+=` ${t}: ${e.count} calls, ${r.toFixed(2)}ms avg, ${i}% errors\n`})}return n}static async getBundleSizes(){return{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}}}now(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()}static startMeasurement(e){(new _h).startMeasurement(e)}static endMeasurement(e){return(new _h).endMeasurement(e)}static measureMemoryUsage(){return(new _h).measureMemoryUsage()}static async measureApiCall(e,t){return(new _h).measureApiCall(e,t)}static getMetrics(){return(new _h).getMetrics()}static generateReport(){return(new _h).generateReport()}}let $h=class e{constructor(t){this.headers=new Map,t&&(Array.isArray(t)?t.forEach(([e,t])=>this.set(e,t)):t instanceof e?t.forEach((e,t)=>this.set(t,e)):Object.entries(t).forEach(([e,t])=>this.set(e,t)))}append(e,t){const n=this.get(e);this.set(e,n?`${n}, ${t}`:t)}delete(e){this.headers.delete(e.toLowerCase())}get(e){return this.headers.get(e.toLowerCase())||null}has(e){return this.headers.has(e.toLowerCase())}set(e,t){this.headers.set(e.toLowerCase(),t)}forEach(e){this.headers.forEach(e)}},Ch=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new $h(t.headers),this.body=t.body||null,this.signal=t.signal||void 0):(this.url=e.url,this.method=t.method||e.method,this.headers=new $h(t.headers||e.headers),this.body=void 0!==t.body?t.body:e.body,this.signal=void 0!==t.signal?null!==(n=t.signal)&&void 0!==n?n:void 0:e.signal)}},Ih=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new $h(t.headers),this.ok=this.status>=200&&this.status<300,this.Dt=e}async text(){return this.Dt}async json(){return JSON.parse(this.Dt)}};var Th=Object.freeze({__proto__:null,Headers:$h,Request:Ch,Response:Ih,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new Ch(e,t),o=new XMLHttpRequest;i.signal&&i.signal.addEventListener("abort",()=>{o.abort(),r(new Error("Request aborted"))}),o.open(i.method,i.url),i.headers.forEach((e,t)=>{o.setRequestHeader(t,e)}),o.onload=()=>{const e=new $h;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new Ih(o.responseText,{status:o.status,statusText:o.statusText,headers:e});n(t)},o.onerror=()=>{r(new TypeError("Network request failed"))},o.ontimeout=()=>{r(new TypeError("Network request timed out"))},o.send(i.body)})}});class Eh{constructor(e){this.state="pending",this.onFulfilledCallbacks=[],this.onRejectedCallbacks=[];try{e(this.resolve.bind(this),this.reject.bind(this))}catch(e){this.reject(e)}}resolve(e){"pending"===this.state&&(this.state="fulfilled",this.value=e,this.onFulfilledCallbacks.forEach(t=>{setTimeout(()=>t(e),0)}))}reject(e){"pending"===this.state&&(this.state="rejected",this.reason=e,this.onRejectedCallbacks.forEach(t=>{setTimeout(()=>t(e),0)}))}then(e,t){return new Eh((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof Eh?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof Eh?i.then(n,r):n(i)}else r(e)}catch(e){r(e)}};"fulfilled"===this.state?setTimeout(()=>i(this.value),0):"rejected"===this.state?setTimeout(()=>o(this.reason),0):(this.onFulfilledCallbacks.push(i),this.onRejectedCallbacks.push(o))})}catch(e){return this.then(void 0,e)}static resolve(e){return new Eh(t=>t(e))}static reject(e){return new Eh((t,n)=>n(e))}static all(e){return new Eh((t,n)=>{if(0===e.length)return void t([]);const r=[];let i=0;e.forEach((o,s)=>{o.then(n=>{r[s]=n,i++,i===e.length&&t(r)},n)})})}}var Ph=Object.freeze({__proto__:null,PromisePolyfill:Eh});class Dh{constructor(e){this.params=new Map,"string"==typeof e?this.parseString(e):e&&"object"==typeof e&&"forEach"in e&&"function"==typeof e.forEach?e.forEach((e,t)=>this.append(t,e)):e&&"object"==typeof e&&Object.entries(e).forEach(([e,t])=>this.set(e,t))}parseString(e){const t=e.startsWith("?")?e.slice(1):e;t&&t.split("&").forEach(e=>{if(!e)return;const t=e.indexOf("=");let n,r;-1===t?(n=e,r=""):(n=e.substring(0,t),r=e.substring(t+1)),n&&this.append(decodeURIComponent(n),decodeURIComponent(r))})}append(e,t){const n=this.params.get(e)||[];n.push(t),this.params.set(e,n)}delete(e){this.params.delete(e)}get(e){var t;const n=this.params.get(e);return n&&n.length>0&&null!==(t=n[0])&&void 0!==t?t:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,t){this.params.set(e,[t])}forEach(e){this.params.forEach((t,n)=>{t.forEach(t=>e(t,n))})}toString(){const e=[];return this.params.forEach((t,n)=>{t.forEach(t=>{e.push(`${encodeURIComponent(n)}=${encodeURIComponent(t)}`)})}),e.join("&")}}var zh=Object.freeze({__proto__:null,URLPolyfill:class{constructor(e,t){const n=this.parseUrl(e,t);this.protocol=n.protocol,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.hash=n.hash,this.host=this.port?`${this.hostname}:${this.port}`:this.hostname,this.origin=`${this.protocol}//${this.host}`,this.href=this.toString(),this.searchParams=new Dh(this.search)}parseUrl(e,t){const n=document.createElement("a");if(t){const r=document.createElement("a");r.href=t,n.href=this.resolveUrl(e,r.href)}else n.href=e;return{protocol:n.protocol,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash}}resolveUrl(e,t){if(e.includes("://"))return e;if(e.startsWith("/")){const n=document.createElement("a");return n.href=t,`${n.protocol}//${n.host}${e}`}return`${t.split("/").slice(0,-1).join("/")}/${e}`}toString(){return`${this.protocol}//${this.host}${this.pathname}${this.search}${this.hash}`}},URLSearchParamsPolyfill:Dh});e.DataLayerManager=kh,e.EnhancedHttpClient=Q,e.ErrorHandlingStrategy=class{handleNetworkError(t){return new G(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(t){if(503===t.status)return new G(e.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);const n=t.status>=500||429===t.status;return 429===t.status?new G(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,t.status):t.status>=400&&t.status<500?new G(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status):t.status>=500?new G(e.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,t.status):new G(e.ErrorType.API_ERROR,`Request failed: ${t.statusText}`,n,t.status)}handleStorageError(t){return new G(e.ErrorType.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(e){return e.retryable}getUserFriendlyMessage(t){switch(t.type){case e.ErrorType.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case e.ErrorType.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case e.ErrorType.API_ERROR:return 429===t.statusCode?"Too many requests. Please wait a moment and try again.":t.statusCode&&t.statusCode>=400&&t.statusCode<500?"Invalid request. Please refresh the page and try again.":t.statusCode&&t.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case e.ErrorType.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case e.ErrorType.TIMEOUT_ERROR:return"Request timed out. Please try again.";case e.ErrorType.VALIDATION_ERROR:return t.validationErrors&&Object.keys(t.validationErrors).length>0?"There were validation errors in your form. Please check your inputs and try again.":"Invalid data provided. Please check your input and try again.";default:return"An unexpected error occurred. Please try again."}}},e.FormStateManager=Ae,e.InsureOS=Sh,e.InsureOSClient=Nh,e.InsureOSError=G,e.LocalStateManager=ee,e.LocalStorageAdapter=J,e.MemoryStorageAdapter=class{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||null}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}clear(){this.storage.clear()}isAvailable(){return!0}},e.PerformanceMonitor=_h,e.PolyfillManager=class{constructor(e={}){var t,n,r;this.detectionResults=null,this.config={fetch:null===(t=e.fetch)||void 0===t||t,promise:null===(n=e.promise)||void 0===n||n,url:null===(r=e.url)||void 0===r||r}}async loadPolyfills(){this.detectionResults=this.detectFeatures(),this.config.fetch&&this.detectionResults.fetch&&await this.loadFetchPolyfill(),this.config.promise&&this.detectionResults.promise&&await this.loadPromisePolyfill(),this.config.url&&this.detectionResults.url&&await this.loadUrlPolyfill()}getDetectionResults(){return this.detectionResults}detectFeatures(){return{fetch:this.needsFetchPolyfill(),promise:this.needsPromisePolyfill(),url:this.needsUrlPolyfill()}}needsFetchPolyfill(){if("undefined"==typeof fetch)return!0;if("undefined"==typeof Headers||"undefined"==typeof Request||"undefined"==typeof Response)return!0;try{return new Headers,new Request("http://example.com"),new Response,!1}catch(e){return!0}}needsPromisePolyfill(){if("undefined"==typeof Promise)return!0;if("function"!=typeof Promise.resolve||"function"!=typeof Promise.reject||"function"!=typeof Promise.all)return!0;try{const e=Promise.resolve(42);return"function"!=typeof e.then||"function"!=typeof e.catch}catch(e){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const e=new URL("http://example.com/path?param=value#hash");if("string"!=typeof e.protocol||"string"!=typeof e.hostname||"string"!=typeof e.pathname||"string"!=typeof e.search||"string"!=typeof e.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const t=new URLSearchParams("param=value");return"function"!=typeof t.get||"function"!=typeof t.set}catch(e){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:e,Headers:t,Request:n,Response:r}=await Promise.resolve().then(function(){return Th});void 0===globalThis.fetch&&(globalThis.fetch=e),void 0===globalThis.Headers&&(globalThis.Headers=t),void 0===globalThis.Request&&(globalThis.Request=n),void 0===globalThis.Response&&(globalThis.Response=r)}catch(e){}}async loadPromisePolyfill(){if(this.needsPromisePolyfill())try{const{PromisePolyfill:e}=await Promise.resolve().then(function(){return Ph});void 0===globalThis.Promise&&(globalThis.Promise=e)}catch(e){}}async loadUrlPolyfill(){if(this.needsUrlPolyfill())try{const{URLPolyfill:e,URLSearchParamsPolyfill:t}=await Promise.resolve().then(function(){return zh});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}},e.RetryStrategy=V,e.SessionStorageAdapter=K,e.ThemeLoader=Js,e.addBreadcrumb=hh,e.captureException=ch,e.captureMessage=uh,e.createAppError=we,e.getAnalytics=function(){return Ie},e.getSupportMessage=Ce,e.groupErrorsByField=function(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})},e.initializeAnalytics=Te,e.initializeSentry=lh,e.isSentryInitialized=fh,e.parseServerValidationErrors=fe,e.setTag=mh,e.setUser=dh,e.shouldShowErrorPage=function(e){return"initialization"===e.type&&"critical"===e.severity},e.shouldShowMaintenancePage=$e,e.trackFormProgress=De,e.trackPaymentCompleted=je,e.trackPaymentFailed=We,e.trackPaymentInitiated=Oe,e.trackQuoteAtCheckout=Re,e.trackQuoteCalculated=ze,e.trackQuoteReferred=Me,e.trackQuoteStarted=Pe,e.validateField=he,e.validatePage=me});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|