@insure-os/client 0.0.26 → 0.0.29

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/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,c,l,u,d,h,m,f,p={},g=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(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 k(e,a,i,o,null)}function k(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 S(e){return e.children}function N(e,t){this.props=e,this.context=t}function _(e,t){if(null==t)return e.m?_(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?_(e):null}function $(e){var t,n;if(null!=(e=e.m)&&null!=e.k){for(e.v=e.k.base=null,t=0;t<e.i.length;t++)if(null!=(n=e.i[t])&&null!=n.v){e.v=e.k.base=n.v;break}return $(e)}}function C(e){(!e.I&&(e.I=!0)&&o.push(e)&&!T.P++||s!=r.debounceRendering)&&((s=r.debounceRendering)||a)(T)}function T(){for(var e,t,n,i,s,a,l,u=1;o.length;)o.length>u&&o.sort(c),e=o.shift(),u=o.length,e.I&&(n=void 0,s=(i=(t=e).N).v,a=[],l=[],t.R&&((n=w({},i)).N=i.N+1,r.vnode&&r.vnode(n),R(t.R,n,i,t.O,t.R.namespaceURI,32&i.C?[s]:null,a,null==s?_(i):s,!!(32&i.C),l),n.N=i.N,n.m.i[n._]=n,j(a,n,l),n.v!=s&&$(n)));T.P=0}function I(e,t,n,r,i,o,s,a,c,l,u){var d,h,m,f,y,w,b,x=r&&r.i||g,N=t.length;for(c=function(e,t,n,r,i){var o,s,a,c,l,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?(c=o+h,(s=e.i[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?k(null,s,null,null,null):v(s)?k(S,{children:s},null,null,null):null==s.constructor&&s.p>0?k(s.type,s.props,s.key,s.ref?s.ref:null,s.N):s).m=e,s.p=e.p+1,a=null,-1!=(l=s._=P(s,n,c,d))&&(d--,(a=n[l])&&(a.C|=2)),null==a||null==a.N?(-1==l&&(i>u?h--:i<u&&h++),"function"!=typeof s.type&&(s.C|=4)):l!=c&&(l==c-1?h--:l==c+1?h++:(l>c?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=_(a)),B(a,a));return r}(n,t,x,c,N),d=0;d<N;d++)null!=(m=n.i[d])&&(h=-1==m._?p:x[m._]||p,m._=d,w=R(e,m,h,i,o,s,a,c,l,u),f=m.v,m.ref&&h.ref!=m.ref&&(h.ref&&L(h.ref,null,m),u.push(m.ref,m.k||f,m)),null==y&&null!=f&&(y=f),(b=!!(4&m.C))||h.i===m.i?c=E(m,c,e,b):"function"==typeof m.type&&void 0!==w?c=w:f&&(c=f.nextSibling),m.C&=-7);return n.v=y,c}function E(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=E(i[o],t,n,r));return t}e.v!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=_(e)),n.insertBefore(e.v,t||null)),t=e.v);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function P(e,t,n,r){var i,o,s,a=e.key,c=e.type,l=t[n],u=null!=l&&!(2&l.C);if(null===l&&null==e.key||u&&a==l.key&&c==l.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(l=t[s=i>=0?i--:o++])&&!(2&l.C)&&a==l.key&&c==l.type)return s;return-1}function D(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||y.test(t)?n:n+"px"}function M(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||D(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||D(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(l,"$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.u=r.u:(n.u=u,e.addEventListener(t,o?h:d,o)):e.removeEventListener(t,o?h:d,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 z(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=u++;else if(t.t<n.u)return;return n(r.event?r.event(t):t)}}}function R(e,t,n,i,o,s,a,c,l,u){var d,h,m,f,p,g,y,x,k,_,$,C,T,E,P,D,M,z=t.type;if(null!=t.constructor)return null;128&n.C&&(l=!!(32&n.C),s=[c=t.v=n.v]),(d=r.p)&&d(t);e:if("function"==typeof z)try{if(x=t.props,k="prototype"in z&&z.prototype.render,_=(d=z.contextType)&&i[d.k],$=d?_?_.props.value:d.m:i,n.k?y=(h=t.k=n.k).m=h.j:(k?t.k=h=new z(x,$):(t.k=h=new N(x,$),h.constructor=z,h.render=F),_&&_.sub(h),h.props=x,h.state||(h.state={}),h.context=$,h.O=i,m=h.I=!0,h.A=[],h.W=[]),k&&null==h.L&&(h.L=h.state),k&&null!=z.getDerivedStateFromProps&&(h.L==h.state&&(h.L=w({},h.L)),w(h.L,z.getDerivedStateFromProps(x,h.L))),f=h.props,p=h.state,h.N=t,m)k&&null==z.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),k&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(k&&null==z.getDerivedStateFromProps&&x!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,$),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.L,$)||t.N==n.N){for(t.N!=n.N&&(h.props=x,h.state=h.L,h.I=!1),t.v=n.v,t.i=n.i,t.i.some(function(e){e&&(e.m=t)}),C=0;C<h.W.length;C++)h.A.push(h.W[C]);h.W=[],h.A.length&&a.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(x,h.L,$),k&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(f,p,g)})}if(h.context=$,h.props=x,h.R=e,h.v=!1,T=r.P,E=0,k){for(h.state=h.L,h.I=!1,T&&T(t),d=h.render(h.props,h.state,h.context),P=0;P<h.W.length;P++)h.A.push(h.W[P]);h.W=[]}else do{h.I=!1,T&&T(t),d=h.render(h.props,h.state,h.context),h.state=h.L}while(h.I&&++E<25);h.state=h.L,null!=h.getChildContext&&(i=w(w({},i),h.getChildContext())),k&&!m&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(f,p)),D=d,null!=d&&d.type===S&&null==d.key&&(D=A(d.props.children)),c=I(e,v(D)?D:[D],t,n,i,o,s,a,c,l,u),h.base=t.v,t.C&=-161,h.A.length&&a.push(h),y&&(h.j=h.m=null)}catch(e){if(t.N=null,l||null!=s)if(e.then){for(t.C|=l?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,t.v=c}else{for(M=s.length;M--;)b(s[M]);O(t)}else t.v=n.v,t.i=n.i,e.then||O(t);r.v(e,t,n)}else null==s&&t.N==n.N?(t.i=n.i,t.v=n.v):c=t.v=W(n.v,t,n,i,o,s,a,l,u);return(d=r.diffed)&&d(t),128&t.C?void 0:c}function O(e){e&&e.k&&(e.k.v=!0),e&&e.i&&e.i.forEach(O)}function j(e,t,n){for(var i=0;i<n.length;i++)L(n[i],n[++i],n[++i]);r.k&&r.k(t,e),e.some(function(t){try{e=t.A,t.A=[],e.some(function(e){e.call(t)})}catch(e){r.v(e,t.N)}})}function A(e){return"object"!=typeof e||null==e||e.p&&e.p>0?e:v(e)?e.map(A):w({},e)}function W(e,t,i,o,s,a,c,l,u){var d,h,m,f,g,y,w,x=i.props,k=t.props,S=t.type;if("svg"==S?s="http://www.w3.org/2000/svg":"math"==S?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((g=a[d])&&"setAttribute"in g==!!S&&(S?g.localName==S:3==g.nodeType)){e=g,a[d]=null;break}if(null==e){if(null==S)return document.createTextNode(k);e=document.createElementNS(s,S,k.is&&k),l&&(r.B&&r.B(t,a),l=!1),a=null}if(null==S)x===k||l&&e.data==k||(e.data=k);else{if(a=a&&n.call(e.childNodes),x=i.props||p,!l&&null!=a)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)if(g=x[d],"children"==d);else if("dangerouslySetInnerHTML"==d)m=g;else if(!(d in k)){if("value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k)continue;M(e,d,null,g,s)}for(d in k)g=k[d],"children"==d?f=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?y=g:"checked"==d?w=g:l&&"function"!=typeof g||x[d]===g||M(e,d,g,x[d],s);if(h)l||m&&(h.H==m.H||h.H==e.innerHTML)||(e.innerHTML=h.H),t.i=[];else if(m&&(e.innerHTML=""),I("template"==t.type?e.content:e,v(f)?f:[f],t,i,o,"foreignObject"==S?"http://www.w3.org/1999/xhtml":s,a,c,a?a[0]:i.i&&_(i,0),l,u),null!=a)for(d=a.length;d--;)b(a[d]);l||(d="value","progress"==S&&null==y?e.removeAttribute("value"):null!=y&&(y!==e[d]||"progress"==S&&!y||"option"==S&&y!=x[d])&&M(e,d,y,x[d],s),d="checked",null!=w&&w!=e[d]&&M(e,d,w,x[d],s))}return e}function L(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 B(e,t,n){var i,o;if(r.unmount&&r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||L(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){r.v(e,t)}i.base=i.R=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&B(i[o],t,n||"function"!=typeof e.type);n||b(e.v),e.k=e.m=e.v=void 0}function F(e,t,n){return this.constructor(e,n)}n=g.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.I),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.I),s)return i.j=i}catch(t){e=t}throw e}},i=0,N.prototype.setState=function(e,t){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=w({},this.state),"function"==typeof e&&(e=e(w({},n),this.props)),e&&w(n,e),null!=e&&this.N&&(t&&this.W.push(t),C(this))},N.prototype.forceUpdate=function(e){this.N&&(this.v=!0,e&&this.A.push(e),C(this))},N.prototype.render=S,o=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,c=function(e,t){return e.N.p-t.N.p},T.P=0,l=/(PointerCapture)$|Capture$/i,u=0,d=z(!1),h=z(!0),m=0,e.ErrorType=void 0,(f=e.ErrorType||(e.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",f.API_ERROR="API_ERROR",f.VALIDATION_ERROR="VALIDATION_ERROR",f.STORAGE_ERROR="STORAGE_ERROR",f.TIMEOUT_ERROR="TIMEOUT_ERROR",f.MAINTENANCE_ERROR="MAINTENANCE_ERROR";class q 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 H{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 q?e.retryable:!("TypeError"!==e.name||!e.message.includes("fetch"))||"AbortError"===e.name}}class U{constructor(e){this.config=e,this.retryStrategy=new H(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 c={method:n,headers:e,signal:o.signal};r&&(c.body=JSON.stringify(r));const l=await fetch(t,c);if(clearTimeout(s),!l.ok)throw await this.handleApiError(l);const u=await l.json();return u.data||u}catch(t){if(clearTimeout(s),t instanceof q)throw t;if(t instanceof Error&&"AbortError"===t.name)throw new q(e.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(t instanceof TypeError&&t.message.includes("fetch"))throw new q(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||[],c=null===(n=s.organisation)||void 0===n?void 0:n.client_settings;let l=a;if(r)t(),l=a;else if(e&&e.length>0)l=a.filter(t=>e.includes(t.code));else if(i&&(null==c?void 0:c.products)&&c.products.length>0){const e=c.products.map(e=>e.code);l=e.map(e=>a.find(t=>t.code===e)).filter(e=>void 0!==e),t((a.length,l.length))}else i&&(t(),l=a);return{products:l,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"})}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})}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}})}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 q&&(e.type,e.message)),t(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw t(),n;const o=e instanceof q?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 q(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 q(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 q(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 q(e.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.error.details):new q(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 q(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 q(e.ErrorType.VALIDATION_ERROR,t.message||"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.errors):new q(e.ErrorType.API_ERROR,t.message||"Invalid request. Please check your input and try again.",!1,n.status)}catch(t){return new q(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 q(e.ErrorType.API_ERROR,t,!1,n.status)}return new q(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 Nd}).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 Z{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 Y{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 G{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}}G.KEY_PREFIX="insure_os_",G.SEPARATOR="_";class J{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||J.DEFAULT_EXPIRATION_MS,namespace:t.namespace||J.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{t.payment_transactions&&t.payment_transactions.length;const n=this.generateStorageKey(e),r=G.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=G.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 G.generateKey(this.config.namespace,e)}}J.DEFAULT_EXPIRATION_MS=864e5,J.DEFAULT_NAMESPACE="quote_intent";class Q{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 V{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 K(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 X(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 ee(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 te(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),c=Math.floor((Date.now()-s)/864e5);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 c<i;case"age_days_less_than_or_equal":return c<=i;case"age_days_greater_than":return c>i;case"age_days_greater_than_or_equal":return c>=i;default:throw new Error(`Unsupported date operator: ${n}`)}}class ne{static create(e){switch(e){case"string":case"text":case"select":return K;case"numeric":return X;case"boolean":return ee;case"date":return te;default:throw new Error(`Unsupported condition type: ${e}`)}}}function re(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:ie(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 ie(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=ne.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var oe=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:ne,booleanMatchesCondition:ee,checkSimpleConditions:re,dateMatchesCondition:te,numericMatchesCondition:X,textMatchesCondition:K});function se(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);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&&(new RegExp(o.pattern).test(s)||r.push({field:e.code||e.id,message:`${e.label} format is invalid`})),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 ae(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=re(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=se(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=re(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 ce(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 le{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:ce(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 ue{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.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}}isStagingEnvironment(){const e=window.location.hostname;return"localhost"===e||e.endsWith(".test")||e.includes("staging")}}class de{constructor(e){this.httpClient=e}async calculateQuote(e){const n=await this.httpClient.calculateQuoteIntent(e);return t(),n}}function he(e,t,n){var r,i,o,s;const a=Date.now(),c=`${e}-${a}`;if(function(e,t,n){try{Promise.resolve().then(function(){return Nd}).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 me(c,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 me(c,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:c,type:e,severity:pe(e),title:fe(e),message:n||ye(e),details:t.message,retryable:ve(e,0),timestamp:a,trackingId:c}}const l="string"==typeof t?t:"An unexpected error occurred";return{id:c,type:e,severity:pe(e),title:fe(e),message:n||l,retryable:ve(e,0),timestamp:a,trackingId:c}}function me(e,t,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=ve(t,n);return{id:e,type:t,severity:s,statusCode:n,title:fe(t,n),message:i||ge(t,n,r),details:r,retryable:a,timestamp:o}}function fe(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 pe(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ge(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 ye(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 ve(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 we(e){return"maintenance"===e.type||503===e.statusCode}function be(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 xe=null;function ke(e){xe=e}function Se(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 Ne(e){var t,n;if(!(null==xe?void 0:xe.isEnabled()))return;const r={...Se(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};xe.push(r)}function _e(e,t,n,r){var i,o;if(!(null==xe?void 0:xe.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,c={...Se(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};xe.push(c)}function $e(e,t){if(!(null==xe?void 0:xe.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,c=r.some(e=>"monthly"===e.amount.frequency),l={...Se(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:c,min_premium:s,max_premium:a};xe.push(l)}function Ce(e,t,n,r,i){if(!(null==xe?void 0:xe.isEnabled()))return;const o={...Se(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};xe.push(o)}function Te(e,t){if(!(null==xe?void 0:xe.isEnabled()))return;const n=t.referrals||[],r={...Se(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};xe.push(r)}function Ie(e,t,n,r){if(!(null==xe?void 0:xe.isEnabled()))return;const i={...Se(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};xe.push(i)}function Ee(e,t,n,r,i,o){if(!(null==xe?void 0:xe.isEnabled()))return;const s={...Se(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};xe.push(s)}function Pe(e,t,n,r,i,o){if(!(null==xe?void 0:xe.isEnabled()))return;const s={...Se(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};xe.push(s)}class De{constructor(e,t,n,r={}){this.quoteIntent=e,this.httpClient=t,this.subscribers=new Set,this.pendingChanges={},this.isCalculating=!1,this.isSaving=!1,this.selectedExcessId=null,this.selectedPaymentOption=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 le(t,i,n),this.autoSaveManager=new V(this.config,this.saveFormData.bind(this)),this.navigationManager=new ue(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new de(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){return t(JSON.stringify(r)),"calculate_age"===n?this.calculateAge(e,r):null}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,J: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=he("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;_e(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}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=ae(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=se(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 oe}),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,J: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=ae(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{this.isCalculating=!0,this.notify();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?$e(this.quoteIntent,e):"referral"===e.outcome_type&&Te(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.selectedExcessId=null,this.selectedPaymentOption=null,this.notify(),t()}catch(e){throw t(),e}}notify(){this.subscribers.forEach(e=>e(this))}getAllFormDataFlattened(){const e={};return Object.values(this.formData.page_data).forEach(t=>{Object.assign(e,t)}),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&&Ie(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 Me{constructor(e,t){this.httpClient=e,this.response=t}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(e){const t=this.response.product.form_definition,n={...this.response.quote_intent.form_data};n.page_data||(n.page_data={});for(const r of t.pages){const t=n.page_data[r.id]||{};for(const n of r.fields){const r=n.code||n.id;e.hasOwnProperty(r)?t[r]=e[r]:("text"===n.type&&(t[r]="sample"),"number"===n.type&&(t[r]=1),"checkbox"===n.type&&(t[r]=!0))}n.page_data[r.id]=t}const r={current_page_index:0,save_type:"full",page_data:{...n.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,r)}}class ze{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new Me(this.httpClient,n)}}var Re=0;function Oe(e,t,n,i,o,s){t||(t={});var a,c,l=t;if("ref"in l)for(c in l={},t)"ref"==c?a=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:--Re,_:-1,C:0,V:o,K:s};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===l[c]&&(l[c]=a[c]);return r.vnode&&r.vnode(u),u}var je,Ae,We,Le,Be=0,Fe=[],qe=r,He=qe.p,Ue=qe.P,Ze=qe.diffed,Ye=qe.k,Ge=qe.unmount,Je=qe.m;function Qe(e,t){qe.A&&qe.A(Ae,e,Be||t),Be=0;var n=Ae.X||(Ae.X={m:[],A:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function Ve(e){return Be=1,function(e,t){var n=Qe(je++,2);if(n.t=e,!n.k&&(n.m=[at(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=Ae,!Ae.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.forEach(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};Ae.te=!0;var i=Ae.shouldComponentUpdate,o=Ae.componentWillUpdate;Ae.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)},Ae.shouldComponentUpdate=r}return n.ee||n.m}(at,e)}function Ke(e,t){var n=Qe(je++,3);!qe.L&&st(n.X,t)&&(n.m=e,n.u=t,Ae.X.A.push(n))}function Xe(e){return Be=5,et(function(){return{current:e}},[])}function et(e,t){var n=Qe(je++,7);return st(n.X,t)&&(n.m=e(),n.X=t,n.A=e),n.m}function tt(){for(var e;e=Fe.shift();)if(e.R&&e.X)try{e.X.A.forEach(it),e.X.A.forEach(ot),e.X.A=[]}catch(t){e.X.A=[],qe.v(t,e.N)}}qe.p=function(e){Ae=null,He&&He(e)},qe.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),Je&&Je(e,t)},qe.P=function(e){Ue&&Ue(e),je=0;var t=(Ae=e.k).X;t&&(We===Ae?(t.A=[],Ae.A=[],t.m.forEach(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.A.forEach(it),t.A.forEach(ot),t.A=[],je=0)),We=Ae},qe.diffed=function(e){Ze&&Ze(e);var t=e.k;t&&t.X&&(t.X.A.length&&(1!==Fe.push(t)&&Le===qe.requestAnimationFrame||((Le=qe.requestAnimationFrame)||rt)(tt)),t.X.m.forEach(function(e){e.u&&(e.X=e.u),e.u=void 0})),We=Ae=null},qe.k=function(e,t){t.some(function(e){try{e.A.forEach(it),e.A=e.A.filter(function(e){return!e.m||ot(e)})}catch(n){t.some(function(e){e.A&&(e.A=[])}),t=[],qe.v(n,e.N)}}),Ye&&Ye(e,t)},qe.unmount=function(e){Ge&&Ge(e);var t,n=e.k;n&&n.X&&(n.X.m.forEach(function(e){try{it(e)}catch(e){t=e}}),n.X=void 0,t&&qe.v(t,n.N))};var nt="function"==typeof requestAnimationFrame;function rt(e){var t,n=function(){clearTimeout(r),nt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nt&&(t=requestAnimationFrame(n))}function it(e){var t=Ae,n=e.k;"function"==typeof n&&(e.k=void 0,n()),Ae=t}function ot(e){var t=Ae;e.k=e.m(),Ae=t}function st(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function at(e,t){return"function"==typeof t?t(e):t}const ct="insure-os";let lt=!1;const ut=new Map,dt={[`--${ct}-radius`]:"0.75rem",[`--${ct}-radius-sm`]:"0.5rem",[`--${ct}-radius-lg`]:"1rem",[`--${ct}-background`]:"oklch(0.955 0 0)",[`--${ct}-foreground`]:"oklch(0.145 0 0)",[`--${ct}-card`]:"oklch(1 0 0)",[`--${ct}-card-foreground`]:"oklch(0.145 0 0)",[`--${ct}-popover`]:"oklch(1 0 0)",[`--${ct}-popover-foreground`]:"oklch(0.145 0 0)",[`--${ct}-primary`]:"oklch(0.205 0 0)",[`--${ct}-primary-foreground`]:"oklch(0.985 0 0)",[`--${ct}-secondary`]:"oklch(0.97 0 0)",[`--${ct}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${ct}-muted`]:"oklch(0.97 0 0)",[`--${ct}-muted-foreground`]:"oklch(0.556 0 0)",[`--${ct}-accent`]:"oklch(0.97 0 0)",[`--${ct}-accent-foreground`]:"oklch(0.205 0 0)",[`--${ct}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${ct}-border`]:"oklch(0.9 0 0)",[`--${ct}-input`]:"oklch(0.9 0 0)",[`--${ct}-ring`]:"oklch(0.708 0 0)",[`--${ct}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${ct}-font-size-large`]:"18px",[`--${ct}-font-size-small`]:"14px",[`--${ct}-font-size`]:"16px",[`--${ct}-border-width`]:"1px",[`--${ct}-transition-duration`]:"200ms",[`--${ct}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${ct}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${ct}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${ct}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${ct}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${ct}-spacing-sm`]:"0.75rem",[`--${ct}-spacing`]:"1rem",[`--${ct}-spacing-md`]:"1.5rem",[`--${ct}-spacing-lg`]:"2rem",[`--${ct}-spacing-xl`]:"3rem"},ht={colors:{background:`var(--${ct}-background)`,foreground:`var(--${ct}-foreground)`,card:`var(--${ct}-card)`,popover:`var(--${ct}-popover)`,popoverForeground:`var(--${ct}-popover-foreground)`,primary:`var(--${ct}-primary)`,primaryForeground:`var(--${ct}-primary-foreground)`,secondary:`var(--${ct}-secondary)`,muted:`var(--${ct}-muted)`,mutedForeground:`var(--${ct}-muted-foreground)`,accent:`var(--${ct}-accent)`,accentForeground:`var(--${ct}-accent-foreground)`,destructive:`var(--${ct}-destructive)`,border:`var(--${ct}-border)`,input:`var(--${ct}-input)`},fontSize:{small:`var(--${ct}-font-size-small)`,default:`var(--${ct}-font-size)`,large:`var(--${ct}-font-size-large)`},radius:{small:`var(--${ct}-radius-sm)`,default:`var(--${ct}-radius)`,large:`var(--${ct}-radius-lg)`},shadow:{sm:`var(--${ct}-shadow-sm)`,md:`var(--${ct}-shadow-md)`},spacing:{sm:`var(--${ct}-spacing-sm)`,default:`var(--${ct}-spacing)`,md:`var(--${ct}-spacing-md)`,lg:`var(--${ct}-spacing-lg)`,xl:`var(--${ct}-spacing-xl)`},fontFamily:`var(--${ct}-font-family)`,borderWidth:`var(--${ct}-border-width)`,transition:`var(--${ct}-transition-duration) var(--${ct}-transition-timing-function)`},mt=new Set;function ft(e){if(!document.getElementById(`${ct}-styles`)){const e=document.createElement("style");e.id=`${ct}-styles`,document.head.appendChild(e)}document.getElementById(`${ct}-styles`).textContent+=e+"\n"}function pt(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 gt(){lt||(ft(`:root {\n${Object.entries(dt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),lt=!0)}const yt={name:e=>`${ct}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){gt();const r=pt(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=ut.get(o);if(s)return s.fullClassName;let a=e;const c=this.name(a);return mt.has(a)||(ft(`.${c} { ${r} }`),mt.add(a)),ut.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),c},keyframes(e,t){const n=`${ct}-${e}`;return mt.has(`keyframes-${e}`)||(ft(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${pt(t)} }`).join("\n")}\n}`),mt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;ft(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${ct}-${e} { ${pt(t)} }`).join("\n")}\n}`),mt.add(n)},pseudoElement(e,t,n){const r=`${ct}-${e}`,i=`${e}-${t}`;return mt.has(i)||(ft(`.${r}${t} { ${pt(n)} }`),mt.add(i)),r}};var vt=Object.freeze({__proto__:null,baseVariables:dt,styles:yt,theme:ht,updateBaseVariables:function(e){t(),Object.assign(dt,e);const n=document.getElementById(`${ct}-styles`);if(n){const e=n.textContent||"",r=`:root {\n${Object.entries(dt).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 gt()}});function wt(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var bt,xt={exports:{}};function kt(){return bt||(bt=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}()}(xt)),xt.exports}var St=wt(kt());function Nt({size:e="small"}){const t=yt.create("spinner-small",{width:"16px",height:"16px"}),n=yt.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return yt.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Oe("div",{className:yt.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Oe("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:St(r),children:Oe("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function _t({className:e,children:t,size:n="md"}){const r={sm:ht.spacing.sm,md:ht.spacing.md,lg:ht.spacing.lg,xl:ht.spacing.xl},i=yt.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?ht.spacing.lg:"lg"===n?ht.spacing.md:r[n]},"(max-width: 480px)":{padding:ht.spacing.sm}});return Oe("div",{className:St(i,e),children:t})}const $t=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,C(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"+m++,e.m=null,e.Provider=e.re=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}();function Ct({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a}){return Oe($t.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function Tt(){const e=function(e){var t=Ae.context[e.k],n=Qe(je++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(Ae)),t.props.value):e.m}($t);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function It(e){const t=Tt(),{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]=Ve(()=>e(n));return Ke(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class Et extends Error{}class Pt extends Et{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Dt extends Et{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Mt extends Et{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class zt extends Et{}class Rt extends Et{constructor(e){super(`Invalid unit ${e}`)}}class Ot extends Et{}class jt extends Et{constructor(){super("Zone is an abstract class")}}const At="numeric",Wt="short",Lt="long",Bt={year:At,month:At,day:At},Ft={year:At,month:Wt,day:At},qt={year:At,month:Wt,day:At,weekday:Wt},Ht={year:At,month:Lt,day:At},Ut={year:At,month:Lt,day:At,weekday:Lt},Zt={hour:At,minute:At},Yt={hour:At,minute:At,second:At},Gt={hour:At,minute:At,second:At,timeZoneName:Wt},Jt={hour:At,minute:At,second:At,timeZoneName:Lt},Qt={hour:At,minute:At,hourCycle:"h23"},Vt={hour:At,minute:At,second:At,hourCycle:"h23"},Kt={hour:At,minute:At,second:At,hourCycle:"h23",timeZoneName:Wt},Xt={hour:At,minute:At,second:At,hourCycle:"h23",timeZoneName:Lt},en={year:At,month:At,day:At,hour:At,minute:At},tn={year:At,month:At,day:At,hour:At,minute:At,second:At},nn={year:At,month:Wt,day:At,hour:At,minute:At},rn={year:At,month:Wt,day:At,hour:At,minute:At,second:At},on={year:At,month:Wt,day:At,weekday:Wt,hour:At,minute:At},sn={year:At,month:Lt,day:At,hour:At,minute:At,timeZoneName:Wt},an={year:At,month:Lt,day:At,hour:At,minute:At,second:At,timeZoneName:Wt},cn={year:At,month:Lt,day:At,weekday:Lt,hour:At,minute:At,timeZoneName:Lt},ln={year:At,month:Lt,day:At,weekday:Lt,hour:At,minute:At,second:At,timeZoneName:Lt};class un{get type(){throw new jt}get name(){throw new jt}get ianaName(){return this.name}get isUniversal(){throw new jt}offsetName(e,t){throw new jt}formatOffset(e,t){throw new jt}offset(e){throw new jt}equals(e){throw new jt}get isValid(){throw new jt}}let dn=null;class hn extends un{static get instance(){return null===dn&&(dn=new hn),dn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Dr(e,t,n)}formatOffset(e,t){return Or(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const mn=new Map,fn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},pn=new Map;class gn extends un{static create(e){let t=pn.get(e);return void 0===t&&pn.set(e,t=new gn(e)),t}static resetCache(){pn.clear(),mn.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=gn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Dr(e,t,n,this.name)}formatOffset(e,t){return Or(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=mn.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"}),mn.set(e,t)),t}(this.name);let[r,i,o,s,a,c,l]=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=fn[t];"era"===t?r[o]=i:dr(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,c,l,u]=r;return[s,i,o,a,c,l,u]}(n,t);"BC"===s&&(r=1-Math.abs(r));let u=+t;const d=u%1e3;return u-=d>=0?d:1e3+d,(Tr({year:r,month:i,day:o,hour:24===a?0:a,minute:c,second:l,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let yn={};const vn=new Map;function wn(e,t={}){const n=JSON.stringify([e,t]);let r=vn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),vn.set(n,r)),r}const bn=new Map,xn=new Map;let kn=null;const Sn=new Map;function Nn(e){let t=Sn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Sn.set(e,t)),t}const _n=new Map;function $n(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class Cn{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=bn.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),bn.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 br(this.floor?Math.floor(e):Nr(e,3),this.padTo)}}class Tn{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&&gn.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=wn(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 In{constructor(e,t,n){this.opts={style:"long",...n},!t&&fr()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=xn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),xn.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),c=1===a,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?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 En={firstDay:1,minimalDays:4,weekend:[6,7]};class Pn{static fromOpts(e){return Pn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||Jn.defaultLocale,s=o||(i?"en-US":kn||(kn=(new Intl.DateTimeFormat).resolvedOptions().locale,kn)),a=t||Jn.defaultNumberingSystem,c=n||Jn.defaultOutputCalendar,l=vr(r)||Jn.defaultWeekSettings;return new Pn(s,a,c,l,o)}static resetCache(){kn=null,vn.clear(),bn.clear(),xn.clear(),Sn.clear(),_n.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return Pn.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=wn(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=wn(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"===Nn(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?Pn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,vr(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 $n(this,e,Br,()=>{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=Ho.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return $n(this,e,Ur,()=>{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=Ho.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return $n(this,void 0,()=>Zr,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Ho.utc(2016,11,13,9),Ho.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return $n(this,e,Qr,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Ho.utc(-40,1,1),Ho.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 Cn(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Tn(e,this.intl,t)}relFormatter(e={}){return new In(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=yn[n];return r||(r=new Intl.ListFormat(e,t),yn[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||Nn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:pr()?function(e){let t=_n.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...En,...t}),_n.set(e,t)}return t}(this.locale):En}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 Dn=null;class Mn extends un{static get utcInstance(){return null===Dn&&(Dn=new Mn(0)),Dn}static instance(e){return 0===e?Mn.utcInstance:new Mn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Mn(Mr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Or(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Or(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Or(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 zn extends un{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 Rn(e,t){if(dr(e)||null===e)return t;if(e instanceof un)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?hn.instance:"utc"===n||"gmt"===n?Mn.utcInstance:Mn.parseSpecifier(n)||gn.create(e)}return hr(e)?Mn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new zn(e)}const On={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},jn={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]},An=On.hanidec.replace(/[\[|\]]/g,"").split(""),Wn=new Map;function Ln({numberingSystem:e},t=""){const n=e||"latn";let r=Wn.get(n);void 0===r&&(r=new Map,Wn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${On[n]}${t}`),r.set(t,i)),i}let Bn,Fn=()=>Date.now(),qn="system",Hn=null,Un=null,Zn=null,Yn=60,Gn=null;class Jn{static get now(){return Fn}static set now(e){Fn=e}static set defaultZone(e){qn=e}static get defaultZone(){return Rn(qn,hn.instance)}static get defaultLocale(){return Hn}static set defaultLocale(e){Hn=e}static get defaultNumberingSystem(){return Un}static set defaultNumberingSystem(e){Un=e}static get defaultOutputCalendar(){return Zn}static set defaultOutputCalendar(e){Zn=e}static get defaultWeekSettings(){return Gn}static set defaultWeekSettings(e){Gn=vr(e)}static get twoDigitCutoffYear(){return Yn}static set twoDigitCutoffYear(e){Yn=e%100}static get throwOnInvalid(){return Bn}static set throwOnInvalid(e){Bn=e}static resetCaches(){Pn.resetCache(),gn.resetCache(),Ho.resetCache(),Wn.clear()}}class Qn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Vn=[0,31,59,90,120,151,181,212,243,273,304,334],Kn=[0,31,60,91,121,152,182,213,244,274,305,335];function Xn(e,t){return new Qn("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function er(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 tr(e,t,n){return n+(_r(e)?Kn:Vn)[t-1]}function nr(e,t){const n=_r(e)?Kn:Vn,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function rr(e,t){return(e-t+7)%7+1}function ir(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=tr(r,i,o),a=rr(er(r,i,o),n);let c,l=Math.floor((s-a+14-t)/7);return l<1?(c=r-1,l=Er(c,t,n)):l>Er(r,t,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...jr(e)}}function or(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=rr(er(r,1,t),n),a=$r(r);let c,l=7*i+o-s-7+t;l<1?(c=r-1,l+=$r(c)):l>a?(c=r+1,l-=$r(r)):c=r;const{month:u,day:d}=nr(c,l);return{year:c,month:u,day:d,...jr(e)}}function sr(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:tr(t,n,r),...jr(e)}}function ar(e){const{year:t,ordinal:n}=e,{month:r,day:i}=nr(t,n);return{year:t,month:r,day:i,...jr(e)}}function cr(e,t){if(!dr(e.localWeekday)||!dr(e.localWeekNumber)||!dr(e.localWeekYear)){if(!dr(e.weekday)||!dr(e.weekNumber)||!dr(e.weekYear))throw new zt("Cannot mix locale-based week fields with ISO-based week fields");return dr(e.localWeekday)||(e.weekday=e.localWeekday),dr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),dr(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 lr(e){const t=mr(e.year),n=wr(e.month,1,12),r=wr(e.day,1,Cr(e.year,e.month));return t?n?!r&&Xn("day",e.day):Xn("month",e.month):Xn("year",e.year)}function ur(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=wr(t,0,23)||24===t&&0===n&&0===r&&0===i,s=wr(n,0,59),a=wr(r,0,59),c=wr(i,0,999);return o?s?a?!c&&Xn("millisecond",i):Xn("second",r):Xn("minute",n):Xn("hour",t)}function dr(e){return void 0===e}function hr(e){return"number"==typeof e}function mr(e){return"number"==typeof e&&e%1==0}function fr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function pr(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function gr(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 yr(e,t){return{}.hasOwnProperty.call(e,t)}function vr(e){if(null==e)return null;if("object"!=typeof e)throw new Ot("Week settings must be an object");if(!wr(e.firstDay,1,7)||!wr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!wr(e,1,7)))throw new Ot("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function wr(e,t,n){return mr(e)&&e>=t&&e<=n}function br(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function xr(e){return dr(e)||null===e||""===e?void 0:parseInt(e,10)}function kr(e){return dr(e)||null===e||""===e?void 0:parseFloat(e)}function Sr(e){if(!dr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function Nr(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 _r(e){return e%4==0&&(e%100!=0||e%400==0)}function $r(e){return _r(e)?366:365}function Cr(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?_r(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Tr(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 Ir(e,t,n){return-rr(er(e,1,t),n)+t-1}function Er(e,t=4,n=1){const r=Ir(e,t,n),i=Ir(e+1,t,n);return($r(e)-r+i)/7}function Pr(e){return e>99?e:e>Jn.twoDigitCutoffYear?1900+e:2e3+e}function Dr(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 Mr(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 zr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Ot(`Invalid unit value ${e}`);return t}function Rr(e,t){const n={};for(const r in e)if(yr(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=zr(i)}return n}function Or(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}${br(n,2)}:${br(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${br(n,2)}${br(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function jr(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const Ar=["January","February","March","April","May","June","July","August","September","October","November","December"],Wr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Lr=["J","F","M","A","M","J","J","A","S","O","N","D"];function Br(e){switch(e){case"narrow":return[...Lr];case"short":return[...Wr];case"long":return[...Ar];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 Fr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],qr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Hr=["M","T","W","T","F","S","S"];function Ur(e){switch(e){case"narrow":return[...Hr];case"short":return[...qr];case"long":return[...Fr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Zr=["AM","PM"],Yr=["Before Christ","Anno Domini"],Gr=["BC","AD"],Jr=["B","A"];function Qr(e){switch(e){case"narrow":return[...Jr];case"short":return[...Gr];case"long":return[...Yr];default:return null}}function Vr(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const Kr={D:Bt,DD:Ft,DDD:Ht,DDDD:Ut,t:Zt,tt:Yt,ttt:Gt,tttt:Jt,T:Qt,TT:Vt,TTT:Kt,TTTT:Xt,f:en,ff:nn,fff:sn,ffff:cn,F:tn,FF:rn,FFF:an,FFFF:ln};class Xr{static create(e,t={}){return new Xr(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 Kr[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 br(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 Br(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return Ur(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),c=t=>{const n=Xr.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},l=t=>n?function(e,t){return Qr(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return Vr(Xr.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 Zr[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 l("short");case"GG":return l("long");case"GGGGG":return l("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 c(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=Xr.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 Vr(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 ei=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ti(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function ni(...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 ri(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 ii(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=xr(t[n+i]);return[r,null,n+i]}}const oi=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,si=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ai=RegExp(`${si.source}(?:${oi.source}?(?:\\[(${ei.source})\\])?)?`),ci=RegExp(`(?:[Tt]${ai.source})?`),li=ii("weekYear","weekNumber","weekDay"),ui=ii("year","ordinal"),di=RegExp(`${si.source} ?(?:${oi.source}|(${ei.source}))?`),hi=RegExp(`(?: ${di.source})?`);function mi(e,t,n){const r=e[t];return dr(r)?n:xr(r)}function fi(e,t){return[{hours:mi(e,t,0),minutes:mi(e,t+1,0),seconds:mi(e,t+2,0),milliseconds:Sr(e[t+3])},null,t+4]}function pi(e,t){const n=!e[t]&&!e[t+1],r=Mr(e[t+1],e[t+2]);return[{},n?null:Mn.instance(r),t+3]}function gi(e,t){return[{},e[t]?gn.create(e[t]):null,t+1]}const yi=RegExp(`^T?${si.source}$`),vi=/^-?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 wi(e){const[t,n,r,i,o,s,a,c,l]=e,u="-"===t[0],d=c&&"-"===c[0],h=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:h(kr(n)),months:h(kr(r)),weeks:h(kr(i)),days:h(kr(o)),hours:h(kr(s)),minutes:h(kr(a)),seconds:h(kr(c),"-0"===c),milliseconds:h(Sr(l),d)}]}const bi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function xi(e,t,n,r,i,o,s){const a={year:2===t.length?Pr(xr(t)):xr(t),month:Wr.indexOf(n)+1,day:xr(r),hour:xr(i),minute:xr(o)};return s&&(a.second=xr(s)),e&&(a.weekday=e.length>3?Fr.indexOf(e)+1:qr.indexOf(e)+1),a}const ki=/^(?:(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 Si(e){const[,t,n,r,i,o,s,a,c,l,u,d]=e,h=xi(t,i,r,n,o,s,a);let m;return m=c?bi[c]:l?0:Mr(u,d),[h,new Mn(m)]}const Ni=/^(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$/,_i=/^(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$/,$i=/^(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 Ci(e){const[,t,n,r,i,o,s,a]=e;return[xi(t,i,r,n,o,s,a),Mn.utcInstance]}function Ti(e){const[,t,n,r,i,o,s,a]=e;return[xi(t,a,n,r,i,o,s),Mn.utcInstance]}const Ii=ti(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ci),Ei=ti(/(\d{4})-?W(\d\d)(?:-?(\d))?/,ci),Pi=ti(/(\d{4})-?(\d{3})/,ci),Di=ti(ai),Mi=ni(function(e,t){return[{year:mi(e,t),month:mi(e,t+1,1),day:mi(e,t+2,1)},null,t+3]},fi,pi,gi),zi=ni(li,fi,pi,gi),Ri=ni(ui,fi,pi,gi),Oi=ni(fi,pi,gi),ji=ni(fi),Ai=ti(/(\d{4})-(\d\d)-(\d\d)/,hi),Wi=ti(di),Li=ni(fi,pi,gi),Bi="Invalid Duration",Fi={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}},qi={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},...Fi},Hi={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},...Fi},Ui=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Zi=Ui.slice(0).reverse();function Yi(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 Vi(r)}function Gi(e,t){let n=t.milliseconds??0;for(const r of Zi.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function Ji(e,t){const n=Gi(e,t)<0?-1:1;Ui.reduceRight((r,i)=>{if(dr(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),Ui.reduce((n,r)=>{if(dr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function Qi(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class Vi{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?Hi:qi;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Pn.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return Vi.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Ot("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new Vi({values:Rr(e,Vi.normalizeUnit),loc:Pn.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(hr(e))return Vi.fromMillis(e);if(Vi.isDuration(e))return e;if("object"==typeof e)return Vi.fromObject(e);throw new Ot(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return ri(e,[vi,wi])}(e);return n?Vi.fromObject(n,t):Vi.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return ri(e,[yi,ji])}(e);return n?Vi.fromObject(n,t):Vi.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Ot("need to specify a reason the Duration is invalid");const n=e instanceof Qn?e:new Qn(e,t);if(Jn.throwOnInvalid)throw new Mt(n);return new Vi({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 Rt(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?Xr.create(this.loc,n).formatDurationFromString(this,e):Bi}toHuman(e={}){if(!this.isValid)return Bi;const t=!1!==e.showZeros,n=Ui.map(n=>{const r=this.values[n];return dr(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+=Nr(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},Ho.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?Gi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Vi.fromDurationLike(e),n={};for(const e of Ui)(yr(t.values,e)||yr(this.values,e))&&(n[e]=t.get(e)+this.get(e));return Yi(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=Vi.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]=zr(e(this.values[n],n));return Yi(this,{values:t},!0)}get(e){return this[Vi.normalizeUnit(e)]}set(e){return this.isValid?Yi(this,{values:{...this.values,...Rr(e,Vi.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return Yi(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 Ji(this.matrix,e),Yi(this,{values:e},!0)}rescale(){return this.isValid?Yi(this,{values:Qi(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>Vi.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of Ui)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;hr(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else hr(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 Ji(this.matrix,t),Yi(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 Yi(this,{values:e},!0)}removeZeros(){return this.isValid?Yi(this,{values:Qi(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 Ui)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Ki="Invalid Interval";class Xi{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 Ot("need to specify a reason the Interval is invalid");const n=e instanceof Qn?e:new Qn(e,t);if(Jn.throwOnInvalid)throw new Dt(n);return new Xi({invalid:n})}static fromDateTimes(e,t){const n=Uo(e),r=Uo(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?Xi.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:Xi.invalid("missing or invalid end"):Xi.invalid("missing or invalid start")}(n,r);return null==i?new Xi({start:n,end:r}):i}static after(e,t){const n=Vi.fromDurationLike(t),r=Uo(e);return Xi.fromDateTimes(r,r.plus(n))}static before(e,t){const n=Vi.fromDurationLike(t),r=Uo(e);return Xi.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=Ho.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=Ho.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return Xi.fromDateTimes(e,o);if(i){const n=Vi.fromISO(r,t);if(n.isValid)return Xi.after(e,n)}else if(s){const e=Vi.fromISO(n,t);if(e.isValid)return Xi.before(o,e)}}return Xi.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?Xi.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Uo).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(Xi.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=Vi.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(Xi.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:Xi.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 Xi.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(Xi.fromDateTimes(t,e.time)),t=null);return Xi.merge(r)}difference(...e){return Xi.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Ki}[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=Bt,t={}){return this.isValid?Xr.create(this.s.loc.clone(t),e).formatInterval(this):Ki}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Ki}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Ki}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Ki}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Ki}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Vi.invalid(this.invalidReason)}mapEndpoints(e){return Xi.fromDateTimes(e(this.s),e(this.e))}}class eo{static hasDST(e=Jn.defaultZone){const t=Ho.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return gn.isValidZone(e)}static normalizeZone(e){return Rn(e,Jn.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Pn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Pn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Pn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Pn.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Pn.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Pn.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Pn.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Pn.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Pn.create(t,null,"gregory").eras(e)}static features(){return{relative:fr(),localeWeek:pr()}}}function to(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(Vi.fromMillis(r).as("days"))}function no(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(On.hanidec))t+=An.indexOf(e[n]);else for(const e in jn){const[n,i]=jn[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const ro=`[ ${String.fromCharCode(160)}]`,io=new RegExp(ro,"g");function oo(e){return e.replace(/\./g,"\\.?").replace(io,ro)}function so(e){return e.replace(/\./g,"").replace(io," ").toLowerCase()}function ao(e,t){return null===e?null:{regex:RegExp(e.map(oo).join("|")),deser:([n])=>e.findIndex(e=>so(n)===so(e))+t}}function co(e,t){return{regex:e,deser:([,e,t])=>Mr(e,t),groups:t}}function lo(e){return{regex:e,deser:([e])=>e}}const uo={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 ho=null;function mo(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=go(Xr.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class fo{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=mo(Xr.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=Ln(t),r=Ln(t,"{2}"),i=Ln(t,"{3}"),o=Ln(t,"{4}"),s=Ln(t,"{6}"),a=Ln(t,"{1,2}"),c=Ln(t,"{1,3}"),l=Ln(t,"{1,6}"),u=Ln(t,"{1,9}"),d=Ln(t,"{2,4}"),h=Ln(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 ao(t.eras("short"),0);case"GG":return ao(t.eras("long"),0);case"y":return no(l);case"yy":case"kk":return no(d,Pr);case"yyyy":case"kkkk":return no(o);case"yyyyy":return no(h);case"yyyyyy":return no(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return no(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return no(r);case"MMM":return ao(t.months("short",!0),1);case"MMMM":return ao(t.months("long",!0),1);case"LLL":return ao(t.months("short",!1),1);case"LLLL":return ao(t.months("long",!1),1);case"o":case"S":return no(c);case"ooo":case"SSS":return no(i);case"u":return lo(u);case"uu":return lo(a);case"uuu":case"E":case"c":return no(n);case"a":return ao(t.meridiems(),0);case"EEE":return ao(t.weekdays("short",!1),1);case"EEEE":return ao(t.weekdays("long",!1),1);case"ccc":return ao(t.weekdays("short",!0),1);case"cccc":return ao(t.weekdays("long",!0),1);case"Z":case"ZZ":return co(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return co(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return lo(/[a-z_+-/]{1,256}?/i);case" ":return lo(/[^\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(yr(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;dr(e.z)||(n=gn.create(e.z)),dr(e.Z)||(n||(n=new Mn(e.Z)),t=e.Z),dr(e.q)||(e.M=3*(e.q-1)+1),dr(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),dr(e.u)||(e.S=Sr(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(yr(n,"a")&&yr(n,"H"))throw new zt("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 po(e,t,n){return new fo(e,n).explainFromTokens(t)}function go(e,t){if(!e)return null;const n=Xr.create(t,e).dtFormatter((ho||(ho=Ho.fromMillis(1555555555555)),ho)),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=uo[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const yo="Invalid DateTime",vo=864e13;function wo(e){return new Qn("unsupported zone",`the zone "${e.name}" is not supported`)}function bo(e){return null===e.weekData&&(e.weekData=ir(e.c)),e.weekData}function xo(e){return null===e.localWeekData&&(e.localWeekData=ir(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function ko(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Ho({...n,...t,old:n})}function So(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 No(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 _o(e,t,n){return So(Tr(e),t,n)}function $o(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,Cr(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=Vi.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=Tr(o);let[c,l]=So(a,n,e.zone);return 0!==s&&(c+=s,l=e.zone.offset(c)),{ts:c,o:l}}function Co(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=Ho.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Ho.invalid(new Qn("unparsable",`the input "${i}" can't be parsed as ${r}`))}function To(e,t,n=!0){return e.isValid?Xr.create(Pn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Io(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=br(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=br(e.c.month),"month"===n)return i;i+="-"}else if(i+=br(e.c.month),"month"===n)return i;return i+=br(e.c.day),i}function Eo(e,t,n,r,i,o,s){let a=!n||0!==e.c.millisecond||0!==e.c.second,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=br(e.c.hour),"hour"===s)break;if(t){if(c+=":",c+=br(e.c.minute),"minute"===s)break;a&&(c+=":",c+=br(e.c.second))}else{if(c+=br(e.c.minute),"minute"===s)break;a&&(c+=br(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(c+=".",c+=br(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?c+="Z":e.o<0?(c+="-",c+=br(Math.trunc(-e.o/60)),c+=":",c+=br(Math.trunc(-e.o%60))):(c+="+",c+=br(Math.trunc(e.o/60)),c+=":",c+=br(Math.trunc(e.o%60)))),o&&(c+="["+e.zone.ianaName+"]"),c}const Po={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Do={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Mo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},zo=["year","month","day","hour","minute","second","millisecond"],Ro=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Oo=["year","ordinal","hour","minute","second","millisecond"];function jo(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 Rt(e);return t}function Ao(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return jo(e)}}function Wo(e,t){const n=Rn(t.zone,Jn.defaultZone);if(!n.isValid)return Ho.invalid(wo(n));const r=Pn.fromObject(t);let i,o;if(dr(e.year))i=Jn.now();else{for(const t of zo)dr(e[t])&&(e[t]=Po[t]);const t=lr(e)||ur(e);if(t)return Ho.invalid(t);const r=function(e){if(void 0===Fo&&(Fo=Jn.now()),"iana"!==e.type)return e.offset(Fo);const t=e.name;let n=qo.get(t);return void 0===n&&(n=e.offset(Fo),qo.set(t,n)),n}(n);[i,o]=_o(e,r,n)}return new Ho({ts:i,zone:n,loc:r,o:o})}function Lo(e,t,n){const r=!!dr(n.round)||n.round,i=dr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=Nr(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 Bo(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 Fo;const qo=new Map;class Ho{constructor(e){const t=e.zone||Jn.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Qn("invalid input"):null)||(t.isValid?null:wo(t));this.ts=dr(e.ts)?Jn.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=hr(e.o)&&!e.old?e.o:t.offset(this.ts);r=No(this.ts,o),n=Number.isNaN(r.year)?new Qn("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||Pn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Ho({})}static local(){const[e,t]=Bo(arguments),[n,r,i,o,s,a,c]=t;return Wo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},e)}static utc(){const[e,t]=Bo(arguments),[n,r,i,o,s,a,c]=t;return e.zone=Mn.utcInstance,Wo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},e)}static fromJSDate(e,t={}){const n=function(e){return"[object Date]"==={}.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(n))return Ho.invalid("invalid input");const r=Rn(t.zone,Jn.defaultZone);return r.isValid?new Ho({ts:n,zone:r,loc:Pn.fromObject(t)}):Ho.invalid(wo(r))}static fromMillis(e,t={}){if(hr(e))return e<-vo||e>vo?Ho.invalid("Timestamp out of range"):new Ho({ts:e,zone:Rn(t.zone,Jn.defaultZone),loc:Pn.fromObject(t)});throw new Ot(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(hr(e))return new Ho({ts:1e3*e,zone:Rn(t.zone,Jn.defaultZone),loc:Pn.fromObject(t)});throw new Ot("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Rn(t.zone,Jn.defaultZone);if(!n.isValid)return Ho.invalid(wo(n));const r=Pn.fromObject(t),i=Rr(e,Ao),{minDaysInFirstWeek:o,startOfWeek:s}=cr(i,r),a=Jn.now(),c=dr(t.specificOffset)?n.offset(a):t.specificOffset,l=!dr(i.ordinal),u=!dr(i.year),d=!dr(i.month)||!dr(i.day),h=u||d,m=i.weekYear||i.weekNumber;if((h||l)&&m)throw new zt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new zt("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!h;let p,g,y=No(a,c);f?(p=Ro,g=Do,y=ir(y,o,s)):l?(p=Oo,g=Mo,y=sr(y)):(p=zo,g=Po);let v=!1;for(const e of p)dr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=f?function(e,t=4,n=1){const r=mr(e.weekYear),i=wr(e.weekNumber,1,Er(e.weekYear,t,n)),o=wr(e.weekday,1,7);return r?i?!o&&Xn("weekday",e.weekday):Xn("week",e.weekNumber):Xn("weekYear",e.weekYear)}(i,o,s):l?function(e){const t=mr(e.year),n=wr(e.ordinal,1,$r(e.year));return t?!n&&Xn("ordinal",e.ordinal):Xn("year",e.year)}(i):lr(i),b=w||ur(i);if(b)return Ho.invalid(b);const x=f?or(i,o,s):l?ar(i):i,[k,S]=_o(x,c,n),N=new Ho({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&e.weekday!==N.weekday?Ho.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${N.toISO()}`):N.isValid?N:Ho.invalid(N.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return ri(e,[Ii,Mi],[Ei,zi],[Pi,Ri],[Di,Oi])}(e);return Co(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return ri(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[ki,Si])}(e);return Co(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return ri(e,[Ni,Ci],[_i,Ci],[$i,Ti])}(e);return Co(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(dr(e)||dr(t))throw new Ot("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Pn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,l]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=po(e,t,n);return[r,i,o,s]}(o,e,t);return l?Ho.invalid(l):Co(s,a,n,`format ${t}`,e,c)}static fromString(e,t,n={}){return Ho.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return ri(e,[Ai,Mi],[Wi,Li])}(e);return Co(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Ot("need to specify a reason the DateTime is invalid");const n=e instanceof Qn?e:new Qn(e,t);if(Jn.throwOnInvalid)throw new Pt(n);return new Ho({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=go(e,Pn.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return mo(Xr.parseFormat(e),Pn.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Fo=void 0,qo.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?bo(this).weekYear:NaN}get weekNumber(){return this.isValid?bo(this).weekNumber:NaN}get weekday(){return this.isValid?bo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?xo(this).weekday:NaN}get localWeekNumber(){return this.isValid?xo(this).weekNumber:NaN}get localWeekYear(){return this.isValid?xo(this).weekYear:NaN}get ordinal(){return this.isValid?sr(this.c).ordinal:NaN}get monthShort(){return this.isValid?eo.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?eo.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?eo.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?eo.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=Tr(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,c=n-s*t,l=No(a,o),u=No(c,s);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[ko(this,{ts:a}),ko(this,{ts:c})]:[this]}get isInLeapYear(){return _r(this.year)}get daysInMonth(){return Cr(this.year,this.month)}get daysInYear(){return this.isValid?$r(this.year):NaN}get weeksInWeekYear(){return this.isValid?Er(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Er(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=Xr.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(Mn.instance(e),t)}toLocal(){return this.setZone(Jn.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=Rn(e,Jn.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]=_o(n,t,e)}return ko(this,{ts:r,zone:e})}return Ho.invalid(wo(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return ko(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=Rr(e,Ao),{minDaysInFirstWeek:n,startOfWeek:r}=cr(t,this.loc),i=!dr(t.weekYear)||!dr(t.weekNumber)||!dr(t.weekday),o=!dr(t.ordinal),s=!dr(t.year),a=!dr(t.month)||!dr(t.day),c=s||a,l=t.weekYear||t.weekNumber;if((c||o)&&l)throw new zt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new zt("Can't mix ordinal dates with month/day");let u;i?u=or({...ir(this.c,n,r),...t},n,r):dr(t.ordinal)?(u={...this.toObject(),...t},dr(t.day)&&(u.day=Math.min(Cr(u.year,u.month),u.day))):u=ar({...sr(this.c),...t});const[d,h]=_o(u,this.o,this.zone);return ko(this,{ts:d,o:h})}plus(e){return this.isValid?ko(this,$o(this,Vi.fromDurationLike(e))):this}minus(e){return this.isValid?ko(this,$o(this,Vi.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=Vi.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?Xr.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):yo}toLocaleString(e=Bt,t={}){return this.isValid?Xr.create(this.loc.clone(t),e).formatDateTime(this):yo}toLocaleParts(e={}){return this.isValid?Xr.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=Io(this,s,o=jo(o));return zo.indexOf(o)>=3&&(a+="T"),a+=Eo(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Io(this,"extended"===e,jo(t)):null}toISOWeekDate(){return To(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=jo(s),(r&&zo.indexOf(s)>=3?"T":"")+Eo(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return To(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return To(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Io(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")),To(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():yo}[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 Vi.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(Vi.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=to(e,t);return(n-n%7)/7}],["days",to]],i={},o=e;let s,a;for(const[c,l]of r)n.indexOf(c)>=0&&(s=c,i[c]=l(e,t),a=o.plus(i),a>t?(i[c]--,(e=o.plus(i))>t&&(a=e,i[c]--,e=o.plus(i))):e=a);return[e,i,a,s]}(e,t,n);const c=t-i,l=n.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===l.length&&(s<t&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));const u=Vi.fromObject(o,r);return l.length>0?Vi.fromMillis(c,r).shiftTo(...l).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(Ho.now(),e,t)}until(e){return this.isValid?Xi.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||Ho.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),Lo(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Lo(e.base||Ho.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(Ho.isDateTime))throw new Ot("min requires all arguments be DateTimes");return gr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(Ho.isDateTime))throw new Ot("max requires all arguments be DateTimes");return gr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return po(Pn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return Ho.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=Pn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new fo(i,e)}static fromFormatParser(e,t,n={}){if(dr(e)||dr(t))throw new Ot("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Pn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new Ot(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:s,zone:a,specificOffset:c,invalidReason:l}=t.explainFromTokens(e);return l?Ho.invalid(l):Co(s,a,n,`format ${t.format}`,e,c)}static get DATE_SHORT(){return Bt}static get DATE_MED(){return Ft}static get DATE_MED_WITH_WEEKDAY(){return qt}static get DATE_FULL(){return Ht}static get DATE_HUGE(){return Ut}static get TIME_SIMPLE(){return Zt}static get TIME_WITH_SECONDS(){return Yt}static get TIME_WITH_SHORT_OFFSET(){return Gt}static get TIME_WITH_LONG_OFFSET(){return Jt}static get TIME_24_SIMPLE(){return Qt}static get TIME_24_WITH_SECONDS(){return Vt}static get TIME_24_WITH_SHORT_OFFSET(){return Kt}static get TIME_24_WITH_LONG_OFFSET(){return Xt}static get DATETIME_SHORT(){return en}static get DATETIME_SHORT_WITH_SECONDS(){return tn}static get DATETIME_MED(){return nn}static get DATETIME_MED_WITH_SECONDS(){return rn}static get DATETIME_MED_WITH_WEEKDAY(){return on}static get DATETIME_FULL(){return sn}static get DATETIME_FULL_WITH_SECONDS(){return an}static get DATETIME_HUGE(){return cn}static get DATETIME_HUGE_WITH_SECONDS(){return ln}}function Uo(e){if(Ho.isDateTime(e))return e;if(e&&e.valueOf&&hr(e.valueOf()))return Ho.fromJSDate(e);if(e&&"object"==typeof e)return Ho.fromObject(e);throw new Ot(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function Zo({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return Oe("div",{className:yt.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:ht.colors.accent}),children:Oe("div",{className:yt.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Oe("div",{className:yt.create("page-heading-wrapper",{width:"100%",marginBottom:ht.spacing.lg}),children:Oe(_t,{children:Oe("div",{className:yt.create("page-heading-container",{backgroundColor:ht.colors.primary,color:ht.colors.primaryForeground,borderRadius:ht.radius.large,padding:`${ht.spacing.lg} ${ht.spacing.xl}`,boxShadow:ht.shadow.md}),children:Oe("div",{className:yt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:ht.spacing.lg}),children:Oe("div",{className:yt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Oe("h1",{className:yt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:ht.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&Oe("p",{className:yt.create("page-template-description",{margin:"0",marginTop:ht.spacing.sm,fontSize:ht.fontSize.small,lineHeight:"1.5",color:ht.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function Yo({className:e,children:t}){const n=yt.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Oe("div",{className:St(n,e),children:t})}function Go({message:e}){return Oe(Zo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe(Yo,{className:yt.name("loading-container"),children:Oe(Nt,{size:"large"})})})})}function Jo({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:ht.colors.primary,color:ht.colors.primaryForeground,boxShadow:ht.shadow.sm},outline:{border:`${ht.borderWidth} solid ${ht.colors.primary}`,backgroundColor:ht.colors.card,color:ht.colors.primary,boxShadow:ht.shadow.sm}},l=yt.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:ht.radius.default,cursor:"pointer",fontSize:ht.fontSize.default,fontWeight:"500",transition:ht.transition,fontFamily:ht.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});yt.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),yt.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:ht.shadow.md}),yt.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:ht.shadow.sm});const u=yt.create(`button-${e}`,{...c[e]});return Oe("button",{type:t,className:St(l,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Oe(Nt,{size:"small"}),o]})}function Qo({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 Oe(Zo,{title:t.title,noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe("div",{className:yt.create("error-page-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Oe("div",{className:yt.create("error-page-card",{backgroundColor:ht.colors.card,boxShadow:ht.shadow.sm,borderRadius:ht.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"500px"}),children:[Oe("div",{className:yt.create("error-page-header",{paddingInline:ht.spacing.xl,paddingTop:ht.spacing.xl,paddingBottom:ht.spacing.lg,textAlign:"center"},{"(max-width: 768px)":{paddingInline:ht.spacing.lg,paddingTop:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingTop:ht.spacing.md}}),children:[Oe("div",{className:yt.create("error-page-icon-wrapper",{display:"flex",justifyContent:"center",marginBottom:ht.spacing.lg}),children:Oe("div",{className:yt.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:Oe("svg",{className:yt.create("error-page-icon",{width:"2rem",height:"2rem",color:ht.colors.destructive}),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Oe("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"})})})}),Oe("h2",{className:yt.create("error-page-title",{margin:"0",marginBottom:ht.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:ht.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:t.title}),Oe("p",{className:yt.create("error-page-description",{margin:"0",marginTop:ht.spacing.sm,fontSize:ht.fontSize.default,lineHeight:"1.6",color:ht.colors.mutedForeground}),children:t.message})]}),Oe("div",{className:yt.create("error-page-content",{paddingInline:ht.spacing.xl,paddingBottom:ht.spacing.xl},{"(max-width: 768px)":{paddingInline:ht.spacing.lg,paddingBottom:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingBottom:ht.spacing.md}}),children:[n&&Oe("p",{className:yt.create("error-page-support",{margin:"0",marginBottom:ht.spacing.lg,fontSize:ht.fontSize.small,lineHeight:"1.5",color:ht.colors.mutedForeground,textAlign:"center"}),children:["If this problem persists, please contact support with reference"," ",Oe("span",{className:yt.create("error-page-ref",{fontFamily:"monospace",fontWeight:"600",color:ht.colors.foreground}),children:n})]}),Oe(Jo,{onClick:()=>{window.location.reload()},className:yt.create("error-page-button",{width:"100%"}),children:"Try Again"})]})]})})})})}function Vo({message:e,estimatedTime:t}){const n=yt.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=yt.create("maintenance-icon",{width:"4rem",height:"4rem",color:ht.colors.primary,marginBottom:"1.5rem"}),i=yt.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:ht.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=yt.create("maintenance-message",{fontSize:ht.fontSize.default,color:ht.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=yt.create("maintenance-info-box",{backgroundColor:ht.colors.muted,borderRadius:ht.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=yt.create("maintenance-info-title",{fontSize:ht.fontSize.default,fontWeight:"600",color:ht.colors.foreground,marginBottom:"0.5rem"}),c=yt.create("maintenance-info-text",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,lineHeight:"1.4"}),l=yt.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Oe(Zo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Oe(_t,{children:Oe(Yo,{children:Oe("div",{className:n,children:[Oe(()=>Oe("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:Oe("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"})}),{}),Oe("h1",{className:i,children:"We'll be right back"}),Oe("p",{className:o,children:e||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Oe("div",{className:s,children:[Oe("p",{className:a,children:"What's happening?"}),Oe("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),t&&Oe("p",{className:c,style:{marginTop:"0.5rem"},children:[Oe("strong",{children:"Estimated time:"})," ",t]})]}),Oe("div",{className:l,children:Oe(Jo,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function Ko({size:e="default",style:t="normal",className:n,children:r}){const i=yt.create("text",{marginTop:"0",marginBottom:"0"}),o=yt.create("text-small",{fontSize:ht.fontSize.small}),s=yt.create("text-default",{fontSize:ht.fontSize.default}),a=yt.create("text-italic",{fontStyle:"italic"}),c=yt.create("text-bold",{fontWeight:"bold"}),l=yt.create("text-underline",{textDecoration:"underline"}),u=St({[a]:"italic"===t,[c]:"bold"===t,[l]:"underline"===t}),d=St({[o]:"small"===e,[s]:"default"===e});return Oe("p",{className:St(i,d,u,n),children:r})}function Xo({title:e,description:t}){return Oe("div",{className:yt.create("section-header",{}),children:[Oe("p",{className:yt.create("section-title",{fontSize:ht.fontSize.large,margin:"0",color:ht.colors.foreground}),children:e}),t&&Oe(Ko,{className:yt.create("section-description",{color:ht.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 es({selected:e}){return Oe("div",{className:St(yt.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${ht.borderWidth} solid transparent`}),e?yt.create("selected-indicator-selected",{backgroundColor:ht.colors.primary}):yt.create("selected-indicator-unselected",{border:`${ht.borderWidth} solid ${ht.colors.border}`}))})}function ts({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 Oe("div",{className:yt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Oe(Xo,{title:"Excess Options"}),Oe("div",{className:yt.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Oe("div",{className:St(yt.create("excess-option-card",{borderRadius:ht.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?yt.create("excess-option-card-selected",{border:`2px solid ${ht.colors.primary}`,backgroundColor:ht.colors.accent}):yt.create("excess-option-card-unselected",{border:`2px solid ${ht.colors.border}`,backgroundColor:ht.colors.card})),onClick:()=>n(e.id),children:[Oe(es,{selected:r}),Oe("div",{className:yt.create("excess-amount",{color:ht.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})}),(null==i?void 0:i.description)&&Oe("div",{className:yt.create("excess-description",{padding:"0.75rem",backgroundColor:ht.colors.muted,borderRadius:ht.radius.default,border:`1px solid ${ht.colors.border}`}),children:Oe(Ko,{className:yt.create("excess-description-text",{fontSize:ht.fontSize.small,color:ht.colors.foreground,margin:"0"}),children:i.description})})]})}function ns(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function rs(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 is({paymentOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=et(()=>{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?Oe(os,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Oe("div",{className:yt.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Oe(os,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function os({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return Oe("div",{className:yt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Oe(Xo,{title:"Payment Options"}),Oe("div",r?{className:yt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Oe(ss,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${e.excess_id}`))}:{className:yt.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${ht.colors.border}`,borderRadius:ht.radius.default,backgroundColor:ht.colors.muted}),children:Oe(Ko,{className:yt.create("placeholder-text",{color:ht.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function ss({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?ns(e.amount.dueToday):`${ns(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`:"Currently Unavailable",s=()=>"bank_transfer"===e.gateway.code?"Manual":`via ${e.gateway.name}`;return Oe("div",{className:St(yt.create("payment-option-row",{borderRadius:ht.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: 480px)":{padding:"0.625rem 0.75rem",gap:"0.25rem",flexWrap:"wrap",alignItems:"flex-start"}}),r?yt.create("payment-option-row-selected",{border:`2px solid ${ht.colors.primary}`,backgroundColor:ht.colors.accent}):yt.create("payment-option-row-unselected",{border:`2px solid ${ht.colors.border}`,backgroundColor:ht.colors.card})),onClick:()=>i&&n(e),children:[Oe("div",{className:yt.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Oe(es,{selected:r}),Oe("div",{className:yt.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Oe("div",{className:yt.create("frequency-title",{fontSize:ht.fontSize.default,fontWeight:"500",color:ht.colors.foreground}),children:rs(e.amount.frequency,e.gateway.code)}),Oe("div",{className:yt.create("gateway-description",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground}),children:s()})]})]}),Oe("div",{className:yt.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Oe(Ko,{className:yt.create("amount-text",{textAlign:"right",color:i?ht.colors.foreground:ht.colors.mutedForeground,fontStyle:i?"normal":"italic"}),children:o()}),i&&"bank_transfer"!==e.gateway.code&&Oe(Ko,{size:"small",className:yt.create("gateway-fee-text",{textAlign:"right",color:ht.colors.mutedForeground}),children:[ns(e.amount.gatewayFee)," fee"]}),i&&"bank_transfer"===e.gateway.code&&Oe(Ko,{size:"small",className:yt.create("no-fee-text",{textAlign:"right",color:ht.colors.mutedForeground}),children:"No fees"})]}),Oe("div",{className:yt.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Oe(es,{selected:r}),Oe("div",{className:yt.create("payment-option-title-mobile",{fontSize:ht.fontSize.default,fontWeight:"500",color:ht.colors.foreground}),children:rs(e.amount.frequency,e.gateway.code)})]}),Oe("div",{className:yt.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:[Oe("div",{className:yt.create("gateway-description-mobile",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground}),children:s()}),Oe(Ko,{className:yt.create("amount-text-mobile",{fontWeight:"500",color:i?ht.colors.foreground:ht.colors.mutedForeground,fontStyle:i?"normal":"italic"}),children:o()})]})]})}const as=e=>{try{return new Date(e).toLocaleDateString("en-NZ",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}};function cs({excessOptions:e,selectedExcessId:t,onEditQuote:n,isEditingQuote:r=!1,productName:i,quoteIntent:o}){const s=et(()=>t?e.find(e=>e.id===t):null,[e,t]),a=null==s?void 0:s.line_item_display,c=et(()=>{var e;if(!(null===(e=null==o?void 0:o.form_data)||void 0===e?void 0:e.page_data))return null;const t=o.form_data.page_data;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},[o]);return Oe("div",{className:yt.create("cart-summary-container",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.lg,boxShadow:ht.shadow.sm},{"(max-width: 768px)":{padding:ht.spacing.md}}),children:[Oe("h3",{className:yt.create("cart-summary-title",{fontSize:ht.fontSize.large,fontWeight:"600",marginBottom:ht.spacing.md,color:ht.colors.foreground}),children:"Insurance Details"}),c&&Oe(S,{children:[Oe("div",{className:yt.create("cart-client-details",{display:"flex",flexDirection:"column",gap:ht.spacing.sm,marginBottom:ht.spacing.md}),children:[c.firstName&&c.lastName&&Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Name"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:[c.firstName," ",c.lastName]})]}),c.email&&Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Email"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:c.email})]}),c.phone&&Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Phone"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:c.phone})]}),c.dob&&Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Date of Birth"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:as(c.dob)})]})]}),Oe("hr",{className:yt.create("divider",{border:"none",borderTop:`1px solid ${ht.colors.border}`,margin:`${ht.spacing.md} 0`})})]}),Oe("div",{className:yt.create("cart-product-section",{display:"flex",flexDirection:"column",gap:ht.spacing.sm,marginBottom:ht.spacing.lg}),children:a&&Oe("div",{className:yt.create("cart-item",{display:"flex",flexDirection:"column",gap:ht.spacing.sm}),children:[Oe("div",{className:yt.create("cart-item-description",{fontSize:ht.fontSize.small,fontWeight:"500",color:ht.colors.foreground}),children:a.description}),a.show_sum_insured&&a.sum_insured&&Oe("div",{className:yt.create("cart-item-sum-insured",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground}),children:["Sum Insured: ",ns(a.sum_insured)]})]})}),Oe(Jo,{onClick:n,disabled:r,variant:"outline",className:yt.create("edit-quote-button",{width:"100%"}),children:r?"Clearing quote...":"Edit details"})]})}function ls({label:e,value:t,isTotal:n=!1,className:r}){return Oe("div",{className:St(yt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Oe("span",{className:yt.create("summary-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:e}),Oe("span",{className:yt.create("summary-value",{fontWeight:n?"600":"500",color:ht.colors.foreground,fontSize:n?ht.fontSize.large:"inherit"}),children:t})]})}function us({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:c=!1}){return et(()=>n?e.find(e=>e.id===n):null,[e,n]),et(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]),Oe("div",{className:yt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Oe("h3",{className:yt.create("cart-summary-title",{fontSize:ht.fontSize.large,fontWeight:"600",marginBottom:ht.spacing.sm,color:ht.colors.foreground}),children:"Payment Details"}),r&&Oe("div",{className:yt.create("summary-section",{paddingBottom:"1rem"}),children:Oe("div",{className:yt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Oe(S,{children:[Oe(ls,{label:"Total Due Today:",value:ns(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Oe(ls,{label:"Gateway Fee:",value:ns(r.amount.gatewayFee)})]}):Oe(S,{children:[Oe(ls,{label:"Due Today:",value:ns(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Oe(ls,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:ns(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Oe(ls,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Oe(S,{children:Oe(ls,{label:"Total Payable:",value:ns(r.amount.totalRepayable),className:yt.create("total-item",{})})})]})})}),c&&Oe("div",{className:yt.create("continue-later-success",{backgroundColor:`${ht.colors.accent}`,padding:"12px 16px",borderRadius:ht.radius.default,borderLeft:`4px solid ${ht.colors.primary}`}),children:[Oe("h4",{className:yt.create("success-title",{margin:"0 0 4px 0",color:ht.colors.primary,fontSize:ht.fontSize.default,fontWeight:"600"}),children:"No problem!"}),Oe("p",{className:yt.create("success-text",{margin:"0",fontSize:ht.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&&Oe(Jo,{onClick:s,disabled:a,variant:"outline",className:yt.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:ht.fontSize.default,fontWeight:"500"}),children:a?"Sending...":"Continue Later (Email Me)"}),Oe(Jo,{onClick:i,disabled:!o,className:yt.create("purchase-button",{width:"100%",height:"3rem",fontSize:ht.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function ds({details:e,onClose:t}){const n=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{})};return Oe("div",{className:yt.create("bank-transfer-container",{display:"flex",flexDirection:"column",gap:ht.spacing.lg}),children:[Oe("div",{className:yt.create("success-message",{backgroundColor:ht.colors.accent,border:`2px solid ${ht.colors.primary}`,borderRadius:ht.radius.default,padding:ht.spacing.lg,textAlign:"center"}),children:[Oe("div",{className:yt.create("success-icon",{fontSize:"3rem",marginBottom:ht.spacing.sm}),children:"✓"}),Oe("h3",{className:yt.create("success-title",{margin:"0",marginBottom:ht.spacing.sm,color:ht.colors.primary,fontSize:ht.fontSize.large,fontWeight:"600"}),children:"Quote Reserved"}),Oe(Ko,{className:yt.create("success-description",{margin:"0",color:ht.colors.foreground,opacity:"0.9"}),children:"Your quote has been reserved. Please complete the bank transfer to finalize your coverage."})]}),Oe("div",{className:yt.create("transfer-instructions",{backgroundColor:ht.colors.card,border:`1px solid ${ht.colors.border}`,borderRadius:ht.radius.default,padding:ht.spacing.lg}),children:[Oe("h4",{className:yt.create("instructions-title",{margin:"0",marginBottom:ht.spacing.md,fontSize:ht.fontSize.default,fontWeight:"600",color:ht.colors.foreground}),children:"Bank Transfer Instructions"}),Oe("div",{className:yt.create("instructions-grid",{display:"grid",gap:ht.spacing.md}),children:[Oe("div",{className:yt.create("detail-row-highlighted",{backgroundColor:ht.colors.accent,border:`2px solid ${ht.colors.primary}`,borderRadius:ht.radius.default,padding:ht.spacing.md}),children:[Oe("div",{className:yt.create("detail-label",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,marginBottom:"0.25rem",fontWeight:"500"}),children:"Reference Number (IMPORTANT)"}),Oe("div",{className:yt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Oe("code",{className:yt.create("detail-value-code",{fontFamily:"monospace",fontSize:ht.fontSize.large,fontWeight:"700",color:ht.colors.primary,letterSpacing:"0.05em"}),children:e.reference}),Oe("button",{onClick:()=>n(e.reference,"Reference"),className:yt.create("copy-button",{background:"transparent",border:`1px solid ${ht.colors.primary}`,borderRadius:ht.radius.small,padding:"0.25rem 0.5rem",cursor:"pointer",fontSize:ht.fontSize.small,color:ht.colors.primary,transition:"all 150ms ease"}),children:"Copy"})]}),Oe(Ko,{size:"small",className:yt.create("reference-note",{marginTop:"0.5rem",marginBottom:"0",color:ht.colors.foreground,fontWeight:"500"}),children:"⚠️ Please include this reference in your transfer particulars"})]}),Oe("div",{className:yt.create("detail-row",{}),children:[Oe("div",{className:yt.create("detail-label",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Amount"}),Oe("div",{className:yt.create("detail-value",{fontSize:ht.fontSize.large,fontWeight:"600",color:ht.colors.foreground}),children:["$",e.amount.toFixed(2)," ",e.currency]})]}),Oe("div",{className:yt.create("detail-row",{}),children:[Oe("div",{className:yt.create("detail-label",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Name"}),Oe("div",{className:yt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Oe("span",{className:yt.create("detail-value",{fontFamily:"monospace",fontSize:ht.fontSize.default,color:ht.colors.foreground}),children:e.bank_account_name}),Oe("button",{onClick:()=>n(e.bank_account_name,"Account name"),className:yt.create("copy-button-small",{background:"transparent",border:`1px solid ${ht.colors.border}`,borderRadius:ht.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]}),Oe("div",{className:yt.create("detail-row",{}),children:[Oe("div",{className:yt.create("detail-label",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Number"}),Oe("div",{className:yt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Oe("span",{className:yt.create("detail-value",{fontFamily:"monospace",fontSize:ht.fontSize.default,color:ht.colors.foreground}),children:e.bank_account_number}),Oe("button",{onClick:()=>n(e.bank_account_number,"Account number"),className:yt.create("copy-button-small",{background:"transparent",border:`1px solid ${ht.colors.border}`,borderRadius:ht.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]})]}),e.instructions_html&&Oe("div",{className:yt.create("additional-instructions",{marginTop:ht.spacing.md,paddingTop:ht.spacing.md,borderTop:`1px solid ${ht.colors.border}`}),children:Oe("div",{className:yt.create("instructions-content",{fontSize:ht.fontSize.small,color:ht.colors.foreground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:e.instructions_html}})})]}),Oe("div",{className:yt.create("important-note",{backgroundColor:ht.colors.muted,border:`1px solid ${ht.colors.border}`,borderRadius:ht.radius.default,padding:ht.spacing.md}),children:Oe(Ko,{size:"small",className:yt.create("note-text",{margin:"0",color:ht.colors.foreground,lineHeight:"1.5"}),children:[Oe("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."]})}),Oe("div",{className:yt.create("actions",{display:"flex",justifyContent:"center"}),children:Oe(Jo,{onClick:t,variant:"primary",children:"I've Made the Transfer"})})]})}function hs({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r}){const{fsm:i}=It(()=>({})),[o,s]=Ve("initiating"),[a,c]=Ve(null),[l,u]=Ve(null),[d,h]=Ve(null),[m,f]=Ve(null);Ke(()=>{e&&r&&p()},[e,r]);const p=async()=>{if(r)try{s("initiating"),c(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){c(e.message||"Failed to initiate payment"),s("failed")}},g=()=>{l&&!l.closed&&l.close(),s("initiating"),c(null),h(null),u(null),f(null),t()},y=()=>{g(),n()};return e?Oe("div","bank_transfer"===o&&m?{className:yt.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:Oe("div",{className:yt.create("modal-content",{backgroundColor:ht.colors.background,borderRadius:ht.radius.large,padding:"2rem",maxWidth:"600px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ht.colors.border}`,margin:"auto"}),onClick:e=>e.stopPropagation(),children:Oe(ds,{details:m,onClose:y})})}:{className:yt.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:[Oe("div",{className:yt.create("modal-content",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ht.colors.border}`}),children:[Oe("div",{className:yt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Oe("div",{className:yt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Oe("h2",{className:yt.create("modal-title",{margin:"0",color:ht.colors.foreground,fontSize:ht.fontSize.large}),children:"Payment Processing"})]}),Oe("div",{className:yt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Oe(Ko,{className:yt.create("status-message",{fontSize:ht.fontSize.default,color:ht.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&&Oe(Ko,{className:yt.create("error-message",{color:ht.colors.destructive,fontSize:ht.fontSize.small,padding:"0.75rem",backgroundColor:ht.colors.destructive+"10",borderRadius:ht.radius.default,border:`1px solid ${ht.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Oe("div",{className:yt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${ht.colors.border}`,borderTop:`3px solid ${ht.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Oe("div",{className:yt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Oe(S,{children:[Oe(Jo,{onClick:g,variant:"outline",children:"Close"}),"cancelled"===o&&Oe(Jo,{onClick:()=>{s("initiating"),c(null),p()},children:"Try Again"})]}):Oe(Jo,"completed"===o?{onClick:g,children:"Continue"}:{onClick:g,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Oe("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function ms({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:Oe("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:ht.colors.primary||"#10b981"},children:Oe("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:Oe("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:ht.colors.destructive},children:[Oe("circle",{cx:"12",cy:"12",r:"10"}),Oe("path",{d:"m15 9-6 6"}),Oe("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:Oe("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:ht.colors.secondary},children:[Oe("circle",{cx:"12",cy:"12",r:"10"}),Oe("path",{d:"m15 9-6 6"}),Oe("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:Oe("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:ht.colors.destructive},children:[Oe("circle",{cx:"12",cy:"12",r:"10"}),Oe("path",{d:"M12 8v4"}),Oe("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=yt.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=yt.create("modal-content",{backgroundColor:ht.colors.background,borderRadius:ht.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${ht.borderWidth} solid ${ht.colors.border}`}),a=yt.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=yt.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:ht.colors.foreground,margin:"0"}),l=yt.create("modal-message",{color:ht.colors.foreground,lineHeight:"1.5",margin:"0"});yt.create("transaction-info",{backgroundColor:ht.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:ht.radius.small,border:`${ht.borderWidth} solid ${ht.colors.border}`,fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,wordBreak:"break-all"});const u=yt.create("modal-button",{backgroundColor:ht.colors.primary,color:ht.colors.primaryForeground,border:"none",borderRadius:ht.radius.default,padding:"0.75rem 1.5rem",fontSize:ht.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=yt.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Oe("div",{className:o,onClick:r,children:Oe("div",{className:s,onClick:e=>e.stopPropagation(),children:Oe("div",{className:a,children:[i.icon,Oe("div",{className:d,children:[Oe("h2",{className:c,children:i.title}),Oe("p",{className:l,children:i.message})]}),Oe("button",{className:u,onClick:r,children:i.buttonText})]})})})}function fs({results:e}){const{fsm:t,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=It(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[s,a]=Ve(!1),[c,l]=Ve(null),[u,d]=Ve(!1),[h,m]=Ve(!1),[f,p]=Ve(!1),g=new URLSearchParams(window.location.search),y=g.get("status"),v=g.get("transactionId")||g.get("transaction_id"),[w,b]=Ve(!(!y||"failed"!==y&&"declined"!==y&&"cancelled"!==y)),x=e.calculations,k=e.payment_options,S=e.payment_gateways;Ke(()=>{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);Ce(i,e,k.length,n,o)}},[]),Ke(()=>{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 N=Boolean(n&&r),_=null==i?void 0:i.payment_return,$=_&&("declined"===_.paymentStatus||"cancelled"===_.paymentStatus||"error"===_.paymentStatus)||w,C=(null==_?void 0:_.paymentStatus)||("failed"===y?"declined":"cancelled"===y?"cancelled":"error"),T=(null==_?void 0:_.paymentTransactionId)||v||void 0;return Oe(Zo,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Oe(_t,{children:[Oe("div",{className:yt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:ht.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:ht.spacing.md}}),children:[Oe("div",{className:yt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:ht.colors.card,boxShadow:ht.shadow.sm,borderRadius:ht.radius.large,display:"flex",flexDirection:"column"}),children:[Oe("div",{className:yt.create("checkout-header",{paddingInline:ht.spacing.xl,paddingTop:ht.spacing.xl,paddingBottom:ht.spacing.lg},{"(max-width: 768px)":{paddingInline:ht.spacing.lg,paddingTop:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingTop:ht.spacing.md}}),children:[Oe("h2",{className:yt.create("checkout-title",{margin:"0",marginBottom:ht.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:ht.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Oe("p",{className:yt.create("checkout-description",{margin:"0",fontSize:ht.fontSize.default,lineHeight:"1.6",color:ht.colors.foreground,opacity:"0.9"}),children:"Choose your excess amount and payment option to secure your coverage."}),Oe("hr",{className:yt.create("checkout-header-border",{marginTop:ht.spacing.lg,borderColor:ht.colors.border})})]}),Oe("div",{className:yt.create("checkout-sections",{paddingInline:ht.spacing.xl,paddingBottom:ht.spacing.xl,display:"flex",flexDirection:"column",gap:ht.spacing.lg},{"(max-width: 768px)":{paddingInline:ht.spacing.lg,paddingBottom:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingBottom:ht.spacing.md}}),children:[Oe(ts,{excessOptions:x,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)}),Oe(is,{paymentOptions:k,paymentGateways:S,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)})]})]}),Oe("div",{className:yt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Oe("div",{className:yt.create("checkout-sidebar-sticky",{position:"sticky",top:ht.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:[Oe(cs,{excessOptions:x,selectedExcessId:n,onEditQuote:async()=>{try{p(!0),await t.clearCalculationResults(),t.navigateToPage(0)}catch(e){alert("Failed to edit quote. Please try again."),p(!1)}},isEditingQuote:f,productName:e.product_name,quoteIntent:i}),Oe("div",{className:yt.create("checkout-sidebar-spacer",{height:ht.spacing.lg},{"(max-width: 950px)":{height:ht.spacing.md}})}),Oe("div",{className:yt.create("checkout-sidebar-card",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,boxShadow:ht.shadow.sm,padding:ht.spacing.lg},{"(max-width: 768px)":{padding:ht.spacing.md}}),children:Oe(us,{excessOptions:x,paymentGateways:S,selectedExcessId:n,selectedPaymentOption:r,onPurchase:()=>{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"}};l(t),a(!0)},canPurchase:N,onContinueLater: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)}},continueLaterLoading:h,showContinueLaterSuccess:u})})]})})]}),$&&Oe(ms,{type:C,transactionId:T,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())}}),Oe(hs,{isOpen:s,onClose:()=>{a(!1),l(null)},onSuccess:()=>{a(!1),l(null),alert("Payment completed successfully!")},onError:e=>{alert("Payment failed: "+e)},paymentRequest:c})]})})}function ps({results:e}){var t,n,r;const{quoteIntent:i}=It(e=>({quoteIntent:null==e?void 0:e.getQuoteIntent()})),o=null===(t=null==i?void 0:i.organisation)||void 0===t?void 0:t.admin_email,s=null===(n=null==i?void 0:i.organisation)||void 0===n?void 0:n.phone,a=o||s,c=yt.create("referral-card",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.xl,boxShadow:ht.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:ht.spacing.lg},"(max-width: 480px)":{padding:ht.spacing.md}}),l=yt.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:ht.spacing.lg}),u=yt.create("referral-icon",{width:"4rem",height:"4rem",color:ht.colors.primary}),d=yt.create("referral-header",{textAlign:"center",marginBottom:ht.spacing.xl}),h=yt.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:ht.colors.primary,marginBottom:ht.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),m=yt.create("referral-subtitle",{fontSize:ht.fontSize.default,color:ht.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),f=yt.create("referral-process-box",{backgroundColor:ht.colors.accent,borderRadius:ht.radius.default,padding:ht.spacing.lg,marginBottom:ht.spacing.xl}),p=yt.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:ht.colors.accentForeground,marginBottom:ht.spacing.md,marginTop:"0"}),g=yt.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:ht.spacing.sm}),y=yt.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:ht.fontSize.small,color:ht.colors.accentForeground,lineHeight:"1.6"}),v=yt.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:ht.colors.primary,color:ht.colors.primaryForeground,borderRadius:"50%",marginRight:ht.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),w=yt.create("referral-contact-section",{borderTop:`1px solid ${ht.colors.border}`,paddingTop:ht.spacing.xl,marginTop:ht.spacing.xl,textAlign:"center"}),b=yt.create("referral-contact-text",{fontSize:ht.fontSize.default,color:ht.colors.foreground,marginBottom:ht.spacing.lg}),x=yt.create("referral-actions",{display:"flex",gap:ht.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:ht.spacing.lg}),k=yt.create("referral-reference",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,marginTop:ht.spacing.md});return Oe(Zo,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Oe(_t,{children:Oe(Yo,{children:Oe("div",{className:c,children:[Oe("div",{className:l,children:Oe(()=>Oe("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:u,children:[Oe("path",{d:"M7 10v12"}),Oe("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"})]}),{})}),Oe("div",{className:d,children:[Oe("h1",{className:h,children:"Thanks for your quote request!"}),Oe("p",{className:m,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Oe("div",{className:f,children:[Oe("h3",{className:p,children:"What happens next?"}),Oe("ul",{className:g,children:[Oe("li",{className:y,children:[Oe("span",{className:v,children:"1"}),Oe("span",{children:"Our team will review your application within 1-2 business days"})]}),Oe("li",{className:y,children:[Oe("span",{className:v,children:"2"}),Oe("span",{children:"We'll contact you with either approval or additional requirements"})]}),Oe("li",{className:y,children:[Oe("span",{className:v,children:"3"}),Oe("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),a&&Oe("div",{className:w,children:[Oe("p",{className:b,children:"Need to speak with someone about your quote?"}),Oe("div",{className:x,children:[s&&Oe(Jo,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:[Oe("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:Oe("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"]}),o&&Oe(Jo,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:[Oe("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:[Oe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Oe("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)&&Oe("div",{className:k,children:["Quote Reference: ",Oe("strong",{children:e.quote_intent.reference})]})]})]})})})})}function gs({results:e}){return"referral"===e.outcome_type?Oe(ps,{results:e}):Oe(fs,{results:e})}function ys({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:l="$"}){const u=Xe(null),[d,h]=Ve("");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}Ke(()=>{h(null!=e&&""!==e?m(e):"")},[e]);const f=yt.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=yt.create("money-input-prefix",{position:"absolute",left:"1rem",color:ht.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=yt.create("money-input-with-prefix",{paddingLeft:l?"2rem":"1rem"});return Oe("div",{className:f,children:[l&&Oe("span",{className:p,children:l}),Oe("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:St(a,l&&g)})]})}function vs(e){var t,n,r,i;const o=yt.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${ht.borderWidth} solid ${e.hasError?ht.colors.destructive:ht.colors.input}`,borderRadius:ht.radius.default,fontSize:ht.fontSize.default,backgroundColor:ht.colors.card,color:ht.colors.foreground,transition:ht.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${ht.colors.destructive} 20%, transparent)`:"none"}),s=yt.name("input");yt.pseudoElement("input",":focus",{border:`${ht.borderWidth} solid ${ht.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${ht.colors.primary} 20%, transparent)`,borderRadius:ht.radius.default});const a=yt.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${ht.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:ht.fontSize.default,backgroundColor:"transparent",color:ht.colors.foreground,outline:"none"}),c=yt.create("select-wrapper",{border:`${ht.borderWidth} solid ${e.hasError?ht.colors.destructive:ht.colors.input}`,borderRadius:ht.radius.default,backgroundColor:ht.colors.card,transition:ht.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${ht.colors.destructive} 20%, transparent)`:"none"}),l=yt.name("select-wrapper");yt.pseudoElement("select-wrapper",":focus-within",{border:`${ht.borderWidth} solid ${ht.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${ht.colors.primary} 20%, transparent)`,borderRadius:ht.radius.default});const{onChange:u,className:d,validation:h,errors:m,...f}=e;function p(e){u(e.currentTarget.value)}function g(e){u(e.currentTarget.value)}if("select"===e.type){const y=e.null_option_label||"N/A";return Oe("div",{className:St(c,l),children:Oe("select",{...f,onChange:p,className:a,children:[e.add_null_option&&Oe("option",{value:"",children:y}),null===(n=null===(t=e.validation)||void 0===t?void 0:t.options)||void 0===n?void 0:n.map(e=>Oe("option",{value:e.value,children:e.label},e.value))]})})}if("date"===e.type)return Oe("input",{...f,type:"date",min:null===(r=e.validation)||void 0===r?void 0:r.minDate,max:null===(i=e.validation)||void 0===i?void 0:i.maxDate,onInput:g,onChange:p,className:St(o,s,d)});if("monthyear"===e.type){function v(e){const t=e.currentTarget.value;u(t?`${t}-01`:"")}const w=e.value?e.value.substring(0,7):"";return Oe("input",{...f,type:"month",value:w,onInput:v,onChange:v,className:St(o,s,d)})}if("year"===e.type){const b=(new Date).getFullYear();return Oe("input",{...f,type:"number",min:b-100,max:b,placeholder:"YYYY",onInput:g,onChange:p,className:St(o,s,d)})}if("money"===e.type)return Oe(ys,{value:e.value,onChange:u,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:St(o,s,d),hasError:e.hasError});if("checkbox"===e.type){const x=!0===e.value||"true"===e.value||"true"===e.value,k=yt.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),S=yt.create("checkbox-"+(x?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${x?ht.colors.primary:e.hasError?ht.colors.destructive:ht.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:x?ht.colors.primary:ht.colors.card,transition:ht.transition,position:"absolute"}),N=yt.name("checkbox-"+(x?"checked":"unchecked"));function _(e){e.preventDefault(),u(x?"false":"true")}return yt.pseudoElement("checkbox-"+(x?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${ht.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),Oe("div",{className:k,children:[Oe("input",{type:"checkbox",id:e.id,name:e.name,checked:x,onClick:_,className:St(S,N,d),required:e.required,readOnly:!0}),x&&Oe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:ht.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Oe("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const $=yt.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),C=yt.create("boolean-radio-group",{display:"flex",gap:"1rem"}),T=yt.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),I=yt.create("boolean-radio",{accentColor:ht.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),E=yt.name("boolean-radio");yt.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${ht.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const P=yt.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${ht.borderWidth} solid ${e.hasError?ht.colors.destructive:ht.colors.input}`,borderRadius:ht.radius.default,fontSize:ht.fontSize.default,backgroundColor:ht.colors.card,color:ht.colors.foreground,transition:ht.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${ht.colors.destructive} 20%, transparent)`:"none",resize:"vertical",fontFamily:ht.fontFamily}),D=yt.name("boolean-textarea");yt.pseudoElement("boolean-textarea",":focus",{border:`${ht.borderWidth} solid ${ht.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${ht.colors.primary} 20%, transparent)`,borderRadius:ht.radius.default});const M=!0===e.value||"true"===e.value,z=!1===e.value||"false"===e.value,R=e.answer||"",O=e.booleanConfig,j=(null==O?void 0:O.enable_details_textbox)&&("yes"===O.show_details_on&&M||"no"===O.show_details_on&&z);function A(t){u(t),(!(null==O?void 0:O.enable_details_textbox)||!("yes"===O.show_details_on&&"true"===t||"no"===O.show_details_on&&"false"===t))&&e.onAnswerChange&&e.onAnswerChange("")}return Oe("div",{className:St($,d),children:[Oe("div",{className:C,children:[Oe("label",{className:T,children:[Oe("input",{type:"radio",name:e.name,checked:M,onChange:()=>A("true"),className:St(I,E)}),Oe("span",{children:"Yes"})]}),Oe("label",{className:T,children:[Oe("input",{type:"radio",name:e.name,checked:z,onChange:()=>A("false"),className:St(I,E)}),Oe("span",{children:"No"})]})]}),j&&Oe("textarea",{placeholder:(null==O?void 0:O.details_placeholder)||"Please provide details",value:R,required:!0,onInput:t=>{return n=t.target.value,void(e.onAnswerChange&&e.onAnswerChange(n));var n},className:St(P,D)})]})}return Oe("input",{...f,onInput:g,onChange:p,className:St(o,s,d)})}function ws({pages:e,currentPageIndex:n,completedPages:r}){const{fsm:i,lastUpdated:o,isSaving:s}=It(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=Xe(null),c=Xe(null);t(e.length),t(e.map((e,t)=>({index:t,id:e.id,title:e.title}))),Ke(()=>{if(a.current&&c.current){const e=c.current,t=a.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}},[n]);const l=Math.round((n+1)/e.length*100),u=yt.create("sidebar-nav-item-base",{display:"flex",alignItems:"flex-start",gap:ht.spacing.sm,padding:`${ht.spacing.sm} ${ht.spacing.sm}`,borderRadius:ht.radius.default,border:"none",backgroundColor:"transparent",color:ht.colors.foreground,cursor:"pointer",transition:ht.transition,textAlign:"left",width:"100%",fontFamily:ht.fontFamily,fontSize:ht.fontSize.small,opacity:"1"}),d=yt.create("sidebar-nav-item-active",{backgroundColor:ht.colors.accent,color:ht.colors.accentForeground}),h=yt.create("sidebar-nav-item-disabled",{cursor:"not-allowed",opacity:"0.5"});yt.pseudoElement("sidebar-nav-item-base",":hover",{backgroundColor:ht.colors.muted}),yt.pseudoElement("sidebar-nav-item-active",":hover",{backgroundColor:ht.colors.accent});const m=yt.create("sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:ht.colors.muted,color:ht.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),f=yt.create("sidebar-indicator-active",{backgroundColor:ht.colors.accentForeground,color:ht.colors.accent}),p=yt.create("sidebar-indicator-completed",{backgroundColor:ht.colors.primary,color:ht.colors.primaryForeground}),g=yt.create("sidebar-page-title-base",{fontWeight:"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),y=yt.create("sidebar-page-title-active",{fontWeight:"600"});return Oe("div",{className:yt.create("sidebar-navigation",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.lg,boxShadow:ht.shadow.sm,position:"sticky",top:ht.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:ht.spacing.lg}),children:[Oe("div",{className:yt.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:ht.spacing.sm}),children:[Oe("span",{className:yt.create("sidebar-progress-text",{fontSize:ht.fontSize.small,fontWeight:"600",color:ht.colors.foreground}),children:["Step ",n+1," of ",e.length]}),Oe("div",{className:yt.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:ht.colors.muted,borderRadius:ht.radius.small,overflow:"hidden"}),children:Oe("div",{className:yt.create("sidebar-progress-fill",{height:"100%",backgroundColor:ht.colors.primary,borderRadius:ht.radius.small,transition:ht.transition}),style:{width:`${l}%`}})})]}),Oe("hr",{className:yt.create("sidebar-divider",{borderColor:ht.colors.border})}),Oe("nav",{ref:c,className:yt.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:ht.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:ht.spacing.sm}),children:e.map((e,o)=>{const c=o===n,l=r.includes(o),v=i.canNavigateToPage(o);o===n&&t(e.title);const w=[u];c&&w.push(d),v&&!s||w.push(h);const b=w.join(" "),x=[m];l?x.push(p):c&&x.push(f);const k=x.join(" ");return Oe("button",{ref:c?a:null,onClick:()=>{return e=o,void((null==i?void 0:i.canNavigateToPage(e))&&i.navigateToPage(e));var e},disabled:!v||s,className:b,children:[Oe("div",{className:k,children:l?Oe("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:Oe("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Oe("div",{className:yt.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:Oe("span",{className:c?`${g} ${y}`:g,children:e.title})})]},e.id)})}),Oe("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&(null==i||i.reset())},className:yt.create("sidebar-reset-button",{padding:`${ht.spacing.sm} ${ht.spacing.md}`,border:`${ht.borderWidth} solid ${ht.colors.border}`,borderRadius:ht.radius.default,backgroundColor:"transparent",color:ht.colors.mutedForeground,fontSize:ht.fontSize.small,fontFamily:ht.fontFamily,cursor:"pointer",transition:ht.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),o&&Oe("div",{className:yt.create("sidebar-last-saved",{fontSize:"0.6875rem",color:ht.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Ho.fromJSDate(new Date(o)).toFormat("T")]})]})}function bs({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=It(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=Ve(!1),a=Math.round((t+1)/e.length*100),c=yt.create("mobile-sidebar-item-base",{display:"flex",alignItems:"center",gap:ht.spacing.sm,padding:ht.spacing.sm,border:"none",borderRadius:ht.radius.default,backgroundColor:"transparent",color:ht.colors.foreground,cursor:"pointer",opacity:"1",transition:ht.transition,width:"100%",textAlign:"left",fontFamily:ht.fontFamily}),l=yt.create("mobile-sidebar-item-active",{backgroundColor:ht.colors.accent,color:ht.colors.accentForeground}),u=yt.create("mobile-sidebar-item-disabled",{cursor:"not-allowed",opacity:"0.5"}),d=yt.create("mobile-sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:ht.colors.muted,color:ht.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),h=yt.create("mobile-sidebar-indicator-active",{backgroundColor:ht.colors.accentForeground,color:ht.colors.accent}),m=yt.create("mobile-sidebar-indicator-completed",{backgroundColor:ht.colors.primary,color:ht.colors.primaryForeground}),f=yt.create("mobile-sidebar-page-title-base",{fontSize:ht.fontSize.small,fontWeight:"500"}),p=yt.create("mobile-sidebar-page-title-active",{fontWeight:"600"});return Oe("div",{className:yt.create("mobile-sidebar",{overflow:"hidden"}),children:[Oe("button",{onClick:()=>s(!o),className:yt.create("mobile-sidebar-header",{width:"100%",padding:ht.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:ht.spacing.sm}),children:[Oe("div",{className:yt.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Oe("span",{className:yt.create("mobile-sidebar-step-text",{fontSize:ht.fontSize.small,fontWeight:"600",color:ht.colors.foreground}),children:["Step ",t+1," of ",e.length]}),Oe("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:yt.create("mobile-sidebar-chevron",{transition:ht.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:ht.colors.mutedForeground}),children:Oe("path",{d:"m6 9 6 6 6-6"})})]}),Oe("div",{className:yt.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:ht.colors.muted,borderRadius:ht.radius.small,overflow:"hidden"}),children:Oe("div",{className:yt.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:ht.colors.primary,borderRadius:ht.radius.small,transition:ht.transition}),style:{width:`${a}%`}})})]}),Oe("hr",{className:yt.create("mobile-sidebar-border",{borderColor:ht.colors.border})}),o&&Oe("div",{className:yt.create("mobile-sidebar-content",{padding:ht.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=[c];a&&v.push(l),y&&!i||v.push(u);const w=v.join(" "),b=[d];g?b.push(m):a&&b.push(h);const x=b.join(" ");return Oe("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:[Oe("div",{className:x,children:g?Oe("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:Oe("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Oe("span",{className:a?`${f} ${p}`:f,children:e.title})]},e.id)})})]})}function xs({organisation:e}){return Oe("div",{className:yt.create("welcome-card",{paddingInline:ht.spacing.lg,paddingTop:ht.spacing.lg},{"(max-width: 950px)":{paddingInline:ht.spacing.lg,paddingTop:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingTop:ht.spacing.md}}),children:[Oe("h2",{className:yt.create("welcome-title",{margin:"0",marginBottom:ht.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:ht.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:ht.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),Oe("p",{className:yt.create("welcome-text",{margin:"0",fontSize:ht.fontSize.default,lineHeight:"1.6",color:ht.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."}),Oe("hr",{className:yt.create("welcome-border",{marginTop:ht.spacing.lg,borderColor:ht.colors.border})})]})}function ks({title:e,description:t}){return Oe(Zo,{title:e,description:t,children:Oe(_t,{children:Oe(Yo,{className:yt.name("error-container"),children:Oe("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:[Oe("path",{d:"M4.929 4.929 19.07 19.071"}),Oe("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function Ss({errors:e,className:t}){return e&&0!==e.length?Oe("div",{className:yt.create("field-error",{color:ht.colors.destructive,fontSize:ht.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>Oe("span",{className:yt.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function Ns({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=Ve(!1);return Oe("label",{for:e,className:yt.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Oe("span",{className:yt.create("label-text",{marginBottom:ht.spacing.sm,fontSize:ht.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:ht.spacing.sm,color:ht.colors.foreground}),children:[Oe("span",{children:[t,r&&Oe("span",{className:yt.create("label-required-indicator",{color:ht.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Oe("span",{className:yt.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Oe("svg",{className:yt.create("tooltip-icon",{width:"1rem",height:"1rem",color:ht.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Oe("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Oe("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Oe("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Oe("span",{className:yt.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:ht.colors.popover,color:ht.colors.popoverForeground,fontSize:"0.875rem",borderRadius:ht.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Oe("span",{className:yt.create("tooltip-arrow",{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:`6px solid ${ht.colors.popover}`})})]})]})]}),n]})}function _s(e){switch(null!=e?e:100){case 25:return yt.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return yt.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return yt.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return yt.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return yt.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return yt.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function $s(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 Cs({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=yt.create("validated-field",{display:"flex",flexDirection:"column",gap:ht.spacing.sm});if("checkbox"===e.type){const t=yt.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:ht.spacing.sm}),a=yt.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=yt.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),l=yt.create("checkbox-label-text",{fontSize:ht.fontSize.default,fontWeight:"600",color:ht.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Oe("div",{className:St(s,_s(e.width),r),children:[Oe("div",{className:t,children:Oe("div",{className:a,children:[Oe("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Oe("label",{htmlFor:i,className:c,children:[Oe("span",{className:l,children:[e.label,e.required&&Oe("span",{className:yt.create("checkbox-required-indicator",{color:ht.colors.destructive}),children:"*"})]}),e.description&&Oe("div",{className:yt.create("checkbox-field-description",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:$s(e.description)}})]})]})}),Oe(Ss,{errors:o})]})}return Oe("div",{className:St(s,_s(e.width),r),children:[Oe(Ns,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&Oe("div",{className:yt.create("field-description",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,marginBottom:ht.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:$s(e.description)}}),n]}),Oe(Ss,{errors:o})]})}function Ts({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:ht.colors.secondary+"08",borderColor:ht.colors.secondary+"30",iconColor:ht.colors.secondary,titleColor:ht.colors.foreground},error:{backgroundColor:ht.colors.destructive+"08",borderColor:ht.colors.destructive,iconColor:ht.colors.destructive,titleColor:ht.colors.destructive},critical:{backgroundColor:ht.colors.destructive+"10",borderColor:ht.colors.destructive,iconColor:ht.colors.destructive,titleColor:ht.colors.destructive}}[e.severity],o=yt.create("error-card",{padding:ht.spacing.md,borderRadius:ht.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:ht.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=yt.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=yt.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=yt.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),l=yt.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=yt.create("error-card-title",{fontSize:ht.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=yt.create("error-card-message",{fontSize:ht.fontSize.small,color:ht.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=yt.create("error-card-details",{fontSize:"0.8125rem",color:ht.colors.mutedForeground,fontFamily:"monospace",backgroundColor:ht.colors.muted,padding:"0.625rem",borderRadius:ht.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),m=yt.create("error-card-support",{fontSize:"0.8125rem",color:ht.colors.mutedForeground,lineHeight:"1.4"}),f=yt.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:ht.colors.mutedForeground,cursor:"pointer",borderRadius:ht.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:ht.transition});return yt.pseudoElement("error-card-dismiss",":hover",{backgroundColor:ht.colors.muted,color:ht.colors.foreground}),Oe("div",{className:St(o,n),children:Oe("div",{className:s,children:[Oe(()=>"warning"===e.severity?Oe("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Oe("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"})}):Oe("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Oe("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"})}),{}),Oe("div",{className:c,children:[Oe("div",{className:l,children:[Oe("div",{className:u,children:e.title}),Oe("div",{className:d,children:e.message}),r&&e.details&&Oe("div",{className:h,children:e.details}),Oe("div",{className:m,children:be(e)})]}),t&&Oe("button",{className:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Oe("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:[Oe("path",{d:"M18 6 6 18"}),Oe("path",{d:"m6 6 12 12"})]})})]})]})})}function Is(){const{definition:e,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=It(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()})),l=e.pages[n];if(!l)return Oe(ks,{title:"Unexpected Error",description:"No page available"});const u=Xe(new Map),d=(e,t)=>{var n;const r=c.getFormProgress().page_data[l.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=h(t.validation.defaultDate,"monthyear"===t.type);if(n)return c.updateFieldValue(l.id,e,n),n}return""},h=(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 c=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),u=String(a.getDate()).padStart(2,"0");return t?`${c}-${l}-01`:`${c}-${l}-${u}`},m=e=>{const t=c.getFormProgress().page_data[l.id];return((null==t?void 0:t.U)||{})[e]||""},f=c.getFormProgress(),p={};Object.values(f.page_data).forEach(e=>{Object.assign(p,e)});const g=null==s?void 0:s.payment_return,y=g&&("declined"===g.paymentStatus||"cancelled"===g.paymentStatus||"error"===g.paymentStatus),v=c.getFormProgress().completed_pages||[];return Oe(Zo,{title:l.title,description:l.description,hideHeader:!0,children:Oe("div",{children:[y&&Oe(ms,{type:g.paymentStatus,transactionId:g.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Oe(_t,{children:Oe("div",{className:yt.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:ht.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Oe("div",{className:yt.create("form-content-wrapper",{minWidth:"0",backgroundColor:ht.colors.card,boxShadow:ht.shadow.sm,borderRadius:ht.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Oe("div",{className:yt.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Oe(bs,{pages:e.pages,currentPageIndex:n,completedPages:v})}),n>0&&Oe("div",{className:yt.create("page-heading-container",{paddingInline:ht.spacing.lg,paddingTop:ht.spacing.lg},{"(max-width: 950px)":{paddingInline:ht.spacing.lg,paddingTop:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingTop:ht.spacing.md}}),children:[Oe("div",{className:yt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:ht.spacing.lg}),children:Oe("div",{className:yt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Oe("h1",{className:yt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:ht.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:l.title}),l.description&&Oe("p",{className:yt.create("page-template-description",{margin:"0",marginTop:ht.spacing.sm,fontSize:ht.fontSize.small,lineHeight:"1.5",color:ht.colors.foreground,opacity:"0.7"}),children:l.description})]})}),Oe("hr",{className:yt.create("page-heading-border",{marginTop:ht.spacing.lg,borderColor:ht.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Oe(xs,{organisation:s.organisation}),o.length>0&&o.map(e=>Oe(Ts,{error:e,onDismiss:()=>c.dismissGeneralError(e.id)},e.id)),Oe("div",{className:yt.create("form-card",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.lg,boxShadow:ht.shadow.sm,display:"flex",flexDirection:"column",gap:ht.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:ht.spacing.md,gap:ht.spacing.lg},"(max-width: 480px)":{padding:ht.spacing.md,gap:ht.spacing.md}}),children:[Oe("form",{onSubmit:e=>e.preventDefault(),className:yt.create("form-fields-container",{flex:"1"}),children:Oe("div",{className:yt.create("form-content-page",{display:"grid",gap:ht.spacing.md,rowGap:ht.spacing.lg,gridTemplateColumns:"repeat(12, 1fr)"}),children:l.fields.map(e=>{const n=e.code||e.id;return(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(p)),n.forEach(e=>{e&&t()}));const r=re(p,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions}),i="show"===e.visibility.action?r.matched:!r.matched;return u.current.get(e.id)!==i&&(t((e.label,e.code)),t(),u.current.set(e.id,i)),i})(e)?Oe(Cs,{field:e,errors:i,children:Oe(vs,{value:d(n,e).toString(),onChange:t=>{let r=t;"boolean"!==e.type&&"checkbox"!==e.type||(r="true"===t),c.updateFieldValue(l.id,n,r)},answer:m(n),onAnswerChange:t=>{var r;c.updateFieldAnswer(l.id,n,t,null===(r=e.boolean_config)||void 0===r?void 0:r.details_rating_factor_id)},id:n,name:n,type:e.type,placeholder:e.placeholder,validation:e.validation,booleanConfig:e.boolean_config,add_null_option:e.add_null_option,null_option_label:e.null_option_label,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n)})},e.id):null})})}),Oe("hr",{className:yt.create("form-navigation-border",{borderColor:ht.colors.border})}),Oe("div",{className:yt.create("form-navigation-inline",{paddingTop:ht.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Oe(Jo,{onClick:()=>null==c?void 0:c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Oe(Jo,{onClick:async function(){c.validateCurrentPage().length>0||(n===r-1?await(null==c?void 0:c.calculateQuote()):await(null==c?void 0:c.navigateToNextPage()))},disabled:a,loading:a,children:n===r-1?"Get Quote":"Continue"})]})]})]}),Oe("div",{className:yt.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Oe(ws,{pages:e.pages,currentPageIndex:n,completedPages:v})})]})})]})})}function Es(){var e,t,n;const{quoteIntent:r,fsm:i}=It(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,c=null===(e=null==r?void 0:r.organisation)||void 0===e?void 0:e.name,l=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=l||u;Ke(()=>{if(s&&r){const e=null==o?void 0:o.paymentStatus,t=null==a?void 0:a.amount;"success"===e&&a?Ee(r,s,t||0,a.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&Pe(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=yt.create("success-card",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.xl,boxShadow:ht.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:ht.spacing.lg},"(max-width: 480px)":{padding:ht.spacing.md}}),m=yt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:ht.spacing.lg}),f=yt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=yt.create("success-header",{textAlign:"center",marginBottom:ht.spacing.xl}),g=yt.create("success-title",{margin:"0",marginBottom:ht.spacing.sm,fontSize:"2rem",fontWeight:"700",color:ht.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=yt.create("success-message",{fontSize:ht.fontSize.default,lineHeight:"1.6",color:ht.colors.foreground,opacity:"0.9",margin:"0"}),v=yt.create("success-contact-section",{borderTop:`1px solid ${ht.colors.border}`,paddingTop:ht.spacing.xl,marginTop:ht.spacing.xl}),w=yt.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:ht.colors.foreground,marginBottom:ht.spacing.md,textAlign:"center"}),b=yt.create("success-contact-details",{backgroundColor:ht.colors.accent,borderRadius:ht.radius.default,padding:ht.spacing.md,display:"flex",flexDirection:"column",gap:ht.spacing.sm,marginBottom:ht.spacing.lg}),x=yt.create("success-contact-item",{display:"flex",alignItems:"center",gap:ht.spacing.sm,fontSize:ht.fontSize.small,color:ht.colors.accentForeground}),k=yt.create("success-actions",{display:"flex",gap:ht.spacing.md,flexWrap:"wrap",justifyContent:"center"}),S=yt.create("success-reference",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,textAlign:"center",marginTop:ht.spacing.md});return Oe(Zo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe(Yo,{children:Oe("div",{className:h,children:[Oe("div",{className:m,children:Oe("div",{className:f,children:Oe("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:Oe("path",{d:"M20 6 9 17l-5-5"})})})}),Oe("div",{className:p,children:[Oe("h1",{className:g,children:"Payment Complete!"}),Oe("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 ",c?`covered by ${c}`:"covered","."]})]}),d&&Oe("div",{className:v,children:[Oe("h3",{className:w,children:"Need assistance?"}),Oe("div",{className:b,children:[l&&Oe("div",{className:x,children:[Oe("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:[Oe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Oe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Oe("span",{children:l})]}),u&&Oe("div",{className:x,children:[Oe("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:Oe("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"})}),Oe("span",{children:u})]})]}),Oe("div",{className:k,children:[u&&Oe(Jo,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[Oe("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:Oe("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"]}),l&&Oe(Jo,{variant:"outline",onClick:()=>window.open(`mailto:${l}`),children:[Oe("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:[Oe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Oe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),r.reference&&Oe("div",{className:S,children:["Quote Reference: ",Oe("strong",{children:r.reference})]})]})})})})}function Ps({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,s]=Ve("initiating"),[a,c]=Ve(null),[l,u]=Ve(null),[d,h]=Ve(null);Ke(()=>{e&&r&&m()},[e,r]);const m=async()=>{var e;if(r)try{s("initiating"),c(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){c(e.message||"Failed to initiate payment"),s("failed")}},f=()=>{l&&!l.closed&&l.close(),s("initiating"),c(null),h(null),u(null),t()};return e?Oe("div",{className:yt.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:[Oe("div",{className:yt.create("modal-content",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ht.colors.border}`}),children:[Oe("div",{className:yt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Oe("div",{className:yt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Oe("h2",{className:yt.create("modal-title",{margin:"0",color:ht.colors.foreground,fontSize:ht.fontSize.large}),children:"Payment Processing"})]}),Oe("div",{className:yt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Oe(Ko,{className:yt.create("status-message",{fontSize:ht.fontSize.default,color:ht.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&&Oe(Ko,{className:yt.create("error-message",{color:ht.colors.destructive,fontSize:ht.fontSize.small,padding:"0.75rem",backgroundColor:ht.colors.destructive+"10",borderRadius:ht.radius.default,border:`1px solid ${ht.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Oe("div",{className:yt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${ht.colors.border}`,borderTop:`3px solid ${ht.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Oe("div",{className:yt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Oe(S,{children:[Oe(Jo,{onClick:f,variant:"outline",children:"Close"}),"cancelled"===o&&Oe(Jo,{onClick:()=>{s("initiating"),c(null),m()},children:"Try Again"})]}):Oe(Jo,"completed"===o?{onClick:f,children:"Continue"}:{onClick:f,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Oe("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Ds({transactionId:e,organisationId:t}){const{httpClient:n}=Tt(),[r,i]=Ve(!0),[o,s]=Ve(null),[a,c]=Ve(null),[l,u]=Ve(!1),[d,h]=Ve(!1),[m,f]=Ve(!1);Ke(()=>{p()},[e]);const p=async()=>{try{if(i(!0),s(null),!n)throw new Error("HTTP client not available");const r=n.getBaseUrl(),o=await fetch(`${r}/payments/bank-transfer/${e}?orgId=${t}`);if(!o.ok)throw new Error(`Failed to load bank transfer details: ${o.statusText}`);const a=await o.json(),l=a.data||a;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){s(e.message||"Failed to load bank transfer details")}finally{i(!1)}};return r?Oe(Go,{message:"Loading payment details..."}):o?Oe(Zo,{title:"Error",description:"Failed to load bank transfer details",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe(Yo,{children:Oe("div",{className:yt.create("error-card",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.xl,boxShadow:ht.shadow.sm,maxWidth:"42rem",margin:"0 auto",textAlign:"center"},{"(max-width: 480px)":{padding:ht.spacing.lg}}),children:[Oe("div",{className:yt.create("error-icon",{fontSize:"3rem",marginBottom:ht.spacing.md,color:ht.colors.destructive}),children:"⚠️"}),Oe("h2",{className:yt.create("error-title",{margin:"0",marginBottom:ht.spacing.sm,color:ht.colors.foreground}),children:"Error Loading Payment Details"}),Oe("p",{className:yt.create("error-message",{color:ht.colors.mutedForeground}),children:o})]})})})}):a?Oe(Zo,{title:"Bank Transfer Payment",description:"Complete your payment via bank transfer",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:[Oe(Yo,{children:Oe("div",{className:yt.create("bank-transfer-container",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,maxWidth:"42rem",margin:"0 auto",overflow:"hidden",boxShadow:"0 20px 60px rgba(0,0,0,0.1)"}),children:[Oe("div",{style:{backgroundColor:ht.colors.primary},className:yt.create("bank-transfer-header",{color:"white",padding:"2.5rem 2rem",textAlign:"center"},{"(max-width: 480px)":{padding:"1.5rem 1rem"}}),children:[Oe("h1",{className:yt.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"}),Oe("p",{className:yt.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:ht.fontSize.small}}),children:"Complete your payment using the details below"})]}),Oe("div",{className:yt.create("bank-transfer-content",{padding:"2rem"},{"(max-width: 480px)":{padding:"1rem"}}),children:[Oe("div",{className:yt.create("payment-details-card",{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:ht.radius.default,padding:"1.5rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Oe("div",{className:yt.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:[Oe("span",{className:yt.create("detail-label",{color:"#6b7280",fontSize:ht.fontSize.default}),children:"Amount to Transfer"}),Oe("span",{className:yt.create("detail-value-amount",{color:ht.colors.primary,fontSize:"1.5rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:["$",a.amount.toFixed(2)," ",a.currency]})]}),Oe("div",{className:yt.create("detail-row",{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:[Oe("span",{className:yt.create("detail-label",{color:"#6b7280",fontSize:ht.fontSize.default}),children:"Account Name"}),Oe("span",{className:yt.create("detail-value",{color:ht.colors.foreground,fontSize:ht.fontSize.default,fontWeight:"600"}),children:a.bank_account_name})]}),Oe("div",{className:yt.create("detail-row",{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:[Oe("span",{className:yt.create("detail-label",{color:"#6b7280",fontSize:ht.fontSize.default}),children:"Account Number"}),Oe("span",{className:yt.create("detail-value",{color:ht.colors.foreground,fontSize:ht.fontSize.default,fontWeight:"600"}),children:a.bank_account_number})]}),Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Oe("span",{className:yt.create("detail-label",{color:"#6b7280",fontSize:ht.fontSize.default}),children:"Payment Reference"}),Oe("span",{className:yt.create("detail-value",{color:ht.colors.foreground,fontSize:ht.fontSize.default,fontWeight:"600"}),children:a.reference})]})]}),Oe("div",{className:yt.create("instructions-card",{backgroundColor:"#eff6ff",borderLeft:`4px solid ${ht.colors.primary}`,borderRadius:ht.radius.default,padding:"1.25rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Oe("h3",{className:yt.create("instructions-title",{margin:"0 0 0.75rem 0",fontSize:ht.fontSize.default,fontWeight:"600",color:ht.colors.foreground}),children:"Payment Instructions"}),Oe("p",{className:yt.create("instructions-text",{margin:"0 0 0.75rem 0",fontSize:ht.fontSize.small,lineHeight:"1.6",color:ht.colors.foreground}),children:[Oe("strong",{children:"Important:"})," Please include the payment reference when making your transfer to ensure your payment is processed correctly."]}),Oe("p",{className:yt.create("instructions-text",{margin:"0",fontSize:ht.fontSize.small,lineHeight:"1.6",color:ht.colors.foreground}),children:"Once we receive your payment, we'll process your quote and send you a confirmation email."})]}),Oe("div",{className:yt.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:[Oe("button",{onClick:()=>{u(!0)},style:{backgroundColor:ht.colors.primary},className:yt.create("confirm-button",{color:"white",border:"none",borderRadius:ht.radius.default,padding:"0.75rem 2rem",fontSize:ht.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"}),Oe("button",{onClick:()=>{h(!0)},className:yt.create("cancel-button",{color:"#6b7280",backgroundColor:"white",border:"2px solid #e5e7eb",borderRadius:ht.radius.default,padding:"0.75rem 2rem",fontSize:ht.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"all 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"Cancel"})]}),Oe("p",{className:yt.create("footer-text",{textAlign:"center",color:"#6b7280",fontSize:ht.fontSize.small,margin:"0"}),children:"Your quote has been saved. We'll process it once payment is received."})]})]})}),d&&Oe("div",{className:yt.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:()=>!m&&h(!1),children:Oe("div",{className:yt.create("modal-content",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ht.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:ht.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Oe("div",{className:yt.create("warning-icon",{fontSize:"4rem",marginBottom:ht.spacing.md}),children:"⚠️"}),Oe("h3",{className:yt.create("modal-title",{margin:"0",marginBottom:ht.spacing.sm,color:ht.colors.foreground,fontSize:ht.fontSize.large,fontWeight:"600"}),children:"Are you sure?"}),Oe("p",{className:yt.create("modal-message",{margin:"0",marginBottom:ht.spacing.lg,color:ht.colors.foreground,lineHeight:"1.6"}),children:"This will take you back to the checkout page."}),Oe("div",{className:yt.create("modal-buttons",{display:"flex",flexDirection:"column-reverse",gap:"0.75rem",justifyContent:"center"}),children:[Oe("button",{onClick:()=>h(!1),disabled:m,className:yt.create("no-button",{backgroundColor:"#f3f4f6",color:ht.colors.foreground,border:"none",borderRadius:ht.radius.default,padding:`${ht.spacing.sm} ${ht.spacing.lg}`,fontSize:ht.fontSize.default,fontWeight:"500",cursor:m?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:m?"0.5":"1",width:"100%"}),children:"No, Go Back"}),Oe("button",{onClick:async()=>{if(n)try{f(!0);const r=n.getBaseUrl();if(!(await fetch(`${r}/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){s("Failed to cancel payment. Please try again."),h(!1),f(!1)}},disabled:m,className:yt.create("yes-button",{backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:ht.radius.default,padding:`${ht.spacing.sm} ${ht.spacing.lg}`,fontSize:ht.fontSize.default,fontWeight:"500",cursor:m?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:m?"0.5":"1",width:"100%"}),children:m?"Cancelling...":"Yes, Cancel Payment"})]})]})}),l&&Oe("div",{className:yt.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:()=>u(!1),children:Oe("div",{className:yt.create("modal-content",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${ht.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:ht.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Oe("div",{className:yt.create("success-icon",{fontSize:"4rem",marginBottom:ht.spacing.md}),children:"✓"}),Oe("h3",{className:yt.create("modal-title",{margin:"0",marginBottom:ht.spacing.sm,color:ht.colors.primary,fontSize:ht.fontSize.large,fontWeight:"600"}),children:"Thank You!"}),Oe("p",{className:yt.create("modal-message",{margin:"0",marginBottom:ht.spacing.lg,color:ht.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."}),Oe("button",{onClick:()=>u(!1),className:yt.create("close-button",{backgroundColor:ht.colors.primary,color:"white",border:"none",borderRadius:ht.radius.default,padding:`${ht.spacing.sm} ${ht.spacing.lg}`,fontSize:ht.fontSize.default,fontWeight:"500",cursor:"pointer",transition:"opacity 150ms ease"}),children:"Close"})]})})]})}):null}yt.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:ht.colors.muted,borderColor:ht.colors.primary,color:ht.colors.primary});class Ms{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 vt}).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)}}Ms.loadedThemes=new Set,Ms.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 zs=Object.freeze({__proto__:null,ThemeLoader:Ms});function Rs({paymentLinkId:e,signedUrl:n}){var r,i,o,s,a,c;const l=Tt().httpClient,[u,d]=Ve(null),[h,m]=Ve(!0),[f,p]=Ve(null),[g,y]=Ve(!1),[v,w]=Ve(null),[b,x]=Ve(null),[k,N]=Ve(null),[_,$]=Ve(!1),[C,T]=Ve(null),[I,E]=Ve(null),[P,D]=Ve(()=>(new Date).toISOString().split("T")[0]),[M,z]=Ve(null),[R,O]=Ve(!1),[j,A]=Ve(null),[W,L]=Ve(null);Ke(()=>{B()},[e]);const B=async()=>{var r,i;try{m(!0);const o=new URLSearchParams(window.location.search),s=o.get("transactionId"),a=o.get("status"),c=o.get("gateway_code"),u=o.get("excess_id");s&&a&&($(!0),T(a),E(s)),c&&N(c);const h=n?await l.getPaymentLinkDetails(n):await l.getPaymentLinkById(e);if("paid"===h.status&&!_&&(!s||"completed"!==a&&"success"!==a))return void p("This payment link has already been used.");if("expired"===h.status)return void p("This payment link has expired.");if("cancelled"===h.status)return void p("This payment link has been cancelled.");if("outdated"===h.status)return void p("This payment link is no longer valid because the quote has been updated. Please request a new payment link.");if("awaiting_payment"===h.status&&h.pending_bank_transfer){const e=h.pending_bank_transfer;if(t(),L({transactionId:e.transaction_id,organisationId:(null===(r=h.organisation)||void 0===r?void 0:r.id)||""}),h.organisation&&h.organisation.theme)try{await Ms.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(e){t()}return}if(h.organisation&&h.organisation.theme)try{await Ms.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(e){t()}if(u){const e=h.calculations.find(e=>e.excess_id===u);e?x(e.id):1===h.calculations.length&&h.calculations[0]&&x(h.calculations[0].id)}else 1===h.calculations.length&&h.calculations[0]&&x(h.calculations[0].id);!c&&1===h.payment_options.length&&h.payment_options[0]&&N(h.payment_options[0].gateway_code),d(h),(null===(i=h.organisation)||void 0===i?void 0:i.quote_page_url)&&A(h.organisation.quote_page_url)}catch(e){p("Failed to load payment details. Please check your link.")}finally{m(!1)}},F=et(()=>u&&b?u.calculations.find(e=>e.id===b):null,[u,b]),q=et(()=>u&&k?u.payment_options.find(e=>e.gateway_code===k):null,[u,k]);if(W)return Oe(Ds,{transactionId:W.transactionId,organisationId:W.organisationId});if(h)return Oe(Zo,{title:"Loading...",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe("div",{className:yt.create("payment-link-loading-card",{textAlign:"center",padding:ht.spacing.xl,backgroundColor:ht.colors.card,borderRadius:ht.radius.large,boxShadow:ht.shadow.sm,maxWidth:"600px",margin:"0 auto"}),children:Oe("p",{className:yt.create("loading-text",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.default}),children:"Loading payment details..."})})})});if(f)return Oe(Zo,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe("div",{className:yt.create("payment-link-error-card",{textAlign:"center",padding:ht.spacing.xl,backgroundColor:ht.colors.card,borderRadius:ht.radius.large,boxShadow:ht.shadow.sm,border:`2px solid ${ht.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Oe("h2",{className:yt.create("error-title",{color:ht.colors.destructive,marginBottom:ht.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"Payment Link Error"}),Oe("p",{className:yt.create("error-message",{color:ht.colors.foreground,fontSize:ht.fontSize.default,margin:"0"}),children:f})]})})});if(!u)return null;const H=new URLSearchParams(window.location.search),U=H.get("transactionId"),Z=H.get("status"),Y=U&&Z;if("paid"===u.status&&("completed"===Z||"success"===Z||Y||_||"completed"===C)||"superseded"===u.status){const e=null===(r=u.organisation)||void 0===r?void 0:r.admin_email,t=null===(i=u.organisation)||void 0===i?void 0:i.phone,n=e||t;return Oe(Zo,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe("div",{className:yt.create("payment-success-card",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.xl,boxShadow:ht.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Oe("div",{className:yt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:ht.spacing.lg}),children:Oe("div",{className:yt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Oe("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:Oe("path",{d:"M20 6 9 17l-5-5"})})})}),Oe("div",{className:yt.create("success-header",{textAlign:"center",marginBottom:ht.spacing.xl}),children:[Oe("h1",{className:yt.create("success-title",{margin:"0",marginBottom:ht.spacing.sm,fontSize:"2rem",fontWeight:"700",color:ht.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Payment Complete!"}),Oe("p",{className:yt.create("success-message",{fontSize:ht.fontSize.default,lineHeight:"1.6",color:ht.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&Oe("div",{className:yt.create("contact-section",{borderTop:`1px solid ${ht.colors.border}`,paddingTop:ht.spacing.xl,marginTop:ht.spacing.xl}),children:[Oe("h3",{className:yt.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:ht.colors.foreground,marginBottom:ht.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Oe("div",{className:yt.create("contact-details",{backgroundColor:ht.colors.accent,borderRadius:ht.radius.default,padding:ht.spacing.md,display:"flex",flexDirection:"column",gap:ht.spacing.sm,marginBottom:ht.spacing.lg}),children:[e&&Oe("div",{className:yt.create("contact-item",{display:"flex",alignItems:"center",gap:ht.spacing.sm,fontSize:ht.fontSize.small,color:ht.colors.accentForeground}),children:Oe("span",{children:["Email: ",e]})}),t&&Oe("div",{className:yt.create("contact-item",{display:"flex",alignItems:"center",gap:ht.spacing.sm,fontSize:ht.fontSize.small,color:ht.colors.accentForeground}),children:Oe("span",{children:["Phone: ",t]})})]}),(I||U)&&Oe("div",{className:yt.create("reference",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,textAlign:"center",marginTop:ht.spacing.md}),children:["Transaction ID: ",Oe("strong",{children:null===(o=I||U)||void 0===o?void 0:o.slice(0,8).toUpperCase()})]})]})]})})})}if(Y&&("failed"===Z||"cancelled"===Z||"failed"===C||"cancelled"===C))return Oe(Zo,{title:"Payment Unsuccessful",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe("div",{className:yt.create("payment-error-card",{textAlign:"center",padding:ht.spacing.xl,backgroundColor:ht.colors.card,borderRadius:ht.radius.large,boxShadow:ht.shadow.sm,border:`2px solid ${ht.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Oe("h2",{className:yt.create("error-title",{color:ht.colors.destructive,marginBottom:ht.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"cancelled"===Z||"cancelled"===C?"Payment Cancelled":"Payment Failed"}),Oe("p",{className:yt.create("error-message",{color:ht.colors.foreground,fontSize:ht.fontSize.default,margin:"0",marginBottom:ht.spacing.lg}),children:"cancelled"===Z||"cancelled"===C?"Your payment was cancelled. You can try again by refreshing this page.":"There was an issue processing your payment. Please try again."}),Oe(Jo,{onClick:()=>window.location.reload(),children:"Try Again"})]})})});const G=u.calculations,J=G.length>0,Q=J,V=(null===(s=u.metadata)||void 0===s?void 0:s.product_name)||"Payment",K=new Date(u.expires_at),X=Boolean(null===(a=null==u?void 0:u.metadata)||void 0===a?void 0:a.quote_intent_id),ee=Boolean((!J||b)&&k&&!M&&!R),te=et(()=>{var e;const t=null===(e=null==u?void 0:u.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},[u]),ne=et(()=>F&&F.line_item_display||null,[F]);return Oe(Zo,{title:"Complete Your Purchase",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:[Oe("div",{className:yt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:ht.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:ht.spacing.md}}),children:[Oe("div",{className:yt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:ht.colors.card,boxShadow:ht.shadow.sm,borderRadius:ht.radius.large,display:"flex",flexDirection:"column"}),children:[Oe("div",{className:yt.create("checkout-header",{paddingInline:ht.spacing.xl,paddingTop:ht.spacing.xl,paddingBottom:ht.spacing.lg},{"(max-width: 768px)":{paddingInline:ht.spacing.lg,paddingTop:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingTop:ht.spacing.md}}),children:[Oe("h2",{className:yt.create("checkout-title",{margin:"0",marginBottom:ht.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:ht.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Oe("p",{className:yt.create("checkout-description",{margin:"0",fontSize:ht.fontSize.default,lineHeight:"1.6",color:ht.colors.foreground,opacity:"0.9"}),children:J?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment option to complete your purchase."}),Oe("hr",{className:yt.create("checkout-header-border",{marginTop:ht.spacing.lg,borderColor:ht.colors.border})})]}),Oe("div",{className:yt.create("checkout-sections",{paddingInline:ht.spacing.xl,paddingBottom:ht.spacing.xl,display:"flex",flexDirection:"column",gap:ht.spacing.lg},{"(max-width: 768px)":{paddingInline:ht.spacing.lg,paddingBottom:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingBottom:ht.spacing.md}}),children:[X&&Oe("div",{className:yt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Oe(Xo,{title:"Cover Start Date"}),Oe("div",{className:yt.create("cover-date-container",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:[Oe("input",{type:"date",value:P,onChange:e=>{return t=e.target.value,D(t),void(async e=>{var t;if(u&&l&&(null===(t=u.metadata)||void 0===t?void 0:t.quote_intent_id)){O(!0),z(null);try{const t=await l.validateCoverStartDate(u.payment_link_id,e);t.valid?z(null):(z(t.message||"This cover start date is not valid."),t.quote_page_url&&A(t.quote_page_url))}catch(e){z("Failed to validate cover date. Please try again.")}finally{O(!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:R,className:yt.create("cover-date-input",{padding:"0.75rem 1rem",fontSize:ht.fontSize.default,border:`2px solid ${M?ht.colors.destructive:ht.colors.border}`,borderRadius:ht.radius.default,backgroundColor:ht.colors.background,color:ht.colors.foreground,width:"auto",maxWidth:"200px",cursor:R?"wait":"pointer"})}),R&&Oe("p",{className:yt.create("validating-text",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,margin:"0"}),children:"Validating..."}),M&&Oe("div",{className:yt.create("cover-date-error",{backgroundColor:`${ht.colors.destructive}10`,border:`1px solid ${ht.colors.destructive}`,borderRadius:ht.radius.default,padding:"1rem"}),children:[Oe("p",{className:yt.create("error-message",{color:ht.colors.destructive,fontSize:ht.fontSize.small,margin:"0",marginBottom:j?ht.spacing.md:"0"}),children:M}),j&&Oe("a",{href:j,className:yt.create("new-quote-link",{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:ht.colors.primary,fontSize:ht.fontSize.small,fontWeight:"500",textDecoration:"none"}),children:["Start New Quote",Oe("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:[Oe("path",{d:"M5 12h14"}),Oe("path",{d:"m12 5 7 7-7 7"})]})]})]})]})]}),Q&&J&&Oe("div",{className:yt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Oe(Xo,{title:"Excess Options"}),Oe("div",{className:yt.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:[...G].sort((e,t)=>e.excess_amount-t.excess_amount).map(e=>{const t=e.id===b;return Oe("div",{className:St(yt.create("excess-option-card",{borderRadius:ht.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),t?yt.create("excess-option-card-selected",{border:`2px solid ${ht.colors.primary}`,backgroundColor:ht.colors.accent}):yt.create("excess-option-card-unselected",{border:`2px solid ${ht.colors.border}`,backgroundColor:ht.colors.card})),onClick:()=>x(e.id),children:[Oe(es,{selected:t}),Oe("div",{className:yt.create("excess-amount",{color:ht.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})}),(null==F?void 0:F.description)&&Oe("div",{className:yt.create("excess-description",{padding:"0.75rem",backgroundColor:ht.colors.muted,borderRadius:ht.radius.default,border:`1px solid ${ht.colors.border}`}),children:Oe(Ko,{className:yt.create("excess-description-text",{fontSize:ht.fontSize.small,color:ht.colors.foreground,margin:"0"}),children:F.description})})]}),u.payment_options.length>0&&Oe("div",{className:yt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Oe(Xo,{title:"Payment Options"}),Oe("div",{className:yt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:u.payment_options.map(e=>{const t=k===e.gateway_code,n="monthly"===e.payment_frequency,r=()=>{var t;return n&&e.amount.monthly?`${ns(parseFloat(e.amount.monthly))} x ${(null===(t=e.metadata)||void 0===t?void 0:t.number_of_instalments)||12}`:ns(parseFloat(e.amount.due_today))},i=()=>"bank_transfer"===e.gateway_code?"Manual":`via ${e.gateway_name}`;return Oe("div",{className:St(yt.create("payment-option-row",{borderRadius:ht.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?yt.create("payment-option-row-selected",{border:`2px solid ${ht.colors.primary}`,backgroundColor:ht.colors.accent}):yt.create("payment-option-row-unselected",{border:`2px solid ${ht.colors.border}`,backgroundColor:ht.colors.card})),onClick:()=>N(e.gateway_code),children:[Oe("div",{className:yt.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Oe(es,{selected:t}),Oe("div",{className:yt.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Oe("div",{className:yt.create("frequency-title",{fontSize:ht.fontSize.default,fontWeight:"500",color:ht.colors.foreground}),children:rs(n?"monthly":"one-time",e.gateway_code)}),Oe("div",{className:yt.create("gateway-description",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground}),children:i()})]})]}),Oe("div",{className:yt.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Oe(Ko,{className:yt.create("amount-text",{textAlign:"right",color:ht.colors.foreground}),children:r()}),"bank_transfer"!==e.gateway_code&&Oe(Ko,{size:"small",className:yt.create("gateway-fee-text",{textAlign:"right",color:ht.colors.mutedForeground}),children:["bank_transfer"===e.gateway_code?null:n&&(null===(o=e.metadata)||void 0===o?void 0:o.total_interest)?ns(e.metadata.total_interest):ns(0)," fee"]}),"bank_transfer"===e.gateway_code&&Oe(Ko,{size:"small",className:yt.create("no-fee-text",{textAlign:"right",color:ht.colors.mutedForeground}),children:"No fees"})]}),Oe("div",{className:yt.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Oe(es,{selected:t}),Oe("div",{className:yt.create("payment-option-title-mobile",{fontSize:ht.fontSize.default,fontWeight:"500",color:ht.colors.foreground}),children:rs(n?"monthly":"one-time",e.gateway_code)})]}),Oe("div",{className:yt.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:[Oe("div",{className:yt.create("gateway-description-mobile",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground}),children:i()}),Oe(Ko,{className:yt.create("amount-text-mobile",{fontWeight:"500",color:ht.colors.foreground}),children:r()})]})]},e.gateway_code);var o})})]})]})]}),Oe("div",{className:yt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Oe("div",{className:yt.create("checkout-sidebar-sticky",{position:"sticky",top:ht.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:[(te||ne)&&Oe("div",{className:yt.create("insurance-details-card",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,padding:ht.spacing.lg,boxShadow:ht.shadow.sm},{"(max-width: 768px)":{padding:ht.spacing.md}}),children:[Oe("h3",{className:yt.create("cart-summary-title",{fontSize:ht.fontSize.large,fontWeight:"600",marginBottom:ht.spacing.md,color:ht.colors.foreground}),children:Q?"Insurance Details":"Payment Details"}),te&&Oe(S,{children:[Oe("div",{className:yt.create("client-details",{display:"flex",flexDirection:"column",gap:ht.spacing.sm,marginBottom:ht.spacing.md}),children:[te.firstName&&te.lastName&&Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Name"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:[te.firstName," ",te.lastName]})]}),te.email&&Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Email"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:te.email})]}),te.phone&&Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Phone"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:te.phone})]}),"Payment"!==V&&Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Product"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:V})]}),Oe("div",{className:yt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:yt.create("detail-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:"Link Expires"}),Oe("span",{className:yt.create("detail-value",{fontWeight:"500",color:ht.colors.foreground,fontSize:ht.fontSize.small}),children:K.toLocaleDateString()})]})]}),Oe("hr",{className:yt.create("divider",{border:"none",borderTop:`1px solid ${ht.colors.border}`,margin:`${ht.spacing.md} 0`})})]}),ne&&Oe("div",{className:yt.create("line-item-section",{}),children:[Oe("div",{className:yt.create("line-item-description",{fontSize:ht.fontSize.small,fontWeight:"500",color:ht.colors.foreground}),children:ne.description}),null!=ne.sum_insured&&Oe("div",{className:yt.create("line-item-sum-insured",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground,marginTop:ht.spacing.sm}),children:["Sum Insured: ",ns(ne.sum_insured)]})]})]}),(te||ne)&&Oe("div",{className:yt.create("checkout-sidebar-spacer",{height:ht.spacing.lg},{"(max-width: 950px)":{height:ht.spacing.md}})}),Oe("div",{className:yt.create("checkout-sidebar-card",{backgroundColor:ht.colors.card,borderRadius:ht.radius.large,boxShadow:ht.shadow.sm,padding:ht.spacing.lg},{"(max-width: 768px)":{padding:ht.spacing.md}}),children:Oe("div",{className:yt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Oe("h3",{className:yt.create("cart-summary-title",{fontSize:ht.fontSize.large,fontWeight:"600",marginBottom:ht.spacing.sm,color:ht.colors.foreground}),children:"Payment Details"}),q&&Oe("div",{className:yt.create("summary-section",{paddingBottom:"1rem"}),children:Oe("div",{className:yt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"monthly"!==q.payment_frequency?Oe(Os,{label:"Total Due Today:",value:ns(parseFloat(q.amount.due_today)),isTotal:!0}):Oe(S,{children:[Oe(Os,{label:"Due Today:",value:ns(parseFloat(q.amount.due_today)),isTotal:!0}),q.amount.monthly&&Oe(Os,{label:"Then Monthly:",value:ns(parseFloat(q.amount.monthly))}),(null===(c=q.metadata)||void 0===c?void 0:c.number_of_instalments)&&Oe(Os,{label:"Installments:",value:q.metadata.number_of_instalments.toString()}),q.amount.total&&Oe(Os,{label:"Total Payable:",value:ns(parseFloat(q.amount.total))})]})})}),Oe(Jo,{onClick:async()=>{var e,t,n,r;if(!u)return;const i=u.calculations.length>0,o=!i;if(i&&!b)return void alert("Please select an excess amount before proceeding.");if(!k)return void alert("Please select a payment method before proceeding.");const s=i?u.calculations.find(e=>e.id===b):null;if(i&&!s)return void alert("Payment configuration error. Please try again.");if(!u.payment_options.find(e=>e.gateway_code===k))return void alert("Payment method not available. Please try again.");let a="Customer";if(null===(e=u.metadata)||void 0===e?void 0:e.client_name)a=u.metadata.client_name;else if(null===(t=u.metadata)||void 0===t?void 0:t.client_details){const e=u.metadata.client_details;e.first_name&&(a=`${e.first_name} ${e.last_name||""}`.trim())}if(o){if(!l)return void alert("Payment service not available. Please try again.");try{m(!0);const e=await l.initiateFixedPayment(u.payment_link_id,k,a);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{m(!1)}return}const c=null===(n=u.metadata)||void 0===n?void 0:n.quote_intent_id,d={...c?{quoteIntentId:c}:{paymentLinkId:u.payment_link_id},paymentLinkId:u.payment_link_id,excessId:(null==s?void 0:s.excess_id)||"",gatewayId:k,calculationId:b||"",clientDetails:{legalName:a},metadata:{payment_link_id:u.payment_link_id,payment_type:c?"quote":"rate",gateway_code:k,gateway:k},...X&&P?{coverStartDate:P}:{}};if("bank_transfer"!==k)w(d),y(!0);else{if(!l)return void alert("Payment service not available. Please try again.");try{m(!0);const e={...d,returnUrl:window.location.href},t=await l.initiatePayment(e,k);if(!(t.bank_account_name&&t.reference&&t.transaction_id))throw new Error("Invalid bank transfer response");L({transactionId:t.transaction_id,organisationId:(null===(r=u.organisation)||void 0===r?void 0:r.id)||""})}catch(e){alert(e.message||"Failed to initiate bank transfer")}finally{m(!1)}}},disabled:!ee,className:yt.create("purchase-button",{width:"100%",height:"3rem",fontSize:ht.fontSize.default,fontWeight:"600"}),children:ee?"Go to Payment":"Select Options to Continue"})]})})]})})]}),g&&v&&l&&Oe(Ps,{isOpen:g,onClose:()=>{y(!1),w(null)},onSuccess:()=>{y(!1),w(null),alert("Payment completed successfully!")},paymentRequest:v,httpClient:l})]})})}function Os({label:e,value:t,isTotal:n=!1,className:r}){return Oe("div",{className:St(yt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Oe("span",{className:yt.create("summary-label",{color:ht.colors.mutedForeground,fontSize:ht.fontSize.small}),children:e}),Oe("span",{className:yt.create("summary-value",{fontWeight:n?"600":"500",color:ht.colors.foreground,fontSize:n?ht.fontSize.large:"inherit"}),children:t})]})}function js({products:e,onSelectProduct:t}){const[n,r]=Ve(null),i=(e,t)=>{t&&(t.preventDefault(),t.stopPropagation()),r(e)};return Oe(Zo,{title:"Select cover",noSubscription:!0,hideHeader:!0,children:Oe(_t,{children:Oe("div",{className:yt.create("product-selection-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Oe("div",{className:yt.create("product-selection-card",{backgroundColor:ht.colors.card,boxShadow:ht.shadow.sm,borderRadius:ht.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Oe("div",{className:yt.create("product-selection-header",{paddingInline:ht.spacing.xl,paddingTop:ht.spacing.xl,paddingBottom:ht.spacing.lg},{"(max-width: 768px)":{paddingInline:ht.spacing.lg,paddingTop:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingTop:ht.spacing.md}}),children:[Oe("h2",{className:yt.create("product-selection-title",{margin:"0",marginBottom:ht.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:ht.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Select Your Cover"}),Oe("p",{className:yt.create("product-selection-description",{margin:"0",fontSize:ht.fontSize.default,lineHeight:"1.6",color:ht.colors.foreground,opacity:"0.9"}),children:"What type of vessel are you insuring?"}),Oe("hr",{className:yt.create("product-selection-header-border",{marginTop:ht.spacing.lg,borderColor:ht.colors.border})})]}),Oe("div",{className:yt.create("product-selection-content",{paddingInline:ht.spacing.xl,paddingBottom:ht.spacing.xl},{"(max-width: 768px)":{paddingInline:ht.spacing.lg,paddingBottom:ht.spacing.lg},"(max-width: 480px)":{paddingInline:ht.spacing.md,paddingBottom:ht.spacing.md}}),children:[0===e.length?Oe("div",{className:yt.create("no-products-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${ht.colors.border}`,borderRadius:ht.radius.default,backgroundColor:ht.colors.muted}),children:[Oe("div",{style:{marginBottom:ht.spacing.default},children:Oe("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{margin:"0 auto",opacity:.5},children:[Oe("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Oe("polyline",{points:"14 2 14 8 20 8"})]})}),Oe("p",{className:yt.create("placeholder-text",{color:ht.colors.mutedForeground,margin:"0"}),children:"No products available for quoting."})]}):Oe("div",{className:yt.create("product-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Oe(As,{product:e,isSelected:(null==n?void 0:n.id)===e.id,onSelect:i},e.id))}),e.length>0&&Oe("div",{className:yt.create("product-selection-actions",{marginTop:ht.spacing.lg}),children:Oe(Jo,{onClick:()=>{n&&t(n)},disabled:!n,className:yt.create("product-selection-continue-button",{width:"100%"}),children:"Continue"})})]})]})})})})}function As({product:e,isSelected:t,onSelect:n}){return Oe("div",{className:St(yt.create("product-option-row",{borderRadius:ht.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?yt.create("product-option-row-selected",{border:`2px solid ${ht.colors.primary}`,backgroundColor:ht.colors.accent}):yt.create("product-option-row-unselected",{border:`2px solid ${ht.colors.border}`,backgroundColor:ht.colors.card})),onClick:t=>n(e,t),role:"button",tabIndex:0,onKeyPress:t=>{"Enter"!==t.key&&" "!==t.key||n(e,t)},children:[Oe(es,{selected:t}),Oe("div",{className:yt.create("product-option-content",{display:"flex",alignItems:"center",justifyContent:"space-between",flex:"1",gap:"1rem"}),children:[Oe("div",{className:yt.create("product-option-info",{display:"flex",flexDirection:"column"}),children:[e.description&&Oe("div",{className:yt.create("product-option-description",{fontSize:ht.fontSize.default,fontWeight:"500",color:ht.colors.foreground}),children:e.description}),Oe("div",{className:yt.create("product-option-name",{fontSize:ht.fontSize.small,color:ht.colors.mutedForeground}),children:e.name})]}),e.icon_svg&&Oe("div",{className:yt.create("product-option-icon",{width:"2.5rem",height:"2.5rem",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",color:t?ht.colors.primary:ht.colors.mutedForeground,transition:"color 150ms ease"}),dangerouslySetInnerHTML:{H:e.icon_svg}})]})]})}function Ws(){var e,t;const n=Tt(),{paymentLinkConfig:r,availableProducts:i,formStateManager:o}=n;if(i&&!o)return Oe(js,{products:i,onSelectProduct:async e=>{localStorage.setItem("insure-os-selected-product",e.code),window.location.reload()}});if(r)return Oe(Rs,{paymentLinkId:r.paymentLinkId,signedUrl:r.signedUrl});const s=new URLSearchParams(window.location.search),a=s.get("pl_ref");if(a)return Oe(Rs,{paymentLinkId:a});const c=window.location.pathname,l=c.match(/\/pay\/([a-f0-9-]+)/);if(l&&l[1])return Oe(Rs,{paymentLinkId:l[1],signedUrl:window.location.href});const u=c.match(/\/payments\/bank-transfer\/([a-f0-9-]+)/),d=s.get("orgId");if(u&&u[1]&&d)return Oe(Ds,{transactionId:u[1],organisationId:d});const{isCalculating:h,results:m,quoteIntent:f}=It(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?Oe(Go,{message:"Processing your quote, please wait..."}):p&&g&&(null===(t=null==f?void 0:f.organisation)||void 0===t?void 0:t.id)?Oe(Ds,{transactionId:g.id,organisationId:f.organisation.id}):y?Oe(Es,{}):m?Oe(gs,{results:m}):Oe(Is,{})}function Ls(e){return Oe(Ct,{...e,children:Oe(Ws,{})})}class Bs extends N{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(e,n){t();try{Promise.resolve().then(function(){return Nd}).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=he("initialization",e,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return we(e)?Oe(Vo,{message:e.message}):Oe(Qo,{error:e})}return this.props.children}}function Fs({config:e,initializeFormContext:n}){const[r,i]=Ve({type:"loading",message:"Loading application..."});return Ke(()=>{(async()=>{try{t();const r=await n(e),o=r.availableProducts&&r.availableProducts.length>0;if(!("payment"===e.mode||r.paymentLinkConfig||o||r.formStateManager&&"function"==typeof r.formStateManager.getFormProgress))throw new Error("FormStateManager was not properly initialized");t(),i({type:"success",formContextProps: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?he("maintenance",e):he("initialization",e),t((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[e,n]),Oe(Bs,{children:Oe("div",{className:yt.create("root",{fontFamily:ht.fontFamily,backgroundColor:ht.colors.background,minHeight:"100vh",color:ht.colors.foreground}),children:function(){switch(r.type){case"loading":return Oe(Go,{message:r.message});case"error":return we(r.error)?Oe(Vo,{message:r.error.message}):Oe(Qo,{error:r.error});case"success":return Oe(Ls,{...r.formContextProps});default:return Oe(Qo,{})}}()})})}const qs="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Hs=globalThis,Us="10.17.0";function Zs(){return Ys(Hs),Hs}function Ys(e){const t=e.oe=e.oe||{};return t.version=t.version||Us,t[Us]=t[Us]||{}}function Gs(e,t,n=Hs){const r=n.oe=n.oe||{},i=r[Us]=r[Us]||{};return i[e]||(i[e]=t())}const Js=["debug","info","warn","error","log","assert","trace"],Qs={};function Vs(e){if(!("console"in Hs))return e();const t=Hs.console,n={},r=Object.keys(Qs);r.forEach(e=>{const r=Qs[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Ks(){return ea().enabled}function Xs(e,...t){qs&&Ks()&&Vs(()=>{Hs.console[e](`Sentry Logger [${e}]:`,...t)})}function ea(){return qs?Gs("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const ta=function(){ea().enabled=!0},na=function(...e){Xs("log",...e)},ra=function(...e){Xs("warn",...e)},ia=function(...e){Xs("error",...e)},oa="?",sa=/\(error: (.*)\)/,aa=/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=sa.test(n)?n.replace(sa,"$1"):n;if(!s.match(/\S*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(la(t).function||"")&&t.pop(),t.reverse(),aa.test(la(t).function||"")&&(t.pop(),aa.test(la(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||la(t).filename,function:e.function||oa}))}(i.slice(r))}}function la(e){return e[e.length-1]||{}}const ua="<anonymous>";function da(e){try{return e&&"function"==typeof e&&e.name||ua}catch{return ua}}function ha(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}}}const ma={},fa={};function pa(e,t){ma[e]=ma[e]||[],ma[e].push(t)}function ga(e,t){if(!fa[e]){fa[e]=!0;try{t()}catch(t){qs&&ia(`Error while instrumenting ${e}`,t)}}}function ya(e,t){const n=e&&ma[e];if(n)for(const r of n)try{r(t)}catch(t){qs&&ia(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${da(r)}\nError:`,t)}}let va=null;function wa(){va=Hs.onerror,Hs.onerror=function(e,t,n,r,i){return ya("error",{column:r,error:i,line:n,msg:e,url:t}),!!va&&va.apply(this,arguments)},Hs.onerror.se=!0}let ba=null;function xa(){ba=Hs.onunhandledrejection,Hs.onunhandledrejection=function(e){return ya("unhandledrejection",e),!ba||ba.apply(this,arguments)},Hs.onunhandledrejection.se=!0}const ka={}.toString;function Sa(e){switch(ka.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Ma(e,Error)}}function Na(e,t){return ka.call(e)===`[object ${t}]`}function _a(e){return Na(e,"ErrorEvent")}function $a(e){return Na(e,"DOMError")}function Ca(e){return Na(e,"String")}function Ta(e){return"object"==typeof e&&null!==e&&"ae"in e&&"ce"in e}function Ia(e){return null===e||Ta(e)||"object"!=typeof e&&"function"!=typeof e}function Ea(e){return Na(e,"Object")}function Pa(e){return"undefined"!=typeof Event&&Ma(e,Event)}function Da(e){return Boolean(e?.then&&"function"==typeof e.then)}function Ma(e,t){try{return e instanceof t}catch{return!1}}function za(e){return!("object"!=typeof e||null===e||!e.le&&!e.ue)}const Ra=Hs;function Oa(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,s=0;const a=" > ",c=a.length;let l;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(l=ja(n,u),!("html"===l||o>1&&s+i.length*c+l.length>=d));)i.push(l),s+=l.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function ja(e,t){const n=e,r=[];if(!n?.tagName)return"";if(Ra.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&&Ca(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}const o=["aria-label","type","name","title","alt"];for(const e of o){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}function Aa(){try{return Ra.document.location.href}catch{return""}}function Wa(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function La(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{za(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Ba(e,t,n=!1){return!!Ca(e)&&(Na(t,"RegExp")?t.test(e):!!Ca(t)&&(n?e===t:e.includes(t)))}function Fa(e,t=[],n=!1){return t.some(t=>Ba(e,t,n))}function qa(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Ua(i,r);try{e[t]=i}catch{qs&&na(`Failed to replace method "${t}" in object`,e)}}function Ha(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{qs&&na(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ua(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Ha(e,"__sentry_original__",t)}catch{}}function Za(e){return e.de}function Ya(e){if(Sa(e))return{message:e.message,name:e.name,stack:e.stack,...Ja(e)};if(Pa(e)){const t={type:e.type,target:Ga(e.target),currentTarget:Ga(e.currentTarget),...Ja(e)};return"undefined"!=typeof CustomEvent&&Ma(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Ga(e){try{return"undefined"!=typeof Element&&Ma(e,Element)?Oa(e):{}.toString.call(e)}catch{return"<unknown>"}}function Ja(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)({}).hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function Qa(e=function(){const e=Hs;return e.crypto||e.msCrypto}()){let t=()=>16*Math.random();try{if(e?.randomUUID)return e.randomUUID().replace(/-/g,"");e?.getRandomValues&&(t=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,e=>(e^(15&t())>>e/4).toString(16))}function Va(e){return e.exception?.values?.[0]}function Ka(e){const{message:t,event_id:n}=e;if(t)return t;const r=Va(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Xa(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 ec(e,t){const n=Va(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 tc(e){if(function(e){try{return e.he}catch{}}(e))return!0;try{Ha(e,"__sentry_captured__",!0)}catch{}return!1}function nc(){return Date.now()/1e3}let rc;function ic(){return(rc??(rc=function(){const{performance:e}=Hs;if(!e?.now||!e.timeOrigin)return nc;const t=e.timeOrigin;return()=>(t+e.now())/1e3}()))()}function oc(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||ic(),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:Qa()),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 sc(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]=sc(r[e],t[e],n-1));return r}function ac(){return Qa()}function cc(){return Qa().substring(16)}const lc="_sentrySpan";function uc(e,t){t?Ha(e,lc,t):delete e[lc]}function dc(e){return e[lc]}class hc{constructor(){this.me=!1,this.fe=[],this.pe=[],this.ge=[],this.ye=[],this.ve={},this.we={},this.be={},this.xe={},this.ke={},this.Se={traceId:ac(),sampleRand:Math.random()}}clone(){const e=new hc;return e.ge=[...this.ge],e.we={...this.we},e.be={...this.be},e.xe={...this.xe},this.xe.flags&&(e.xe.flags={values:[...this.xe.flags.values]}),e.ve=this.ve,e.Ne=this.Ne,e._e=this._e,e.$e=this.$e,e.Ce=this.Ce,e.pe=[...this.pe],e.ye=[...this.ye],e.ke={...this.ke},e.Se={...this.Se},e.Te=this.Te,e.Ie=this.Ie,uc(e,dc(this)),e}setClient(e){this.Te=e}setLastEventId(e){this.Ie=e}getClient(){return this.Te}lastEventId(){return this.Ie}addScopeListener(e){this.fe.push(e)}addEventProcessor(e){return this.pe.push(e),this}setUser(e){return this.ve=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._e&&oc(this._e,{user:e}),this.Ee(),this}getUser(){return this.ve}setTags(e){return this.we={...this.we,...e},this.Ee(),this}setTag(e,t){return this.we={...this.we,[e]:t},this.Ee(),this}setExtras(e){return this.be={...this.be,...e},this.Ee(),this}setExtra(e,t){return this.be={...this.be,[e]:t},this.Ee(),this}setFingerprint(e){return this.Ce=e,this.Ee(),this}setLevel(e){return this.Ne=e,this.Ee(),this}setTransactionName(e){return this.$e=e,this.Ee(),this}setContext(e,t){return null===t?delete this.xe[e]:this.xe[e]=t,this.Ee(),this}setSession(e){return e?this._e=e:delete this._e,this.Ee(),this}getSession(){return this._e}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof hc?t.getScopeData():Ea(t)?e:void 0,{tags:r,extra:i,user:o,contexts:s,level:a,fingerprint:c=[],propagationContext:l}=n||{};return this.we={...this.we,...r},this.be={...this.be,...i},this.xe={...this.xe,...s},o&&Object.keys(o).length&&(this.ve=o),a&&(this.Ne=a),c.length&&(this.Ce=c),l&&(this.Se=l),this}clear(){return this.ge=[],this.we={},this.be={},this.ve={},this.xe={},this.Ne=void 0,this.$e=void 0,this.Ce=void 0,this._e=void 0,uc(this,void 0),this.ye=[],this.setPropagationContext({traceId:ac(),sampleRand:Math.random()}),this.Ee(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:nc(),...e,message:e.message?Wa(e.message,2048):e.message};return this.ge.push(r),this.ge.length>n&&(this.ge=this.ge.slice(-n),this.Te?.recordDroppedEvent("buffer_overflow","log_item")),this.Ee(),this}getLastBreadcrumb(){return this.ge[this.ge.length-1]}clearBreadcrumbs(){return this.ge=[],this.Ee(),this}addAttachment(e){return this.ye.push(e),this}clearAttachments(){return this.ye=[],this}getScopeData(){return{breadcrumbs:this.ge,attachments:this.ye,contexts:this.xe,tags:this.we,extra:this.be,user:this.ve,level:this.Ne,fingerprint:this.Ce||[],eventProcessors:this.pe,propagationContext:this.Se,sdkProcessingMetadata:this.ke,transactionName:this.$e,span:dc(this)}}setSDKProcessingMetadata(e){return this.ke=sc(this.ke,e,2),this}setPropagationContext(e){return this.Se=e,this}getPropagationContext(){return this.Se}captureException(e,t){const n=t?.event_id||Qa();if(!this.Te)return qs&&ra("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Te.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||Qa();if(!this.Te)return qs&&ra("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this.Te.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t?.event_id||Qa();return this.Te?(this.Te.captureEvent(e,{...t,event_id:n},this),n):(qs&&ra("No client configured on scope - will not capture event!"),n)}Ee(){this.me||(this.me=!0,this.fe.forEach(e=>{e(this)}),this.me=!1)}}class mc{constructor(e,t){let n,r;n=e||new hc,r=t||new hc,this.Pe=[{scope:n}],this.De=r}withScope(e){const t=this.Me();let n;try{n=e(t)}catch(e){throw this.ze(),e}return Da(n)?n.then(e=>(this.ze(),e),e=>{throw this.ze(),e}):(this.ze(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.De}getStackTop(){return this.Pe[this.Pe.length-1]}Me(){const e=this.getScope().clone();return this.Pe.push({client:this.getClient(),scope:e}),e}ze(){return!(this.Pe.length<=1||!this.Pe.pop())}}function fc(){const e=Ys(Zs());return e.stack=e.stack||new mc(Gs("defaultCurrentScope",()=>new hc),Gs("defaultIsolationScope",()=>new hc))}function pc(e){return fc().withScope(e)}function gc(e,t){const n=fc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function yc(e){return fc().withScope(()=>e(fc().getIsolationScope()))}function vc(e){const t=Ys(e);return t.acs?t.acs:{withIsolationScope:yc,withScope:pc,withSetScope:gc,withSetIsolationScope:(e,t)=>yc(t),getCurrentScope:()=>fc().getScope(),getIsolationScope:()=>fc().getIsolationScope()}}function wc(){return vc(Zs()).getCurrentScope()}function bc(){return vc(Zs()).getIsolationScope()}function xc(...e){const t=vc(Zs());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function kc(){return wc().getClient()}function Sc(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||cc()};return r&&(o.parent_span_id=r),o}const Nc="sentry.profile_id",_c="sentry.exclusive_time";function $c(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function Cc(e){const t=e;return{scope:t.Re,isolationScope:$c(t.Oe)}}const Tc=/^sentry-/;function Ic(e){return e.split(",").map(e=>e.split("=").map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const Ec=/^o(\d+)\./,Pc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Dc(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function Mc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function zc(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(Ec);return t?.[1]}(n)),r}let Rc=!1;function Oc(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Lc(e).parent_span_id,o=Cc(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||cc():t,trace_id:n}}function jc(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 Ac(e){return"number"==typeof e?Wc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Wc(e.getTime()):ic()}function Wc(e){return e>9999999999?e/1e3:e}function Lc(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:c}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0,start_timestamp:Ac(i),timestamp:Ac(s)||void 0,status:Bc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:jc(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Bc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"unknown_error"}function Fc(e){return e.je||e}function qc(){Rc||(Vs(()=>{}),Rc=!0)}function Hc(e){na(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Uc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(Yc(n)){if(Ba(e.description,n))return qs&&Hc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||Ba(e.description,n.name),r=!n.op||e.op&&Ba(e.op,n.op);if(t&&r)return qs&&Hc(e),!0}return!1}function Zc(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 Yc(e){return"string"==typeof e||e instanceof RegExp}const Gc="production";function Jc(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Gc,release:n.release,public_key:r,trace_id:e,org_id:zc(t)};return t.emit("createDsc",i),i}function Qc(e){const t=kc();if(!t)return{};const n=Fc(e),r=Lc(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 c=n.Ae;if(c)return a(c);const l=o?.get("sentry.dsc"),u=l&&function(e){const t=function(e){if(e&&(Ca(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=Ic(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Ic(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.match(Tc)&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(l);if(u)return a(u);const d=Jc(e.spanContext().traceId,t),h=i["sentry.source"],m=r.description;return"url"!==h&&m&&(d.transaction=m),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const e=kc()?.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")??Cc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}function Vc(e,t=100,n=1/0){try{return Xc("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Kc(e,t=3,n=102400){const r=Vc(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?Kc(e,t-1,n):r;var i}function Xc(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.We)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(za(t))return"[VueViewModel]";if(Ea(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: ${da(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.Le)return t;const c="number"==typeof t.Be?t.Be:n;if(0===c)return a.replace("object ","");if(o(t))return"[Circular ~]";const l=t;if(l&&"function"==typeof l.toJSON)try{return Xc("",l.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=Ya(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]=Xc(e,t,c-1,r,i),d++}return s(t),u}function el(e,t=[]){return[e,t]}function tl(e,t){const[n,r]=e;return[n,[...r,t]]}function nl(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function rl(e){const t=Ys(Hs);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function il(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[rl(r),e]:r.push("string"==typeof e?rl(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(Vc(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 ol(e){const t="string"==typeof e.data?rl(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const sl={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function al(e){return sl[e]}function cl(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function ll(e){return new dl(t=>{t(e)})}function ul(e){return new dl((t,n)=>{n(e)})}class dl{constructor(e){this.Fe=0,this.qe=[],this.He(e)}then(e,t){return new dl((n,r)=>{this.qe.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.Ue()})}catch(e){return this.then(e=>e,e)}finally(e){return new dl((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)})})}Ue(){if(0===this.Fe)return;const e=this.qe.slice();this.qe=[],e.forEach(e=>{e[0]||(1===this.Fe&&e[1](this.Ze),2===this.Fe&&e[2](this.Ze),e[0]=!0)})}He(e){const t=(e,t)=>{0===this.Fe&&(Da(t)?t.then(n,r):(this.Fe=e,this.Ze=t,this.Ue()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}}function hl(e,t,n,r=0){try{const i=ml(t,n,e,r);return Da(i)?i:ll(i)}catch(e){return ul(e)}}function ml(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return qs&&null===o&&na(`Event processor "${i.id||"?"}" dropped event`),Da(o)?o.then(e=>ml(e,t,n,r+1)):ml(o,t,n,r+1)}function fl(e,t){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:h,transactionName:m,span:f}=t;pl(e,"extra",n),pl(e,"tags",r),pl(e,"user",i),pl(e,"contexts",o),e.sdkProcessingMetadata=sc(e.sdkProcessingMetadata,a,2),s&&(e.level=s),m&&(e.transactionName=m),f&&(e.span=f),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),l.length&&(e.fingerprint=[...e.fingerprint,...l]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function pl(e,t,n){e[t]=sc(e[t],n,1)}let gl,yl,vl;function wl(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||Qa(),timestamp:t.timestamp||nc()},l=n.integrations||e.integrations.map(e=>e.name);!function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o=250}=t;e.environment=e.environment||n||Gc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&(s.url=Wa(s.url,o))}(c,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(c,l),i&&i.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=Hs.Ye;if(!t)return{};const n=Object.keys(t);return vl&&n.length===yl||(yl=n.length,vl=n.reduce((n,r)=>{gl||(gl={});const i=gl[r];if(i)n[i[0]]=i[1];else{const i=e(r);for(let e=i.length-1;e>=0;e--){const o=i[e],s=o?.filename,a=t[r];if(s&&a){n[s]=a,gl[r]=[s,a];break}}}return n},{})),vl}(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}(c,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new hc;return n.update(t),n}(r,n.captureContext);n.mechanism&&ec(c,n.mechanism);const d=i?i.getEventProcessors():[],h=Gs("globalScope",()=>new hc).getScopeData();o&&fl(h,o.getScopeData()),u&&fl(h,u.getScopeData());const m=[...n.attachments||[],...h.attachments];return 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:Oc(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Qc(t),...e.sdkProcessingMetadata};const n=Lc(Fc(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)}(c,h),hl([...d,...h.eventProcessors],c,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:Vc(e.data,t,n)}}))},...e.user&&{user:Vc(e.user,t,n)},...e.contexts&&{contexts:Vc(e.contexts,t,n)},...e.extra&&{extra:Vc(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Vc(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Vc(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Vc(e.contexts.flags,3,n)),r}(e,s,a):e))}function bl(e){return wc().captureException(e,void 0)}function xl(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return wc().captureMessage(e,n,r)}function kl(e,t){return wc().captureEvent(e,t)}function Sl(e){const t=bc(),n=wc(),{userAgent:r}=Hs.navigator||{},i=function(e){const t=ic(),n={sid:Qa(),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&&oc(n,e),n}({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&oc(o,{status:"exited"}),Nl(),t.setSession(i),i}function Nl(){const e=bc(),t=wc().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),oc(e,t)}(t),_l(),e.setSession()}function _l(){const e=bc(),t=kc(),n=e.getSession();n&&t&&t.captureSession(n)}function $l(e=!1){e?Nl():_l()}const Cl=[];function Tl(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 Il(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function El(e,t,n){if(n[t.name])qs&&na(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===Cl.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),Cl.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)}qs&&na(`Integration installed: ${t.name}`)}}function Pl(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 Dl="Not capturing exception because it's already been captured.",Ml="Discarded session because of missing or non-string release",zl=Symbol.for("SentryInternalError"),Rl=Symbol.for("SentryDoNotSendEventError");function Ol(e){return{message:e,[zl]:!0}}function jl(e){return{message:e,[Rl]:!0}}function Al(e){return!!e&&"object"==typeof e&&zl in e}function Wl(e){return!!e&&"object"==typeof e&&Rl in e}class Ll{constructor(e){if(this.Ge=e,this.Je={},this.Qe=0,this.Ve={},this.Ke={},this.pe=[],e.dsn?this.Xe=function(e){const t="string"==typeof e?function(e){const t=Pc.exec(e);if(!t)return void Vs(()=>{});const[n,r,i="",o="",s="",a=""]=t.slice(1);let c="",l=a;const u=l.split("/");if(u.length>1&&(c=u.slice(0,-1).join("/"),l=u.pop()),l){const e=l.match(/^\d+/);e&&(l=e[0])}return Mc({host:o,pass:i,path:c,projectId:l,port:s,protocol:n,publicKey:r})}(e):Mc(e);if(t&&function(e){if(!qs)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(ia(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(ia(`Invalid Sentry Dsn: Invalid port ${t}`),1):(ia(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(ia(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):qs&&ra("No DSN provided, client will not send events."),this.Xe){const i=(t=this.Xe,n=e.tunnel,r=e.et?e.et.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.nt=e.transport({tunnel:this.Ge.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:i})}var t,n,r}captureException(e,t,n){const r=Qa();if(tc(e))return qs&&na(Dl),r;const i={event_id:r,...t};return this.rt(this.eventFromException(e,i).then(e=>this.it(e,i,n))),i.event_id}captureMessage(e,t,n,r){const i={event_id:Qa(),...n},o=Ta(e)?e:String(e),s=Ia(e)?this.eventFromMessage(o,t,i):this.eventFromException(e,i);return this.rt(s.then(e=>this.it(e,i,r))),i.event_id}captureEvent(e,t,n){const r=Qa();if(t?.originalException&&tc(t.originalException))return qs&&na(Dl),r;const i={event_id:r,...t},o=e.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope;return this.rt(this.it(e,i,s||n,a)),i.event_id}captureSession(e){this.sendSession(e),oc(e,{init:!1})}getDsn(){return this.Xe}getOptions(){return this.Ge}getSdkMetadata(){return this.Ge.et}getTransport(){return this.nt}async flush(e){const t=this.nt;if(!t)return!0;this.emit("flush");const n=await this.ot(e),r=await t.flush(e);return n&&r}async close(e){const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this.pe}addEventProcessor(e){this.pe.push(e)}init(){(this.st()||this.Ge.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this.ct()}getIntegrationByName(e){return this.Je[e]}addIntegration(e){const t=this.Je[e.name];El(this,e,this.Je),t||Il(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=cl(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:Dc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,el(s,[[{type:o},e]])}(e,this.Xe,this.Ge.et,this.Ge.tunnel);for(const e of t.attachments||[])n=tl(n,ol(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=Gc}=this.Ge;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(qs&&ra(Ml));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(qs&&ra(Ml));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=cl(n);return el({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Dc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.Xe,this.Ge.et,this.Ge.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.Ge.sendClientReports){const r=`${e}:${t}`;qs&&na(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.Ve[r]=(this.Ve[r]||0)+n}}on(e,t){const n=this.Ke[e]=this.Ke[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this.Ke[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this.st()&&this.nt)try{return await this.nt.send(e)}catch(e){return qs&&ia("Error while sending envelope:",e),{}}return qs&&ia("Transport disabled"),{}}ct(){const{integrations:e}=this.Ge;this.Je=function(e,t){const n={};return t.forEach(t=>{t&&El(e,t,n)}),n}(this,e),Il(this,e)}lt(e,t){let n="fatal"===t.level,r=!1;const i=t.exception?.values;if(i){r=!0;for(const e of i){const t=e.mechanism;if(!1===t?.handled){n=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(oc(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}async ot(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this.Qe)return!0;t++}return!1}st(){return!1!==this.getOptions().enabled&&void 0!==this.nt}ut(e,t,n,r){const i=this.getOptions(),o=Object.keys(this.Je);return!t.integrations&&o?.length&&(t.integrations=o),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),wl(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:Sc(n),...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||Jc(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}it(e,t={},n=wc(),r=bc()){return qs&&Bl(e)&&na(`Captured error event \`${Pl(e)[0]||"<unknown>"}\``),this.ht(e,t,n,r).then(e=>e.event_id,e=>{qs&&(Wl(e)?na(e.message):Al(e)?ra(e.message):ra(e))})}ht(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Fl(e),a=Bl(e),c=e.type||"error",l=`before send for type \`${c}\``,u=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 u&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),ul(jl(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d="replay_event"===c?"replay":c;return this.ut(e,t,n,r).then(e=>{if(null===e)throw this.recordDroppedEvent("event_processor",d),jl("An event processor returned `null`, will not send event.");if(t.data&&!0===t.data.ft)return e;const n=function(e,t,n,r){const{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s,ignoreSpans:a}=t;let c=n;if(Bl(c)&&i)return i(c,r);if(Fl(c)){if(s||a){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?.[Nc],exclusive_time:s?.[_c],measurements:e.measurements,is_segment:!0}}(c);if(a?.length&&Uc(t,a))return null;if(s){const e=s(t);e?c=sc(n,{type:"transaction",timestamp:(l=e).timestamp,start_timestamp:l.start_timestamp,transaction:l.description,contexts:{trace:{trace_id:l.trace_id,span_id:l.span_id,parent_span_id:l.parent_span_id,op:l.op,status:l.status,origin:l.origin,data:{...l.data,...l.profile_id&&{[Nc]:l.profile_id},...l.exclusive_time&&{[_c]:l.exclusive_time}}}},measurements:l.measurements}):qc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(a?.length&&Uc(e,a))Zc(n,e);else if(s){const n=s(e);n?t.push(n):(qc(),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 l;return c}(this,i,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Da(e))return e.then(e=>{if(!Ea(e)&&null!==e)throw Ol(n);return e},e=>{throw Ol(`${t} rejected with ${e}`)});if(!Ea(e)&&null!==e)throw Ol(n);return e}(n,l)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",d),s){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw jl(`${l} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.lt(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(Wl(e)||Al(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{ft:!0},originalException:e}),Ol(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)})}rt(e){this.Qe++,e.then(e=>(this.Qe--,e),e=>(this.Qe--,e))}gt(){const e=this.Ve;return this.Ve={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}yt(){qs&&na("Flushing outcomes...");const e=this.gt();if(0===e.length)return void(qs&&na("No outcomes to send"));if(!this.Xe)return void(qs&&na("No dsn provided, will not send outcomes"));qs&&na("Sending outcomes:",e);const t=(n=e,el((r=this.Ge.tunnel&&Dc(this.Xe))?{dsn:r}:{},[[{type:"client_report"},{timestamp:nc(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function Bl(e){return void 0===e.type}function Fl(e){return"transaction"===e.type}function ql(e){const t=function(e){return Hl().get(e)}(e)??[];if(0===t.length)return;const n=e.getOptions(),r=function(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Dc(r)),el(i,[(o=e,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(t,n.et,n.tunnel,e.getDsn());Hl().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(r)}function Hl(){return Gs("clientToLogBufferMap",()=>new WeakMap)}const Ul=Symbol.for("SentryBufferFullError");function Zl(e,t,n=function(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 ul(Ul);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return ll(!0);const n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;const r=[n,new Promise(t=>setTimeout(()=>t(!1),e))];return Promise.race(r)}}}(e.bufferSize||64)){let r={};return{send:function(i){const o=[];if(nl(i,(t,n)=>{const i=al(n);!function(e,t,n=Date.now()){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=el(i[0],o),a=t=>{nl(s,(n,r)=>{e.recordDroppedEvent(t,al(r))})};return n.add(()=>t({body:il(s)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&qs&&ra(`Sentry responded with status code ${e.statusCode} to sent event.`),r=function(e,{statusCode:t,headers:n},r=Date.now()){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=Date.now()){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"),qs&&ia("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Ul)return qs&&ia("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function Yl(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 Gl(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 Jl=100;function Ql(e,t){const n=kc(),r=bc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Jl}=n.getOptions();if(o<=0)return;const s={timestamp:nc(),...e},a=i?Vs(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let Vl;const Kl=new WeakMap,Xl=()=>({name:"FunctionToString",setupOnce(){Vl=function(){}.toString;try{Function.prototype.toString=function(...e){const t=Za(this),n=Kl.has(kc())&&void 0!==t?t:this;return Vl.apply(n,e)}}catch{}},setup(e){Kl.set(e,!0)}}),eu=[/^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. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],tu=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=ru(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=ru(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&&Fa(n,t)}(e,t.ignoreTransactions))return qs&&ra(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Ka(e)}`),!0}else{if(function(e,t){return!!t?.length&&Pl(e).some(e=>Fa(e,t))}(e,t.ignoreErrors))return qs&&ra(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Ka(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 qs&&ra(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Ka(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=iu(e);return!!n&&Fa(n,t)}(e,t.denyUrls))return qs&&ra(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Ka(e)}.\nUrl: ${iu(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=iu(e);return!n||Fa(n,t)}(e,t.allowUrls))return qs&&ra(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Ka(e)}.\nUrl: ${iu(e)}`),!0}return!1}(n,t)?null:n}}},nu=(e={})=>({...tu(e),name:"InboundFilters"});function ru(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:eu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function iu(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 qs&&ia(`Cannot extract url for event ${Ka(e)}`),null}}function ou(e,t,n,r,i,o){if(!i.exception?.values||!o||!Ma(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=su(e,t,r,o.originalException,n,i.exception.values,s,0))}function su(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(Ma(r[i],Error)){au(s,a);const o=e(t,r[i]),l=c.length;cu(o,i,l,a),c=su(e,t,n,r[i],i,[o,...c],o,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(Ma(r,Error)){au(s,a);const l=e(t,r),u=c.length;cu(l,`errors[${o}]`,u,a),c=su(e,t,n,r,i,[l,...c],l,u)}}),c}function au(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function cu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function lu(){"console"in Hs&&Js.forEach(function(e){e in Hs.console&&qa(Hs.console,e,function(t){return Qs[e]=t,function(...t){ya("console",{args:t,level:e});const n=Qs[e];n?.apply(Hs.console,t)}})})}const uu=()=>{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&&(!!hu(e,t)&&!!du(e,t))))}(e,t)||!!function(e,t){const n=mu(t),r=mu(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!hu(e,t)&&!!du(e,t)))}(e,t))}(t,e))return qs&&ra("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function du(e,t){let n=ha(e),r=ha(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 hu(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 mu(e){return e.exception?.values?.[0]}function fu(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const pu=Hs;function gu(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function yu(e,t){const n="fetch";pa(n,e),ga(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in pu))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(gu(pu.fetch))return!0;let e=!1;const t=pu.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=gu(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){qs&&ra("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||qa(Hs,"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:wu(t),method:vu(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:wu(t),method:vu(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*ic(),virtualError:n,headers:bu(t)};return ya("fetch",{...o}),e.apply(Hs,t).then(async e=>(ya("fetch",{...o,endTimestamp:1e3*ic(),response:e}),e),e=>{if(ya("fetch",{...o,endTimestamp:1e3*ic(),error:e}),Sa(e)&&void 0===e.stack&&(e.stack=n.stack,Ha(e,"framesToPop",1)),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);e.message=`${e.message} (${t.host})`}catch{}throw e})}})}(0,t))}function vu(e,t){return!!e&&"object"==typeof e&&!!e[t]}function wu(e){return"string"==typeof e?e:e?vu(e,"url")?e.url:e.toString?e.toString():"":""}function bu(e){const[t,n]=e;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if("undefined"!=typeof Request&&Ma(t,Request))return new Headers(t.headers)}catch{}}const xu=Hs;let ku=0;function Su(){return ku>0}function Nu(e,t={}){if(!function(e){return"function"==typeof e}(e))return e;try{const t=e.vt;if(t)return"function"==typeof t?t:e;if(Za(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>Nu(e,t));return e.apply(this,r)}catch(e){throw ku++,setTimeout(()=>{ku--}),xc(r=>{r.addEventProcessor(e=>(t.mechanism&&(Xa(e,void 0),ec(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),bl(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Ua(n,e),Ha(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function _u(e,t){const n=Cu(e,t),r={type:Eu(t),value:Pu(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function $u(e,t){return{exception:{values:[_u(e,t)]}}}function Cu(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&Tu.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 Tu=/Minified React error #\d+;/i;function Iu(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function Eu(e){const t=e?.name;return!t&&Iu(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function Pu(e){const t=e?.message;return Iu(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function Du(e,t,n,r,i){let o;if(_a(t)&&t.error)return $u(e,t.error);if($a(t)||Na(t,"DOMException")){const i=t;if("stack"in t)o=$u(e,t);else{const t=i.name||($a(i)?"DOMError":"DOMException"),s=i.message?`${t}: ${i.message}`:t;o=Mu(e,s,n,r),Xa(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Sa(t)?$u(e,t):Ea(t)||Pa(t)?(o=function(e,t,n,r){const i=kc(),o=i?.getOptions().normalizeDepth,s=function(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}(t),a={wt:Kc(t,o)};if(s)return{exception:{values:[_u(e,s)]},extra:a};const c={exception:{values:[{type:Pa(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:zu(t,{isUnhandledRejection:r})}]},extra:a};if(n){const t=Cu(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),ec(o,{synthetic:!0}),o):(o=Mu(e,t,n,r),Xa(o,`${t}`),ec(o,{synthetic:!0}),o)}function Mu(e,t,n,r){const i={};if(r&&n){const r=Cu(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),ec(i,{synthetic:!0})}if(Ta(t)){const{ae:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function zu(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(Ya(e));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=t)return Wa(r,t);for(let e=n.length;e>0;e--){const r=n.slice(0,e).join(", ");if(!(r.length>t))return e===n.length?r:Wa(r,t)}return""}(e),r=t?"promise rejection":"exception";return _a(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Pa(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 Ru extends Ll{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:xu.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(e,t,n=[t],r="npm"){const i=e.et||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:n.map(e=>({name:`${r}:@sentry/${e}`,version:Us})),version:Us}),e.et=i}(t,"browser",["browser"],xu.SENTRY_SDK_SOURCE||"npm"),t.et?.sdk&&(t.et.sdk.settings={infer_ip:t.sendDefaultPii?"auto":"never",...t.et.sdk.settings}),super(t);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o}=this.Ge;xu.document&&(i||o)&&xu.document.addEventListener("visibilitychange",()=>{"hidden"===xu.document.visibilityState&&(i&&this.yt(),o&&ql(this))}),o&&(this.on("flush",()=>{ql(this)}),this.on("afterCaptureLog",()=>{this.bt&&clearTimeout(this.bt),this.bt=setTimeout(()=>{ql(this)},5e3)})),r&&this.on("beforeSendSession",Gl)}eventFromException(e,t){return function(e,t,n,r){const i=Du(e,t,n?.syntheticException||void 0,r);return ec(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),ll(i)}(this.Ge.stackParser,e,t,this.Ge.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=Mu(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),ll(o)}(this.Ge.stackParser,e,t,n,this.Ge.attachStacktrace)}ut(e,t,n,r){return e.platform=e.platform||"javascript",super.ut(e,t,n,r)}}const Ou="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ju=Hs;let Au,Wu,Lu,Bu;function Fu(){if(!ju.document)return;const e=ya.bind(null,"dom"),t=qu(e,!0);ju.document.addEventListener("click",t,!1),ju.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=ju,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(qa(r,"addEventListener",function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.xt=this.xt||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=qu(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),qa(r,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this.xt||{},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.xt)}catch{}return e.call(this,t,n,r)}}))})}function qu(e,t=!1){return n=>{if(!n||n.kt)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;Ha(n,"_sentryCaptured",!0),r&&!r.St&&Ha(r,"_sentryId",Qa());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==Wu)return!1;try{if(!e.target||e.target.St!==Lu)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),Wu=n.type,Lu=r?r.St:void 0),clearTimeout(Au),Au=ju.setTimeout(()=>{Lu=void 0,Wu=void 0},1e3)}}function Hu(e){const t="history";pa(t,e),ga(t,Uu)}function Uu(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Bu,i=function(e){try{return new URL(e,ju.location.origin).toString()}catch{return e}}(String(n));if(Bu=i,r===i)return e.apply(this,t);ya("history",{from:r,to:i})}return e.apply(this,t)}}ju.addEventListener("popstate",()=>{const e=ju.location.href,t=Bu;Bu=e,t!==e&&ya("history",{from:t,to:e})}),"history"in pu&&pu.history&&(qa(ju.history,"pushState",e),qa(ju.history,"replaceState",e))}const Zu={},Yu="__sentry_xhr_v3__";function Gu(){if(!ju.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*ic(),o=Ca(n[0])?n[0].toUpperCase():void 0,s=function(e){if(Ca(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[Yu]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.Nt=!0);const a=()=>{const e=t[Yu];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}ya("xhr",{endTimestamp:1e3*ic(),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[Yu];return o&&Ca(r)&&Ca(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[Yu];return r?(void 0!==n[0]&&(r.body=n[0]),ya("xhr",{startTimestamp:1e3*ic(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function Ju(e,t=function(e){const t=Zu[e];if(t)return t;let n=ju[e];if(gu(n))return Zu[e]=n.bind(ju);const r=ju.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){Ou&&ra(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?Zu[e]=n.bind(ju):n}("fetch")){let n=0,r=0;return Zl(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 Zu.fetch=void 0,e}finally{n-=o,r--}})}function Qu(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?oa:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Vu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ku=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Xu=/\((\S*)(?::(\d+))(?::(\d+))\)/,ed=/at (.+?) ?\(data:(.+?),/,td=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,nd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,rd=ca([30,e=>{const t=e.match(ed);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=Vu.exec(e);if(n){const[,e,t,r]=n;return Qu(e,oa,+t,+r)}const r=Ku.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=Xu.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=id(r[1]||oa,r[2]);return Qu(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=td.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=nd.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]||oa;return[n,e]=id(n,e),Qu(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),id=(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]:oa,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},od="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,sd=(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";pa(t,e),ga(t,lu)}(function(e){return function(t){if(kc()!==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:La(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${La(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Ql(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(kc()!==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&&(od&&ra(`\`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=Oa(t,{keyAttrs:o,maxStringLength:s}),i=function(e){if(!Ra.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}),Ql(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),pa("dom",n),ga("dom",Fu)),t.xhr&&function(e){pa("xhr",e),ga("xhr",Gu)}(function(e){return function(t){if(kc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Yu];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:c}=i,l={method:o,url:s,status_code:a},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:l,type:"http",level:fu(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),Ql(d,u)}}(e)),t.fetch&&yu(function(e){return function(t){if(kc()!==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=t.fetchData,o={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:i,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",s,o),Ql(s,o)}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:fu(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),Ql(a,s)}}}(e)),t.history&&Hu(function(e){return function(t){if(kc()!==e)return;let n=t.from,r=t.to;const i=Yl(xu.location.href);let o=n?Yl(n):void 0;const s=Yl(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),Ql({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){kc()===e&&Ql({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Ka(t)},{event:t})}}(e))}}},ad=["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"],cd=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&qa(xu,"setTimeout",ld),t.setInterval&&qa(xu,"setInterval",ld),t.requestAnimationFrame&&qa(xu,"requestAnimationFrame",ud),t.XMLHttpRequest&&"XMLHttpRequest"in xu&&qa(XMLHttpRequest.prototype,"send",dd);const e=t.eventTarget;e&&(Array.isArray(e)?e:ad).forEach(e=>function(e,t){const n=xu,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(qa(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=Nu(i.handleEvent,{mechanism:{data:{handler:da(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,Nu(i,{mechanism:{data:{handler:da(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),qa(r,"removeEventListener",function(e){return function(t,n,r){try{const i=n.vt;i&&e.call(this,t,i,r)}catch{}return e.call(this,t,n,r)}}))}(e,t))}}};function ld(e){return function(...t){const n=t[0];return t[0]=Nu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${da(e)}`}}),e.apply(this,t)}}function ud(e){return function(t){return e.apply(this,[Nu(t,{mechanism:{data:{handler:da(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function dd(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&qa(n,e,function(t){const n={mechanism:{data:{handler:da(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Za(t);return r&&(n.mechanism.data.handler=da(r)),Nu(t,n)})}),e.apply(this,t)}}const hd=(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";pa(t,t=>{const{stackParser:n,attachStacktrace:r}=fd();if(kc()!==e||Su())return;const{msg:i,url:o,line:s,column:a,error:c}=t,l=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||{},c=a.frames=a.frames||[],l=r,u=n,d=function(e){if(Ca(e)&&0!==e.length){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+)/);return`<data:${t?t[1]:"text/javascript"}${e.includes("base64,")?",base64":""}>`}return e.slice(0,1024)}}(t)??Aa();return 0===c.length&&c.push({colno:l,filename:d,function:oa,in_app:!0,lineno:u}),e}(Du(n,c||i,void 0,r,!1),o,s,a);l.level="error",kl(l,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),ga(t,wa)}()}(e),md("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";pa(t,t=>{const{stackParser:n,attachStacktrace:r}=fd();if(kc()!==e||Su())return;const i=function(e){if(Ia(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=Ia(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:Du(n,i,void 0,r,!0);o.level="error",kl(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),ga(t,xa)}()}(e),md("onunhandledrejection"))}}};function md(e){od&&na(`Global Handler attached: ${e}`)}function fd(){const e=kc();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const pd=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){ou(_u,i.getOptions().stackParser,n,t,e,r)}}};let gd=!1;function yd(e){if(gd)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/];!function(e={}){const t=!e.skipBrowserExtensionCheck&&!!function(){if(void 0===xu.window)return!1;const e=xu;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=Aa();return!(xu===xu.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(e=>n.startsWith(`${e}://`)))}()&&(od&&Vs(()=>{}),!0),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||rd,Array.isArray(r)?ca(...r):r),integrations:Tl({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[nu(),Xl(),cd(),sd(),hd(),pd(),uu(),{name:"HttpContext",preprocessEvent(e){if(!xu.navigator&&!xu.location&&!xu.document)return;const t=function(){const e=Aa(),{referrer:t}=xu.document||{},{userAgent:n}=xu.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:"BrowserSession",setupOnce(){void 0!==xu.document?(Sl({ignoreDuration:!0}),$l(),Hu(({from:e,to:t})=>{void 0!==e&&e!==t&&(Sl({ignoreDuration:!0}),$l())})):od&&ra("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:e.defaultIntegrations}),transport:e.transport||Ju};var r;!function(e,t){!0===t.debug&&(qs?ta():Vs(()=>{})),wc().update(t.initialScope);const n=new e(t);(function(e){wc().setClient(e)})(n),n.init()}(Ru,n)}({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:[sd({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),uu()],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"]}),gd=!0,t()}catch(e){}else t()}function vd(e,n){if(gd)try{n?xc(t=>{Object.entries(n).forEach(([e,n])=>{t.setContext(e,n)}),bl(e)}):bl(e)}catch(e){t()}}function wd(e,n="info",r){if(gd)try{r?xc(t=>{Object.entries(r).forEach(([e,n])=>{t.setContext(e,n)}),xl(e,n)}):xl(e,n)}catch(e){t()}}function bd(e){if(gd)try{!function(e){bc().setUser(e)}(e)}catch(e){t()}}function xd(e){if(gd)try{Ql(e)}catch(e){t()}}function kd(e,n){if(gd)try{!function(e,t){bc().setTag(e,t)}(e,n)}catch(e){t()}}function Sd(){return gd}var Nd=Object.freeze({__proto__:null,addBreadcrumb:xd,captureException:vd,captureMessage:wd,initializeSentry:yd,isSentryInitialized:Sd,setTag:kd,setUser:bd});const _d="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",$d="production",Cd="insureos-scripts",Td=!0,Id=1,Ed=.1;class Pd{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 Dd{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{yd({dsn:_d,environment:$d,release:Cd,enabled:Td,sampleRate:Id,tracesSampleRate:Ed}),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 Pd({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}),ke(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=[],R(t,e=t.i=x(S,null,[e]),i||p,p,t.namespaceURI,i?null:t.firstChild?n.call(t.childNodes):null,o,i?i.v:t.firstChild,!1,s),j(o,e,s)}(x(Fs,{config:t,initializeFormContext:this.initializeFormContext.bind(this)}),e)}createHttpClient(e){var t,n,r,i,o,s,a,c,l,u;if(!e.orgId)throw new Error("orgId is required");const d=e.apiBaseUrl||"https://api.os.insure";return new U({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===(l=null===(c=e.httpConfig)||void 0===c?void 0:c.retryConfig)||void 0===l?void 0:l.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 ze(t)}async initializeFormContext(e){const n=this.createHttpClient(e),r=new URLSearchParams(window.location.search).get("pl_ref");if(r)return t(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:r,signedUrl:void 0}};if("payment"===e.mode)return t(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:e.paymentLinkId,signedUrl:e.signedUrl}};const i="sessionStorage"===e.storageType?new Y:new Z;i.isAvailable()?t(i.constructor.name):t();const o=new J(i),s=new Q(o),a=e.products,c=null==a?void 0:a.includes("*"),l=!a||0===a.length,u=l||c||a&&a.length>1,d=a&&1===a.length&&!c,h=localStorage.getItem("insure-os-selected-product");if(u&&!e.quoteIntentUrl&&!h){t();const e=await n.fetchAvailableProducts(l?void 0:a);if(t(),e.organisation&&e.organisation.theme)try{const n=await Promise.resolve().then(function(){return zs}).then(e=>e.ThemeLoader);await n.loadTheme({slug:e.organisation.slug,theme_url:e.organisation.theme.css_url}),t()}catch(e){t()}return{httpClient:n,stateManager:o,quoteIntent:null,quoteIntentStore:s,formStateManager:null,availableProducts:e.products,productCodes:a}}let m;h?(t(),m=h,localStorage.removeItem("insure-os-selected-product")):d&&(m=a[0]);const f=async()=>{t();const r=e.quoteIntentUrl?await n.getQuoteIntent(e.quoteIntentUrl):await n.createQuoteIntent({code:m});return t(),{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,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}},p=async t=>{var r;const i=new URLSearchParams(window.location.search),s=i.get("transaction_id")||i.get("payment_id")||i.get("transactionId"),a=await n.getQuoteIntent(t);let c;const l=i.get("status");if(s){const e=null===(r=a.payment_transactions)||void 0===r?void 0:r.find(e=>e.id===s);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"}c={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"}c={paymentTransactionId:s,paymentStatus:e,transactionStatus:void 0}}}const u={id:a.quote_intent.id,url:a.url,calculate_url:a.calculate_url,delete_calculations_url:a.delete_calculations_url,expires_at:new Date(a.quote_intent.expires_at).getTime(),updated_at:new Date(a.quote_intent.updated_at).getTime(),created_at:new Date(a.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:a.product.id,form_definition:a.product.form_definition,form_data:a.quote_intent.form_data,status:a.quote_intent.status,reference:a.quote_intent.reference,organisation:a.organisation,payment_return:c,payment_transactions:a.payment_transactions,cached_result:a.cached_result};return c&&o.saveQuoteIntent(e.orgId,u),u},g=new URLSearchParams(window.location.search);if(g.get("transactionId")||g.get("transaction_id")||g.get("payment_id"),g.get("status"),"1"===g.get("clear")){t(),localStorage.clear(),g.delete("clear");const e=g.toString()?`${window.location.pathname}?${g.toString()}`:window.location.pathname;window.history.replaceState({},"",e),t()}let y=null,v=!1;try{const t=o.getQuoteIntent(e.orgId),n=await s.getOrCreateQuoteIntent(e.orgId,f,p);n.payment_return&&o.saveQuoteIntent(e.orgId,n),y=n,v=!t}catch(t){if(!(t instanceof q&&404===t.statusCode))throw t;s.clearQuoteIntent(e.orgId),y=await s.getOrCreateQuoteIntent(e.orgId,f,p),v=!0}if(v&&y&&Ne(y),!y)throw new Error("Failed to initialize quote intent state");t(),t(y.payment_return),y.payment_return&&t(y.payment_return);const w=new De(y,n,s,{autoSave:!1,autoSaveInterval:y.form_definition.settings.autoSaveInterval});if(y.form_data&&w.restoreFormProgress(y.form_data),t(y.cached_result),y.cached_result?(t(y.cached_result),w.restoreCalculationResult(y.cached_result),t(),t(w.hasCalculationResponse())):t(),y.organisation&&y.organisation.theme)try{await Ms.loadTheme({slug:y.organisation.slug,theme_url:y.organisation.theme.css_url})}catch(e){t()}return await this.handleAutoCalculationIfComplete(w),{httpClient:n,stateManager:o,quoteIntent:y,quoteIntentStore:s,formStateManager:w}}async handleAutoCalculationIfComplete(e){try{const n=e.getQuoteIntent();if("paid"===n.status||"completed"===n.status)return void t();if(e.hasCalculationResponse())return void t();if(e.hasLastCalculationFailed())return void t();const r=e.getPageCompletionStatus(),{totalPages:i,completedPages:o}=r,s=o.length===i;t((o.length,e.getIsCalculating(),e.hasLastCalculationFailed())),s&&!e.getIsCalculating()&&(t(),await e.calculateQuote(),t())}catch(e){t()}}}const Md=new Dd;"undefined"!=typeof window&&(window.InsureOS=Md,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 Md.mount(r,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class zd{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,zd.instance)return zd.instance;zd.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 zd).startMeasurement(e)}static endMeasurement(e){return(new zd).endMeasurement(e)}static measureMemoryUsage(){return(new zd).measureMemoryUsage()}static async measureApiCall(e,t){return(new zd).measureApiCall(e,t)}static getMetrics(){return(new zd).getMetrics()}static generateReport(){return(new zd).generateReport()}}let Rd=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)}},Od=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new Rd(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 Rd(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)}},jd=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new Rd(t.headers),this.ok=this.status>=200&&this.status<300,this._t=e}async text(){return this._t}async json(){return JSON.parse(this._t)}};var Ad=Object.freeze({__proto__:null,Headers:Rd,Request:Od,Response:jd,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new Od(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 Rd;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new jd(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 Wd{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 Wd((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof Wd?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof Wd?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 Wd(t=>t(e))}static reject(e){return new Wd((t,n)=>n(e))}static all(e){return new Wd((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 Ld=Object.freeze({__proto__:null,PromisePolyfill:Wd});class Bd{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 Fd=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 Bd(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:Bd});e.DataLayerManager=Pd,e.EnhancedHttpClient=U,e.ErrorHandlingStrategy=class{handleNetworkError(t){return new q(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(t){if(503===t.status)return new q(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 q(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,t.status):t.status>=400&&t.status<500?new q(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status):t.status>=500?new q(e.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,t.status):new q(e.ErrorType.API_ERROR,`Request failed: ${t.statusText}`,n,t.status)}handleStorageError(t){return new q(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=De,e.InsureOS=Md,e.InsureOSClient=Dd,e.InsureOSError=q,e.LocalStateManager=J,e.LocalStorageAdapter=Z,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=zd,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 Ad});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 Ld});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 Fd});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}},e.RetryStrategy=H,e.SessionStorageAdapter=Y,e.ThemeLoader=Ms,e.addBreadcrumb=xd,e.captureException=vd,e.captureMessage=wd,e.createAppError=he,e.getAnalytics=function(){return xe},e.getSupportMessage=be,e.groupErrorsByField=function(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})},e.initializeAnalytics=ke,e.initializeSentry=yd,e.isSentryInitialized=Sd,e.parseServerValidationErrors=ce,e.setTag=kd,e.setUser=bd,e.shouldShowErrorPage=function(e){return"initialization"===e.type&&"critical"===e.severity},e.shouldShowMaintenancePage=we,e.trackFormProgress=_e,e.trackPaymentCompleted=Ee,e.trackPaymentFailed=Pe,e.trackPaymentInitiated=Ie,e.trackQuoteAtCheckout=Ce,e.trackQuoteCalculated=$e,e.trackQuoteReferred=Te,e.trackQuoteStarted=Ne,e.validateField=se,e.validatePage=ae});
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,c,l,u,d,h,m,f,p={},g=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(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 k(e,a,i,o,null)}function k(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 S(e){return e.children}function N(e,t){this.props=e,this.context=t}function _(e,t){if(null==t)return e.m?_(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?_(e):null}function $(e){var t,n;if(null!=(e=e.m)&&null!=e.k){for(e.v=e.k.base=null,t=0;t<e.i.length;t++)if(null!=(n=e.i[t])&&null!=n.v){e.v=e.k.base=n.v;break}return $(e)}}function C(e){(!e.I&&(e.I=!0)&&o.push(e)&&!T.P++||s!=r.debounceRendering)&&((s=r.debounceRendering)||a)(T)}function T(){for(var e,t,n,i,s,a,l,u=1;o.length;)o.length>u&&o.sort(c),e=o.shift(),u=o.length,e.I&&(n=void 0,s=(i=(t=e).N).v,a=[],l=[],t.R&&((n=w({},i)).N=i.N+1,r.vnode&&r.vnode(n),R(t.R,n,i,t.O,t.R.namespaceURI,32&i.C?[s]:null,a,null==s?_(i):s,!!(32&i.C),l),n.N=i.N,n.m.i[n._]=n,j(a,n,l),n.v!=s&&$(n)));T.P=0}function I(e,t,n,r,i,o,s,a,c,l,u){var d,h,m,f,y,w,b,x=r&&r.i||g,N=t.length;for(c=function(e,t,n,r,i){var o,s,a,c,l,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?(c=o+h,(s=e.i[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?k(null,s,null,null,null):v(s)?k(S,{children:s},null,null,null):null==s.constructor&&s.p>0?k(s.type,s.props,s.key,s.ref?s.ref:null,s.N):s).m=e,s.p=e.p+1,a=null,-1!=(l=s._=P(s,n,c,d))&&(d--,(a=n[l])&&(a.C|=2)),null==a||null==a.N?(-1==l&&(i>u?h--:i<u&&h++),"function"!=typeof s.type&&(s.C|=4)):l!=c&&(l==c-1?h--:l==c+1?h++:(l>c?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=_(a)),B(a,a));return r}(n,t,x,c,N),d=0;d<N;d++)null!=(m=n.i[d])&&(h=-1==m._?p:x[m._]||p,m._=d,w=R(e,m,h,i,o,s,a,c,l,u),f=m.v,m.ref&&h.ref!=m.ref&&(h.ref&&L(h.ref,null,m),u.push(m.ref,m.k||f,m)),null==y&&null!=f&&(y=f),(b=!!(4&m.C))||h.i===m.i?c=E(m,c,e,b):"function"==typeof m.type&&void 0!==w?c=w:f&&(c=f.nextSibling),m.C&=-7);return n.v=y,c}function E(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=E(i[o],t,n,r));return t}e.v!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=_(e)),n.insertBefore(e.v,t||null)),t=e.v);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function P(e,t,n,r){var i,o,s,a=e.key,c=e.type,l=t[n],u=null!=l&&!(2&l.C);if(null===l&&null==e.key||u&&a==l.key&&c==l.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(l=t[s=i>=0?i--:o++])&&!(2&l.C)&&a==l.key&&c==l.type)return s;return-1}function D(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||y.test(t)?n:n+"px"}function M(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||D(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||D(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(l,"$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.u=r.u:(n.u=u,e.addEventListener(t,o?h:d,o)):e.removeEventListener(t,o?h:d,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 z(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=u++;else if(t.t<n.u)return;return n(r.event?r.event(t):t)}}}function R(e,t,n,i,o,s,a,c,l,u){var d,h,m,f,p,g,y,x,k,_,$,C,T,E,P,D,M,z=t.type;if(null!=t.constructor)return null;128&n.C&&(l=!!(32&n.C),s=[c=t.v=n.v]),(d=r.p)&&d(t);e:if("function"==typeof z)try{if(x=t.props,k="prototype"in z&&z.prototype.render,_=(d=z.contextType)&&i[d.k],$=d?_?_.props.value:d.m:i,n.k?y=(h=t.k=n.k).m=h.j:(k?t.k=h=new z(x,$):(t.k=h=new N(x,$),h.constructor=z,h.render=F),_&&_.sub(h),h.props=x,h.state||(h.state={}),h.context=$,h.O=i,m=h.I=!0,h.A=[],h.W=[]),k&&null==h.L&&(h.L=h.state),k&&null!=z.getDerivedStateFromProps&&(h.L==h.state&&(h.L=w({},h.L)),w(h.L,z.getDerivedStateFromProps(x,h.L))),f=h.props,p=h.state,h.N=t,m)k&&null==z.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),k&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(k&&null==z.getDerivedStateFromProps&&x!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,$),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.L,$)||t.N==n.N){for(t.N!=n.N&&(h.props=x,h.state=h.L,h.I=!1),t.v=n.v,t.i=n.i,t.i.some(function(e){e&&(e.m=t)}),C=0;C<h.W.length;C++)h.A.push(h.W[C]);h.W=[],h.A.length&&a.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(x,h.L,$),k&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(f,p,g)})}if(h.context=$,h.props=x,h.R=e,h.v=!1,T=r.P,E=0,k){for(h.state=h.L,h.I=!1,T&&T(t),d=h.render(h.props,h.state,h.context),P=0;P<h.W.length;P++)h.A.push(h.W[P]);h.W=[]}else do{h.I=!1,T&&T(t),d=h.render(h.props,h.state,h.context),h.state=h.L}while(h.I&&++E<25);h.state=h.L,null!=h.getChildContext&&(i=w(w({},i),h.getChildContext())),k&&!m&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(f,p)),D=d,null!=d&&d.type===S&&null==d.key&&(D=A(d.props.children)),c=I(e,v(D)?D:[D],t,n,i,o,s,a,c,l,u),h.base=t.v,t.C&=-161,h.A.length&&a.push(h),y&&(h.j=h.m=null)}catch(e){if(t.N=null,l||null!=s)if(e.then){for(t.C|=l?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,t.v=c}else{for(M=s.length;M--;)b(s[M]);O(t)}else t.v=n.v,t.i=n.i,e.then||O(t);r.v(e,t,n)}else null==s&&t.N==n.N?(t.i=n.i,t.v=n.v):c=t.v=W(n.v,t,n,i,o,s,a,l,u);return(d=r.diffed)&&d(t),128&t.C?void 0:c}function O(e){e&&e.k&&(e.k.v=!0),e&&e.i&&e.i.forEach(O)}function j(e,t,n){for(var i=0;i<n.length;i++)L(n[i],n[++i],n[++i]);r.k&&r.k(t,e),e.some(function(t){try{e=t.A,t.A=[],e.some(function(e){e.call(t)})}catch(e){r.v(e,t.N)}})}function A(e){return"object"!=typeof e||null==e||e.p&&e.p>0?e:v(e)?e.map(A):w({},e)}function W(e,t,i,o,s,a,c,l,u){var d,h,m,f,g,y,w,x=i.props,k=t.props,S=t.type;if("svg"==S?s="http://www.w3.org/2000/svg":"math"==S?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((g=a[d])&&"setAttribute"in g==!!S&&(S?g.localName==S:3==g.nodeType)){e=g,a[d]=null;break}if(null==e){if(null==S)return document.createTextNode(k);e=document.createElementNS(s,S,k.is&&k),l&&(r.B&&r.B(t,a),l=!1),a=null}if(null==S)x===k||l&&e.data==k||(e.data=k);else{if(a=a&&n.call(e.childNodes),x=i.props||p,!l&&null!=a)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)if(g=x[d],"children"==d);else if("dangerouslySetInnerHTML"==d)m=g;else if(!(d in k)){if("value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k)continue;M(e,d,null,g,s)}for(d in k)g=k[d],"children"==d?f=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?y=g:"checked"==d?w=g:l&&"function"!=typeof g||x[d]===g||M(e,d,g,x[d],s);if(h)l||m&&(h.H==m.H||h.H==e.innerHTML)||(e.innerHTML=h.H),t.i=[];else if(m&&(e.innerHTML=""),I("template"==t.type?e.content:e,v(f)?f:[f],t,i,o,"foreignObject"==S?"http://www.w3.org/1999/xhtml":s,a,c,a?a[0]:i.i&&_(i,0),l,u),null!=a)for(d=a.length;d--;)b(a[d]);l||(d="value","progress"==S&&null==y?e.removeAttribute("value"):null!=y&&(y!==e[d]||"progress"==S&&!y||"option"==S&&y!=x[d])&&M(e,d,y,x[d],s),d="checked",null!=w&&w!=e[d]&&M(e,d,w,x[d],s))}return e}function L(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 B(e,t,n){var i,o;if(r.unmount&&r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||L(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){r.v(e,t)}i.base=i.R=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&B(i[o],t,n||"function"!=typeof e.type);n||b(e.v),e.k=e.m=e.v=void 0}function F(e,t,n){return this.constructor(e,n)}n=g.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.I),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.I),s)return i.j=i}catch(t){e=t}throw e}},i=0,N.prototype.setState=function(e,t){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=w({},this.state),"function"==typeof e&&(e=e(w({},n),this.props)),e&&w(n,e),null!=e&&this.N&&(t&&this.W.push(t),C(this))},N.prototype.forceUpdate=function(e){this.N&&(this.v=!0,e&&this.A.push(e),C(this))},N.prototype.render=S,o=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,c=function(e,t){return e.N.p-t.N.p},T.P=0,l=/(PointerCapture)$|Capture$/i,u=0,d=z(!1),h=z(!0),m=0,e.ErrorType=void 0,(f=e.ErrorType||(e.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",f.API_ERROR="API_ERROR",f.VALIDATION_ERROR="VALIDATION_ERROR",f.STORAGE_ERROR="STORAGE_ERROR",f.TIMEOUT_ERROR="TIMEOUT_ERROR",f.MAINTENANCE_ERROR="MAINTENANCE_ERROR";class q 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 H{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 q?e.retryable:!("TypeError"!==e.name||!e.message.includes("fetch"))||"AbortError"===e.name}}class U{constructor(e){this.config=e,this.retryStrategy=new H(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 c={method:n,headers:e,signal:o.signal};r&&(c.body=JSON.stringify(r));const l=await fetch(t,c);if(clearTimeout(s),!l.ok)throw await this.handleApiError(l);const u=await l.json();return u.data||u}catch(t){if(clearTimeout(s),t instanceof q)throw t;if(t instanceof Error&&"AbortError"===t.name)throw new q(e.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(t instanceof TypeError&&t.message.includes("fetch"))throw new q(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||[],c=null===(n=s.organisation)||void 0===n?void 0:n.client_settings;let l=a;if(r)t(),l=a;else if(e&&e.length>0)l=a.filter(t=>e.includes(t.code));else if(i&&(null==c?void 0:c.products)&&c.products.length>0){const e=c.products.map(e=>e.code);l=e.map(e=>a.find(t=>t.code===e)).filter(e=>void 0!==e),t((a.length,l.length))}else i&&(t(),l=a);return{products:l,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"})}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})}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 q&&(e.type,e.message)),t(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw t(),n;const o=e instanceof q?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 q(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 q(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 q(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 q(e.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.error.details):new q(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 q(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 q(e.ErrorType.VALIDATION_ERROR,t.message||"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.errors):new q(e.ErrorType.API_ERROR,t.message||"Invalid request. Please check your input and try again.",!1,n.status)}catch(t){return new q(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 q(e.ErrorType.API_ERROR,t,!1,n.status)}return new q(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 _d}).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 Z{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 Y{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 G{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}}G.KEY_PREFIX="insure_os_",G.SEPARATOR="_";class J{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||J.DEFAULT_EXPIRATION_MS,namespace:t.namespace||J.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{t.payment_transactions&&t.payment_transactions.length;const n=this.generateStorageKey(e),r=G.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=G.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 G.generateKey(this.config.namespace,e)}}J.DEFAULT_EXPIRATION_MS=864e5,J.DEFAULT_NAMESPACE="quote_intent";class Q{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 V{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 K(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 X(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 ee(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 te(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),c=Math.floor((Date.now()-s)/864e5);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 c<i;case"age_days_less_than_or_equal":return c<=i;case"age_days_greater_than":return c>i;case"age_days_greater_than_or_equal":return c>=i;default:throw new Error(`Unsupported date operator: ${n}`)}}class ne{static create(e){switch(e){case"string":case"text":case"select":return K;case"numeric":return X;case"boolean":return ee;case"date":return te;default:throw new Error(`Unsupported condition type: ${e}`)}}}function re(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:ie(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 ie(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=ne.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var oe=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:ne,booleanMatchesCondition:ee,checkSimpleConditions:re,dateMatchesCondition:te,numericMatchesCondition:X,textMatchesCondition:K});function se(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 ae(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=re(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=se(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=re(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 ce(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 le{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:ce(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 ue{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.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}}isStagingEnvironment(){const e=window.location.hostname;return"localhost"===e||e.endsWith(".test")||e.includes("staging")}}class de{constructor(e){this.httpClient=e}async calculateQuote(e){const n=await this.httpClient.calculateQuoteIntent(e);return t(),n}}function he(e,t,n){var r,i,o,s;const a=Date.now(),c=`${e}-${a}`;if(function(e,t,n){try{Promise.resolve().then(function(){return _d}).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 me(c,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 me(c,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:c,type:e,severity:pe(e),title:fe(e),message:n||ye(e),details:t.message,retryable:ve(e,0),timestamp:a,trackingId:c}}const l="string"==typeof t?t:"An unexpected error occurred";return{id:c,type:e,severity:pe(e),title:fe(e),message:n||l,retryable:ve(e,0),timestamp:a,trackingId:c}}function me(e,t,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=ve(t,n);return{id:e,type:t,severity:s,statusCode:n,title:fe(t,n),message:i||ge(t,n,r),details:r,retryable:a,timestamp:o}}function fe(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 pe(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ge(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 ye(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 ve(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 we(e){return"maintenance"===e.type||503===e.statusCode}function be(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 xe=null;function ke(e){xe=e}function Se(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 Ne(e){var t,n;if(!(null==xe?void 0:xe.isEnabled()))return;const r={...Se(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};xe.push(r)}function _e(e,t,n,r){var i,o;if(!(null==xe?void 0:xe.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,c={...Se(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};xe.push(c)}function $e(e,t){if(!(null==xe?void 0:xe.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,c=r.some(e=>"monthly"===e.amount.frequency),l={...Se(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:c,min_premium:s,max_premium:a};xe.push(l)}function Ce(e,t,n,r,i){if(!(null==xe?void 0:xe.isEnabled()))return;const o={...Se(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};xe.push(o)}function Te(e,t){if(!(null==xe?void 0:xe.isEnabled()))return;const n=t.referrals||[],r={...Se(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};xe.push(r)}function Ie(e,t,n,r){if(!(null==xe?void 0:xe.isEnabled()))return;const i={...Se(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};xe.push(i)}function Ee(e,t,n,r,i,o){if(!(null==xe?void 0:xe.isEnabled()))return;const s={...Se(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};xe.push(s)}function Pe(e,t,n,r,i,o){if(!(null==xe?void 0:xe.isEnabled()))return;const s={...Se(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};xe.push(s)}class De{constructor(e,t,n,r={}){this.quoteIntent=e,this.httpClient=t,this.subscribers=new Set,this.pendingChanges={},this.isCalculating=!1,this.isSaving=!1,this.selectedExcessId=null,this.selectedPaymentOption=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 le(t,i,n),this.autoSaveManager=new V(this.config,this.saveFormData.bind(this)),this.navigationManager=new ue(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new de(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){return t(JSON.stringify(r)),"calculate_age"===n?this.calculateAge(e,r):null}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,J: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=he("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;_e(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}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=ae(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=se(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 oe}),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,J: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=ae(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{this.isCalculating=!0,this.notify();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?$e(this.quoteIntent,e):"referral"===e.outcome_type&&Te(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.selectedExcessId=null,this.selectedPaymentOption=null,this.notify(),t()}catch(e){throw t(),e}}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&&Ie(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 Me{constructor(e,t){this.httpClient=e,this.response=t}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(e){const t=this.response.product.form_definition,n={...this.response.quote_intent.form_data};n.page_data||(n.page_data={});for(const r of t.pages){const t=n.page_data[r.id]||{};for(const n of r.fields){const r=n.code||n.id;e.hasOwnProperty(r)?t[r]=e[r]:("text"===n.type&&(t[r]="sample"),"number"===n.type&&(t[r]=1),"checkbox"===n.type&&(t[r]=!0))}n.page_data[r.id]=t}const r={current_page_index:0,save_type:"full",page_data:{...n.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,r)}}class ze{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new Me(this.httpClient,n)}}var Re=0;function Oe(e,t,n,i,o,s){t||(t={});var a,c,l=t;if("ref"in l)for(c in l={},t)"ref"==c?a=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:--Re,_:-1,C:0,V:o,K:s};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===l[c]&&(l[c]=a[c]);return r.vnode&&r.vnode(u),u}var je,Ae,We,Le,Be=0,Fe=[],qe=r,He=qe.p,Ue=qe.P,Ze=qe.diffed,Ye=qe.k,Ge=qe.unmount,Je=qe.m;function Qe(e,t){qe.A&&qe.A(Ae,e,Be||t),Be=0;var n=Ae.X||(Ae.X={m:[],A:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function Ve(e){return Be=1,function(e,t){var n=Qe(je++,2);if(n.t=e,!n.k&&(n.m=[ct(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=Ae,!Ae.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.forEach(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};Ae.te=!0;var i=Ae.shouldComponentUpdate,o=Ae.componentWillUpdate;Ae.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)},Ae.shouldComponentUpdate=r}return n.ee||n.m}(ct,e)}function Ke(e,t){var n=Qe(je++,3);!qe.L&&at(n.X,t)&&(n.m=e,n.u=t,Ae.X.A.push(n))}function Xe(e){return Be=5,et(function(){return{current:e}},[])}function et(e,t){var n=Qe(je++,7);return at(n.X,t)&&(n.m=e(),n.X=t,n.A=e),n.m}function tt(e,t){return Be=8,et(function(){return e},t)}function nt(){for(var e;e=Fe.shift();)if(e.R&&e.X)try{e.X.A.forEach(ot),e.X.A.forEach(st),e.X.A=[]}catch(t){e.X.A=[],qe.v(t,e.N)}}qe.p=function(e){Ae=null,He&&He(e)},qe.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),Je&&Je(e,t)},qe.P=function(e){Ue&&Ue(e),je=0;var t=(Ae=e.k).X;t&&(We===Ae?(t.A=[],Ae.A=[],t.m.forEach(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.A.forEach(ot),t.A.forEach(st),t.A=[],je=0)),We=Ae},qe.diffed=function(e){Ze&&Ze(e);var t=e.k;t&&t.X&&(t.X.A.length&&(1!==Fe.push(t)&&Le===qe.requestAnimationFrame||((Le=qe.requestAnimationFrame)||it)(nt)),t.X.m.forEach(function(e){e.u&&(e.X=e.u),e.u=void 0})),We=Ae=null},qe.k=function(e,t){t.some(function(e){try{e.A.forEach(ot),e.A=e.A.filter(function(e){return!e.m||st(e)})}catch(n){t.some(function(e){e.A&&(e.A=[])}),t=[],qe.v(n,e.N)}}),Ye&&Ye(e,t)},qe.unmount=function(e){Ge&&Ge(e);var t,n=e.k;n&&n.X&&(n.X.m.forEach(function(e){try{ot(e)}catch(e){t=e}}),n.X=void 0,t&&qe.v(t,n.N))};var rt="function"==typeof requestAnimationFrame;function it(e){var t,n=function(){clearTimeout(r),rt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);rt&&(t=requestAnimationFrame(n))}function ot(e){var t=Ae,n=e.k;"function"==typeof n&&(e.k=void 0,n()),Ae=t}function st(e){var t=Ae;e.k=e.m(),Ae=t}function at(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ct(e,t){return"function"==typeof t?t(e):t}const lt="insure-os";let ut=!1;const dt=new Map,ht={[`--${lt}-radius`]:"0.75rem",[`--${lt}-radius-sm`]:"0.5rem",[`--${lt}-radius-lg`]:"1rem",[`--${lt}-background`]:"oklch(0.955 0 0)",[`--${lt}-foreground`]:"oklch(0.145 0 0)",[`--${lt}-card`]:"oklch(1 0 0)",[`--${lt}-card-foreground`]:"oklch(0.145 0 0)",[`--${lt}-popover`]:"oklch(1 0 0)",[`--${lt}-popover-foreground`]:"oklch(0.145 0 0)",[`--${lt}-primary`]:"oklch(0.205 0 0)",[`--${lt}-primary-foreground`]:"oklch(0.985 0 0)",[`--${lt}-secondary`]:"oklch(0.97 0 0)",[`--${lt}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${lt}-muted`]:"oklch(0.97 0 0)",[`--${lt}-muted-foreground`]:"oklch(0.556 0 0)",[`--${lt}-accent`]:"oklch(0.97 0 0)",[`--${lt}-accent-foreground`]:"oklch(0.205 0 0)",[`--${lt}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${lt}-border`]:"oklch(0.9 0 0)",[`--${lt}-input`]:"oklch(0.9 0 0)",[`--${lt}-ring`]:"oklch(0.708 0 0)",[`--${lt}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${lt}-font-size-large`]:"18px",[`--${lt}-font-size-small`]:"14px",[`--${lt}-font-size`]:"16px",[`--${lt}-border-width`]:"1px",[`--${lt}-transition-duration`]:"200ms",[`--${lt}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${lt}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${lt}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${lt}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${lt}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${lt}-spacing-sm`]:"0.75rem",[`--${lt}-spacing`]:"1rem",[`--${lt}-spacing-md`]:"1.5rem",[`--${lt}-spacing-lg`]:"2rem",[`--${lt}-spacing-xl`]:"3rem"},mt={colors:{background:`var(--${lt}-background)`,foreground:`var(--${lt}-foreground)`,card:`var(--${lt}-card)`,popover:`var(--${lt}-popover)`,popoverForeground:`var(--${lt}-popover-foreground)`,primary:`var(--${lt}-primary)`,primaryForeground:`var(--${lt}-primary-foreground)`,secondary:`var(--${lt}-secondary)`,muted:`var(--${lt}-muted)`,mutedForeground:`var(--${lt}-muted-foreground)`,accent:`var(--${lt}-accent)`,accentForeground:`var(--${lt}-accent-foreground)`,destructive:`var(--${lt}-destructive)`,border:`var(--${lt}-border)`,input:`var(--${lt}-input)`},fontSize:{small:`var(--${lt}-font-size-small)`,default:`var(--${lt}-font-size)`,large:`var(--${lt}-font-size-large)`},radius:{small:`var(--${lt}-radius-sm)`,default:`var(--${lt}-radius)`,large:`var(--${lt}-radius-lg)`},shadow:{sm:`var(--${lt}-shadow-sm)`,md:`var(--${lt}-shadow-md)`},spacing:{sm:`var(--${lt}-spacing-sm)`,default:`var(--${lt}-spacing)`,md:`var(--${lt}-spacing-md)`,lg:`var(--${lt}-spacing-lg)`,xl:`var(--${lt}-spacing-xl)`},fontFamily:`var(--${lt}-font-family)`,borderWidth:`var(--${lt}-border-width)`,transition:`var(--${lt}-transition-duration) var(--${lt}-transition-timing-function)`},ft=new Set;function pt(e){if(!document.getElementById(`${lt}-styles`)){const e=document.createElement("style");e.id=`${lt}-styles`,document.head.appendChild(e)}document.getElementById(`${lt}-styles`).textContent+=e+"\n"}function gt(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 yt(){ut||(pt(`:root {\n${Object.entries(ht).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),ut=!0)}const vt={name:e=>`${lt}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){yt();const r=gt(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=dt.get(o);if(s)return s.fullClassName;let a=e;const c=this.name(a);return ft.has(a)||(pt(`.${c} { ${r} }`),ft.add(a)),dt.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),c},keyframes(e,t){const n=`${lt}-${e}`;return ft.has(`keyframes-${e}`)||(pt(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${gt(t)} }`).join("\n")}\n}`),ft.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;pt(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${lt}-${e} { ${gt(t)} }`).join("\n")}\n}`),ft.add(n)},pseudoElement(e,t,n){const r=`${lt}-${e}`,i=`${e}-${t}`;return ft.has(i)||(pt(`.${r}${t} { ${gt(n)} }`),ft.add(i)),r}};var wt=Object.freeze({__proto__:null,baseVariables:ht,styles:vt,theme:mt,updateBaseVariables:function(e){t(),Object.assign(ht,e);const n=document.getElementById(`${lt}-styles`);if(n){const e=n.textContent||"",r=`:root {\n${Object.entries(ht).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 yt()}});function bt(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var xt,kt={exports:{}};function St(){return xt||(xt=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}()}(kt)),kt.exports}var Nt=bt(St());function _t({size:e="small"}){const t=vt.create("spinner-small",{width:"16px",height:"16px"}),n=vt.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return vt.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Oe("div",{className:vt.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Oe("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:Nt(r),children:Oe("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function $t({className:e,children:t,size:n="md"}){const r={sm:mt.spacing.sm,md:mt.spacing.md,lg:mt.spacing.lg,xl:mt.spacing.xl},i=vt.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?mt.spacing.lg:"lg"===n?mt.spacing.md:r[n]},"(max-width: 480px)":{padding:mt.spacing.sm}});return Oe("div",{className:Nt(i,e),children:t})}const Ct=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,C(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"+m++,e.m=null,e.Provider=e.re=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}();function Tt({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a}){return Oe(Ct.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function It(){const e=function(e){var t=Ae.context[e.k],n=Qe(je++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(Ae)),t.props.value):e.m}(Ct);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function Et(e){const t=It(),{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]=Ve(()=>e(n));return Ke(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class Pt extends Error{}class Dt extends Pt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Mt extends Pt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class zt extends Pt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Rt extends Pt{}class Ot extends Pt{constructor(e){super(`Invalid unit ${e}`)}}class jt extends Pt{}class At extends Pt{constructor(){super("Zone is an abstract class")}}const Wt="numeric",Lt="short",Bt="long",Ft={year:Wt,month:Wt,day:Wt},qt={year:Wt,month:Lt,day:Wt},Ht={year:Wt,month:Lt,day:Wt,weekday:Lt},Ut={year:Wt,month:Bt,day:Wt},Zt={year:Wt,month:Bt,day:Wt,weekday:Bt},Yt={hour:Wt,minute:Wt},Gt={hour:Wt,minute:Wt,second:Wt},Jt={hour:Wt,minute:Wt,second:Wt,timeZoneName:Lt},Qt={hour:Wt,minute:Wt,second:Wt,timeZoneName:Bt},Vt={hour:Wt,minute:Wt,hourCycle:"h23"},Kt={hour:Wt,minute:Wt,second:Wt,hourCycle:"h23"},Xt={hour:Wt,minute:Wt,second:Wt,hourCycle:"h23",timeZoneName:Lt},en={hour:Wt,minute:Wt,second:Wt,hourCycle:"h23",timeZoneName:Bt},tn={year:Wt,month:Wt,day:Wt,hour:Wt,minute:Wt},nn={year:Wt,month:Wt,day:Wt,hour:Wt,minute:Wt,second:Wt},rn={year:Wt,month:Lt,day:Wt,hour:Wt,minute:Wt},on={year:Wt,month:Lt,day:Wt,hour:Wt,minute:Wt,second:Wt},sn={year:Wt,month:Lt,day:Wt,weekday:Lt,hour:Wt,minute:Wt},an={year:Wt,month:Bt,day:Wt,hour:Wt,minute:Wt,timeZoneName:Lt},cn={year:Wt,month:Bt,day:Wt,hour:Wt,minute:Wt,second:Wt,timeZoneName:Lt},ln={year:Wt,month:Bt,day:Wt,weekday:Bt,hour:Wt,minute:Wt,timeZoneName:Bt},un={year:Wt,month:Bt,day:Wt,weekday:Bt,hour:Wt,minute:Wt,second:Wt,timeZoneName:Bt};class dn{get type(){throw new At}get name(){throw new At}get ianaName(){return this.name}get isUniversal(){throw new At}offsetName(e,t){throw new At}formatOffset(e,t){throw new At}offset(e){throw new At}equals(e){throw new At}get isValid(){throw new At}}let hn=null;class mn extends dn{static get instance(){return null===hn&&(hn=new mn),hn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Mr(e,t,n)}formatOffset(e,t){return jr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const fn=new Map,pn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},gn=new Map;class yn extends dn{static create(e){let t=gn.get(e);return void 0===t&&gn.set(e,t=new yn(e)),t}static resetCache(){gn.clear(),fn.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=yn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Mr(e,t,n,this.name)}formatOffset(e,t){return jr(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=fn.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"}),fn.set(e,t)),t}(this.name);let[r,i,o,s,a,c,l]=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=pn[t];"era"===t?r[o]=i:hr(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,c,l,u]=r;return[s,i,o,a,c,l,u]}(n,t);"BC"===s&&(r=1-Math.abs(r));let u=+t;const d=u%1e3;return u-=d>=0?d:1e3+d,(Ir({year:r,month:i,day:o,hour:24===a?0:a,minute:c,second:l,millisecond:0})-u)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let vn={};const wn=new Map;function bn(e,t={}){const n=JSON.stringify([e,t]);let r=wn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),wn.set(n,r)),r}const xn=new Map,kn=new Map;let Sn=null;const Nn=new Map;function _n(e){let t=Nn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Nn.set(e,t)),t}const $n=new Map;function Cn(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class Tn{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=xn.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),xn.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 xr(this.floor?Math.floor(e):_r(e,3),this.padTo)}}class In{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&&yn.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=bn(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 En{constructor(e,t,n){this.opts={style:"long",...n},!t&&pr()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=kn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),kn.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),c=1===a,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?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 Pn={firstDay:1,minimalDays:4,weekend:[6,7]};class Dn{static fromOpts(e){return Dn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||Qn.defaultLocale,s=o||(i?"en-US":Sn||(Sn=(new Intl.DateTimeFormat).resolvedOptions().locale,Sn)),a=t||Qn.defaultNumberingSystem,c=n||Qn.defaultOutputCalendar,l=wr(r)||Qn.defaultWeekSettings;return new Dn(s,a,c,l,o)}static resetCache(){Sn=null,wn.clear(),xn.clear(),kn.clear(),Nn.clear(),$n.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return Dn.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=bn(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=bn(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"===_n(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?Dn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,wr(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 Cn(this,e,Fr,()=>{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=Uo.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Cn(this,e,Zr,()=>{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=Uo.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return Cn(this,void 0,()=>Yr,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Uo.utc(2016,11,13,9),Uo.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Cn(this,e,Vr,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Uo.utc(-40,1,1),Uo.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 Tn(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new In(e,this.intl,t)}relFormatter(e={}){return new En(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=vn[n];return r||(r=new Intl.ListFormat(e,t),vn[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||_n(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:gr()?function(e){let t=$n.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...Pn,...t}),$n.set(e,t)}return t}(this.locale):Pn}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 Mn=null;class zn extends dn{static get utcInstance(){return null===Mn&&(Mn=new zn(0)),Mn}static instance(e){return 0===e?zn.utcInstance:new zn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new zn(zr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${jr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${jr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return jr(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 Rn extends dn{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 On(e,t){if(hr(e)||null===e)return t;if(e instanceof dn)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?mn.instance:"utc"===n||"gmt"===n?zn.utcInstance:zn.parseSpecifier(n)||yn.create(e)}return mr(e)?zn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Rn(e)}const jn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},An={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]},Wn=jn.hanidec.replace(/[\[|\]]/g,"").split(""),Ln=new Map;function Bn({numberingSystem:e},t=""){const n=e||"latn";let r=Ln.get(n);void 0===r&&(r=new Map,Ln.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${jn[n]}${t}`),r.set(t,i)),i}let Fn,qn=()=>Date.now(),Hn="system",Un=null,Zn=null,Yn=null,Gn=60,Jn=null;class Qn{static get now(){return qn}static set now(e){qn=e}static set defaultZone(e){Hn=e}static get defaultZone(){return On(Hn,mn.instance)}static get defaultLocale(){return Un}static set defaultLocale(e){Un=e}static get defaultNumberingSystem(){return Zn}static set defaultNumberingSystem(e){Zn=e}static get defaultOutputCalendar(){return Yn}static set defaultOutputCalendar(e){Yn=e}static get defaultWeekSettings(){return Jn}static set defaultWeekSettings(e){Jn=wr(e)}static get twoDigitCutoffYear(){return Gn}static set twoDigitCutoffYear(e){Gn=e%100}static get throwOnInvalid(){return Fn}static set throwOnInvalid(e){Fn=e}static resetCaches(){Dn.resetCache(),yn.resetCache(),Uo.resetCache(),Ln.clear()}}class Vn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Kn=[0,31,59,90,120,151,181,212,243,273,304,334],Xn=[0,31,60,91,121,152,182,213,244,274,305,335];function er(e,t){return new Vn("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function tr(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 nr(e,t,n){return n+($r(e)?Xn:Kn)[t-1]}function rr(e,t){const n=$r(e)?Xn:Kn,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function ir(e,t){return(e-t+7)%7+1}function or(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=nr(r,i,o),a=ir(tr(r,i,o),n);let c,l=Math.floor((s-a+14-t)/7);return l<1?(c=r-1,l=Pr(c,t,n)):l>Pr(r,t,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...Ar(e)}}function sr(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=ir(tr(r,1,t),n),a=Cr(r);let c,l=7*i+o-s-7+t;l<1?(c=r-1,l+=Cr(c)):l>a?(c=r+1,l-=Cr(r)):c=r;const{month:u,day:d}=rr(c,l);return{year:c,month:u,day:d,...Ar(e)}}function ar(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:nr(t,n,r),...Ar(e)}}function cr(e){const{year:t,ordinal:n}=e,{month:r,day:i}=rr(t,n);return{year:t,month:r,day:i,...Ar(e)}}function lr(e,t){if(!hr(e.localWeekday)||!hr(e.localWeekNumber)||!hr(e.localWeekYear)){if(!hr(e.weekday)||!hr(e.weekNumber)||!hr(e.weekYear))throw new Rt("Cannot mix locale-based week fields with ISO-based week fields");return hr(e.localWeekday)||(e.weekday=e.localWeekday),hr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),hr(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 ur(e){const t=fr(e.year),n=br(e.month,1,12),r=br(e.day,1,Tr(e.year,e.month));return t?n?!r&&er("day",e.day):er("month",e.month):er("year",e.year)}function dr(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=br(t,0,23)||24===t&&0===n&&0===r&&0===i,s=br(n,0,59),a=br(r,0,59),c=br(i,0,999);return o?s?a?!c&&er("millisecond",i):er("second",r):er("minute",n):er("hour",t)}function hr(e){return void 0===e}function mr(e){return"number"==typeof e}function fr(e){return"number"==typeof e&&e%1==0}function pr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function gr(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function yr(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 vr(e,t){return{}.hasOwnProperty.call(e,t)}function wr(e){if(null==e)return null;if("object"!=typeof e)throw new jt("Week settings must be an object");if(!br(e.firstDay,1,7)||!br(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!br(e,1,7)))throw new jt("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function br(e,t,n){return fr(e)&&e>=t&&e<=n}function xr(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function kr(e){return hr(e)||null===e||""===e?void 0:parseInt(e,10)}function Sr(e){return hr(e)||null===e||""===e?void 0:parseFloat(e)}function Nr(e){if(!hr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function _r(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 $r(e){return e%4==0&&(e%100!=0||e%400==0)}function Cr(e){return $r(e)?366:365}function Tr(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?$r(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Ir(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 Er(e,t,n){return-ir(tr(e,1,t),n)+t-1}function Pr(e,t=4,n=1){const r=Er(e,t,n),i=Er(e+1,t,n);return(Cr(e)-r+i)/7}function Dr(e){return e>99?e:e>Qn.twoDigitCutoffYear?1900+e:2e3+e}function Mr(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 zr(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 Rr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new jt(`Invalid unit value ${e}`);return t}function Or(e,t){const n={};for(const r in e)if(vr(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=Rr(i)}return n}function jr(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}${xr(n,2)}:${xr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${xr(n,2)}${xr(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Ar(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const Wr=["January","February","March","April","May","June","July","August","September","October","November","December"],Lr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Br=["J","F","M","A","M","J","J","A","S","O","N","D"];function Fr(e){switch(e){case"narrow":return[...Br];case"short":return[...Lr];case"long":return[...Wr];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 qr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Hr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ur=["M","T","W","T","F","S","S"];function Zr(e){switch(e){case"narrow":return[...Ur];case"short":return[...Hr];case"long":return[...qr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Yr=["AM","PM"],Gr=["Before Christ","Anno Domini"],Jr=["BC","AD"],Qr=["B","A"];function Vr(e){switch(e){case"narrow":return[...Qr];case"short":return[...Jr];case"long":return[...Gr];default:return null}}function Kr(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const Xr={D:Ft,DD:qt,DDD:Ut,DDDD:Zt,t:Yt,tt:Gt,ttt:Jt,tttt:Qt,T:Vt,TT:Kt,TTT:Xt,TTTT:en,f:tn,ff:rn,fff:an,ffff:ln,F:nn,FF:on,FFF:cn,FFFF:un};class ei{static create(e,t={}){return new ei(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 Xr[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 xr(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 Fr(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return Zr(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),c=t=>{const n=ei.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},l=t=>n?function(e,t){return Vr(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return Kr(ei.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 Yr[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 l("short");case"GG":return l("long");case"GGGGG":return l("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 c(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=ei.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 Kr(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 ti=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function ni(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function ri(...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 ii(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 oi(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=kr(t[n+i]);return[r,null,n+i]}}const si=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ai=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ci=RegExp(`${ai.source}(?:${si.source}?(?:\\[(${ti.source})\\])?)?`),li=RegExp(`(?:[Tt]${ci.source})?`),ui=oi("weekYear","weekNumber","weekDay"),di=oi("year","ordinal"),hi=RegExp(`${ai.source} ?(?:${si.source}|(${ti.source}))?`),mi=RegExp(`(?: ${hi.source})?`);function fi(e,t,n){const r=e[t];return hr(r)?n:kr(r)}function pi(e,t){return[{hours:fi(e,t,0),minutes:fi(e,t+1,0),seconds:fi(e,t+2,0),milliseconds:Nr(e[t+3])},null,t+4]}function gi(e,t){const n=!e[t]&&!e[t+1],r=zr(e[t+1],e[t+2]);return[{},n?null:zn.instance(r),t+3]}function yi(e,t){return[{},e[t]?yn.create(e[t]):null,t+1]}const vi=RegExp(`^T?${ai.source}$`),wi=/^-?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 bi(e){const[t,n,r,i,o,s,a,c,l]=e,u="-"===t[0],d=c&&"-"===c[0],h=(e,t=!1)=>void 0!==e&&(t||e&&u)?-e:e;return[{years:h(Sr(n)),months:h(Sr(r)),weeks:h(Sr(i)),days:h(Sr(o)),hours:h(Sr(s)),minutes:h(Sr(a)),seconds:h(Sr(c),"-0"===c),milliseconds:h(Nr(l),d)}]}const xi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function ki(e,t,n,r,i,o,s){const a={year:2===t.length?Dr(kr(t)):kr(t),month:Lr.indexOf(n)+1,day:kr(r),hour:kr(i),minute:kr(o)};return s&&(a.second=kr(s)),e&&(a.weekday=e.length>3?qr.indexOf(e)+1:Hr.indexOf(e)+1),a}const Si=/^(?:(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 Ni(e){const[,t,n,r,i,o,s,a,c,l,u,d]=e,h=ki(t,i,r,n,o,s,a);let m;return m=c?xi[c]:l?0:zr(u,d),[h,new zn(m)]}const _i=/^(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$/,$i=/^(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$/,Ci=/^(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 Ti(e){const[,t,n,r,i,o,s,a]=e;return[ki(t,i,r,n,o,s,a),zn.utcInstance]}function Ii(e){const[,t,n,r,i,o,s,a]=e;return[ki(t,a,n,r,i,o,s),zn.utcInstance]}const Ei=ni(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,li),Pi=ni(/(\d{4})-?W(\d\d)(?:-?(\d))?/,li),Di=ni(/(\d{4})-?(\d{3})/,li),Mi=ni(ci),zi=ri(function(e,t){return[{year:fi(e,t),month:fi(e,t+1,1),day:fi(e,t+2,1)},null,t+3]},pi,gi,yi),Ri=ri(ui,pi,gi,yi),Oi=ri(di,pi,gi,yi),ji=ri(pi,gi,yi),Ai=ri(pi),Wi=ni(/(\d{4})-(\d\d)-(\d\d)/,mi),Li=ni(hi),Bi=ri(pi,gi,yi),Fi="Invalid Duration",qi={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}},Hi={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},...qi},Ui={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},...qi},Zi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Yi=Zi.slice(0).reverse();function Gi(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 Ki(r)}function Ji(e,t){let n=t.milliseconds??0;for(const r of Yi.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function Qi(e,t){const n=Ji(e,t)<0?-1:1;Zi.reduceRight((r,i)=>{if(hr(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),Zi.reduce((n,r)=>{if(hr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function Vi(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class Ki{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?Ui:Hi;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Dn.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return Ki.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new jt("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new Ki({values:Or(e,Ki.normalizeUnit),loc:Dn.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(mr(e))return Ki.fromMillis(e);if(Ki.isDuration(e))return e;if("object"==typeof e)return Ki.fromObject(e);throw new jt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return ii(e,[wi,bi])}(e);return n?Ki.fromObject(n,t):Ki.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return ii(e,[vi,Ai])}(e);return n?Ki.fromObject(n,t):Ki.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new jt("need to specify a reason the Duration is invalid");const n=e instanceof Vn?e:new Vn(e,t);if(Qn.throwOnInvalid)throw new zt(n);return new Ki({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 Ot(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?ei.create(this.loc,n).formatDurationFromString(this,e):Fi}toHuman(e={}){if(!this.isValid)return Fi;const t=!1!==e.showZeros,n=Zi.map(n=>{const r=this.values[n];return hr(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+=_r(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},Uo.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?Ji(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Ki.fromDurationLike(e),n={};for(const e of Zi)(vr(t.values,e)||vr(this.values,e))&&(n[e]=t.get(e)+this.get(e));return Gi(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=Ki.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]=Rr(e(this.values[n],n));return Gi(this,{values:t},!0)}get(e){return this[Ki.normalizeUnit(e)]}set(e){return this.isValid?Gi(this,{values:{...this.values,...Or(e,Ki.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return Gi(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 Qi(this.matrix,e),Gi(this,{values:e},!0)}rescale(){return this.isValid?Gi(this,{values:Vi(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>Ki.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of Zi)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;mr(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else mr(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 Qi(this.matrix,t),Gi(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 Gi(this,{values:e},!0)}removeZeros(){return this.isValid?Gi(this,{values:Vi(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 Zi)if(!t(this.values[n],e.values[n]))return!1;return!0}}const Xi="Invalid Interval";class eo{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 jt("need to specify a reason the Interval is invalid");const n=e instanceof Vn?e:new Vn(e,t);if(Qn.throwOnInvalid)throw new Mt(n);return new eo({invalid:n})}static fromDateTimes(e,t){const n=Zo(e),r=Zo(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?eo.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:eo.invalid("missing or invalid end"):eo.invalid("missing or invalid start")}(n,r);return null==i?new eo({start:n,end:r}):i}static after(e,t){const n=Ki.fromDurationLike(t),r=Zo(e);return eo.fromDateTimes(r,r.plus(n))}static before(e,t){const n=Ki.fromDurationLike(t),r=Zo(e);return eo.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=Uo.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=Uo.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return eo.fromDateTimes(e,o);if(i){const n=Ki.fromISO(r,t);if(n.isValid)return eo.after(e,n)}else if(s){const e=Ki.fromISO(n,t);if(e.isValid)return eo.before(o,e)}}return eo.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?eo.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Zo).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(eo.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=Ki.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(eo.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:eo.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 eo.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(eo.fromDateTimes(t,e.time)),t=null);return eo.merge(r)}difference(...e){return eo.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Xi}[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=Ft,t={}){return this.isValid?ei.create(this.s.loc.clone(t),e).formatInterval(this):Xi}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Xi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Xi}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Xi}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Xi}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Ki.invalid(this.invalidReason)}mapEndpoints(e){return eo.fromDateTimes(e(this.s),e(this.e))}}class to{static hasDST(e=Qn.defaultZone){const t=Uo.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return yn.isValidZone(e)}static normalizeZone(e){return On(e,Qn.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Dn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Dn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Dn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Dn.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Dn.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Dn.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Dn.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Dn.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Dn.create(t,null,"gregory").eras(e)}static features(){return{relative:pr(),localeWeek:gr()}}}function no(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(Ki.fromMillis(r).as("days"))}function ro(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(jn.hanidec))t+=Wn.indexOf(e[n]);else for(const e in An){const[n,i]=An[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const io=`[ ${String.fromCharCode(160)}]`,oo=new RegExp(io,"g");function so(e){return e.replace(/\./g,"\\.?").replace(oo,io)}function ao(e){return e.replace(/\./g,"").replace(oo," ").toLowerCase()}function co(e,t){return null===e?null:{regex:RegExp(e.map(so).join("|")),deser:([n])=>e.findIndex(e=>ao(n)===ao(e))+t}}function lo(e,t){return{regex:e,deser:([,e,t])=>zr(e,t),groups:t}}function uo(e){return{regex:e,deser:([e])=>e}}const ho={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 mo=null;function fo(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=yo(ei.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class po{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=fo(ei.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=Bn(t),r=Bn(t,"{2}"),i=Bn(t,"{3}"),o=Bn(t,"{4}"),s=Bn(t,"{6}"),a=Bn(t,"{1,2}"),c=Bn(t,"{1,3}"),l=Bn(t,"{1,6}"),u=Bn(t,"{1,9}"),d=Bn(t,"{2,4}"),h=Bn(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 co(t.eras("short"),0);case"GG":return co(t.eras("long"),0);case"y":return ro(l);case"yy":case"kk":return ro(d,Dr);case"yyyy":case"kkkk":return ro(o);case"yyyyy":return ro(h);case"yyyyyy":return ro(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return ro(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return ro(r);case"MMM":return co(t.months("short",!0),1);case"MMMM":return co(t.months("long",!0),1);case"LLL":return co(t.months("short",!1),1);case"LLLL":return co(t.months("long",!1),1);case"o":case"S":return ro(c);case"ooo":case"SSS":return ro(i);case"u":return uo(u);case"uu":return uo(a);case"uuu":case"E":case"c":return ro(n);case"a":return co(t.meridiems(),0);case"EEE":return co(t.weekdays("short",!1),1);case"EEEE":return co(t.weekdays("long",!1),1);case"ccc":return co(t.weekdays("short",!0),1);case"cccc":return co(t.weekdays("long",!0),1);case"Z":case"ZZ":return lo(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return lo(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return uo(/[a-z_+-/]{1,256}?/i);case" ":return uo(/[^\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(vr(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;hr(e.z)||(n=yn.create(e.z)),hr(e.Z)||(n||(n=new zn(e.Z)),t=e.Z),hr(e.q)||(e.M=3*(e.q-1)+1),hr(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),hr(e.u)||(e.S=Nr(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(vr(n,"a")&&vr(n,"H"))throw new Rt("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 go(e,t,n){return new po(e,n).explainFromTokens(t)}function yo(e,t){if(!e)return null;const n=ei.create(t,e).dtFormatter((mo||(mo=Uo.fromMillis(1555555555555)),mo)),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=ho[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const vo="Invalid DateTime",wo=864e13;function bo(e){return new Vn("unsupported zone",`the zone "${e.name}" is not supported`)}function xo(e){return null===e.weekData&&(e.weekData=or(e.c)),e.weekData}function ko(e){return null===e.localWeekData&&(e.localWeekData=or(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function So(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Uo({...n,...t,old:n})}function No(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 _o(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 $o(e,t,n){return No(Ir(e),t,n)}function Co(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,Tr(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=Ki.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=Ir(o);let[c,l]=No(a,n,e.zone);return 0!==s&&(c+=s,l=e.zone.offset(c)),{ts:c,o:l}}function To(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=Uo.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Uo.invalid(new Vn("unparsable",`the input "${i}" can't be parsed as ${r}`))}function Io(e,t,n=!0){return e.isValid?ei.create(Dn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Eo(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=xr(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=xr(e.c.month),"month"===n)return i;i+="-"}else if(i+=xr(e.c.month),"month"===n)return i;return i+=xr(e.c.day),i}function Po(e,t,n,r,i,o,s){let a=!n||0!==e.c.millisecond||0!==e.c.second,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=xr(e.c.hour),"hour"===s)break;if(t){if(c+=":",c+=xr(e.c.minute),"minute"===s)break;a&&(c+=":",c+=xr(e.c.second))}else{if(c+=xr(e.c.minute),"minute"===s)break;a&&(c+=xr(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(c+=".",c+=xr(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?c+="Z":e.o<0?(c+="-",c+=xr(Math.trunc(-e.o/60)),c+=":",c+=xr(Math.trunc(-e.o%60))):(c+="+",c+=xr(Math.trunc(e.o/60)),c+=":",c+=xr(Math.trunc(e.o%60)))),o&&(c+="["+e.zone.ianaName+"]"),c}const Do={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Mo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},zo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ro=["year","month","day","hour","minute","second","millisecond"],Oo=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],jo=["year","ordinal","hour","minute","second","millisecond"];function Ao(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 Ot(e);return t}function Wo(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Ao(e)}}function Lo(e,t){const n=On(t.zone,Qn.defaultZone);if(!n.isValid)return Uo.invalid(bo(n));const r=Dn.fromObject(t);let i,o;if(hr(e.year))i=Qn.now();else{for(const t of Ro)hr(e[t])&&(e[t]=Do[t]);const t=ur(e)||dr(e);if(t)return Uo.invalid(t);const r=function(e){if(void 0===qo&&(qo=Qn.now()),"iana"!==e.type)return e.offset(qo);const t=e.name;let n=Ho.get(t);return void 0===n&&(n=e.offset(qo),Ho.set(t,n)),n}(n);[i,o]=$o(e,r,n)}return new Uo({ts:i,zone:n,loc:r,o:o})}function Bo(e,t,n){const r=!!hr(n.round)||n.round,i=hr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=_r(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 Fo(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 qo;const Ho=new Map;class Uo{constructor(e){const t=e.zone||Qn.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new Vn("invalid input"):null)||(t.isValid?null:bo(t));this.ts=hr(e.ts)?Qn.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=mr(e.o)&&!e.old?e.o:t.offset(this.ts);r=_o(this.ts,o),n=Number.isNaN(r.year)?new Vn("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||Dn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Uo({})}static local(){const[e,t]=Fo(arguments),[n,r,i,o,s,a,c]=t;return Lo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},e)}static utc(){const[e,t]=Fo(arguments),[n,r,i,o,s,a,c]=t;return e.zone=zn.utcInstance,Lo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},e)}static fromJSDate(e,t={}){const n=function(e){return"[object Date]"==={}.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(n))return Uo.invalid("invalid input");const r=On(t.zone,Qn.defaultZone);return r.isValid?new Uo({ts:n,zone:r,loc:Dn.fromObject(t)}):Uo.invalid(bo(r))}static fromMillis(e,t={}){if(mr(e))return e<-wo||e>wo?Uo.invalid("Timestamp out of range"):new Uo({ts:e,zone:On(t.zone,Qn.defaultZone),loc:Dn.fromObject(t)});throw new jt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(mr(e))return new Uo({ts:1e3*e,zone:On(t.zone,Qn.defaultZone),loc:Dn.fromObject(t)});throw new jt("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=On(t.zone,Qn.defaultZone);if(!n.isValid)return Uo.invalid(bo(n));const r=Dn.fromObject(t),i=Or(e,Wo),{minDaysInFirstWeek:o,startOfWeek:s}=lr(i,r),a=Qn.now(),c=hr(t.specificOffset)?n.offset(a):t.specificOffset,l=!hr(i.ordinal),u=!hr(i.year),d=!hr(i.month)||!hr(i.day),h=u||d,m=i.weekYear||i.weekNumber;if((h||l)&&m)throw new Rt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new Rt("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!h;let p,g,y=_o(a,c);f?(p=Oo,g=Mo,y=or(y,o,s)):l?(p=jo,g=zo,y=ar(y)):(p=Ro,g=Do);let v=!1;for(const e of p)hr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=f?function(e,t=4,n=1){const r=fr(e.weekYear),i=br(e.weekNumber,1,Pr(e.weekYear,t,n)),o=br(e.weekday,1,7);return r?i?!o&&er("weekday",e.weekday):er("week",e.weekNumber):er("weekYear",e.weekYear)}(i,o,s):l?function(e){const t=fr(e.year),n=br(e.ordinal,1,Cr(e.year));return t?!n&&er("ordinal",e.ordinal):er("year",e.year)}(i):ur(i),b=w||dr(i);if(b)return Uo.invalid(b);const x=f?sr(i,o,s):l?cr(i):i,[k,S]=$o(x,c,n),N=new Uo({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&e.weekday!==N.weekday?Uo.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${N.toISO()}`):N.isValid?N:Uo.invalid(N.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return ii(e,[Ei,zi],[Pi,Ri],[Di,Oi],[Mi,ji])}(e);return To(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return ii(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[Si,Ni])}(e);return To(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return ii(e,[_i,Ti],[$i,Ti],[Ci,Ii])}(e);return To(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(hr(e)||hr(t))throw new jt("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Dn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,l]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=go(e,t,n);return[r,i,o,s]}(o,e,t);return l?Uo.invalid(l):To(s,a,n,`format ${t}`,e,c)}static fromString(e,t,n={}){return Uo.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return ii(e,[Wi,zi],[Li,Bi])}(e);return To(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new jt("need to specify a reason the DateTime is invalid");const n=e instanceof Vn?e:new Vn(e,t);if(Qn.throwOnInvalid)throw new Dt(n);return new Uo({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=yo(e,Dn.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return fo(ei.parseFormat(e),Dn.fromObject(t)).map(e=>e.val).join("")}static resetCache(){qo=void 0,Ho.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?xo(this).weekYear:NaN}get weekNumber(){return this.isValid?xo(this).weekNumber:NaN}get weekday(){return this.isValid?xo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?ko(this).weekday:NaN}get localWeekNumber(){return this.isValid?ko(this).weekNumber:NaN}get localWeekYear(){return this.isValid?ko(this).weekYear:NaN}get ordinal(){return this.isValid?ar(this.c).ordinal:NaN}get monthShort(){return this.isValid?to.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?to.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?to.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?to.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=Ir(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,c=n-s*t,l=_o(a,o),u=_o(c,s);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[So(this,{ts:a}),So(this,{ts:c})]:[this]}get isInLeapYear(){return $r(this.year)}get daysInMonth(){return Tr(this.year,this.month)}get daysInYear(){return this.isValid?Cr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Pr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Pr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=ei.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(zn.instance(e),t)}toLocal(){return this.setZone(Qn.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=On(e,Qn.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]=$o(n,t,e)}return So(this,{ts:r,zone:e})}return Uo.invalid(bo(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return So(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=Or(e,Wo),{minDaysInFirstWeek:n,startOfWeek:r}=lr(t,this.loc),i=!hr(t.weekYear)||!hr(t.weekNumber)||!hr(t.weekday),o=!hr(t.ordinal),s=!hr(t.year),a=!hr(t.month)||!hr(t.day),c=s||a,l=t.weekYear||t.weekNumber;if((c||o)&&l)throw new Rt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Rt("Can't mix ordinal dates with month/day");let u;i?u=sr({...or(this.c,n,r),...t},n,r):hr(t.ordinal)?(u={...this.toObject(),...t},hr(t.day)&&(u.day=Math.min(Tr(u.year,u.month),u.day))):u=cr({...ar(this.c),...t});const[d,h]=$o(u,this.o,this.zone);return So(this,{ts:d,o:h})}plus(e){return this.isValid?So(this,Co(this,Ki.fromDurationLike(e))):this}minus(e){return this.isValid?So(this,Co(this,Ki.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=Ki.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?ei.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):vo}toLocaleString(e=Ft,t={}){return this.isValid?ei.create(this.loc.clone(t),e).formatDateTime(this):vo}toLocaleParts(e={}){return this.isValid?ei.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=Eo(this,s,o=Ao(o));return Ro.indexOf(o)>=3&&(a+="T"),a+=Po(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Eo(this,"extended"===e,Ao(t)):null}toISOWeekDate(){return Io(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=Ao(s),(r&&Ro.indexOf(s)>=3?"T":"")+Po(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return Io(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Io(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Eo(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")),Io(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():vo}[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 Ki.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(Ki.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=no(e,t);return(n-n%7)/7}],["days",no]],i={},o=e;let s,a;for(const[c,l]of r)n.indexOf(c)>=0&&(s=c,i[c]=l(e,t),a=o.plus(i),a>t?(i[c]--,(e=o.plus(i))>t&&(a=e,i[c]--,e=o.plus(i))):e=a);return[e,i,a,s]}(e,t,n);const c=t-i,l=n.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===l.length&&(s<t&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));const u=Ki.fromObject(o,r);return l.length>0?Ki.fromMillis(c,r).shiftTo(...l).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(Uo.now(),e,t)}until(e){return this.isValid?eo.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||Uo.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),Bo(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Bo(e.base||Uo.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(Uo.isDateTime))throw new jt("min requires all arguments be DateTimes");return yr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(Uo.isDateTime))throw new jt("max requires all arguments be DateTimes");return yr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return go(Dn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return Uo.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=Dn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new po(i,e)}static fromFormatParser(e,t,n={}){if(hr(e)||hr(t))throw new jt("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Dn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new jt(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:s,zone:a,specificOffset:c,invalidReason:l}=t.explainFromTokens(e);return l?Uo.invalid(l):To(s,a,n,`format ${t.format}`,e,c)}static get DATE_SHORT(){return Ft}static get DATE_MED(){return qt}static get DATE_MED_WITH_WEEKDAY(){return Ht}static get DATE_FULL(){return Ut}static get DATE_HUGE(){return Zt}static get TIME_SIMPLE(){return Yt}static get TIME_WITH_SECONDS(){return Gt}static get TIME_WITH_SHORT_OFFSET(){return Jt}static get TIME_WITH_LONG_OFFSET(){return Qt}static get TIME_24_SIMPLE(){return Vt}static get TIME_24_WITH_SECONDS(){return Kt}static get TIME_24_WITH_SHORT_OFFSET(){return Xt}static get TIME_24_WITH_LONG_OFFSET(){return en}static get DATETIME_SHORT(){return tn}static get DATETIME_SHORT_WITH_SECONDS(){return nn}static get DATETIME_MED(){return rn}static get DATETIME_MED_WITH_SECONDS(){return on}static get DATETIME_MED_WITH_WEEKDAY(){return sn}static get DATETIME_FULL(){return an}static get DATETIME_FULL_WITH_SECONDS(){return cn}static get DATETIME_HUGE(){return ln}static get DATETIME_HUGE_WITH_SECONDS(){return un}}function Zo(e){if(Uo.isDateTime(e))return e;if(e&&e.valueOf&&mr(e.valueOf()))return Uo.fromJSDate(e);if(e&&"object"==typeof e)return Uo.fromObject(e);throw new jt(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function Yo({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return Oe("div",{className:vt.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:mt.colors.accent}),children:Oe("div",{className:vt.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Oe("div",{className:vt.create("page-heading-wrapper",{width:"100%",marginBottom:mt.spacing.lg}),children:Oe($t,{children:Oe("div",{className:vt.create("page-heading-container",{backgroundColor:mt.colors.primary,color:mt.colors.primaryForeground,borderRadius:mt.radius.large,padding:`${mt.spacing.lg} ${mt.spacing.xl}`,boxShadow:mt.shadow.md}),children:Oe("div",{className:vt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:mt.spacing.lg}),children:Oe("div",{className:vt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Oe("h1",{className:vt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:mt.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&Oe("p",{className:vt.create("page-template-description",{margin:"0",marginTop:mt.spacing.sm,fontSize:mt.fontSize.small,lineHeight:"1.5",color:mt.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function Go({className:e,children:t}){const n=vt.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Oe("div",{className:Nt(n,e),children:t})}function Jo({message:e}){return Oe(Yo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe(Go,{className:vt.name("loading-container"),children:Oe(_t,{size:"large"})})})})}function Qo({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:mt.colors.primary,color:mt.colors.primaryForeground,boxShadow:mt.shadow.sm},outline:{border:`${mt.borderWidth} solid ${mt.colors.primary}`,backgroundColor:mt.colors.card,color:mt.colors.primary,boxShadow:mt.shadow.sm}},l=vt.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:mt.radius.default,cursor:"pointer",fontSize:mt.fontSize.default,fontWeight:"500",transition:mt.transition,fontFamily:mt.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});vt.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),vt.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:mt.shadow.md}),vt.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:mt.shadow.sm});const u=vt.create(`button-${e}`,{...c[e]});return Oe("button",{type:t,className:Nt(l,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Oe(_t,{size:"small"}),o]})}function Vo({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 Oe(Yo,{title:t.title,noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe("div",{className:vt.create("error-page-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Oe("div",{className:vt.create("error-page-card",{backgroundColor:mt.colors.card,boxShadow:mt.shadow.sm,borderRadius:mt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"500px"}),children:[Oe("div",{className:vt.create("error-page-header",{paddingInline:mt.spacing.xl,paddingTop:mt.spacing.xl,paddingBottom:mt.spacing.lg,textAlign:"center"},{"(max-width: 768px)":{paddingInline:mt.spacing.lg,paddingTop:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingTop:mt.spacing.md}}),children:[Oe("div",{className:vt.create("error-page-icon-wrapper",{display:"flex",justifyContent:"center",marginBottom:mt.spacing.lg}),children:Oe("div",{className:vt.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:Oe("svg",{className:vt.create("error-page-icon",{width:"2rem",height:"2rem",color:mt.colors.destructive}),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Oe("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"})})})}),Oe("h2",{className:vt.create("error-page-title",{margin:"0",marginBottom:mt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:mt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:t.title}),Oe("p",{className:vt.create("error-page-description",{margin:"0",marginTop:mt.spacing.sm,fontSize:mt.fontSize.default,lineHeight:"1.6",color:mt.colors.mutedForeground}),children:t.message})]}),Oe("div",{className:vt.create("error-page-content",{paddingInline:mt.spacing.xl,paddingBottom:mt.spacing.xl},{"(max-width: 768px)":{paddingInline:mt.spacing.lg,paddingBottom:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingBottom:mt.spacing.md}}),children:[n&&Oe("p",{className:vt.create("error-page-support",{margin:"0",marginBottom:mt.spacing.lg,fontSize:mt.fontSize.small,lineHeight:"1.5",color:mt.colors.mutedForeground,textAlign:"center"}),children:["If this problem persists, please contact support with reference"," ",Oe("span",{className:vt.create("error-page-ref",{fontFamily:"monospace",fontWeight:"600",color:mt.colors.foreground}),children:n})]}),Oe(Qo,{onClick:()=>{window.location.reload()},className:vt.create("error-page-button",{width:"100%"}),children:"Try Again"})]})]})})})})}function Ko({message:e,estimatedTime:t}){const n=vt.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=vt.create("maintenance-icon",{width:"4rem",height:"4rem",color:mt.colors.primary,marginBottom:"1.5rem"}),i=vt.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:mt.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=vt.create("maintenance-message",{fontSize:mt.fontSize.default,color:mt.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=vt.create("maintenance-info-box",{backgroundColor:mt.colors.muted,borderRadius:mt.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=vt.create("maintenance-info-title",{fontSize:mt.fontSize.default,fontWeight:"600",color:mt.colors.foreground,marginBottom:"0.5rem"}),c=vt.create("maintenance-info-text",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,lineHeight:"1.4"}),l=vt.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Oe(Yo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Oe($t,{children:Oe(Go,{children:Oe("div",{className:n,children:[Oe(()=>Oe("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:Oe("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"})}),{}),Oe("h1",{className:i,children:"We'll be right back"}),Oe("p",{className:o,children:e||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Oe("div",{className:s,children:[Oe("p",{className:a,children:"What's happening?"}),Oe("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),t&&Oe("p",{className:c,style:{marginTop:"0.5rem"},children:[Oe("strong",{children:"Estimated time:"})," ",t]})]}),Oe("div",{className:l,children:Oe(Qo,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function Xo({size:e="default",style:t="normal",className:n,children:r}){const i=vt.create("text",{marginTop:"0",marginBottom:"0"}),o=vt.create("text-small",{fontSize:mt.fontSize.small}),s=vt.create("text-default",{fontSize:mt.fontSize.default}),a=vt.create("text-italic",{fontStyle:"italic"}),c=vt.create("text-bold",{fontWeight:"bold"}),l=vt.create("text-underline",{textDecoration:"underline"}),u=Nt({[a]:"italic"===t,[c]:"bold"===t,[l]:"underline"===t}),d=Nt({[o]:"small"===e,[s]:"default"===e});return Oe("p",{className:Nt(i,d,u,n),children:r})}function es({title:e,description:t}){return Oe("div",{className:vt.create("section-header",{}),children:[Oe("p",{className:vt.create("section-title",{fontSize:mt.fontSize.large,margin:"0",color:mt.colors.foreground}),children:e}),t&&Oe(Xo,{className:vt.create("section-description",{color:mt.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 ts({selected:e}){return Oe("div",{className:Nt(vt.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${mt.borderWidth} solid transparent`}),e?vt.create("selected-indicator-selected",{backgroundColor:mt.colors.primary}):vt.create("selected-indicator-unselected",{border:`${mt.borderWidth} solid ${mt.colors.border}`}))})}function ns({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 Oe("div",{className:vt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Oe(es,{title:"Excess Options"}),Oe("div",{className:vt.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Oe("div",{className:Nt(vt.create("excess-option-card",{borderRadius:mt.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?vt.create("excess-option-card-selected",{border:`2px solid ${mt.colors.primary}`,backgroundColor:mt.colors.accent}):vt.create("excess-option-card-unselected",{border:`2px solid ${mt.colors.border}`,backgroundColor:mt.colors.card})),onClick:()=>n(e.id),children:[Oe(ts,{selected:r}),Oe("div",{className:vt.create("excess-amount",{color:mt.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})}),(null==i?void 0:i.description)&&Oe("div",{className:vt.create("excess-description",{padding:"0.75rem",backgroundColor:mt.colors.muted,borderRadius:mt.radius.default,border:`1px solid ${mt.colors.border}`}),children:Oe(Xo,{className:vt.create("excess-description-text",{fontSize:mt.fontSize.small,color:mt.colors.foreground,margin:"0"}),children:i.description})})]})}function rs(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function is(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 os({paymentOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=et(()=>{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?Oe(ss,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Oe("div",{className:vt.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Oe(ss,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function ss({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return Oe("div",{className:vt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Oe(es,{title:"Payment Options"}),Oe("div",r?{className:vt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Oe(as,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${e.excess_id}`))}:{className:vt.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${mt.colors.border}`,borderRadius:mt.radius.default,backgroundColor:mt.colors.muted}),children:Oe(Xo,{className:vt.create("placeholder-text",{color:mt.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function as({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?rs(e.amount.dueToday):`${rs(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`:"Currently Unavailable",s=()=>"bank_transfer"===e.gateway.code?"Manual":`via ${e.gateway.name}`;return Oe("div",{className:Nt(vt.create("payment-option-row",{borderRadius:mt.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: 480px)":{padding:"0.625rem 0.75rem",gap:"0.25rem",flexWrap:"wrap",alignItems:"flex-start"}}),r?vt.create("payment-option-row-selected",{border:`2px solid ${mt.colors.primary}`,backgroundColor:mt.colors.accent}):vt.create("payment-option-row-unselected",{border:`2px solid ${mt.colors.border}`,backgroundColor:mt.colors.card})),onClick:()=>i&&n(e),children:[Oe("div",{className:vt.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Oe(ts,{selected:r}),Oe("div",{className:vt.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Oe("div",{className:vt.create("frequency-title",{fontSize:mt.fontSize.default,fontWeight:"500",color:mt.colors.foreground}),children:is(e.amount.frequency,e.gateway.code)}),Oe("div",{className:vt.create("gateway-description",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground}),children:s()})]})]}),Oe("div",{className:vt.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Oe(Xo,{className:vt.create("amount-text",{textAlign:"right",color:i?mt.colors.foreground:mt.colors.mutedForeground,fontStyle:i?"normal":"italic"}),children:o()}),i&&"bank_transfer"!==e.gateway.code&&Oe(Xo,{size:"small",className:vt.create("gateway-fee-text",{textAlign:"right",color:mt.colors.mutedForeground}),children:[rs(e.amount.gatewayFee)," fee"]}),i&&"bank_transfer"===e.gateway.code&&Oe(Xo,{size:"small",className:vt.create("no-fee-text",{textAlign:"right",color:mt.colors.mutedForeground}),children:"No fees"})]}),Oe("div",{className:vt.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Oe(ts,{selected:r}),Oe("div",{className:vt.create("payment-option-title-mobile",{fontSize:mt.fontSize.default,fontWeight:"500",color:mt.colors.foreground}),children:is(e.amount.frequency,e.gateway.code)})]}),Oe("div",{className:vt.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:[Oe("div",{className:vt.create("gateway-description-mobile",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground}),children:s()}),Oe(Xo,{className:vt.create("amount-text-mobile",{fontWeight:"500",color:i?mt.colors.foreground:mt.colors.mutedForeground,fontStyle:i?"normal":"italic"}),children:o()})]})]})}const cs=e=>{try{return new Date(e).toLocaleDateString("en-NZ",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}};function ls({excessOptions:e,selectedExcessId:t,onEditQuote:n,isEditingQuote:r=!1,productName:i,quoteIntent:o}){const s=et(()=>t?e.find(e=>e.id===t):null,[e,t]),a=null==s?void 0:s.line_item_display,c=et(()=>{var e;if(!(null===(e=null==o?void 0:o.form_data)||void 0===e?void 0:e.page_data))return null;const t=o.form_data.page_data;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},[o]);return Oe("div",{className:vt.create("cart-summary-container",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.lg,boxShadow:mt.shadow.sm},{"(max-width: 768px)":{padding:mt.spacing.md}}),children:[Oe("h3",{className:vt.create("cart-summary-title",{fontSize:mt.fontSize.large,fontWeight:"600",marginBottom:mt.spacing.md,color:mt.colors.foreground}),children:"Insurance Details"}),c&&Oe(S,{children:[Oe("div",{className:vt.create("cart-client-details",{display:"flex",flexDirection:"column",gap:mt.spacing.sm,marginBottom:mt.spacing.md}),children:[c.firstName&&c.lastName&&Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Name"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:[c.firstName," ",c.lastName]})]}),c.email&&Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Email"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:c.email})]}),c.phone&&Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Phone"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:c.phone})]}),c.dob&&Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Date of Birth"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:cs(c.dob)})]})]}),Oe("hr",{className:vt.create("divider",{border:"none",borderTop:`1px solid ${mt.colors.border}`,margin:`${mt.spacing.md} 0`})})]}),Oe("div",{className:vt.create("cart-product-section",{display:"flex",flexDirection:"column",gap:mt.spacing.sm,marginBottom:mt.spacing.lg}),children:a&&Oe("div",{className:vt.create("cart-item",{display:"flex",flexDirection:"column",gap:mt.spacing.sm}),children:[Oe("div",{className:vt.create("cart-item-description",{fontSize:mt.fontSize.small,fontWeight:"500",color:mt.colors.foreground}),children:a.description}),a.show_sum_insured&&a.sum_insured&&Oe("div",{className:vt.create("cart-item-sum-insured",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground}),children:["Sum Insured: ",rs(a.sum_insured)]})]})}),Oe(Qo,{onClick:n,disabled:r,variant:"outline",className:vt.create("edit-quote-button",{width:"100%"}),children:r?"Clearing quote...":"Edit details"})]})}function us({label:e,value:t,isTotal:n=!1,className:r}){return Oe("div",{className:Nt(vt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Oe("span",{className:vt.create("summary-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:e}),Oe("span",{className:vt.create("summary-value",{fontWeight:n?"600":"500",color:mt.colors.foreground,fontSize:n?mt.fontSize.large:"inherit"}),children:t})]})}function ds({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:c=!1}){return et(()=>n?e.find(e=>e.id===n):null,[e,n]),et(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]),Oe("div",{className:vt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Oe("h3",{className:vt.create("cart-summary-title",{fontSize:mt.fontSize.large,fontWeight:"600",marginBottom:mt.spacing.sm,color:mt.colors.foreground}),children:"Payment Details"}),r&&Oe("div",{className:vt.create("summary-section",{paddingBottom:"1rem"}),children:Oe("div",{className:vt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Oe(S,{children:[Oe(us,{label:"Total Due Today:",value:rs(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Oe(us,{label:"Gateway Fee:",value:rs(r.amount.gatewayFee)})]}):Oe(S,{children:[Oe(us,{label:"Due Today:",value:rs(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Oe(us,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:rs(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Oe(us,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Oe(S,{children:Oe(us,{label:"Total Payable:",value:rs(r.amount.totalRepayable),className:vt.create("total-item",{})})})]})})}),c&&Oe("div",{className:vt.create("continue-later-success",{backgroundColor:`${mt.colors.accent}`,padding:"12px 16px",borderRadius:mt.radius.default,borderLeft:`4px solid ${mt.colors.primary}`}),children:[Oe("h4",{className:vt.create("success-title",{margin:"0 0 4px 0",color:mt.colors.primary,fontSize:mt.fontSize.default,fontWeight:"600"}),children:"No problem!"}),Oe("p",{className:vt.create("success-text",{margin:"0",fontSize:mt.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&&Oe(Qo,{onClick:s,disabled:a,variant:"outline",className:vt.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:mt.fontSize.default,fontWeight:"500"}),children:a?"Sending...":"Continue Later (Email Me)"}),Oe(Qo,{onClick:i,disabled:!o,className:vt.create("purchase-button",{width:"100%",height:"3rem",fontSize:mt.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function hs({details:e,onClose:t}){const n=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{})};return Oe("div",{className:vt.create("bank-transfer-container",{display:"flex",flexDirection:"column",gap:mt.spacing.lg}),children:[Oe("div",{className:vt.create("success-message",{backgroundColor:mt.colors.accent,border:`2px solid ${mt.colors.primary}`,borderRadius:mt.radius.default,padding:mt.spacing.lg,textAlign:"center"}),children:[Oe("div",{className:vt.create("success-icon",{fontSize:"3rem",marginBottom:mt.spacing.sm}),children:"✓"}),Oe("h3",{className:vt.create("success-title",{margin:"0",marginBottom:mt.spacing.sm,color:mt.colors.primary,fontSize:mt.fontSize.large,fontWeight:"600"}),children:"Quote Reserved"}),Oe(Xo,{className:vt.create("success-description",{margin:"0",color:mt.colors.foreground,opacity:"0.9"}),children:"Your quote has been reserved. Please complete the bank transfer to finalize your coverage."})]}),Oe("div",{className:vt.create("transfer-instructions",{backgroundColor:mt.colors.card,border:`1px solid ${mt.colors.border}`,borderRadius:mt.radius.default,padding:mt.spacing.lg}),children:[Oe("h4",{className:vt.create("instructions-title",{margin:"0",marginBottom:mt.spacing.md,fontSize:mt.fontSize.default,fontWeight:"600",color:mt.colors.foreground}),children:"Bank Transfer Instructions"}),Oe("div",{className:vt.create("instructions-grid",{display:"grid",gap:mt.spacing.md}),children:[Oe("div",{className:vt.create("detail-row-highlighted",{backgroundColor:mt.colors.accent,border:`2px solid ${mt.colors.primary}`,borderRadius:mt.radius.default,padding:mt.spacing.md}),children:[Oe("div",{className:vt.create("detail-label",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,marginBottom:"0.25rem",fontWeight:"500"}),children:"Reference Number (IMPORTANT)"}),Oe("div",{className:vt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Oe("code",{className:vt.create("detail-value-code",{fontFamily:"monospace",fontSize:mt.fontSize.large,fontWeight:"700",color:mt.colors.primary,letterSpacing:"0.05em"}),children:e.reference}),Oe("button",{onClick:()=>n(e.reference,"Reference"),className:vt.create("copy-button",{background:"transparent",border:`1px solid ${mt.colors.primary}`,borderRadius:mt.radius.small,padding:"0.25rem 0.5rem",cursor:"pointer",fontSize:mt.fontSize.small,color:mt.colors.primary,transition:"all 150ms ease"}),children:"Copy"})]}),Oe(Xo,{size:"small",className:vt.create("reference-note",{marginTop:"0.5rem",marginBottom:"0",color:mt.colors.foreground,fontWeight:"500"}),children:"⚠️ Please include this reference in your transfer particulars"})]}),Oe("div",{className:vt.create("detail-row",{}),children:[Oe("div",{className:vt.create("detail-label",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Amount"}),Oe("div",{className:vt.create("detail-value",{fontSize:mt.fontSize.large,fontWeight:"600",color:mt.colors.foreground}),children:["$",e.amount.toFixed(2)," ",e.currency]})]}),Oe("div",{className:vt.create("detail-row",{}),children:[Oe("div",{className:vt.create("detail-label",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Name"}),Oe("div",{className:vt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Oe("span",{className:vt.create("detail-value",{fontFamily:"monospace",fontSize:mt.fontSize.default,color:mt.colors.foreground}),children:e.bank_account_name}),Oe("button",{onClick:()=>n(e.bank_account_name,"Account name"),className:vt.create("copy-button-small",{background:"transparent",border:`1px solid ${mt.colors.border}`,borderRadius:mt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]}),Oe("div",{className:vt.create("detail-row",{}),children:[Oe("div",{className:vt.create("detail-label",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Number"}),Oe("div",{className:vt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Oe("span",{className:vt.create("detail-value",{fontFamily:"monospace",fontSize:mt.fontSize.default,color:mt.colors.foreground}),children:e.bank_account_number}),Oe("button",{onClick:()=>n(e.bank_account_number,"Account number"),className:vt.create("copy-button-small",{background:"transparent",border:`1px solid ${mt.colors.border}`,borderRadius:mt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]})]}),e.instructions_html&&Oe("div",{className:vt.create("additional-instructions",{marginTop:mt.spacing.md,paddingTop:mt.spacing.md,borderTop:`1px solid ${mt.colors.border}`}),children:Oe("div",{className:vt.create("instructions-content",{fontSize:mt.fontSize.small,color:mt.colors.foreground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:e.instructions_html}})})]}),Oe("div",{className:vt.create("important-note",{backgroundColor:mt.colors.muted,border:`1px solid ${mt.colors.border}`,borderRadius:mt.radius.default,padding:mt.spacing.md}),children:Oe(Xo,{size:"small",className:vt.create("note-text",{margin:"0",color:mt.colors.foreground,lineHeight:"1.5"}),children:[Oe("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."]})}),Oe("div",{className:vt.create("actions",{display:"flex",justifyContent:"center"}),children:Oe(Qo,{onClick:t,variant:"primary",children:"I've Made the Transfer"})})]})}function ms({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r}){const{fsm:i}=Et(()=>({})),[o,s]=Ve("initiating"),[a,c]=Ve(null),[l,u]=Ve(null),[d,h]=Ve(null),[m,f]=Ve(null);Ke(()=>{e&&r&&p()},[e,r]);const p=async()=>{if(r)try{s("initiating"),c(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){c(e.message||"Failed to initiate payment"),s("failed")}},g=()=>{l&&!l.closed&&l.close(),s("initiating"),c(null),h(null),u(null),f(null),t()},y=()=>{g(),n()};return e?Oe("div","bank_transfer"===o&&m?{className:vt.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:Oe("div",{className:vt.create("modal-content",{backgroundColor:mt.colors.background,borderRadius:mt.radius.large,padding:"2rem",maxWidth:"600px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${mt.colors.border}`,margin:"auto"}),onClick:e=>e.stopPropagation(),children:Oe(hs,{details:m,onClose:y})})}:{className:vt.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:[Oe("div",{className:vt.create("modal-content",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${mt.colors.border}`}),children:[Oe("div",{className:vt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Oe("div",{className:vt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Oe("h2",{className:vt.create("modal-title",{margin:"0",color:mt.colors.foreground,fontSize:mt.fontSize.large}),children:"Payment Processing"})]}),Oe("div",{className:vt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Oe(Xo,{className:vt.create("status-message",{fontSize:mt.fontSize.default,color:mt.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&&Oe(Xo,{className:vt.create("error-message",{color:mt.colors.destructive,fontSize:mt.fontSize.small,padding:"0.75rem",backgroundColor:mt.colors.destructive+"10",borderRadius:mt.radius.default,border:`1px solid ${mt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Oe("div",{className:vt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${mt.colors.border}`,borderTop:`3px solid ${mt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Oe("div",{className:vt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Oe(S,{children:[Oe(Qo,{onClick:g,variant:"outline",children:"Close"}),"cancelled"===o&&Oe(Qo,{onClick:()=>{s("initiating"),c(null),p()},children:"Try Again"})]}):Oe(Qo,"completed"===o?{onClick:g,children:"Continue"}:{onClick:g,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Oe("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function fs({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:Oe("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:mt.colors.primary||"#10b981"},children:Oe("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:Oe("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:mt.colors.destructive},children:[Oe("circle",{cx:"12",cy:"12",r:"10"}),Oe("path",{d:"m15 9-6 6"}),Oe("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:Oe("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:mt.colors.secondary},children:[Oe("circle",{cx:"12",cy:"12",r:"10"}),Oe("path",{d:"m15 9-6 6"}),Oe("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:Oe("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:mt.colors.destructive},children:[Oe("circle",{cx:"12",cy:"12",r:"10"}),Oe("path",{d:"M12 8v4"}),Oe("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=vt.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=vt.create("modal-content",{backgroundColor:mt.colors.background,borderRadius:mt.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${mt.borderWidth} solid ${mt.colors.border}`}),a=vt.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=vt.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:mt.colors.foreground,margin:"0"}),l=vt.create("modal-message",{color:mt.colors.foreground,lineHeight:"1.5",margin:"0"});vt.create("transaction-info",{backgroundColor:mt.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:mt.radius.small,border:`${mt.borderWidth} solid ${mt.colors.border}`,fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,wordBreak:"break-all"});const u=vt.create("modal-button",{backgroundColor:mt.colors.primary,color:mt.colors.primaryForeground,border:"none",borderRadius:mt.radius.default,padding:"0.75rem 1.5rem",fontSize:mt.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=vt.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Oe("div",{className:o,onClick:r,children:Oe("div",{className:s,onClick:e=>e.stopPropagation(),children:Oe("div",{className:a,children:[i.icon,Oe("div",{className:d,children:[Oe("h2",{className:c,children:i.title}),Oe("p",{className:l,children:i.message})]}),Oe("button",{className:u,onClick:r,children:i.buttonText})]})})})}function ps({results:e}){const{fsm:t,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=Et(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[s,a]=Ve(!1),[c,l]=Ve(null),[u,d]=Ve(!1),[h,m]=Ve(!1),[f,p]=Ve(!1),g=new URLSearchParams(window.location.search),y=g.get("status"),v=g.get("transactionId")||g.get("transaction_id"),[w,b]=Ve(!(!y||"failed"!==y&&"declined"!==y&&"cancelled"!==y)),x=e.calculations,k=e.payment_options,S=e.payment_gateways;Ke(()=>{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);Ce(i,e,k.length,n,o)}},[]),Ke(()=>{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 N=Boolean(n&&r),_=null==i?void 0:i.payment_return,$=_&&("declined"===_.paymentStatus||"cancelled"===_.paymentStatus||"error"===_.paymentStatus)||w,C=(null==_?void 0:_.paymentStatus)||("failed"===y?"declined":"cancelled"===y?"cancelled":"error"),T=(null==_?void 0:_.paymentTransactionId)||v||void 0;return Oe(Yo,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Oe($t,{children:[Oe("div",{className:vt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:mt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:mt.spacing.md}}),children:[Oe("div",{className:vt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:mt.colors.card,boxShadow:mt.shadow.sm,borderRadius:mt.radius.large,display:"flex",flexDirection:"column"}),children:[Oe("div",{className:vt.create("checkout-header",{paddingInline:mt.spacing.xl,paddingTop:mt.spacing.xl,paddingBottom:mt.spacing.lg},{"(max-width: 768px)":{paddingInline:mt.spacing.lg,paddingTop:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingTop:mt.spacing.md}}),children:[Oe("h2",{className:vt.create("checkout-title",{margin:"0",marginBottom:mt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:mt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Oe("p",{className:vt.create("checkout-description",{margin:"0",fontSize:mt.fontSize.default,lineHeight:"1.6",color:mt.colors.foreground,opacity:"0.9"}),children:"Choose your excess amount and payment option to secure your coverage."}),Oe("hr",{className:vt.create("checkout-header-border",{marginTop:mt.spacing.lg,borderColor:mt.colors.border})})]}),Oe("div",{className:vt.create("checkout-sections",{paddingInline:mt.spacing.xl,paddingBottom:mt.spacing.xl,display:"flex",flexDirection:"column",gap:mt.spacing.lg},{"(max-width: 768px)":{paddingInline:mt.spacing.lg,paddingBottom:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingBottom:mt.spacing.md}}),children:[Oe(ns,{excessOptions:x,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)}),Oe(os,{paymentOptions:k,paymentGateways:S,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)})]})]}),Oe("div",{className:vt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Oe("div",{className:vt.create("checkout-sidebar-sticky",{position:"sticky",top:mt.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:[Oe(ls,{excessOptions:x,selectedExcessId:n,onEditQuote:async()=>{try{p(!0),await t.clearCalculationResults(),t.navigateToPage(0)}catch(e){alert("Failed to edit quote. Please try again."),p(!1)}},isEditingQuote:f,productName:e.product_name,quoteIntent:i}),Oe("div",{className:vt.create("checkout-sidebar-spacer",{height:mt.spacing.lg},{"(max-width: 950px)":{height:mt.spacing.md}})}),Oe("div",{className:vt.create("checkout-sidebar-card",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,boxShadow:mt.shadow.sm,padding:mt.spacing.lg},{"(max-width: 768px)":{padding:mt.spacing.md}}),children:Oe(ds,{excessOptions:x,paymentGateways:S,selectedExcessId:n,selectedPaymentOption:r,onPurchase:()=>{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"}};l(t),a(!0)},canPurchase:N,onContinueLater: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)}},continueLaterLoading:h,showContinueLaterSuccess:u})})]})})]}),$&&Oe(fs,{type:C,transactionId:T,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())}}),Oe(ms,{isOpen:s,onClose:()=>{a(!1),l(null)},onSuccess:()=>{a(!1),l(null),alert("Payment completed successfully!")},onError:e=>{alert("Payment failed: "+e)},paymentRequest:c})]})})}function gs({results:e}){var t,n,r;const{quoteIntent:i,fsm:o}=Et(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,c=s||a,l=vt.create("referral-card",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.xl,boxShadow:mt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:mt.spacing.lg},"(max-width: 480px)":{padding:mt.spacing.md}}),u=vt.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:mt.spacing.lg}),d=vt.create("referral-icon",{width:"4rem",height:"4rem",color:mt.colors.primary}),h=vt.create("referral-header",{textAlign:"center",marginBottom:mt.spacing.xl}),m=vt.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:mt.colors.primary,marginBottom:mt.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=vt.create("referral-subtitle",{fontSize:mt.fontSize.default,color:mt.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),p=vt.create("referral-process-box",{backgroundColor:mt.colors.accent,borderRadius:mt.radius.default,padding:mt.spacing.lg,marginBottom:mt.spacing.xl}),g=vt.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:mt.colors.accentForeground,marginBottom:mt.spacing.md,marginTop:"0"}),y=vt.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:mt.spacing.sm}),v=vt.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:mt.fontSize.small,color:mt.colors.accentForeground,lineHeight:"1.6"}),w=vt.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:mt.colors.primary,color:mt.colors.primaryForeground,borderRadius:"50%",marginRight:mt.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),b=vt.create("referral-contact-section",{borderTop:`1px solid ${mt.colors.border}`,paddingTop:mt.spacing.xl,marginTop:mt.spacing.xl,textAlign:"center"}),x=vt.create("referral-contact-text",{fontSize:mt.fontSize.default,color:mt.colors.foreground,marginBottom:mt.spacing.lg}),k=vt.create("referral-actions",{display:"flex",gap:mt.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:mt.spacing.lg}),S=vt.create("referral-reference",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,marginTop:mt.spacing.md}),N=vt.create("referral-new-request",{textAlign:"center",marginTop:mt.spacing.md}),_=vt.create("referral-new-request-link",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:"0",fontFamily:"inherit"});return Oe(Yo,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Oe($t,{children:Oe(Go,{children:Oe("div",{className:l,children:[Oe("div",{className:u,children:Oe(()=>Oe("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:[Oe("path",{d:"M7 10v12"}),Oe("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"})]}),{})}),Oe("div",{className:h,children:[Oe("h1",{className:m,children:"Thanks for your quote request!"}),Oe("p",{className:f,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Oe("div",{className:p,children:[Oe("h3",{className:g,children:"What happens next?"}),Oe("ul",{className:y,children:[Oe("li",{className:v,children:[Oe("span",{className:w,children:"1"}),Oe("span",{children:"Our team will review your application within 1-2 business days"})]}),Oe("li",{className:v,children:[Oe("span",{className:w,children:"2"}),Oe("span",{children:"We'll contact you with either approval or additional requirements"})]}),Oe("li",{className:v,children:[Oe("span",{className:w,children:"3"}),Oe("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),c&&Oe("div",{className:b,children:[Oe("p",{className:x,children:"Need to speak with someone about your quote?"}),Oe("div",{className:k,children:[a&&Oe(Qo,{variant:"outline",onClick:()=>window.open(`tel:${a}`),children:[Oe("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:Oe("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&&Oe(Qo,{variant:"outline",onClick:()=>window.open(`mailto:${s}`),children:[Oe("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:[Oe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Oe("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)&&Oe("div",{className:S,children:["Quote Reference: ",Oe("strong",{children:e.quote_intent.reference})]})]}),Oe("div",{className:N,children:Oe("button",{type:"button",className:_,onClick:()=>null==o?void 0:o.reset(),children:"Start a new quote"})})]})})})})}function ys({results:e}){return"referral"===e.outcome_type?Oe(gs,{results:e}):Oe(ps,{results:e})}function vs({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:l="$"}){const u=Xe(null),[d,h]=Ve("");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}Ke(()=>{h(null!=e&&""!==e?m(e):"")},[e]);const f=vt.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=vt.create("money-input-prefix",{position:"absolute",left:"1rem",color:mt.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=vt.create("money-input-with-prefix",{paddingLeft:l?"2rem":"1rem"});return Oe("div",{className:f,children:[l&&Oe("span",{className:p,children:l}),Oe("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:Nt(a,l&&g)})]})}function ws(e){var t,n,r,i;const o=vt.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${mt.borderWidth} solid ${e.hasError?mt.colors.destructive:mt.colors.input}`,borderRadius:mt.radius.default,fontSize:mt.fontSize.default,backgroundColor:mt.colors.card,color:mt.colors.foreground,transition:mt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${mt.colors.destructive} 20%, transparent)`:"none"}),s=vt.name("input");vt.pseudoElement("input",":focus",{border:`${mt.borderWidth} solid ${mt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${mt.colors.primary} 20%, transparent)`,borderRadius:mt.radius.default});const a=vt.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${mt.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:mt.fontSize.default,backgroundColor:"transparent",color:mt.colors.foreground,outline:"none"}),c=vt.create("select-wrapper",{border:`${mt.borderWidth} solid ${e.hasError?mt.colors.destructive:mt.colors.input}`,borderRadius:mt.radius.default,backgroundColor:mt.colors.card,transition:mt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${mt.colors.destructive} 20%, transparent)`:"none"}),l=vt.name("select-wrapper");vt.pseudoElement("select-wrapper",":focus-within",{border:`${mt.borderWidth} solid ${mt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${mt.colors.primary} 20%, transparent)`,borderRadius:mt.radius.default});const{onChange:u,onBlur:d,onKeyDown:h,className:m,validation:f,errors:p,suffix:g,...y}=e;function v(e){u(e.currentTarget.value)}function w(e){u(e.currentTarget.value)}function b(e){d&&d(e.currentTarget.value)}if("select"===e.type){const x=e.null_option_label||"N/A";return Oe("div",{className:Nt(c,l),children:Oe("select",{...y,onChange:v,className:a,children:[e.add_null_option&&Oe("option",{value:"",children:x}),null===(n=null===(t=e.validation)||void 0===t?void 0:t.options)||void 0===n?void 0:n.map(e=>Oe("option",{value:e.value,children:e.label},e.value))]})})}if("date"===e.type)return Oe("input",{...y,type:"date",min:null===(r=e.validation)||void 0===r?void 0:r.minDate,max:null===(i=e.validation)||void 0===i?void 0:i.maxDate,onInput:w,onChange:v,className:Nt(o,s,m)});if("monthyear"===e.type){function k(e){const t=e.currentTarget.value;u(t?`${t}-01`:"")}const S=e.value?e.value.substring(0,7):"";return Oe("input",{...y,type:"month",value:S,onInput:k,onChange:k,className:Nt(o,s,m)})}if("year"===e.type){const N=(new Date).getFullYear();return Oe("input",{...y,type:"number",min:N-100,max:N,placeholder:"YYYY",onInput:w,onChange:v,className:Nt(o,s,m)})}if("money"===e.type)return Oe(vs,{value:e.value,onChange:u,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:Nt(o,s,m),hasError:e.hasError});if("checkbox"===e.type){const _=!0===e.value||"true"===e.value||"true"===e.value,$=vt.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),C=vt.create("checkbox-"+(_?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${_?mt.colors.primary:e.hasError?mt.colors.destructive:mt.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:_?mt.colors.primary:mt.colors.card,transition:mt.transition,position:"absolute"}),T=vt.name("checkbox-"+(_?"checked":"unchecked"));function I(e){e.preventDefault(),u(_?"false":"true")}return vt.pseudoElement("checkbox-"+(_?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${mt.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),Oe("div",{className:$,children:[Oe("input",{type:"checkbox",id:e.id,name:e.name,checked:_,onClick:I,className:Nt(C,T,m),required:e.required,readOnly:!0}),_&&Oe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:mt.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Oe("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const E=vt.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),P=vt.create("boolean-radio-group",{display:"flex",gap:"1rem"}),D=vt.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),M=vt.create("boolean-radio",{accentColor:mt.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),z=vt.name("boolean-radio");vt.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${mt.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const R=vt.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${mt.borderWidth} solid ${e.hasError?mt.colors.destructive:mt.colors.input}`,borderRadius:mt.radius.default,fontSize:mt.fontSize.default,backgroundColor:mt.colors.card,color:mt.colors.foreground,transition:mt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${mt.colors.destructive} 20%, transparent)`:"none",resize:"vertical",fontFamily:mt.fontFamily}),O=vt.name("boolean-textarea");vt.pseudoElement("boolean-textarea",":focus",{border:`${mt.borderWidth} solid ${mt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${mt.colors.primary} 20%, transparent)`,borderRadius:mt.radius.default});const j=!0===e.value||"true"===e.value,A=!1===e.value||"false"===e.value,W=e.answer||"",L=e.booleanConfig,B=(null==L?void 0:L.enable_details_textbox)&&("yes"===L.show_details_on&&j||"no"===L.show_details_on&&A);function F(t){u(t),(!(null==L?void 0:L.enable_details_textbox)||!("yes"===L.show_details_on&&"true"===t||"no"===L.show_details_on&&"false"===t))&&e.onAnswerChange&&W&&e.onAnswerChange("")}return Oe("div",{className:Nt(E,m),children:[Oe("div",{className:P,children:[Oe("label",{className:D,children:[Oe("input",{type:"radio",name:e.name,checked:j,onChange:()=>F("true"),className:Nt(M,z)}),Oe("span",{children:"Yes"})]}),Oe("label",{className:D,children:[Oe("input",{type:"radio",name:e.name,checked:A,onChange:()=>F("false"),className:Nt(M,z)}),Oe("span",{children:"No"})]})]}),B&&Oe("textarea",{placeholder:(null==L?void 0:L.details_placeholder)||"Please provide details",value:W,required:!0,onInput:t=>{return n=t.target.value,void(e.onAnswerChange&&e.onAnswerChange(n));var n},className:Nt(R,O)})]})}return g?Oe("div",{className:vt.create("input-with-suffix",{display:"flex",alignItems:"center",gap:mt.spacing.sm}),children:[Oe("input",{...y,onInput:w,onChange:v,onBlur:b,onKeyDown:h,className:Nt(o,s,m),style:{flex:1}}),g]}):Oe("input",{...y,onInput:w,onChange:v,onBlur:b,onKeyDown:h,className:Nt(o,s,m)})}function bs({pages:e,currentPageIndex:n,completedPages:r}){const{fsm:i,lastUpdated:o,isSaving:s}=Et(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=Xe(null),c=Xe(null);t(e.length),t(e.map((e,t)=>({index:t,id:e.id,title:e.title}))),Ke(()=>{if(a.current&&c.current){const e=c.current,t=a.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}},[n]);const l=Math.round((n+1)/e.length*100),u=vt.create("sidebar-nav-item-base",{display:"flex",alignItems:"flex-start",gap:mt.spacing.sm,padding:`${mt.spacing.sm} ${mt.spacing.sm}`,borderRadius:mt.radius.default,border:"none",backgroundColor:"transparent",color:mt.colors.foreground,cursor:"pointer",transition:mt.transition,textAlign:"left",width:"100%",fontFamily:mt.fontFamily,fontSize:mt.fontSize.small,opacity:"1"}),d=vt.create("sidebar-nav-item-active",{backgroundColor:mt.colors.accent,color:mt.colors.accentForeground}),h=vt.create("sidebar-nav-item-disabled",{cursor:"not-allowed",opacity:"0.5"});vt.pseudoElement("sidebar-nav-item-base",":hover",{backgroundColor:mt.colors.muted}),vt.pseudoElement("sidebar-nav-item-active",":hover",{backgroundColor:mt.colors.accent});const m=vt.create("sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:mt.colors.muted,color:mt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),f=vt.create("sidebar-indicator-active",{backgroundColor:mt.colors.accentForeground,color:mt.colors.accent}),p=vt.create("sidebar-indicator-completed",{backgroundColor:mt.colors.primary,color:mt.colors.primaryForeground}),g=vt.create("sidebar-page-title-base",{fontWeight:"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),y=vt.create("sidebar-page-title-active",{fontWeight:"600"});return Oe("div",{className:vt.create("sidebar-navigation",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.lg,boxShadow:mt.shadow.sm,position:"sticky",top:mt.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:mt.spacing.lg}),children:[Oe("div",{className:vt.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:mt.spacing.sm}),children:[Oe("span",{className:vt.create("sidebar-progress-text",{fontSize:mt.fontSize.small,fontWeight:"600",color:mt.colors.foreground}),children:["Step ",n+1," of ",e.length]}),Oe("div",{className:vt.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:mt.colors.muted,borderRadius:mt.radius.small,overflow:"hidden"}),children:Oe("div",{className:vt.create("sidebar-progress-fill",{height:"100%",backgroundColor:mt.colors.primary,borderRadius:mt.radius.small,transition:mt.transition}),style:{width:`${l}%`}})})]}),Oe("hr",{className:vt.create("sidebar-divider",{borderColor:mt.colors.border})}),Oe("nav",{ref:c,className:vt.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:mt.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:mt.spacing.sm}),children:e.map((e,o)=>{const c=o===n,l=r.includes(o),v=i.canNavigateToPage(o);o===n&&t(e.title);const w=[u];c&&w.push(d),v&&!s||w.push(h);const b=w.join(" "),x=[m];l?x.push(p):c&&x.push(f);const k=x.join(" ");return Oe("button",{ref:c?a:null,onClick:()=>{return e=o,void((null==i?void 0:i.canNavigateToPage(e))&&i.navigateToPage(e));var e},disabled:!v||s,className:b,children:[Oe("div",{className:k,children:l?Oe("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:Oe("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Oe("div",{className:vt.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:Oe("span",{className:c?`${g} ${y}`:g,children:e.title})})]},e.id)})}),Oe("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&(null==i||i.reset())},className:vt.create("sidebar-reset-button",{padding:`${mt.spacing.sm} ${mt.spacing.md}`,border:`${mt.borderWidth} solid ${mt.colors.border}`,borderRadius:mt.radius.default,backgroundColor:"transparent",color:mt.colors.mutedForeground,fontSize:mt.fontSize.small,fontFamily:mt.fontFamily,cursor:"pointer",transition:mt.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),o&&Oe("div",{className:vt.create("sidebar-last-saved",{fontSize:"0.6875rem",color:mt.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Uo.fromJSDate(new Date(o)).toFormat("T")]})]})}function xs({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=Et(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=Ve(!1),a=Math.round((t+1)/e.length*100),c=vt.create("mobile-sidebar-item-base",{display:"flex",alignItems:"center",gap:mt.spacing.sm,padding:mt.spacing.sm,border:"none",borderRadius:mt.radius.default,backgroundColor:"transparent",color:mt.colors.foreground,cursor:"pointer",opacity:"1",transition:mt.transition,width:"100%",textAlign:"left",fontFamily:mt.fontFamily}),l=vt.create("mobile-sidebar-item-active",{backgroundColor:mt.colors.accent,color:mt.colors.accentForeground}),u=vt.create("mobile-sidebar-item-disabled",{cursor:"not-allowed",opacity:"0.5"}),d=vt.create("mobile-sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:mt.colors.muted,color:mt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),h=vt.create("mobile-sidebar-indicator-active",{backgroundColor:mt.colors.accentForeground,color:mt.colors.accent}),m=vt.create("mobile-sidebar-indicator-completed",{backgroundColor:mt.colors.primary,color:mt.colors.primaryForeground}),f=vt.create("mobile-sidebar-page-title-base",{fontSize:mt.fontSize.small,fontWeight:"500"}),p=vt.create("mobile-sidebar-page-title-active",{fontWeight:"600"});return Oe("div",{className:vt.create("mobile-sidebar",{overflow:"hidden"}),children:[Oe("button",{onClick:()=>s(!o),className:vt.create("mobile-sidebar-header",{width:"100%",padding:mt.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:mt.spacing.sm}),children:[Oe("div",{className:vt.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Oe("span",{className:vt.create("mobile-sidebar-step-text",{fontSize:mt.fontSize.small,fontWeight:"600",color:mt.colors.foreground}),children:["Step ",t+1," of ",e.length]}),Oe("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:vt.create("mobile-sidebar-chevron",{transition:mt.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:mt.colors.mutedForeground}),children:Oe("path",{d:"m6 9 6 6 6-6"})})]}),Oe("div",{className:vt.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:mt.colors.muted,borderRadius:mt.radius.small,overflow:"hidden"}),children:Oe("div",{className:vt.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:mt.colors.primary,borderRadius:mt.radius.small,transition:mt.transition}),style:{width:`${a}%`}})})]}),Oe("hr",{className:vt.create("mobile-sidebar-border",{borderColor:mt.colors.border})}),o&&Oe("div",{className:vt.create("mobile-sidebar-content",{padding:mt.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=[c];a&&v.push(l),y&&!i||v.push(u);const w=v.join(" "),b=[d];g?b.push(m):a&&b.push(h);const x=b.join(" ");return Oe("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:[Oe("div",{className:x,children:g?Oe("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:Oe("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Oe("span",{className:a?`${f} ${p}`:f,children:e.title})]},e.id)})})]})}function ks({organisation:e}){return Oe("div",{className:vt.create("welcome-card",{paddingInline:mt.spacing.lg,paddingTop:mt.spacing.lg},{"(max-width: 950px)":{paddingInline:mt.spacing.lg,paddingTop:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingTop:mt.spacing.md}}),children:[Oe("h2",{className:vt.create("welcome-title",{margin:"0",marginBottom:mt.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:mt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:mt.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),Oe("p",{className:vt.create("welcome-text",{margin:"0",fontSize:mt.fontSize.default,lineHeight:"1.6",color:mt.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."}),Oe("hr",{className:vt.create("welcome-border",{marginTop:mt.spacing.lg,borderColor:mt.colors.border})})]})}function Ss({title:e,description:t}){return Oe(Yo,{title:e,description:t,children:Oe($t,{children:Oe(Go,{className:vt.name("error-container"),children:Oe("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:[Oe("path",{d:"M4.929 4.929 19.07 19.071"}),Oe("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function Ns({errors:e,className:t}){return e&&0!==e.length?Oe("div",{className:vt.create("field-error",{color:mt.colors.destructive,fontSize:mt.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>Oe("span",{className:vt.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function _s({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=Ve(!1);return Oe("label",{for:e,className:vt.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Oe("span",{className:vt.create("label-text",{marginBottom:mt.spacing.sm,fontSize:mt.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:mt.spacing.sm,color:mt.colors.foreground}),children:[Oe("span",{children:[t,r&&Oe("span",{className:vt.create("label-required-indicator",{color:mt.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Oe("span",{className:vt.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Oe("svg",{className:vt.create("tooltip-icon",{width:"1rem",height:"1rem",color:mt.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Oe("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Oe("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Oe("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Oe("span",{className:vt.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:mt.colors.popover,color:mt.colors.popoverForeground,fontSize:"0.875rem",borderRadius:mt.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Oe("span",{className:vt.create("tooltip-arrow",{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:`6px solid ${mt.colors.popover}`})})]})]})]}),n]})}function $s(e){switch(null!=e?e:100){case 25:return vt.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return vt.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return vt.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return vt.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return vt.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return vt.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function Cs(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 Ts({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=vt.create("validated-field",{display:"flex",flexDirection:"column",gap:mt.spacing.sm});if("checkbox"===e.type){const t=vt.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:mt.spacing.sm}),a=vt.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=vt.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),l=vt.create("checkbox-label-text",{fontSize:mt.fontSize.default,fontWeight:"600",color:mt.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Oe("div",{className:Nt(s,$s(e.width),r),children:[Oe("div",{className:t,children:Oe("div",{className:a,children:[Oe("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Oe("label",{htmlFor:i,className:c,children:[Oe("span",{className:l,children:[e.label,e.required&&Oe("span",{className:vt.create("checkbox-required-indicator",{color:mt.colors.destructive}),children:"*"})]}),e.description&&Oe("div",{className:vt.create("checkbox-field-description",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:Cs(e.description)}})]})]})}),Oe(Ns,{errors:o})]})}return Oe("div",{className:Nt(s,$s(e.width),r),children:[Oe(_s,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&Oe("div",{className:vt.create("field-description",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,marginBottom:mt.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:Cs(e.description)}}),n]}),Oe(Ns,{errors:o})]})}function Is({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:mt.colors.secondary+"08",borderColor:mt.colors.secondary+"30",iconColor:mt.colors.secondary,titleColor:mt.colors.foreground},error:{backgroundColor:mt.colors.destructive+"08",borderColor:mt.colors.destructive,iconColor:mt.colors.destructive,titleColor:mt.colors.destructive},critical:{backgroundColor:mt.colors.destructive+"10",borderColor:mt.colors.destructive,iconColor:mt.colors.destructive,titleColor:mt.colors.destructive}}[e.severity],o=vt.create("error-card",{padding:mt.spacing.md,borderRadius:mt.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:mt.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=vt.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=vt.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=vt.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),l=vt.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=vt.create("error-card-title",{fontSize:mt.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=vt.create("error-card-message",{fontSize:mt.fontSize.small,color:mt.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=vt.create("error-card-details",{fontSize:"0.8125rem",color:mt.colors.mutedForeground,fontFamily:"monospace",backgroundColor:mt.colors.muted,padding:"0.625rem",borderRadius:mt.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),m=vt.create("error-card-support",{fontSize:"0.8125rem",color:mt.colors.mutedForeground,lineHeight:"1.4"}),f=vt.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:mt.colors.mutedForeground,cursor:"pointer",borderRadius:mt.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:mt.transition});return vt.pseudoElement("error-card-dismiss",":hover",{backgroundColor:mt.colors.muted,color:mt.colors.foreground}),Oe("div",{className:Nt(o,n),children:Oe("div",{className:s,children:[Oe(()=>"warning"===e.severity?Oe("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Oe("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"})}):Oe("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Oe("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"})}),{}),Oe("div",{className:c,children:[Oe("div",{className:l,children:[Oe("div",{className:u,children:e.title}),Oe("div",{className:d,children:e.message}),r&&e.details&&Oe("div",{className:h,children:e.details}),Oe("div",{className:m,children:be(e)})]}),t&&Oe("button",{className:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Oe("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:[Oe("path",{d:"M18 6 6 18"}),Oe("path",{d:"m6 6 12 12"})]})})]})]})})}function Es(){const{definition:e,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=Et(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:l}=It(),[u,d]=Ve({status:"idle"}),[h,m]=Ve(""),f=tt(async e=>{const n=null!=e?e:h;if(n&&n.trim()){if((null==s?void 0:s.id)&&l){d({status:"validating"});try{const e=await l.validatePromoCode(s.id,n.trim());e.valid?d({status:"valid",name:e.name||n}):d({status:"invalid",message:e.message})}catch(e){t(),d({status:"invalid",message:"Unable to validate promo code"})}}}else d({status:"idle"})},[null==s?void 0:s.id,l,h]),p=tt(e=>{"Enter"===e.key&&(e.preventDefault(),f())},[f]),g=e.pages[n];if(!g)return Oe(Ss,{title:"Unexpected Error",description:"No page available"});const y=Xe(new Map),v=(e,t)=>{var n;const r=c.getFormProgress().page_data[g.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=w(t.validation.defaultDate,"monthyear"===t.type);if(n)return c.updateFieldValue(g.id,e,n),n}return""},w=(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 c=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),u=String(a.getDate()).padStart(2,"0");return t?`${c}-${l}-01`:`${c}-${l}-${u}`},b=e=>{const t=c.getFormProgress().page_data[g.id];return((null==t?void 0:t.U)||{})[e]||""},x=c.getFormProgress(),k={};Object.values(x.page_data).forEach(e=>{const{U:t,...n}=e;Object.assign(k,n),t&&Object.keys(t).length>0&&(k.U||(k.U={}),Object.assign(k.U,t))});const S=null==s?void 0:s.payment_return,N=S&&("declined"===S.paymentStatus||"cancelled"===S.paymentStatus||"error"===S.paymentStatus),_=c.getFormProgress().completed_pages||[];return Oe(Yo,{title:g.title,description:g.description,hideHeader:!0,children:Oe("div",{children:[N&&Oe(fs,{type:S.paymentStatus,transactionId:S.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Oe($t,{children:Oe("div",{className:vt.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:mt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Oe("div",{className:vt.create("form-content-wrapper",{minWidth:"0",backgroundColor:mt.colors.card,boxShadow:mt.shadow.sm,borderRadius:mt.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Oe("div",{className:vt.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Oe(xs,{pages:e.pages,currentPageIndex:n,completedPages:_})}),n>0&&Oe("div",{className:vt.create("page-heading-container",{paddingInline:mt.spacing.lg,paddingTop:mt.spacing.lg},{"(max-width: 950px)":{paddingInline:mt.spacing.lg,paddingTop:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingTop:mt.spacing.md}}),children:[Oe("div",{className:vt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:mt.spacing.lg}),children:Oe("div",{className:vt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Oe("h1",{className:vt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:mt.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:g.title}),g.description&&Oe("p",{className:vt.create("page-template-description",{margin:"0",marginTop:mt.spacing.sm,fontSize:mt.fontSize.small,lineHeight:"1.5",color:mt.colors.foreground,opacity:"0.7"}),children:g.description})]})}),Oe("hr",{className:vt.create("page-heading-border",{marginTop:mt.spacing.lg,borderColor:mt.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Oe(ks,{organisation:s.organisation}),o.length>0&&o.map(e=>Oe(Is,{error:e,onDismiss:()=>c.dismissGeneralError(e.id)},e.id)),Oe("div",{className:vt.create("form-card",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.lg,boxShadow:mt.shadow.sm,display:"flex",flexDirection:"column",gap:mt.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:mt.spacing.md,gap:mt.spacing.lg},"(max-width: 480px)":{padding:mt.spacing.md,gap:mt.spacing.md}}),children:[Oe("form",{onSubmit:e=>e.preventDefault(),className:vt.create("form-fields-container",{flex:"1"}),children:Oe("div",{className:vt.create("form-content-page",{display:"grid",gap:mt.spacing.md,rowGap:mt.spacing.lg,gridTemplateColumns:"repeat(12, 1fr)"}),children:g.fields.map(e=>{const n=e.code||e.id,r="promo_code"===n;if(!(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(k)),n.forEach(e=>{e&&t((k[e],k[e]))}));const r=re(k,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions}),i="show"===e.visibility.action?r.matched:!r.matched;return y.current.get(e.id)!==i&&(t((e.label,e.code)),t(),y.current.set(e.id,i)),i})(e))return null;const o="validating"===u.status,s=r?Oe("button",{type:"button",onClick:()=>f(),disabled:!h.trim()||o,style:{height:"2.75rem",minWidth:"5rem",padding:"0 1rem",fontSize:mt.fontSize.small,backgroundColor:mt.colors.primary,color:mt.colors.primaryForeground,border:"none",borderRadius:mt.radius.default,cursor:h.trim()&&!o?"pointer":"not-allowed",opacity:h.trim()&&!o?1:.5,whiteSpace:"nowrap"},children:o?Oe(_t,{size:"small"}):"Apply"}):void 0,a=!r||"valid"!==u.status&&"invalid"!==u.status?null:Oe("div",{style:{marginTop:"0.5rem"},children:["valid"===u.status&&Oe("span",{style:{color:"#22c55e",fontSize:mt.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Oe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Oe("path",{d:"M20 6 9 17l-5-5"})}),'Promo code "',u.name,'" applied']}),"invalid"===u.status&&Oe("span",{style:{color:mt.colors.destructive,fontSize:mt.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Oe("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Oe("circle",{cx:"12",cy:"12",r:"10"}),Oe("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),Oe("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),u.message]})]});return Oe(Ts,{field:e,errors:i,children:[Oe(ws,{value:v(n,e).toString(),onChange:t=>{let i=t;"boolean"!==e.type&&"checkbox"!==e.type||(i="true"===t),c.updateFieldValue(g.id,n,i),r&&(m(t),d({status:"idle"}))},onKeyDown:r?p:void 0,answer:b(n),onAnswerChange:t=>{var r;c.updateFieldAnswer(g.id,n,t,null===(r=e.boolean_config)||void 0===r?void 0:r.details_rating_factor_id)},id:n,name:n,type:e.type,placeholder:e.placeholder,validation:e.validation,booleanConfig:e.boolean_config,add_null_option:e.add_null_option,null_option_label:e.null_option_label,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n),suffix:s}),a]},e.id)})})}),Oe("hr",{className:vt.create("form-navigation-border",{borderColor:mt.colors.border})}),Oe("div",{className:vt.create("form-navigation-inline",{paddingTop:mt.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Oe(Qo,{onClick:()=>null==c?void 0:c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Oe(Qo,{onClick:async function(){c.validateCurrentPage().length>0||(n===r-1?await(null==c?void 0:c.calculateQuote()):await(null==c?void 0:c.navigateToNextPage()))},disabled:a,loading:a,children:n===r-1?"Get Quote":"Continue"})]})]})]}),Oe("div",{className:vt.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Oe(bs,{pages:e.pages,currentPageIndex:n,completedPages:_})})]})})]})})}function Ps(){var e,t,n;const{quoteIntent:r,fsm:i}=Et(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,c=null===(e=null==r?void 0:r.organisation)||void 0===e?void 0:e.name,l=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=l||u;Ke(()=>{if(s&&r){const e=null==o?void 0:o.paymentStatus,t=null==a?void 0:a.amount;"success"===e&&a?Ee(r,s,t||0,a.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&Pe(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=vt.create("success-card",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.xl,boxShadow:mt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:mt.spacing.lg},"(max-width: 480px)":{padding:mt.spacing.md}}),m=vt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:mt.spacing.lg}),f=vt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=vt.create("success-header",{textAlign:"center",marginBottom:mt.spacing.xl}),g=vt.create("success-title",{margin:"0",marginBottom:mt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:mt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=vt.create("success-message",{fontSize:mt.fontSize.default,lineHeight:"1.6",color:mt.colors.foreground,opacity:"0.9",margin:"0"}),v=vt.create("success-contact-section",{borderTop:`1px solid ${mt.colors.border}`,paddingTop:mt.spacing.xl,marginTop:mt.spacing.xl}),w=vt.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:mt.colors.foreground,marginBottom:mt.spacing.md,textAlign:"center"}),b=vt.create("success-contact-details",{backgroundColor:mt.colors.accent,borderRadius:mt.radius.default,padding:mt.spacing.md,display:"flex",flexDirection:"column",gap:mt.spacing.sm,marginBottom:mt.spacing.lg}),x=vt.create("success-contact-item",{display:"flex",alignItems:"center",gap:mt.spacing.sm,fontSize:mt.fontSize.small,color:mt.colors.accentForeground}),k=vt.create("success-actions",{display:"flex",gap:mt.spacing.md,flexWrap:"wrap",justifyContent:"center"}),S=vt.create("success-reference",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,textAlign:"center",marginTop:mt.spacing.md});return Oe(Yo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe(Go,{children:Oe("div",{className:h,children:[Oe("div",{className:m,children:Oe("div",{className:f,children:Oe("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:Oe("path",{d:"M20 6 9 17l-5-5"})})})}),Oe("div",{className:p,children:[Oe("h1",{className:g,children:"Payment Complete!"}),Oe("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 ",c?`covered by ${c}`:"covered","."]})]}),d&&Oe("div",{className:v,children:[Oe("h3",{className:w,children:"Need assistance?"}),Oe("div",{className:b,children:[l&&Oe("div",{className:x,children:[Oe("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:[Oe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Oe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Oe("span",{children:l})]}),u&&Oe("div",{className:x,children:[Oe("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:Oe("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"})}),Oe("span",{children:u})]})]}),Oe("div",{className:k,children:[u&&Oe(Qo,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[Oe("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:Oe("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"]}),l&&Oe(Qo,{variant:"outline",onClick:()=>window.open(`mailto:${l}`),children:[Oe("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:[Oe("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Oe("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),r.reference&&Oe("div",{className:S,children:["Quote Reference: ",Oe("strong",{children:r.reference})]})]})})})})}function Ds({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,s]=Ve("initiating"),[a,c]=Ve(null),[l,u]=Ve(null),[d,h]=Ve(null);Ke(()=>{e&&r&&m()},[e,r]);const m=async()=>{var e;if(r)try{s("initiating"),c(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){c(e.message||"Failed to initiate payment"),s("failed")}},f=()=>{l&&!l.closed&&l.close(),s("initiating"),c(null),h(null),u(null),t()};return e?Oe("div",{className:vt.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:[Oe("div",{className:vt.create("modal-content",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${mt.colors.border}`}),children:[Oe("div",{className:vt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Oe("div",{className:vt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Oe("h2",{className:vt.create("modal-title",{margin:"0",color:mt.colors.foreground,fontSize:mt.fontSize.large}),children:"Payment Processing"})]}),Oe("div",{className:vt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Oe(Xo,{className:vt.create("status-message",{fontSize:mt.fontSize.default,color:mt.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&&Oe(Xo,{className:vt.create("error-message",{color:mt.colors.destructive,fontSize:mt.fontSize.small,padding:"0.75rem",backgroundColor:mt.colors.destructive+"10",borderRadius:mt.radius.default,border:`1px solid ${mt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Oe("div",{className:vt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${mt.colors.border}`,borderTop:`3px solid ${mt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Oe("div",{className:vt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Oe(S,{children:[Oe(Qo,{onClick:f,variant:"outline",children:"Close"}),"cancelled"===o&&Oe(Qo,{onClick:()=>{s("initiating"),c(null),m()},children:"Try Again"})]}):Oe(Qo,"completed"===o?{onClick:f,children:"Continue"}:{onClick:f,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Oe("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Ms({transactionId:e,organisationId:t}){const{httpClient:n}=It(),[r,i]=Ve(!0),[o,s]=Ve(null),[a,c]=Ve(null),[l,u]=Ve(!1),[d,h]=Ve(!1),[m,f]=Ve(!1);Ke(()=>{p()},[e]);const p=async()=>{try{if(i(!0),s(null),!n)throw new Error("HTTP client not available");const r=n.getBaseUrl(),o=await fetch(`${r}/payments/bank-transfer/${e}?orgId=${t}`);if(!o.ok)throw new Error(`Failed to load bank transfer details: ${o.statusText}`);const a=await o.json(),l=a.data||a;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){s(e.message||"Failed to load bank transfer details")}finally{i(!1)}};return r?Oe(Jo,{message:"Loading payment details..."}):o?Oe(Yo,{title:"Error",description:"Failed to load bank transfer details",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe(Go,{children:Oe("div",{className:vt.create("error-card",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.xl,boxShadow:mt.shadow.sm,maxWidth:"42rem",margin:"0 auto",textAlign:"center"},{"(max-width: 480px)":{padding:mt.spacing.lg}}),children:[Oe("div",{className:vt.create("error-icon",{fontSize:"3rem",marginBottom:mt.spacing.md,color:mt.colors.destructive}),children:"⚠️"}),Oe("h2",{className:vt.create("error-title",{margin:"0",marginBottom:mt.spacing.sm,color:mt.colors.foreground}),children:"Error Loading Payment Details"}),Oe("p",{className:vt.create("error-message",{color:mt.colors.mutedForeground}),children:o})]})})})}):a?Oe(Yo,{title:"Bank Transfer Payment",description:"Complete your payment via bank transfer",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:[Oe(Go,{children:Oe("div",{className:vt.create("bank-transfer-container",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,maxWidth:"42rem",margin:"0 auto",overflow:"hidden",boxShadow:"0 20px 60px rgba(0,0,0,0.1)"}),children:[Oe("div",{style:{backgroundColor:mt.colors.primary},className:vt.create("bank-transfer-header",{color:"white",padding:"2.5rem 2rem",textAlign:"center"},{"(max-width: 480px)":{padding:"1.5rem 1rem"}}),children:[Oe("h1",{className:vt.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"}),Oe("p",{className:vt.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:mt.fontSize.small}}),children:"Complete your payment using the details below"})]}),Oe("div",{className:vt.create("bank-transfer-content",{padding:"2rem"},{"(max-width: 480px)":{padding:"1rem"}}),children:[Oe("div",{className:vt.create("payment-details-card",{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:mt.radius.default,padding:"1.5rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Oe("div",{className:vt.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:[Oe("span",{className:vt.create("detail-label",{color:"#6b7280",fontSize:mt.fontSize.default}),children:"Amount to Transfer"}),Oe("span",{className:vt.create("detail-value-amount",{color:mt.colors.primary,fontSize:"1.5rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:["$",a.amount.toFixed(2)," ",a.currency]})]}),Oe("div",{className:vt.create("detail-row",{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:[Oe("span",{className:vt.create("detail-label",{color:"#6b7280",fontSize:mt.fontSize.default}),children:"Account Name"}),Oe("span",{className:vt.create("detail-value",{color:mt.colors.foreground,fontSize:mt.fontSize.default,fontWeight:"600"}),children:a.bank_account_name})]}),Oe("div",{className:vt.create("detail-row",{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:[Oe("span",{className:vt.create("detail-label",{color:"#6b7280",fontSize:mt.fontSize.default}),children:"Account Number"}),Oe("span",{className:vt.create("detail-value",{color:mt.colors.foreground,fontSize:mt.fontSize.default,fontWeight:"600"}),children:a.bank_account_number})]}),Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Oe("span",{className:vt.create("detail-label",{color:"#6b7280",fontSize:mt.fontSize.default}),children:"Payment Reference"}),Oe("span",{className:vt.create("detail-value",{color:mt.colors.foreground,fontSize:mt.fontSize.default,fontWeight:"600"}),children:a.reference})]})]}),Oe("div",{className:vt.create("instructions-card",{backgroundColor:"#eff6ff",borderLeft:`4px solid ${mt.colors.primary}`,borderRadius:mt.radius.default,padding:"1.25rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Oe("h3",{className:vt.create("instructions-title",{margin:"0 0 0.75rem 0",fontSize:mt.fontSize.default,fontWeight:"600",color:mt.colors.foreground}),children:"Payment Instructions"}),Oe("p",{className:vt.create("instructions-text",{margin:"0 0 0.75rem 0",fontSize:mt.fontSize.small,lineHeight:"1.6",color:mt.colors.foreground}),children:[Oe("strong",{children:"Important:"})," Please include the payment reference when making your transfer to ensure your payment is processed correctly."]}),Oe("p",{className:vt.create("instructions-text",{margin:"0",fontSize:mt.fontSize.small,lineHeight:"1.6",color:mt.colors.foreground}),children:"Once we receive your payment, we'll process your quote and send you a confirmation email."})]}),Oe("div",{className:vt.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:[Oe("button",{onClick:()=>{u(!0)},style:{backgroundColor:mt.colors.primary},className:vt.create("confirm-button",{color:"white",border:"none",borderRadius:mt.radius.default,padding:"0.75rem 2rem",fontSize:mt.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"}),Oe("button",{onClick:()=>{h(!0)},className:vt.create("cancel-button",{color:"#6b7280",backgroundColor:"white",border:"2px solid #e5e7eb",borderRadius:mt.radius.default,padding:"0.75rem 2rem",fontSize:mt.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"all 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"Cancel"})]}),Oe("p",{className:vt.create("footer-text",{textAlign:"center",color:"#6b7280",fontSize:mt.fontSize.small,margin:"0"}),children:"Your quote has been saved. We'll process it once payment is received."})]})]})}),d&&Oe("div",{className:vt.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:()=>!m&&h(!1),children:Oe("div",{className:vt.create("modal-content",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${mt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:mt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Oe("div",{className:vt.create("warning-icon",{fontSize:"4rem",marginBottom:mt.spacing.md}),children:"⚠️"}),Oe("h3",{className:vt.create("modal-title",{margin:"0",marginBottom:mt.spacing.sm,color:mt.colors.foreground,fontSize:mt.fontSize.large,fontWeight:"600"}),children:"Are you sure?"}),Oe("p",{className:vt.create("modal-message",{margin:"0",marginBottom:mt.spacing.lg,color:mt.colors.foreground,lineHeight:"1.6"}),children:"This will take you back to the checkout page."}),Oe("div",{className:vt.create("modal-buttons",{display:"flex",flexDirection:"column-reverse",gap:"0.75rem",justifyContent:"center"}),children:[Oe("button",{onClick:()=>h(!1),disabled:m,className:vt.create("no-button",{backgroundColor:"#f3f4f6",color:mt.colors.foreground,border:"none",borderRadius:mt.radius.default,padding:`${mt.spacing.sm} ${mt.spacing.lg}`,fontSize:mt.fontSize.default,fontWeight:"500",cursor:m?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:m?"0.5":"1",width:"100%"}),children:"No, Go Back"}),Oe("button",{onClick:async()=>{if(n)try{f(!0);const r=n.getBaseUrl();if(!(await fetch(`${r}/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){s("Failed to cancel payment. Please try again."),h(!1),f(!1)}},disabled:m,className:vt.create("yes-button",{backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:mt.radius.default,padding:`${mt.spacing.sm} ${mt.spacing.lg}`,fontSize:mt.fontSize.default,fontWeight:"500",cursor:m?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:m?"0.5":"1",width:"100%"}),children:m?"Cancelling...":"Yes, Cancel Payment"})]})]})}),l&&Oe("div",{className:vt.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:()=>u(!1),children:Oe("div",{className:vt.create("modal-content",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${mt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:mt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Oe("div",{className:vt.create("success-icon",{fontSize:"4rem",marginBottom:mt.spacing.md}),children:"✓"}),Oe("h3",{className:vt.create("modal-title",{margin:"0",marginBottom:mt.spacing.sm,color:mt.colors.primary,fontSize:mt.fontSize.large,fontWeight:"600"}),children:"Thank You!"}),Oe("p",{className:vt.create("modal-message",{margin:"0",marginBottom:mt.spacing.lg,color:mt.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."}),Oe("button",{onClick:()=>u(!1),className:vt.create("close-button",{backgroundColor:mt.colors.primary,color:"white",border:"none",borderRadius:mt.radius.default,padding:`${mt.spacing.sm} ${mt.spacing.lg}`,fontSize:mt.fontSize.default,fontWeight:"500",cursor:"pointer",transition:"opacity 150ms ease"}),children:"Close"})]})})]})}):null}vt.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:mt.colors.muted,borderColor:mt.colors.primary,color:mt.colors.primary});class zs{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 wt}).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)}}zs.loadedThemes=new Set,zs.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 Rs=Object.freeze({__proto__:null,ThemeLoader:zs});function Os({paymentLinkId:e,signedUrl:n}){var r,i,o,s,a,c;const l=It().httpClient,[u,d]=Ve(null),[h,m]=Ve(!0),[f,p]=Ve(null),[g,y]=Ve(!1),[v,w]=Ve(null),[b,x]=Ve(null),[k,N]=Ve(null),[_,$]=Ve(!1),[C,T]=Ve(null),[I,E]=Ve(null),[P,D]=Ve(()=>{var e;return null!==(e=(new Date).toISOString().split("T")[0])&&void 0!==e?e:""}),[M,z]=Ve(null),[R,O]=Ve(!1),[j,A]=Ve(null),[W,L]=Ve(null);Ke(()=>{B()},[e]);const B=async()=>{var r,i;try{m(!0);const o=new URLSearchParams(window.location.search),s=o.get("transactionId"),a=o.get("status"),c=o.get("gateway_code"),u=o.get("excess_id");s&&a&&($(!0),T(a),E(s)),c&&N(c);const h=n?await l.getPaymentLinkDetails(n):await l.getPaymentLinkById(e);if("paid"===h.status&&!_&&(!s||"completed"!==a&&"success"!==a))return void p("This payment link has already been used.");if("expired"===h.status)return void p("This payment link has expired.");if("cancelled"===h.status)return void p("This payment link has been cancelled.");if("outdated"===h.status)return void p("This payment link is no longer valid because the quote has been updated. Please request a new payment link.");if("awaiting_payment"===h.status&&h.pending_bank_transfer){const e=h.pending_bank_transfer;if(t(),L({transactionId:e.transaction_id,organisationId:(null===(r=h.organisation)||void 0===r?void 0:r.id)||""}),h.organisation&&h.organisation.theme)try{await zs.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(e){t()}return}if(h.organisation&&h.organisation.theme)try{await zs.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(e){t()}if(u){const e=h.calculations.find(e=>e.excess_id===u);e?x(e.id):1===h.calculations.length&&h.calculations[0]&&x(h.calculations[0].id)}else 1===h.calculations.length&&h.calculations[0]&&x(h.calculations[0].id);!c&&1===h.payment_options.length&&h.payment_options[0]&&N(h.payment_options[0].gateway_code),d(h),(null===(i=h.organisation)||void 0===i?void 0:i.quote_page_url)&&A(h.organisation.quote_page_url)}catch(e){p("Failed to load payment details. Please check your link.")}finally{m(!1)}},F=et(()=>u&&b?u.calculations.find(e=>e.id===b):null,[u,b]),q=et(()=>u&&k?u.payment_options.find(e=>e.gateway_code===k):null,[u,k]);if(W)return Oe(Ms,{transactionId:W.transactionId,organisationId:W.organisationId});if(h)return Oe(Yo,{title:"Loading...",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe("div",{className:vt.create("payment-link-loading-card",{textAlign:"center",padding:mt.spacing.xl,backgroundColor:mt.colors.card,borderRadius:mt.radius.large,boxShadow:mt.shadow.sm,maxWidth:"600px",margin:"0 auto"}),children:Oe("p",{className:vt.create("loading-text",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.default}),children:"Loading payment details..."})})})});if(f)return Oe(Yo,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe("div",{className:vt.create("payment-link-error-card",{textAlign:"center",padding:mt.spacing.xl,backgroundColor:mt.colors.card,borderRadius:mt.radius.large,boxShadow:mt.shadow.sm,border:`2px solid ${mt.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Oe("h2",{className:vt.create("error-title",{color:mt.colors.destructive,marginBottom:mt.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"Payment Link Error"}),Oe("p",{className:vt.create("error-message",{color:mt.colors.foreground,fontSize:mt.fontSize.default,margin:"0"}),children:f})]})})});if(!u)return null;const H=new URLSearchParams(window.location.search),U=H.get("transactionId"),Z=H.get("status"),Y=U&&Z;if("paid"===u.status&&("completed"===Z||"success"===Z||Y||_||"completed"===C)||"superseded"===u.status){const e=null===(r=u.organisation)||void 0===r?void 0:r.admin_email,t=null===(i=u.organisation)||void 0===i?void 0:i.phone,n=e||t;return Oe(Yo,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe("div",{className:vt.create("payment-success-card",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.xl,boxShadow:mt.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Oe("div",{className:vt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:mt.spacing.lg}),children:Oe("div",{className:vt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Oe("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:Oe("path",{d:"M20 6 9 17l-5-5"})})})}),Oe("div",{className:vt.create("success-header",{textAlign:"center",marginBottom:mt.spacing.xl}),children:[Oe("h1",{className:vt.create("success-title",{margin:"0",marginBottom:mt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:mt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Payment Complete!"}),Oe("p",{className:vt.create("success-message",{fontSize:mt.fontSize.default,lineHeight:"1.6",color:mt.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&Oe("div",{className:vt.create("contact-section",{borderTop:`1px solid ${mt.colors.border}`,paddingTop:mt.spacing.xl,marginTop:mt.spacing.xl}),children:[Oe("h3",{className:vt.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:mt.colors.foreground,marginBottom:mt.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Oe("div",{className:vt.create("contact-details",{backgroundColor:mt.colors.accent,borderRadius:mt.radius.default,padding:mt.spacing.md,display:"flex",flexDirection:"column",gap:mt.spacing.sm,marginBottom:mt.spacing.lg}),children:[e&&Oe("div",{className:vt.create("contact-item",{display:"flex",alignItems:"center",gap:mt.spacing.sm,fontSize:mt.fontSize.small,color:mt.colors.accentForeground}),children:Oe("span",{children:["Email: ",e]})}),t&&Oe("div",{className:vt.create("contact-item",{display:"flex",alignItems:"center",gap:mt.spacing.sm,fontSize:mt.fontSize.small,color:mt.colors.accentForeground}),children:Oe("span",{children:["Phone: ",t]})})]}),(I||U)&&Oe("div",{className:vt.create("reference",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,textAlign:"center",marginTop:mt.spacing.md}),children:["Transaction ID: ",Oe("strong",{children:null===(o=I||U)||void 0===o?void 0:o.slice(0,8).toUpperCase()})]})]})]})})})}if(Y&&("failed"===Z||"cancelled"===Z||"failed"===C||"cancelled"===C))return Oe(Yo,{title:"Payment Unsuccessful",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe("div",{className:vt.create("payment-error-card",{textAlign:"center",padding:mt.spacing.xl,backgroundColor:mt.colors.card,borderRadius:mt.radius.large,boxShadow:mt.shadow.sm,border:`2px solid ${mt.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Oe("h2",{className:vt.create("error-title",{color:mt.colors.destructive,marginBottom:mt.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"cancelled"===Z||"cancelled"===C?"Payment Cancelled":"Payment Failed"}),Oe("p",{className:vt.create("error-message",{color:mt.colors.foreground,fontSize:mt.fontSize.default,margin:"0",marginBottom:mt.spacing.lg}),children:"cancelled"===Z||"cancelled"===C?"Your payment was cancelled. You can try again by refreshing this page.":"There was an issue processing your payment. Please try again."}),Oe(Qo,{onClick:()=>window.location.reload(),children:"Try Again"})]})})});const G=u.calculations,J=G.length>0,Q=J,V=(null===(s=u.metadata)||void 0===s?void 0:s.product_name)||"Payment",K=new Date(u.expires_at),X=Boolean(null===(a=null==u?void 0:u.metadata)||void 0===a?void 0:a.quote_intent_id),ee=Boolean((!J||b)&&k&&!M&&!R),te=et(()=>{var e;const t=null===(e=null==u?void 0:u.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},[u]),ne=et(()=>F&&F.line_item_display||null,[F]);return Oe(Yo,{title:"Complete Your Purchase",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:[Oe("div",{className:vt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:mt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:mt.spacing.md}}),children:[Oe("div",{className:vt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:mt.colors.card,boxShadow:mt.shadow.sm,borderRadius:mt.radius.large,display:"flex",flexDirection:"column"}),children:[Oe("div",{className:vt.create("checkout-header",{paddingInline:mt.spacing.xl,paddingTop:mt.spacing.xl,paddingBottom:mt.spacing.lg},{"(max-width: 768px)":{paddingInline:mt.spacing.lg,paddingTop:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingTop:mt.spacing.md}}),children:[Oe("h2",{className:vt.create("checkout-title",{margin:"0",marginBottom:mt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:mt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Oe("p",{className:vt.create("checkout-description",{margin:"0",fontSize:mt.fontSize.default,lineHeight:"1.6",color:mt.colors.foreground,opacity:"0.9"}),children:J?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment option to complete your purchase."}),Oe("hr",{className:vt.create("checkout-header-border",{marginTop:mt.spacing.lg,borderColor:mt.colors.border})})]}),Oe("div",{className:vt.create("checkout-sections",{paddingInline:mt.spacing.xl,paddingBottom:mt.spacing.xl,display:"flex",flexDirection:"column",gap:mt.spacing.lg},{"(max-width: 768px)":{paddingInline:mt.spacing.lg,paddingBottom:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingBottom:mt.spacing.md}}),children:[X&&Oe("div",{className:vt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Oe(es,{title:"Cover Start Date"}),Oe("div",{className:vt.create("cover-date-container",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:[Oe("input",{type:"date",value:P,onChange:e=>{return t=e.target.value,D(t),void(async e=>{var t;if(u&&l&&(null===(t=u.metadata)||void 0===t?void 0:t.quote_intent_id)){O(!0),z(null);try{const t=await l.validateCoverStartDate(u.payment_link_id,e);t.valid?z(null):(z(t.message||"This cover start date is not valid."),t.quote_page_url&&A(t.quote_page_url))}catch(e){z("Failed to validate cover date. Please try again.")}finally{O(!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:R,className:vt.create("cover-date-input",{padding:"0.75rem 1rem",fontSize:mt.fontSize.default,border:`2px solid ${M?mt.colors.destructive:mt.colors.border}`,borderRadius:mt.radius.default,backgroundColor:mt.colors.background,color:mt.colors.foreground,width:"auto",maxWidth:"200px",cursor:R?"wait":"pointer"})}),R&&Oe("p",{className:vt.create("validating-text",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,margin:"0"}),children:"Validating..."}),M&&Oe("div",{className:vt.create("cover-date-error",{backgroundColor:`${mt.colors.destructive}10`,border:`1px solid ${mt.colors.destructive}`,borderRadius:mt.radius.default,padding:"1rem"}),children:[Oe("p",{className:vt.create("error-message",{color:mt.colors.destructive,fontSize:mt.fontSize.small,margin:"0",marginBottom:j?mt.spacing.md:"0"}),children:M}),j&&Oe("a",{href:j,className:vt.create("new-quote-link",{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:mt.colors.primary,fontSize:mt.fontSize.small,fontWeight:"500",textDecoration:"none"}),children:["Start New Quote",Oe("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:[Oe("path",{d:"M5 12h14"}),Oe("path",{d:"m12 5 7 7-7 7"})]})]})]})]})]}),Q&&J&&Oe("div",{className:vt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Oe(es,{title:"Excess Options"}),Oe("div",{className:vt.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:[...G].sort((e,t)=>e.excess_amount-t.excess_amount).map(e=>{const t=e.id===b;return Oe("div",{className:Nt(vt.create("excess-option-card",{borderRadius:mt.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),t?vt.create("excess-option-card-selected",{border:`2px solid ${mt.colors.primary}`,backgroundColor:mt.colors.accent}):vt.create("excess-option-card-unselected",{border:`2px solid ${mt.colors.border}`,backgroundColor:mt.colors.card})),onClick:()=>x(e.id),children:[Oe(ts,{selected:t}),Oe("div",{className:vt.create("excess-amount",{color:mt.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})}),(null==F?void 0:F.description)&&Oe("div",{className:vt.create("excess-description",{padding:"0.75rem",backgroundColor:mt.colors.muted,borderRadius:mt.radius.default,border:`1px solid ${mt.colors.border}`}),children:Oe(Xo,{className:vt.create("excess-description-text",{fontSize:mt.fontSize.small,color:mt.colors.foreground,margin:"0"}),children:F.description})})]}),u.payment_options.length>0&&Oe("div",{className:vt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Oe(es,{title:"Payment Options"}),Oe("div",{className:vt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:u.payment_options.map(e=>{const t=k===e.gateway_code,n="monthly"===e.payment_frequency,r=()=>{var t;return n&&e.amount.monthly?`${rs(parseFloat(e.amount.monthly))} x ${(null===(t=e.metadata)||void 0===t?void 0:t.number_of_instalments)||12}`:rs(parseFloat(e.amount.due_today))},i=()=>"bank_transfer"===e.gateway_code?"Manual":`via ${e.gateway_name}`;return Oe("div",{className:Nt(vt.create("payment-option-row",{borderRadius:mt.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?vt.create("payment-option-row-selected",{border:`2px solid ${mt.colors.primary}`,backgroundColor:mt.colors.accent}):vt.create("payment-option-row-unselected",{border:`2px solid ${mt.colors.border}`,backgroundColor:mt.colors.card})),onClick:()=>N(e.gateway_code),children:[Oe("div",{className:vt.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Oe(ts,{selected:t}),Oe("div",{className:vt.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Oe("div",{className:vt.create("frequency-title",{fontSize:mt.fontSize.default,fontWeight:"500",color:mt.colors.foreground}),children:is(n?"monthly":"one-time",e.gateway_code)}),Oe("div",{className:vt.create("gateway-description",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground}),children:i()})]})]}),Oe("div",{className:vt.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Oe(Xo,{className:vt.create("amount-text",{textAlign:"right",color:mt.colors.foreground}),children:r()}),"bank_transfer"!==e.gateway_code&&Oe(Xo,{size:"small",className:vt.create("gateway-fee-text",{textAlign:"right",color:mt.colors.mutedForeground}),children:["bank_transfer"===e.gateway_code?null:n&&(null===(o=e.metadata)||void 0===o?void 0:o.total_interest)?rs(e.metadata.total_interest):rs(0)," fee"]}),"bank_transfer"===e.gateway_code&&Oe(Xo,{size:"small",className:vt.create("no-fee-text",{textAlign:"right",color:mt.colors.mutedForeground}),children:"No fees"})]}),Oe("div",{className:vt.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Oe(ts,{selected:t}),Oe("div",{className:vt.create("payment-option-title-mobile",{fontSize:mt.fontSize.default,fontWeight:"500",color:mt.colors.foreground}),children:is(n?"monthly":"one-time",e.gateway_code)})]}),Oe("div",{className:vt.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:[Oe("div",{className:vt.create("gateway-description-mobile",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground}),children:i()}),Oe(Xo,{className:vt.create("amount-text-mobile",{fontWeight:"500",color:mt.colors.foreground}),children:r()})]})]},e.gateway_code);var o})})]})]})]}),Oe("div",{className:vt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Oe("div",{className:vt.create("checkout-sidebar-sticky",{position:"sticky",top:mt.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:[(te||ne)&&Oe("div",{className:vt.create("insurance-details-card",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,padding:mt.spacing.lg,boxShadow:mt.shadow.sm},{"(max-width: 768px)":{padding:mt.spacing.md}}),children:[Oe("h3",{className:vt.create("cart-summary-title",{fontSize:mt.fontSize.large,fontWeight:"600",marginBottom:mt.spacing.md,color:mt.colors.foreground}),children:Q?"Insurance Details":"Payment Details"}),te&&Oe(S,{children:[Oe("div",{className:vt.create("client-details",{display:"flex",flexDirection:"column",gap:mt.spacing.sm,marginBottom:mt.spacing.md}),children:[te.firstName&&te.lastName&&Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Name"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:[te.firstName," ",te.lastName]})]}),te.email&&Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Email"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:te.email})]}),te.phone&&Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Phone"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:te.phone})]}),"Payment"!==V&&Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Product"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:V})]}),Oe("div",{className:vt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Oe("span",{className:vt.create("detail-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:"Link Expires"}),Oe("span",{className:vt.create("detail-value",{fontWeight:"500",color:mt.colors.foreground,fontSize:mt.fontSize.small}),children:K.toLocaleDateString()})]})]}),Oe("hr",{className:vt.create("divider",{border:"none",borderTop:`1px solid ${mt.colors.border}`,margin:`${mt.spacing.md} 0`})})]}),ne&&Oe("div",{className:vt.create("line-item-section",{}),children:[Oe("div",{className:vt.create("line-item-description",{fontSize:mt.fontSize.small,fontWeight:"500",color:mt.colors.foreground}),children:ne.description}),null!=ne.sum_insured&&Oe("div",{className:vt.create("line-item-sum-insured",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground,marginTop:mt.spacing.sm}),children:["Sum Insured: ",rs(ne.sum_insured)]})]})]}),(te||ne)&&Oe("div",{className:vt.create("checkout-sidebar-spacer",{height:mt.spacing.lg},{"(max-width: 950px)":{height:mt.spacing.md}})}),Oe("div",{className:vt.create("checkout-sidebar-card",{backgroundColor:mt.colors.card,borderRadius:mt.radius.large,boxShadow:mt.shadow.sm,padding:mt.spacing.lg},{"(max-width: 768px)":{padding:mt.spacing.md}}),children:Oe("div",{className:vt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Oe("h3",{className:vt.create("cart-summary-title",{fontSize:mt.fontSize.large,fontWeight:"600",marginBottom:mt.spacing.sm,color:mt.colors.foreground}),children:"Payment Details"}),q&&Oe("div",{className:vt.create("summary-section",{paddingBottom:"1rem"}),children:Oe("div",{className:vt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"monthly"!==q.payment_frequency?Oe(js,{label:"Total Due Today:",value:rs(parseFloat(q.amount.due_today)),isTotal:!0}):Oe(S,{children:[Oe(js,{label:"Due Today:",value:rs(parseFloat(q.amount.due_today)),isTotal:!0}),q.amount.monthly&&Oe(js,{label:"Then Monthly:",value:rs(parseFloat(q.amount.monthly))}),(null===(c=q.metadata)||void 0===c?void 0:c.number_of_instalments)&&Oe(js,{label:"Installments:",value:q.metadata.number_of_instalments.toString()}),q.amount.total&&Oe(js,{label:"Total Payable:",value:rs(parseFloat(q.amount.total))})]})})}),Oe(Qo,{onClick:async()=>{var e,t,n,r;if(!u)return;const i=u.calculations.length>0,o=!i;if(i&&!b)return void alert("Please select an excess amount before proceeding.");if(!k)return void alert("Please select a payment method before proceeding.");const s=i?u.calculations.find(e=>e.id===b):null;if(i&&!s)return void alert("Payment configuration error. Please try again.");if(!u.payment_options.find(e=>e.gateway_code===k))return void alert("Payment method not available. Please try again.");let a="Customer";if(null===(e=u.metadata)||void 0===e?void 0:e.client_name)a=u.metadata.client_name;else if(null===(t=u.metadata)||void 0===t?void 0:t.client_details){const e=u.metadata.client_details;e.first_name&&(a=`${e.first_name} ${e.last_name||""}`.trim())}if(o){if(!l)return void alert("Payment service not available. Please try again.");try{m(!0);const e=await l.initiateFixedPayment(u.payment_link_id,k,a);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{m(!1)}return}const c=null===(n=u.metadata)||void 0===n?void 0:n.quote_intent_id,d={...c?{quoteIntentId:c}:{paymentLinkId:u.payment_link_id},paymentLinkId:u.payment_link_id,excessId:(null==s?void 0:s.excess_id)||"",gatewayId:k,calculationId:b||"",clientDetails:{legalName:a},metadata:{payment_link_id:u.payment_link_id,payment_type:c?"quote":"rate",gateway_code:k,gateway:k},...X&&P?{coverStartDate:P}:{}};if("bank_transfer"!==k)w(d),y(!0);else{if(!l)return void alert("Payment service not available. Please try again.");try{m(!0);const e={...d,returnUrl:window.location.href},t=await l.initiatePayment(e,k);if(!(t.bank_account_name&&t.reference&&t.transaction_id))throw new Error("Invalid bank transfer response");L({transactionId:t.transaction_id,organisationId:(null===(r=u.organisation)||void 0===r?void 0:r.id)||""})}catch(e){alert(e.message||"Failed to initiate bank transfer")}finally{m(!1)}}},disabled:!ee,className:vt.create("purchase-button",{width:"100%",height:"3rem",fontSize:mt.fontSize.default,fontWeight:"600"}),children:ee?"Go to Payment":"Select Options to Continue"})]})})]})})]}),g&&v&&l&&Oe(Ds,{isOpen:g,onClose:()=>{y(!1),w(null)},onSuccess:()=>{y(!1),w(null),alert("Payment completed successfully!")},paymentRequest:v,httpClient:l})]})})}function js({label:e,value:t,isTotal:n=!1,className:r}){return Oe("div",{className:Nt(vt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Oe("span",{className:vt.create("summary-label",{color:mt.colors.mutedForeground,fontSize:mt.fontSize.small}),children:e}),Oe("span",{className:vt.create("summary-value",{fontWeight:n?"600":"500",color:mt.colors.foreground,fontSize:n?mt.fontSize.large:"inherit"}),children:t})]})}function As({products:e,onSelectProduct:t}){const[n,r]=Ve(null),i=(e,t)=>{t&&(t.preventDefault(),t.stopPropagation()),r(e)};return Oe(Yo,{title:"Select cover",noSubscription:!0,hideHeader:!0,children:Oe($t,{children:Oe("div",{className:vt.create("product-selection-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Oe("div",{className:vt.create("product-selection-card",{backgroundColor:mt.colors.card,boxShadow:mt.shadow.sm,borderRadius:mt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Oe("div",{className:vt.create("product-selection-header",{paddingInline:mt.spacing.xl,paddingTop:mt.spacing.xl,paddingBottom:mt.spacing.lg},{"(max-width: 768px)":{paddingInline:mt.spacing.lg,paddingTop:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingTop:mt.spacing.md}}),children:[Oe("h2",{className:vt.create("product-selection-title",{margin:"0",marginBottom:mt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:mt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Select Your Cover"}),Oe("p",{className:vt.create("product-selection-description",{margin:"0",fontSize:mt.fontSize.default,lineHeight:"1.6",color:mt.colors.foreground,opacity:"0.9"}),children:"What type of vessel are you insuring?"}),Oe("hr",{className:vt.create("product-selection-header-border",{marginTop:mt.spacing.lg,borderColor:mt.colors.border})})]}),Oe("div",{className:vt.create("product-selection-content",{paddingInline:mt.spacing.xl,paddingBottom:mt.spacing.xl},{"(max-width: 768px)":{paddingInline:mt.spacing.lg,paddingBottom:mt.spacing.lg},"(max-width: 480px)":{paddingInline:mt.spacing.md,paddingBottom:mt.spacing.md}}),children:[0===e.length?Oe("div",{className:vt.create("no-products-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${mt.colors.border}`,borderRadius:mt.radius.default,backgroundColor:mt.colors.muted}),children:[Oe("div",{style:{marginBottom:mt.spacing.default},children:Oe("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{margin:"0 auto",opacity:.5},children:[Oe("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Oe("polyline",{points:"14 2 14 8 20 8"})]})}),Oe("p",{className:vt.create("placeholder-text",{color:mt.colors.mutedForeground,margin:"0"}),children:"No products available for quoting."})]}):Oe("div",{className:vt.create("product-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Oe(Ws,{product:e,isSelected:(null==n?void 0:n.id)===e.id,onSelect:i},e.id))}),e.length>0&&Oe("div",{className:vt.create("product-selection-actions",{marginTop:mt.spacing.lg}),children:Oe(Qo,{onClick:()=>{n&&t(n)},disabled:!n,className:vt.create("product-selection-continue-button",{width:"100%"}),children:"Continue"})})]})]})})})})}function Ws({product:e,isSelected:t,onSelect:n}){return Oe("div",{className:Nt(vt.create("product-option-row",{borderRadius:mt.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?vt.create("product-option-row-selected",{border:`2px solid ${mt.colors.primary}`,backgroundColor:mt.colors.accent}):vt.create("product-option-row-unselected",{border:`2px solid ${mt.colors.border}`,backgroundColor:mt.colors.card})),onClick:t=>n(e,t),role:"button",tabIndex:0,onKeyPress:t=>{"Enter"!==t.key&&" "!==t.key||n(e,t)},children:[Oe(ts,{selected:t}),Oe("div",{className:vt.create("product-option-content",{display:"flex",alignItems:"center",justifyContent:"space-between",flex:"1",gap:"1rem"}),children:[Oe("div",{className:vt.create("product-option-info",{display:"flex",flexDirection:"column"}),children:[e.description&&Oe("div",{className:vt.create("product-option-description",{fontSize:mt.fontSize.default,fontWeight:"500",color:mt.colors.foreground}),children:e.description}),Oe("div",{className:vt.create("product-option-name",{fontSize:mt.fontSize.small,color:mt.colors.mutedForeground}),children:e.name})]}),e.icon_svg&&Oe("div",{className:vt.create("product-option-icon",{width:"2.5rem",height:"2.5rem",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",color:t?mt.colors.primary:mt.colors.mutedForeground,transition:"color 150ms ease"}),dangerouslySetInnerHTML:{H:e.icon_svg}})]})]})}function Ls(){var e,t;const n=It(),{paymentLinkConfig:r,availableProducts:i,formStateManager:o}=n;if(i&&!o)return Oe(As,{products:i,onSelectProduct:async e=>{localStorage.setItem("insure-os-selected-product",e.code),window.location.reload()}});if(r)return Oe(Os,{paymentLinkId:r.paymentLinkId,signedUrl:r.signedUrl});const s=new URLSearchParams(window.location.search),a=s.get("pl_ref");if(a)return Oe(Os,{paymentLinkId:a});const c=window.location.pathname,l=c.match(/\/pay\/([a-f0-9-]+)/);if(l&&l[1])return Oe(Os,{paymentLinkId:l[1],signedUrl:window.location.href});const u=c.match(/\/payments\/bank-transfer\/([a-f0-9-]+)/),d=s.get("orgId");if(u&&u[1]&&d)return Oe(Ms,{transactionId:u[1],organisationId:d});const{isCalculating:h,results:m,quoteIntent:f}=Et(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?Oe(Jo,{message:"Processing your quote, please wait..."}):p&&g&&(null===(t=null==f?void 0:f.organisation)||void 0===t?void 0:t.id)?Oe(Ms,{transactionId:g.id,organisationId:f.organisation.id}):y?Oe(Ps,{}):m?Oe(ys,{results:m}):Oe(Es,{})}function Bs(e){return Oe(Tt,{...e,children:Oe(Ls,{})})}class Fs extends N{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(e,n){t();try{Promise.resolve().then(function(){return _d}).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=he("initialization",e,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return we(e)?Oe(Ko,{message:e.message}):Oe(Vo,{error:e})}return this.props.children}}function qs({config:e,initializeFormContext:n}){const[r,i]=Ve({type:"loading",message:"Loading application..."});return Ke(()=>{(async()=>{try{t();const r=await n(e),o=r.availableProducts&&r.availableProducts.length>0;if(!("payment"===e.mode||r.paymentLinkConfig||o||r.formStateManager&&"function"==typeof r.formStateManager.getFormProgress))throw new Error("FormStateManager was not properly initialized");t(),i({type:"success",formContextProps: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?he("maintenance",e):he("initialization",e),t((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[e,n]),Oe(Fs,{children:Oe("div",{className:vt.create("root",{fontFamily:mt.fontFamily,backgroundColor:mt.colors.background,minHeight:"100vh",color:mt.colors.foreground}),children:function(){switch(r.type){case"loading":return Oe(Jo,{message:r.message});case"error":return we(r.error)?Oe(Ko,{message:r.error.message}):Oe(Vo,{error:r.error});case"success":return Oe(Bs,{...r.formContextProps});default:return Oe(Vo,{})}}()})})}const Hs="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Us=globalThis,Zs="10.17.0";function Ys(){return Gs(Us),Us}function Gs(e){const t=e.oe=e.oe||{};return t.version=t.version||Zs,t[Zs]=t[Zs]||{}}function Js(e,t,n=Us){const r=n.oe=n.oe||{},i=r[Zs]=r[Zs]||{};return i[e]||(i[e]=t())}const Qs=["debug","info","warn","error","log","assert","trace"],Vs={};function Ks(e){if(!("console"in Us))return e();const t=Us.console,n={},r=Object.keys(Vs);r.forEach(e=>{const r=Vs[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Xs(){return ta().enabled}function ea(e,...t){Hs&&Xs()&&Ks(()=>{Us.console[e](`Sentry Logger [${e}]:`,...t)})}function ta(){return Hs?Js("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const na=function(){ta().enabled=!0},ra=function(...e){ea("log",...e)},ia=function(...e){ea("warn",...e)},oa=function(...e){ea("error",...e)},sa="?",aa=/\(error: (.*)\)/,ca=/captureMessage|captureException/;function la(...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=aa.test(n)?n.replace(aa,"$1"):n;if(!s.match(/\S*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(ua(t).function||"")&&t.pop(),t.reverse(),ca.test(ua(t).function||"")&&(t.pop(),ca.test(ua(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||ua(t).filename,function:e.function||sa}))}(i.slice(r))}}function ua(e){return e[e.length-1]||{}}const da="<anonymous>";function ha(e){try{return e&&"function"==typeof e&&e.name||da}catch{return da}}function ma(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}}}const fa={},pa={};function ga(e,t){fa[e]=fa[e]||[],fa[e].push(t)}function ya(e,t){if(!pa[e]){pa[e]=!0;try{t()}catch(t){Hs&&oa(`Error while instrumenting ${e}`,t)}}}function va(e,t){const n=e&&fa[e];if(n)for(const r of n)try{r(t)}catch(t){Hs&&oa(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${ha(r)}\nError:`,t)}}let wa=null;function ba(){wa=Us.onerror,Us.onerror=function(e,t,n,r,i){return va("error",{column:r,error:i,line:n,msg:e,url:t}),!!wa&&wa.apply(this,arguments)},Us.onerror.se=!0}let xa=null;function ka(){xa=Us.onunhandledrejection,Us.onunhandledrejection=function(e){return va("unhandledrejection",e),!xa||xa.apply(this,arguments)},Us.onunhandledrejection.se=!0}const Sa={}.toString;function Na(e){switch(Sa.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return za(e,Error)}}function _a(e,t){return Sa.call(e)===`[object ${t}]`}function $a(e){return _a(e,"ErrorEvent")}function Ca(e){return _a(e,"DOMError")}function Ta(e){return _a(e,"String")}function Ia(e){return"object"==typeof e&&null!==e&&"ae"in e&&"ce"in e}function Ea(e){return null===e||Ia(e)||"object"!=typeof e&&"function"!=typeof e}function Pa(e){return _a(e,"Object")}function Da(e){return"undefined"!=typeof Event&&za(e,Event)}function Ma(e){return Boolean(e?.then&&"function"==typeof e.then)}function za(e,t){try{return e instanceof t}catch{return!1}}function Ra(e){return!("object"!=typeof e||null===e||!e.le&&!e.ue)}const Oa=Us;function ja(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,s=0;const a=" > ",c=a.length;let l;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(l=Aa(n,u),!("html"===l||o>1&&s+i.length*c+l.length>=d));)i.push(l),s+=l.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Aa(e,t){const n=e,r=[];if(!n?.tagName)return"";if(Oa.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&&Ta(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}const o=["aria-label","type","name","title","alt"];for(const e of o){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}function Wa(){try{return Oa.document.location.href}catch{return""}}function La(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Ba(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{Ra(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Fa(e,t,n=!1){return!!Ta(e)&&(_a(t,"RegExp")?t.test(e):!!Ta(t)&&(n?e===t:e.includes(t)))}function qa(e,t=[],n=!1){return t.some(t=>Fa(e,t,n))}function Ha(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Za(i,r);try{e[t]=i}catch{Hs&&ra(`Failed to replace method "${t}" in object`,e)}}function Ua(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Hs&&ra(`Failed to add non-enumerable property "${t}" to object`,e)}}function Za(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Ua(e,"__sentry_original__",t)}catch{}}function Ya(e){return e.de}function Ga(e){if(Na(e))return{message:e.message,name:e.name,stack:e.stack,...Qa(e)};if(Da(e)){const t={type:e.type,target:Ja(e.target),currentTarget:Ja(e.currentTarget),...Qa(e)};return"undefined"!=typeof CustomEvent&&za(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Ja(e){try{return"undefined"!=typeof Element&&za(e,Element)?ja(e):{}.toString.call(e)}catch{return"<unknown>"}}function Qa(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)({}).hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function Va(e=function(){const e=Us;return e.crypto||e.msCrypto}()){let t=()=>16*Math.random();try{if(e?.randomUUID)return e.randomUUID().replace(/-/g,"");e?.getRandomValues&&(t=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,e=>(e^(15&t())>>e/4).toString(16))}function Ka(e){return e.exception?.values?.[0]}function Xa(e){const{message:t,event_id:n}=e;if(t)return t;const r=Ka(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ec(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 tc(e,t){const n=Ka(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 nc(e){if(function(e){try{return e.he}catch{}}(e))return!0;try{Ua(e,"__sentry_captured__",!0)}catch{}return!1}function rc(){return Date.now()/1e3}let ic;function oc(){return(ic??(ic=function(){const{performance:e}=Us;if(!e?.now||!e.timeOrigin)return rc;const t=e.timeOrigin;return()=>(t+e.now())/1e3}()))()}function sc(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||oc(),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:Va()),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 ac(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]=ac(r[e],t[e],n-1));return r}function cc(){return Va()}function lc(){return Va().substring(16)}const uc="_sentrySpan";function dc(e,t){t?Ua(e,uc,t):delete e[uc]}function hc(e){return e[uc]}class mc{constructor(){this.me=!1,this.fe=[],this.pe=[],this.ge=[],this.ye=[],this.ve={},this.we={},this.be={},this.xe={},this.ke={},this.Se={traceId:cc(),sampleRand:Math.random()}}clone(){const e=new mc;return e.ge=[...this.ge],e.we={...this.we},e.be={...this.be},e.xe={...this.xe},this.xe.flags&&(e.xe.flags={values:[...this.xe.flags.values]}),e.ve=this.ve,e.Ne=this.Ne,e._e=this._e,e.$e=this.$e,e.Ce=this.Ce,e.pe=[...this.pe],e.ye=[...this.ye],e.ke={...this.ke},e.Se={...this.Se},e.Te=this.Te,e.Ie=this.Ie,dc(e,hc(this)),e}setClient(e){this.Te=e}setLastEventId(e){this.Ie=e}getClient(){return this.Te}lastEventId(){return this.Ie}addScopeListener(e){this.fe.push(e)}addEventProcessor(e){return this.pe.push(e),this}setUser(e){return this.ve=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._e&&sc(this._e,{user:e}),this.Ee(),this}getUser(){return this.ve}setTags(e){return this.we={...this.we,...e},this.Ee(),this}setTag(e,t){return this.we={...this.we,[e]:t},this.Ee(),this}setExtras(e){return this.be={...this.be,...e},this.Ee(),this}setExtra(e,t){return this.be={...this.be,[e]:t},this.Ee(),this}setFingerprint(e){return this.Ce=e,this.Ee(),this}setLevel(e){return this.Ne=e,this.Ee(),this}setTransactionName(e){return this.$e=e,this.Ee(),this}setContext(e,t){return null===t?delete this.xe[e]:this.xe[e]=t,this.Ee(),this}setSession(e){return e?this._e=e:delete this._e,this.Ee(),this}getSession(){return this._e}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof mc?t.getScopeData():Pa(t)?e:void 0,{tags:r,extra:i,user:o,contexts:s,level:a,fingerprint:c=[],propagationContext:l}=n||{};return this.we={...this.we,...r},this.be={...this.be,...i},this.xe={...this.xe,...s},o&&Object.keys(o).length&&(this.ve=o),a&&(this.Ne=a),c.length&&(this.Ce=c),l&&(this.Se=l),this}clear(){return this.ge=[],this.we={},this.be={},this.ve={},this.xe={},this.Ne=void 0,this.$e=void 0,this.Ce=void 0,this._e=void 0,dc(this,void 0),this.ye=[],this.setPropagationContext({traceId:cc(),sampleRand:Math.random()}),this.Ee(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:rc(),...e,message:e.message?La(e.message,2048):e.message};return this.ge.push(r),this.ge.length>n&&(this.ge=this.ge.slice(-n),this.Te?.recordDroppedEvent("buffer_overflow","log_item")),this.Ee(),this}getLastBreadcrumb(){return this.ge[this.ge.length-1]}clearBreadcrumbs(){return this.ge=[],this.Ee(),this}addAttachment(e){return this.ye.push(e),this}clearAttachments(){return this.ye=[],this}getScopeData(){return{breadcrumbs:this.ge,attachments:this.ye,contexts:this.xe,tags:this.we,extra:this.be,user:this.ve,level:this.Ne,fingerprint:this.Ce||[],eventProcessors:this.pe,propagationContext:this.Se,sdkProcessingMetadata:this.ke,transactionName:this.$e,span:hc(this)}}setSDKProcessingMetadata(e){return this.ke=ac(this.ke,e,2),this}setPropagationContext(e){return this.Se=e,this}getPropagationContext(){return this.Se}captureException(e,t){const n=t?.event_id||Va();if(!this.Te)return Hs&&ia("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Te.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||Va();if(!this.Te)return Hs&&ia("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this.Te.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t?.event_id||Va();return this.Te?(this.Te.captureEvent(e,{...t,event_id:n},this),n):(Hs&&ia("No client configured on scope - will not capture event!"),n)}Ee(){this.me||(this.me=!0,this.fe.forEach(e=>{e(this)}),this.me=!1)}}class fc{constructor(e,t){let n,r;n=e||new mc,r=t||new mc,this.Pe=[{scope:n}],this.De=r}withScope(e){const t=this.Me();let n;try{n=e(t)}catch(e){throw this.ze(),e}return Ma(n)?n.then(e=>(this.ze(),e),e=>{throw this.ze(),e}):(this.ze(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.De}getStackTop(){return this.Pe[this.Pe.length-1]}Me(){const e=this.getScope().clone();return this.Pe.push({client:this.getClient(),scope:e}),e}ze(){return!(this.Pe.length<=1||!this.Pe.pop())}}function pc(){const e=Gs(Ys());return e.stack=e.stack||new fc(Js("defaultCurrentScope",()=>new mc),Js("defaultIsolationScope",()=>new mc))}function gc(e){return pc().withScope(e)}function yc(e,t){const n=pc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function vc(e){return pc().withScope(()=>e(pc().getIsolationScope()))}function wc(e){const t=Gs(e);return t.acs?t.acs:{withIsolationScope:vc,withScope:gc,withSetScope:yc,withSetIsolationScope:(e,t)=>vc(t),getCurrentScope:()=>pc().getScope(),getIsolationScope:()=>pc().getIsolationScope()}}function bc(){return wc(Ys()).getCurrentScope()}function xc(){return wc(Ys()).getIsolationScope()}function kc(...e){const t=wc(Ys());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Sc(){return bc().getClient()}function Nc(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||lc()};return r&&(o.parent_span_id=r),o}const _c="sentry.profile_id",$c="sentry.exclusive_time";function Cc(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.Re,isolationScope:Cc(t.Oe)}}const Ic=/^sentry-/;function Ec(e){return e.split(",").map(e=>e.split("=").map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const Pc=/^o(\d+)\./,Dc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Mc(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function zc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Rc(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(Pc);return t?.[1]}(n)),r}let Oc=!1;function jc(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Bc(e).parent_span_id,o=Tc(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||lc():t,trace_id:n}}function Ac(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 Wc(e){return"number"==typeof e?Lc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Lc(e.getTime()):oc()}function Lc(e){return e>9999999999?e/1e3:e}function Bc(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:c}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0,start_timestamp:Wc(i),timestamp:Wc(s)||void 0,status:Fc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:Ac(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Fc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"unknown_error"}function qc(e){return e.je||e}function Hc(){Oc||(Ks(()=>{}),Oc=!0)}function Uc(e){ra(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Zc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(Gc(n)){if(Fa(e.description,n))return Hs&&Uc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||Fa(e.description,n.name),r=!n.op||e.op&&Fa(e.op,n.op);if(t&&r)return Hs&&Uc(e),!0}return!1}function Yc(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 Gc(e){return"string"==typeof e||e instanceof RegExp}const Jc="production";function Qc(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Jc,release:n.release,public_key:r,trace_id:e,org_id:Rc(t)};return t.emit("createDsc",i),i}function Vc(e){const t=Sc();if(!t)return{};const n=qc(e),r=Bc(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 c=n.Ae;if(c)return a(c);const l=o?.get("sentry.dsc"),u=l&&function(e){const t=function(e){if(e&&(Ta(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=Ec(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Ec(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.match(Ic)&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(l);if(u)return a(u);const d=Qc(e.spanContext().traceId,t),h=i["sentry.source"],m=r.description;return"url"!==h&&m&&(d.transaction=m),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const e=Sc()?.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 Kc(e,t=100,n=1/0){try{return el("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Xc(e,t=3,n=102400){const r=Kc(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?Xc(e,t-1,n):r;var i}function el(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.We)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(Ra(t))return"[VueViewModel]";if(Pa(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: ${ha(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.Le)return t;const c="number"==typeof t.Be?t.Be:n;if(0===c)return a.replace("object ","");if(o(t))return"[Circular ~]";const l=t;if(l&&"function"==typeof l.toJSON)try{return el("",l.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=Ga(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]=el(e,t,c-1,r,i),d++}return s(t),u}function tl(e,t=[]){return[e,t]}function nl(e,t){const[n,r]=e;return[n,[...r,t]]}function rl(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function il(e){const t=Gs(Us);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function ol(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[il(r),e]:r.push("string"==typeof e?il(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(Kc(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 sl(e){const t="string"==typeof e.data?il(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const al={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function cl(e){return al[e]}function ll(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function ul(e){return new hl(t=>{t(e)})}function dl(e){return new hl((t,n)=>{n(e)})}class hl{constructor(e){this.Fe=0,this.qe=[],this.He(e)}then(e,t){return new hl((n,r)=>{this.qe.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.Ue()})}catch(e){return this.then(e=>e,e)}finally(e){return new hl((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)})})}Ue(){if(0===this.Fe)return;const e=this.qe.slice();this.qe=[],e.forEach(e=>{e[0]||(1===this.Fe&&e[1](this.Ze),2===this.Fe&&e[2](this.Ze),e[0]=!0)})}He(e){const t=(e,t)=>{0===this.Fe&&(Ma(t)?t.then(n,r):(this.Fe=e,this.Ze=t,this.Ue()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}}function ml(e,t,n,r=0){try{const i=fl(t,n,e,r);return Ma(i)?i:ul(i)}catch(e){return dl(e)}}function fl(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return Hs&&null===o&&ra(`Event processor "${i.id||"?"}" dropped event`),Ma(o)?o.then(e=>fl(e,t,n,r+1)):fl(o,t,n,r+1)}function pl(e,t){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:h,transactionName:m,span:f}=t;gl(e,"extra",n),gl(e,"tags",r),gl(e,"user",i),gl(e,"contexts",o),e.sdkProcessingMetadata=ac(e.sdkProcessingMetadata,a,2),s&&(e.level=s),m&&(e.transactionName=m),f&&(e.span=f),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),l.length&&(e.fingerprint=[...e.fingerprint,...l]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function gl(e,t,n){e[t]=ac(e[t],n,1)}let yl,vl,wl;function bl(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||Va(),timestamp:t.timestamp||rc()},l=n.integrations||e.integrations.map(e=>e.name);!function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o=250}=t;e.environment=e.environment||n||Jc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&(s.url=La(s.url,o))}(c,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(c,l),i&&i.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=Us.Ye;if(!t)return{};const n=Object.keys(t);return wl&&n.length===vl||(vl=n.length,wl=n.reduce((n,r)=>{yl||(yl={});const i=yl[r];if(i)n[i[0]]=i[1];else{const i=e(r);for(let e=i.length-1;e>=0;e--){const o=i[e],s=o?.filename,a=t[r];if(s&&a){n[s]=a,yl[r]=[s,a];break}}}return n},{})),wl}(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}(c,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new mc;return n.update(t),n}(r,n.captureContext);n.mechanism&&tc(c,n.mechanism);const d=i?i.getEventProcessors():[],h=Js("globalScope",()=>new mc).getScopeData();o&&pl(h,o.getScopeData()),u&&pl(h,u.getScopeData());const m=[...n.attachments||[],...h.attachments];return 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:jc(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Vc(t),...e.sdkProcessingMetadata};const n=Bc(qc(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)}(c,h),ml([...d,...h.eventProcessors],c,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:Kc(e.data,t,n)}}))},...e.user&&{user:Kc(e.user,t,n)},...e.contexts&&{contexts:Kc(e.contexts,t,n)},...e.extra&&{extra:Kc(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Kc(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Kc(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Kc(e.contexts.flags,3,n)),r}(e,s,a):e))}function xl(e){return bc().captureException(e,void 0)}function kl(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return bc().captureMessage(e,n,r)}function Sl(e,t){return bc().captureEvent(e,t)}function Nl(e){const t=xc(),n=bc(),{userAgent:r}=Us.navigator||{},i=function(e){const t=oc(),n={sid:Va(),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&&sc(n,e),n}({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&sc(o,{status:"exited"}),_l(),t.setSession(i),i}function _l(){const e=xc(),t=bc().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),sc(e,t)}(t),$l(),e.setSession()}function $l(){const e=xc(),t=Sc(),n=e.getSession();n&&t&&t.captureSession(n)}function Cl(e=!1){e?_l():$l()}const Tl=[];function Il(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 El(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Pl(e,t,n){if(n[t.name])Hs&&ra(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===Tl.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),Tl.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)}Hs&&ra(`Integration installed: ${t.name}`)}}function Dl(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 Ml="Not capturing exception because it's already been captured.",zl="Discarded session because of missing or non-string release",Rl=Symbol.for("SentryInternalError"),Ol=Symbol.for("SentryDoNotSendEventError");function jl(e){return{message:e,[Rl]:!0}}function Al(e){return{message:e,[Ol]:!0}}function Wl(e){return!!e&&"object"==typeof e&&Rl in e}function Ll(e){return!!e&&"object"==typeof e&&Ol in e}class Bl{constructor(e){if(this.Ge=e,this.Je={},this.Qe=0,this.Ve={},this.Ke={},this.pe=[],e.dsn?this.Xe=function(e){const t="string"==typeof e?function(e){const t=Dc.exec(e);if(!t)return void Ks(()=>{});const[n,r,i="",o="",s="",a=""]=t.slice(1);let c="",l=a;const u=l.split("/");if(u.length>1&&(c=u.slice(0,-1).join("/"),l=u.pop()),l){const e=l.match(/^\d+/);e&&(l=e[0])}return zc({host:o,pass:i,path:c,projectId:l,port:s,protocol:n,publicKey:r})}(e):zc(e);if(t&&function(e){if(!Hs)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(oa(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(oa(`Invalid Sentry Dsn: Invalid port ${t}`),1):(oa(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(oa(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Hs&&ia("No DSN provided, client will not send events."),this.Xe){const i=(t=this.Xe,n=e.tunnel,r=e.et?e.et.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.nt=e.transport({tunnel:this.Ge.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:i})}var t,n,r}captureException(e,t,n){const r=Va();if(nc(e))return Hs&&ra(Ml),r;const i={event_id:r,...t};return this.rt(this.eventFromException(e,i).then(e=>this.it(e,i,n))),i.event_id}captureMessage(e,t,n,r){const i={event_id:Va(),...n},o=Ia(e)?e:String(e),s=Ea(e)?this.eventFromMessage(o,t,i):this.eventFromException(e,i);return this.rt(s.then(e=>this.it(e,i,r))),i.event_id}captureEvent(e,t,n){const r=Va();if(t?.originalException&&nc(t.originalException))return Hs&&ra(Ml),r;const i={event_id:r,...t},o=e.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope;return this.rt(this.it(e,i,s||n,a)),i.event_id}captureSession(e){this.sendSession(e),sc(e,{init:!1})}getDsn(){return this.Xe}getOptions(){return this.Ge}getSdkMetadata(){return this.Ge.et}getTransport(){return this.nt}async flush(e){const t=this.nt;if(!t)return!0;this.emit("flush");const n=await this.ot(e),r=await t.flush(e);return n&&r}async close(e){const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this.pe}addEventProcessor(e){this.pe.push(e)}init(){(this.st()||this.Ge.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this.ct()}getIntegrationByName(e){return this.Je[e]}addIntegration(e){const t=this.Je[e.name];Pl(this,e,this.Je),t||El(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=ll(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:Mc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,tl(s,[[{type:o},e]])}(e,this.Xe,this.Ge.et,this.Ge.tunnel);for(const e of t.attachments||[])n=nl(n,sl(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=Jc}=this.Ge;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Hs&&ia(zl));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(Hs&&ia(zl));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=ll(n);return tl({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Mc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.Xe,this.Ge.et,this.Ge.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.Ge.sendClientReports){const r=`${e}:${t}`;Hs&&ra(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.Ve[r]=(this.Ve[r]||0)+n}}on(e,t){const n=this.Ke[e]=this.Ke[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this.Ke[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this.st()&&this.nt)try{return await this.nt.send(e)}catch(e){return Hs&&oa("Error while sending envelope:",e),{}}return Hs&&oa("Transport disabled"),{}}ct(){const{integrations:e}=this.Ge;this.Je=function(e,t){const n={};return t.forEach(t=>{t&&Pl(e,t,n)}),n}(this,e),El(this,e)}lt(e,t){let n="fatal"===t.level,r=!1;const i=t.exception?.values;if(i){r=!0;for(const e of i){const t=e.mechanism;if(!1===t?.handled){n=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(sc(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}async ot(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this.Qe)return!0;t++}return!1}st(){return!1!==this.getOptions().enabled&&void 0!==this.nt}ut(e,t,n,r){const i=this.getOptions(),o=Object.keys(this.Je);return!t.integrations&&o?.length&&(t.integrations=o),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),bl(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:Nc(n),...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||Qc(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}it(e,t={},n=bc(),r=xc()){return Hs&&Fl(e)&&ra(`Captured error event \`${Dl(e)[0]||"<unknown>"}\``),this.ht(e,t,n,r).then(e=>e.event_id,e=>{Hs&&(Ll(e)?ra(e.message):Wl(e)?ia(e.message):ia(e))})}ht(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=ql(e),a=Fl(e),c=e.type||"error",l=`before send for type \`${c}\``,u=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 u&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),dl(Al(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d="replay_event"===c?"replay":c;return this.ut(e,t,n,r).then(e=>{if(null===e)throw this.recordDroppedEvent("event_processor",d),Al("An event processor returned `null`, will not send event.");if(t.data&&!0===t.data.ft)return e;const n=function(e,t,n,r){const{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s,ignoreSpans:a}=t;let c=n;if(Fl(c)&&i)return i(c,r);if(ql(c)){if(s||a){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?.[_c],exclusive_time:s?.[$c],measurements:e.measurements,is_segment:!0}}(c);if(a?.length&&Zc(t,a))return null;if(s){const e=s(t);e?c=ac(n,{type:"transaction",timestamp:(l=e).timestamp,start_timestamp:l.start_timestamp,transaction:l.description,contexts:{trace:{trace_id:l.trace_id,span_id:l.span_id,parent_span_id:l.parent_span_id,op:l.op,status:l.status,origin:l.origin,data:{...l.data,...l.profile_id&&{[_c]:l.profile_id},...l.exclusive_time&&{[$c]:l.exclusive_time}}}},measurements:l.measurements}):Hc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(a?.length&&Zc(e,a))Yc(n,e);else if(s){const n=s(e);n?t.push(n):(Hc(),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 l;return c}(this,i,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Ma(e))return e.then(e=>{if(!Pa(e)&&null!==e)throw jl(n);return e},e=>{throw jl(`${t} rejected with ${e}`)});if(!Pa(e)&&null!==e)throw jl(n);return e}(n,l)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",d),s){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw Al(`${l} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.lt(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(Ll(e)||Wl(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{ft:!0},originalException:e}),jl(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)})}rt(e){this.Qe++,e.then(e=>(this.Qe--,e),e=>(this.Qe--,e))}gt(){const e=this.Ve;return this.Ve={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}yt(){Hs&&ra("Flushing outcomes...");const e=this.gt();if(0===e.length)return void(Hs&&ra("No outcomes to send"));if(!this.Xe)return void(Hs&&ra("No dsn provided, will not send outcomes"));Hs&&ra("Sending outcomes:",e);const t=(n=e,tl((r=this.Ge.tunnel&&Mc(this.Xe))?{dsn:r}:{},[[{type:"client_report"},{timestamp:rc(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function Fl(e){return void 0===e.type}function ql(e){return"transaction"===e.type}function Hl(e){const t=function(e){return Ul().get(e)}(e)??[];if(0===t.length)return;const n=e.getOptions(),r=function(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Mc(r)),tl(i,[(o=e,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(t,n.et,n.tunnel,e.getDsn());Ul().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(r)}function Ul(){return Js("clientToLogBufferMap",()=>new WeakMap)}const Zl=Symbol.for("SentryBufferFullError");function Yl(e,t,n=function(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 dl(Zl);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return ul(!0);const n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;const r=[n,new Promise(t=>setTimeout(()=>t(!1),e))];return Promise.race(r)}}}(e.bufferSize||64)){let r={};return{send:function(i){const o=[];if(rl(i,(t,n)=>{const i=cl(n);!function(e,t,n=Date.now()){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=tl(i[0],o),a=t=>{rl(s,(n,r)=>{e.recordDroppedEvent(t,cl(r))})};return n.add(()=>t({body:ol(s)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Hs&&ia(`Sentry responded with status code ${e.statusCode} to sent event.`),r=function(e,{statusCode:t,headers:n},r=Date.now()){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=Date.now()){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"),Hs&&oa("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Zl)return Hs&&oa("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function Gl(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 Jl(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 Ql=100;function Vl(e,t){const n=Sc(),r=xc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Ql}=n.getOptions();if(o<=0)return;const s={timestamp:rc(),...e},a=i?Ks(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let Kl;const Xl=new WeakMap,eu=()=>({name:"FunctionToString",setupOnce(){Kl=function(){}.toString;try{Function.prototype.toString=function(...e){const t=Ya(this),n=Xl.has(Sc())&&void 0!==t?t:this;return Kl.apply(n,e)}}catch{}},setup(e){Xl.set(e,!0)}}),tu=[/^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. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],nu=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=iu(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=iu(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&&qa(n,t)}(e,t.ignoreTransactions))return Hs&&ia(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Xa(e)}`),!0}else{if(function(e,t){return!!t?.length&&Dl(e).some(e=>qa(e,t))}(e,t.ignoreErrors))return Hs&&ia(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Xa(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 Hs&&ia(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Xa(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=ou(e);return!!n&&qa(n,t)}(e,t.denyUrls))return Hs&&ia(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Xa(e)}.\nUrl: ${ou(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=ou(e);return!n||qa(n,t)}(e,t.allowUrls))return Hs&&ia(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Xa(e)}.\nUrl: ${ou(e)}`),!0}return!1}(n,t)?null:n}}},ru=(e={})=>({...nu(e),name:"InboundFilters"});function iu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:tu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function ou(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 Hs&&oa(`Cannot extract url for event ${Xa(e)}`),null}}function su(e,t,n,r,i,o){if(!i.exception?.values||!o||!za(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=au(e,t,r,o.originalException,n,i.exception.values,s,0))}function au(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(za(r[i],Error)){cu(s,a);const o=e(t,r[i]),l=c.length;lu(o,i,l,a),c=au(e,t,n,r[i],i,[o,...c],o,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(za(r,Error)){cu(s,a);const l=e(t,r),u=c.length;lu(l,`errors[${o}]`,u,a),c=au(e,t,n,r,i,[l,...c],l,u)}}),c}function cu(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function lu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function uu(){"console"in Us&&Qs.forEach(function(e){e in Us.console&&Ha(Us.console,e,function(t){return Vs[e]=t,function(...t){va("console",{args:t,level:e});const n=Vs[e];n?.apply(Us.console,t)}})})}const du=()=>{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&&(!!mu(e,t)&&!!hu(e,t))))}(e,t)||!!function(e,t){const n=fu(t),r=fu(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!mu(e,t)&&!!hu(e,t)))}(e,t))}(t,e))return Hs&&ia("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function hu(e,t){let n=ma(e),r=ma(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 mu(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 fu(e){return e.exception?.values?.[0]}function pu(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const gu=Us;function yu(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function vu(e,t){const n="fetch";ga(n,e),ya(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in gu))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(yu(gu.fetch))return!0;let e=!1;const t=gu.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=yu(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Hs&&ia("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||Ha(Us,"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:bu(t),method:wu(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:bu(t),method:wu(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*oc(),virtualError:n,headers:xu(t)};return va("fetch",{...o}),e.apply(Us,t).then(async e=>(va("fetch",{...o,endTimestamp:1e3*oc(),response:e}),e),e=>{if(va("fetch",{...o,endTimestamp:1e3*oc(),error:e}),Na(e)&&void 0===e.stack&&(e.stack=n.stack,Ua(e,"framesToPop",1)),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);e.message=`${e.message} (${t.host})`}catch{}throw e})}})}(0,t))}function wu(e,t){return!!e&&"object"==typeof e&&!!e[t]}function bu(e){return"string"==typeof e?e:e?wu(e,"url")?e.url:e.toString?e.toString():"":""}function xu(e){const[t,n]=e;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if("undefined"!=typeof Request&&za(t,Request))return new Headers(t.headers)}catch{}}const ku=Us;let Su=0;function Nu(){return Su>0}function _u(e,t={}){if(!function(e){return"function"==typeof e}(e))return e;try{const t=e.vt;if(t)return"function"==typeof t?t:e;if(Ya(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>_u(e,t));return e.apply(this,r)}catch(e){throw Su++,setTimeout(()=>{Su--}),kc(r=>{r.addEventProcessor(e=>(t.mechanism&&(ec(e,void 0),tc(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),xl(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Za(n,e),Ua(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function $u(e,t){const n=Tu(e,t),r={type:Pu(t),value:Du(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Cu(e,t){return{exception:{values:[$u(e,t)]}}}function Tu(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&Iu.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 Iu=/Minified React error #\d+;/i;function Eu(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function Pu(e){const t=e?.name;return!t&&Eu(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function Du(e){const t=e?.message;return Eu(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function Mu(e,t,n,r,i){let o;if($a(t)&&t.error)return Cu(e,t.error);if(Ca(t)||_a(t,"DOMException")){const i=t;if("stack"in t)o=Cu(e,t);else{const t=i.name||(Ca(i)?"DOMError":"DOMException"),s=i.message?`${t}: ${i.message}`:t;o=zu(e,s,n,r),ec(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Na(t)?Cu(e,t):Pa(t)||Da(t)?(o=function(e,t,n,r){const i=Sc(),o=i?.getOptions().normalizeDepth,s=function(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}(t),a={wt:Xc(t,o)};if(s)return{exception:{values:[$u(e,s)]},extra:a};const c={exception:{values:[{type:Da(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Ru(t,{isUnhandledRejection:r})}]},extra:a};if(n){const t=Tu(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),tc(o,{synthetic:!0}),o):(o=zu(e,t,n,r),ec(o,`${t}`),tc(o,{synthetic:!0}),o)}function zu(e,t,n,r){const i={};if(r&&n){const r=Tu(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),tc(i,{synthetic:!0})}if(Ia(t)){const{ae:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Ru(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(Ga(e));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=t)return La(r,t);for(let e=n.length;e>0;e--){const r=n.slice(0,e).join(", ");if(!(r.length>t))return e===n.length?r:La(r,t)}return""}(e),r=t?"promise rejection":"exception";return $a(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Da(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 Ou extends Bl{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:ku.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(e,t,n=[t],r="npm"){const i=e.et||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:n.map(e=>({name:`${r}:@sentry/${e}`,version:Zs})),version:Zs}),e.et=i}(t,"browser",["browser"],ku.SENTRY_SDK_SOURCE||"npm"),t.et?.sdk&&(t.et.sdk.settings={infer_ip:t.sendDefaultPii?"auto":"never",...t.et.sdk.settings}),super(t);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o}=this.Ge;ku.document&&(i||o)&&ku.document.addEventListener("visibilitychange",()=>{"hidden"===ku.document.visibilityState&&(i&&this.yt(),o&&Hl(this))}),o&&(this.on("flush",()=>{Hl(this)}),this.on("afterCaptureLog",()=>{this.bt&&clearTimeout(this.bt),this.bt=setTimeout(()=>{Hl(this)},5e3)})),r&&this.on("beforeSendSession",Jl)}eventFromException(e,t){return function(e,t,n,r){const i=Mu(e,t,n?.syntheticException||void 0,r);return tc(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),ul(i)}(this.Ge.stackParser,e,t,this.Ge.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=zu(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),ul(o)}(this.Ge.stackParser,e,t,n,this.Ge.attachStacktrace)}ut(e,t,n,r){return e.platform=e.platform||"javascript",super.ut(e,t,n,r)}}const ju="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Au=Us;let Wu,Lu,Bu,Fu;function qu(){if(!Au.document)return;const e=va.bind(null,"dom"),t=Hu(e,!0);Au.document.addEventListener("click",t,!1),Au.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=Au,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ha(r,"addEventListener",function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.xt=this.xt||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=Hu(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),Ha(r,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this.xt||{},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.xt)}catch{}return e.call(this,t,n,r)}}))})}function Hu(e,t=!1){return n=>{if(!n||n.kt)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;Ua(n,"_sentryCaptured",!0),r&&!r.St&&Ua(r,"_sentryId",Va());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==Lu)return!1;try{if(!e.target||e.target.St!==Bu)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),Lu=n.type,Bu=r?r.St:void 0),clearTimeout(Wu),Wu=Au.setTimeout(()=>{Bu=void 0,Lu=void 0},1e3)}}function Uu(e){const t="history";ga(t,e),ya(t,Zu)}function Zu(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Fu,i=function(e){try{return new URL(e,Au.location.origin).toString()}catch{return e}}(String(n));if(Fu=i,r===i)return e.apply(this,t);va("history",{from:r,to:i})}return e.apply(this,t)}}Au.addEventListener("popstate",()=>{const e=Au.location.href,t=Fu;Fu=e,t!==e&&va("history",{from:t,to:e})}),"history"in gu&&gu.history&&(Ha(Au.history,"pushState",e),Ha(Au.history,"replaceState",e))}const Yu={},Gu="__sentry_xhr_v3__";function Ju(){if(!Au.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*oc(),o=Ta(n[0])?n[0].toUpperCase():void 0,s=function(e){if(Ta(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[Gu]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.Nt=!0);const a=()=>{const e=t[Gu];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}va("xhr",{endTimestamp:1e3*oc(),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[Gu];return o&&Ta(r)&&Ta(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[Gu];return r?(void 0!==n[0]&&(r.body=n[0]),va("xhr",{startTimestamp:1e3*oc(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function Qu(e,t=function(e){const t=Yu[e];if(t)return t;let n=Au[e];if(yu(n))return Yu[e]=n.bind(Au);const r=Au.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){ju&&ia(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?Yu[e]=n.bind(Au):n}("fetch")){let n=0,r=0;return Yl(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 Yu.fetch=void 0,e}finally{n-=o,r--}})}function Vu(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 Ku=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Xu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ed=/\((\S*)(?::(\d+))(?::(\d+))\)/,td=/at (.+?) ?\(data:(.+?),/,nd=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,rd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,id=la([30,e=>{const t=e.match(td);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=Ku.exec(e);if(n){const[,e,t,r]=n;return Vu(e,sa,+t,+r)}const r=Xu.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=ed.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=od(r[1]||sa,r[2]);return Vu(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=nd.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=rd.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]=od(n,e),Vu(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),od=(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]},sd="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ad=(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";ga(t,e),ya(t,uu)}(function(e){return function(t){if(Sc()!==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:Ba(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Ba(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Vl(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(Sc()!==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&&(sd&&ia(`\`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=ja(t,{keyAttrs:o,maxStringLength:s}),i=function(e){if(!Oa.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}),Vl(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),ga("dom",n),ya("dom",qu)),t.xhr&&function(e){ga("xhr",e),ya("xhr",Ju)}(function(e){return function(t){if(Sc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Gu];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:c}=i,l={method:o,url:s,status_code:a},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:l,type:"http",level:pu(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),Vl(d,u)}}(e)),t.fetch&&vu(function(e){return function(t){if(Sc()!==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=t.fetchData,o={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:i,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",s,o),Vl(s,o)}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:pu(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),Vl(a,s)}}}(e)),t.history&&Uu(function(e){return function(t){if(Sc()!==e)return;let n=t.from,r=t.to;const i=Gl(ku.location.href);let o=n?Gl(n):void 0;const s=Gl(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),Vl({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){Sc()===e&&Vl({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Xa(t)},{event:t})}}(e))}}},cd=["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"],ld=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Ha(ku,"setTimeout",ud),t.setInterval&&Ha(ku,"setInterval",ud),t.requestAnimationFrame&&Ha(ku,"requestAnimationFrame",dd),t.XMLHttpRequest&&"XMLHttpRequest"in ku&&Ha(XMLHttpRequest.prototype,"send",hd);const e=t.eventTarget;e&&(Array.isArray(e)?e:cd).forEach(e=>function(e,t){const n=ku,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ha(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=_u(i.handleEvent,{mechanism:{data:{handler:ha(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,_u(i,{mechanism:{data:{handler:ha(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),Ha(r,"removeEventListener",function(e){return function(t,n,r){try{const i=n.vt;i&&e.call(this,t,i,r)}catch{}return e.call(this,t,n,r)}}))}(e,t))}}};function ud(e){return function(...t){const n=t[0];return t[0]=_u(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ha(e)}`}}),e.apply(this,t)}}function dd(e){return function(t){return e.apply(this,[_u(t,{mechanism:{data:{handler:ha(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function hd(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&Ha(n,e,function(t){const n={mechanism:{data:{handler:ha(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Ya(t);return r&&(n.mechanism.data.handler=ha(r)),_u(t,n)})}),e.apply(this,t)}}const md=(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";ga(t,t=>{const{stackParser:n,attachStacktrace:r}=pd();if(Sc()!==e||Nu())return;const{msg:i,url:o,line:s,column:a,error:c}=t,l=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||{},c=a.frames=a.frames||[],l=r,u=n,d=function(e){if(Ta(e)&&0!==e.length){if(e.startsWith("data:")){const t=e.match(/^data:([^;]+)/);return`<data:${t?t[1]:"text/javascript"}${e.includes("base64,")?",base64":""}>`}return e.slice(0,1024)}}(t)??Wa();return 0===c.length&&c.push({colno:l,filename:d,function:sa,in_app:!0,lineno:u}),e}(Mu(n,c||i,void 0,r,!1),o,s,a);l.level="error",Sl(l,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),ya(t,ba)}()}(e),fd("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";ga(t,t=>{const{stackParser:n,attachStacktrace:r}=pd();if(Sc()!==e||Nu())return;const i=function(e){if(Ea(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=Ea(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:Mu(n,i,void 0,r,!0);o.level="error",Sl(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),ya(t,ka)}()}(e),fd("onunhandledrejection"))}}};function fd(e){sd&&ra(`Global Handler attached: ${e}`)}function pd(){const e=Sc();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const gd=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){su($u,i.getOptions().stackParser,n,t,e,r)}}};let yd=!1;function vd(e){if(yd)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/];!function(e={}){const t=!e.skipBrowserExtensionCheck&&!!function(){if(void 0===ku.window)return!1;const e=ku;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=Wa();return!(ku===ku.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(e=>n.startsWith(`${e}://`)))}()&&(sd&&Ks(()=>{}),!0),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||id,Array.isArray(r)?la(...r):r),integrations:Il({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[ru(),eu(),ld(),ad(),md(),gd(),du(),{name:"HttpContext",preprocessEvent(e){if(!ku.navigator&&!ku.location&&!ku.document)return;const t=function(){const e=Wa(),{referrer:t}=ku.document||{},{userAgent:n}=ku.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:"BrowserSession",setupOnce(){void 0!==ku.document?(Nl({ignoreDuration:!0}),Cl(),Uu(({from:e,to:t})=>{void 0!==e&&e!==t&&(Nl({ignoreDuration:!0}),Cl())})):sd&&ia("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:e.defaultIntegrations}),transport:e.transport||Qu};var r;!function(e,t){!0===t.debug&&(Hs?na():Ks(()=>{})),bc().update(t.initialScope);const n=new e(t);(function(e){bc().setClient(e)})(n),n.init()}(Ou,n)}({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:[ad({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),du()],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"]}),yd=!0,t()}catch(e){}else t()}function wd(e,n){if(yd)try{n?kc(t=>{Object.entries(n).forEach(([e,n])=>{t.setContext(e,n)}),xl(e)}):xl(e)}catch(e){t()}}function bd(e,n="info",r){if(yd)try{r?kc(t=>{Object.entries(r).forEach(([e,n])=>{t.setContext(e,n)}),kl(e,n)}):kl(e,n)}catch(e){t()}}function xd(e){if(yd)try{!function(e){xc().setUser(e)}(e)}catch(e){t()}}function kd(e){if(yd)try{Vl(e)}catch(e){t()}}function Sd(e,n){if(yd)try{!function(e,t){xc().setTag(e,t)}(e,n)}catch(e){t()}}function Nd(){return yd}var _d=Object.freeze({__proto__:null,addBreadcrumb:kd,captureException:wd,captureMessage:bd,initializeSentry:vd,isSentryInitialized:Nd,setTag:Sd,setUser:xd});const $d="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",Cd="production",Td="insureos-scripts",Id=!0,Ed=1,Pd=.1;class Dd{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 Md{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{vd({dsn:$d,environment:Cd,release:Td,enabled:Id,sampleRate:Ed,tracesSampleRate:Pd}),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 Dd({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}),ke(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=[],R(t,e=t.i=x(S,null,[e]),i||p,p,t.namespaceURI,i?null:t.firstChild?n.call(t.childNodes):null,o,i?i.v:t.firstChild,!1,s),j(o,e,s)}(x(qs,{config:t,initializeFormContext:this.initializeFormContext.bind(this)}),e)}createHttpClient(e){var t,n,r,i,o,s,a,c,l,u;if(!e.orgId)throw new Error("orgId is required");const d=e.apiBaseUrl||"https://api.os.insure";return new U({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===(l=null===(c=e.httpConfig)||void 0===c?void 0:c.retryConfig)||void 0===l?void 0:l.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 ze(t)}async initializeFormContext(e){const n=this.createHttpClient(e),r=new URLSearchParams(window.location.search).get("pl_ref");if(r)return t(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:r,signedUrl:void 0}};if("payment"===e.mode)return t(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:e.paymentLinkId,signedUrl:e.signedUrl}};const i="sessionStorage"===e.storageType?new Y:new Z;i.isAvailable()?t(i.constructor.name):t();const o=new J(i),s=new Q(o),a=e.products,c=null==a?void 0:a.includes("*"),l=!a||0===a.length,u=l||c||a&&a.length>1,d=a&&1===a.length&&!c,h=localStorage.getItem("insure-os-selected-product");if(u&&!e.quoteIntentUrl&&!h){t();const e=await n.fetchAvailableProducts(l?void 0:a);if(t(),e.organisation&&e.organisation.theme)try{const n=await Promise.resolve().then(function(){return Rs}).then(e=>e.ThemeLoader);await n.loadTheme({slug:e.organisation.slug,theme_url:e.organisation.theme.css_url}),t()}catch(e){t()}return{httpClient:n,stateManager:o,quoteIntent:null,quoteIntentStore:s,formStateManager:null,availableProducts:e.products,productCodes:a}}let m;h?(t(),m=h,localStorage.removeItem("insure-os-selected-product")):d&&(m=a[0]);const f=async()=>{t();const r=e.quoteIntentUrl?await n.getQuoteIntent(e.quoteIntentUrl):await n.createQuoteIntent({code:m});return t(),{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,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}},p=async t=>{var r;const i=new URLSearchParams(window.location.search),s=i.get("transaction_id")||i.get("payment_id")||i.get("transactionId"),a=await n.getQuoteIntent(t);let c;const l=i.get("status");if(s){const e=null===(r=a.payment_transactions)||void 0===r?void 0:r.find(e=>e.id===s);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"}c={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"}c={paymentTransactionId:s,paymentStatus:e,transactionStatus:void 0}}}const u={id:a.quote_intent.id,url:a.url,calculate_url:a.calculate_url,delete_calculations_url:a.delete_calculations_url,expires_at:new Date(a.quote_intent.expires_at).getTime(),updated_at:new Date(a.quote_intent.updated_at).getTime(),created_at:new Date(a.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:a.product.id,form_definition:a.product.form_definition,form_data:a.quote_intent.form_data,status:a.quote_intent.status,reference:a.quote_intent.reference,organisation:a.organisation,payment_return:c,payment_transactions:a.payment_transactions,cached_result:a.cached_result};return c&&o.saveQuoteIntent(e.orgId,u),u},g=new URLSearchParams(window.location.search);if(g.get("transactionId")||g.get("transaction_id")||g.get("payment_id"),g.get("status"),"1"===g.get("clear")){t(),localStorage.clear(),g.delete("clear");const e=g.toString()?`${window.location.pathname}?${g.toString()}`:window.location.pathname;window.history.replaceState({},"",e),t()}let y=null,v=!1;try{const t=o.getQuoteIntent(e.orgId),n=await s.getOrCreateQuoteIntent(e.orgId,f,p);n.payment_return&&o.saveQuoteIntent(e.orgId,n),y=n,v=!t}catch(t){if(!(t instanceof q&&404===t.statusCode))throw t;s.clearQuoteIntent(e.orgId),y=await s.getOrCreateQuoteIntent(e.orgId,f,p),v=!0}if(v&&y&&Ne(y),!y)throw new Error("Failed to initialize quote intent state");t(),t(y.payment_return),y.payment_return&&t(y.payment_return);const w=new De(y,n,s,{autoSave:!1,autoSaveInterval:y.form_definition.settings.autoSaveInterval});if(y.form_data&&w.restoreFormProgress(y.form_data),t(y.cached_result),y.cached_result?(t(y.cached_result),w.restoreCalculationResult(y.cached_result),t(),t(w.hasCalculationResponse())):t(),y.organisation&&y.organisation.theme)try{await zs.loadTheme({slug:y.organisation.slug,theme_url:y.organisation.theme.css_url})}catch(e){t()}return await this.handleAutoCalculationIfComplete(w),{httpClient:n,stateManager:o,quoteIntent:y,quoteIntentStore:s,formStateManager:w}}async handleAutoCalculationIfComplete(e){try{const n=e.getQuoteIntent();if("paid"===n.status||"completed"===n.status)return void t();if(e.hasCalculationResponse())return void t();if(e.hasLastCalculationFailed())return void t();const r=e.getPageCompletionStatus(),{totalPages:i,completedPages:o}=r,s=o.length===i;t((o.length,e.getIsCalculating(),e.hasLastCalculationFailed())),s&&!e.getIsCalculating()&&(t(),await e.calculateQuote(),t())}catch(e){t()}}}const zd=new Md;"undefined"!=typeof window&&(window.InsureOS=zd,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 zd.mount(r,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class Rd{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,Rd.instance)return Rd.instance;Rd.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 Rd).startMeasurement(e)}static endMeasurement(e){return(new Rd).endMeasurement(e)}static measureMemoryUsage(){return(new Rd).measureMemoryUsage()}static async measureApiCall(e,t){return(new Rd).measureApiCall(e,t)}static getMetrics(){return(new Rd).getMetrics()}static generateReport(){return(new Rd).generateReport()}}let Od=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)}},jd=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new Od(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 Od(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)}},Ad=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new Od(t.headers),this.ok=this.status>=200&&this.status<300,this._t=e}async text(){return this._t}async json(){return JSON.parse(this._t)}};var Wd=Object.freeze({__proto__:null,Headers:Od,Request:jd,Response:Ad,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new jd(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 Od;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new Ad(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 Ld{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 Ld((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof Ld?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof Ld?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 Ld(t=>t(e))}static reject(e){return new Ld((t,n)=>n(e))}static all(e){return new Ld((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 Bd=Object.freeze({__proto__:null,PromisePolyfill:Ld});class Fd{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 qd=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 Fd(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:Fd});e.DataLayerManager=Dd,e.EnhancedHttpClient=U,e.ErrorHandlingStrategy=class{handleNetworkError(t){return new q(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(t){if(503===t.status)return new q(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 q(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,t.status):t.status>=400&&t.status<500?new q(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status):t.status>=500?new q(e.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,t.status):new q(e.ErrorType.API_ERROR,`Request failed: ${t.statusText}`,n,t.status)}handleStorageError(t){return new q(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=De,e.InsureOS=zd,e.InsureOSClient=Md,e.InsureOSError=q,e.LocalStateManager=J,e.LocalStorageAdapter=Z,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=Rd,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 Wd});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 Bd});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 qd});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}},e.RetryStrategy=H,e.SessionStorageAdapter=Y,e.ThemeLoader=zs,e.addBreadcrumb=kd,e.captureException=wd,e.captureMessage=bd,e.createAppError=he,e.getAnalytics=function(){return xe},e.getSupportMessage=be,e.groupErrorsByField=function(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})},e.initializeAnalytics=ke,e.initializeSentry=vd,e.isSentryInitialized=Nd,e.parseServerValidationErrors=ce,e.setTag=Sd,e.setUser=xd,e.shouldShowErrorPage=function(e){return"initialization"===e.type&&"critical"===e.severity},e.shouldShowMaintenancePage=we,e.trackFormProgress=_e,e.trackPaymentCompleted=Ee,e.trackPaymentFailed=Pe,e.trackPaymentInitiated=Ie,e.trackQuoteAtCheckout=Ce,e.trackQuoteCalculated=$e,e.trackQuoteReferred=Te,e.trackQuoteStarted=Ne,e.validateField=se,e.validatePage=ae});
2
2
  //# sourceMappingURL=index.umd.js.map