@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/bundle-sizes.json +11 -11
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=()=>{globalThis.insureOSDebug};var t,n,r,i,o,s,a,c,l,u,d,h,m,f={},p=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function w(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(e,n,r){var i,o,s,a={};for(s in n)"key"==s?i=n[s]:"ref"==s?o=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?t.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 x(e,a,i,o,null)}function x(e,t,i,o,s){var a={type:e,props:t,key:i,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:null==s?++r:s,_:-1,C:0};return null==s&&null!=n.vnode&&n.vnode(a),a}function k(e){return e.children}function S(e,t){this.props=e,this.context=t}function N(e,t){if(null==t)return e.m?N(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?N(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 $(e){(!e.I&&(e.I=!0)&&i.push(e)&&!C.P++||o!=n.debounceRendering)&&((o=n.debounceRendering)||s)(C)}function C(){for(var e,t,r,o,s,c,l,u=1;i.length;)i.length>u&&i.sort(a),e=i.shift(),u=i.length,e.I&&(r=void 0,s=(o=(t=e).N).v,c=[],l=[],t.R&&((r=v({},o)).N=o.N+1,n.vnode&&n.vnode(r),z(t.R,r,o,t.O,t.R.namespaceURI,32&o.C?[s]:null,c,null==s?N(o):s,!!(32&o.C),l),r.N=o.N,r.m.i[r._]=r,O(c,r,l),r.v!=s&&_(r)));C.P=0}function T(e,t,n,r,i,o,s,a,c,l,u){var d,h,m,g,v,w,b,S=r&&r.i||p,_=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?x(null,s,null,null,null):y(s)?x(k,{children:s},null,null,null):null==s.constructor&&s.p>0?x(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._=E(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=N(a)),L(a,a));return r}(n,t,S,c,_),d=0;d<_;d++)null!=(m=n.i[d])&&(h=-1==m._?f:S[m._]||f,m._=d,w=z(e,m,h,i,o,s,a,c,l,u),g=m.v,m.ref&&h.ref!=m.ref&&(h.ref&&W(h.ref,null,m),u.push(m.ref,m.k||g,m)),null==v&&null!=g&&(v=g),(b=!!(4&m.C))||h.i===m.i?c=I(m,c,e,b):"function"==typeof m.type&&void 0!==w?c=w:g&&(c=g.nextSibling),m.C&=-7);return n.v=v,c}function I(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=I(i[o],t,n,r));return t}e.v!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=N(e)),n.insertBefore(e.v,t||null)),t=e.v);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function E(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 P(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||g.test(t)?n:n+"px"}function D(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||P(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||P(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(c,"$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=l,e.addEventListener(t,o?d:u,o)):e.removeEventListener(t,o?d:u,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 M(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t.t)t.t=l++;else if(t.t<r.u)return;return r(n.event?n.event(t):t)}}}function z(e,t,r,i,o,s,a,c,l,u){var d,h,m,f,p,g,b,x,N,_,$,C,I,E,P,D,M,z=t.type;if(null!=t.constructor)return null;128&r.C&&(l=!!(32&r.C),s=[c=t.v=r.v]),(d=n.p)&&d(t);e:if("function"==typeof z)try{if(x=t.props,N="prototype"in z&&z.prototype.render,_=(d=z.contextType)&&i[d.k],$=d?_?_.props.value:d.m:i,r.k?b=(h=t.k=r.k).m=h.j:(N?t.k=h=new z(x,$):(t.k=h=new S(x,$),h.constructor=z,h.render=B),_&&_.sub(h),h.props=x,h.state||(h.state={}),h.context=$,h.O=i,m=h.I=!0,h.A=[],h.W=[]),N&&null==h.L&&(h.L=h.state),N&&null!=z.getDerivedStateFromProps&&(h.L==h.state&&(h.L=v({},h.L)),v(h.L,z.getDerivedStateFromProps(x,h.L))),f=h.props,p=h.state,h.N=t,m)N&&null==z.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),N&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(N&&null==z.getDerivedStateFromProps&&x!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,$),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.L,$)||t.N==r.N){for(t.N!=r.N&&(h.props=x,h.state=h.L,h.I=!1),t.v=r.v,t.i=r.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,$),N&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(f,p,g)})}if(h.context=$,h.props=x,h.R=e,h.v=!1,I=n.P,E=0,N){for(h.state=h.L,h.I=!1,I&&I(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,I&&I(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=v(v({},i),h.getChildContext())),N&&!m&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(f,p)),D=d,null!=d&&d.type===k&&null==d.key&&(D=j(d.props.children)),c=T(e,y(D)?D:[D],t,r,i,o,s,a,c,l,u),h.base=t.v,t.C&=-161,h.A.length&&a.push(h),b&&(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--;)w(s[M]);R(t)}else t.v=r.v,t.i=r.i,e.then||R(t);n.v(e,t,r)}else null==s&&t.N==r.N?(t.i=r.i,t.v=r.v):c=t.v=A(r.v,t,r,i,o,s,a,l,u);return(d=n.diffed)&&d(t),128&t.C?void 0:c}function R(e){e&&e.k&&(e.k.v=!0),e&&e.i&&e.i.forEach(R)}function O(e,t,r){for(var i=0;i<r.length;i++)W(r[i],r[++i],r[++i]);n.k&&n.k(t,e),e.some(function(t){try{e=t.A,t.A=[],e.some(function(e){e.call(t)})}catch(e){n.v(e,t.N)}})}function j(e){return"object"!=typeof e||null==e||e.p&&e.p>0?e:y(e)?e.map(j):v({},e)}function A(e,r,i,o,s,a,c,l,u){var d,h,m,p,g,v,b,x=i.props,k=r.props,S=r.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&&(n.B&&n.B(r,a),l=!1),a=null}if(null==S)x===k||l&&e.data==k||(e.data=k);else{if(a=a&&t.call(e.childNodes),x=i.props||f,!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;D(e,d,null,g,s)}for(d in k)g=k[d],"children"==d?p=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?v=g:"checked"==d?b=g:l&&"function"!=typeof g||x[d]===g||D(e,d,g,x[d],s);if(h)l||m&&(h.H==m.H||h.H==e.innerHTML)||(e.innerHTML=h.H),r.i=[];else if(m&&(e.innerHTML=""),T("template"==r.type?e.content:e,y(p)?p:[p],r,i,o,"foreignObject"==S?"http://www.w3.org/1999/xhtml":s,a,c,a?a[0]:i.i&&N(i,0),l,u),null!=a)for(d=a.length;d--;)w(a[d]);l||(d="value","progress"==S&&null==v?e.removeAttribute("value"):null!=v&&(v!==e[d]||"progress"==S&&!v||"option"==S&&v!=x[d])&&D(e,d,v,x[d],s),d="checked",null!=b&&b!=e[d]&&D(e,d,b,x[d],s))}return e}function W(e,t,r){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){n.v(e,r)}}function L(e,t,r){var i,o;if(n.unmount&&n.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||W(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.v(e,t)}i.base=i.R=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&L(i[o],t,r||"function"!=typeof e.type);r||w(e.v),e.k=e.m=e.v=void 0}function B(e,t,n){return this.constructor(e,n)}t=p.slice,n={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}},r=0,S.prototype.setState=function(e,t){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=v({},this.state),"function"==typeof e&&(e=e(v({},n),this.props)),e&&v(n,e),null!=e&&this.N&&(t&&this.W.push(t),$(this))},S.prototype.forceUpdate=function(e){this.N&&(this.v=!0,e&&this.A.push(e),$(this))},S.prototype.render=k,i=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(e,t){return e.N.p-t.N.p},C.P=0,c=/(PointerCapture)$|Capture$/i,l=0,u=M(!1),d=M(!0),h=0,function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.API_ERROR="API_ERROR",e.VALIDATION_ERROR="VALIDATION_ERROR",e.STORAGE_ERROR="STORAGE_ERROR",e.TIMEOUT_ERROR="TIMEOUT_ERROR",e.MAINTENANCE_ERROR="MAINTENANCE_ERROR"}(m||(m={}));class F 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 q{handleNetworkError(e){return new F(m.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(e){if(503===e.status)return new F(m.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,e.status);const t=e.status>=500||429===e.status;return 429===e.status?new F(m.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,e.status):e.status>=400&&e.status<500?new F(m.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,e.status):e.status>=500?new F(m.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,e.status):new F(m.API_ERROR,`Request failed: ${e.statusText}`,t,e.status)}handleStorageError(e){return new F(m.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(e){return e.retryable}getUserFriendlyMessage(e){switch(e.type){case m.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case m.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case m.API_ERROR:return 429===e.statusCode?"Too many requests. Please wait a moment and try again.":e.statusCode&&e.statusCode>=400&&e.statusCode<500?"Invalid request. Please refresh the page and try again.":e.statusCode&&e.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case m.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case m.TIMEOUT_ERROR:return"Request timed out. Please try again.";case m.VALIDATION_ERROR:return e.validationErrors&&Object.keys(e.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."}}}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 F?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:e,method:t,body:n,skipOrgHeader:r=!1}){return this.executeWithRetry(async()=>{const i=new AbortController,o=setTimeout(()=>i.abort(),this.config.timeout);try{const s={"Content-Type":"application/json"},a=e.includes("signed=");r||a||(s["X-Organisation-ID"]=this.config.orgId);const c={method:t,headers:s,signal:i.signal};n&&(c.body=JSON.stringify(n));const l=await fetch(e,c);if(clearTimeout(o),!l.ok)throw await this.handleApiError(l);const u=await l.json();return u.data||u}catch(e){if(clearTimeout(o),e instanceof F)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new F(m.TIMEOUT_ERROR,"Request timed out",!0);if(e instanceof TypeError&&e.message.includes("fetch"))throw new F(m.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw e}})}getQuoteIntent(e){return this.makeRequest({url:e,method:"GET"})}async fetchAvailableProducts(t){var n;const r=null==t?void 0:t.includes("*"),i=!t||0===t.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)e(),l=a;else if(t&&t.length>0)l=a.filter(e=>t.includes(e.code));else if(i&&(null==c?void 0:c.products)&&c.products.length>0){const t=c.products.map(e=>e.code);l=t.map(e=>a.find(t=>t.code===e)).filter(e=>void 0!==e),e((a.length,l.length))}else i&&(e(),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(t){let n;for(let r=0;r<=this.config.retryConfig.maxRetries;r++)try{return e(this.config.retryConfig.maxRetries),await t()}catch(t){n=t;const i=this.retryStrategy.shouldRetry(n,r);if(e(t instanceof F&&(t.type,t.message)),e(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw e(),n;const o=t instanceof F?t.retryAfter:void 0,s=this.retryStrategy.getDelay(r,o);e(),await new Promise(e=>setTimeout(e,s))}throw n}async handleApiError(t){var n;const r=t.headers.get("retry-after"),i=await t.json().catch(()=>({}));if(e(),this.captureApiErrorToSentry(t,i),503===t.status)return new F(m.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);if(429===t.status)return new F(m.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,t.status,r||void 0);if(t.status>=500){const e=i.message||"Service temporarily unavailable. Please try again in a moment.";return new F(m.API_ERROR,e,!1,t.status)}if(422===t.status)try{const e=i;return e.error&&e.error.details&&e.error.details.form_data?new F(m.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,t.status,void 0,e.error.details):new F(m.VALIDATION_ERROR,e.message||"Validation failed. Please check your inputs.",!1,t.status,void 0,null===(n=e.error)||void 0===n?void 0:n.details)}catch(e){return new F(m.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,t.status)}if(400===t.status)try{const e=i;return e.errors?new F(m.VALIDATION_ERROR,e.message||"Form validation failed. Please check your inputs.",!1,t.status,void 0,e.errors):new F(m.API_ERROR,e.message||"Invalid request. Please check your input and try again.",!1,t.status)}catch(e){return new F(m.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status)}if(t.status>=400&&t.status<500){const e=i.message||"Invalid request. Please refresh the page and try again.";return new F(m.API_ERROR,e,!1,t.status)}return new F(m.API_ERROR,`Request failed: ${t.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(t.status),t.status)}captureApiErrorToSentry(e,t){try{(e.status>=500||429===e.status)&&Promise.resolve().then(function(){return Td}).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{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}}class J{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}}J.KEY_PREFIX="insure_os_",J.SEPARATOR="_";class Q{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||Q.DEFAULT_EXPIRATION_MS,namespace:t.namespace||Q.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{t.payment_transactions&&t.payment_transactions.length;const n=this.generateStorageKey(e),r=J.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=J.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 J.generateKey(this.config.namespace,e)}}Q.DEFAULT_EXPIRATION_MS=864e5,Q.DEFAULT_NAMESPACE="quote_intent";class V{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 K{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 X(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 ee(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 te(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 ne(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 re{static create(e){switch(e){case"string":case"text":case"select":return X;case"numeric":return ee;case"boolean":return te;case"date":return ne;default:throw new Error(`Unsupported condition type: ${e}`)}}}function ie(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:oe(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 oe(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=re.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var se=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:re,booleanMatchesCondition:te,checkSimpleConditions:ie,dateMatchesCondition:ne,numericMatchesCondition:ee,textMatchesCondition:X});function ae(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 ce(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=ie(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=ae(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=ie(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 le(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}function ue(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})}class de{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:le(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 he{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 me{constructor(e){this.httpClient=e}async calculateQuote(t){const n=await this.httpClient.calculateQuoteIntent(t);return e(),n}}function fe(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 Td}).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 pe(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 pe(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:ye(e),title:ge(e),message:n||we(e),details:t.message,retryable:be(e,0),timestamp:a,trackingId:c}}const l="string"==typeof t?t:"An unexpected error occurred";return{id:c,type:e,severity:ye(e),title:ge(e),message:n||l,retryable:be(e,0),timestamp:a,trackingId:c}}function pe(e,t,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=be(t,n);return{id:e,type:t,severity:s,statusCode:n,title:ge(t,n),message:i||ve(t,n,r),details:r,retryable:a,timestamp:o}}function ge(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 ye(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ve(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 we(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 be(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 xe(e){return"initialization"===e.type&&"critical"===e.severity}function ke(e){return"maintenance"===e.type||503===e.statusCode}function Se(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 Ne=null;function _e(e){Ne=e}function $e(){return Ne}function Ce(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 Te(e){var t,n;if(!(null==Ne?void 0:Ne.isEnabled()))return;const r={...Ce(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};Ne.push(r)}function Ie(e,t,n,r){var i,o;if(!(null==Ne?void 0:Ne.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={...Ce(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};Ne.push(c)}function Ee(e,t){if(!(null==Ne?void 0:Ne.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={...Ce(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};Ne.push(l)}function Pe(e,t,n,r,i){if(!(null==Ne?void 0:Ne.isEnabled()))return;const o={...Ce(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};Ne.push(o)}function De(e,t){if(!(null==Ne?void 0:Ne.isEnabled()))return;const n=t.referrals||[],r={...Ce(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};Ne.push(r)}function Me(e,t,n,r){if(!(null==Ne?void 0:Ne.isEnabled()))return;const i={...Ce(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};Ne.push(i)}function ze(e,t,n,r,i,o){if(!(null==Ne?void 0:Ne.isEnabled()))return;const s={...Ce(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};Ne.push(s)}function Re(e,t,n,r,i,o){if(!(null==Ne?void 0:Ne.isEnabled()))return;const s={...Ce(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};Ne.push(s)}class Oe{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 de(t,i,n),this.autoSaveManager=new K(this.config,this.saveFormData.bind(this)),this.navigationManager=new he(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new me(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(t,n,r,i){if(this.autoSaveManager.startTyping(),this.formData.page_data[t]||(this.formData.page_data[t]={}),this.formData.page_data[t].U||(this.formData.page_data[t].U={}),this.formData.page_data[t].U[n]=r,i){const n=this.getRatingFactorCodeById(i);n&&(this.formData.page_data[t][n]=r,e())}this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(t){var n;if(this.isUserTyping())return;const r=t.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),e(t.current_page),this.formData={...t,current_page:o},this.notify()}restoreCalculationResult(t){e(),e(t.outcome_type),this.calculationResult=t,t.default_excess_id&&(this.selectedExcessId=t.default_excess_id),e(),this.notify(),e()}getRatingFactorCodeById(t){const n=this.getFormDefinition();for(const e of n.pages)for(const n of e.fields){if(n.rating_factor_id===t)return n.code||n.id;if(n.rating_factor_mappings)for(const e of n.rating_factor_mappings)if(e.rating_factor_id===t)return e.rating_factor_code||n.code||n.id}return e(),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(t,n,r){return e(JSON.stringify(r)),"calculate_age"===n?this.calculateAge(t,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(t=!1,n="auto-save"){if(!t&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);e();const o={...this.formData,page_data:{...this.formData.page_data,J:i}};try{const e=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:t,saveType:n});if(!e.success){if(e.validationErrors){this.setServerValidationErrors(e.validationErrors),this.notify();const t=new Error("Validation failed");throw t.isValidationError=!0,t}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=fe("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;Ie(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=ce(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=ae(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 se}),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(){e();const t=this.getFormDefinition(),n=[],r=this.getAllFormDataFlattened();for(const i of t.pages){const t=ce(i,r);e(i.title,t.errors.length>0&&t.errors),n.push(...t.errors)}if(n.length>0)throw e(),this.validationErrors=n,this.notify(),new Error("Form validation failed");e(),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?Ee(this.quoteIntent,e):"referral"===e.outcome_type&&De(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(){e();try{await this.httpClient.deleteCalculations(this.quoteIntent.delete_calculations_url),this.calculationResult=void 0,this.selectedExcessId=null,this.selectedPaymentOption=null,this.notify(),e()}catch(t){throw e(),t}}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(t){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(e=>e.id===t.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");e();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(e=>e.gateway_id===t.gatewayId&&e.calculation_id===t.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(e=>e.id===t.calculationId);try{const e=await this.httpClient.initiatePayment(t,o);return s&&Me(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),e}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 je{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 Ae{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new je(this.httpClient,n)}}var We=0;function Le(e,t,r,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:r,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:--We,_:-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 n.vnode&&n.vnode(u),u}var Be,Fe,qe,He,Ue=0,Ze=[],Ye=n,Ge=Ye.p,Je=Ye.P,Qe=Ye.diffed,Ve=Ye.k,Ke=Ye.unmount,Xe=Ye.m;function et(e,t){Ye.A&&Ye.A(Fe,e,Ue||t),Ue=0;var n=Fe.X||(Fe.X={m:[],A:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function tt(e){return Ue=1,function(e,t){var n=et(Be++,2);if(n.t=e,!n.k&&(n.m=[dt(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=Fe,!Fe.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};Fe.te=!0;var i=Fe.shouldComponentUpdate,o=Fe.componentWillUpdate;Fe.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)},Fe.shouldComponentUpdate=r}return n.ee||n.m}(dt,e)}function nt(e,t){var n=et(Be++,3);!Ye.L&&ut(n.X,t)&&(n.m=e,n.u=t,Fe.X.A.push(n))}function rt(e){return Ue=5,it(function(){return{current:e}},[])}function it(e,t){var n=et(Be++,7);return ut(n.X,t)&&(n.m=e(),n.X=t,n.A=e),n.m}function ot(){for(var e;e=Ze.shift();)if(e.R&&e.X)try{e.X.A.forEach(ct),e.X.A.forEach(lt),e.X.A=[]}catch(t){e.X.A=[],Ye.v(t,e.N)}}Ye.p=function(e){Fe=null,Ge&&Ge(e)},Ye.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),Xe&&Xe(e,t)},Ye.P=function(e){Je&&Je(e),Be=0;var t=(Fe=e.k).X;t&&(qe===Fe?(t.A=[],Fe.A=[],t.m.forEach(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.A.forEach(ct),t.A.forEach(lt),t.A=[],Be=0)),qe=Fe},Ye.diffed=function(e){Qe&&Qe(e);var t=e.k;t&&t.X&&(t.X.A.length&&(1!==Ze.push(t)&&He===Ye.requestAnimationFrame||((He=Ye.requestAnimationFrame)||at)(ot)),t.X.m.forEach(function(e){e.u&&(e.X=e.u),e.u=void 0})),qe=Fe=null},Ye.k=function(e,t){t.some(function(e){try{e.A.forEach(ct),e.A=e.A.filter(function(e){return!e.m||lt(e)})}catch(n){t.some(function(e){e.A&&(e.A=[])}),t=[],Ye.v(n,e.N)}}),Ve&&Ve(e,t)},Ye.unmount=function(e){Ke&&Ke(e);var t,n=e.k;n&&n.X&&(n.X.m.forEach(function(e){try{ct(e)}catch(e){t=e}}),n.X=void 0,t&&Ye.v(t,n.N))};var st="function"==typeof requestAnimationFrame;function at(e){var t,n=function(){clearTimeout(r),st&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);st&&(t=requestAnimationFrame(n))}function ct(e){var t=Fe,n=e.k;"function"==typeof n&&(e.k=void 0,n()),Fe=t}function lt(e){var t=Fe;e.k=e.m(),Fe=t}function ut(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function dt(e,t){return"function"==typeof t?t(e):t}const ht="insure-os";let mt=!1;const ft=new Map,pt={[`--${ht}-radius`]:"0.75rem",[`--${ht}-radius-sm`]:"0.5rem",[`--${ht}-radius-lg`]:"1rem",[`--${ht}-background`]:"oklch(0.955 0 0)",[`--${ht}-foreground`]:"oklch(0.145 0 0)",[`--${ht}-card`]:"oklch(1 0 0)",[`--${ht}-card-foreground`]:"oklch(0.145 0 0)",[`--${ht}-popover`]:"oklch(1 0 0)",[`--${ht}-popover-foreground`]:"oklch(0.145 0 0)",[`--${ht}-primary`]:"oklch(0.205 0 0)",[`--${ht}-primary-foreground`]:"oklch(0.985 0 0)",[`--${ht}-secondary`]:"oklch(0.97 0 0)",[`--${ht}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${ht}-muted`]:"oklch(0.97 0 0)",[`--${ht}-muted-foreground`]:"oklch(0.556 0 0)",[`--${ht}-accent`]:"oklch(0.97 0 0)",[`--${ht}-accent-foreground`]:"oklch(0.205 0 0)",[`--${ht}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${ht}-border`]:"oklch(0.9 0 0)",[`--${ht}-input`]:"oklch(0.9 0 0)",[`--${ht}-ring`]:"oklch(0.708 0 0)",[`--${ht}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${ht}-font-size-large`]:"18px",[`--${ht}-font-size-small`]:"14px",[`--${ht}-font-size`]:"16px",[`--${ht}-border-width`]:"1px",[`--${ht}-transition-duration`]:"200ms",[`--${ht}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${ht}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${ht}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${ht}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${ht}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${ht}-spacing-sm`]:"0.75rem",[`--${ht}-spacing`]:"1rem",[`--${ht}-spacing-md`]:"1.5rem",[`--${ht}-spacing-lg`]:"2rem",[`--${ht}-spacing-xl`]:"3rem"},gt={colors:{background:`var(--${ht}-background)`,foreground:`var(--${ht}-foreground)`,card:`var(--${ht}-card)`,popover:`var(--${ht}-popover)`,popoverForeground:`var(--${ht}-popover-foreground)`,primary:`var(--${ht}-primary)`,primaryForeground:`var(--${ht}-primary-foreground)`,secondary:`var(--${ht}-secondary)`,muted:`var(--${ht}-muted)`,mutedForeground:`var(--${ht}-muted-foreground)`,accent:`var(--${ht}-accent)`,accentForeground:`var(--${ht}-accent-foreground)`,destructive:`var(--${ht}-destructive)`,border:`var(--${ht}-border)`,input:`var(--${ht}-input)`},fontSize:{small:`var(--${ht}-font-size-small)`,default:`var(--${ht}-font-size)`,large:`var(--${ht}-font-size-large)`},radius:{small:`var(--${ht}-radius-sm)`,default:`var(--${ht}-radius)`,large:`var(--${ht}-radius-lg)`},shadow:{sm:`var(--${ht}-shadow-sm)`,md:`var(--${ht}-shadow-md)`},spacing:{sm:`var(--${ht}-spacing-sm)`,default:`var(--${ht}-spacing)`,md:`var(--${ht}-spacing-md)`,lg:`var(--${ht}-spacing-lg)`,xl:`var(--${ht}-spacing-xl)`},fontFamily:`var(--${ht}-font-family)`,borderWidth:`var(--${ht}-border-width)`,transition:`var(--${ht}-transition-duration) var(--${ht}-transition-timing-function)`},yt=new Set;function vt(e){if(!document.getElementById(`${ht}-styles`)){const e=document.createElement("style");e.id=`${ht}-styles`,document.head.appendChild(e)}document.getElementById(`${ht}-styles`).textContent+=e+"\n"}function wt(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 bt(){mt||(vt(`:root {\n${Object.entries(pt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),mt=!0)}const xt={name:e=>`${ht}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){bt();const r=wt(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=ft.get(o);if(s)return s.fullClassName;let a=e;const c=this.name(a);return yt.has(a)||(vt(`.${c} { ${r} }`),yt.add(a)),ft.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),c},keyframes(e,t){const n=`${ht}-${e}`;return yt.has(`keyframes-${e}`)||(vt(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${wt(t)} }`).join("\n")}\n}`),yt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;vt(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${ht}-${e} { ${wt(t)} }`).join("\n")}\n}`),yt.add(n)},pseudoElement(e,t,n){const r=`${ht}-${e}`,i=`${e}-${t}`;return yt.has(i)||(vt(`.${r}${t} { ${wt(n)} }`),yt.add(i)),r}};var kt=Object.freeze({__proto__:null,baseVariables:pt,styles:xt,theme:gt,updateBaseVariables:function(t){e(),Object.assign(pt,t);const n=document.getElementById(`${ht}-styles`);if(n){const t=n.textContent||"",r=`:root {\n${Object.entries(pt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,i=t.includes(":root {")?t.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+t;n.textContent=i,e()}else bt()}});function St(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var Nt,_t={exports:{}};function $t(){return Nt||(Nt=1,e=_t,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}()),_t.exports;var e}var Ct=St($t());function Tt({size:e="small"}){const t=xt.create("spinner-small",{width:"16px",height:"16px"}),n=xt.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return xt.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Le("div",{className:xt.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Le("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:Ct(r),children:Le("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function It({className:e,children:t,size:n="md"}){const r={sm:gt.spacing.sm,md:gt.spacing.md,lg:gt.spacing.lg,xl:gt.spacing.xl},i=xt.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?gt.spacing.lg:"lg"===n?gt.spacing.md:r[n]},"(max-width: 480px)":{padding:gt.spacing.sm}});return Le("div",{className:Ct(i,e),children:t})}const Et=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,$(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"+h++,e.m=null,e.Provider=e.re=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}();function Pt({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a}){return Le(Et.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function Dt(){const e=function(e){var t=Fe.context[e.k],n=et(Be++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(Fe)),t.props.value):e.m}(Et);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function Mt(e){const t=Dt(),{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]=tt(()=>e(n));return nt(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class zt extends Error{}class Rt extends zt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Ot extends zt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class jt extends zt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class At extends zt{}class Wt extends zt{constructor(e){super(`Invalid unit ${e}`)}}class Lt extends zt{}class Bt extends zt{constructor(){super("Zone is an abstract class")}}const Ft="numeric",qt="short",Ht="long",Ut={year:Ft,month:Ft,day:Ft},Zt={year:Ft,month:qt,day:Ft},Yt={year:Ft,month:qt,day:Ft,weekday:qt},Gt={year:Ft,month:Ht,day:Ft},Jt={year:Ft,month:Ht,day:Ft,weekday:Ht},Qt={hour:Ft,minute:Ft},Vt={hour:Ft,minute:Ft,second:Ft},Kt={hour:Ft,minute:Ft,second:Ft,timeZoneName:qt},Xt={hour:Ft,minute:Ft,second:Ft,timeZoneName:Ht},en={hour:Ft,minute:Ft,hourCycle:"h23"},tn={hour:Ft,minute:Ft,second:Ft,hourCycle:"h23"},nn={hour:Ft,minute:Ft,second:Ft,hourCycle:"h23",timeZoneName:qt},rn={hour:Ft,minute:Ft,second:Ft,hourCycle:"h23",timeZoneName:Ht},on={year:Ft,month:Ft,day:Ft,hour:Ft,minute:Ft},sn={year:Ft,month:Ft,day:Ft,hour:Ft,minute:Ft,second:Ft},an={year:Ft,month:qt,day:Ft,hour:Ft,minute:Ft},cn={year:Ft,month:qt,day:Ft,hour:Ft,minute:Ft,second:Ft},ln={year:Ft,month:qt,day:Ft,weekday:qt,hour:Ft,minute:Ft},un={year:Ft,month:Ht,day:Ft,hour:Ft,minute:Ft,timeZoneName:qt},dn={year:Ft,month:Ht,day:Ft,hour:Ft,minute:Ft,second:Ft,timeZoneName:qt},hn={year:Ft,month:Ht,day:Ft,weekday:Ht,hour:Ft,minute:Ft,timeZoneName:Ht},mn={year:Ft,month:Ht,day:Ft,weekday:Ht,hour:Ft,minute:Ft,second:Ft,timeZoneName:Ht};class fn{get type(){throw new Bt}get name(){throw new Bt}get ianaName(){return this.name}get isUniversal(){throw new Bt}offsetName(e,t){throw new Bt}formatOffset(e,t){throw new Bt}offset(e){throw new Bt}equals(e){throw new Bt}get isValid(){throw new Bt}}let pn=null;class gn extends fn{static get instance(){return null===pn&&(pn=new gn),pn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Or(e,t,n)}formatOffset(e,t){return Lr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const yn=new Map,vn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},wn=new Map;class bn extends fn{static create(e){let t=wn.get(e);return void 0===t&&wn.set(e,t=new bn(e)),t}static resetCache(){wn.clear(),yn.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=bn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Or(e,t,n,this.name)}formatOffset(e,t){return Lr(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=yn.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"}),yn.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=vn[t];"era"===t?r[o]=i:pr(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,(Dr({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 xn={};const kn=new Map;function Sn(e,t={}){const n=JSON.stringify([e,t]);let r=kn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),kn.set(n,r)),r}const Nn=new Map,_n=new Map;let $n=null;const Cn=new Map;function Tn(e){let t=Cn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Cn.set(e,t)),t}const In=new Map;function En(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class Pn{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=Nn.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),Nn.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 Nr(this.floor?Math.floor(e):Tr(e,3),this.padTo)}}class Dn{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&&bn.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=Sn(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 Mn{constructor(e,t,n){this.opts={style:"long",...n},!t&&vr()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=_n.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),_n.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 zn={firstDay:1,minimalDays:4,weekend:[6,7]};class Rn{static fromOpts(e){return Rn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||Xn.defaultLocale,s=o||(i?"en-US":$n||($n=(new Intl.DateTimeFormat).resolvedOptions().locale,$n)),a=t||Xn.defaultNumberingSystem,c=n||Xn.defaultOutputCalendar,l=kr(r)||Xn.defaultWeekSettings;return new Rn(s,a,c,l,o)}static resetCache(){$n=null,kn.clear(),Nn.clear(),_n.clear(),Cn.clear(),In.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return Rn.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=Sn(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=Sn(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"===Tn(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?Rn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,kr(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 En(this,e,Ur,()=>{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=Go.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return En(this,e,Jr,()=>{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=Go.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return En(this,void 0,()=>Qr,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Go.utc(2016,11,13,9),Go.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return En(this,e,ei,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Go.utc(-40,1,1),Go.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 Pn(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Dn(e,this.intl,t)}relFormatter(e={}){return new Mn(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=xn[n];return r||(r=new Intl.ListFormat(e,t),xn[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||Tn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:wr()?function(e){let t=In.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...zn,...t}),In.set(e,t)}return t}(this.locale):zn}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 On=null;class jn extends fn{static get utcInstance(){return null===On&&(On=new jn(0)),On}static instance(e){return 0===e?jn.utcInstance:new jn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new jn(jr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Lr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Lr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Lr(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 An extends fn{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 Wn(e,t){if(pr(e)||null===e)return t;if(e instanceof fn)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?gn.instance:"utc"===n||"gmt"===n?jn.utcInstance:jn.parseSpecifier(n)||bn.create(e)}return gr(e)?jn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new An(e)}const Ln={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Bn={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]},Fn=Ln.hanidec.replace(/[\[|\]]/g,"").split(""),qn=new Map;function Hn({numberingSystem:e},t=""){const n=e||"latn";let r=qn.get(n);void 0===r&&(r=new Map,qn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${Ln[n]}${t}`),r.set(t,i)),i}let Un,Zn=()=>Date.now(),Yn="system",Gn=null,Jn=null,Qn=null,Vn=60,Kn=null;class Xn{static get now(){return Zn}static set now(e){Zn=e}static set defaultZone(e){Yn=e}static get defaultZone(){return Wn(Yn,gn.instance)}static get defaultLocale(){return Gn}static set defaultLocale(e){Gn=e}static get defaultNumberingSystem(){return Jn}static set defaultNumberingSystem(e){Jn=e}static get defaultOutputCalendar(){return Qn}static set defaultOutputCalendar(e){Qn=e}static get defaultWeekSettings(){return Kn}static set defaultWeekSettings(e){Kn=kr(e)}static get twoDigitCutoffYear(){return Vn}static set twoDigitCutoffYear(e){Vn=e%100}static get throwOnInvalid(){return Un}static set throwOnInvalid(e){Un=e}static resetCaches(){Rn.resetCache(),bn.resetCache(),Go.resetCache(),qn.clear()}}class er{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const tr=[0,31,59,90,120,151,181,212,243,273,304,334],nr=[0,31,60,91,121,152,182,213,244,274,305,335];function rr(e,t){return new er("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function ir(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 or(e,t,n){return n+(Ir(e)?nr:tr)[t-1]}function sr(e,t){const n=Ir(e)?nr:tr,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function ar(e,t){return(e-t+7)%7+1}function cr(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=or(r,i,o),a=ar(ir(r,i,o),n);let c,l=Math.floor((s-a+14-t)/7);return l<1?(c=r-1,l=zr(c,t,n)):l>zr(r,t,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...Br(e)}}function lr(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=ar(ir(r,1,t),n),a=Er(r);let c,l=7*i+o-s-7+t;l<1?(c=r-1,l+=Er(c)):l>a?(c=r+1,l-=Er(r)):c=r;const{month:u,day:d}=sr(c,l);return{year:c,month:u,day:d,...Br(e)}}function ur(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:or(t,n,r),...Br(e)}}function dr(e){const{year:t,ordinal:n}=e,{month:r,day:i}=sr(t,n);return{year:t,month:r,day:i,...Br(e)}}function hr(e,t){if(!pr(e.localWeekday)||!pr(e.localWeekNumber)||!pr(e.localWeekYear)){if(!pr(e.weekday)||!pr(e.weekNumber)||!pr(e.weekYear))throw new At("Cannot mix locale-based week fields with ISO-based week fields");return pr(e.localWeekday)||(e.weekday=e.localWeekday),pr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),pr(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 mr(e){const t=yr(e.year),n=Sr(e.month,1,12),r=Sr(e.day,1,Pr(e.year,e.month));return t?n?!r&&rr("day",e.day):rr("month",e.month):rr("year",e.year)}function fr(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=Sr(t,0,23)||24===t&&0===n&&0===r&&0===i,s=Sr(n,0,59),a=Sr(r,0,59),c=Sr(i,0,999);return o?s?a?!c&&rr("millisecond",i):rr("second",r):rr("minute",n):rr("hour",t)}function pr(e){return void 0===e}function gr(e){return"number"==typeof e}function yr(e){return"number"==typeof e&&e%1==0}function vr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function wr(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function br(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 xr(e,t){return{}.hasOwnProperty.call(e,t)}function kr(e){if(null==e)return null;if("object"!=typeof e)throw new Lt("Week settings must be an object");if(!Sr(e.firstDay,1,7)||!Sr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!Sr(e,1,7)))throw new Lt("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Sr(e,t,n){return yr(e)&&e>=t&&e<=n}function Nr(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function _r(e){return pr(e)||null===e||""===e?void 0:parseInt(e,10)}function $r(e){return pr(e)||null===e||""===e?void 0:parseFloat(e)}function Cr(e){if(!pr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function Tr(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 Ir(e){return e%4==0&&(e%100!=0||e%400==0)}function Er(e){return Ir(e)?366:365}function Pr(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?Ir(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Dr(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 Mr(e,t,n){return-ar(ir(e,1,t),n)+t-1}function zr(e,t=4,n=1){const r=Mr(e,t,n),i=Mr(e+1,t,n);return(Er(e)-r+i)/7}function Rr(e){return e>99?e:e>Xn.twoDigitCutoffYear?1900+e:2e3+e}function Or(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 jr(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 Ar(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Lt(`Invalid unit value ${e}`);return t}function Wr(e,t){const n={};for(const r in e)if(xr(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=Ar(i)}return n}function Lr(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}${Nr(n,2)}:${Nr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${Nr(n,2)}${Nr(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Br(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const Fr=["January","February","March","April","May","June","July","August","September","October","November","December"],qr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Hr=["J","F","M","A","M","J","J","A","S","O","N","D"];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","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 Zr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Yr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Gr=["M","T","W","T","F","S","S"];function Jr(e){switch(e){case"narrow":return[...Gr];case"short":return[...Yr];case"long":return[...Zr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Qr=["AM","PM"],Vr=["Before Christ","Anno Domini"],Kr=["BC","AD"],Xr=["B","A"];function ei(e){switch(e){case"narrow":return[...Xr];case"short":return[...Kr];case"long":return[...Vr];default:return null}}function ti(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const ni={D:Ut,DD:Zt,DDD:Gt,DDDD:Jt,t:Qt,tt:Vt,ttt:Kt,tttt:Xt,T:en,TT:tn,TTT:nn,TTTT:rn,f:on,ff:an,fff:un,ffff:hn,F:sn,FF:cn,FFF:dn,FFFF:mn};class ri{static create(e,t={}){return new ri(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 ni[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 Nr(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 Ur(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return Jr(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),c=t=>{const n=ri.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},l=t=>n?function(e,t){return ei(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return ti(ri.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 Qr[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=ri.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 ti(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 ii=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function oi(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function si(...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 ai(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 ci(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=_r(t[n+i]);return[r,null,n+i]}}const li=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ui=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,di=RegExp(`${ui.source}(?:${li.source}?(?:\\[(${ii.source})\\])?)?`),hi=RegExp(`(?:[Tt]${di.source})?`),mi=ci("weekYear","weekNumber","weekDay"),fi=ci("year","ordinal"),pi=RegExp(`${ui.source} ?(?:${li.source}|(${ii.source}))?`),gi=RegExp(`(?: ${pi.source})?`);function yi(e,t,n){const r=e[t];return pr(r)?n:_r(r)}function vi(e,t){return[{hours:yi(e,t,0),minutes:yi(e,t+1,0),seconds:yi(e,t+2,0),milliseconds:Cr(e[t+3])},null,t+4]}function wi(e,t){const n=!e[t]&&!e[t+1],r=jr(e[t+1],e[t+2]);return[{},n?null:jn.instance(r),t+3]}function bi(e,t){return[{},e[t]?bn.create(e[t]):null,t+1]}const xi=RegExp(`^T?${ui.source}$`),ki=/^-?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 Si(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($r(n)),months:h($r(r)),weeks:h($r(i)),days:h($r(o)),hours:h($r(s)),minutes:h($r(a)),seconds:h($r(c),"-0"===c),milliseconds:h(Cr(l),d)}]}const Ni={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function _i(e,t,n,r,i,o,s){const a={year:2===t.length?Rr(_r(t)):_r(t),month:qr.indexOf(n)+1,day:_r(r),hour:_r(i),minute:_r(o)};return s&&(a.second=_r(s)),e&&(a.weekday=e.length>3?Zr.indexOf(e)+1:Yr.indexOf(e)+1),a}const $i=/^(?:(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 Ci(e){const[,t,n,r,i,o,s,a,c,l,u,d]=e,h=_i(t,i,r,n,o,s,a);let m;return m=c?Ni[c]:l?0:jr(u,d),[h,new jn(m)]}const Ti=/^(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$/,Ii=/^(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$/,Ei=/^(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 Pi(e){const[,t,n,r,i,o,s,a]=e;return[_i(t,i,r,n,o,s,a),jn.utcInstance]}function Di(e){const[,t,n,r,i,o,s,a]=e;return[_i(t,a,n,r,i,o,s),jn.utcInstance]}const Mi=oi(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,hi),zi=oi(/(\d{4})-?W(\d\d)(?:-?(\d))?/,hi),Ri=oi(/(\d{4})-?(\d{3})/,hi),Oi=oi(di),ji=si(function(e,t){return[{year:yi(e,t),month:yi(e,t+1,1),day:yi(e,t+2,1)},null,t+3]},vi,wi,bi),Ai=si(mi,vi,wi,bi),Wi=si(fi,vi,wi,bi),Li=si(vi,wi,bi),Bi=si(vi),Fi=oi(/(\d{4})-(\d\d)-(\d\d)/,gi),qi=oi(pi),Hi=si(vi,wi,bi),Ui="Invalid Duration",Zi={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}},Yi={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},...Zi},Gi={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},...Zi},Ji=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Qi=Ji.slice(0).reverse();function Vi(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 to(r)}function Ki(e,t){let n=t.milliseconds??0;for(const r of Qi.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function Xi(e,t){const n=Ki(e,t)<0?-1:1;Ji.reduceRight((r,i)=>{if(pr(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),Ji.reduce((n,r)=>{if(pr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function eo(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class to{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?Gi:Yi;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Rn.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return to.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Lt("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new to({values:Wr(e,to.normalizeUnit),loc:Rn.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(gr(e))return to.fromMillis(e);if(to.isDuration(e))return e;if("object"==typeof e)return to.fromObject(e);throw new Lt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return ai(e,[ki,Si])}(e);return n?to.fromObject(n,t):to.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return ai(e,[xi,Bi])}(e);return n?to.fromObject(n,t):to.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Lt("need to specify a reason the Duration is invalid");const n=e instanceof er?e:new er(e,t);if(Xn.throwOnInvalid)throw new jt(n);return new to({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 Wt(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?ri.create(this.loc,n).formatDurationFromString(this,e):Ui}toHuman(e={}){if(!this.isValid)return Ui;const t=!1!==e.showZeros,n=Ji.map(n=>{const r=this.values[n];return pr(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+=Tr(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},Go.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?Ki(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=to.fromDurationLike(e),n={};for(const e of Ji)(xr(t.values,e)||xr(this.values,e))&&(n[e]=t.get(e)+this.get(e));return Vi(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=to.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]=Ar(e(this.values[n],n));return Vi(this,{values:t},!0)}get(e){return this[to.normalizeUnit(e)]}set(e){return this.isValid?Vi(this,{values:{...this.values,...Wr(e,to.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return Vi(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 Xi(this.matrix,e),Vi(this,{values:e},!0)}rescale(){return this.isValid?Vi(this,{values:eo(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>to.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of Ji)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;gr(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else gr(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 Xi(this.matrix,t),Vi(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 Vi(this,{values:e},!0)}removeZeros(){return this.isValid?Vi(this,{values:eo(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 Ji)if(!t(this.values[n],e.values[n]))return!1;return!0}}const no="Invalid Interval";class ro{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 Lt("need to specify a reason the Interval is invalid");const n=e instanceof er?e:new er(e,t);if(Xn.throwOnInvalid)throw new Ot(n);return new ro({invalid:n})}static fromDateTimes(e,t){const n=Jo(e),r=Jo(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?ro.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:ro.invalid("missing or invalid end"):ro.invalid("missing or invalid start")}(n,r);return null==i?new ro({start:n,end:r}):i}static after(e,t){const n=to.fromDurationLike(t),r=Jo(e);return ro.fromDateTimes(r,r.plus(n))}static before(e,t){const n=to.fromDurationLike(t),r=Jo(e);return ro.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=Go.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=Go.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return ro.fromDateTimes(e,o);if(i){const n=to.fromISO(r,t);if(n.isValid)return ro.after(e,n)}else if(s){const e=to.fromISO(n,t);if(e.isValid)return ro.before(o,e)}}return ro.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?ro.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Jo).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(ro.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=to.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(ro.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:ro.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 ro.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(ro.fromDateTimes(t,e.time)),t=null);return ro.merge(r)}difference(...e){return ro.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:no}[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=Ut,t={}){return this.isValid?ri.create(this.s.loc.clone(t),e).formatInterval(this):no}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:no}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:no}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:no}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:no}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):to.invalid(this.invalidReason)}mapEndpoints(e){return ro.fromDateTimes(e(this.s),e(this.e))}}class io{static hasDST(e=Xn.defaultZone){const t=Go.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return bn.isValidZone(e)}static normalizeZone(e){return Wn(e,Xn.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Rn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Rn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Rn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Rn.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Rn.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Rn.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Rn.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Rn.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Rn.create(t,null,"gregory").eras(e)}static features(){return{relative:vr(),localeWeek:wr()}}}function oo(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(to.fromMillis(r).as("days"))}function so(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(Ln.hanidec))t+=Fn.indexOf(e[n]);else for(const e in Bn){const[n,i]=Bn[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const ao=`[ ${String.fromCharCode(160)}]`,co=new RegExp(ao,"g");function lo(e){return e.replace(/\./g,"\\.?").replace(co,ao)}function uo(e){return e.replace(/\./g,"").replace(co," ").toLowerCase()}function ho(e,t){return null===e?null:{regex:RegExp(e.map(lo).join("|")),deser:([n])=>e.findIndex(e=>uo(n)===uo(e))+t}}function mo(e,t){return{regex:e,deser:([,e,t])=>jr(e,t),groups:t}}function fo(e){return{regex:e,deser:([e])=>e}}const po={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 go=null;function yo(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=bo(ri.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class vo{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=yo(ri.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=Hn(t),r=Hn(t,"{2}"),i=Hn(t,"{3}"),o=Hn(t,"{4}"),s=Hn(t,"{6}"),a=Hn(t,"{1,2}"),c=Hn(t,"{1,3}"),l=Hn(t,"{1,6}"),u=Hn(t,"{1,9}"),d=Hn(t,"{2,4}"),h=Hn(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 ho(t.eras("short"),0);case"GG":return ho(t.eras("long"),0);case"y":return so(l);case"yy":case"kk":return so(d,Rr);case"yyyy":case"kkkk":return so(o);case"yyyyy":return so(h);case"yyyyyy":return so(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return so(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return so(r);case"MMM":return ho(t.months("short",!0),1);case"MMMM":return ho(t.months("long",!0),1);case"LLL":return ho(t.months("short",!1),1);case"LLLL":return ho(t.months("long",!1),1);case"o":case"S":return so(c);case"ooo":case"SSS":return so(i);case"u":return fo(u);case"uu":return fo(a);case"uuu":case"E":case"c":return so(n);case"a":return ho(t.meridiems(),0);case"EEE":return ho(t.weekdays("short",!1),1);case"EEEE":return ho(t.weekdays("long",!1),1);case"ccc":return ho(t.weekdays("short",!0),1);case"cccc":return ho(t.weekdays("long",!0),1);case"Z":case"ZZ":return mo(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return mo(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return fo(/[a-z_+-/]{1,256}?/i);case" ":return fo(/[^\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(xr(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;pr(e.z)||(n=bn.create(e.z)),pr(e.Z)||(n||(n=new jn(e.Z)),t=e.Z),pr(e.q)||(e.M=3*(e.q-1)+1),pr(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),pr(e.u)||(e.S=Cr(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(xr(n,"a")&&xr(n,"H"))throw new At("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 wo(e,t,n){return new vo(e,n).explainFromTokens(t)}function bo(e,t){if(!e)return null;const n=ri.create(t,e).dtFormatter((go||(go=Go.fromMillis(1555555555555)),go)),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=po[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const xo="Invalid DateTime",ko=864e13;function So(e){return new er("unsupported zone",`the zone "${e.name}" is not supported`)}function No(e){return null===e.weekData&&(e.weekData=cr(e.c)),e.weekData}function _o(e){return null===e.localWeekData&&(e.localWeekData=cr(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function $o(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Go({...n,...t,old:n})}function Co(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 To(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 Io(e,t,n){return Co(Dr(e),t,n)}function Eo(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,Pr(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=to.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=Dr(o);let[c,l]=Co(a,n,e.zone);return 0!==s&&(c+=s,l=e.zone.offset(c)),{ts:c,o:l}}function Po(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=Go.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Go.invalid(new er("unparsable",`the input "${i}" can't be parsed as ${r}`))}function Do(e,t,n=!0){return e.isValid?ri.create(Rn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function Mo(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=Nr(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=Nr(e.c.month),"month"===n)return i;i+="-"}else if(i+=Nr(e.c.month),"month"===n)return i;return i+=Nr(e.c.day),i}function zo(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+=Nr(e.c.hour),"hour"===s)break;if(t){if(c+=":",c+=Nr(e.c.minute),"minute"===s)break;a&&(c+=":",c+=Nr(e.c.second))}else{if(c+=Nr(e.c.minute),"minute"===s)break;a&&(c+=Nr(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(c+=".",c+=Nr(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?c+="Z":e.o<0?(c+="-",c+=Nr(Math.trunc(-e.o/60)),c+=":",c+=Nr(Math.trunc(-e.o%60))):(c+="+",c+=Nr(Math.trunc(e.o/60)),c+=":",c+=Nr(Math.trunc(e.o%60)))),o&&(c+="["+e.zone.ianaName+"]"),c}const Ro={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Oo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},jo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ao=["year","month","day","hour","minute","second","millisecond"],Wo=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Lo=["year","ordinal","hour","minute","second","millisecond"];function Bo(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 Wt(e);return t}function Fo(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Bo(e)}}function qo(e,t){const n=Wn(t.zone,Xn.defaultZone);if(!n.isValid)return Go.invalid(So(n));const r=Rn.fromObject(t);let i,o;if(pr(e.year))i=Xn.now();else{for(const t of Ao)pr(e[t])&&(e[t]=Ro[t]);const t=mr(e)||fr(e);if(t)return Go.invalid(t);const r=function(e){if(void 0===Zo&&(Zo=Xn.now()),"iana"!==e.type)return e.offset(Zo);const t=e.name;let n=Yo.get(t);return void 0===n&&(n=e.offset(Zo),Yo.set(t,n)),n}(n);[i,o]=Io(e,r,n)}return new Go({ts:i,zone:n,loc:r,o:o})}function Ho(e,t,n){const r=!!pr(n.round)||n.round,i=pr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=Tr(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 Uo(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 Zo;const Yo=new Map;class Go{constructor(e){const t=e.zone||Xn.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new er("invalid input"):null)||(t.isValid?null:So(t));this.ts=pr(e.ts)?Xn.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=gr(e.o)&&!e.old?e.o:t.offset(this.ts);r=To(this.ts,o),n=Number.isNaN(r.year)?new er("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||Rn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Go({})}static local(){const[e,t]=Uo(arguments),[n,r,i,o,s,a,c]=t;return qo({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},e)}static utc(){const[e,t]=Uo(arguments),[n,r,i,o,s,a,c]=t;return e.zone=jn.utcInstance,qo({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 Go.invalid("invalid input");const r=Wn(t.zone,Xn.defaultZone);return r.isValid?new Go({ts:n,zone:r,loc:Rn.fromObject(t)}):Go.invalid(So(r))}static fromMillis(e,t={}){if(gr(e))return e<-ko||e>ko?Go.invalid("Timestamp out of range"):new Go({ts:e,zone:Wn(t.zone,Xn.defaultZone),loc:Rn.fromObject(t)});throw new Lt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(gr(e))return new Go({ts:1e3*e,zone:Wn(t.zone,Xn.defaultZone),loc:Rn.fromObject(t)});throw new Lt("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Wn(t.zone,Xn.defaultZone);if(!n.isValid)return Go.invalid(So(n));const r=Rn.fromObject(t),i=Wr(e,Fo),{minDaysInFirstWeek:o,startOfWeek:s}=hr(i,r),a=Xn.now(),c=pr(t.specificOffset)?n.offset(a):t.specificOffset,l=!pr(i.ordinal),u=!pr(i.year),d=!pr(i.month)||!pr(i.day),h=u||d,m=i.weekYear||i.weekNumber;if((h||l)&&m)throw new At("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new At("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!h;let p,g,y=To(a,c);f?(p=Wo,g=Oo,y=cr(y,o,s)):l?(p=Lo,g=jo,y=ur(y)):(p=Ao,g=Ro);let v=!1;for(const e of p)pr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=f?function(e,t=4,n=1){const r=yr(e.weekYear),i=Sr(e.weekNumber,1,zr(e.weekYear,t,n)),o=Sr(e.weekday,1,7);return r?i?!o&&rr("weekday",e.weekday):rr("week",e.weekNumber):rr("weekYear",e.weekYear)}(i,o,s):l?function(e){const t=yr(e.year),n=Sr(e.ordinal,1,Er(e.year));return t?!n&&rr("ordinal",e.ordinal):rr("year",e.year)}(i):mr(i),b=w||fr(i);if(b)return Go.invalid(b);const x=f?lr(i,o,s):l?dr(i):i,[k,S]=Io(x,c,n),N=new Go({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&e.weekday!==N.weekday?Go.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${N.toISO()}`):N.isValid?N:Go.invalid(N.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return ai(e,[Mi,ji],[zi,Ai],[Ri,Wi],[Oi,Li])}(e);return Po(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return ai(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[$i,Ci])}(e);return Po(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return ai(e,[Ti,Pi],[Ii,Pi],[Ei,Di])}(e);return Po(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(pr(e)||pr(t))throw new Lt("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Rn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,l]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=wo(e,t,n);return[r,i,o,s]}(o,e,t);return l?Go.invalid(l):Po(s,a,n,`format ${t}`,e,c)}static fromString(e,t,n={}){return Go.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return ai(e,[Fi,ji],[qi,Hi])}(e);return Po(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Lt("need to specify a reason the DateTime is invalid");const n=e instanceof er?e:new er(e,t);if(Xn.throwOnInvalid)throw new Rt(n);return new Go({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=bo(e,Rn.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return yo(ri.parseFormat(e),Rn.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Zo=void 0,Yo.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?No(this).weekYear:NaN}get weekNumber(){return this.isValid?No(this).weekNumber:NaN}get weekday(){return this.isValid?No(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?_o(this).weekday:NaN}get localWeekNumber(){return this.isValid?_o(this).weekNumber:NaN}get localWeekYear(){return this.isValid?_o(this).weekYear:NaN}get ordinal(){return this.isValid?ur(this.c).ordinal:NaN}get monthShort(){return this.isValid?io.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?io.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?io.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?io.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=Dr(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=To(a,o),u=To(c,s);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[$o(this,{ts:a}),$o(this,{ts:c})]:[this]}get isInLeapYear(){return Ir(this.year)}get daysInMonth(){return Pr(this.year,this.month)}get daysInYear(){return this.isValid?Er(this.year):NaN}get weeksInWeekYear(){return this.isValid?zr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?zr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=ri.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(jn.instance(e),t)}toLocal(){return this.setZone(Xn.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=Wn(e,Xn.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]=Io(n,t,e)}return $o(this,{ts:r,zone:e})}return Go.invalid(So(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return $o(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=Wr(e,Fo),{minDaysInFirstWeek:n,startOfWeek:r}=hr(t,this.loc),i=!pr(t.weekYear)||!pr(t.weekNumber)||!pr(t.weekday),o=!pr(t.ordinal),s=!pr(t.year),a=!pr(t.month)||!pr(t.day),c=s||a,l=t.weekYear||t.weekNumber;if((c||o)&&l)throw new At("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new At("Can't mix ordinal dates with month/day");let u;i?u=lr({...cr(this.c,n,r),...t},n,r):pr(t.ordinal)?(u={...this.toObject(),...t},pr(t.day)&&(u.day=Math.min(Pr(u.year,u.month),u.day))):u=dr({...ur(this.c),...t});const[d,h]=Io(u,this.o,this.zone);return $o(this,{ts:d,o:h})}plus(e){return this.isValid?$o(this,Eo(this,to.fromDurationLike(e))):this}minus(e){return this.isValid?$o(this,Eo(this,to.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=to.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?ri.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):xo}toLocaleString(e=Ut,t={}){return this.isValid?ri.create(this.loc.clone(t),e).formatDateTime(this):xo}toLocaleParts(e={}){return this.isValid?ri.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=Mo(this,s,o=Bo(o));return Ao.indexOf(o)>=3&&(a+="T"),a+=zo(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?Mo(this,"extended"===e,Bo(t)):null}toISOWeekDate(){return Do(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=Bo(s),(r&&Ao.indexOf(s)>=3?"T":"")+zo(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return Do(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Do(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Mo(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")),Do(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():xo}[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 to.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(to.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=oo(e,t);return(n-n%7)/7}],["days",oo]],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=to.fromObject(o,r);return l.length>0?to.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(Go.now(),e,t)}until(e){return this.isValid?ro.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||Go.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),Ho(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Ho(e.base||Go.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(Go.isDateTime))throw new Lt("min requires all arguments be DateTimes");return br(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(Go.isDateTime))throw new Lt("max requires all arguments be DateTimes");return br(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return wo(Rn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return Go.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=Rn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new vo(i,e)}static fromFormatParser(e,t,n={}){if(pr(e)||pr(t))throw new Lt("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Rn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new Lt(`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?Go.invalid(l):Po(s,a,n,`format ${t.format}`,e,c)}static get DATE_SHORT(){return Ut}static get DATE_MED(){return Zt}static get DATE_MED_WITH_WEEKDAY(){return Yt}static get DATE_FULL(){return Gt}static get DATE_HUGE(){return Jt}static get TIME_SIMPLE(){return Qt}static get TIME_WITH_SECONDS(){return Vt}static get TIME_WITH_SHORT_OFFSET(){return Kt}static get TIME_WITH_LONG_OFFSET(){return Xt}static get TIME_24_SIMPLE(){return en}static get TIME_24_WITH_SECONDS(){return tn}static get TIME_24_WITH_SHORT_OFFSET(){return nn}static get TIME_24_WITH_LONG_OFFSET(){return rn}static get DATETIME_SHORT(){return on}static get DATETIME_SHORT_WITH_SECONDS(){return sn}static get DATETIME_MED(){return an}static get DATETIME_MED_WITH_SECONDS(){return cn}static get DATETIME_MED_WITH_WEEKDAY(){return ln}static get DATETIME_FULL(){return un}static get DATETIME_FULL_WITH_SECONDS(){return dn}static get DATETIME_HUGE(){return hn}static get DATETIME_HUGE_WITH_SECONDS(){return mn}}function Jo(e){if(Go.isDateTime(e))return e;if(e&&e.valueOf&&gr(e.valueOf()))return Go.fromJSDate(e);if(e&&"object"==typeof e)return Go.fromObject(e);throw new Lt(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function Qo({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return Le("div",{className:xt.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:gt.colors.accent}),children:Le("div",{className:xt.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Le("div",{className:xt.create("page-heading-wrapper",{width:"100%",marginBottom:gt.spacing.lg}),children:Le(It,{children:Le("div",{className:xt.create("page-heading-container",{backgroundColor:gt.colors.primary,color:gt.colors.primaryForeground,borderRadius:gt.radius.large,padding:`${gt.spacing.lg} ${gt.spacing.xl}`,boxShadow:gt.shadow.md}),children:Le("div",{className:xt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:gt.spacing.lg}),children:Le("div",{className:xt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Le("h1",{className:xt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:gt.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&Le("p",{className:xt.create("page-template-description",{margin:"0",marginTop:gt.spacing.sm,fontSize:gt.fontSize.small,lineHeight:"1.5",color:gt.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function Vo({className:e,children:t}){const n=xt.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Le("div",{className:Ct(n,e),children:t})}function Ko({message:e}){return Le(Qo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le(Vo,{className:xt.name("loading-container"),children:Le(Tt,{size:"large"})})})})}function Xo({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:gt.colors.primary,color:gt.colors.primaryForeground,boxShadow:gt.shadow.sm},outline:{border:`${gt.borderWidth} solid ${gt.colors.primary}`,backgroundColor:gt.colors.card,color:gt.colors.primary,boxShadow:gt.shadow.sm}},l=xt.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:gt.radius.default,cursor:"pointer",fontSize:gt.fontSize.default,fontWeight:"500",transition:gt.transition,fontFamily:gt.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});xt.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),xt.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:gt.shadow.md}),xt.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:gt.shadow.sm});const u=xt.create(`button-${e}`,{...c[e]});return Le("button",{type:t,className:Ct(l,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Le(Tt,{size:"small"}),o]})}function es({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 Le(Qo,{title:t.title,noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le("div",{className:xt.create("error-page-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Le("div",{className:xt.create("error-page-card",{backgroundColor:gt.colors.card,boxShadow:gt.shadow.sm,borderRadius:gt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"500px"}),children:[Le("div",{className:xt.create("error-page-header",{paddingInline:gt.spacing.xl,paddingTop:gt.spacing.xl,paddingBottom:gt.spacing.lg,textAlign:"center"},{"(max-width: 768px)":{paddingInline:gt.spacing.lg,paddingTop:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingTop:gt.spacing.md}}),children:[Le("div",{className:xt.create("error-page-icon-wrapper",{display:"flex",justifyContent:"center",marginBottom:gt.spacing.lg}),children:Le("div",{className:xt.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:Le("svg",{className:xt.create("error-page-icon",{width:"2rem",height:"2rem",color:gt.colors.destructive}),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Le("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"})})})}),Le("h2",{className:xt.create("error-page-title",{margin:"0",marginBottom:gt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:gt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:t.title}),Le("p",{className:xt.create("error-page-description",{margin:"0",marginTop:gt.spacing.sm,fontSize:gt.fontSize.default,lineHeight:"1.6",color:gt.colors.mutedForeground}),children:t.message})]}),Le("div",{className:xt.create("error-page-content",{paddingInline:gt.spacing.xl,paddingBottom:gt.spacing.xl},{"(max-width: 768px)":{paddingInline:gt.spacing.lg,paddingBottom:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingBottom:gt.spacing.md}}),children:[n&&Le("p",{className:xt.create("error-page-support",{margin:"0",marginBottom:gt.spacing.lg,fontSize:gt.fontSize.small,lineHeight:"1.5",color:gt.colors.mutedForeground,textAlign:"center"}),children:["If this problem persists, please contact support with reference"," ",Le("span",{className:xt.create("error-page-ref",{fontFamily:"monospace",fontWeight:"600",color:gt.colors.foreground}),children:n})]}),Le(Xo,{onClick:()=>{window.location.reload()},className:xt.create("error-page-button",{width:"100%"}),children:"Try Again"})]})]})})})})}function ts({message:e,estimatedTime:t}){const n=xt.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=xt.create("maintenance-icon",{width:"4rem",height:"4rem",color:gt.colors.primary,marginBottom:"1.5rem"}),i=xt.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:gt.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=xt.create("maintenance-message",{fontSize:gt.fontSize.default,color:gt.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=xt.create("maintenance-info-box",{backgroundColor:gt.colors.muted,borderRadius:gt.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=xt.create("maintenance-info-title",{fontSize:gt.fontSize.default,fontWeight:"600",color:gt.colors.foreground,marginBottom:"0.5rem"}),c=xt.create("maintenance-info-text",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,lineHeight:"1.4"}),l=xt.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Le(Qo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Le(It,{children:Le(Vo,{children:Le("div",{className:n,children:[Le(()=>Le("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:Le("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"})}),{}),Le("h1",{className:i,children:"We'll be right back"}),Le("p",{className:o,children:e||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Le("div",{className:s,children:[Le("p",{className:a,children:"What's happening?"}),Le("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),t&&Le("p",{className:c,style:{marginTop:"0.5rem"},children:[Le("strong",{children:"Estimated time:"})," ",t]})]}),Le("div",{className:l,children:Le(Xo,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function ns({size:e="default",style:t="normal",className:n,children:r}){const i=xt.create("text",{marginTop:"0",marginBottom:"0"}),o=xt.create("text-small",{fontSize:gt.fontSize.small}),s=xt.create("text-default",{fontSize:gt.fontSize.default}),a=xt.create("text-italic",{fontStyle:"italic"}),c=xt.create("text-bold",{fontWeight:"bold"}),l=xt.create("text-underline",{textDecoration:"underline"}),u=Ct({[a]:"italic"===t,[c]:"bold"===t,[l]:"underline"===t}),d=Ct({[o]:"small"===e,[s]:"default"===e});return Le("p",{className:Ct(i,d,u,n),children:r})}function rs({title:e,description:t}){return Le("div",{className:xt.create("section-header",{}),children:[Le("p",{className:xt.create("section-title",{fontSize:gt.fontSize.large,margin:"0",color:gt.colors.foreground}),children:e}),t&&Le(ns,{className:xt.create("section-description",{color:gt.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 is({selected:e}){return Le("div",{className:Ct(xt.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${gt.borderWidth} solid transparent`}),e?xt.create("selected-indicator-selected",{backgroundColor:gt.colors.primary}):xt.create("selected-indicator-unselected",{border:`${gt.borderWidth} solid ${gt.colors.border}`}))})}function os({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 Le("div",{className:xt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Le(rs,{title:"Excess Options"}),Le("div",{className:xt.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Le("div",{className:Ct(xt.create("excess-option-card",{borderRadius:gt.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?xt.create("excess-option-card-selected",{border:`2px solid ${gt.colors.primary}`,backgroundColor:gt.colors.accent}):xt.create("excess-option-card-unselected",{border:`2px solid ${gt.colors.border}`,backgroundColor:gt.colors.card})),onClick:()=>n(e.id),children:[Le(is,{selected:r}),Le("div",{className:xt.create("excess-amount",{color:gt.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})}),(null==i?void 0:i.description)&&Le("div",{className:xt.create("excess-description",{padding:"0.75rem",backgroundColor:gt.colors.muted,borderRadius:gt.radius.default,border:`1px solid ${gt.colors.border}`}),children:Le(ns,{className:xt.create("excess-description-text",{fontSize:gt.fontSize.small,color:gt.colors.foreground,margin:"0"}),children:i.description})})]})}function ss(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function as(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 cs({paymentOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=it(()=>{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?Le(ls,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Le("div",{className:xt.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Le(ls,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function ls({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return Le("div",{className:xt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Le(rs,{title:"Payment Options"}),Le("div",r?{className:xt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Le(us,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${e.excess_id}`))}:{className:xt.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${gt.colors.border}`,borderRadius:gt.radius.default,backgroundColor:gt.colors.muted}),children:Le(ns,{className:xt.create("placeholder-text",{color:gt.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function us({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?ss(e.amount.dueToday):`${ss(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`:"Currently Unavailable",s=()=>"bank_transfer"===e.gateway.code?"Manual":`via ${e.gateway.name}`;return Le("div",{className:Ct(xt.create("payment-option-row",{borderRadius:gt.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?xt.create("payment-option-row-selected",{border:`2px solid ${gt.colors.primary}`,backgroundColor:gt.colors.accent}):xt.create("payment-option-row-unselected",{border:`2px solid ${gt.colors.border}`,backgroundColor:gt.colors.card})),onClick:()=>i&&n(e),children:[Le("div",{className:xt.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Le(is,{selected:r}),Le("div",{className:xt.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Le("div",{className:xt.create("frequency-title",{fontSize:gt.fontSize.default,fontWeight:"500",color:gt.colors.foreground}),children:as(e.amount.frequency,e.gateway.code)}),Le("div",{className:xt.create("gateway-description",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground}),children:s()})]})]}),Le("div",{className:xt.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Le(ns,{className:xt.create("amount-text",{textAlign:"right",color:i?gt.colors.foreground:gt.colors.mutedForeground,fontStyle:i?"normal":"italic"}),children:o()}),i&&"bank_transfer"!==e.gateway.code&&Le(ns,{size:"small",className:xt.create("gateway-fee-text",{textAlign:"right",color:gt.colors.mutedForeground}),children:[ss(e.amount.gatewayFee)," fee"]}),i&&"bank_transfer"===e.gateway.code&&Le(ns,{size:"small",className:xt.create("no-fee-text",{textAlign:"right",color:gt.colors.mutedForeground}),children:"No fees"})]}),Le("div",{className:xt.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Le(is,{selected:r}),Le("div",{className:xt.create("payment-option-title-mobile",{fontSize:gt.fontSize.default,fontWeight:"500",color:gt.colors.foreground}),children:as(e.amount.frequency,e.gateway.code)})]}),Le("div",{className:xt.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:[Le("div",{className:xt.create("gateway-description-mobile",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground}),children:s()}),Le(ns,{className:xt.create("amount-text-mobile",{fontWeight:"500",color:i?gt.colors.foreground:gt.colors.mutedForeground,fontStyle:i?"normal":"italic"}),children:o()})]})]})}const ds=e=>{try{return new Date(e).toLocaleDateString("en-NZ",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}};function hs({excessOptions:e,selectedExcessId:t,onEditQuote:n,isEditingQuote:r=!1,productName:i,quoteIntent:o}){const s=it(()=>t?e.find(e=>e.id===t):null,[e,t]),a=null==s?void 0:s.line_item_display,c=it(()=>{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 Le("div",{className:xt.create("cart-summary-container",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.lg,boxShadow:gt.shadow.sm},{"(max-width: 768px)":{padding:gt.spacing.md}}),children:[Le("h3",{className:xt.create("cart-summary-title",{fontSize:gt.fontSize.large,fontWeight:"600",marginBottom:gt.spacing.md,color:gt.colors.foreground}),children:"Insurance Details"}),c&&Le(k,{children:[Le("div",{className:xt.create("cart-client-details",{display:"flex",flexDirection:"column",gap:gt.spacing.sm,marginBottom:gt.spacing.md}),children:[c.firstName&&c.lastName&&Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Name"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:[c.firstName," ",c.lastName]})]}),c.email&&Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Email"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:c.email})]}),c.phone&&Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Phone"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:c.phone})]}),c.dob&&Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Date of Birth"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:ds(c.dob)})]})]}),Le("hr",{className:xt.create("divider",{border:"none",borderTop:`1px solid ${gt.colors.border}`,margin:`${gt.spacing.md} 0`})})]}),Le("div",{className:xt.create("cart-product-section",{display:"flex",flexDirection:"column",gap:gt.spacing.sm,marginBottom:gt.spacing.lg}),children:a&&Le("div",{className:xt.create("cart-item",{display:"flex",flexDirection:"column",gap:gt.spacing.sm}),children:[Le("div",{className:xt.create("cart-item-description",{fontSize:gt.fontSize.small,fontWeight:"500",color:gt.colors.foreground}),children:a.description}),a.show_sum_insured&&a.sum_insured&&Le("div",{className:xt.create("cart-item-sum-insured",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground}),children:["Sum Insured: ",ss(a.sum_insured)]})]})}),Le(Xo,{onClick:n,disabled:r,variant:"outline",className:xt.create("edit-quote-button",{width:"100%"}),children:r?"Clearing quote...":"Edit details"})]})}function ms({label:e,value:t,isTotal:n=!1,className:r}){return Le("div",{className:Ct(xt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Le("span",{className:xt.create("summary-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:e}),Le("span",{className:xt.create("summary-value",{fontWeight:n?"600":"500",color:gt.colors.foreground,fontSize:n?gt.fontSize.large:"inherit"}),children:t})]})}function fs({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:c=!1}){return it(()=>n?e.find(e=>e.id===n):null,[e,n]),it(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]),Le("div",{className:xt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Le("h3",{className:xt.create("cart-summary-title",{fontSize:gt.fontSize.large,fontWeight:"600",marginBottom:gt.spacing.sm,color:gt.colors.foreground}),children:"Payment Details"}),r&&Le("div",{className:xt.create("summary-section",{paddingBottom:"1rem"}),children:Le("div",{className:xt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Le(k,{children:[Le(ms,{label:"Total Due Today:",value:ss(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Le(ms,{label:"Gateway Fee:",value:ss(r.amount.gatewayFee)})]}):Le(k,{children:[Le(ms,{label:"Due Today:",value:ss(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Le(ms,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:ss(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Le(ms,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Le(k,{children:Le(ms,{label:"Total Payable:",value:ss(r.amount.totalRepayable),className:xt.create("total-item",{})})})]})})}),c&&Le("div",{className:xt.create("continue-later-success",{backgroundColor:`${gt.colors.accent}`,padding:"12px 16px",borderRadius:gt.radius.default,borderLeft:`4px solid ${gt.colors.primary}`}),children:[Le("h4",{className:xt.create("success-title",{margin:"0 0 4px 0",color:gt.colors.primary,fontSize:gt.fontSize.default,fontWeight:"600"}),children:"No problem!"}),Le("p",{className:xt.create("success-text",{margin:"0",fontSize:gt.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&&Le(Xo,{onClick:s,disabled:a,variant:"outline",className:xt.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:gt.fontSize.default,fontWeight:"500"}),children:a?"Sending...":"Continue Later (Email Me)"}),Le(Xo,{onClick:i,disabled:!o,className:xt.create("purchase-button",{width:"100%",height:"3rem",fontSize:gt.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function ps({details:e,onClose:t}){const n=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{})};return Le("div",{className:xt.create("bank-transfer-container",{display:"flex",flexDirection:"column",gap:gt.spacing.lg}),children:[Le("div",{className:xt.create("success-message",{backgroundColor:gt.colors.accent,border:`2px solid ${gt.colors.primary}`,borderRadius:gt.radius.default,padding:gt.spacing.lg,textAlign:"center"}),children:[Le("div",{className:xt.create("success-icon",{fontSize:"3rem",marginBottom:gt.spacing.sm}),children:"✓"}),Le("h3",{className:xt.create("success-title",{margin:"0",marginBottom:gt.spacing.sm,color:gt.colors.primary,fontSize:gt.fontSize.large,fontWeight:"600"}),children:"Quote Reserved"}),Le(ns,{className:xt.create("success-description",{margin:"0",color:gt.colors.foreground,opacity:"0.9"}),children:"Your quote has been reserved. Please complete the bank transfer to finalize your coverage."})]}),Le("div",{className:xt.create("transfer-instructions",{backgroundColor:gt.colors.card,border:`1px solid ${gt.colors.border}`,borderRadius:gt.radius.default,padding:gt.spacing.lg}),children:[Le("h4",{className:xt.create("instructions-title",{margin:"0",marginBottom:gt.spacing.md,fontSize:gt.fontSize.default,fontWeight:"600",color:gt.colors.foreground}),children:"Bank Transfer Instructions"}),Le("div",{className:xt.create("instructions-grid",{display:"grid",gap:gt.spacing.md}),children:[Le("div",{className:xt.create("detail-row-highlighted",{backgroundColor:gt.colors.accent,border:`2px solid ${gt.colors.primary}`,borderRadius:gt.radius.default,padding:gt.spacing.md}),children:[Le("div",{className:xt.create("detail-label",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,marginBottom:"0.25rem",fontWeight:"500"}),children:"Reference Number (IMPORTANT)"}),Le("div",{className:xt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Le("code",{className:xt.create("detail-value-code",{fontFamily:"monospace",fontSize:gt.fontSize.large,fontWeight:"700",color:gt.colors.primary,letterSpacing:"0.05em"}),children:e.reference}),Le("button",{onClick:()=>n(e.reference,"Reference"),className:xt.create("copy-button",{background:"transparent",border:`1px solid ${gt.colors.primary}`,borderRadius:gt.radius.small,padding:"0.25rem 0.5rem",cursor:"pointer",fontSize:gt.fontSize.small,color:gt.colors.primary,transition:"all 150ms ease"}),children:"Copy"})]}),Le(ns,{size:"small",className:xt.create("reference-note",{marginTop:"0.5rem",marginBottom:"0",color:gt.colors.foreground,fontWeight:"500"}),children:"⚠️ Please include this reference in your transfer particulars"})]}),Le("div",{className:xt.create("detail-row",{}),children:[Le("div",{className:xt.create("detail-label",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Amount"}),Le("div",{className:xt.create("detail-value",{fontSize:gt.fontSize.large,fontWeight:"600",color:gt.colors.foreground}),children:["$",e.amount.toFixed(2)," ",e.currency]})]}),Le("div",{className:xt.create("detail-row",{}),children:[Le("div",{className:xt.create("detail-label",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Name"}),Le("div",{className:xt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Le("span",{className:xt.create("detail-value",{fontFamily:"monospace",fontSize:gt.fontSize.default,color:gt.colors.foreground}),children:e.bank_account_name}),Le("button",{onClick:()=>n(e.bank_account_name,"Account name"),className:xt.create("copy-button-small",{background:"transparent",border:`1px solid ${gt.colors.border}`,borderRadius:gt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]}),Le("div",{className:xt.create("detail-row",{}),children:[Le("div",{className:xt.create("detail-label",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Number"}),Le("div",{className:xt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Le("span",{className:xt.create("detail-value",{fontFamily:"monospace",fontSize:gt.fontSize.default,color:gt.colors.foreground}),children:e.bank_account_number}),Le("button",{onClick:()=>n(e.bank_account_number,"Account number"),className:xt.create("copy-button-small",{background:"transparent",border:`1px solid ${gt.colors.border}`,borderRadius:gt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]})]}),e.instructions_html&&Le("div",{className:xt.create("additional-instructions",{marginTop:gt.spacing.md,paddingTop:gt.spacing.md,borderTop:`1px solid ${gt.colors.border}`}),children:Le("div",{className:xt.create("instructions-content",{fontSize:gt.fontSize.small,color:gt.colors.foreground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:e.instructions_html}})})]}),Le("div",{className:xt.create("important-note",{backgroundColor:gt.colors.muted,border:`1px solid ${gt.colors.border}`,borderRadius:gt.radius.default,padding:gt.spacing.md}),children:Le(ns,{size:"small",className:xt.create("note-text",{margin:"0",color:gt.colors.foreground,lineHeight:"1.5"}),children:[Le("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."]})}),Le("div",{className:xt.create("actions",{display:"flex",justifyContent:"center"}),children:Le(Xo,{onClick:t,variant:"primary",children:"I've Made the Transfer"})})]})}function gs({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r}){const{fsm:i}=Mt(()=>({})),[o,s]=tt("initiating"),[a,c]=tt(null),[l,u]=tt(null),[d,h]=tt(null),[m,f]=tt(null);nt(()=>{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?Le("div","bank_transfer"===o&&m?{className:xt.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:Le("div",{className:xt.create("modal-content",{backgroundColor:gt.colors.background,borderRadius:gt.radius.large,padding:"2rem",maxWidth:"600px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${gt.colors.border}`,margin:"auto"}),onClick:e=>e.stopPropagation(),children:Le(ps,{details:m,onClose:y})})}:{className:xt.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:[Le("div",{className:xt.create("modal-content",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${gt.colors.border}`}),children:[Le("div",{className:xt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Le("div",{className:xt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Le("h2",{className:xt.create("modal-title",{margin:"0",color:gt.colors.foreground,fontSize:gt.fontSize.large}),children:"Payment Processing"})]}),Le("div",{className:xt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Le(ns,{className:xt.create("status-message",{fontSize:gt.fontSize.default,color:gt.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&&Le(ns,{className:xt.create("error-message",{color:gt.colors.destructive,fontSize:gt.fontSize.small,padding:"0.75rem",backgroundColor:gt.colors.destructive+"10",borderRadius:gt.radius.default,border:`1px solid ${gt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Le("div",{className:xt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${gt.colors.border}`,borderTop:`3px solid ${gt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Le("div",{className:xt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Le(k,{children:[Le(Xo,{onClick:g,variant:"outline",children:"Close"}),"cancelled"===o&&Le(Xo,{onClick:()=>{s("initiating"),c(null),p()},children:"Try Again"})]}):Le(Xo,"completed"===o?{onClick:g,children:"Continue"}:{onClick:g,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Le("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function ys({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:Le("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:gt.colors.primary||"#10b981"},children:Le("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:Le("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:gt.colors.destructive},children:[Le("circle",{cx:"12",cy:"12",r:"10"}),Le("path",{d:"m15 9-6 6"}),Le("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:Le("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:gt.colors.secondary},children:[Le("circle",{cx:"12",cy:"12",r:"10"}),Le("path",{d:"m15 9-6 6"}),Le("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:Le("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:gt.colors.destructive},children:[Le("circle",{cx:"12",cy:"12",r:"10"}),Le("path",{d:"M12 8v4"}),Le("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=xt.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=xt.create("modal-content",{backgroundColor:gt.colors.background,borderRadius:gt.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${gt.borderWidth} solid ${gt.colors.border}`}),a=xt.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=xt.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:gt.colors.foreground,margin:"0"}),l=xt.create("modal-message",{color:gt.colors.foreground,lineHeight:"1.5",margin:"0"});xt.create("transaction-info",{backgroundColor:gt.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:gt.radius.small,border:`${gt.borderWidth} solid ${gt.colors.border}`,fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,wordBreak:"break-all"});const u=xt.create("modal-button",{backgroundColor:gt.colors.primary,color:gt.colors.primaryForeground,border:"none",borderRadius:gt.radius.default,padding:"0.75rem 1.5rem",fontSize:gt.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=xt.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Le("div",{className:o,onClick:r,children:Le("div",{className:s,onClick:e=>e.stopPropagation(),children:Le("div",{className:a,children:[i.icon,Le("div",{className:d,children:[Le("h2",{className:c,children:i.title}),Le("p",{className:l,children:i.message})]}),Le("button",{className:u,onClick:r,children:i.buttonText})]})})})}function vs({results:e}){const{fsm:t,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=Mt(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[s,a]=tt(!1),[c,l]=tt(null),[u,d]=tt(!1),[h,m]=tt(!1),[f,p]=tt(!1),g=new URLSearchParams(window.location.search),y=g.get("status"),v=g.get("transactionId")||g.get("transaction_id"),[w,b]=tt(!(!y||"failed"!==y&&"declined"!==y&&"cancelled"!==y)),x=e.calculations,k=e.payment_options,S=e.payment_gateways;nt(()=>{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);Pe(i,e,k.length,n,o)}},[]),nt(()=>{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 Le(Qo,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Le(It,{children:[Le("div",{className:xt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:gt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:gt.spacing.md}}),children:[Le("div",{className:xt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:gt.colors.card,boxShadow:gt.shadow.sm,borderRadius:gt.radius.large,display:"flex",flexDirection:"column"}),children:[Le("div",{className:xt.create("checkout-header",{paddingInline:gt.spacing.xl,paddingTop:gt.spacing.xl,paddingBottom:gt.spacing.lg},{"(max-width: 768px)":{paddingInline:gt.spacing.lg,paddingTop:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingTop:gt.spacing.md}}),children:[Le("h2",{className:xt.create("checkout-title",{margin:"0",marginBottom:gt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:gt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Le("p",{className:xt.create("checkout-description",{margin:"0",fontSize:gt.fontSize.default,lineHeight:"1.6",color:gt.colors.foreground,opacity:"0.9"}),children:"Choose your excess amount and payment option to secure your coverage."}),Le("hr",{className:xt.create("checkout-header-border",{marginTop:gt.spacing.lg,borderColor:gt.colors.border})})]}),Le("div",{className:xt.create("checkout-sections",{paddingInline:gt.spacing.xl,paddingBottom:gt.spacing.xl,display:"flex",flexDirection:"column",gap:gt.spacing.lg},{"(max-width: 768px)":{paddingInline:gt.spacing.lg,paddingBottom:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingBottom:gt.spacing.md}}),children:[Le(os,{excessOptions:x,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)}),Le(cs,{paymentOptions:k,paymentGateways:S,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)})]})]}),Le("div",{className:xt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Le("div",{className:xt.create("checkout-sidebar-sticky",{position:"sticky",top:gt.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:[Le(hs,{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}),Le("div",{className:xt.create("checkout-sidebar-spacer",{height:gt.spacing.lg},{"(max-width: 950px)":{height:gt.spacing.md}})}),Le("div",{className:xt.create("checkout-sidebar-card",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,boxShadow:gt.shadow.sm,padding:gt.spacing.lg},{"(max-width: 768px)":{padding:gt.spacing.md}}),children:Le(fs,{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})})]})})]}),$&&Le(ys,{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())}}),Le(gs,{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 ws({results:e}){var t,n,r;const{quoteIntent:i}=Mt(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=xt.create("referral-card",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.xl,boxShadow:gt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:gt.spacing.lg},"(max-width: 480px)":{padding:gt.spacing.md}}),l=xt.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:gt.spacing.lg}),u=xt.create("referral-icon",{width:"4rem",height:"4rem",color:gt.colors.primary}),d=xt.create("referral-header",{textAlign:"center",marginBottom:gt.spacing.xl}),h=xt.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:gt.colors.primary,marginBottom:gt.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),m=xt.create("referral-subtitle",{fontSize:gt.fontSize.default,color:gt.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),f=xt.create("referral-process-box",{backgroundColor:gt.colors.accent,borderRadius:gt.radius.default,padding:gt.spacing.lg,marginBottom:gt.spacing.xl}),p=xt.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:gt.colors.accentForeground,marginBottom:gt.spacing.md,marginTop:"0"}),g=xt.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:gt.spacing.sm}),y=xt.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:gt.fontSize.small,color:gt.colors.accentForeground,lineHeight:"1.6"}),v=xt.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:gt.colors.primary,color:gt.colors.primaryForeground,borderRadius:"50%",marginRight:gt.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),w=xt.create("referral-contact-section",{borderTop:`1px solid ${gt.colors.border}`,paddingTop:gt.spacing.xl,marginTop:gt.spacing.xl,textAlign:"center"}),b=xt.create("referral-contact-text",{fontSize:gt.fontSize.default,color:gt.colors.foreground,marginBottom:gt.spacing.lg}),x=xt.create("referral-actions",{display:"flex",gap:gt.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:gt.spacing.lg}),k=xt.create("referral-reference",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,marginTop:gt.spacing.md});return Le(Qo,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Le(It,{children:Le(Vo,{children:Le("div",{className:c,children:[Le("div",{className:l,children:Le(()=>Le("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:[Le("path",{d:"M7 10v12"}),Le("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"})]}),{})}),Le("div",{className:d,children:[Le("h1",{className:h,children:"Thanks for your quote request!"}),Le("p",{className:m,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Le("div",{className:f,children:[Le("h3",{className:p,children:"What happens next?"}),Le("ul",{className:g,children:[Le("li",{className:y,children:[Le("span",{className:v,children:"1"}),Le("span",{children:"Our team will review your application within 1-2 business days"})]}),Le("li",{className:y,children:[Le("span",{className:v,children:"2"}),Le("span",{children:"We'll contact you with either approval or additional requirements"})]}),Le("li",{className:y,children:[Le("span",{className:v,children:"3"}),Le("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),a&&Le("div",{className:w,children:[Le("p",{className:b,children:"Need to speak with someone about your quote?"}),Le("div",{className:x,children:[s&&Le(Xo,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:[Le("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:Le("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&&Le(Xo,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:[Le("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:[Le("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Le("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)&&Le("div",{className:k,children:["Quote Reference: ",Le("strong",{children:e.quote_intent.reference})]})]})]})})})})}function bs({results:e}){return"referral"===e.outcome_type?Le(ws,{results:e}):Le(vs,{results:e})}function xs({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:l="$"}){const u=rt(null),[d,h]=tt("");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}nt(()=>{h(null!=e&&""!==e?m(e):"")},[e]);const f=xt.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=xt.create("money-input-prefix",{position:"absolute",left:"1rem",color:gt.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=xt.create("money-input-with-prefix",{paddingLeft:l?"2rem":"1rem"});return Le("div",{className:f,children:[l&&Le("span",{className:p,children:l}),Le("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:Ct(a,l&&g)})]})}function ks(e){var t,n,r,i;const o=xt.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${gt.borderWidth} solid ${e.hasError?gt.colors.destructive:gt.colors.input}`,borderRadius:gt.radius.default,fontSize:gt.fontSize.default,backgroundColor:gt.colors.card,color:gt.colors.foreground,transition:gt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${gt.colors.destructive} 20%, transparent)`:"none"}),s=xt.name("input");xt.pseudoElement("input",":focus",{border:`${gt.borderWidth} solid ${gt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${gt.colors.primary} 20%, transparent)`,borderRadius:gt.radius.default});const a=xt.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${gt.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:gt.fontSize.default,backgroundColor:"transparent",color:gt.colors.foreground,outline:"none"}),c=xt.create("select-wrapper",{border:`${gt.borderWidth} solid ${e.hasError?gt.colors.destructive:gt.colors.input}`,borderRadius:gt.radius.default,backgroundColor:gt.colors.card,transition:gt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${gt.colors.destructive} 20%, transparent)`:"none"}),l=xt.name("select-wrapper");xt.pseudoElement("select-wrapper",":focus-within",{border:`${gt.borderWidth} solid ${gt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${gt.colors.primary} 20%, transparent)`,borderRadius:gt.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 Le("div",{className:Ct(c,l),children:Le("select",{...f,onChange:p,className:a,children:[e.add_null_option&&Le("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=>Le("option",{value:e.value,children:e.label},e.value))]})})}if("date"===e.type)return Le("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:Ct(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 Le("input",{...f,type:"month",value:w,onInput:v,onChange:v,className:Ct(o,s,d)})}if("year"===e.type){const b=(new Date).getFullYear();return Le("input",{...f,type:"number",min:b-100,max:b,placeholder:"YYYY",onInput:g,onChange:p,className:Ct(o,s,d)})}if("money"===e.type)return Le(xs,{value:e.value,onChange:u,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:Ct(o,s,d),hasError:e.hasError});if("checkbox"===e.type){const x=!0===e.value||"true"===e.value||"true"===e.value,k=xt.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),S=xt.create("checkbox-"+(x?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${x?gt.colors.primary:e.hasError?gt.colors.destructive:gt.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:x?gt.colors.primary:gt.colors.card,transition:gt.transition,position:"absolute"}),N=xt.name("checkbox-"+(x?"checked":"unchecked"));function _(e){e.preventDefault(),u(x?"false":"true")}return xt.pseudoElement("checkbox-"+(x?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${gt.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),Le("div",{className:k,children:[Le("input",{type:"checkbox",id:e.id,name:e.name,checked:x,onClick:_,className:Ct(S,N,d),required:e.required,readOnly:!0}),x&&Le("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:gt.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Le("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const $=xt.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),C=xt.create("boolean-radio-group",{display:"flex",gap:"1rem"}),T=xt.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),I=xt.create("boolean-radio",{accentColor:gt.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),E=xt.name("boolean-radio");xt.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${gt.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const P=xt.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${gt.borderWidth} solid ${e.hasError?gt.colors.destructive:gt.colors.input}`,borderRadius:gt.radius.default,fontSize:gt.fontSize.default,backgroundColor:gt.colors.card,color:gt.colors.foreground,transition:gt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${gt.colors.destructive} 20%, transparent)`:"none",resize:"vertical",fontFamily:gt.fontFamily}),D=xt.name("boolean-textarea");xt.pseudoElement("boolean-textarea",":focus",{border:`${gt.borderWidth} solid ${gt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${gt.colors.primary} 20%, transparent)`,borderRadius:gt.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 Le("div",{className:Ct($,d),children:[Le("div",{className:C,children:[Le("label",{className:T,children:[Le("input",{type:"radio",name:e.name,checked:M,onChange:()=>A("true"),className:Ct(I,E)}),Le("span",{children:"Yes"})]}),Le("label",{className:T,children:[Le("input",{type:"radio",name:e.name,checked:z,onChange:()=>A("false"),className:Ct(I,E)}),Le("span",{children:"No"})]})]}),j&&Le("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:Ct(P,D)})]})}return Le("input",{...f,onInput:g,onChange:p,className:Ct(o,s,d)})}function Ss({pages:t,currentPageIndex:n,completedPages:r}){const{fsm:i,lastUpdated:o,isSaving:s}=Mt(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=rt(null),c=rt(null);e(t.length),e(t.map((e,t)=>({index:t,id:e.id,title:e.title}))),nt(()=>{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)/t.length*100),u=xt.create("sidebar-nav-item-base",{display:"flex",alignItems:"flex-start",gap:gt.spacing.sm,padding:`${gt.spacing.sm} ${gt.spacing.sm}`,borderRadius:gt.radius.default,border:"none",backgroundColor:"transparent",color:gt.colors.foreground,cursor:"pointer",transition:gt.transition,textAlign:"left",width:"100%",fontFamily:gt.fontFamily,fontSize:gt.fontSize.small,opacity:"1"}),d=xt.create("sidebar-nav-item-active",{backgroundColor:gt.colors.accent,color:gt.colors.accentForeground}),h=xt.create("sidebar-nav-item-disabled",{cursor:"not-allowed",opacity:"0.5"});xt.pseudoElement("sidebar-nav-item-base",":hover",{backgroundColor:gt.colors.muted}),xt.pseudoElement("sidebar-nav-item-active",":hover",{backgroundColor:gt.colors.accent});const m=xt.create("sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:gt.colors.muted,color:gt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),f=xt.create("sidebar-indicator-active",{backgroundColor:gt.colors.accentForeground,color:gt.colors.accent}),p=xt.create("sidebar-indicator-completed",{backgroundColor:gt.colors.primary,color:gt.colors.primaryForeground}),g=xt.create("sidebar-page-title-base",{fontWeight:"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),y=xt.create("sidebar-page-title-active",{fontWeight:"600"});return Le("div",{className:xt.create("sidebar-navigation",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.lg,boxShadow:gt.shadow.sm,position:"sticky",top:gt.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:gt.spacing.lg}),children:[Le("div",{className:xt.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:gt.spacing.sm}),children:[Le("span",{className:xt.create("sidebar-progress-text",{fontSize:gt.fontSize.small,fontWeight:"600",color:gt.colors.foreground}),children:["Step ",n+1," of ",t.length]}),Le("div",{className:xt.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:gt.colors.muted,borderRadius:gt.radius.small,overflow:"hidden"}),children:Le("div",{className:xt.create("sidebar-progress-fill",{height:"100%",backgroundColor:gt.colors.primary,borderRadius:gt.radius.small,transition:gt.transition}),style:{width:`${l}%`}})})]}),Le("hr",{className:xt.create("sidebar-divider",{borderColor:gt.colors.border})}),Le("nav",{ref:c,className:xt.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:gt.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:gt.spacing.sm}),children:t.map((t,o)=>{const c=o===n,l=r.includes(o),v=i.canNavigateToPage(o);o===n&&e(t.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 Le("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:[Le("div",{className:k,children:l?Le("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:Le("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Le("div",{className:xt.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:Le("span",{className:c?`${g} ${y}`:g,children:t.title})})]},t.id)})}),Le("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&(null==i||i.reset())},className:xt.create("sidebar-reset-button",{padding:`${gt.spacing.sm} ${gt.spacing.md}`,border:`${gt.borderWidth} solid ${gt.colors.border}`,borderRadius:gt.radius.default,backgroundColor:"transparent",color:gt.colors.mutedForeground,fontSize:gt.fontSize.small,fontFamily:gt.fontFamily,cursor:"pointer",transition:gt.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),o&&Le("div",{className:xt.create("sidebar-last-saved",{fontSize:"0.6875rem",color:gt.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Go.fromJSDate(new Date(o)).toFormat("T")]})]})}function Ns({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=Mt(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=tt(!1),a=Math.round((t+1)/e.length*100),c=xt.create("mobile-sidebar-item-base",{display:"flex",alignItems:"center",gap:gt.spacing.sm,padding:gt.spacing.sm,border:"none",borderRadius:gt.radius.default,backgroundColor:"transparent",color:gt.colors.foreground,cursor:"pointer",opacity:"1",transition:gt.transition,width:"100%",textAlign:"left",fontFamily:gt.fontFamily}),l=xt.create("mobile-sidebar-item-active",{backgroundColor:gt.colors.accent,color:gt.colors.accentForeground}),u=xt.create("mobile-sidebar-item-disabled",{cursor:"not-allowed",opacity:"0.5"}),d=xt.create("mobile-sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:gt.colors.muted,color:gt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),h=xt.create("mobile-sidebar-indicator-active",{backgroundColor:gt.colors.accentForeground,color:gt.colors.accent}),m=xt.create("mobile-sidebar-indicator-completed",{backgroundColor:gt.colors.primary,color:gt.colors.primaryForeground}),f=xt.create("mobile-sidebar-page-title-base",{fontSize:gt.fontSize.small,fontWeight:"500"}),p=xt.create("mobile-sidebar-page-title-active",{fontWeight:"600"});return Le("div",{className:xt.create("mobile-sidebar",{overflow:"hidden"}),children:[Le("button",{onClick:()=>s(!o),className:xt.create("mobile-sidebar-header",{width:"100%",padding:gt.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:gt.spacing.sm}),children:[Le("div",{className:xt.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Le("span",{className:xt.create("mobile-sidebar-step-text",{fontSize:gt.fontSize.small,fontWeight:"600",color:gt.colors.foreground}),children:["Step ",t+1," of ",e.length]}),Le("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:xt.create("mobile-sidebar-chevron",{transition:gt.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:gt.colors.mutedForeground}),children:Le("path",{d:"m6 9 6 6 6-6"})})]}),Le("div",{className:xt.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:gt.colors.muted,borderRadius:gt.radius.small,overflow:"hidden"}),children:Le("div",{className:xt.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:gt.colors.primary,borderRadius:gt.radius.small,transition:gt.transition}),style:{width:`${a}%`}})})]}),Le("hr",{className:xt.create("mobile-sidebar-border",{borderColor:gt.colors.border})}),o&&Le("div",{className:xt.create("mobile-sidebar-content",{padding:gt.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 Le("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:[Le("div",{className:x,children:g?Le("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:Le("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Le("span",{className:a?`${f} ${p}`:f,children:e.title})]},e.id)})})]})}function _s({organisation:e}){return Le("div",{className:xt.create("welcome-card",{paddingInline:gt.spacing.lg,paddingTop:gt.spacing.lg},{"(max-width: 950px)":{paddingInline:gt.spacing.lg,paddingTop:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingTop:gt.spacing.md}}),children:[Le("h2",{className:xt.create("welcome-title",{margin:"0",marginBottom:gt.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:gt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:gt.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),Le("p",{className:xt.create("welcome-text",{margin:"0",fontSize:gt.fontSize.default,lineHeight:"1.6",color:gt.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."}),Le("hr",{className:xt.create("welcome-border",{marginTop:gt.spacing.lg,borderColor:gt.colors.border})})]})}function $s({title:e,description:t}){return Le(Qo,{title:e,description:t,children:Le(It,{children:Le(Vo,{className:xt.name("error-container"),children:Le("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:[Le("path",{d:"M4.929 4.929 19.07 19.071"}),Le("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function Cs({errors:e,className:t}){return e&&0!==e.length?Le("div",{className:xt.create("field-error",{color:gt.colors.destructive,fontSize:gt.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>Le("span",{className:xt.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function Ts({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=tt(!1);return Le("label",{for:e,className:xt.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Le("span",{className:xt.create("label-text",{marginBottom:gt.spacing.sm,fontSize:gt.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:gt.spacing.sm,color:gt.colors.foreground}),children:[Le("span",{children:[t,r&&Le("span",{className:xt.create("label-required-indicator",{color:gt.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Le("span",{className:xt.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Le("svg",{className:xt.create("tooltip-icon",{width:"1rem",height:"1rem",color:gt.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Le("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Le("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Le("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Le("span",{className:xt.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:gt.colors.popover,color:gt.colors.popoverForeground,fontSize:"0.875rem",borderRadius:gt.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Le("span",{className:xt.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 ${gt.colors.popover}`})})]})]})]}),n]})}function Is(e){switch(null!=e?e:100){case 25:return xt.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return xt.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return xt.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return xt.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return xt.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return xt.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function Es(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 Ps({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=xt.create("validated-field",{display:"flex",flexDirection:"column",gap:gt.spacing.sm});if("checkbox"===e.type){const t=xt.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:gt.spacing.sm}),a=xt.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=xt.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),l=xt.create("checkbox-label-text",{fontSize:gt.fontSize.default,fontWeight:"600",color:gt.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Le("div",{className:Ct(s,Is(e.width),r),children:[Le("div",{className:t,children:Le("div",{className:a,children:[Le("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Le("label",{htmlFor:i,className:c,children:[Le("span",{className:l,children:[e.label,e.required&&Le("span",{className:xt.create("checkbox-required-indicator",{color:gt.colors.destructive}),children:"*"})]}),e.description&&Le("div",{className:xt.create("checkbox-field-description",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:Es(e.description)}})]})]})}),Le(Cs,{errors:o})]})}return Le("div",{className:Ct(s,Is(e.width),r),children:[Le(Ts,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&Le("div",{className:xt.create("field-description",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,marginBottom:gt.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:Es(e.description)}}),n]}),Le(Cs,{errors:o})]})}function Ds({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:gt.colors.secondary+"08",borderColor:gt.colors.secondary+"30",iconColor:gt.colors.secondary,titleColor:gt.colors.foreground},error:{backgroundColor:gt.colors.destructive+"08",borderColor:gt.colors.destructive,iconColor:gt.colors.destructive,titleColor:gt.colors.destructive},critical:{backgroundColor:gt.colors.destructive+"10",borderColor:gt.colors.destructive,iconColor:gt.colors.destructive,titleColor:gt.colors.destructive}}[e.severity],o=xt.create("error-card",{padding:gt.spacing.md,borderRadius:gt.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:gt.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=xt.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=xt.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=xt.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),l=xt.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=xt.create("error-card-title",{fontSize:gt.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=xt.create("error-card-message",{fontSize:gt.fontSize.small,color:gt.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=xt.create("error-card-details",{fontSize:"0.8125rem",color:gt.colors.mutedForeground,fontFamily:"monospace",backgroundColor:gt.colors.muted,padding:"0.625rem",borderRadius:gt.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),m=xt.create("error-card-support",{fontSize:"0.8125rem",color:gt.colors.mutedForeground,lineHeight:"1.4"}),f=xt.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:gt.colors.mutedForeground,cursor:"pointer",borderRadius:gt.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:gt.transition});return xt.pseudoElement("error-card-dismiss",":hover",{backgroundColor:gt.colors.muted,color:gt.colors.foreground}),Le("div",{className:Ct(o,n),children:Le("div",{className:s,children:[Le(()=>"warning"===e.severity?Le("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Le("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"})}):Le("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Le("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"})}),{}),Le("div",{className:c,children:[Le("div",{className:l,children:[Le("div",{className:u,children:e.title}),Le("div",{className:d,children:e.message}),r&&e.details&&Le("div",{className:h,children:e.details}),Le("div",{className:m,children:Se(e)})]}),t&&Le("button",{className:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Le("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:[Le("path",{d:"M18 6 6 18"}),Le("path",{d:"m6 6 12 12"})]})})]})]})})}function Ms(){const{definition:t,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=Mt(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=t.pages[n];if(!l)return Le($s,{title:"Unexpected Error",description:"No page available"});const u=rt(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 Le(Qo,{title:l.title,description:l.description,hideHeader:!0,children:Le("div",{children:[y&&Le(ys,{type:g.paymentStatus,transactionId:g.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Le(It,{children:Le("div",{className:xt.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:gt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Le("div",{className:xt.create("form-content-wrapper",{minWidth:"0",backgroundColor:gt.colors.card,boxShadow:gt.shadow.sm,borderRadius:gt.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Le("div",{className:xt.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Le(Ns,{pages:t.pages,currentPageIndex:n,completedPages:v})}),n>0&&Le("div",{className:xt.create("page-heading-container",{paddingInline:gt.spacing.lg,paddingTop:gt.spacing.lg},{"(max-width: 950px)":{paddingInline:gt.spacing.lg,paddingTop:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingTop:gt.spacing.md}}),children:[Le("div",{className:xt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:gt.spacing.lg}),children:Le("div",{className:xt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Le("h1",{className:xt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:gt.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:l.title}),l.description&&Le("p",{className:xt.create("page-template-description",{margin:"0",marginTop:gt.spacing.sm,fontSize:gt.fontSize.small,lineHeight:"1.5",color:gt.colors.foreground,opacity:"0.7"}),children:l.description})]})}),Le("hr",{className:xt.create("page-heading-border",{marginTop:gt.spacing.lg,borderColor:gt.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Le(_s,{organisation:s.organisation}),o.length>0&&o.map(e=>Le(Ds,{error:e,onDismiss:()=>c.dismissGeneralError(e.id)},e.id)),Le("div",{className:xt.create("form-card",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.lg,boxShadow:gt.shadow.sm,display:"flex",flexDirection:"column",gap:gt.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:gt.spacing.md,gap:gt.spacing.lg},"(max-width: 480px)":{padding:gt.spacing.md,gap:gt.spacing.md}}),children:[Le("form",{onSubmit:e=>e.preventDefault(),className:xt.create("form-fields-container",{flex:"1"}),children:Le("div",{className:xt.create("form-content-page",{display:"grid",gap:gt.spacing.md,rowGap:gt.spacing.lg,gridTemplateColumns:"repeat(12, 1fr)"}),children:l.fields.map(t=>{const n=t.code||t.id;return(t=>{if(!t.visibility)return!0;const n=t.visibility.conditions.map(e=>"field"in e?e.field:null).filter(Boolean);n.length>0&&(e((t.label,t.code)),e(Object.keys(p)),n.forEach(t=>{t&&e()}));const r=ie(p,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions}),i="show"===t.visibility.action?r.matched:!r.matched;return u.current.get(t.id)!==i&&(e((t.label,t.code)),e(),u.current.set(t.id,i)),i})(t)?Le(Ps,{field:t,errors:i,children:Le(ks,{value:d(n,t).toString(),onChange:e=>{let r=e;"boolean"!==t.type&&"checkbox"!==t.type||(r="true"===e),c.updateFieldValue(l.id,n,r)},answer:m(n),onAnswerChange:e=>{var r;c.updateFieldAnswer(l.id,n,e,null===(r=t.boolean_config)||void 0===r?void 0:r.details_rating_factor_id)},id:n,name:n,type:t.type,placeholder:t.placeholder,validation:t.validation,booleanConfig:t.boolean_config,add_null_option:t.add_null_option,null_option_label:t.null_option_label,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n)})},t.id):null})})}),Le("hr",{className:xt.create("form-navigation-border",{borderColor:gt.colors.border})}),Le("div",{className:xt.create("form-navigation-inline",{paddingTop:gt.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Le(Xo,{onClick:()=>null==c?void 0:c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Le(Xo,{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"})]})]})]}),Le("div",{className:xt.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Le(Ss,{pages:t.pages,currentPageIndex:n,completedPages:v})})]})})]})})}function zs(){var e,t,n;const{quoteIntent:r,fsm:i}=Mt(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;nt(()=>{if(s&&r){const e=null==o?void 0:o.paymentStatus,t=null==a?void 0:a.amount;"success"===e&&a?ze(r,s,t||0,a.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&Re(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=xt.create("success-card",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.xl,boxShadow:gt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:gt.spacing.lg},"(max-width: 480px)":{padding:gt.spacing.md}}),m=xt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:gt.spacing.lg}),f=xt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=xt.create("success-header",{textAlign:"center",marginBottom:gt.spacing.xl}),g=xt.create("success-title",{margin:"0",marginBottom:gt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:gt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=xt.create("success-message",{fontSize:gt.fontSize.default,lineHeight:"1.6",color:gt.colors.foreground,opacity:"0.9",margin:"0"}),v=xt.create("success-contact-section",{borderTop:`1px solid ${gt.colors.border}`,paddingTop:gt.spacing.xl,marginTop:gt.spacing.xl}),w=xt.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:gt.colors.foreground,marginBottom:gt.spacing.md,textAlign:"center"}),b=xt.create("success-contact-details",{backgroundColor:gt.colors.accent,borderRadius:gt.radius.default,padding:gt.spacing.md,display:"flex",flexDirection:"column",gap:gt.spacing.sm,marginBottom:gt.spacing.lg}),x=xt.create("success-contact-item",{display:"flex",alignItems:"center",gap:gt.spacing.sm,fontSize:gt.fontSize.small,color:gt.colors.accentForeground}),k=xt.create("success-actions",{display:"flex",gap:gt.spacing.md,flexWrap:"wrap",justifyContent:"center"}),S=xt.create("success-reference",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,textAlign:"center",marginTop:gt.spacing.md});return Le(Qo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le(Vo,{children:Le("div",{className:h,children:[Le("div",{className:m,children:Le("div",{className:f,children:Le("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:Le("path",{d:"M20 6 9 17l-5-5"})})})}),Le("div",{className:p,children:[Le("h1",{className:g,children:"Payment Complete!"}),Le("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&&Le("div",{className:v,children:[Le("h3",{className:w,children:"Need assistance?"}),Le("div",{className:b,children:[l&&Le("div",{className:x,children:[Le("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:[Le("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Le("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Le("span",{children:l})]}),u&&Le("div",{className:x,children:[Le("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:Le("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"})}),Le("span",{children:u})]})]}),Le("div",{className:k,children:[u&&Le(Xo,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[Le("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:Le("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&&Le(Xo,{variant:"outline",onClick:()=>window.open(`mailto:${l}`),children:[Le("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:[Le("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Le("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),r.reference&&Le("div",{className:S,children:["Quote Reference: ",Le("strong",{children:r.reference})]})]})})})})}function Rs({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,s]=tt("initiating"),[a,c]=tt(null),[l,u]=tt(null),[d,h]=tt(null);nt(()=>{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?Le("div",{className:xt.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:[Le("div",{className:xt.create("modal-content",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${gt.colors.border}`}),children:[Le("div",{className:xt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Le("div",{className:xt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Le("h2",{className:xt.create("modal-title",{margin:"0",color:gt.colors.foreground,fontSize:gt.fontSize.large}),children:"Payment Processing"})]}),Le("div",{className:xt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Le(ns,{className:xt.create("status-message",{fontSize:gt.fontSize.default,color:gt.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&&Le(ns,{className:xt.create("error-message",{color:gt.colors.destructive,fontSize:gt.fontSize.small,padding:"0.75rem",backgroundColor:gt.colors.destructive+"10",borderRadius:gt.radius.default,border:`1px solid ${gt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Le("div",{className:xt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${gt.colors.border}`,borderTop:`3px solid ${gt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Le("div",{className:xt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Le(k,{children:[Le(Xo,{onClick:f,variant:"outline",children:"Close"}),"cancelled"===o&&Le(Xo,{onClick:()=>{s("initiating"),c(null),m()},children:"Try Again"})]}):Le(Xo,"completed"===o?{onClick:f,children:"Continue"}:{onClick:f,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Le("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Os({transactionId:e,organisationId:t}){const{httpClient:n}=Dt(),[r,i]=tt(!0),[o,s]=tt(null),[a,c]=tt(null),[l,u]=tt(!1),[d,h]=tt(!1),[m,f]=tt(!1);nt(()=>{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?Le(Ko,{message:"Loading payment details..."}):o?Le(Qo,{title:"Error",description:"Failed to load bank transfer details",noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le(Vo,{children:Le("div",{className:xt.create("error-card",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.xl,boxShadow:gt.shadow.sm,maxWidth:"42rem",margin:"0 auto",textAlign:"center"},{"(max-width: 480px)":{padding:gt.spacing.lg}}),children:[Le("div",{className:xt.create("error-icon",{fontSize:"3rem",marginBottom:gt.spacing.md,color:gt.colors.destructive}),children:"⚠️"}),Le("h2",{className:xt.create("error-title",{margin:"0",marginBottom:gt.spacing.sm,color:gt.colors.foreground}),children:"Error Loading Payment Details"}),Le("p",{className:xt.create("error-message",{color:gt.colors.mutedForeground}),children:o})]})})})}):a?Le(Qo,{title:"Bank Transfer Payment",description:"Complete your payment via bank transfer",noSubscription:!0,hideHeader:!0,children:Le(It,{children:[Le(Vo,{children:Le("div",{className:xt.create("bank-transfer-container",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,maxWidth:"42rem",margin:"0 auto",overflow:"hidden",boxShadow:"0 20px 60px rgba(0,0,0,0.1)"}),children:[Le("div",{style:{backgroundColor:gt.colors.primary},className:xt.create("bank-transfer-header",{color:"white",padding:"2.5rem 2rem",textAlign:"center"},{"(max-width: 480px)":{padding:"1.5rem 1rem"}}),children:[Le("h1",{className:xt.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"}),Le("p",{className:xt.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:gt.fontSize.small}}),children:"Complete your payment using the details below"})]}),Le("div",{className:xt.create("bank-transfer-content",{padding:"2rem"},{"(max-width: 480px)":{padding:"1rem"}}),children:[Le("div",{className:xt.create("payment-details-card",{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:gt.radius.default,padding:"1.5rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Le("div",{className:xt.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:[Le("span",{className:xt.create("detail-label",{color:"#6b7280",fontSize:gt.fontSize.default}),children:"Amount to Transfer"}),Le("span",{className:xt.create("detail-value-amount",{color:gt.colors.primary,fontSize:"1.5rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:["$",a.amount.toFixed(2)," ",a.currency]})]}),Le("div",{className:xt.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:[Le("span",{className:xt.create("detail-label",{color:"#6b7280",fontSize:gt.fontSize.default}),children:"Account Name"}),Le("span",{className:xt.create("detail-value",{color:gt.colors.foreground,fontSize:gt.fontSize.default,fontWeight:"600"}),children:a.bank_account_name})]}),Le("div",{className:xt.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:[Le("span",{className:xt.create("detail-label",{color:"#6b7280",fontSize:gt.fontSize.default}),children:"Account Number"}),Le("span",{className:xt.create("detail-value",{color:gt.colors.foreground,fontSize:gt.fontSize.default,fontWeight:"600"}),children:a.bank_account_number})]}),Le("div",{className:xt.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:[Le("span",{className:xt.create("detail-label",{color:"#6b7280",fontSize:gt.fontSize.default}),children:"Payment Reference"}),Le("span",{className:xt.create("detail-value",{color:gt.colors.foreground,fontSize:gt.fontSize.default,fontWeight:"600"}),children:a.reference})]})]}),Le("div",{className:xt.create("instructions-card",{backgroundColor:"#eff6ff",borderLeft:`4px solid ${gt.colors.primary}`,borderRadius:gt.radius.default,padding:"1.25rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Le("h3",{className:xt.create("instructions-title",{margin:"0 0 0.75rem 0",fontSize:gt.fontSize.default,fontWeight:"600",color:gt.colors.foreground}),children:"Payment Instructions"}),Le("p",{className:xt.create("instructions-text",{margin:"0 0 0.75rem 0",fontSize:gt.fontSize.small,lineHeight:"1.6",color:gt.colors.foreground}),children:[Le("strong",{children:"Important:"})," Please include the payment reference when making your transfer to ensure your payment is processed correctly."]}),Le("p",{className:xt.create("instructions-text",{margin:"0",fontSize:gt.fontSize.small,lineHeight:"1.6",color:gt.colors.foreground}),children:"Once we receive your payment, we'll process your quote and send you a confirmation email."})]}),Le("div",{className:xt.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:[Le("button",{onClick:()=>{u(!0)},style:{backgroundColor:gt.colors.primary},className:xt.create("confirm-button",{color:"white",border:"none",borderRadius:gt.radius.default,padding:"0.75rem 2rem",fontSize:gt.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"}),Le("button",{onClick:()=>{h(!0)},className:xt.create("cancel-button",{color:"#6b7280",backgroundColor:"white",border:"2px solid #e5e7eb",borderRadius:gt.radius.default,padding:"0.75rem 2rem",fontSize:gt.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"all 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"Cancel"})]}),Le("p",{className:xt.create("footer-text",{textAlign:"center",color:"#6b7280",fontSize:gt.fontSize.small,margin:"0"}),children:"Your quote has been saved. We'll process it once payment is received."})]})]})}),d&&Le("div",{className:xt.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:Le("div",{className:xt.create("modal-content",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${gt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:gt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Le("div",{className:xt.create("warning-icon",{fontSize:"4rem",marginBottom:gt.spacing.md}),children:"⚠️"}),Le("h3",{className:xt.create("modal-title",{margin:"0",marginBottom:gt.spacing.sm,color:gt.colors.foreground,fontSize:gt.fontSize.large,fontWeight:"600"}),children:"Are you sure?"}),Le("p",{className:xt.create("modal-message",{margin:"0",marginBottom:gt.spacing.lg,color:gt.colors.foreground,lineHeight:"1.6"}),children:"This will take you back to the checkout page."}),Le("div",{className:xt.create("modal-buttons",{display:"flex",flexDirection:"column-reverse",gap:"0.75rem",justifyContent:"center"}),children:[Le("button",{onClick:()=>h(!1),disabled:m,className:xt.create("no-button",{backgroundColor:"#f3f4f6",color:gt.colors.foreground,border:"none",borderRadius:gt.radius.default,padding:`${gt.spacing.sm} ${gt.spacing.lg}`,fontSize:gt.fontSize.default,fontWeight:"500",cursor:m?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:m?"0.5":"1",width:"100%"}),children:"No, Go Back"}),Le("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:xt.create("yes-button",{backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:gt.radius.default,padding:`${gt.spacing.sm} ${gt.spacing.lg}`,fontSize:gt.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&&Le("div",{className:xt.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:Le("div",{className:xt.create("modal-content",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${gt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:gt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Le("div",{className:xt.create("success-icon",{fontSize:"4rem",marginBottom:gt.spacing.md}),children:"✓"}),Le("h3",{className:xt.create("modal-title",{margin:"0",marginBottom:gt.spacing.sm,color:gt.colors.primary,fontSize:gt.fontSize.large,fontWeight:"600"}),children:"Thank You!"}),Le("p",{className:xt.create("modal-message",{margin:"0",marginBottom:gt.spacing.lg,color:gt.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."}),Le("button",{onClick:()=>u(!1),className:xt.create("close-button",{backgroundColor:gt.colors.primary,color:"white",border:"none",borderRadius:gt.radius.default,padding:`${gt.spacing.sm} ${gt.spacing.lg}`,fontSize:gt.fontSize.default,fontWeight:"500",cursor:"pointer",transition:"opacity 150ms ease"}),children:"Close"})]})})]})}):null}xt.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:gt.colors.muted,borderColor:gt.colors.primary,color:gt.colors.primary});class js{static async loadTheme(t){try{if(e(t.slug),e(t.theme_url),this.loadedThemes.has(t.slug))return void e(t.slug);const n=await fetch(t.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();e(r.substring(0,200));const i=this.parseCSSContent(r);e(i.mappedVariables),e(i.classRules.length),this.applyParsedTheme(t.slug,i),this.loadedThemes.add(t.slug),e(t.slug)}catch(n){throw e(t.slug),n}}static parseCSSContent(t){e();const n={},r={};let i="";const o=t.match(/:root\s*\{([^}]+)\}/);if(o){const t=o[1];e(null==t||t.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(t));){const t=`--${s[1]}`,i=s[2].trim();n[t]=i;const o=this.variableMapping[t];o?(r[o]=i,e()):e()}}else e();return i=t.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&e(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(t,n){e(),Promise.resolve().then(function(){return kt}).then(({updateBaseVariables:t})=>{Object.keys(n.mappedVariables).length>0&&(e(n.mappedVariables),t(n.mappedVariables))}).catch(()=>{e()}),n.classRules&&this.applyClassRules(t,n.classRules),this.injectOriginalCSS(t,n)}static applyClassRules(t,n){const r=document.getElementById(`insure-os-theme-classes-${t}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${t}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),e()}}static injectOriginalCSS(t,n){const r=document.getElementById(`insure-os-theme-original-${t}`);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-${t}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),e()}}static removeTheme(t){let n=!1;[`insure-os-theme-classes-${t}`,`insure-os-theme-original-${t}`].forEach(e=>{const t=document.getElementById(e);t&&(t.remove(),n=!0)}),n&&(this.loadedThemes.delete(t),e())}static isThemeLoaded(e){return this.loadedThemes.has(e)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}js.loadedThemes=new Set,js.variableMapping={"--color-primary":"--insure-os-primary","--color-primary-foreground":"--insure-os-primary-foreground","--color-secondary":"--insure-os-secondary","--color-secondary-foreground":"--insure-os-secondary-foreground","--color-accent":"--insure-os-accent","--color-accent-foreground":"--insure-os-accent-foreground","--color-background":"--insure-os-background","--color-foreground":"--insure-os-foreground","--color-card":"--insure-os-card","--color-card-foreground":"--insure-os-card-foreground","--color-popover":"--insure-os-popover","--color-popover-foreground":"--insure-os-popover-foreground","--color-muted":"--insure-os-muted","--color-muted-foreground":"--insure-os-muted-foreground","--color-destructive":"--insure-os-destructive","--color-border":"--insure-os-border","--color-input":"--insure-os-input","--color-ring":"--insure-os-ring","--font-sans":"--insure-os-font-family","--radius":"--insure-os-radius","--radius-sm":"--insure-os-radius-sm","--radius-lg":"--insure-os-radius-lg"};var As=Object.freeze({__proto__:null,ThemeLoader:js});function Ws({paymentLinkId:t,signedUrl:n}){var r,i,o,s,a,c;const l=Dt().httpClient,[u,d]=tt(null),[h,m]=tt(!0),[f,p]=tt(null),[g,y]=tt(!1),[v,w]=tt(null),[b,x]=tt(null),[S,N]=tt(null),[_,$]=tt(!1),[C,T]=tt(null),[I,E]=tt(null),[P,D]=tt(()=>(new Date).toISOString().split("T")[0]),[M,z]=tt(null),[R,O]=tt(!1),[j,A]=tt(null),[W,L]=tt(null);nt(()=>{B()},[t]);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(t);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 t=h.pending_bank_transfer;if(e(),L({transactionId:t.transaction_id,organisationId:(null===(r=h.organisation)||void 0===r?void 0:r.id)||""}),h.organisation&&h.organisation.theme)try{await js.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(t){e()}return}if(h.organisation&&h.organisation.theme)try{await js.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(t){e()}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=it(()=>u&&b?u.calculations.find(e=>e.id===b):null,[u,b]),q=it(()=>u&&S?u.payment_options.find(e=>e.gateway_code===S):null,[u,S]);if(W)return Le(Os,{transactionId:W.transactionId,organisationId:W.organisationId});if(h)return Le(Qo,{title:"Loading...",noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le("div",{className:xt.create("payment-link-loading-card",{textAlign:"center",padding:gt.spacing.xl,backgroundColor:gt.colors.card,borderRadius:gt.radius.large,boxShadow:gt.shadow.sm,maxWidth:"600px",margin:"0 auto"}),children:Le("p",{className:xt.create("loading-text",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.default}),children:"Loading payment details..."})})})});if(f)return Le(Qo,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le("div",{className:xt.create("payment-link-error-card",{textAlign:"center",padding:gt.spacing.xl,backgroundColor:gt.colors.card,borderRadius:gt.radius.large,boxShadow:gt.shadow.sm,border:`2px solid ${gt.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Le("h2",{className:xt.create("error-title",{color:gt.colors.destructive,marginBottom:gt.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"Payment Link Error"}),Le("p",{className:xt.create("error-message",{color:gt.colors.foreground,fontSize:gt.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 Le(Qo,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le("div",{className:xt.create("payment-success-card",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.xl,boxShadow:gt.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Le("div",{className:xt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:gt.spacing.lg}),children:Le("div",{className:xt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Le("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:Le("path",{d:"M20 6 9 17l-5-5"})})})}),Le("div",{className:xt.create("success-header",{textAlign:"center",marginBottom:gt.spacing.xl}),children:[Le("h1",{className:xt.create("success-title",{margin:"0",marginBottom:gt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:gt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Payment Complete!"}),Le("p",{className:xt.create("success-message",{fontSize:gt.fontSize.default,lineHeight:"1.6",color:gt.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&Le("div",{className:xt.create("contact-section",{borderTop:`1px solid ${gt.colors.border}`,paddingTop:gt.spacing.xl,marginTop:gt.spacing.xl}),children:[Le("h3",{className:xt.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:gt.colors.foreground,marginBottom:gt.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Le("div",{className:xt.create("contact-details",{backgroundColor:gt.colors.accent,borderRadius:gt.radius.default,padding:gt.spacing.md,display:"flex",flexDirection:"column",gap:gt.spacing.sm,marginBottom:gt.spacing.lg}),children:[e&&Le("div",{className:xt.create("contact-item",{display:"flex",alignItems:"center",gap:gt.spacing.sm,fontSize:gt.fontSize.small,color:gt.colors.accentForeground}),children:Le("span",{children:["Email: ",e]})}),t&&Le("div",{className:xt.create("contact-item",{display:"flex",alignItems:"center",gap:gt.spacing.sm,fontSize:gt.fontSize.small,color:gt.colors.accentForeground}),children:Le("span",{children:["Phone: ",t]})})]}),(I||U)&&Le("div",{className:xt.create("reference",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,textAlign:"center",marginTop:gt.spacing.md}),children:["Transaction ID: ",Le("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 Le(Qo,{title:"Payment Unsuccessful",noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le("div",{className:xt.create("payment-error-card",{textAlign:"center",padding:gt.spacing.xl,backgroundColor:gt.colors.card,borderRadius:gt.radius.large,boxShadow:gt.shadow.sm,border:`2px solid ${gt.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Le("h2",{className:xt.create("error-title",{color:gt.colors.destructive,marginBottom:gt.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"cancelled"===Z||"cancelled"===C?"Payment Cancelled":"Payment Failed"}),Le("p",{className:xt.create("error-message",{color:gt.colors.foreground,fontSize:gt.fontSize.default,margin:"0",marginBottom:gt.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."}),Le(Xo,{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)&&S&&!M&&!R),te=it(()=>{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=it(()=>F&&F.line_item_display||null,[F]);return Le(Qo,{title:"Complete Your Purchase",noSubscription:!0,hideHeader:!0,children:Le(It,{children:[Le("div",{className:xt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:gt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:gt.spacing.md}}),children:[Le("div",{className:xt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:gt.colors.card,boxShadow:gt.shadow.sm,borderRadius:gt.radius.large,display:"flex",flexDirection:"column"}),children:[Le("div",{className:xt.create("checkout-header",{paddingInline:gt.spacing.xl,paddingTop:gt.spacing.xl,paddingBottom:gt.spacing.lg},{"(max-width: 768px)":{paddingInline:gt.spacing.lg,paddingTop:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingTop:gt.spacing.md}}),children:[Le("h2",{className:xt.create("checkout-title",{margin:"0",marginBottom:gt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:gt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Le("p",{className:xt.create("checkout-description",{margin:"0",fontSize:gt.fontSize.default,lineHeight:"1.6",color:gt.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."}),Le("hr",{className:xt.create("checkout-header-border",{marginTop:gt.spacing.lg,borderColor:gt.colors.border})})]}),Le("div",{className:xt.create("checkout-sections",{paddingInline:gt.spacing.xl,paddingBottom:gt.spacing.xl,display:"flex",flexDirection:"column",gap:gt.spacing.lg},{"(max-width: 768px)":{paddingInline:gt.spacing.lg,paddingBottom:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingBottom:gt.spacing.md}}),children:[X&&Le("div",{className:xt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Le(rs,{title:"Cover Start Date"}),Le("div",{className:xt.create("cover-date-container",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:[Le("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:xt.create("cover-date-input",{padding:"0.75rem 1rem",fontSize:gt.fontSize.default,border:`2px solid ${M?gt.colors.destructive:gt.colors.border}`,borderRadius:gt.radius.default,backgroundColor:gt.colors.background,color:gt.colors.foreground,width:"auto",maxWidth:"200px",cursor:R?"wait":"pointer"})}),R&&Le("p",{className:xt.create("validating-text",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,margin:"0"}),children:"Validating..."}),M&&Le("div",{className:xt.create("cover-date-error",{backgroundColor:`${gt.colors.destructive}10`,border:`1px solid ${gt.colors.destructive}`,borderRadius:gt.radius.default,padding:"1rem"}),children:[Le("p",{className:xt.create("error-message",{color:gt.colors.destructive,fontSize:gt.fontSize.small,margin:"0",marginBottom:j?gt.spacing.md:"0"}),children:M}),j&&Le("a",{href:j,className:xt.create("new-quote-link",{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:gt.colors.primary,fontSize:gt.fontSize.small,fontWeight:"500",textDecoration:"none"}),children:["Start New Quote",Le("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:[Le("path",{d:"M5 12h14"}),Le("path",{d:"m12 5 7 7-7 7"})]})]})]})]})]}),Q&&J&&Le("div",{className:xt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Le(rs,{title:"Excess Options"}),Le("div",{className:xt.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 Le("div",{className:Ct(xt.create("excess-option-card",{borderRadius:gt.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),t?xt.create("excess-option-card-selected",{border:`2px solid ${gt.colors.primary}`,backgroundColor:gt.colors.accent}):xt.create("excess-option-card-unselected",{border:`2px solid ${gt.colors.border}`,backgroundColor:gt.colors.card})),onClick:()=>x(e.id),children:[Le(is,{selected:t}),Le("div",{className:xt.create("excess-amount",{color:gt.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})}),(null==F?void 0:F.description)&&Le("div",{className:xt.create("excess-description",{padding:"0.75rem",backgroundColor:gt.colors.muted,borderRadius:gt.radius.default,border:`1px solid ${gt.colors.border}`}),children:Le(ns,{className:xt.create("excess-description-text",{fontSize:gt.fontSize.small,color:gt.colors.foreground,margin:"0"}),children:F.description})})]}),u.payment_options.length>0&&Le("div",{className:xt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Le(rs,{title:"Payment Options"}),Le("div",{className:xt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:u.payment_options.map(e=>{const t=S===e.gateway_code,n="monthly"===e.payment_frequency,r=()=>{var t;return n&&e.amount.monthly?`${ss(parseFloat(e.amount.monthly))} x ${(null===(t=e.metadata)||void 0===t?void 0:t.number_of_instalments)||12}`:ss(parseFloat(e.amount.due_today))},i=()=>"bank_transfer"===e.gateway_code?"Manual":`via ${e.gateway_name}`;return Le("div",{className:Ct(xt.create("payment-option-row",{borderRadius:gt.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?xt.create("payment-option-row-selected",{border:`2px solid ${gt.colors.primary}`,backgroundColor:gt.colors.accent}):xt.create("payment-option-row-unselected",{border:`2px solid ${gt.colors.border}`,backgroundColor:gt.colors.card})),onClick:()=>N(e.gateway_code),children:[Le("div",{className:xt.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Le(is,{selected:t}),Le("div",{className:xt.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Le("div",{className:xt.create("frequency-title",{fontSize:gt.fontSize.default,fontWeight:"500",color:gt.colors.foreground}),children:as(n?"monthly":"one-time",e.gateway_code)}),Le("div",{className:xt.create("gateway-description",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground}),children:i()})]})]}),Le("div",{className:xt.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Le(ns,{className:xt.create("amount-text",{textAlign:"right",color:gt.colors.foreground}),children:r()}),"bank_transfer"!==e.gateway_code&&Le(ns,{size:"small",className:xt.create("gateway-fee-text",{textAlign:"right",color:gt.colors.mutedForeground}),children:["bank_transfer"===e.gateway_code?null:n&&(null===(o=e.metadata)||void 0===o?void 0:o.total_interest)?ss(e.metadata.total_interest):ss(0)," fee"]}),"bank_transfer"===e.gateway_code&&Le(ns,{size:"small",className:xt.create("no-fee-text",{textAlign:"right",color:gt.colors.mutedForeground}),children:"No fees"})]}),Le("div",{className:xt.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Le(is,{selected:t}),Le("div",{className:xt.create("payment-option-title-mobile",{fontSize:gt.fontSize.default,fontWeight:"500",color:gt.colors.foreground}),children:as(n?"monthly":"one-time",e.gateway_code)})]}),Le("div",{className:xt.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:[Le("div",{className:xt.create("gateway-description-mobile",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground}),children:i()}),Le(ns,{className:xt.create("amount-text-mobile",{fontWeight:"500",color:gt.colors.foreground}),children:r()})]})]},e.gateway_code);var o})})]})]})]}),Le("div",{className:xt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Le("div",{className:xt.create("checkout-sidebar-sticky",{position:"sticky",top:gt.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:[(te||ne)&&Le("div",{className:xt.create("insurance-details-card",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,padding:gt.spacing.lg,boxShadow:gt.shadow.sm},{"(max-width: 768px)":{padding:gt.spacing.md}}),children:[Le("h3",{className:xt.create("cart-summary-title",{fontSize:gt.fontSize.large,fontWeight:"600",marginBottom:gt.spacing.md,color:gt.colors.foreground}),children:Q?"Insurance Details":"Payment Details"}),te&&Le(k,{children:[Le("div",{className:xt.create("client-details",{display:"flex",flexDirection:"column",gap:gt.spacing.sm,marginBottom:gt.spacing.md}),children:[te.firstName&&te.lastName&&Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Name"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:[te.firstName," ",te.lastName]})]}),te.email&&Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Email"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:te.email})]}),te.phone&&Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Phone"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:te.phone})]}),"Payment"!==V&&Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Product"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:V})]}),Le("div",{className:xt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:xt.create("detail-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:"Link Expires"}),Le("span",{className:xt.create("detail-value",{fontWeight:"500",color:gt.colors.foreground,fontSize:gt.fontSize.small}),children:K.toLocaleDateString()})]})]}),Le("hr",{className:xt.create("divider",{border:"none",borderTop:`1px solid ${gt.colors.border}`,margin:`${gt.spacing.md} 0`})})]}),ne&&Le("div",{className:xt.create("line-item-section",{}),children:[Le("div",{className:xt.create("line-item-description",{fontSize:gt.fontSize.small,fontWeight:"500",color:gt.colors.foreground}),children:ne.description}),null!=ne.sum_insured&&Le("div",{className:xt.create("line-item-sum-insured",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground,marginTop:gt.spacing.sm}),children:["Sum Insured: ",ss(ne.sum_insured)]})]})]}),(te||ne)&&Le("div",{className:xt.create("checkout-sidebar-spacer",{height:gt.spacing.lg},{"(max-width: 950px)":{height:gt.spacing.md}})}),Le("div",{className:xt.create("checkout-sidebar-card",{backgroundColor:gt.colors.card,borderRadius:gt.radius.large,boxShadow:gt.shadow.sm,padding:gt.spacing.lg},{"(max-width: 768px)":{padding:gt.spacing.md}}),children:Le("div",{className:xt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Le("h3",{className:xt.create("cart-summary-title",{fontSize:gt.fontSize.large,fontWeight:"600",marginBottom:gt.spacing.sm,color:gt.colors.foreground}),children:"Payment Details"}),q&&Le("div",{className:xt.create("summary-section",{paddingBottom:"1rem"}),children:Le("div",{className:xt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"monthly"!==q.payment_frequency?Le(Ls,{label:"Total Due Today:",value:ss(parseFloat(q.amount.due_today)),isTotal:!0}):Le(k,{children:[Le(Ls,{label:"Due Today:",value:ss(parseFloat(q.amount.due_today)),isTotal:!0}),q.amount.monthly&&Le(Ls,{label:"Then Monthly:",value:ss(parseFloat(q.amount.monthly))}),(null===(c=q.metadata)||void 0===c?void 0:c.number_of_instalments)&&Le(Ls,{label:"Installments:",value:q.metadata.number_of_instalments.toString()}),q.amount.total&&Le(Ls,{label:"Total Payable:",value:ss(parseFloat(q.amount.total))})]})})}),Le(Xo,{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(!S)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===S))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,S,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:S,calculationId:b||"",clientDetails:{legalName:a},metadata:{payment_link_id:u.payment_link_id,payment_type:c?"quote":"rate",gateway_code:S,gateway:S},...X&&P?{coverStartDate:P}:{}};if("bank_transfer"!==S)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,S);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:xt.create("purchase-button",{width:"100%",height:"3rem",fontSize:gt.fontSize.default,fontWeight:"600"}),children:ee?"Go to Payment":"Select Options to Continue"})]})})]})})]}),g&&v&&l&&Le(Rs,{isOpen:g,onClose:()=>{y(!1),w(null)},onSuccess:()=>{y(!1),w(null),alert("Payment completed successfully!")},paymentRequest:v,httpClient:l})]})})}function Ls({label:e,value:t,isTotal:n=!1,className:r}){return Le("div",{className:Ct(xt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Le("span",{className:xt.create("summary-label",{color:gt.colors.mutedForeground,fontSize:gt.fontSize.small}),children:e}),Le("span",{className:xt.create("summary-value",{fontWeight:n?"600":"500",color:gt.colors.foreground,fontSize:n?gt.fontSize.large:"inherit"}),children:t})]})}function Bs({products:e,onSelectProduct:t}){const[n,r]=tt(null),i=(e,t)=>{t&&(t.preventDefault(),t.stopPropagation()),r(e)};return Le(Qo,{title:"Select cover",noSubscription:!0,hideHeader:!0,children:Le(It,{children:Le("div",{className:xt.create("product-selection-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Le("div",{className:xt.create("product-selection-card",{backgroundColor:gt.colors.card,boxShadow:gt.shadow.sm,borderRadius:gt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Le("div",{className:xt.create("product-selection-header",{paddingInline:gt.spacing.xl,paddingTop:gt.spacing.xl,paddingBottom:gt.spacing.lg},{"(max-width: 768px)":{paddingInline:gt.spacing.lg,paddingTop:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingTop:gt.spacing.md}}),children:[Le("h2",{className:xt.create("product-selection-title",{margin:"0",marginBottom:gt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:gt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Select Your Cover"}),Le("p",{className:xt.create("product-selection-description",{margin:"0",fontSize:gt.fontSize.default,lineHeight:"1.6",color:gt.colors.foreground,opacity:"0.9"}),children:"What type of vessel are you insuring?"}),Le("hr",{className:xt.create("product-selection-header-border",{marginTop:gt.spacing.lg,borderColor:gt.colors.border})})]}),Le("div",{className:xt.create("product-selection-content",{paddingInline:gt.spacing.xl,paddingBottom:gt.spacing.xl},{"(max-width: 768px)":{paddingInline:gt.spacing.lg,paddingBottom:gt.spacing.lg},"(max-width: 480px)":{paddingInline:gt.spacing.md,paddingBottom:gt.spacing.md}}),children:[0===e.length?Le("div",{className:xt.create("no-products-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${gt.colors.border}`,borderRadius:gt.radius.default,backgroundColor:gt.colors.muted}),children:[Le("div",{style:{marginBottom:gt.spacing.default},children:Le("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{margin:"0 auto",opacity:.5},children:[Le("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Le("polyline",{points:"14 2 14 8 20 8"})]})}),Le("p",{className:xt.create("placeholder-text",{color:gt.colors.mutedForeground,margin:"0"}),children:"No products available for quoting."})]}):Le("div",{className:xt.create("product-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Le(Fs,{product:e,isSelected:(null==n?void 0:n.id)===e.id,onSelect:i},e.id))}),e.length>0&&Le("div",{className:xt.create("product-selection-actions",{marginTop:gt.spacing.lg}),children:Le(Xo,{onClick:()=>{n&&t(n)},disabled:!n,className:xt.create("product-selection-continue-button",{width:"100%"}),children:"Continue"})})]})]})})})})}function Fs({product:e,isSelected:t,onSelect:n}){return Le("div",{className:Ct(xt.create("product-option-row",{borderRadius:gt.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?xt.create("product-option-row-selected",{border:`2px solid ${gt.colors.primary}`,backgroundColor:gt.colors.accent}):xt.create("product-option-row-unselected",{border:`2px solid ${gt.colors.border}`,backgroundColor:gt.colors.card})),onClick:t=>n(e,t),role:"button",tabIndex:0,onKeyPress:t=>{"Enter"!==t.key&&" "!==t.key||n(e,t)},children:[Le(is,{selected:t}),Le("div",{className:xt.create("product-option-content",{display:"flex",alignItems:"center",justifyContent:"space-between",flex:"1",gap:"1rem"}),children:[Le("div",{className:xt.create("product-option-info",{display:"flex",flexDirection:"column"}),children:[e.description&&Le("div",{className:xt.create("product-option-description",{fontSize:gt.fontSize.default,fontWeight:"500",color:gt.colors.foreground}),children:e.description}),Le("div",{className:xt.create("product-option-name",{fontSize:gt.fontSize.small,color:gt.colors.mutedForeground}),children:e.name})]}),e.icon_svg&&Le("div",{className:xt.create("product-option-icon",{width:"2.5rem",height:"2.5rem",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",color:t?gt.colors.primary:gt.colors.mutedForeground,transition:"color 150ms ease"}),dangerouslySetInnerHTML:{H:e.icon_svg}})]})]})}function qs(){var e,t;const n=Dt(),{paymentLinkConfig:r,availableProducts:i,formStateManager:o}=n;if(i&&!o)return Le(Bs,{products:i,onSelectProduct:async e=>{localStorage.setItem("insure-os-selected-product",e.code),window.location.reload()}});if(r)return Le(Ws,{paymentLinkId:r.paymentLinkId,signedUrl:r.signedUrl});const s=new URLSearchParams(window.location.search),a=s.get("pl_ref");if(a)return Le(Ws,{paymentLinkId:a});const c=window.location.pathname,l=c.match(/\/pay\/([a-f0-9-]+)/);if(l&&l[1])return Le(Ws,{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 Le(Os,{transactionId:u[1],organisationId:d});const{isCalculating:h,results:m,quoteIntent:f}=Mt(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?Le(Ko,{message:"Processing your quote, please wait..."}):p&&g&&(null===(t=null==f?void 0:f.organisation)||void 0===t?void 0:t.id)?Le(Os,{transactionId:g.id,organisationId:f.organisation.id}):y?Le(zs,{}):m?Le(bs,{results:m}):Le(Ms,{})}function Hs(e){return Le(Pt,{...e,children:Le(qs,{})})}class Us extends S{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(t,n){e();try{Promise.resolve().then(function(){return Td}).then(({captureException:e,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),e(t,{componentStack:n.componentStack}))}).catch(()=>{})}catch(e){}const r=fe("initialization",t,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return ke(e)?Le(ts,{message:e.message}):Le(es,{error:e})}return this.props.children}}function Zs({config:t,initializeFormContext:n}){const[r,i]=tt({type:"loading",message:"Loading application..."});return nt(()=>{(async()=>{try{e();const r=await n(t),o=r.availableProducts&&r.availableProducts.length>0;if(!("payment"===t.mode||r.paymentLinkConfig||o||r.formStateManager&&"function"==typeof r.formStateManager.getFormProgress))throw new Error("FormStateManager was not properly initialized");e(),i({type:"success",formContextProps:r})}catch(t){let n;e(),n=t&&"object"==typeof t&&"type"in t&&"MAINTENANCE_ERROR"===t.type||t&&"object"==typeof t&&"statusCode"in t&&503===t.statusCode||t&&"object"==typeof t&&"status"in t&&503===t.status?fe("maintenance",t):fe("initialization",t),e((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[t,n]),Le(Us,{children:Le("div",{className:xt.create("root",{fontFamily:gt.fontFamily,backgroundColor:gt.colors.background,minHeight:"100vh",color:gt.colors.foreground}),children:function(){switch(r.type){case"loading":return Le(Ko,{message:r.message});case"error":return ke(r.error)?Le(ts,{message:r.error.message}):Le(es,{error:r.error});case"success":return Le(Hs,{...r.formContextProps});default:return Le(es,{})}}()})})}const Ys="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Gs=globalThis,Js="10.17.0";function Qs(){return Vs(Gs),Gs}function Vs(e){const t=e.oe=e.oe||{};return t.version=t.version||Js,t[Js]=t[Js]||{}}function Ks(e,t,n=Gs){const r=n.oe=n.oe||{},i=r[Js]=r[Js]||{};return i[e]||(i[e]=t())}const Xs=["debug","info","warn","error","log","assert","trace"],ea={};function ta(e){if(!("console"in Gs))return e();const t=Gs.console,n={},r=Object.keys(ea);r.forEach(e=>{const r=ea[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function na(){return ia().enabled}function ra(e,...t){Ys&&na()&&ta(()=>{Gs.console[e](`Sentry Logger [${e}]:`,...t)})}function ia(){return Ys?Ks("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const oa=function(){ia().enabled=!0},sa=function(...e){ra("log",...e)},aa=function(...e){ra("warn",...e)},ca=function(...e){ra("error",...e)},la="?",ua=/\(error: (.*)\)/,da=/captureMessage|captureException/;function ha(...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=ua.test(n)?n.replace(ua,"$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(ma(t).function||"")&&t.pop(),t.reverse(),da.test(ma(t).function||"")&&(t.pop(),da.test(ma(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||ma(t).filename,function:e.function||la}))}(i.slice(r))}}function ma(e){return e[e.length-1]||{}}const fa="<anonymous>";function pa(e){try{return e&&"function"==typeof e&&e.name||fa}catch{return fa}}function ga(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 ya={},va={};function wa(e,t){ya[e]=ya[e]||[],ya[e].push(t)}function ba(e,t){if(!va[e]){va[e]=!0;try{t()}catch(t){Ys&&ca(`Error while instrumenting ${e}`,t)}}}function xa(e,t){const n=e&&ya[e];if(n)for(const r of n)try{r(t)}catch(t){Ys&&ca(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${pa(r)}\nError:`,t)}}let ka=null;function Sa(){ka=Gs.onerror,Gs.onerror=function(e,t,n,r,i){return xa("error",{column:r,error:i,line:n,msg:e,url:t}),!!ka&&ka.apply(this,arguments)},Gs.onerror.se=!0}let Na=null;function _a(){Na=Gs.onunhandledrejection,Gs.onunhandledrejection=function(e){return xa("unhandledrejection",e),!Na||Na.apply(this,arguments)},Gs.onunhandledrejection.se=!0}const $a={}.toString;function Ca(e){switch($a.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ja(e,Error)}}function Ta(e,t){return $a.call(e)===`[object ${t}]`}function Ia(e){return Ta(e,"ErrorEvent")}function Ea(e){return Ta(e,"DOMError")}function Pa(e){return Ta(e,"String")}function Da(e){return"object"==typeof e&&null!==e&&"ae"in e&&"ce"in e}function Ma(e){return null===e||Da(e)||"object"!=typeof e&&"function"!=typeof e}function za(e){return Ta(e,"Object")}function Ra(e){return"undefined"!=typeof Event&&ja(e,Event)}function Oa(e){return Boolean(e?.then&&"function"==typeof e.then)}function ja(e,t){try{return e instanceof t}catch{return!1}}function Aa(e){return!("object"!=typeof e||null===e||!e.le&&!e.ue)}const Wa=Gs;function La(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=Ba(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 Ba(e,t){const n=e,r=[];if(!n?.tagName)return"";if(Wa.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&&Pa(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 Fa(){try{return Wa.document.location.href}catch{return""}}function qa(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Ha(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{Aa(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Ua(e,t,n=!1){return!!Pa(e)&&(Ta(t,"RegExp")?t.test(e):!!Pa(t)&&(n?e===t:e.includes(t)))}function Za(e,t=[],n=!1){return t.some(t=>Ua(e,t,n))}function Ya(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Ja(i,r);try{e[t]=i}catch{Ys&&sa(`Failed to replace method "${t}" in object`,e)}}function Ga(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Ys&&sa(`Failed to add non-enumerable property "${t}" to object`,e)}}function Ja(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Ga(e,"__sentry_original__",t)}catch{}}function Qa(e){return e.de}function Va(e){if(Ca(e))return{message:e.message,name:e.name,stack:e.stack,...Xa(e)};if(Ra(e)){const t={type:e.type,target:Ka(e.target),currentTarget:Ka(e.currentTarget),...Xa(e)};return"undefined"!=typeof CustomEvent&&ja(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Ka(e){try{return"undefined"!=typeof Element&&ja(e,Element)?La(e):{}.toString.call(e)}catch{return"<unknown>"}}function Xa(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 ec(e=function(){const e=Gs;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 tc(e){return e.exception?.values?.[0]}function nc(e){const{message:t,event_id:n}=e;if(t)return t;const r=tc(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function rc(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 ic(e,t){const n=tc(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 oc(e){if(function(e){try{return e.he}catch{}}(e))return!0;try{Ga(e,"__sentry_captured__",!0)}catch{}return!1}function sc(){return Date.now()/1e3}let ac;function cc(){return(ac??(ac=function(){const{performance:e}=Gs;if(!e?.now||!e.timeOrigin)return sc;const t=e.timeOrigin;return()=>(t+e.now())/1e3}()))()}function lc(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||cc(),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:ec()),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 uc(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]=uc(r[e],t[e],n-1));return r}function dc(){return ec()}function hc(){return ec().substring(16)}const mc="_sentrySpan";function fc(e,t){t?Ga(e,mc,t):delete e[mc]}function pc(e){return e[mc]}class gc{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:dc(),sampleRand:Math.random()}}clone(){const e=new gc;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,fc(e,pc(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&&lc(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 gc?t.getScopeData():za(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,fc(this,void 0),this.ye=[],this.setPropagationContext({traceId:dc(),sampleRand:Math.random()}),this.Ee(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:sc(),...e,message:e.message?qa(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:pc(this)}}setSDKProcessingMetadata(e){return this.ke=uc(this.ke,e,2),this}setPropagationContext(e){return this.Se=e,this}getPropagationContext(){return this.Se}captureException(e,t){const n=t?.event_id||ec();if(!this.Te)return Ys&&aa("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||ec();if(!this.Te)return Ys&&aa("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||ec();return this.Te?(this.Te.captureEvent(e,{...t,event_id:n},this),n):(Ys&&aa("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 yc{constructor(e,t){let n,r;n=e||new gc,r=t||new gc,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 Oa(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 vc(){const e=Vs(Qs());return e.stack=e.stack||new yc(Ks("defaultCurrentScope",()=>new gc),Ks("defaultIsolationScope",()=>new gc))}function wc(e){return vc().withScope(e)}function bc(e,t){const n=vc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function xc(e){return vc().withScope(()=>e(vc().getIsolationScope()))}function kc(e){const t=Vs(e);return t.acs?t.acs:{withIsolationScope:xc,withScope:wc,withSetScope:bc,withSetIsolationScope:(e,t)=>xc(t),getCurrentScope:()=>vc().getScope(),getIsolationScope:()=>vc().getIsolationScope()}}function Sc(){return kc(Qs()).getCurrentScope()}function Nc(){return kc(Qs()).getIsolationScope()}function _c(...e){const t=kc(Qs());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function $c(){return Sc().getClient()}function Cc(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||hc()};return r&&(o.parent_span_id=r),o}const Tc="sentry.profile_id",Ic="sentry.exclusive_time";function Ec(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function Pc(e){const t=e;return{scope:t.Re,isolationScope:Ec(t.Oe)}}const Dc=/^sentry-/;function Mc(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 zc=/^o(\d+)\./,Rc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Oc(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 jc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Ac(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(zc);return t?.[1]}(n)),r}let Wc=!1;function Lc(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Hc(e).parent_span_id,o=Pc(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||hc():t,trace_id:n}}function Bc(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 Fc(e){return"number"==typeof e?qc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?qc(e.getTime()):cc()}function qc(e){return e>9999999999?e/1e3:e}function Hc(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:i,name:o,endTime:s,status:a,links: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:Fc(i),timestamp:Fc(s)||void 0,status:Uc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:Bc(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Uc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"unknown_error"}function Zc(e){return e.je||e}function Yc(){Wc||(ta(()=>{}),Wc=!0)}function Gc(e){sa(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Jc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(Vc(n)){if(Ua(e.description,n))return Ys&&Gc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||Ua(e.description,n.name),r=!n.op||e.op&&Ua(e.op,n.op);if(t&&r)return Ys&&Gc(e),!0}return!1}function Qc(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 Vc(e){return"string"==typeof e||e instanceof RegExp}const Kc="production";function Xc(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Kc,release:n.release,public_key:r,trace_id:e,org_id:Ac(t)};return t.emit("createDsc",i),i}function el(e){const t=$c();if(!t)return{};const n=Zc(e),r=Hc(n),i=r.data,o=n.spanContext().traceState,s=o?.get("sentry.sample_rate")??i["sentry.sample_rate"]??i["sentry.previous_trace_sample_rate"];function a(e){return"number"!=typeof s&&"string"!=typeof s||(e.sample_rate=`${s}`),e}const c=n.Ae;if(c)return a(c);const l=o?.get("sentry.dsc"),u=l&&function(e){const t=function(e){if(e&&(Pa(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=Mc(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Mc(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.match(Dc)&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(l);if(u)return a(u);const d=Xc(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=$c()?.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")??Pc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}function tl(e,t=100,n=1/0){try{return rl("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function nl(e,t=3,n=102400){const r=tl(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?nl(e,t-1,n):r;var i}function rl(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(Aa(t))return"[VueViewModel]";if(za(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: ${pa(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 rl("",l.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=Va(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]=rl(e,t,c-1,r,i),d++}return s(t),u}function il(e,t=[]){return[e,t]}function ol(e,t){const[n,r]=e;return[n,[...r,t]]}function sl(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function al(e){const t=Vs(Gs);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function cl(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[al(r),e]:r.push("string"==typeof e?al(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(tl(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 ll(e){const t="string"==typeof e.data?al(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const ul={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 dl(e){return ul[e]}function hl(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function ml(e){return new pl(t=>{t(e)})}function fl(e){return new pl((t,n)=>{n(e)})}class pl{constructor(e){this.Fe=0,this.qe=[],this.He(e)}then(e,t){return new pl((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 pl((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&&(Oa(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 gl(e,t,n,r=0){try{const i=yl(t,n,e,r);return Oa(i)?i:ml(i)}catch(e){return fl(e)}}function yl(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return Ys&&null===o&&sa(`Event processor "${i.id||"?"}" dropped event`),Oa(o)?o.then(e=>yl(e,t,n,r+1)):yl(o,t,n,r+1)}function vl(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;wl(e,"extra",n),wl(e,"tags",r),wl(e,"user",i),wl(e,"contexts",o),e.sdkProcessingMetadata=uc(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 wl(e,t,n){e[t]=uc(e[t],n,1)}let bl,xl,kl;function Sl(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||ec(),timestamp:t.timestamp||sc()},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||Kc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&(s.url=qa(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=Gs.Ye;if(!t)return{};const n=Object.keys(t);return kl&&n.length===xl||(xl=n.length,kl=n.reduce((n,r)=>{bl||(bl={});const i=bl[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,bl[r]=[s,a];break}}}return n},{})),kl}(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 gc;return n.update(t),n}(r,n.captureContext);n.mechanism&&ic(c,n.mechanism);const d=i?i.getEventProcessors():[],h=Ks("globalScope",()=>new gc).getScopeData();o&&vl(h,o.getScopeData()),u&&vl(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:Lc(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:el(t),...e.sdkProcessingMetadata};const n=Hc(Zc(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),gl([...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:tl(e.data,t,n)}}))},...e.user&&{user:tl(e.user,t,n)},...e.contexts&&{contexts:tl(e.contexts,t,n)},...e.extra&&{extra:tl(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=tl(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:tl(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=tl(e.contexts.flags,3,n)),r}(e,s,a):e))}function Nl(e){return Sc().captureException(e,void 0)}function _l(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return Sc().captureMessage(e,n,r)}function $l(e,t){return Sc().captureEvent(e,t)}function Cl(e){const t=Nc(),n=Sc(),{userAgent:r}=Gs.navigator||{},i=function(e){const t=cc(),n={sid:ec(),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&&lc(n,e),n}({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&lc(o,{status:"exited"}),Tl(),t.setSession(i),i}function Tl(){const e=Nc(),t=Sc().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),lc(e,t)}(t),Il(),e.setSession()}function Il(){const e=Nc(),t=$c(),n=e.getSession();n&&t&&t.captureSession(n)}function El(e=!1){e?Tl():Il()}const Pl=[];function Dl(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 Ml(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function zl(e,t,n){if(n[t.name])Ys&&sa(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===Pl.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),Pl.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)}Ys&&sa(`Integration installed: ${t.name}`)}}function Rl(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 Ol="Not capturing exception because it's already been captured.",jl="Discarded session because of missing or non-string release",Al=Symbol.for("SentryInternalError"),Wl=Symbol.for("SentryDoNotSendEventError");function Ll(e){return{message:e,[Al]:!0}}function Bl(e){return{message:e,[Wl]:!0}}function Fl(e){return!!e&&"object"==typeof e&&Al in e}function ql(e){return!!e&&"object"==typeof e&&Wl in e}class Hl{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=Rc.exec(e);if(!t)return void ta(()=>{});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 jc({host:o,pass:i,path:c,projectId:l,port:s,protocol:n,publicKey:r})}(e):jc(e);if(t&&function(e){if(!Ys)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(ca(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(ca(`Invalid Sentry Dsn: Invalid port ${t}`),1):(ca(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(ca(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Ys&&aa("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=ec();if(oc(e))return Ys&&sa(Ol),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:ec(),...n},o=Da(e)?e:String(e),s=Ma(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=ec();if(t?.originalException&&oc(t.originalException))return Ys&&sa(Ol),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),lc(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];zl(this,e,this.Je),t||Ml(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=hl(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const n=e.sdk||{};e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,n?.sdk);const s=function(e,t,n,r){const i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Oc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,il(s,[[{type:o},e]])}(e,this.Xe,this.Ge.et,this.Ge.tunnel);for(const e of t.attachments||[])n=ol(n,ll(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=Kc}=this.Ge;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Ys&&aa(jl));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(Ys&&aa(jl));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=hl(n);return il({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Oc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.Xe,this.Ge.et,this.Ge.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.Ge.sendClientReports){const r=`${e}:${t}`;Ys&&sa(`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 Ys&&ca("Error while sending envelope:",e),{}}return Ys&&ca("Transport disabled"),{}}ct(){const{integrations:e}=this.Ge;this.Je=function(e,t){const n={};return t.forEach(t=>{t&&zl(e,t,n)}),n}(this,e),Ml(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)&&(lc(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),Sl(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:Cc(n),...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||Xc(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}it(e,t={},n=Sc(),r=Nc()){return Ys&&Ul(e)&&sa(`Captured error event \`${Rl(e)[0]||"<unknown>"}\``),this.ht(e,t,n,r).then(e=>e.event_id,e=>{Ys&&(ql(e)?sa(e.message):Fl(e)?aa(e.message):aa(e))})}ht(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Zl(e),a=Ul(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"),fl(Bl(`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),Bl("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(Ul(c)&&i)return i(c,r);if(Zl(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?.[Tc],exclusive_time:s?.[Ic],measurements:e.measurements,is_segment:!0}}(c);if(a?.length&&Jc(t,a))return null;if(s){const e=s(t);e?c=uc(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&&{[Tc]:l.profile_id},...l.exclusive_time&&{[Ic]:l.exclusive_time}}}},measurements:l.measurements}):Yc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(a?.length&&Jc(e,a))Qc(n,e);else if(s){const n=s(e);n?t.push(n):(Yc(),t.push(e))}else t.push(e);const r=c.spans.length-t.length;r&&e.recordDroppedEvent("before_send","span",r),c.spans=t}}if(o){if(c.spans){const e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return o(c,r)}}var l;return c}(this,i,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Oa(e))return e.then(e=>{if(!za(e)&&null!==e)throw Ll(n);return e},e=>{throw Ll(`${t} rejected with ${e}`)});if(!za(e)&&null!==e)throw Ll(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 Bl(`${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(ql(e)||Fl(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{ft:!0},originalException:e}),Ll(`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(){Ys&&sa("Flushing outcomes...");const e=this.gt();if(0===e.length)return void(Ys&&sa("No outcomes to send"));if(!this.Xe)return void(Ys&&sa("No dsn provided, will not send outcomes"));Ys&&sa("Sending outcomes:",e);const t=(n=e,il((r=this.Ge.tunnel&&Oc(this.Xe))?{dsn:r}:{},[[{type:"client_report"},{timestamp:sc(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function Ul(e){return void 0===e.type}function Zl(e){return"transaction"===e.type}function Yl(e){const t=function(e){return Gl().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=Oc(r)),il(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());Gl().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(r)}function Gl(){return Ks("clientToLogBufferMap",()=>new WeakMap)}const Jl=Symbol.for("SentryBufferFullError");function Ql(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 fl(Jl);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return ml(!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(sl(i,(t,n)=>{const i=dl(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=il(i[0],o),a=t=>{sl(s,(n,r)=>{e.recordDroppedEvent(t,dl(r))})};return n.add(()=>t({body:cl(s)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Ys&&aa(`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"),Ys&&ca("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Jl)return Ys&&ca("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function Vl(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 Kl(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 Xl=100;function eu(e,t){const n=$c(),r=Nc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Xl}=n.getOptions();if(o<=0)return;const s={timestamp:sc(),...e},a=i?ta(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let tu;const nu=new WeakMap,ru=()=>({name:"FunctionToString",setupOnce(){tu=function(){}.toString;try{Function.prototype.toString=function(...e){const t=Qa(this),n=nu.has($c())&&void 0!==t?t:this;return tu.apply(n,e)}}catch{}},setup(e){nu.set(e,!0)}}),iu=[/^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$/],ou=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=au(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=au(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&&Za(n,t)}(e,t.ignoreTransactions))return Ys&&aa(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${nc(e)}`),!0}else{if(function(e,t){return!!t?.length&&Rl(e).some(e=>Za(e,t))}(e,t.ignoreErrors))return Ys&&aa(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${nc(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 Ys&&aa(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${nc(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=cu(e);return!!n&&Za(n,t)}(e,t.denyUrls))return Ys&&aa(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${nc(e)}.\nUrl: ${cu(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=cu(e);return!n||Za(n,t)}(e,t.allowUrls))return Ys&&aa(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${nc(e)}.\nUrl: ${cu(e)}`),!0}return!1}(n,t)?null:n}}},su=(e={})=>({...ou(e),name:"InboundFilters"});function au(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:iu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function cu(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 Ys&&ca(`Cannot extract url for event ${nc(e)}`),null}}function lu(e,t,n,r,i,o){if(!i.exception?.values||!o||!ja(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=uu(e,t,r,o.originalException,n,i.exception.values,s,0))}function uu(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(ja(r[i],Error)){du(s,a);const o=e(t,r[i]),l=c.length;hu(o,i,l,a),c=uu(e,t,n,r[i],i,[o,...c],o,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(ja(r,Error)){du(s,a);const l=e(t,r),u=c.length;hu(l,`errors[${o}]`,u,a),c=uu(e,t,n,r,i,[l,...c],l,u)}}),c}function du(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function hu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function mu(){"console"in Gs&&Xs.forEach(function(e){e in Gs.console&&Ya(Gs.console,e,function(t){return ea[e]=t,function(...t){xa("console",{args:t,level:e});const n=ea[e];n?.apply(Gs.console,t)}})})}const fu=()=>{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&&(!!gu(e,t)&&!!pu(e,t))))}(e,t)||!!function(e,t){const n=yu(t),r=yu(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!gu(e,t)&&!!pu(e,t)))}(e,t))}(t,e))return Ys&&aa("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function pu(e,t){let n=ga(e),r=ga(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 gu(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 yu(e){return e.exception?.values?.[0]}function vu(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const wu=Gs;function bu(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function xu(e,t){const n="fetch";wa(n,e),ba(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in wu))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(bu(wu.fetch))return!0;let e=!1;const t=wu.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=bu(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Ys&&aa("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||Ya(Gs,"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:Su(t),method:ku(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:Su(t),method:ku(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*cc(),virtualError:n,headers:Nu(t)};return xa("fetch",{...o}),e.apply(Gs,t).then(async e=>(xa("fetch",{...o,endTimestamp:1e3*cc(),response:e}),e),e=>{if(xa("fetch",{...o,endTimestamp:1e3*cc(),error:e}),Ca(e)&&void 0===e.stack&&(e.stack=n.stack,Ga(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 ku(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Su(e){return"string"==typeof e?e:e?ku(e,"url")?e.url:e.toString?e.toString():"":""}function Nu(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&&ja(t,Request))return new Headers(t.headers)}catch{}}const _u=Gs;let $u=0;function Cu(){return $u>0}function Tu(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(Qa(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>Tu(e,t));return e.apply(this,r)}catch(e){throw $u++,setTimeout(()=>{$u--}),_c(r=>{r.addEventProcessor(e=>(t.mechanism&&(rc(e,void 0),ic(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),Nl(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Ja(n,e),Ga(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function Iu(e,t){const n=Pu(e,t),r={type:zu(t),value:Ru(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Eu(e,t){return{exception:{values:[Iu(e,t)]}}}function Pu(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&Du.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 Du=/Minified React error #\d+;/i;function Mu(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function zu(e){const t=e?.name;return!t&&Mu(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function Ru(e){const t=e?.message;return Mu(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 Ou(e,t,n,r,i){let o;if(Ia(t)&&t.error)return Eu(e,t.error);if(Ea(t)||Ta(t,"DOMException")){const i=t;if("stack"in t)o=Eu(e,t);else{const t=i.name||(Ea(i)?"DOMError":"DOMException"),s=i.message?`${t}: ${i.message}`:t;o=ju(e,s,n,r),rc(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Ca(t)?Eu(e,t):za(t)||Ra(t)?(o=function(e,t,n,r){const i=$c(),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:nl(t,o)};if(s)return{exception:{values:[Iu(e,s)]},extra:a};const c={exception:{values:[{type:Ra(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Au(t,{isUnhandledRejection:r})}]},extra:a};if(n){const t=Pu(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),ic(o,{synthetic:!0}),o):(o=ju(e,t,n,r),rc(o,`${t}`),ic(o,{synthetic:!0}),o)}function ju(e,t,n,r){const i={};if(r&&n){const r=Pu(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),ic(i,{synthetic:!0})}if(Da(t)){const{ae:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Au(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(Va(e));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=t)return qa(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:qa(r,t)}return""}(e),r=t?"promise rejection":"exception";return Ia(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Ra(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 Wu extends Hl{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:_u.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:Js})),version:Js}),e.et=i}(t,"browser",["browser"],_u.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;_u.document&&(i||o)&&_u.document.addEventListener("visibilitychange",()=>{"hidden"===_u.document.visibilityState&&(i&&this.yt(),o&&Yl(this))}),o&&(this.on("flush",()=>{Yl(this)}),this.on("afterCaptureLog",()=>{this.bt&&clearTimeout(this.bt),this.bt=setTimeout(()=>{Yl(this)},5e3)})),r&&this.on("beforeSendSession",Kl)}eventFromException(e,t){return function(e,t,n,r){const i=Ou(e,t,n?.syntheticException||void 0,r);return ic(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),ml(i)}(this.Ge.stackParser,e,t,this.Ge.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=ju(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),ml(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 Lu="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Bu=Gs;let Fu,qu,Hu,Uu;function Zu(){if(!Bu.document)return;const e=xa.bind(null,"dom"),t=Yu(e,!0);Bu.document.addEventListener("click",t,!1),Bu.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=Bu,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ya(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=Yu(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),Ya(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 Yu(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;Ga(n,"_sentryCaptured",!0),r&&!r.St&&Ga(r,"_sentryId",ec());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==qu)return!1;try{if(!e.target||e.target.St!==Hu)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),qu=n.type,Hu=r?r.St:void 0),clearTimeout(Fu),Fu=Bu.setTimeout(()=>{Hu=void 0,qu=void 0},1e3)}}function Gu(e){const t="history";wa(t,e),ba(t,Ju)}function Ju(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Uu,i=function(e){try{return new URL(e,Bu.location.origin).toString()}catch{return e}}(String(n));if(Uu=i,r===i)return e.apply(this,t);xa("history",{from:r,to:i})}return e.apply(this,t)}}Bu.addEventListener("popstate",()=>{const e=Bu.location.href,t=Uu;Uu=e,t!==e&&xa("history",{from:t,to:e})}),"history"in wu&&wu.history&&(Ya(Bu.history,"pushState",e),Ya(Bu.history,"replaceState",e))}const Qu={},Vu="__sentry_xhr_v3__";function Ku(){if(!Bu.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*cc(),o=Pa(n[0])?n[0].toUpperCase():void 0,s=function(e){if(Pa(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[Vu]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.Nt=!0);const a=()=>{const e=t[Vu];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}xa("xhr",{endTimestamp:1e3*cc(),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[Vu];return o&&Pa(r)&&Pa(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[Vu];return r?(void 0!==n[0]&&(r.body=n[0]),xa("xhr",{startTimestamp:1e3*cc(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function Xu(e,t=function(e){const t=Qu[e];if(t)return t;let n=Bu[e];if(bu(n))return Qu[e]=n.bind(Bu);const r=Bu.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){Lu&&aa(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?Qu[e]=n.bind(Bu):n}("fetch")){let n=0,r=0;return Ql(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 Qu.fetch=void 0,e}finally{n-=o,r--}})}function ed(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?la:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const td=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,nd=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,rd=/\((\S*)(?::(\d+))(?::(\d+))\)/,id=/at (.+?) ?\(data:(.+?),/,od=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,sd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ad=ha([30,e=>{const t=e.match(id);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=td.exec(e);if(n){const[,e,t,r]=n;return ed(e,la,+t,+r)}const r=nd.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=rd.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=cd(r[1]||la,r[2]);return ed(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=od.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=sd.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]||la;return[n,e]=cd(n,e),ed(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),cd=(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]:la,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},ld="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ud=(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";wa(t,e),ba(t,mu)}(function(e){return function(t){if($c()!==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:Ha(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Ha(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}eu(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if($c()!==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&&(ld&&aa(`\`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=La(t,{keyAttrs:o,maxStringLength:s}),i=function(e){if(!Wa.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}),eu(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),wa("dom",n),ba("dom",Zu)),t.xhr&&function(e){wa("xhr",e),ba("xhr",Ku)}(function(e){return function(t){if($c()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Vu];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:vu(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),eu(d,u)}}(e)),t.fetch&&xu(function(e){return function(t){if($c()!==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),eu(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:vu(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),eu(a,s)}}}(e)),t.history&&Gu(function(e){return function(t){if($c()!==e)return;let n=t.from,r=t.to;const i=Vl(_u.location.href);let o=n?Vl(n):void 0;const s=Vl(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),eu({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){$c()===e&&eu({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:nc(t)},{event:t})}}(e))}}},dd=["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"],hd=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Ya(_u,"setTimeout",md),t.setInterval&&Ya(_u,"setInterval",md),t.requestAnimationFrame&&Ya(_u,"requestAnimationFrame",fd),t.XMLHttpRequest&&"XMLHttpRequest"in _u&&Ya(XMLHttpRequest.prototype,"send",pd);const e=t.eventTarget;e&&(Array.isArray(e)?e:dd).forEach(e=>function(e,t){const n=_u,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ya(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=Tu(i.handleEvent,{mechanism:{data:{handler:pa(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,Tu(i,{mechanism:{data:{handler:pa(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),Ya(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 md(e){return function(...t){const n=t[0];return t[0]=Tu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${pa(e)}`}}),e.apply(this,t)}}function fd(e){return function(t){return e.apply(this,[Tu(t,{mechanism:{data:{handler:pa(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function pd(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&Ya(n,e,function(t){const n={mechanism:{data:{handler:pa(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Qa(t);return r&&(n.mechanism.data.handler=pa(r)),Tu(t,n)})}),e.apply(this,t)}}const gd=(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";wa(t,t=>{const{stackParser:n,attachStacktrace:r}=vd();if($c()!==e||Cu())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(Pa(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)??Fa();return 0===c.length&&c.push({colno:l,filename:d,function:la,in_app:!0,lineno:u}),e}(Ou(n,c||i,void 0,r,!1),o,s,a);l.level="error",$l(l,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),ba(t,Sa)}()}(e),yd("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";wa(t,t=>{const{stackParser:n,attachStacktrace:r}=vd();if($c()!==e||Cu())return;const i=function(e){if(Ma(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=Ma(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:Ou(n,i,void 0,r,!0);o.level="error",$l(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),ba(t,_a)}()}(e),yd("onunhandledrejection"))}}};function yd(e){ld&&sa(`Global Handler attached: ${e}`)}function vd(){const e=$c();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const wd=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){lu(Iu,i.getOptions().stackParser,n,t,e,r)}}};let bd=!1;function xd(t){if(bd)e();else if(t.enabled&&t.dsn)try{const n=t.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===_u.window)return!1;const e=_u;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=Fa();return!(_u===_u.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(e=>n.startsWith(`${e}://`)))}()&&(ld&&ta(()=>{}),!0),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||ad,Array.isArray(r)?ha(...r):r),integrations:Dl({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[su(),ru(),hd(),ud(),gd(),wd(),fu(),{name:"HttpContext",preprocessEvent(e){if(!_u.navigator&&!_u.location&&!_u.document)return;const t=function(){const e=Fa(),{referrer:t}=_u.document||{},{userAgent:n}=_u.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!==_u.document?(Cl({ignoreDuration:!0}),El(),Gu(({from:e,to:t})=>{void 0!==e&&e!==t&&(Cl({ignoreDuration:!0}),El())})):ld&&aa("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:e.defaultIntegrations}),transport:e.transport||Xu};var r;!function(e,t){!0===t.debug&&(Ys?oa():ta(()=>{})),Sc().update(t.initialScope);const n=new e(t);(function(e){Sc().setClient(e)})(n),n.init()}(Wu,n)}({dsn:t.dsn,environment:t.environment||"production",release:t.release,beforeSend:t=>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||"")))}(t,n)?(t.tags={...t.tags,source:"insureos-widget"},e(t.exception),t):(e(t.exception),null),allowUrls:n,sampleRate:t.sampleRate||1,tracesSampleRate:t.tracesSampleRate||.1,integrations:[ud({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),fu()],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"]}),bd=!0,e()}catch(e){}else e()}function kd(t,n){if(bd)try{n?_c(e=>{Object.entries(n).forEach(([t,n])=>{e.setContext(t,n)}),Nl(t)}):Nl(t)}catch(t){e()}}function Sd(t,n="info",r){if(bd)try{r?_c(e=>{Object.entries(r).forEach(([t,n])=>{e.setContext(t,n)}),_l(t,n)}):_l(t,n)}catch(t){e()}}function Nd(t){if(bd)try{!function(e){Nc().setUser(e)}(t)}catch(t){e()}}function _d(t){if(bd)try{eu(t)}catch(t){e()}}function $d(t,n){if(bd)try{!function(e,t){Nc().setTag(e,t)}(t,n)}catch(t){e()}}function Cd(){return bd}var Td=Object.freeze({__proto__:null,addBreadcrumb:_d,captureException:kd,captureMessage:Sd,initializeSentry:xd,isSentryInitialized:Cd,setTag:$d,setUser:Nd});const Id="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",Ed="production",Pd="insureos-scripts",Dd=!0,Md=1,zd=.1;class Rd{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(...t){this.config.debug&&e("[Analytics]",...t)}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 Od{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{xd({dsn:Id,environment:Ed,release:Pd,enabled:Dd,sampleRate:Md,tracesSampleRate:zd}),this.sentryInitialized=!0,e()}catch(t){e()}}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(t){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new Rd({enabled:null===(n=t.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=t.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=t.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=t.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:t.debug}),_e(this.analyticsManager),e()}catch(t){e()}}async mount(e,r){r.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(r),this.initializeSentryOnce(),this.initializeAnalyticsOnce(r),function(e,r){var i,o,s;r==document&&(r=document.documentElement),n.m&&n.m(e,r),i=r.i,o=[],s=[],z(r,e=r.i=b(k,null,[e]),i||f,f,r.namespaceURI,i?null:r.firstChild?t.call(r.childNodes):null,o,i?i.v:r.firstChild,!1,s),O(o,e,s)}(b(Zs,{config:r,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 Ae(t)}async initializeFormContext(t){const n=this.createHttpClient(t),r=new URLSearchParams(window.location.search).get("pl_ref");if(r)return e(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:r,signedUrl:void 0}};if("payment"===t.mode)return e(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:t.paymentLinkId,signedUrl:t.signedUrl}};const i="sessionStorage"===t.storageType?new Y:new Z;i.isAvailable()?e(i.constructor.name):e();const o=new Q(i),s=new V(o),a=t.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&&!t.quoteIntentUrl&&!h){e();const t=await n.fetchAvailableProducts(l?void 0:a);if(e(),t.organisation&&t.organisation.theme)try{const n=await Promise.resolve().then(function(){return As}).then(e=>e.ThemeLoader);await n.loadTheme({slug:t.organisation.slug,theme_url:t.organisation.theme.css_url}),e()}catch(t){e()}return{httpClient:n,stateManager:o,quoteIntent:null,quoteIntentStore:s,formStateManager:null,availableProducts:t.products,productCodes:a}}let m;h?(e(),m=h,localStorage.removeItem("insure-os-selected-product")):d&&(m=a[0]);const f=async()=>{e();const r=t.quoteIntentUrl?await n.getQuoteIntent(t.quoteIntentUrl):await n.createQuoteIntent({code:m});return e(),{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:t.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 e=>{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(e);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:t.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(t.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")){e(),localStorage.clear(),g.delete("clear");const t=g.toString()?`${window.location.pathname}?${g.toString()}`:window.location.pathname;window.history.replaceState({},"",t),e()}let y=null,v=!1;try{const e=o.getQuoteIntent(t.orgId),n=await s.getOrCreateQuoteIntent(t.orgId,f,p);n.payment_return&&o.saveQuoteIntent(t.orgId,n),y=n,v=!e}catch(e){if(!(e instanceof F&&404===e.statusCode))throw e;s.clearQuoteIntent(t.orgId),y=await s.getOrCreateQuoteIntent(t.orgId,f,p),v=!0}if(v&&y&&Te(y),!y)throw new Error("Failed to initialize quote intent state");e(),e(y.payment_return),y.payment_return&&e(y.payment_return);const w=new Oe(y,n,s,{autoSave:!1,autoSaveInterval:y.form_definition.settings.autoSaveInterval});if(y.form_data&&w.restoreFormProgress(y.form_data),e(y.cached_result),y.cached_result?(e(y.cached_result),w.restoreCalculationResult(y.cached_result),e(),e(w.hasCalculationResponse())):e(),y.organisation&&y.organisation.theme)try{await js.loadTheme({slug:y.organisation.slug,theme_url:y.organisation.theme.css_url})}catch(t){e()}return await this.handleAutoCalculationIfComplete(w),{httpClient:n,stateManager:o,quoteIntent:y,quoteIntentStore:s,formStateManager:w}}async handleAutoCalculationIfComplete(t){try{const n=t.getQuoteIntent();if("paid"===n.status||"completed"===n.status)return void e();if(t.hasCalculationResponse())return void e();if(t.hasLastCalculationFailed())return void e();const r=t.getPageCompletionStatus(),{totalPages:i,completedPages:o}=r,s=o.length===i;e((o.length,t.getIsCalculating(),t.hasLastCalculationFailed())),s&&!t.getIsCalculating()&&(e(),await t.calculateQuote(),e())}catch(t){e()}}}const jd=new Od;"undefined"!=typeof window&&(window.InsureOS=jd,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 jd.mount(r,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class Ad{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 qd});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 Ud});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 Yd});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}}class Wd{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,Wd.instance)return Wd.instance;Wd.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 Wd).startMeasurement(e)}static endMeasurement(e){return(new Wd).endMeasurement(e)}static measureMemoryUsage(){return(new Wd).measureMemoryUsage()}static async measureApiCall(e,t){return(new Wd).measureApiCall(e,t)}static getMetrics(){return(new Wd).getMetrics()}static generateReport(){return(new Wd).generateReport()}}let Ld=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)}},Bd=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new Ld(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 Ld(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)}},Fd=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new Ld(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 qd=Object.freeze({__proto__:null,Headers:Ld,Request:Bd,Response:Fd,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new Bd(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 Ld;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new Fd(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 Hd{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 Hd((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof Hd?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof Hd?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 Hd(t=>t(e))}static reject(e){return new Hd((t,n)=>n(e))}static all(e){return new Hd((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 Ud=Object.freeze({__proto__:null,PromisePolyfill:Hd});class Zd{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 Yd=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 Zd(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:Zd});export{Rd as DataLayerManager,U as EnhancedHttpClient,q as ErrorHandlingStrategy,m as ErrorType,Oe as FormStateManager,jd as InsureOS,Od as InsureOSClient,F as InsureOSError,Q as LocalStateManager,Z as LocalStorageAdapter,G as MemoryStorageAdapter,Wd as PerformanceMonitor,Ad as PolyfillManager,H as RetryStrategy,Y as SessionStorageAdapter,js as ThemeLoader,_d as addBreadcrumb,kd as captureException,Sd as captureMessage,fe as createAppError,$e as getAnalytics,Se as getSupportMessage,ue as groupErrorsByField,_e as initializeAnalytics,xd as initializeSentry,Cd as isSentryInitialized,le as parseServerValidationErrors,$d as setTag,Nd as setUser,xe as shouldShowErrorPage,ke as shouldShowMaintenancePage,Ie as trackFormProgress,ze as trackPaymentCompleted,Re as trackPaymentFailed,Me as trackPaymentInitiated,Pe as trackQuoteAtCheckout,Ee as trackQuoteCalculated,De as trackQuoteReferred,Te as trackQuoteStarted,ae as validateField,ce as validatePage};
|
|
1
|
+
const e=()=>{globalThis.insureOSDebug};var t,n,r,i,o,s,a,c,l,u,d,h,m,f={},p=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function w(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(e,n,r){var i,o,s,a={};for(s in n)"key"==s?i=n[s]:"ref"==s?o=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?t.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 x(e,a,i,o,null)}function x(e,t,i,o,s){var a={type:e,props:t,key:i,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:null==s?++r:s,_:-1,C:0};return null==s&&null!=n.vnode&&n.vnode(a),a}function k(e){return e.children}function S(e,t){this.props=e,this.context=t}function N(e,t){if(null==t)return e.m?N(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?N(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 $(e){(!e.I&&(e.I=!0)&&i.push(e)&&!C.P++||o!=n.debounceRendering)&&((o=n.debounceRendering)||s)(C)}function C(){for(var e,t,r,o,s,c,l,u=1;i.length;)i.length>u&&i.sort(a),e=i.shift(),u=i.length,e.I&&(r=void 0,s=(o=(t=e).N).v,c=[],l=[],t.R&&((r=v({},o)).N=o.N+1,n.vnode&&n.vnode(r),z(t.R,r,o,t.O,t.R.namespaceURI,32&o.C?[s]:null,c,null==s?N(o):s,!!(32&o.C),l),r.N=o.N,r.m.i[r._]=r,O(c,r,l),r.v!=s&&_(r)));C.P=0}function T(e,t,n,r,i,o,s,a,c,l,u){var d,h,m,g,v,w,b,S=r&&r.i||p,_=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?x(null,s,null,null,null):y(s)?x(k,{children:s},null,null,null):null==s.constructor&&s.p>0?x(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._=E(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=N(a)),L(a,a));return r}(n,t,S,c,_),d=0;d<_;d++)null!=(m=n.i[d])&&(h=-1==m._?f:S[m._]||f,m._=d,w=z(e,m,h,i,o,s,a,c,l,u),g=m.v,m.ref&&h.ref!=m.ref&&(h.ref&&W(h.ref,null,m),u.push(m.ref,m.k||g,m)),null==v&&null!=g&&(v=g),(b=!!(4&m.C))||h.i===m.i?c=I(m,c,e,b):"function"==typeof m.type&&void 0!==w?c=w:g&&(c=g.nextSibling),m.C&=-7);return n.v=v,c}function I(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=I(i[o],t,n,r));return t}e.v!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=N(e)),n.insertBefore(e.v,t||null)),t=e.v);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function E(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 P(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||g.test(t)?n:n+"px"}function D(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||P(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||P(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(c,"$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=l,e.addEventListener(t,o?d:u,o)):e.removeEventListener(t,o?d:u,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 M(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t.t)t.t=l++;else if(t.t<r.u)return;return r(n.event?n.event(t):t)}}}function z(e,t,r,i,o,s,a,c,l,u){var d,h,m,f,p,g,b,x,N,_,$,C,I,E,P,D,M,z=t.type;if(null!=t.constructor)return null;128&r.C&&(l=!!(32&r.C),s=[c=t.v=r.v]),(d=n.p)&&d(t);e:if("function"==typeof z)try{if(x=t.props,N="prototype"in z&&z.prototype.render,_=(d=z.contextType)&&i[d.k],$=d?_?_.props.value:d.m:i,r.k?b=(h=t.k=r.k).m=h.j:(N?t.k=h=new z(x,$):(t.k=h=new S(x,$),h.constructor=z,h.render=B),_&&_.sub(h),h.props=x,h.state||(h.state={}),h.context=$,h.O=i,m=h.I=!0,h.A=[],h.W=[]),N&&null==h.L&&(h.L=h.state),N&&null!=z.getDerivedStateFromProps&&(h.L==h.state&&(h.L=v({},h.L)),v(h.L,z.getDerivedStateFromProps(x,h.L))),f=h.props,p=h.state,h.N=t,m)N&&null==z.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),N&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(N&&null==z.getDerivedStateFromProps&&x!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,$),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.L,$)||t.N==r.N){for(t.N!=r.N&&(h.props=x,h.state=h.L,h.I=!1),t.v=r.v,t.i=r.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,$),N&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(f,p,g)})}if(h.context=$,h.props=x,h.R=e,h.v=!1,I=n.P,E=0,N){for(h.state=h.L,h.I=!1,I&&I(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,I&&I(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=v(v({},i),h.getChildContext())),N&&!m&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(f,p)),D=d,null!=d&&d.type===k&&null==d.key&&(D=j(d.props.children)),c=T(e,y(D)?D:[D],t,r,i,o,s,a,c,l,u),h.base=t.v,t.C&=-161,h.A.length&&a.push(h),b&&(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--;)w(s[M]);R(t)}else t.v=r.v,t.i=r.i,e.then||R(t);n.v(e,t,r)}else null==s&&t.N==r.N?(t.i=r.i,t.v=r.v):c=t.v=A(r.v,t,r,i,o,s,a,l,u);return(d=n.diffed)&&d(t),128&t.C?void 0:c}function R(e){e&&e.k&&(e.k.v=!0),e&&e.i&&e.i.forEach(R)}function O(e,t,r){for(var i=0;i<r.length;i++)W(r[i],r[++i],r[++i]);n.k&&n.k(t,e),e.some(function(t){try{e=t.A,t.A=[],e.some(function(e){e.call(t)})}catch(e){n.v(e,t.N)}})}function j(e){return"object"!=typeof e||null==e||e.p&&e.p>0?e:y(e)?e.map(j):v({},e)}function A(e,r,i,o,s,a,c,l,u){var d,h,m,p,g,v,b,x=i.props,k=r.props,S=r.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&&(n.B&&n.B(r,a),l=!1),a=null}if(null==S)x===k||l&&e.data==k||(e.data=k);else{if(a=a&&t.call(e.childNodes),x=i.props||f,!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;D(e,d,null,g,s)}for(d in k)g=k[d],"children"==d?p=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?v=g:"checked"==d?b=g:l&&"function"!=typeof g||x[d]===g||D(e,d,g,x[d],s);if(h)l||m&&(h.H==m.H||h.H==e.innerHTML)||(e.innerHTML=h.H),r.i=[];else if(m&&(e.innerHTML=""),T("template"==r.type?e.content:e,y(p)?p:[p],r,i,o,"foreignObject"==S?"http://www.w3.org/1999/xhtml":s,a,c,a?a[0]:i.i&&N(i,0),l,u),null!=a)for(d=a.length;d--;)w(a[d]);l||(d="value","progress"==S&&null==v?e.removeAttribute("value"):null!=v&&(v!==e[d]||"progress"==S&&!v||"option"==S&&v!=x[d])&&D(e,d,v,x[d],s),d="checked",null!=b&&b!=e[d]&&D(e,d,b,x[d],s))}return e}function W(e,t,r){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){n.v(e,r)}}function L(e,t,r){var i,o;if(n.unmount&&n.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||W(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.v(e,t)}i.base=i.R=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&L(i[o],t,r||"function"!=typeof e.type);r||w(e.v),e.k=e.m=e.v=void 0}function B(e,t,n){return this.constructor(e,n)}t=p.slice,n={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}},r=0,S.prototype.setState=function(e,t){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=v({},this.state),"function"==typeof e&&(e=e(v({},n),this.props)),e&&v(n,e),null!=e&&this.N&&(t&&this.W.push(t),$(this))},S.prototype.forceUpdate=function(e){this.N&&(this.v=!0,e&&this.A.push(e),$(this))},S.prototype.render=k,i=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(e,t){return e.N.p-t.N.p},C.P=0,c=/(PointerCapture)$|Capture$/i,l=0,u=M(!1),d=M(!0),h=0,function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.API_ERROR="API_ERROR",e.VALIDATION_ERROR="VALIDATION_ERROR",e.STORAGE_ERROR="STORAGE_ERROR",e.TIMEOUT_ERROR="TIMEOUT_ERROR",e.MAINTENANCE_ERROR="MAINTENANCE_ERROR"}(m||(m={}));class F 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 q{handleNetworkError(e){return new F(m.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(e){if(503===e.status)return new F(m.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,e.status);const t=e.status>=500||429===e.status;return 429===e.status?new F(m.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,e.status):e.status>=400&&e.status<500?new F(m.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,e.status):e.status>=500?new F(m.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,e.status):new F(m.API_ERROR,`Request failed: ${e.statusText}`,t,e.status)}handleStorageError(e){return new F(m.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(e){return e.retryable}getUserFriendlyMessage(e){switch(e.type){case m.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case m.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case m.API_ERROR:return 429===e.statusCode?"Too many requests. Please wait a moment and try again.":e.statusCode&&e.statusCode>=400&&e.statusCode<500?"Invalid request. Please refresh the page and try again.":e.statusCode&&e.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case m.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case m.TIMEOUT_ERROR:return"Request timed out. Please try again.";case m.VALIDATION_ERROR:return e.validationErrors&&Object.keys(e.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."}}}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 F?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:e,method:t,body:n,skipOrgHeader:r=!1}){return this.executeWithRetry(async()=>{const i=new AbortController,o=setTimeout(()=>i.abort(),this.config.timeout);try{const s={"Content-Type":"application/json"},a=e.includes("signed=");r||a||(s["X-Organisation-ID"]=this.config.orgId);const c={method:t,headers:s,signal:i.signal};n&&(c.body=JSON.stringify(n));const l=await fetch(e,c);if(clearTimeout(o),!l.ok)throw await this.handleApiError(l);const u=await l.json();return u.data||u}catch(e){if(clearTimeout(o),e instanceof F)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new F(m.TIMEOUT_ERROR,"Request timed out",!0);if(e instanceof TypeError&&e.message.includes("fetch"))throw new F(m.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw e}})}getQuoteIntent(e){return this.makeRequest({url:e,method:"GET"})}async fetchAvailableProducts(t){var n;const r=null==t?void 0:t.includes("*"),i=!t||0===t.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)e(),l=a;else if(t&&t.length>0)l=a.filter(e=>t.includes(e.code));else if(i&&(null==c?void 0:c.products)&&c.products.length>0){const t=c.products.map(e=>e.code);l=t.map(e=>a.find(t=>t.code===e)).filter(e=>void 0!==e),e((a.length,l.length))}else i&&(e(),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(t){let n;for(let r=0;r<=this.config.retryConfig.maxRetries;r++)try{return e(this.config.retryConfig.maxRetries),await t()}catch(t){n=t;const i=this.retryStrategy.shouldRetry(n,r);if(e(t instanceof F&&(t.type,t.message)),e(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw e(),n;const o=t instanceof F?t.retryAfter:void 0,s=this.retryStrategy.getDelay(r,o);e(),await new Promise(e=>setTimeout(e,s))}throw n}async handleApiError(t){var n;const r=t.headers.get("retry-after"),i=await t.json().catch(()=>({}));if(e(),this.captureApiErrorToSentry(t,i),503===t.status)return new F(m.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);if(429===t.status)return new F(m.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,t.status,r||void 0);if(t.status>=500){const e=i.message||"Service temporarily unavailable. Please try again in a moment.";return new F(m.API_ERROR,e,!1,t.status)}if(422===t.status)try{const e=i;return e.error&&e.error.details&&e.error.details.form_data?new F(m.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,t.status,void 0,e.error.details):new F(m.VALIDATION_ERROR,e.message||"Validation failed. Please check your inputs.",!1,t.status,void 0,null===(n=e.error)||void 0===n?void 0:n.details)}catch(e){return new F(m.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,t.status)}if(400===t.status)try{const e=i;return e.errors?new F(m.VALIDATION_ERROR,e.message||"Form validation failed. Please check your inputs.",!1,t.status,void 0,e.errors):new F(m.API_ERROR,e.message||"Invalid request. Please check your input and try again.",!1,t.status)}catch(e){return new F(m.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status)}if(t.status>=400&&t.status<500){const e=i.message||"Invalid request. Please refresh the page and try again.";return new F(m.API_ERROR,e,!1,t.status)}return new F(m.API_ERROR,`Request failed: ${t.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(t.status),t.status)}captureApiErrorToSentry(e,t){try{(e.status>=500||429===e.status)&&Promise.resolve().then(function(){return Id}).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{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}}class J{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}}J.KEY_PREFIX="insure_os_",J.SEPARATOR="_";class Q{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||Q.DEFAULT_EXPIRATION_MS,namespace:t.namespace||Q.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{t.payment_transactions&&t.payment_transactions.length;const n=this.generateStorageKey(e),r=J.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=J.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 J.generateKey(this.config.namespace,e)}}Q.DEFAULT_EXPIRATION_MS=864e5,Q.DEFAULT_NAMESPACE="quote_intent";class V{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 K{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 X(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 ee(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 te(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 ne(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 re{static create(e){switch(e){case"string":case"text":case"select":return X;case"numeric":return ee;case"boolean":return te;case"date":return ne;default:throw new Error(`Unsupported condition type: ${e}`)}}}function ie(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:oe(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 oe(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=re.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var se=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:re,booleanMatchesCondition:te,checkSimpleConditions:ie,dateMatchesCondition:ne,numericMatchesCondition:ee,textMatchesCondition:X});function ae(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 ce(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=ie(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=ae(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=ie(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 le(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}function ue(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})}class de{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:le(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 he{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 me{constructor(e){this.httpClient=e}async calculateQuote(t){const n=await this.httpClient.calculateQuoteIntent(t);return e(),n}}function fe(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 Id}).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 pe(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 pe(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:ye(e),title:ge(e),message:n||we(e),details:t.message,retryable:be(e,0),timestamp:a,trackingId:c}}const l="string"==typeof t?t:"An unexpected error occurred";return{id:c,type:e,severity:ye(e),title:ge(e),message:n||l,retryable:be(e,0),timestamp:a,trackingId:c}}function pe(e,t,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=be(t,n);return{id:e,type:t,severity:s,statusCode:n,title:ge(t,n),message:i||ve(t,n,r),details:r,retryable:a,timestamp:o}}function ge(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 ye(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ve(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 we(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 be(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 xe(e){return"initialization"===e.type&&"critical"===e.severity}function ke(e){return"maintenance"===e.type||503===e.statusCode}function Se(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 Ne=null;function _e(e){Ne=e}function $e(){return Ne}function Ce(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 Te(e){var t,n;if(!(null==Ne?void 0:Ne.isEnabled()))return;const r={...Ce(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};Ne.push(r)}function Ie(e,t,n,r){var i,o;if(!(null==Ne?void 0:Ne.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={...Ce(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};Ne.push(c)}function Ee(e,t){if(!(null==Ne?void 0:Ne.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={...Ce(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};Ne.push(l)}function Pe(e,t,n,r,i){if(!(null==Ne?void 0:Ne.isEnabled()))return;const o={...Ce(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};Ne.push(o)}function De(e,t){if(!(null==Ne?void 0:Ne.isEnabled()))return;const n=t.referrals||[],r={...Ce(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};Ne.push(r)}function Me(e,t,n,r){if(!(null==Ne?void 0:Ne.isEnabled()))return;const i={...Ce(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};Ne.push(i)}function ze(e,t,n,r,i,o){if(!(null==Ne?void 0:Ne.isEnabled()))return;const s={...Ce(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};Ne.push(s)}function Re(e,t,n,r,i,o){if(!(null==Ne?void 0:Ne.isEnabled()))return;const s={...Ce(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};Ne.push(s)}class Oe{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 de(t,i,n),this.autoSaveManager=new K(this.config,this.saveFormData.bind(this)),this.navigationManager=new he(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new me(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(t,n,r,i){if(this.autoSaveManager.startTyping(),this.formData.page_data[t]||(this.formData.page_data[t]={}),this.formData.page_data[t].U||(this.formData.page_data[t].U={}),this.formData.page_data[t].U[n]=r,i){const n=this.getRatingFactorCodeById(i);n&&(this.formData.page_data[t][n]=r,e())}this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(t){var n;if(this.isUserTyping())return;const r=t.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),e(t.current_page),this.formData={...t,current_page:o},this.notify()}restoreCalculationResult(t){e(),e(t.outcome_type),this.calculationResult=t,t.default_excess_id&&(this.selectedExcessId=t.default_excess_id),e(),this.notify(),e()}getRatingFactorCodeById(t){const n=this.getFormDefinition();for(const e of n.pages)for(const n of e.fields){if(n.rating_factor_id===t)return n.code||n.id;if(n.rating_factor_mappings)for(const e of n.rating_factor_mappings)if(e.rating_factor_id===t)return e.rating_factor_code||n.code||n.id}return e(),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(t,n,r){return e(JSON.stringify(r)),"calculate_age"===n?this.calculateAge(t,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(t=!1,n="auto-save"){if(!t&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);e();const o={...this.formData,page_data:{...this.formData.page_data,J:i}};try{const e=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:t,saveType:n});if(!e.success){if(e.validationErrors){this.setServerValidationErrors(e.validationErrors),this.notify();const t=new Error("Validation failed");throw t.isValidationError=!0,t}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=fe("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;Ie(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=ce(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=ae(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 se}),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(){e();const t=this.getFormDefinition(),n=[],r=this.getAllFormDataFlattened();for(const i of t.pages){const t=ce(i,r);e(i.title,t.errors.length>0&&t.errors),n.push(...t.errors)}if(n.length>0)throw e(),this.validationErrors=n,this.notify(),new Error("Form validation failed");e(),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?Ee(this.quoteIntent,e):"referral"===e.outcome_type&&De(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(){e();try{await this.httpClient.deleteCalculations(this.quoteIntent.delete_calculations_url),this.calculationResult=void 0,this.selectedExcessId=null,this.selectedPaymentOption=null,this.notify(),e()}catch(t){throw e(),t}}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(t){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(e=>e.id===t.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");e();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(e=>e.gateway_id===t.gatewayId&&e.calculation_id===t.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(e=>e.id===t.calculationId);try{const e=await this.httpClient.initiatePayment(t,o);return s&&Me(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),e}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 je{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 Ae{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new je(this.httpClient,n)}}var We=0;function Le(e,t,r,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:r,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:--We,_:-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 n.vnode&&n.vnode(u),u}var Be,Fe,qe,He,Ue=0,Ze=[],Ye=n,Ge=Ye.p,Je=Ye.P,Qe=Ye.diffed,Ve=Ye.k,Ke=Ye.unmount,Xe=Ye.m;function et(e,t){Ye.A&&Ye.A(Fe,e,Ue||t),Ue=0;var n=Fe.X||(Fe.X={m:[],A:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function tt(e){return Ue=1,function(e,t){var n=et(Be++,2);if(n.t=e,!n.k&&(n.m=[ht(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=Fe,!Fe.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};Fe.te=!0;var i=Fe.shouldComponentUpdate,o=Fe.componentWillUpdate;Fe.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)},Fe.shouldComponentUpdate=r}return n.ee||n.m}(ht,e)}function nt(e,t){var n=et(Be++,3);!Ye.L&&dt(n.X,t)&&(n.m=e,n.u=t,Fe.X.A.push(n))}function rt(e){return Ue=5,it(function(){return{current:e}},[])}function it(e,t){var n=et(Be++,7);return dt(n.X,t)&&(n.m=e(),n.X=t,n.A=e),n.m}function ot(e,t){return Ue=8,it(function(){return e},t)}function st(){for(var e;e=Ze.shift();)if(e.R&&e.X)try{e.X.A.forEach(lt),e.X.A.forEach(ut),e.X.A=[]}catch(t){e.X.A=[],Ye.v(t,e.N)}}Ye.p=function(e){Fe=null,Ge&&Ge(e)},Ye.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),Xe&&Xe(e,t)},Ye.P=function(e){Je&&Je(e),Be=0;var t=(Fe=e.k).X;t&&(qe===Fe?(t.A=[],Fe.A=[],t.m.forEach(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.A.forEach(lt),t.A.forEach(ut),t.A=[],Be=0)),qe=Fe},Ye.diffed=function(e){Qe&&Qe(e);var t=e.k;t&&t.X&&(t.X.A.length&&(1!==Ze.push(t)&&He===Ye.requestAnimationFrame||((He=Ye.requestAnimationFrame)||ct)(st)),t.X.m.forEach(function(e){e.u&&(e.X=e.u),e.u=void 0})),qe=Fe=null},Ye.k=function(e,t){t.some(function(e){try{e.A.forEach(lt),e.A=e.A.filter(function(e){return!e.m||ut(e)})}catch(n){t.some(function(e){e.A&&(e.A=[])}),t=[],Ye.v(n,e.N)}}),Ve&&Ve(e,t)},Ye.unmount=function(e){Ke&&Ke(e);var t,n=e.k;n&&n.X&&(n.X.m.forEach(function(e){try{lt(e)}catch(e){t=e}}),n.X=void 0,t&&Ye.v(t,n.N))};var at="function"==typeof requestAnimationFrame;function ct(e){var t,n=function(){clearTimeout(r),at&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);at&&(t=requestAnimationFrame(n))}function lt(e){var t=Fe,n=e.k;"function"==typeof n&&(e.k=void 0,n()),Fe=t}function ut(e){var t=Fe;e.k=e.m(),Fe=t}function dt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ht(e,t){return"function"==typeof t?t(e):t}const mt="insure-os";let ft=!1;const pt=new Map,gt={[`--${mt}-radius`]:"0.75rem",[`--${mt}-radius-sm`]:"0.5rem",[`--${mt}-radius-lg`]:"1rem",[`--${mt}-background`]:"oklch(0.955 0 0)",[`--${mt}-foreground`]:"oklch(0.145 0 0)",[`--${mt}-card`]:"oklch(1 0 0)",[`--${mt}-card-foreground`]:"oklch(0.145 0 0)",[`--${mt}-popover`]:"oklch(1 0 0)",[`--${mt}-popover-foreground`]:"oklch(0.145 0 0)",[`--${mt}-primary`]:"oklch(0.205 0 0)",[`--${mt}-primary-foreground`]:"oklch(0.985 0 0)",[`--${mt}-secondary`]:"oklch(0.97 0 0)",[`--${mt}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${mt}-muted`]:"oklch(0.97 0 0)",[`--${mt}-muted-foreground`]:"oklch(0.556 0 0)",[`--${mt}-accent`]:"oklch(0.97 0 0)",[`--${mt}-accent-foreground`]:"oklch(0.205 0 0)",[`--${mt}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${mt}-border`]:"oklch(0.9 0 0)",[`--${mt}-input`]:"oklch(0.9 0 0)",[`--${mt}-ring`]:"oklch(0.708 0 0)",[`--${mt}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${mt}-font-size-large`]:"18px",[`--${mt}-font-size-small`]:"14px",[`--${mt}-font-size`]:"16px",[`--${mt}-border-width`]:"1px",[`--${mt}-transition-duration`]:"200ms",[`--${mt}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${mt}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${mt}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${mt}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${mt}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${mt}-spacing-sm`]:"0.75rem",[`--${mt}-spacing`]:"1rem",[`--${mt}-spacing-md`]:"1.5rem",[`--${mt}-spacing-lg`]:"2rem",[`--${mt}-spacing-xl`]:"3rem"},yt={colors:{background:`var(--${mt}-background)`,foreground:`var(--${mt}-foreground)`,card:`var(--${mt}-card)`,popover:`var(--${mt}-popover)`,popoverForeground:`var(--${mt}-popover-foreground)`,primary:`var(--${mt}-primary)`,primaryForeground:`var(--${mt}-primary-foreground)`,secondary:`var(--${mt}-secondary)`,muted:`var(--${mt}-muted)`,mutedForeground:`var(--${mt}-muted-foreground)`,accent:`var(--${mt}-accent)`,accentForeground:`var(--${mt}-accent-foreground)`,destructive:`var(--${mt}-destructive)`,border:`var(--${mt}-border)`,input:`var(--${mt}-input)`},fontSize:{small:`var(--${mt}-font-size-small)`,default:`var(--${mt}-font-size)`,large:`var(--${mt}-font-size-large)`},radius:{small:`var(--${mt}-radius-sm)`,default:`var(--${mt}-radius)`,large:`var(--${mt}-radius-lg)`},shadow:{sm:`var(--${mt}-shadow-sm)`,md:`var(--${mt}-shadow-md)`},spacing:{sm:`var(--${mt}-spacing-sm)`,default:`var(--${mt}-spacing)`,md:`var(--${mt}-spacing-md)`,lg:`var(--${mt}-spacing-lg)`,xl:`var(--${mt}-spacing-xl)`},fontFamily:`var(--${mt}-font-family)`,borderWidth:`var(--${mt}-border-width)`,transition:`var(--${mt}-transition-duration) var(--${mt}-transition-timing-function)`},vt=new Set;function wt(e){if(!document.getElementById(`${mt}-styles`)){const e=document.createElement("style");e.id=`${mt}-styles`,document.head.appendChild(e)}document.getElementById(`${mt}-styles`).textContent+=e+"\n"}function bt(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 xt(){ft||(wt(`:root {\n${Object.entries(gt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),ft=!0)}const kt={name:e=>`${mt}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){xt();const r=bt(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=pt.get(o);if(s)return s.fullClassName;let a=e;const c=this.name(a);return vt.has(a)||(wt(`.${c} { ${r} }`),vt.add(a)),pt.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),c},keyframes(e,t){const n=`${mt}-${e}`;return vt.has(`keyframes-${e}`)||(wt(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${bt(t)} }`).join("\n")}\n}`),vt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;wt(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${mt}-${e} { ${bt(t)} }`).join("\n")}\n}`),vt.add(n)},pseudoElement(e,t,n){const r=`${mt}-${e}`,i=`${e}-${t}`;return vt.has(i)||(wt(`.${r}${t} { ${bt(n)} }`),vt.add(i)),r}};var St=Object.freeze({__proto__:null,baseVariables:gt,styles:kt,theme:yt,updateBaseVariables:function(t){e(),Object.assign(gt,t);const n=document.getElementById(`${mt}-styles`);if(n){const t=n.textContent||"",r=`:root {\n${Object.entries(gt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,i=t.includes(":root {")?t.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+t;n.textContent=i,e()}else xt()}});function Nt(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var _t,$t={exports:{}};function Ct(){return _t||(_t=1,e=$t,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}()),$t.exports;var e}var Tt=Nt(Ct());function It({size:e="small"}){const t=kt.create("spinner-small",{width:"16px",height:"16px"}),n=kt.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return kt.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Le("div",{className:kt.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Le("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:Tt(r),children:Le("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function Et({className:e,children:t,size:n="md"}){const r={sm:yt.spacing.sm,md:yt.spacing.md,lg:yt.spacing.lg,xl:yt.spacing.xl},i=kt.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?yt.spacing.lg:"lg"===n?yt.spacing.md:r[n]},"(max-width: 480px)":{padding:yt.spacing.sm}});return Le("div",{className:Tt(i,e),children:t})}const Pt=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,$(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"+h++,e.m=null,e.Provider=e.re=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}();function Dt({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a}){return Le(Pt.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function Mt(){const e=function(e){var t=Fe.context[e.k],n=et(Be++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(Fe)),t.props.value):e.m}(Pt);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function zt(e){const t=Mt(),{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]=tt(()=>e(n));return nt(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class Rt extends Error{}class Ot extends Rt{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class jt extends Rt{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class At extends Rt{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Wt extends Rt{}class Lt extends Rt{constructor(e){super(`Invalid unit ${e}`)}}class Bt extends Rt{}class Ft extends Rt{constructor(){super("Zone is an abstract class")}}const qt="numeric",Ht="short",Ut="long",Zt={year:qt,month:qt,day:qt},Yt={year:qt,month:Ht,day:qt},Gt={year:qt,month:Ht,day:qt,weekday:Ht},Jt={year:qt,month:Ut,day:qt},Qt={year:qt,month:Ut,day:qt,weekday:Ut},Vt={hour:qt,minute:qt},Kt={hour:qt,minute:qt,second:qt},Xt={hour:qt,minute:qt,second:qt,timeZoneName:Ht},en={hour:qt,minute:qt,second:qt,timeZoneName:Ut},tn={hour:qt,minute:qt,hourCycle:"h23"},nn={hour:qt,minute:qt,second:qt,hourCycle:"h23"},rn={hour:qt,minute:qt,second:qt,hourCycle:"h23",timeZoneName:Ht},on={hour:qt,minute:qt,second:qt,hourCycle:"h23",timeZoneName:Ut},sn={year:qt,month:qt,day:qt,hour:qt,minute:qt},an={year:qt,month:qt,day:qt,hour:qt,minute:qt,second:qt},cn={year:qt,month:Ht,day:qt,hour:qt,minute:qt},ln={year:qt,month:Ht,day:qt,hour:qt,minute:qt,second:qt},un={year:qt,month:Ht,day:qt,weekday:Ht,hour:qt,minute:qt},dn={year:qt,month:Ut,day:qt,hour:qt,minute:qt,timeZoneName:Ht},hn={year:qt,month:Ut,day:qt,hour:qt,minute:qt,second:qt,timeZoneName:Ht},mn={year:qt,month:Ut,day:qt,weekday:Ut,hour:qt,minute:qt,timeZoneName:Ut},fn={year:qt,month:Ut,day:qt,weekday:Ut,hour:qt,minute:qt,second:qt,timeZoneName:Ut};class pn{get type(){throw new Ft}get name(){throw new Ft}get ianaName(){return this.name}get isUniversal(){throw new Ft}offsetName(e,t){throw new Ft}formatOffset(e,t){throw new Ft}offset(e){throw new Ft}equals(e){throw new Ft}get isValid(){throw new Ft}}let gn=null;class yn extends pn{static get instance(){return null===gn&&(gn=new yn),gn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jr(e,t,n)}formatOffset(e,t){return Br(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const vn=new Map,wn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},bn=new Map;class xn extends pn{static create(e){let t=bn.get(e);return void 0===t&&bn.set(e,t=new xn(e)),t}static resetCache(){bn.clear(),vn.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=xn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jr(e,t,n,this.name)}formatOffset(e,t){return Br(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=vn.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"}),vn.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=wn[t];"era"===t?r[o]=i:gr(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,(Mr({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 kn={};const Sn=new Map;function Nn(e,t={}){const n=JSON.stringify([e,t]);let r=Sn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),Sn.set(n,r)),r}const _n=new Map,$n=new Map;let Cn=null;const Tn=new Map;function In(e){let t=Tn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),Tn.set(e,t)),t}const En=new Map;function Pn(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class Dn{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=_n.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),_n.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 _r(this.floor?Math.floor(e):Ir(e,3),this.padTo)}}class Mn{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&&xn.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=Nn(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 zn{constructor(e,t,n){this.opts={style:"long",...n},!t&&wr()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=$n.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),$n.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 Rn={firstDay:1,minimalDays:4,weekend:[6,7]};class On{static fromOpts(e){return On.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||er.defaultLocale,s=o||(i?"en-US":Cn||(Cn=(new Intl.DateTimeFormat).resolvedOptions().locale,Cn)),a=t||er.defaultNumberingSystem,c=n||er.defaultOutputCalendar,l=Sr(r)||er.defaultWeekSettings;return new On(s,a,c,l,o)}static resetCache(){Cn=null,Sn.clear(),_n.clear(),$n.clear(),Tn.clear(),En.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return On.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=Nn(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=Nn(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"===In(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?On.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Sr(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 Pn(this,e,Zr,()=>{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=Jo.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Pn(this,e,Qr,()=>{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=Jo.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return Pn(this,void 0,()=>Vr,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Jo.utc(2016,11,13,9),Jo.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Pn(this,e,ti,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Jo.utc(-40,1,1),Jo.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 Dn(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Mn(e,this.intl,t)}relFormatter(e={}){return new zn(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=kn[n];return r||(r=new Intl.ListFormat(e,t),kn[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||In(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:br()?function(e){let t=En.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...Rn,...t}),En.set(e,t)}return t}(this.locale):Rn}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 jn=null;class An extends pn{static get utcInstance(){return null===jn&&(jn=new An(0)),jn}static instance(e){return 0===e?An.utcInstance:new An(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new An(Ar(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Br(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Br(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Br(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 Wn extends pn{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 Ln(e,t){if(gr(e)||null===e)return t;if(e instanceof pn)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?yn.instance:"utc"===n||"gmt"===n?An.utcInstance:An.parseSpecifier(n)||xn.create(e)}return yr(e)?An.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Wn(e)}const Bn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Fn={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]},qn=Bn.hanidec.replace(/[\[|\]]/g,"").split(""),Hn=new Map;function Un({numberingSystem:e},t=""){const n=e||"latn";let r=Hn.get(n);void 0===r&&(r=new Map,Hn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${Bn[n]}${t}`),r.set(t,i)),i}let Zn,Yn=()=>Date.now(),Gn="system",Jn=null,Qn=null,Vn=null,Kn=60,Xn=null;class er{static get now(){return Yn}static set now(e){Yn=e}static set defaultZone(e){Gn=e}static get defaultZone(){return Ln(Gn,yn.instance)}static get defaultLocale(){return Jn}static set defaultLocale(e){Jn=e}static get defaultNumberingSystem(){return Qn}static set defaultNumberingSystem(e){Qn=e}static get defaultOutputCalendar(){return Vn}static set defaultOutputCalendar(e){Vn=e}static get defaultWeekSettings(){return Xn}static set defaultWeekSettings(e){Xn=Sr(e)}static get twoDigitCutoffYear(){return Kn}static set twoDigitCutoffYear(e){Kn=e%100}static get throwOnInvalid(){return Zn}static set throwOnInvalid(e){Zn=e}static resetCaches(){On.resetCache(),xn.resetCache(),Jo.resetCache(),Hn.clear()}}class tr{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const nr=[0,31,59,90,120,151,181,212,243,273,304,334],rr=[0,31,60,91,121,152,182,213,244,274,305,335];function ir(e,t){return new tr("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function or(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 sr(e,t,n){return n+(Er(e)?rr:nr)[t-1]}function ar(e,t){const n=Er(e)?rr:nr,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function cr(e,t){return(e-t+7)%7+1}function lr(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=sr(r,i,o),a=cr(or(r,i,o),n);let c,l=Math.floor((s-a+14-t)/7);return l<1?(c=r-1,l=Rr(c,t,n)):l>Rr(r,t,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...Fr(e)}}function ur(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=cr(or(r,1,t),n),a=Pr(r);let c,l=7*i+o-s-7+t;l<1?(c=r-1,l+=Pr(c)):l>a?(c=r+1,l-=Pr(r)):c=r;const{month:u,day:d}=ar(c,l);return{year:c,month:u,day:d,...Fr(e)}}function dr(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:sr(t,n,r),...Fr(e)}}function hr(e){const{year:t,ordinal:n}=e,{month:r,day:i}=ar(t,n);return{year:t,month:r,day:i,...Fr(e)}}function mr(e,t){if(!gr(e.localWeekday)||!gr(e.localWeekNumber)||!gr(e.localWeekYear)){if(!gr(e.weekday)||!gr(e.weekNumber)||!gr(e.weekYear))throw new Wt("Cannot mix locale-based week fields with ISO-based week fields");return gr(e.localWeekday)||(e.weekday=e.localWeekday),gr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),gr(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 fr(e){const t=vr(e.year),n=Nr(e.month,1,12),r=Nr(e.day,1,Dr(e.year,e.month));return t?n?!r&&ir("day",e.day):ir("month",e.month):ir("year",e.year)}function pr(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=Nr(t,0,23)||24===t&&0===n&&0===r&&0===i,s=Nr(n,0,59),a=Nr(r,0,59),c=Nr(i,0,999);return o?s?a?!c&&ir("millisecond",i):ir("second",r):ir("minute",n):ir("hour",t)}function gr(e){return void 0===e}function yr(e){return"number"==typeof e}function vr(e){return"number"==typeof e&&e%1==0}function wr(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function br(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function xr(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 kr(e,t){return{}.hasOwnProperty.call(e,t)}function Sr(e){if(null==e)return null;if("object"!=typeof e)throw new Bt("Week settings must be an object");if(!Nr(e.firstDay,1,7)||!Nr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!Nr(e,1,7)))throw new Bt("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Nr(e,t,n){return vr(e)&&e>=t&&e<=n}function _r(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function $r(e){return gr(e)||null===e||""===e?void 0:parseInt(e,10)}function Cr(e){return gr(e)||null===e||""===e?void 0:parseFloat(e)}function Tr(e){if(!gr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function Ir(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 Er(e){return e%4==0&&(e%100!=0||e%400==0)}function Pr(e){return Er(e)?366:365}function Dr(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?Er(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Mr(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 zr(e,t,n){return-cr(or(e,1,t),n)+t-1}function Rr(e,t=4,n=1){const r=zr(e,t,n),i=zr(e+1,t,n);return(Pr(e)-r+i)/7}function Or(e){return e>99?e:e>er.twoDigitCutoffYear?1900+e:2e3+e}function jr(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 Ar(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 Wr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Bt(`Invalid unit value ${e}`);return t}function Lr(e,t){const n={};for(const r in e)if(kr(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=Wr(i)}return n}function Br(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}${_r(n,2)}:${_r(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${_r(n,2)}${_r(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Fr(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const qr=["January","February","March","April","May","June","July","August","September","October","November","December"],Hr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ur=["J","F","M","A","M","J","J","A","S","O","N","D"];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","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 Yr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Gr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Jr=["M","T","W","T","F","S","S"];function Qr(e){switch(e){case"narrow":return[...Jr];case"short":return[...Gr];case"long":return[...Yr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Vr=["AM","PM"],Kr=["Before Christ","Anno Domini"],Xr=["BC","AD"],ei=["B","A"];function ti(e){switch(e){case"narrow":return[...ei];case"short":return[...Xr];case"long":return[...Kr];default:return null}}function ni(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const ri={D:Zt,DD:Yt,DDD:Jt,DDDD:Qt,t:Vt,tt:Kt,ttt:Xt,tttt:en,T:tn,TT:nn,TTT:rn,TTTT:on,f:sn,ff:cn,fff:dn,ffff:mn,F:an,FF:ln,FFF:hn,FFFF:fn};class ii{static create(e,t={}){return new ii(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 ri[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 _r(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 Zr(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return Qr(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),c=t=>{const n=ii.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},l=t=>n?function(e,t){return ti(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return ni(ii.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 Vr[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=ii.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 ni(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 oi=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function si(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function ai(...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 ci(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 li(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=$r(t[n+i]);return[r,null,n+i]}}const ui=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,di=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,hi=RegExp(`${di.source}(?:${ui.source}?(?:\\[(${oi.source})\\])?)?`),mi=RegExp(`(?:[Tt]${hi.source})?`),fi=li("weekYear","weekNumber","weekDay"),pi=li("year","ordinal"),gi=RegExp(`${di.source} ?(?:${ui.source}|(${oi.source}))?`),yi=RegExp(`(?: ${gi.source})?`);function vi(e,t,n){const r=e[t];return gr(r)?n:$r(r)}function wi(e,t){return[{hours:vi(e,t,0),minutes:vi(e,t+1,0),seconds:vi(e,t+2,0),milliseconds:Tr(e[t+3])},null,t+4]}function bi(e,t){const n=!e[t]&&!e[t+1],r=Ar(e[t+1],e[t+2]);return[{},n?null:An.instance(r),t+3]}function xi(e,t){return[{},e[t]?xn.create(e[t]):null,t+1]}const ki=RegExp(`^T?${di.source}$`),Si=/^-?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 Ni(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(Cr(n)),months:h(Cr(r)),weeks:h(Cr(i)),days:h(Cr(o)),hours:h(Cr(s)),minutes:h(Cr(a)),seconds:h(Cr(c),"-0"===c),milliseconds:h(Tr(l),d)}]}const _i={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function $i(e,t,n,r,i,o,s){const a={year:2===t.length?Or($r(t)):$r(t),month:Hr.indexOf(n)+1,day:$r(r),hour:$r(i),minute:$r(o)};return s&&(a.second=$r(s)),e&&(a.weekday=e.length>3?Yr.indexOf(e)+1:Gr.indexOf(e)+1),a}const Ci=/^(?:(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 Ti(e){const[,t,n,r,i,o,s,a,c,l,u,d]=e,h=$i(t,i,r,n,o,s,a);let m;return m=c?_i[c]:l?0:Ar(u,d),[h,new An(m)]}const Ii=/^(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$/,Ei=/^(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$/,Pi=/^(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 Di(e){const[,t,n,r,i,o,s,a]=e;return[$i(t,i,r,n,o,s,a),An.utcInstance]}function Mi(e){const[,t,n,r,i,o,s,a]=e;return[$i(t,a,n,r,i,o,s),An.utcInstance]}const zi=si(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,mi),Ri=si(/(\d{4})-?W(\d\d)(?:-?(\d))?/,mi),Oi=si(/(\d{4})-?(\d{3})/,mi),ji=si(hi),Ai=ai(function(e,t){return[{year:vi(e,t),month:vi(e,t+1,1),day:vi(e,t+2,1)},null,t+3]},wi,bi,xi),Wi=ai(fi,wi,bi,xi),Li=ai(pi,wi,bi,xi),Bi=ai(wi,bi,xi),Fi=ai(wi),qi=si(/(\d{4})-(\d\d)-(\d\d)/,yi),Hi=si(gi),Ui=ai(wi,bi,xi),Zi="Invalid Duration",Yi={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}},Gi={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},...Yi},Ji={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},...Yi},Qi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Vi=Qi.slice(0).reverse();function Ki(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 no(r)}function Xi(e,t){let n=t.milliseconds??0;for(const r of Vi.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function eo(e,t){const n=Xi(e,t)<0?-1:1;Qi.reduceRight((r,i)=>{if(gr(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),Qi.reduce((n,r)=>{if(gr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function to(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class no{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?Ji:Gi;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||On.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return no.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Bt("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new no({values:Lr(e,no.normalizeUnit),loc:On.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(yr(e))return no.fromMillis(e);if(no.isDuration(e))return e;if("object"==typeof e)return no.fromObject(e);throw new Bt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return ci(e,[Si,Ni])}(e);return n?no.fromObject(n,t):no.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return ci(e,[ki,Fi])}(e);return n?no.fromObject(n,t):no.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Bt("need to specify a reason the Duration is invalid");const n=e instanceof tr?e:new tr(e,t);if(er.throwOnInvalid)throw new At(n);return new no({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 Lt(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?ii.create(this.loc,n).formatDurationFromString(this,e):Zi}toHuman(e={}){if(!this.isValid)return Zi;const t=!1!==e.showZeros,n=Qi.map(n=>{const r=this.values[n];return gr(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+=Ir(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},Jo.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?Xi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=no.fromDurationLike(e),n={};for(const e of Qi)(kr(t.values,e)||kr(this.values,e))&&(n[e]=t.get(e)+this.get(e));return Ki(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=no.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]=Wr(e(this.values[n],n));return Ki(this,{values:t},!0)}get(e){return this[no.normalizeUnit(e)]}set(e){return this.isValid?Ki(this,{values:{...this.values,...Lr(e,no.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return Ki(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 eo(this.matrix,e),Ki(this,{values:e},!0)}rescale(){return this.isValid?Ki(this,{values:to(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>no.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of Qi)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;yr(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else yr(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 eo(this.matrix,t),Ki(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 Ki(this,{values:e},!0)}removeZeros(){return this.isValid?Ki(this,{values:to(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 Qi)if(!t(this.values[n],e.values[n]))return!1;return!0}}const ro="Invalid Interval";class io{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 Bt("need to specify a reason the Interval is invalid");const n=e instanceof tr?e:new tr(e,t);if(er.throwOnInvalid)throw new jt(n);return new io({invalid:n})}static fromDateTimes(e,t){const n=Qo(e),r=Qo(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?io.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:io.invalid("missing or invalid end"):io.invalid("missing or invalid start")}(n,r);return null==i?new io({start:n,end:r}):i}static after(e,t){const n=no.fromDurationLike(t),r=Qo(e);return io.fromDateTimes(r,r.plus(n))}static before(e,t){const n=no.fromDurationLike(t),r=Qo(e);return io.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=Jo.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=Jo.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return io.fromDateTimes(e,o);if(i){const n=no.fromISO(r,t);if(n.isValid)return io.after(e,n)}else if(s){const e=no.fromISO(n,t);if(e.isValid)return io.before(o,e)}}return io.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?io.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Qo).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(io.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=no.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(io.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:io.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 io.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(io.fromDateTimes(t,e.time)),t=null);return io.merge(r)}difference(...e){return io.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ro}[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=Zt,t={}){return this.isValid?ii.create(this.s.loc.clone(t),e).formatInterval(this):ro}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ro}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ro}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ro}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ro}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):no.invalid(this.invalidReason)}mapEndpoints(e){return io.fromDateTimes(e(this.s),e(this.e))}}class oo{static hasDST(e=er.defaultZone){const t=Jo.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return xn.isValidZone(e)}static normalizeZone(e){return Ln(e,er.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||On.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||On.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||On.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||On.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||On.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||On.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||On.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return On.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return On.create(t,null,"gregory").eras(e)}static features(){return{relative:wr(),localeWeek:br()}}}function so(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(no.fromMillis(r).as("days"))}function ao(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(Bn.hanidec))t+=qn.indexOf(e[n]);else for(const e in Fn){const[n,i]=Fn[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const co=`[ ${String.fromCharCode(160)}]`,lo=new RegExp(co,"g");function uo(e){return e.replace(/\./g,"\\.?").replace(lo,co)}function ho(e){return e.replace(/\./g,"").replace(lo," ").toLowerCase()}function mo(e,t){return null===e?null:{regex:RegExp(e.map(uo).join("|")),deser:([n])=>e.findIndex(e=>ho(n)===ho(e))+t}}function fo(e,t){return{regex:e,deser:([,e,t])=>Ar(e,t),groups:t}}function po(e){return{regex:e,deser:([e])=>e}}const go={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 yo=null;function vo(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=xo(ii.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class wo{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=vo(ii.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=Un(t),r=Un(t,"{2}"),i=Un(t,"{3}"),o=Un(t,"{4}"),s=Un(t,"{6}"),a=Un(t,"{1,2}"),c=Un(t,"{1,3}"),l=Un(t,"{1,6}"),u=Un(t,"{1,9}"),d=Un(t,"{2,4}"),h=Un(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 mo(t.eras("short"),0);case"GG":return mo(t.eras("long"),0);case"y":return ao(l);case"yy":case"kk":return ao(d,Or);case"yyyy":case"kkkk":return ao(o);case"yyyyy":return ao(h);case"yyyyyy":return ao(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return ao(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return ao(r);case"MMM":return mo(t.months("short",!0),1);case"MMMM":return mo(t.months("long",!0),1);case"LLL":return mo(t.months("short",!1),1);case"LLLL":return mo(t.months("long",!1),1);case"o":case"S":return ao(c);case"ooo":case"SSS":return ao(i);case"u":return po(u);case"uu":return po(a);case"uuu":case"E":case"c":return ao(n);case"a":return mo(t.meridiems(),0);case"EEE":return mo(t.weekdays("short",!1),1);case"EEEE":return mo(t.weekdays("long",!1),1);case"ccc":return mo(t.weekdays("short",!0),1);case"cccc":return mo(t.weekdays("long",!0),1);case"Z":case"ZZ":return fo(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return fo(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return po(/[a-z_+-/]{1,256}?/i);case" ":return po(/[^\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(kr(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;gr(e.z)||(n=xn.create(e.z)),gr(e.Z)||(n||(n=new An(e.Z)),t=e.Z),gr(e.q)||(e.M=3*(e.q-1)+1),gr(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),gr(e.u)||(e.S=Tr(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(kr(n,"a")&&kr(n,"H"))throw new Wt("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 bo(e,t,n){return new wo(e,n).explainFromTokens(t)}function xo(e,t){if(!e)return null;const n=ii.create(t,e).dtFormatter((yo||(yo=Jo.fromMillis(1555555555555)),yo)),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=go[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const ko="Invalid DateTime",So=864e13;function No(e){return new tr("unsupported zone",`the zone "${e.name}" is not supported`)}function _o(e){return null===e.weekData&&(e.weekData=lr(e.c)),e.weekData}function $o(e){return null===e.localWeekData&&(e.localWeekData=lr(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Co(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new Jo({...n,...t,old:n})}function To(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 Io(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 Eo(e,t,n){return To(Mr(e),t,n)}function Po(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,Dr(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=no.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=Mr(o);let[c,l]=To(a,n,e.zone);return 0!==s&&(c+=s,l=e.zone.offset(c)),{ts:c,o:l}}function Do(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=Jo.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Jo.invalid(new tr("unparsable",`the input "${i}" can't be parsed as ${r}`))}function Mo(e,t,n=!0){return e.isValid?ii.create(On.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function zo(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=_r(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=_r(e.c.month),"month"===n)return i;i+="-"}else if(i+=_r(e.c.month),"month"===n)return i;return i+=_r(e.c.day),i}function Ro(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+=_r(e.c.hour),"hour"===s)break;if(t){if(c+=":",c+=_r(e.c.minute),"minute"===s)break;a&&(c+=":",c+=_r(e.c.second))}else{if(c+=_r(e.c.minute),"minute"===s)break;a&&(c+=_r(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(c+=".",c+=_r(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?c+="Z":e.o<0?(c+="-",c+=_r(Math.trunc(-e.o/60)),c+=":",c+=_r(Math.trunc(-e.o%60))):(c+="+",c+=_r(Math.trunc(e.o/60)),c+=":",c+=_r(Math.trunc(e.o%60)))),o&&(c+="["+e.zone.ianaName+"]"),c}const Oo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},jo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ao={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Wo=["year","month","day","hour","minute","second","millisecond"],Lo=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Bo=["year","ordinal","hour","minute","second","millisecond"];function Fo(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 Lt(e);return t}function qo(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Fo(e)}}function Ho(e,t){const n=Ln(t.zone,er.defaultZone);if(!n.isValid)return Jo.invalid(No(n));const r=On.fromObject(t);let i,o;if(gr(e.year))i=er.now();else{for(const t of Wo)gr(e[t])&&(e[t]=Oo[t]);const t=fr(e)||pr(e);if(t)return Jo.invalid(t);const r=function(e){if(void 0===Yo&&(Yo=er.now()),"iana"!==e.type)return e.offset(Yo);const t=e.name;let n=Go.get(t);return void 0===n&&(n=e.offset(Yo),Go.set(t,n)),n}(n);[i,o]=Eo(e,r,n)}return new Jo({ts:i,zone:n,loc:r,o:o})}function Uo(e,t,n){const r=!!gr(n.round)||n.round,i=gr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=Ir(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 Zo(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 Yo;const Go=new Map;class Jo{constructor(e){const t=e.zone||er.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new tr("invalid input"):null)||(t.isValid?null:No(t));this.ts=gr(e.ts)?er.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=yr(e.o)&&!e.old?e.o:t.offset(this.ts);r=Io(this.ts,o),n=Number.isNaN(r.year)?new tr("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||On.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Jo({})}static local(){const[e,t]=Zo(arguments),[n,r,i,o,s,a,c]=t;return Ho({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},e)}static utc(){const[e,t]=Zo(arguments),[n,r,i,o,s,a,c]=t;return e.zone=An.utcInstance,Ho({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 Jo.invalid("invalid input");const r=Ln(t.zone,er.defaultZone);return r.isValid?new Jo({ts:n,zone:r,loc:On.fromObject(t)}):Jo.invalid(No(r))}static fromMillis(e,t={}){if(yr(e))return e<-So||e>So?Jo.invalid("Timestamp out of range"):new Jo({ts:e,zone:Ln(t.zone,er.defaultZone),loc:On.fromObject(t)});throw new Bt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(yr(e))return new Jo({ts:1e3*e,zone:Ln(t.zone,er.defaultZone),loc:On.fromObject(t)});throw new Bt("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Ln(t.zone,er.defaultZone);if(!n.isValid)return Jo.invalid(No(n));const r=On.fromObject(t),i=Lr(e,qo),{minDaysInFirstWeek:o,startOfWeek:s}=mr(i,r),a=er.now(),c=gr(t.specificOffset)?n.offset(a):t.specificOffset,l=!gr(i.ordinal),u=!gr(i.year),d=!gr(i.month)||!gr(i.day),h=u||d,m=i.weekYear||i.weekNumber;if((h||l)&&m)throw new Wt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new Wt("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!h;let p,g,y=Io(a,c);f?(p=Lo,g=jo,y=lr(y,o,s)):l?(p=Bo,g=Ao,y=dr(y)):(p=Wo,g=Oo);let v=!1;for(const e of p)gr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=f?function(e,t=4,n=1){const r=vr(e.weekYear),i=Nr(e.weekNumber,1,Rr(e.weekYear,t,n)),o=Nr(e.weekday,1,7);return r?i?!o&&ir("weekday",e.weekday):ir("week",e.weekNumber):ir("weekYear",e.weekYear)}(i,o,s):l?function(e){const t=vr(e.year),n=Nr(e.ordinal,1,Pr(e.year));return t?!n&&ir("ordinal",e.ordinal):ir("year",e.year)}(i):fr(i),b=w||pr(i);if(b)return Jo.invalid(b);const x=f?ur(i,o,s):l?hr(i):i,[k,S]=Eo(x,c,n),N=new Jo({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&e.weekday!==N.weekday?Jo.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${N.toISO()}`):N.isValid?N:Jo.invalid(N.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return ci(e,[zi,Ai],[Ri,Wi],[Oi,Li],[ji,Bi])}(e);return Do(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return ci(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[Ci,Ti])}(e);return Do(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return ci(e,[Ii,Di],[Ei,Di],[Pi,Mi])}(e);return Do(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(gr(e)||gr(t))throw new Bt("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=On.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,l]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=bo(e,t,n);return[r,i,o,s]}(o,e,t);return l?Jo.invalid(l):Do(s,a,n,`format ${t}`,e,c)}static fromString(e,t,n={}){return Jo.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return ci(e,[qi,Ai],[Hi,Ui])}(e);return Do(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Bt("need to specify a reason the DateTime is invalid");const n=e instanceof tr?e:new tr(e,t);if(er.throwOnInvalid)throw new Ot(n);return new Jo({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=xo(e,On.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return vo(ii.parseFormat(e),On.fromObject(t)).map(e=>e.val).join("")}static resetCache(){Yo=void 0,Go.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?_o(this).weekYear:NaN}get weekNumber(){return this.isValid?_o(this).weekNumber:NaN}get weekday(){return this.isValid?_o(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?$o(this).weekday:NaN}get localWeekNumber(){return this.isValid?$o(this).weekNumber:NaN}get localWeekYear(){return this.isValid?$o(this).weekYear:NaN}get ordinal(){return this.isValid?dr(this.c).ordinal:NaN}get monthShort(){return this.isValid?oo.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?oo.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?oo.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?oo.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=Mr(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=Io(a,o),u=Io(c,s);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[Co(this,{ts:a}),Co(this,{ts:c})]:[this]}get isInLeapYear(){return Er(this.year)}get daysInMonth(){return Dr(this.year,this.month)}get daysInYear(){return this.isValid?Pr(this.year):NaN}get weeksInWeekYear(){return this.isValid?Rr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Rr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=ii.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(An.instance(e),t)}toLocal(){return this.setZone(er.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=Ln(e,er.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]=Eo(n,t,e)}return Co(this,{ts:r,zone:e})}return Jo.invalid(No(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return Co(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=Lr(e,qo),{minDaysInFirstWeek:n,startOfWeek:r}=mr(t,this.loc),i=!gr(t.weekYear)||!gr(t.weekNumber)||!gr(t.weekday),o=!gr(t.ordinal),s=!gr(t.year),a=!gr(t.month)||!gr(t.day),c=s||a,l=t.weekYear||t.weekNumber;if((c||o)&&l)throw new Wt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Wt("Can't mix ordinal dates with month/day");let u;i?u=ur({...lr(this.c,n,r),...t},n,r):gr(t.ordinal)?(u={...this.toObject(),...t},gr(t.day)&&(u.day=Math.min(Dr(u.year,u.month),u.day))):u=hr({...dr(this.c),...t});const[d,h]=Eo(u,this.o,this.zone);return Co(this,{ts:d,o:h})}plus(e){return this.isValid?Co(this,Po(this,no.fromDurationLike(e))):this}minus(e){return this.isValid?Co(this,Po(this,no.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=no.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?ii.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):ko}toLocaleString(e=Zt,t={}){return this.isValid?ii.create(this.loc.clone(t),e).formatDateTime(this):ko}toLocaleParts(e={}){return this.isValid?ii.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=zo(this,s,o=Fo(o));return Wo.indexOf(o)>=3&&(a+="T"),a+=Ro(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?zo(this,"extended"===e,Fo(t)):null}toISOWeekDate(){return Mo(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=Fo(s),(r&&Wo.indexOf(s)>=3?"T":"")+Ro(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return Mo(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Mo(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?zo(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")),Mo(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ko}[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 no.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(no.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=so(e,t);return(n-n%7)/7}],["days",so]],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=no.fromObject(o,r);return l.length>0?no.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(Jo.now(),e,t)}until(e){return this.isValid?io.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||Jo.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),Uo(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Uo(e.base||Jo.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(Jo.isDateTime))throw new Bt("min requires all arguments be DateTimes");return xr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(Jo.isDateTime))throw new Bt("max requires all arguments be DateTimes");return xr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return bo(On.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return Jo.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=On.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new wo(i,e)}static fromFormatParser(e,t,n={}){if(gr(e)||gr(t))throw new Bt("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=On.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new Bt(`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?Jo.invalid(l):Do(s,a,n,`format ${t.format}`,e,c)}static get DATE_SHORT(){return Zt}static get DATE_MED(){return Yt}static get DATE_MED_WITH_WEEKDAY(){return Gt}static get DATE_FULL(){return Jt}static get DATE_HUGE(){return Qt}static get TIME_SIMPLE(){return Vt}static get TIME_WITH_SECONDS(){return Kt}static get TIME_WITH_SHORT_OFFSET(){return Xt}static get TIME_WITH_LONG_OFFSET(){return en}static get TIME_24_SIMPLE(){return tn}static get TIME_24_WITH_SECONDS(){return nn}static get TIME_24_WITH_SHORT_OFFSET(){return rn}static get TIME_24_WITH_LONG_OFFSET(){return on}static get DATETIME_SHORT(){return sn}static get DATETIME_SHORT_WITH_SECONDS(){return an}static get DATETIME_MED(){return cn}static get DATETIME_MED_WITH_SECONDS(){return ln}static get DATETIME_MED_WITH_WEEKDAY(){return un}static get DATETIME_FULL(){return dn}static get DATETIME_FULL_WITH_SECONDS(){return hn}static get DATETIME_HUGE(){return mn}static get DATETIME_HUGE_WITH_SECONDS(){return fn}}function Qo(e){if(Jo.isDateTime(e))return e;if(e&&e.valueOf&&yr(e.valueOf()))return Jo.fromJSDate(e);if(e&&"object"==typeof e)return Jo.fromObject(e);throw new Bt(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function Vo({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return Le("div",{className:kt.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:yt.colors.accent}),children:Le("div",{className:kt.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Le("div",{className:kt.create("page-heading-wrapper",{width:"100%",marginBottom:yt.spacing.lg}),children:Le(Et,{children:Le("div",{className:kt.create("page-heading-container",{backgroundColor:yt.colors.primary,color:yt.colors.primaryForeground,borderRadius:yt.radius.large,padding:`${yt.spacing.lg} ${yt.spacing.xl}`,boxShadow:yt.shadow.md}),children:Le("div",{className:kt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:yt.spacing.lg}),children:Le("div",{className:kt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Le("h1",{className:kt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:yt.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&Le("p",{className:kt.create("page-template-description",{margin:"0",marginTop:yt.spacing.sm,fontSize:yt.fontSize.small,lineHeight:"1.5",color:yt.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function Ko({className:e,children:t}){const n=kt.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Le("div",{className:Tt(n,e),children:t})}function Xo({message:e}){return Le(Vo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le(Ko,{className:kt.name("loading-container"),children:Le(It,{size:"large"})})})})}function es({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:yt.colors.primary,color:yt.colors.primaryForeground,boxShadow:yt.shadow.sm},outline:{border:`${yt.borderWidth} solid ${yt.colors.primary}`,backgroundColor:yt.colors.card,color:yt.colors.primary,boxShadow:yt.shadow.sm}},l=kt.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:yt.radius.default,cursor:"pointer",fontSize:yt.fontSize.default,fontWeight:"500",transition:yt.transition,fontFamily:yt.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});kt.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),kt.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:yt.shadow.md}),kt.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:yt.shadow.sm});const u=kt.create(`button-${e}`,{...c[e]});return Le("button",{type:t,className:Tt(l,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Le(It,{size:"small"}),o]})}function ts({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 Le(Vo,{title:t.title,noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le("div",{className:kt.create("error-page-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Le("div",{className:kt.create("error-page-card",{backgroundColor:yt.colors.card,boxShadow:yt.shadow.sm,borderRadius:yt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"500px"}),children:[Le("div",{className:kt.create("error-page-header",{paddingInline:yt.spacing.xl,paddingTop:yt.spacing.xl,paddingBottom:yt.spacing.lg,textAlign:"center"},{"(max-width: 768px)":{paddingInline:yt.spacing.lg,paddingTop:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingTop:yt.spacing.md}}),children:[Le("div",{className:kt.create("error-page-icon-wrapper",{display:"flex",justifyContent:"center",marginBottom:yt.spacing.lg}),children:Le("div",{className:kt.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:Le("svg",{className:kt.create("error-page-icon",{width:"2rem",height:"2rem",color:yt.colors.destructive}),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:Le("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"})})})}),Le("h2",{className:kt.create("error-page-title",{margin:"0",marginBottom:yt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:yt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:t.title}),Le("p",{className:kt.create("error-page-description",{margin:"0",marginTop:yt.spacing.sm,fontSize:yt.fontSize.default,lineHeight:"1.6",color:yt.colors.mutedForeground}),children:t.message})]}),Le("div",{className:kt.create("error-page-content",{paddingInline:yt.spacing.xl,paddingBottom:yt.spacing.xl},{"(max-width: 768px)":{paddingInline:yt.spacing.lg,paddingBottom:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingBottom:yt.spacing.md}}),children:[n&&Le("p",{className:kt.create("error-page-support",{margin:"0",marginBottom:yt.spacing.lg,fontSize:yt.fontSize.small,lineHeight:"1.5",color:yt.colors.mutedForeground,textAlign:"center"}),children:["If this problem persists, please contact support with reference"," ",Le("span",{className:kt.create("error-page-ref",{fontFamily:"monospace",fontWeight:"600",color:yt.colors.foreground}),children:n})]}),Le(es,{onClick:()=>{window.location.reload()},className:kt.create("error-page-button",{width:"100%"}),children:"Try Again"})]})]})})})})}function ns({message:e,estimatedTime:t}){const n=kt.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=kt.create("maintenance-icon",{width:"4rem",height:"4rem",color:yt.colors.primary,marginBottom:"1.5rem"}),i=kt.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:yt.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=kt.create("maintenance-message",{fontSize:yt.fontSize.default,color:yt.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=kt.create("maintenance-info-box",{backgroundColor:yt.colors.muted,borderRadius:yt.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=kt.create("maintenance-info-title",{fontSize:yt.fontSize.default,fontWeight:"600",color:yt.colors.foreground,marginBottom:"0.5rem"}),c=kt.create("maintenance-info-text",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,lineHeight:"1.4"}),l=kt.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Le(Vo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Le(Et,{children:Le(Ko,{children:Le("div",{className:n,children:[Le(()=>Le("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:Le("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"})}),{}),Le("h1",{className:i,children:"We'll be right back"}),Le("p",{className:o,children:e||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Le("div",{className:s,children:[Le("p",{className:a,children:"What's happening?"}),Le("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),t&&Le("p",{className:c,style:{marginTop:"0.5rem"},children:[Le("strong",{children:"Estimated time:"})," ",t]})]}),Le("div",{className:l,children:Le(es,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function rs({size:e="default",style:t="normal",className:n,children:r}){const i=kt.create("text",{marginTop:"0",marginBottom:"0"}),o=kt.create("text-small",{fontSize:yt.fontSize.small}),s=kt.create("text-default",{fontSize:yt.fontSize.default}),a=kt.create("text-italic",{fontStyle:"italic"}),c=kt.create("text-bold",{fontWeight:"bold"}),l=kt.create("text-underline",{textDecoration:"underline"}),u=Tt({[a]:"italic"===t,[c]:"bold"===t,[l]:"underline"===t}),d=Tt({[o]:"small"===e,[s]:"default"===e});return Le("p",{className:Tt(i,d,u,n),children:r})}function is({title:e,description:t}){return Le("div",{className:kt.create("section-header",{}),children:[Le("p",{className:kt.create("section-title",{fontSize:yt.fontSize.large,margin:"0",color:yt.colors.foreground}),children:e}),t&&Le(rs,{className:kt.create("section-description",{color:yt.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 os({selected:e}){return Le("div",{className:Tt(kt.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${yt.borderWidth} solid transparent`}),e?kt.create("selected-indicator-selected",{backgroundColor:yt.colors.primary}):kt.create("selected-indicator-unselected",{border:`${yt.borderWidth} solid ${yt.colors.border}`}))})}function ss({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 Le("div",{className:kt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Le(is,{title:"Excess Options"}),Le("div",{className:kt.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Le("div",{className:Tt(kt.create("excess-option-card",{borderRadius:yt.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?kt.create("excess-option-card-selected",{border:`2px solid ${yt.colors.primary}`,backgroundColor:yt.colors.accent}):kt.create("excess-option-card-unselected",{border:`2px solid ${yt.colors.border}`,backgroundColor:yt.colors.card})),onClick:()=>n(e.id),children:[Le(os,{selected:r}),Le("div",{className:kt.create("excess-amount",{color:yt.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})}),(null==i?void 0:i.description)&&Le("div",{className:kt.create("excess-description",{padding:"0.75rem",backgroundColor:yt.colors.muted,borderRadius:yt.radius.default,border:`1px solid ${yt.colors.border}`}),children:Le(rs,{className:kt.create("excess-description-text",{fontSize:yt.fontSize.small,color:yt.colors.foreground,margin:"0"}),children:i.description})})]})}function as(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function cs(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 ls({paymentOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=it(()=>{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?Le(us,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Le("div",{className:kt.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Le(us,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function us({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return Le("div",{className:kt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Le(is,{title:"Payment Options"}),Le("div",r?{className:kt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Le(ds,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${e.excess_id}`))}:{className:kt.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${yt.colors.border}`,borderRadius:yt.radius.default,backgroundColor:yt.colors.muted}),children:Le(rs,{className:kt.create("placeholder-text",{color:yt.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function ds({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?as(e.amount.dueToday):`${as(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`:"Currently Unavailable",s=()=>"bank_transfer"===e.gateway.code?"Manual":`via ${e.gateway.name}`;return Le("div",{className:Tt(kt.create("payment-option-row",{borderRadius:yt.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?kt.create("payment-option-row-selected",{border:`2px solid ${yt.colors.primary}`,backgroundColor:yt.colors.accent}):kt.create("payment-option-row-unselected",{border:`2px solid ${yt.colors.border}`,backgroundColor:yt.colors.card})),onClick:()=>i&&n(e),children:[Le("div",{className:kt.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Le(os,{selected:r}),Le("div",{className:kt.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Le("div",{className:kt.create("frequency-title",{fontSize:yt.fontSize.default,fontWeight:"500",color:yt.colors.foreground}),children:cs(e.amount.frequency,e.gateway.code)}),Le("div",{className:kt.create("gateway-description",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground}),children:s()})]})]}),Le("div",{className:kt.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Le(rs,{className:kt.create("amount-text",{textAlign:"right",color:i?yt.colors.foreground:yt.colors.mutedForeground,fontStyle:i?"normal":"italic"}),children:o()}),i&&"bank_transfer"!==e.gateway.code&&Le(rs,{size:"small",className:kt.create("gateway-fee-text",{textAlign:"right",color:yt.colors.mutedForeground}),children:[as(e.amount.gatewayFee)," fee"]}),i&&"bank_transfer"===e.gateway.code&&Le(rs,{size:"small",className:kt.create("no-fee-text",{textAlign:"right",color:yt.colors.mutedForeground}),children:"No fees"})]}),Le("div",{className:kt.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Le(os,{selected:r}),Le("div",{className:kt.create("payment-option-title-mobile",{fontSize:yt.fontSize.default,fontWeight:"500",color:yt.colors.foreground}),children:cs(e.amount.frequency,e.gateway.code)})]}),Le("div",{className:kt.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:[Le("div",{className:kt.create("gateway-description-mobile",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground}),children:s()}),Le(rs,{className:kt.create("amount-text-mobile",{fontWeight:"500",color:i?yt.colors.foreground:yt.colors.mutedForeground,fontStyle:i?"normal":"italic"}),children:o()})]})]})}const hs=e=>{try{return new Date(e).toLocaleDateString("en-NZ",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}};function ms({excessOptions:e,selectedExcessId:t,onEditQuote:n,isEditingQuote:r=!1,productName:i,quoteIntent:o}){const s=it(()=>t?e.find(e=>e.id===t):null,[e,t]),a=null==s?void 0:s.line_item_display,c=it(()=>{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 Le("div",{className:kt.create("cart-summary-container",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.lg,boxShadow:yt.shadow.sm},{"(max-width: 768px)":{padding:yt.spacing.md}}),children:[Le("h3",{className:kt.create("cart-summary-title",{fontSize:yt.fontSize.large,fontWeight:"600",marginBottom:yt.spacing.md,color:yt.colors.foreground}),children:"Insurance Details"}),c&&Le(k,{children:[Le("div",{className:kt.create("cart-client-details",{display:"flex",flexDirection:"column",gap:yt.spacing.sm,marginBottom:yt.spacing.md}),children:[c.firstName&&c.lastName&&Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Name"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:[c.firstName," ",c.lastName]})]}),c.email&&Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Email"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:c.email})]}),c.phone&&Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Phone"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:c.phone})]}),c.dob&&Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Date of Birth"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:hs(c.dob)})]})]}),Le("hr",{className:kt.create("divider",{border:"none",borderTop:`1px solid ${yt.colors.border}`,margin:`${yt.spacing.md} 0`})})]}),Le("div",{className:kt.create("cart-product-section",{display:"flex",flexDirection:"column",gap:yt.spacing.sm,marginBottom:yt.spacing.lg}),children:a&&Le("div",{className:kt.create("cart-item",{display:"flex",flexDirection:"column",gap:yt.spacing.sm}),children:[Le("div",{className:kt.create("cart-item-description",{fontSize:yt.fontSize.small,fontWeight:"500",color:yt.colors.foreground}),children:a.description}),a.show_sum_insured&&a.sum_insured&&Le("div",{className:kt.create("cart-item-sum-insured",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground}),children:["Sum Insured: ",as(a.sum_insured)]})]})}),Le(es,{onClick:n,disabled:r,variant:"outline",className:kt.create("edit-quote-button",{width:"100%"}),children:r?"Clearing quote...":"Edit details"})]})}function fs({label:e,value:t,isTotal:n=!1,className:r}){return Le("div",{className:Tt(kt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Le("span",{className:kt.create("summary-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:e}),Le("span",{className:kt.create("summary-value",{fontWeight:n?"600":"500",color:yt.colors.foreground,fontSize:n?yt.fontSize.large:"inherit"}),children:t})]})}function ps({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:c=!1}){return it(()=>n?e.find(e=>e.id===n):null,[e,n]),it(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]),Le("div",{className:kt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Le("h3",{className:kt.create("cart-summary-title",{fontSize:yt.fontSize.large,fontWeight:"600",marginBottom:yt.spacing.sm,color:yt.colors.foreground}),children:"Payment Details"}),r&&Le("div",{className:kt.create("summary-section",{paddingBottom:"1rem"}),children:Le("div",{className:kt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Le(k,{children:[Le(fs,{label:"Total Due Today:",value:as(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Le(fs,{label:"Gateway Fee:",value:as(r.amount.gatewayFee)})]}):Le(k,{children:[Le(fs,{label:"Due Today:",value:as(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Le(fs,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:as(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Le(fs,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Le(k,{children:Le(fs,{label:"Total Payable:",value:as(r.amount.totalRepayable),className:kt.create("total-item",{})})})]})})}),c&&Le("div",{className:kt.create("continue-later-success",{backgroundColor:`${yt.colors.accent}`,padding:"12px 16px",borderRadius:yt.radius.default,borderLeft:`4px solid ${yt.colors.primary}`}),children:[Le("h4",{className:kt.create("success-title",{margin:"0 0 4px 0",color:yt.colors.primary,fontSize:yt.fontSize.default,fontWeight:"600"}),children:"No problem!"}),Le("p",{className:kt.create("success-text",{margin:"0",fontSize:yt.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&&Le(es,{onClick:s,disabled:a,variant:"outline",className:kt.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:yt.fontSize.default,fontWeight:"500"}),children:a?"Sending...":"Continue Later (Email Me)"}),Le(es,{onClick:i,disabled:!o,className:kt.create("purchase-button",{width:"100%",height:"3rem",fontSize:yt.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function gs({details:e,onClose:t}){const n=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{})};return Le("div",{className:kt.create("bank-transfer-container",{display:"flex",flexDirection:"column",gap:yt.spacing.lg}),children:[Le("div",{className:kt.create("success-message",{backgroundColor:yt.colors.accent,border:`2px solid ${yt.colors.primary}`,borderRadius:yt.radius.default,padding:yt.spacing.lg,textAlign:"center"}),children:[Le("div",{className:kt.create("success-icon",{fontSize:"3rem",marginBottom:yt.spacing.sm}),children:"✓"}),Le("h3",{className:kt.create("success-title",{margin:"0",marginBottom:yt.spacing.sm,color:yt.colors.primary,fontSize:yt.fontSize.large,fontWeight:"600"}),children:"Quote Reserved"}),Le(rs,{className:kt.create("success-description",{margin:"0",color:yt.colors.foreground,opacity:"0.9"}),children:"Your quote has been reserved. Please complete the bank transfer to finalize your coverage."})]}),Le("div",{className:kt.create("transfer-instructions",{backgroundColor:yt.colors.card,border:`1px solid ${yt.colors.border}`,borderRadius:yt.radius.default,padding:yt.spacing.lg}),children:[Le("h4",{className:kt.create("instructions-title",{margin:"0",marginBottom:yt.spacing.md,fontSize:yt.fontSize.default,fontWeight:"600",color:yt.colors.foreground}),children:"Bank Transfer Instructions"}),Le("div",{className:kt.create("instructions-grid",{display:"grid",gap:yt.spacing.md}),children:[Le("div",{className:kt.create("detail-row-highlighted",{backgroundColor:yt.colors.accent,border:`2px solid ${yt.colors.primary}`,borderRadius:yt.radius.default,padding:yt.spacing.md}),children:[Le("div",{className:kt.create("detail-label",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,marginBottom:"0.25rem",fontWeight:"500"}),children:"Reference Number (IMPORTANT)"}),Le("div",{className:kt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Le("code",{className:kt.create("detail-value-code",{fontFamily:"monospace",fontSize:yt.fontSize.large,fontWeight:"700",color:yt.colors.primary,letterSpacing:"0.05em"}),children:e.reference}),Le("button",{onClick:()=>n(e.reference,"Reference"),className:kt.create("copy-button",{background:"transparent",border:`1px solid ${yt.colors.primary}`,borderRadius:yt.radius.small,padding:"0.25rem 0.5rem",cursor:"pointer",fontSize:yt.fontSize.small,color:yt.colors.primary,transition:"all 150ms ease"}),children:"Copy"})]}),Le(rs,{size:"small",className:kt.create("reference-note",{marginTop:"0.5rem",marginBottom:"0",color:yt.colors.foreground,fontWeight:"500"}),children:"⚠️ Please include this reference in your transfer particulars"})]}),Le("div",{className:kt.create("detail-row",{}),children:[Le("div",{className:kt.create("detail-label",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Amount"}),Le("div",{className:kt.create("detail-value",{fontSize:yt.fontSize.large,fontWeight:"600",color:yt.colors.foreground}),children:["$",e.amount.toFixed(2)," ",e.currency]})]}),Le("div",{className:kt.create("detail-row",{}),children:[Le("div",{className:kt.create("detail-label",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Name"}),Le("div",{className:kt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Le("span",{className:kt.create("detail-value",{fontFamily:"monospace",fontSize:yt.fontSize.default,color:yt.colors.foreground}),children:e.bank_account_name}),Le("button",{onClick:()=>n(e.bank_account_name,"Account name"),className:kt.create("copy-button-small",{background:"transparent",border:`1px solid ${yt.colors.border}`,borderRadius:yt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]}),Le("div",{className:kt.create("detail-row",{}),children:[Le("div",{className:kt.create("detail-label",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Number"}),Le("div",{className:kt.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Le("span",{className:kt.create("detail-value",{fontFamily:"monospace",fontSize:yt.fontSize.default,color:yt.colors.foreground}),children:e.bank_account_number}),Le("button",{onClick:()=>n(e.bank_account_number,"Account number"),className:kt.create("copy-button-small",{background:"transparent",border:`1px solid ${yt.colors.border}`,borderRadius:yt.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]})]}),e.instructions_html&&Le("div",{className:kt.create("additional-instructions",{marginTop:yt.spacing.md,paddingTop:yt.spacing.md,borderTop:`1px solid ${yt.colors.border}`}),children:Le("div",{className:kt.create("instructions-content",{fontSize:yt.fontSize.small,color:yt.colors.foreground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:e.instructions_html}})})]}),Le("div",{className:kt.create("important-note",{backgroundColor:yt.colors.muted,border:`1px solid ${yt.colors.border}`,borderRadius:yt.radius.default,padding:yt.spacing.md}),children:Le(rs,{size:"small",className:kt.create("note-text",{margin:"0",color:yt.colors.foreground,lineHeight:"1.5"}),children:[Le("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."]})}),Le("div",{className:kt.create("actions",{display:"flex",justifyContent:"center"}),children:Le(es,{onClick:t,variant:"primary",children:"I've Made the Transfer"})})]})}function ys({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r}){const{fsm:i}=zt(()=>({})),[o,s]=tt("initiating"),[a,c]=tt(null),[l,u]=tt(null),[d,h]=tt(null),[m,f]=tt(null);nt(()=>{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?Le("div","bank_transfer"===o&&m?{className:kt.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:Le("div",{className:kt.create("modal-content",{backgroundColor:yt.colors.background,borderRadius:yt.radius.large,padding:"2rem",maxWidth:"600px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${yt.colors.border}`,margin:"auto"}),onClick:e=>e.stopPropagation(),children:Le(gs,{details:m,onClose:y})})}:{className:kt.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:[Le("div",{className:kt.create("modal-content",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${yt.colors.border}`}),children:[Le("div",{className:kt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Le("div",{className:kt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Le("h2",{className:kt.create("modal-title",{margin:"0",color:yt.colors.foreground,fontSize:yt.fontSize.large}),children:"Payment Processing"})]}),Le("div",{className:kt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Le(rs,{className:kt.create("status-message",{fontSize:yt.fontSize.default,color:yt.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&&Le(rs,{className:kt.create("error-message",{color:yt.colors.destructive,fontSize:yt.fontSize.small,padding:"0.75rem",backgroundColor:yt.colors.destructive+"10",borderRadius:yt.radius.default,border:`1px solid ${yt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Le("div",{className:kt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${yt.colors.border}`,borderTop:`3px solid ${yt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Le("div",{className:kt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Le(k,{children:[Le(es,{onClick:g,variant:"outline",children:"Close"}),"cancelled"===o&&Le(es,{onClick:()=>{s("initiating"),c(null),p()},children:"Try Again"})]}):Le(es,"completed"===o?{onClick:g,children:"Continue"}:{onClick:g,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Le("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function vs({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:Le("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:yt.colors.primary||"#10b981"},children:Le("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:Le("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:yt.colors.destructive},children:[Le("circle",{cx:"12",cy:"12",r:"10"}),Le("path",{d:"m15 9-6 6"}),Le("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:Le("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:yt.colors.secondary},children:[Le("circle",{cx:"12",cy:"12",r:"10"}),Le("path",{d:"m15 9-6 6"}),Le("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:Le("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:yt.colors.destructive},children:[Le("circle",{cx:"12",cy:"12",r:"10"}),Le("path",{d:"M12 8v4"}),Le("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=kt.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=kt.create("modal-content",{backgroundColor:yt.colors.background,borderRadius:yt.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${yt.borderWidth} solid ${yt.colors.border}`}),a=kt.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=kt.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:yt.colors.foreground,margin:"0"}),l=kt.create("modal-message",{color:yt.colors.foreground,lineHeight:"1.5",margin:"0"});kt.create("transaction-info",{backgroundColor:yt.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:yt.radius.small,border:`${yt.borderWidth} solid ${yt.colors.border}`,fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,wordBreak:"break-all"});const u=kt.create("modal-button",{backgroundColor:yt.colors.primary,color:yt.colors.primaryForeground,border:"none",borderRadius:yt.radius.default,padding:"0.75rem 1.5rem",fontSize:yt.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=kt.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Le("div",{className:o,onClick:r,children:Le("div",{className:s,onClick:e=>e.stopPropagation(),children:Le("div",{className:a,children:[i.icon,Le("div",{className:d,children:[Le("h2",{className:c,children:i.title}),Le("p",{className:l,children:i.message})]}),Le("button",{className:u,onClick:r,children:i.buttonText})]})})})}function ws({results:e}){const{fsm:t,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i,httpClient:o}=zt(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[s,a]=tt(!1),[c,l]=tt(null),[u,d]=tt(!1),[h,m]=tt(!1),[f,p]=tt(!1),g=new URLSearchParams(window.location.search),y=g.get("status"),v=g.get("transactionId")||g.get("transaction_id"),[w,b]=tt(!(!y||"failed"!==y&&"declined"!==y&&"cancelled"!==y)),x=e.calculations,k=e.payment_options,S=e.payment_gateways;nt(()=>{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);Pe(i,e,k.length,n,o)}},[]),nt(()=>{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 Le(Vo,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Le(Et,{children:[Le("div",{className:kt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:yt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:yt.spacing.md}}),children:[Le("div",{className:kt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:yt.colors.card,boxShadow:yt.shadow.sm,borderRadius:yt.radius.large,display:"flex",flexDirection:"column"}),children:[Le("div",{className:kt.create("checkout-header",{paddingInline:yt.spacing.xl,paddingTop:yt.spacing.xl,paddingBottom:yt.spacing.lg},{"(max-width: 768px)":{paddingInline:yt.spacing.lg,paddingTop:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingTop:yt.spacing.md}}),children:[Le("h2",{className:kt.create("checkout-title",{margin:"0",marginBottom:yt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:yt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Le("p",{className:kt.create("checkout-description",{margin:"0",fontSize:yt.fontSize.default,lineHeight:"1.6",color:yt.colors.foreground,opacity:"0.9"}),children:"Choose your excess amount and payment option to secure your coverage."}),Le("hr",{className:kt.create("checkout-header-border",{marginTop:yt.spacing.lg,borderColor:yt.colors.border})})]}),Le("div",{className:kt.create("checkout-sections",{paddingInline:yt.spacing.xl,paddingBottom:yt.spacing.xl,display:"flex",flexDirection:"column",gap:yt.spacing.lg},{"(max-width: 768px)":{paddingInline:yt.spacing.lg,paddingBottom:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingBottom:yt.spacing.md}}),children:[Le(ss,{excessOptions:x,selectedExcessId:n,onExcessSelect:e=>t.setSelectedExcessId(e)}),Le(ls,{paymentOptions:k,paymentGateways:S,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:e=>t.setSelectedPaymentOption(e)})]})]}),Le("div",{className:kt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Le("div",{className:kt.create("checkout-sidebar-sticky",{position:"sticky",top:yt.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:[Le(ms,{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}),Le("div",{className:kt.create("checkout-sidebar-spacer",{height:yt.spacing.lg},{"(max-width: 950px)":{height:yt.spacing.md}})}),Le("div",{className:kt.create("checkout-sidebar-card",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,boxShadow:yt.shadow.sm,padding:yt.spacing.lg},{"(max-width: 768px)":{padding:yt.spacing.md}}),children:Le(ps,{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})})]})})]}),$&&Le(vs,{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())}}),Le(ys,{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 bs({results:e}){var t,n,r;const{quoteIntent:i,fsm:o}=zt(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=kt.create("referral-card",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.xl,boxShadow:yt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:yt.spacing.lg},"(max-width: 480px)":{padding:yt.spacing.md}}),u=kt.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:yt.spacing.lg}),d=kt.create("referral-icon",{width:"4rem",height:"4rem",color:yt.colors.primary}),h=kt.create("referral-header",{textAlign:"center",marginBottom:yt.spacing.xl}),m=kt.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:yt.colors.primary,marginBottom:yt.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=kt.create("referral-subtitle",{fontSize:yt.fontSize.default,color:yt.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),p=kt.create("referral-process-box",{backgroundColor:yt.colors.accent,borderRadius:yt.radius.default,padding:yt.spacing.lg,marginBottom:yt.spacing.xl}),g=kt.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:yt.colors.accentForeground,marginBottom:yt.spacing.md,marginTop:"0"}),y=kt.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:yt.spacing.sm}),v=kt.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:yt.fontSize.small,color:yt.colors.accentForeground,lineHeight:"1.6"}),w=kt.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:yt.colors.primary,color:yt.colors.primaryForeground,borderRadius:"50%",marginRight:yt.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),b=kt.create("referral-contact-section",{borderTop:`1px solid ${yt.colors.border}`,paddingTop:yt.spacing.xl,marginTop:yt.spacing.xl,textAlign:"center"}),x=kt.create("referral-contact-text",{fontSize:yt.fontSize.default,color:yt.colors.foreground,marginBottom:yt.spacing.lg}),k=kt.create("referral-actions",{display:"flex",gap:yt.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:yt.spacing.lg}),S=kt.create("referral-reference",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,marginTop:yt.spacing.md}),N=kt.create("referral-new-request",{textAlign:"center",marginTop:yt.spacing.md}),_=kt.create("referral-new-request-link",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:"0",fontFamily:"inherit"});return Le(Vo,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Le(Et,{children:Le(Ko,{children:Le("div",{className:l,children:[Le("div",{className:u,children:Le(()=>Le("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:[Le("path",{d:"M7 10v12"}),Le("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"})]}),{})}),Le("div",{className:h,children:[Le("h1",{className:m,children:"Thanks for your quote request!"}),Le("p",{className:f,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Le("div",{className:p,children:[Le("h3",{className:g,children:"What happens next?"}),Le("ul",{className:y,children:[Le("li",{className:v,children:[Le("span",{className:w,children:"1"}),Le("span",{children:"Our team will review your application within 1-2 business days"})]}),Le("li",{className:v,children:[Le("span",{className:w,children:"2"}),Le("span",{children:"We'll contact you with either approval or additional requirements"})]}),Le("li",{className:v,children:[Le("span",{className:w,children:"3"}),Le("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),c&&Le("div",{className:b,children:[Le("p",{className:x,children:"Need to speak with someone about your quote?"}),Le("div",{className:k,children:[a&&Le(es,{variant:"outline",onClick:()=>window.open(`tel:${a}`),children:[Le("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:Le("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&&Le(es,{variant:"outline",onClick:()=>window.open(`mailto:${s}`),children:[Le("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:[Le("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Le("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)&&Le("div",{className:S,children:["Quote Reference: ",Le("strong",{children:e.quote_intent.reference})]})]}),Le("div",{className:N,children:Le("button",{type:"button",className:_,onClick:()=>null==o?void 0:o.reset(),children:"Start a new quote"})})]})})})})}function xs({results:e}){return"referral"===e.outcome_type?Le(bs,{results:e}):Le(ws,{results:e})}function ks({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:l="$"}){const u=rt(null),[d,h]=tt("");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}nt(()=>{h(null!=e&&""!==e?m(e):"")},[e]);const f=kt.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=kt.create("money-input-prefix",{position:"absolute",left:"1rem",color:yt.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=kt.create("money-input-with-prefix",{paddingLeft:l?"2rem":"1rem"});return Le("div",{className:f,children:[l&&Le("span",{className:p,children:l}),Le("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:Tt(a,l&&g)})]})}function Ss(e){var t,n,r,i;const o=kt.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${yt.borderWidth} solid ${e.hasError?yt.colors.destructive:yt.colors.input}`,borderRadius:yt.radius.default,fontSize:yt.fontSize.default,backgroundColor:yt.colors.card,color:yt.colors.foreground,transition:yt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${yt.colors.destructive} 20%, transparent)`:"none"}),s=kt.name("input");kt.pseudoElement("input",":focus",{border:`${yt.borderWidth} solid ${yt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${yt.colors.primary} 20%, transparent)`,borderRadius:yt.radius.default});const a=kt.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${yt.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:yt.fontSize.default,backgroundColor:"transparent",color:yt.colors.foreground,outline:"none"}),c=kt.create("select-wrapper",{border:`${yt.borderWidth} solid ${e.hasError?yt.colors.destructive:yt.colors.input}`,borderRadius:yt.radius.default,backgroundColor:yt.colors.card,transition:yt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${yt.colors.destructive} 20%, transparent)`:"none"}),l=kt.name("select-wrapper");kt.pseudoElement("select-wrapper",":focus-within",{border:`${yt.borderWidth} solid ${yt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${yt.colors.primary} 20%, transparent)`,borderRadius:yt.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 Le("div",{className:Tt(c,l),children:Le("select",{...y,onChange:v,className:a,children:[e.add_null_option&&Le("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=>Le("option",{value:e.value,children:e.label},e.value))]})})}if("date"===e.type)return Le("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:Tt(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 Le("input",{...y,type:"month",value:S,onInput:k,onChange:k,className:Tt(o,s,m)})}if("year"===e.type){const N=(new Date).getFullYear();return Le("input",{...y,type:"number",min:N-100,max:N,placeholder:"YYYY",onInput:w,onChange:v,className:Tt(o,s,m)})}if("money"===e.type)return Le(ks,{value:e.value,onChange:u,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:Tt(o,s,m),hasError:e.hasError});if("checkbox"===e.type){const _=!0===e.value||"true"===e.value||"true"===e.value,$=kt.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),C=kt.create("checkbox-"+(_?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${_?yt.colors.primary:e.hasError?yt.colors.destructive:yt.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:_?yt.colors.primary:yt.colors.card,transition:yt.transition,position:"absolute"}),T=kt.name("checkbox-"+(_?"checked":"unchecked"));function I(e){e.preventDefault(),u(_?"false":"true")}return kt.pseudoElement("checkbox-"+(_?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${yt.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),Le("div",{className:$,children:[Le("input",{type:"checkbox",id:e.id,name:e.name,checked:_,onClick:I,className:Tt(C,T,m),required:e.required,readOnly:!0}),_&&Le("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:yt.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Le("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const E=kt.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),P=kt.create("boolean-radio-group",{display:"flex",gap:"1rem"}),D=kt.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),M=kt.create("boolean-radio",{accentColor:yt.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),z=kt.name("boolean-radio");kt.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${yt.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const R=kt.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${yt.borderWidth} solid ${e.hasError?yt.colors.destructive:yt.colors.input}`,borderRadius:yt.radius.default,fontSize:yt.fontSize.default,backgroundColor:yt.colors.card,color:yt.colors.foreground,transition:yt.transition,outline:"none",boxShadow:e.hasError?`0 0 0 3px color-mix(in srgb, ${yt.colors.destructive} 20%, transparent)`:"none",resize:"vertical",fontFamily:yt.fontFamily}),O=kt.name("boolean-textarea");kt.pseudoElement("boolean-textarea",":focus",{border:`${yt.borderWidth} solid ${yt.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${yt.colors.primary} 20%, transparent)`,borderRadius:yt.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 Le("div",{className:Tt(E,m),children:[Le("div",{className:P,children:[Le("label",{className:D,children:[Le("input",{type:"radio",name:e.name,checked:j,onChange:()=>F("true"),className:Tt(M,z)}),Le("span",{children:"Yes"})]}),Le("label",{className:D,children:[Le("input",{type:"radio",name:e.name,checked:A,onChange:()=>F("false"),className:Tt(M,z)}),Le("span",{children:"No"})]})]}),B&&Le("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:Tt(R,O)})]})}return g?Le("div",{className:kt.create("input-with-suffix",{display:"flex",alignItems:"center",gap:yt.spacing.sm}),children:[Le("input",{...y,onInput:w,onChange:v,onBlur:b,onKeyDown:h,className:Tt(o,s,m),style:{flex:1}}),g]}):Le("input",{...y,onInput:w,onChange:v,onBlur:b,onKeyDown:h,className:Tt(o,s,m)})}function Ns({pages:t,currentPageIndex:n,completedPages:r}){const{fsm:i,lastUpdated:o,isSaving:s}=zt(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=rt(null),c=rt(null);e(t.length),e(t.map((e,t)=>({index:t,id:e.id,title:e.title}))),nt(()=>{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)/t.length*100),u=kt.create("sidebar-nav-item-base",{display:"flex",alignItems:"flex-start",gap:yt.spacing.sm,padding:`${yt.spacing.sm} ${yt.spacing.sm}`,borderRadius:yt.radius.default,border:"none",backgroundColor:"transparent",color:yt.colors.foreground,cursor:"pointer",transition:yt.transition,textAlign:"left",width:"100%",fontFamily:yt.fontFamily,fontSize:yt.fontSize.small,opacity:"1"}),d=kt.create("sidebar-nav-item-active",{backgroundColor:yt.colors.accent,color:yt.colors.accentForeground}),h=kt.create("sidebar-nav-item-disabled",{cursor:"not-allowed",opacity:"0.5"});kt.pseudoElement("sidebar-nav-item-base",":hover",{backgroundColor:yt.colors.muted}),kt.pseudoElement("sidebar-nav-item-active",":hover",{backgroundColor:yt.colors.accent});const m=kt.create("sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:yt.colors.muted,color:yt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),f=kt.create("sidebar-indicator-active",{backgroundColor:yt.colors.accentForeground,color:yt.colors.accent}),p=kt.create("sidebar-indicator-completed",{backgroundColor:yt.colors.primary,color:yt.colors.primaryForeground}),g=kt.create("sidebar-page-title-base",{fontWeight:"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),y=kt.create("sidebar-page-title-active",{fontWeight:"600"});return Le("div",{className:kt.create("sidebar-navigation",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.lg,boxShadow:yt.shadow.sm,position:"sticky",top:yt.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:yt.spacing.lg}),children:[Le("div",{className:kt.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:yt.spacing.sm}),children:[Le("span",{className:kt.create("sidebar-progress-text",{fontSize:yt.fontSize.small,fontWeight:"600",color:yt.colors.foreground}),children:["Step ",n+1," of ",t.length]}),Le("div",{className:kt.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:yt.colors.muted,borderRadius:yt.radius.small,overflow:"hidden"}),children:Le("div",{className:kt.create("sidebar-progress-fill",{height:"100%",backgroundColor:yt.colors.primary,borderRadius:yt.radius.small,transition:yt.transition}),style:{width:`${l}%`}})})]}),Le("hr",{className:kt.create("sidebar-divider",{borderColor:yt.colors.border})}),Le("nav",{ref:c,className:kt.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:yt.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:yt.spacing.sm}),children:t.map((t,o)=>{const c=o===n,l=r.includes(o),v=i.canNavigateToPage(o);o===n&&e(t.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 Le("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:[Le("div",{className:k,children:l?Le("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:Le("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Le("div",{className:kt.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:Le("span",{className:c?`${g} ${y}`:g,children:t.title})})]},t.id)})}),Le("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&(null==i||i.reset())},className:kt.create("sidebar-reset-button",{padding:`${yt.spacing.sm} ${yt.spacing.md}`,border:`${yt.borderWidth} solid ${yt.colors.border}`,borderRadius:yt.radius.default,backgroundColor:"transparent",color:yt.colors.mutedForeground,fontSize:yt.fontSize.small,fontFamily:yt.fontFamily,cursor:"pointer",transition:yt.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),o&&Le("div",{className:kt.create("sidebar-last-saved",{fontSize:"0.6875rem",color:yt.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Jo.fromJSDate(new Date(o)).toFormat("T")]})]})}function _s({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=zt(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=tt(!1),a=Math.round((t+1)/e.length*100),c=kt.create("mobile-sidebar-item-base",{display:"flex",alignItems:"center",gap:yt.spacing.sm,padding:yt.spacing.sm,border:"none",borderRadius:yt.radius.default,backgroundColor:"transparent",color:yt.colors.foreground,cursor:"pointer",opacity:"1",transition:yt.transition,width:"100%",textAlign:"left",fontFamily:yt.fontFamily}),l=kt.create("mobile-sidebar-item-active",{backgroundColor:yt.colors.accent,color:yt.colors.accentForeground}),u=kt.create("mobile-sidebar-item-disabled",{cursor:"not-allowed",opacity:"0.5"}),d=kt.create("mobile-sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:yt.colors.muted,color:yt.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),h=kt.create("mobile-sidebar-indicator-active",{backgroundColor:yt.colors.accentForeground,color:yt.colors.accent}),m=kt.create("mobile-sidebar-indicator-completed",{backgroundColor:yt.colors.primary,color:yt.colors.primaryForeground}),f=kt.create("mobile-sidebar-page-title-base",{fontSize:yt.fontSize.small,fontWeight:"500"}),p=kt.create("mobile-sidebar-page-title-active",{fontWeight:"600"});return Le("div",{className:kt.create("mobile-sidebar",{overflow:"hidden"}),children:[Le("button",{onClick:()=>s(!o),className:kt.create("mobile-sidebar-header",{width:"100%",padding:yt.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:yt.spacing.sm}),children:[Le("div",{className:kt.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Le("span",{className:kt.create("mobile-sidebar-step-text",{fontSize:yt.fontSize.small,fontWeight:"600",color:yt.colors.foreground}),children:["Step ",t+1," of ",e.length]}),Le("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:kt.create("mobile-sidebar-chevron",{transition:yt.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:yt.colors.mutedForeground}),children:Le("path",{d:"m6 9 6 6 6-6"})})]}),Le("div",{className:kt.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:yt.colors.muted,borderRadius:yt.radius.small,overflow:"hidden"}),children:Le("div",{className:kt.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:yt.colors.primary,borderRadius:yt.radius.small,transition:yt.transition}),style:{width:`${a}%`}})})]}),Le("hr",{className:kt.create("mobile-sidebar-border",{borderColor:yt.colors.border})}),o&&Le("div",{className:kt.create("mobile-sidebar-content",{padding:yt.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 Le("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:[Le("div",{className:x,children:g?Le("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:Le("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Le("span",{className:a?`${f} ${p}`:f,children:e.title})]},e.id)})})]})}function $s({organisation:e}){return Le("div",{className:kt.create("welcome-card",{paddingInline:yt.spacing.lg,paddingTop:yt.spacing.lg},{"(max-width: 950px)":{paddingInline:yt.spacing.lg,paddingTop:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingTop:yt.spacing.md}}),children:[Le("h2",{className:kt.create("welcome-title",{margin:"0",marginBottom:yt.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:yt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:yt.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),Le("p",{className:kt.create("welcome-text",{margin:"0",fontSize:yt.fontSize.default,lineHeight:"1.6",color:yt.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."}),Le("hr",{className:kt.create("welcome-border",{marginTop:yt.spacing.lg,borderColor:yt.colors.border})})]})}function Cs({title:e,description:t}){return Le(Vo,{title:e,description:t,children:Le(Et,{children:Le(Ko,{className:kt.name("error-container"),children:Le("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:[Le("path",{d:"M4.929 4.929 19.07 19.071"}),Le("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function Ts({errors:e,className:t}){return e&&0!==e.length?Le("div",{className:kt.create("field-error",{color:yt.colors.destructive,fontSize:yt.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>Le("span",{className:kt.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function Is({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=tt(!1);return Le("label",{for:e,className:kt.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Le("span",{className:kt.create("label-text",{marginBottom:yt.spacing.sm,fontSize:yt.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:yt.spacing.sm,color:yt.colors.foreground}),children:[Le("span",{children:[t,r&&Le("span",{className:kt.create("label-required-indicator",{color:yt.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Le("span",{className:kt.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Le("svg",{className:kt.create("tooltip-icon",{width:"1rem",height:"1rem",color:yt.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Le("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Le("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Le("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Le("span",{className:kt.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:yt.colors.popover,color:yt.colors.popoverForeground,fontSize:"0.875rem",borderRadius:yt.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Le("span",{className:kt.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 ${yt.colors.popover}`})})]})]})]}),n]})}function Es(e){switch(null!=e?e:100){case 25:return kt.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return kt.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return kt.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return kt.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return kt.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return kt.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function Ps(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 Ds({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=kt.create("validated-field",{display:"flex",flexDirection:"column",gap:yt.spacing.sm});if("checkbox"===e.type){const t=kt.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:yt.spacing.sm}),a=kt.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=kt.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),l=kt.create("checkbox-label-text",{fontSize:yt.fontSize.default,fontWeight:"600",color:yt.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Le("div",{className:Tt(s,Es(e.width),r),children:[Le("div",{className:t,children:Le("div",{className:a,children:[Le("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Le("label",{htmlFor:i,className:c,children:[Le("span",{className:l,children:[e.label,e.required&&Le("span",{className:kt.create("checkbox-required-indicator",{color:yt.colors.destructive}),children:"*"})]}),e.description&&Le("div",{className:kt.create("checkbox-field-description",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:Ps(e.description)}})]})]})}),Le(Ts,{errors:o})]})}return Le("div",{className:Tt(s,Es(e.width),r),children:[Le(Is,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&Le("div",{className:kt.create("field-description",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,marginBottom:yt.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:Ps(e.description)}}),n]}),Le(Ts,{errors:o})]})}function Ms({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:yt.colors.secondary+"08",borderColor:yt.colors.secondary+"30",iconColor:yt.colors.secondary,titleColor:yt.colors.foreground},error:{backgroundColor:yt.colors.destructive+"08",borderColor:yt.colors.destructive,iconColor:yt.colors.destructive,titleColor:yt.colors.destructive},critical:{backgroundColor:yt.colors.destructive+"10",borderColor:yt.colors.destructive,iconColor:yt.colors.destructive,titleColor:yt.colors.destructive}}[e.severity],o=kt.create("error-card",{padding:yt.spacing.md,borderRadius:yt.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:yt.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=kt.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=kt.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=kt.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),l=kt.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=kt.create("error-card-title",{fontSize:yt.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=kt.create("error-card-message",{fontSize:yt.fontSize.small,color:yt.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=kt.create("error-card-details",{fontSize:"0.8125rem",color:yt.colors.mutedForeground,fontFamily:"monospace",backgroundColor:yt.colors.muted,padding:"0.625rem",borderRadius:yt.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),m=kt.create("error-card-support",{fontSize:"0.8125rem",color:yt.colors.mutedForeground,lineHeight:"1.4"}),f=kt.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:yt.colors.mutedForeground,cursor:"pointer",borderRadius:yt.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:yt.transition});return kt.pseudoElement("error-card-dismiss",":hover",{backgroundColor:yt.colors.muted,color:yt.colors.foreground}),Le("div",{className:Tt(o,n),children:Le("div",{className:s,children:[Le(()=>"warning"===e.severity?Le("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Le("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"})}):Le("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Le("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"})}),{}),Le("div",{className:c,children:[Le("div",{className:l,children:[Le("div",{className:u,children:e.title}),Le("div",{className:d,children:e.message}),r&&e.details&&Le("div",{className:h,children:e.details}),Le("div",{className:m,children:Se(e)})]}),t&&Le("button",{className:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Le("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:[Le("path",{d:"M18 6 6 18"}),Le("path",{d:"m6 6 12 12"})]})})]})]})})}function zs(){const{definition:t,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=zt(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}=Mt(),[u,d]=tt({status:"idle"}),[h,m]=tt(""),f=ot(async t=>{const n=null!=t?t: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(t){e(),d({status:"invalid",message:"Unable to validate promo code"})}}}else d({status:"idle"})},[null==s?void 0:s.id,l,h]),p=ot(e=>{"Enter"===e.key&&(e.preventDefault(),f())},[f]),g=t.pages[n];if(!g)return Le(Cs,{title:"Unexpected Error",description:"No page available"});const y=rt(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 Le(Vo,{title:g.title,description:g.description,hideHeader:!0,children:Le("div",{children:[N&&Le(vs,{type:S.paymentStatus,transactionId:S.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Le(Et,{children:Le("div",{className:kt.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:yt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Le("div",{className:kt.create("form-content-wrapper",{minWidth:"0",backgroundColor:yt.colors.card,boxShadow:yt.shadow.sm,borderRadius:yt.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Le("div",{className:kt.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Le(_s,{pages:t.pages,currentPageIndex:n,completedPages:_})}),n>0&&Le("div",{className:kt.create("page-heading-container",{paddingInline:yt.spacing.lg,paddingTop:yt.spacing.lg},{"(max-width: 950px)":{paddingInline:yt.spacing.lg,paddingTop:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingTop:yt.spacing.md}}),children:[Le("div",{className:kt.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:yt.spacing.lg}),children:Le("div",{className:kt.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Le("h1",{className:kt.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:yt.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:g.title}),g.description&&Le("p",{className:kt.create("page-template-description",{margin:"0",marginTop:yt.spacing.sm,fontSize:yt.fontSize.small,lineHeight:"1.5",color:yt.colors.foreground,opacity:"0.7"}),children:g.description})]})}),Le("hr",{className:kt.create("page-heading-border",{marginTop:yt.spacing.lg,borderColor:yt.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Le($s,{organisation:s.organisation}),o.length>0&&o.map(e=>Le(Ms,{error:e,onDismiss:()=>c.dismissGeneralError(e.id)},e.id)),Le("div",{className:kt.create("form-card",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.lg,boxShadow:yt.shadow.sm,display:"flex",flexDirection:"column",gap:yt.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:yt.spacing.md,gap:yt.spacing.lg},"(max-width: 480px)":{padding:yt.spacing.md,gap:yt.spacing.md}}),children:[Le("form",{onSubmit:e=>e.preventDefault(),className:kt.create("form-fields-container",{flex:"1"}),children:Le("div",{className:kt.create("form-content-page",{display:"grid",gap:yt.spacing.md,rowGap:yt.spacing.lg,gridTemplateColumns:"repeat(12, 1fr)"}),children:g.fields.map(t=>{const n=t.code||t.id,r="promo_code"===n;if(!(t=>{if(!t.visibility)return!0;const n=t.visibility.conditions.map(e=>"field"in e?e.field:null).filter(Boolean);n.length>0&&(e((t.label,t.code)),e(Object.keys(k)),n.forEach(t=>{t&&e((k[t],k[t]))}));const r=ie(k,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions}),i="show"===t.visibility.action?r.matched:!r.matched;return y.current.get(t.id)!==i&&(e((t.label,t.code)),e(),y.current.set(t.id,i)),i})(t))return null;const o="validating"===u.status,s=r?Le("button",{type:"button",onClick:()=>f(),disabled:!h.trim()||o,style:{height:"2.75rem",minWidth:"5rem",padding:"0 1rem",fontSize:yt.fontSize.small,backgroundColor:yt.colors.primary,color:yt.colors.primaryForeground,border:"none",borderRadius:yt.radius.default,cursor:h.trim()&&!o?"pointer":"not-allowed",opacity:h.trim()&&!o?1:.5,whiteSpace:"nowrap"},children:o?Le(It,{size:"small"}):"Apply"}):void 0,a=!r||"valid"!==u.status&&"invalid"!==u.status?null:Le("div",{style:{marginTop:"0.5rem"},children:["valid"===u.status&&Le("span",{style:{color:"#22c55e",fontSize:yt.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Le("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Le("path",{d:"M20 6 9 17l-5-5"})}),'Promo code "',u.name,'" applied']}),"invalid"===u.status&&Le("span",{style:{color:yt.colors.destructive,fontSize:yt.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Le("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Le("circle",{cx:"12",cy:"12",r:"10"}),Le("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),Le("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),u.message]})]});return Le(Ds,{field:t,errors:i,children:[Le(Ss,{value:v(n,t).toString(),onChange:e=>{let i=e;"boolean"!==t.type&&"checkbox"!==t.type||(i="true"===e),c.updateFieldValue(g.id,n,i),r&&(m(e),d({status:"idle"}))},onKeyDown:r?p:void 0,answer:b(n),onAnswerChange:e=>{var r;c.updateFieldAnswer(g.id,n,e,null===(r=t.boolean_config)||void 0===r?void 0:r.details_rating_factor_id)},id:n,name:n,type:t.type,placeholder:t.placeholder,validation:t.validation,booleanConfig:t.boolean_config,add_null_option:t.add_null_option,null_option_label:t.null_option_label,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n),suffix:s}),a]},t.id)})})}),Le("hr",{className:kt.create("form-navigation-border",{borderColor:yt.colors.border})}),Le("div",{className:kt.create("form-navigation-inline",{paddingTop:yt.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Le(es,{onClick:()=>null==c?void 0:c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Le(es,{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"})]})]})]}),Le("div",{className:kt.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Le(Ns,{pages:t.pages,currentPageIndex:n,completedPages:_})})]})})]})})}function Rs(){var e,t,n;const{quoteIntent:r,fsm:i}=zt(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;nt(()=>{if(s&&r){const e=null==o?void 0:o.paymentStatus,t=null==a?void 0:a.amount;"success"===e&&a?ze(r,s,t||0,a.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&Re(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=kt.create("success-card",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.xl,boxShadow:yt.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:yt.spacing.lg},"(max-width: 480px)":{padding:yt.spacing.md}}),m=kt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:yt.spacing.lg}),f=kt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=kt.create("success-header",{textAlign:"center",marginBottom:yt.spacing.xl}),g=kt.create("success-title",{margin:"0",marginBottom:yt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:yt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=kt.create("success-message",{fontSize:yt.fontSize.default,lineHeight:"1.6",color:yt.colors.foreground,opacity:"0.9",margin:"0"}),v=kt.create("success-contact-section",{borderTop:`1px solid ${yt.colors.border}`,paddingTop:yt.spacing.xl,marginTop:yt.spacing.xl}),w=kt.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:yt.colors.foreground,marginBottom:yt.spacing.md,textAlign:"center"}),b=kt.create("success-contact-details",{backgroundColor:yt.colors.accent,borderRadius:yt.radius.default,padding:yt.spacing.md,display:"flex",flexDirection:"column",gap:yt.spacing.sm,marginBottom:yt.spacing.lg}),x=kt.create("success-contact-item",{display:"flex",alignItems:"center",gap:yt.spacing.sm,fontSize:yt.fontSize.small,color:yt.colors.accentForeground}),k=kt.create("success-actions",{display:"flex",gap:yt.spacing.md,flexWrap:"wrap",justifyContent:"center"}),S=kt.create("success-reference",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,textAlign:"center",marginTop:yt.spacing.md});return Le(Vo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le(Ko,{children:Le("div",{className:h,children:[Le("div",{className:m,children:Le("div",{className:f,children:Le("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:Le("path",{d:"M20 6 9 17l-5-5"})})})}),Le("div",{className:p,children:[Le("h1",{className:g,children:"Payment Complete!"}),Le("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&&Le("div",{className:v,children:[Le("h3",{className:w,children:"Need assistance?"}),Le("div",{className:b,children:[l&&Le("div",{className:x,children:[Le("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:[Le("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Le("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Le("span",{children:l})]}),u&&Le("div",{className:x,children:[Le("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:Le("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"})}),Le("span",{children:u})]})]}),Le("div",{className:k,children:[u&&Le(es,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[Le("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:Le("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&&Le(es,{variant:"outline",onClick:()=>window.open(`mailto:${l}`),children:[Le("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:[Le("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Le("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),r.reference&&Le("div",{className:S,children:["Quote Reference: ",Le("strong",{children:r.reference})]})]})})})})}function Os({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,s]=tt("initiating"),[a,c]=tt(null),[l,u]=tt(null),[d,h]=tt(null);nt(()=>{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?Le("div",{className:kt.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:[Le("div",{className:kt.create("modal-content",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${yt.colors.border}`}),children:[Le("div",{className:kt.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Le("div",{className:kt.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Le("h2",{className:kt.create("modal-title",{margin:"0",color:yt.colors.foreground,fontSize:yt.fontSize.large}),children:"Payment Processing"})]}),Le("div",{className:kt.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Le(rs,{className:kt.create("status-message",{fontSize:yt.fontSize.default,color:yt.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&&Le(rs,{className:kt.create("error-message",{color:yt.colors.destructive,fontSize:yt.fontSize.small,padding:"0.75rem",backgroundColor:yt.colors.destructive+"10",borderRadius:yt.radius.default,border:`1px solid ${yt.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Le("div",{className:kt.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${yt.colors.border}`,borderTop:`3px solid ${yt.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Le("div",{className:kt.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Le(k,{children:[Le(es,{onClick:f,variant:"outline",children:"Close"}),"cancelled"===o&&Le(es,{onClick:()=>{s("initiating"),c(null),m()},children:"Try Again"})]}):Le(es,"completed"===o?{onClick:f,children:"Continue"}:{onClick:f,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Le("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function js({transactionId:e,organisationId:t}){const{httpClient:n}=Mt(),[r,i]=tt(!0),[o,s]=tt(null),[a,c]=tt(null),[l,u]=tt(!1),[d,h]=tt(!1),[m,f]=tt(!1);nt(()=>{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?Le(Xo,{message:"Loading payment details..."}):o?Le(Vo,{title:"Error",description:"Failed to load bank transfer details",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le(Ko,{children:Le("div",{className:kt.create("error-card",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.xl,boxShadow:yt.shadow.sm,maxWidth:"42rem",margin:"0 auto",textAlign:"center"},{"(max-width: 480px)":{padding:yt.spacing.lg}}),children:[Le("div",{className:kt.create("error-icon",{fontSize:"3rem",marginBottom:yt.spacing.md,color:yt.colors.destructive}),children:"⚠️"}),Le("h2",{className:kt.create("error-title",{margin:"0",marginBottom:yt.spacing.sm,color:yt.colors.foreground}),children:"Error Loading Payment Details"}),Le("p",{className:kt.create("error-message",{color:yt.colors.mutedForeground}),children:o})]})})})}):a?Le(Vo,{title:"Bank Transfer Payment",description:"Complete your payment via bank transfer",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:[Le(Ko,{children:Le("div",{className:kt.create("bank-transfer-container",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,maxWidth:"42rem",margin:"0 auto",overflow:"hidden",boxShadow:"0 20px 60px rgba(0,0,0,0.1)"}),children:[Le("div",{style:{backgroundColor:yt.colors.primary},className:kt.create("bank-transfer-header",{color:"white",padding:"2.5rem 2rem",textAlign:"center"},{"(max-width: 480px)":{padding:"1.5rem 1rem"}}),children:[Le("h1",{className:kt.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"}),Le("p",{className:kt.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:yt.fontSize.small}}),children:"Complete your payment using the details below"})]}),Le("div",{className:kt.create("bank-transfer-content",{padding:"2rem"},{"(max-width: 480px)":{padding:"1rem"}}),children:[Le("div",{className:kt.create("payment-details-card",{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:yt.radius.default,padding:"1.5rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Le("div",{className:kt.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:[Le("span",{className:kt.create("detail-label",{color:"#6b7280",fontSize:yt.fontSize.default}),children:"Amount to Transfer"}),Le("span",{className:kt.create("detail-value-amount",{color:yt.colors.primary,fontSize:"1.5rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:["$",a.amount.toFixed(2)," ",a.currency]})]}),Le("div",{className:kt.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:[Le("span",{className:kt.create("detail-label",{color:"#6b7280",fontSize:yt.fontSize.default}),children:"Account Name"}),Le("span",{className:kt.create("detail-value",{color:yt.colors.foreground,fontSize:yt.fontSize.default,fontWeight:"600"}),children:a.bank_account_name})]}),Le("div",{className:kt.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:[Le("span",{className:kt.create("detail-label",{color:"#6b7280",fontSize:yt.fontSize.default}),children:"Account Number"}),Le("span",{className:kt.create("detail-value",{color:yt.colors.foreground,fontSize:yt.fontSize.default,fontWeight:"600"}),children:a.bank_account_number})]}),Le("div",{className:kt.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:[Le("span",{className:kt.create("detail-label",{color:"#6b7280",fontSize:yt.fontSize.default}),children:"Payment Reference"}),Le("span",{className:kt.create("detail-value",{color:yt.colors.foreground,fontSize:yt.fontSize.default,fontWeight:"600"}),children:a.reference})]})]}),Le("div",{className:kt.create("instructions-card",{backgroundColor:"#eff6ff",borderLeft:`4px solid ${yt.colors.primary}`,borderRadius:yt.radius.default,padding:"1.25rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Le("h3",{className:kt.create("instructions-title",{margin:"0 0 0.75rem 0",fontSize:yt.fontSize.default,fontWeight:"600",color:yt.colors.foreground}),children:"Payment Instructions"}),Le("p",{className:kt.create("instructions-text",{margin:"0 0 0.75rem 0",fontSize:yt.fontSize.small,lineHeight:"1.6",color:yt.colors.foreground}),children:[Le("strong",{children:"Important:"})," Please include the payment reference when making your transfer to ensure your payment is processed correctly."]}),Le("p",{className:kt.create("instructions-text",{margin:"0",fontSize:yt.fontSize.small,lineHeight:"1.6",color:yt.colors.foreground}),children:"Once we receive your payment, we'll process your quote and send you a confirmation email."})]}),Le("div",{className:kt.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:[Le("button",{onClick:()=>{u(!0)},style:{backgroundColor:yt.colors.primary},className:kt.create("confirm-button",{color:"white",border:"none",borderRadius:yt.radius.default,padding:"0.75rem 2rem",fontSize:yt.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"}),Le("button",{onClick:()=>{h(!0)},className:kt.create("cancel-button",{color:"#6b7280",backgroundColor:"white",border:"2px solid #e5e7eb",borderRadius:yt.radius.default,padding:"0.75rem 2rem",fontSize:yt.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"all 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"Cancel"})]}),Le("p",{className:kt.create("footer-text",{textAlign:"center",color:"#6b7280",fontSize:yt.fontSize.small,margin:"0"}),children:"Your quote has been saved. We'll process it once payment is received."})]})]})}),d&&Le("div",{className:kt.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:Le("div",{className:kt.create("modal-content",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${yt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:yt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Le("div",{className:kt.create("warning-icon",{fontSize:"4rem",marginBottom:yt.spacing.md}),children:"⚠️"}),Le("h3",{className:kt.create("modal-title",{margin:"0",marginBottom:yt.spacing.sm,color:yt.colors.foreground,fontSize:yt.fontSize.large,fontWeight:"600"}),children:"Are you sure?"}),Le("p",{className:kt.create("modal-message",{margin:"0",marginBottom:yt.spacing.lg,color:yt.colors.foreground,lineHeight:"1.6"}),children:"This will take you back to the checkout page."}),Le("div",{className:kt.create("modal-buttons",{display:"flex",flexDirection:"column-reverse",gap:"0.75rem",justifyContent:"center"}),children:[Le("button",{onClick:()=>h(!1),disabled:m,className:kt.create("no-button",{backgroundColor:"#f3f4f6",color:yt.colors.foreground,border:"none",borderRadius:yt.radius.default,padding:`${yt.spacing.sm} ${yt.spacing.lg}`,fontSize:yt.fontSize.default,fontWeight:"500",cursor:m?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:m?"0.5":"1",width:"100%"}),children:"No, Go Back"}),Le("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:kt.create("yes-button",{backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:yt.radius.default,padding:`${yt.spacing.sm} ${yt.spacing.lg}`,fontSize:yt.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&&Le("div",{className:kt.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:Le("div",{className:kt.create("modal-content",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${yt.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:yt.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Le("div",{className:kt.create("success-icon",{fontSize:"4rem",marginBottom:yt.spacing.md}),children:"✓"}),Le("h3",{className:kt.create("modal-title",{margin:"0",marginBottom:yt.spacing.sm,color:yt.colors.primary,fontSize:yt.fontSize.large,fontWeight:"600"}),children:"Thank You!"}),Le("p",{className:kt.create("modal-message",{margin:"0",marginBottom:yt.spacing.lg,color:yt.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."}),Le("button",{onClick:()=>u(!1),className:kt.create("close-button",{backgroundColor:yt.colors.primary,color:"white",border:"none",borderRadius:yt.radius.default,padding:`${yt.spacing.sm} ${yt.spacing.lg}`,fontSize:yt.fontSize.default,fontWeight:"500",cursor:"pointer",transition:"opacity 150ms ease"}),children:"Close"})]})})]})}):null}kt.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:yt.colors.muted,borderColor:yt.colors.primary,color:yt.colors.primary});class As{static async loadTheme(t){try{if(e(t.slug),e(t.theme_url),this.loadedThemes.has(t.slug))return void e(t.slug);const n=await fetch(t.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();e(r.substring(0,200));const i=this.parseCSSContent(r);e(i.mappedVariables),e(i.classRules.length),this.applyParsedTheme(t.slug,i),this.loadedThemes.add(t.slug),e(t.slug)}catch(n){throw e(t.slug),n}}static parseCSSContent(t){e();const n={},r={};let i="";const o=t.match(/:root\s*\{([^}]+)\}/);if(o){const t=o[1];e(null==t||t.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(t));){const t=`--${s[1]}`,i=s[2].trim();n[t]=i;const o=this.variableMapping[t];o?(r[o]=i,e()):e()}}else e();return i=t.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&e(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(t,n){e(),Promise.resolve().then(function(){return St}).then(({updateBaseVariables:t})=>{Object.keys(n.mappedVariables).length>0&&(e(n.mappedVariables),t(n.mappedVariables))}).catch(()=>{e()}),n.classRules&&this.applyClassRules(t,n.classRules),this.injectOriginalCSS(t,n)}static applyClassRules(t,n){const r=document.getElementById(`insure-os-theme-classes-${t}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${t}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),e()}}static injectOriginalCSS(t,n){const r=document.getElementById(`insure-os-theme-original-${t}`);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-${t}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),e()}}static removeTheme(t){let n=!1;[`insure-os-theme-classes-${t}`,`insure-os-theme-original-${t}`].forEach(e=>{const t=document.getElementById(e);t&&(t.remove(),n=!0)}),n&&(this.loadedThemes.delete(t),e())}static isThemeLoaded(e){return this.loadedThemes.has(e)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}As.loadedThemes=new Set,As.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 Ws=Object.freeze({__proto__:null,ThemeLoader:As});function Ls({paymentLinkId:t,signedUrl:n}){var r,i,o,s,a,c;const l=Mt().httpClient,[u,d]=tt(null),[h,m]=tt(!0),[f,p]=tt(null),[g,y]=tt(!1),[v,w]=tt(null),[b,x]=tt(null),[S,N]=tt(null),[_,$]=tt(!1),[C,T]=tt(null),[I,E]=tt(null),[P,D]=tt(()=>{var e;return null!==(e=(new Date).toISOString().split("T")[0])&&void 0!==e?e:""}),[M,z]=tt(null),[R,O]=tt(!1),[j,A]=tt(null),[W,L]=tt(null);nt(()=>{B()},[t]);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(t);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 t=h.pending_bank_transfer;if(e(),L({transactionId:t.transaction_id,organisationId:(null===(r=h.organisation)||void 0===r?void 0:r.id)||""}),h.organisation&&h.organisation.theme)try{await As.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(t){e()}return}if(h.organisation&&h.organisation.theme)try{await As.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(t){e()}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=it(()=>u&&b?u.calculations.find(e=>e.id===b):null,[u,b]),q=it(()=>u&&S?u.payment_options.find(e=>e.gateway_code===S):null,[u,S]);if(W)return Le(js,{transactionId:W.transactionId,organisationId:W.organisationId});if(h)return Le(Vo,{title:"Loading...",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le("div",{className:kt.create("payment-link-loading-card",{textAlign:"center",padding:yt.spacing.xl,backgroundColor:yt.colors.card,borderRadius:yt.radius.large,boxShadow:yt.shadow.sm,maxWidth:"600px",margin:"0 auto"}),children:Le("p",{className:kt.create("loading-text",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.default}),children:"Loading payment details..."})})})});if(f)return Le(Vo,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le("div",{className:kt.create("payment-link-error-card",{textAlign:"center",padding:yt.spacing.xl,backgroundColor:yt.colors.card,borderRadius:yt.radius.large,boxShadow:yt.shadow.sm,border:`2px solid ${yt.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Le("h2",{className:kt.create("error-title",{color:yt.colors.destructive,marginBottom:yt.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"Payment Link Error"}),Le("p",{className:kt.create("error-message",{color:yt.colors.foreground,fontSize:yt.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 Le(Vo,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le("div",{className:kt.create("payment-success-card",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.xl,boxShadow:yt.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Le("div",{className:kt.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:yt.spacing.lg}),children:Le("div",{className:kt.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Le("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:Le("path",{d:"M20 6 9 17l-5-5"})})})}),Le("div",{className:kt.create("success-header",{textAlign:"center",marginBottom:yt.spacing.xl}),children:[Le("h1",{className:kt.create("success-title",{margin:"0",marginBottom:yt.spacing.sm,fontSize:"2rem",fontWeight:"700",color:yt.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Payment Complete!"}),Le("p",{className:kt.create("success-message",{fontSize:yt.fontSize.default,lineHeight:"1.6",color:yt.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&Le("div",{className:kt.create("contact-section",{borderTop:`1px solid ${yt.colors.border}`,paddingTop:yt.spacing.xl,marginTop:yt.spacing.xl}),children:[Le("h3",{className:kt.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:yt.colors.foreground,marginBottom:yt.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Le("div",{className:kt.create("contact-details",{backgroundColor:yt.colors.accent,borderRadius:yt.radius.default,padding:yt.spacing.md,display:"flex",flexDirection:"column",gap:yt.spacing.sm,marginBottom:yt.spacing.lg}),children:[e&&Le("div",{className:kt.create("contact-item",{display:"flex",alignItems:"center",gap:yt.spacing.sm,fontSize:yt.fontSize.small,color:yt.colors.accentForeground}),children:Le("span",{children:["Email: ",e]})}),t&&Le("div",{className:kt.create("contact-item",{display:"flex",alignItems:"center",gap:yt.spacing.sm,fontSize:yt.fontSize.small,color:yt.colors.accentForeground}),children:Le("span",{children:["Phone: ",t]})})]}),(I||U)&&Le("div",{className:kt.create("reference",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,textAlign:"center",marginTop:yt.spacing.md}),children:["Transaction ID: ",Le("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 Le(Vo,{title:"Payment Unsuccessful",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le("div",{className:kt.create("payment-error-card",{textAlign:"center",padding:yt.spacing.xl,backgroundColor:yt.colors.card,borderRadius:yt.radius.large,boxShadow:yt.shadow.sm,border:`2px solid ${yt.colors.destructive}`,maxWidth:"600px",margin:"0 auto"}),children:[Le("h2",{className:kt.create("error-title",{color:yt.colors.destructive,marginBottom:yt.spacing.md,marginTop:"0",fontSize:"1.5rem",fontWeight:"700"}),children:"cancelled"===Z||"cancelled"===C?"Payment Cancelled":"Payment Failed"}),Le("p",{className:kt.create("error-message",{color:yt.colors.foreground,fontSize:yt.fontSize.default,margin:"0",marginBottom:yt.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."}),Le(es,{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)&&S&&!M&&!R),te=it(()=>{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=it(()=>F&&F.line_item_display||null,[F]);return Le(Vo,{title:"Complete Your Purchase",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:[Le("div",{className:kt.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:yt.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"},"(max-width: 480px)":{gap:yt.spacing.md}}),children:[Le("div",{className:kt.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:yt.colors.card,boxShadow:yt.shadow.sm,borderRadius:yt.radius.large,display:"flex",flexDirection:"column"}),children:[Le("div",{className:kt.create("checkout-header",{paddingInline:yt.spacing.xl,paddingTop:yt.spacing.xl,paddingBottom:yt.spacing.lg},{"(max-width: 768px)":{paddingInline:yt.spacing.lg,paddingTop:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingTop:yt.spacing.md}}),children:[Le("h2",{className:kt.create("checkout-title",{margin:"0",marginBottom:yt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:yt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Complete Your Purchase"}),Le("p",{className:kt.create("checkout-description",{margin:"0",fontSize:yt.fontSize.default,lineHeight:"1.6",color:yt.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."}),Le("hr",{className:kt.create("checkout-header-border",{marginTop:yt.spacing.lg,borderColor:yt.colors.border})})]}),Le("div",{className:kt.create("checkout-sections",{paddingInline:yt.spacing.xl,paddingBottom:yt.spacing.xl,display:"flex",flexDirection:"column",gap:yt.spacing.lg},{"(max-width: 768px)":{paddingInline:yt.spacing.lg,paddingBottom:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingBottom:yt.spacing.md}}),children:[X&&Le("div",{className:kt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Le(is,{title:"Cover Start Date"}),Le("div",{className:kt.create("cover-date-container",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:[Le("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:kt.create("cover-date-input",{padding:"0.75rem 1rem",fontSize:yt.fontSize.default,border:`2px solid ${M?yt.colors.destructive:yt.colors.border}`,borderRadius:yt.radius.default,backgroundColor:yt.colors.background,color:yt.colors.foreground,width:"auto",maxWidth:"200px",cursor:R?"wait":"pointer"})}),R&&Le("p",{className:kt.create("validating-text",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,margin:"0"}),children:"Validating..."}),M&&Le("div",{className:kt.create("cover-date-error",{backgroundColor:`${yt.colors.destructive}10`,border:`1px solid ${yt.colors.destructive}`,borderRadius:yt.radius.default,padding:"1rem"}),children:[Le("p",{className:kt.create("error-message",{color:yt.colors.destructive,fontSize:yt.fontSize.small,margin:"0",marginBottom:j?yt.spacing.md:"0"}),children:M}),j&&Le("a",{href:j,className:kt.create("new-quote-link",{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:yt.colors.primary,fontSize:yt.fontSize.small,fontWeight:"500",textDecoration:"none"}),children:["Start New Quote",Le("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:[Le("path",{d:"M5 12h14"}),Le("path",{d:"m12 5 7 7-7 7"})]})]})]})]})]}),Q&&J&&Le("div",{className:kt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Le(is,{title:"Excess Options"}),Le("div",{className:kt.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 Le("div",{className:Tt(kt.create("excess-option-card",{borderRadius:yt.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),t?kt.create("excess-option-card-selected",{border:`2px solid ${yt.colors.primary}`,backgroundColor:yt.colors.accent}):kt.create("excess-option-card-unselected",{border:`2px solid ${yt.colors.border}`,backgroundColor:yt.colors.card})),onClick:()=>x(e.id),children:[Le(os,{selected:t}),Le("div",{className:kt.create("excess-amount",{color:yt.colors.foreground}),children:["$",Number(e.excess_amount).toFixed(0)]})]},e.id)})}),(null==F?void 0:F.description)&&Le("div",{className:kt.create("excess-description",{padding:"0.75rem",backgroundColor:yt.colors.muted,borderRadius:yt.radius.default,border:`1px solid ${yt.colors.border}`}),children:Le(rs,{className:kt.create("excess-description-text",{fontSize:yt.fontSize.small,color:yt.colors.foreground,margin:"0"}),children:F.description})})]}),u.payment_options.length>0&&Le("div",{className:kt.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Le(is,{title:"Payment Options"}),Le("div",{className:kt.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:u.payment_options.map(e=>{const t=S===e.gateway_code,n="monthly"===e.payment_frequency,r=()=>{var t;return n&&e.amount.monthly?`${as(parseFloat(e.amount.monthly))} x ${(null===(t=e.metadata)||void 0===t?void 0:t.number_of_instalments)||12}`:as(parseFloat(e.amount.due_today))},i=()=>"bank_transfer"===e.gateway_code?"Manual":`via ${e.gateway_name}`;return Le("div",{className:Tt(kt.create("payment-option-row",{borderRadius:yt.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?kt.create("payment-option-row-selected",{border:`2px solid ${yt.colors.primary}`,backgroundColor:yt.colors.accent}):kt.create("payment-option-row-unselected",{border:`2px solid ${yt.colors.border}`,backgroundColor:yt.colors.card})),onClick:()=>N(e.gateway_code),children:[Le("div",{className:kt.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Le(os,{selected:t}),Le("div",{className:kt.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Le("div",{className:kt.create("frequency-title",{fontSize:yt.fontSize.default,fontWeight:"500",color:yt.colors.foreground}),children:cs(n?"monthly":"one-time",e.gateway_code)}),Le("div",{className:kt.create("gateway-description",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground}),children:i()})]})]}),Le("div",{className:kt.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Le(rs,{className:kt.create("amount-text",{textAlign:"right",color:yt.colors.foreground}),children:r()}),"bank_transfer"!==e.gateway_code&&Le(rs,{size:"small",className:kt.create("gateway-fee-text",{textAlign:"right",color:yt.colors.mutedForeground}),children:["bank_transfer"===e.gateway_code?null:n&&(null===(o=e.metadata)||void 0===o?void 0:o.total_interest)?as(e.metadata.total_interest):as(0)," fee"]}),"bank_transfer"===e.gateway_code&&Le(rs,{size:"small",className:kt.create("no-fee-text",{textAlign:"right",color:yt.colors.mutedForeground}),children:"No fees"})]}),Le("div",{className:kt.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Le(os,{selected:t}),Le("div",{className:kt.create("payment-option-title-mobile",{fontSize:yt.fontSize.default,fontWeight:"500",color:yt.colors.foreground}),children:cs(n?"monthly":"one-time",e.gateway_code)})]}),Le("div",{className:kt.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:[Le("div",{className:kt.create("gateway-description-mobile",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground}),children:i()}),Le(rs,{className:kt.create("amount-text-mobile",{fontWeight:"500",color:yt.colors.foreground}),children:r()})]})]},e.gateway_code);var o})})]})]})]}),Le("div",{className:kt.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Le("div",{className:kt.create("checkout-sidebar-sticky",{position:"sticky",top:yt.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:[(te||ne)&&Le("div",{className:kt.create("insurance-details-card",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,padding:yt.spacing.lg,boxShadow:yt.shadow.sm},{"(max-width: 768px)":{padding:yt.spacing.md}}),children:[Le("h3",{className:kt.create("cart-summary-title",{fontSize:yt.fontSize.large,fontWeight:"600",marginBottom:yt.spacing.md,color:yt.colors.foreground}),children:Q?"Insurance Details":"Payment Details"}),te&&Le(k,{children:[Le("div",{className:kt.create("client-details",{display:"flex",flexDirection:"column",gap:yt.spacing.sm,marginBottom:yt.spacing.md}),children:[te.firstName&&te.lastName&&Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Name"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:[te.firstName," ",te.lastName]})]}),te.email&&Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Email"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:te.email})]}),te.phone&&Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Phone"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:te.phone})]}),"Payment"!==V&&Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Product"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:V})]}),Le("div",{className:kt.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Le("span",{className:kt.create("detail-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:"Link Expires"}),Le("span",{className:kt.create("detail-value",{fontWeight:"500",color:yt.colors.foreground,fontSize:yt.fontSize.small}),children:K.toLocaleDateString()})]})]}),Le("hr",{className:kt.create("divider",{border:"none",borderTop:`1px solid ${yt.colors.border}`,margin:`${yt.spacing.md} 0`})})]}),ne&&Le("div",{className:kt.create("line-item-section",{}),children:[Le("div",{className:kt.create("line-item-description",{fontSize:yt.fontSize.small,fontWeight:"500",color:yt.colors.foreground}),children:ne.description}),null!=ne.sum_insured&&Le("div",{className:kt.create("line-item-sum-insured",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground,marginTop:yt.spacing.sm}),children:["Sum Insured: ",as(ne.sum_insured)]})]})]}),(te||ne)&&Le("div",{className:kt.create("checkout-sidebar-spacer",{height:yt.spacing.lg},{"(max-width: 950px)":{height:yt.spacing.md}})}),Le("div",{className:kt.create("checkout-sidebar-card",{backgroundColor:yt.colors.card,borderRadius:yt.radius.large,boxShadow:yt.shadow.sm,padding:yt.spacing.lg},{"(max-width: 768px)":{padding:yt.spacing.md}}),children:Le("div",{className:kt.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Le("h3",{className:kt.create("cart-summary-title",{fontSize:yt.fontSize.large,fontWeight:"600",marginBottom:yt.spacing.sm,color:yt.colors.foreground}),children:"Payment Details"}),q&&Le("div",{className:kt.create("summary-section",{paddingBottom:"1rem"}),children:Le("div",{className:kt.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"monthly"!==q.payment_frequency?Le(Bs,{label:"Total Due Today:",value:as(parseFloat(q.amount.due_today)),isTotal:!0}):Le(k,{children:[Le(Bs,{label:"Due Today:",value:as(parseFloat(q.amount.due_today)),isTotal:!0}),q.amount.monthly&&Le(Bs,{label:"Then Monthly:",value:as(parseFloat(q.amount.monthly))}),(null===(c=q.metadata)||void 0===c?void 0:c.number_of_instalments)&&Le(Bs,{label:"Installments:",value:q.metadata.number_of_instalments.toString()}),q.amount.total&&Le(Bs,{label:"Total Payable:",value:as(parseFloat(q.amount.total))})]})})}),Le(es,{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(!S)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===S))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,S,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:S,calculationId:b||"",clientDetails:{legalName:a},metadata:{payment_link_id:u.payment_link_id,payment_type:c?"quote":"rate",gateway_code:S,gateway:S},...X&&P?{coverStartDate:P}:{}};if("bank_transfer"!==S)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,S);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:kt.create("purchase-button",{width:"100%",height:"3rem",fontSize:yt.fontSize.default,fontWeight:"600"}),children:ee?"Go to Payment":"Select Options to Continue"})]})})]})})]}),g&&v&&l&&Le(Os,{isOpen:g,onClose:()=>{y(!1),w(null)},onSuccess:()=>{y(!1),w(null),alert("Payment completed successfully!")},paymentRequest:v,httpClient:l})]})})}function Bs({label:e,value:t,isTotal:n=!1,className:r}){return Le("div",{className:Tt(kt.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Le("span",{className:kt.create("summary-label",{color:yt.colors.mutedForeground,fontSize:yt.fontSize.small}),children:e}),Le("span",{className:kt.create("summary-value",{fontWeight:n?"600":"500",color:yt.colors.foreground,fontSize:n?yt.fontSize.large:"inherit"}),children:t})]})}function Fs({products:e,onSelectProduct:t}){const[n,r]=tt(null),i=(e,t)=>{t&&(t.preventDefault(),t.stopPropagation()),r(e)};return Le(Vo,{title:"Select cover",noSubscription:!0,hideHeader:!0,children:Le(Et,{children:Le("div",{className:kt.create("product-selection-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Le("div",{className:kt.create("product-selection-card",{backgroundColor:yt.colors.card,boxShadow:yt.shadow.sm,borderRadius:yt.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Le("div",{className:kt.create("product-selection-header",{paddingInline:yt.spacing.xl,paddingTop:yt.spacing.xl,paddingBottom:yt.spacing.lg},{"(max-width: 768px)":{paddingInline:yt.spacing.lg,paddingTop:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingTop:yt.spacing.md}}),children:[Le("h2",{className:kt.create("product-selection-title",{margin:"0",marginBottom:yt.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:yt.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Select Your Cover"}),Le("p",{className:kt.create("product-selection-description",{margin:"0",fontSize:yt.fontSize.default,lineHeight:"1.6",color:yt.colors.foreground,opacity:"0.9"}),children:"What type of vessel are you insuring?"}),Le("hr",{className:kt.create("product-selection-header-border",{marginTop:yt.spacing.lg,borderColor:yt.colors.border})})]}),Le("div",{className:kt.create("product-selection-content",{paddingInline:yt.spacing.xl,paddingBottom:yt.spacing.xl},{"(max-width: 768px)":{paddingInline:yt.spacing.lg,paddingBottom:yt.spacing.lg},"(max-width: 480px)":{paddingInline:yt.spacing.md,paddingBottom:yt.spacing.md}}),children:[0===e.length?Le("div",{className:kt.create("no-products-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${yt.colors.border}`,borderRadius:yt.radius.default,backgroundColor:yt.colors.muted}),children:[Le("div",{style:{marginBottom:yt.spacing.default},children:Le("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{margin:"0 auto",opacity:.5},children:[Le("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Le("polyline",{points:"14 2 14 8 20 8"})]})}),Le("p",{className:kt.create("placeholder-text",{color:yt.colors.mutedForeground,margin:"0"}),children:"No products available for quoting."})]}):Le("div",{className:kt.create("product-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Le(qs,{product:e,isSelected:(null==n?void 0:n.id)===e.id,onSelect:i},e.id))}),e.length>0&&Le("div",{className:kt.create("product-selection-actions",{marginTop:yt.spacing.lg}),children:Le(es,{onClick:()=>{n&&t(n)},disabled:!n,className:kt.create("product-selection-continue-button",{width:"100%"}),children:"Continue"})})]})]})})})})}function qs({product:e,isSelected:t,onSelect:n}){return Le("div",{className:Tt(kt.create("product-option-row",{borderRadius:yt.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?kt.create("product-option-row-selected",{border:`2px solid ${yt.colors.primary}`,backgroundColor:yt.colors.accent}):kt.create("product-option-row-unselected",{border:`2px solid ${yt.colors.border}`,backgroundColor:yt.colors.card})),onClick:t=>n(e,t),role:"button",tabIndex:0,onKeyPress:t=>{"Enter"!==t.key&&" "!==t.key||n(e,t)},children:[Le(os,{selected:t}),Le("div",{className:kt.create("product-option-content",{display:"flex",alignItems:"center",justifyContent:"space-between",flex:"1",gap:"1rem"}),children:[Le("div",{className:kt.create("product-option-info",{display:"flex",flexDirection:"column"}),children:[e.description&&Le("div",{className:kt.create("product-option-description",{fontSize:yt.fontSize.default,fontWeight:"500",color:yt.colors.foreground}),children:e.description}),Le("div",{className:kt.create("product-option-name",{fontSize:yt.fontSize.small,color:yt.colors.mutedForeground}),children:e.name})]}),e.icon_svg&&Le("div",{className:kt.create("product-option-icon",{width:"2.5rem",height:"2.5rem",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",color:t?yt.colors.primary:yt.colors.mutedForeground,transition:"color 150ms ease"}),dangerouslySetInnerHTML:{H:e.icon_svg}})]})]})}function Hs(){var e,t;const n=Mt(),{paymentLinkConfig:r,availableProducts:i,formStateManager:o}=n;if(i&&!o)return Le(Fs,{products:i,onSelectProduct:async e=>{localStorage.setItem("insure-os-selected-product",e.code),window.location.reload()}});if(r)return Le(Ls,{paymentLinkId:r.paymentLinkId,signedUrl:r.signedUrl});const s=new URLSearchParams(window.location.search),a=s.get("pl_ref");if(a)return Le(Ls,{paymentLinkId:a});const c=window.location.pathname,l=c.match(/\/pay\/([a-f0-9-]+)/);if(l&&l[1])return Le(Ls,{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 Le(js,{transactionId:u[1],organisationId:d});const{isCalculating:h,results:m,quoteIntent:f}=zt(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?Le(Xo,{message:"Processing your quote, please wait..."}):p&&g&&(null===(t=null==f?void 0:f.organisation)||void 0===t?void 0:t.id)?Le(js,{transactionId:g.id,organisationId:f.organisation.id}):y?Le(Rs,{}):m?Le(xs,{results:m}):Le(zs,{})}function Us(e){return Le(Dt,{...e,children:Le(Hs,{})})}class Zs extends S{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(t,n){e();try{Promise.resolve().then(function(){return Id}).then(({captureException:e,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),e(t,{componentStack:n.componentStack}))}).catch(()=>{})}catch(e){}const r=fe("initialization",t,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return ke(e)?Le(ns,{message:e.message}):Le(ts,{error:e})}return this.props.children}}function Ys({config:t,initializeFormContext:n}){const[r,i]=tt({type:"loading",message:"Loading application..."});return nt(()=>{(async()=>{try{e();const r=await n(t),o=r.availableProducts&&r.availableProducts.length>0;if(!("payment"===t.mode||r.paymentLinkConfig||o||r.formStateManager&&"function"==typeof r.formStateManager.getFormProgress))throw new Error("FormStateManager was not properly initialized");e(),i({type:"success",formContextProps:r})}catch(t){let n;e(),n=t&&"object"==typeof t&&"type"in t&&"MAINTENANCE_ERROR"===t.type||t&&"object"==typeof t&&"statusCode"in t&&503===t.statusCode||t&&"object"==typeof t&&"status"in t&&503===t.status?fe("maintenance",t):fe("initialization",t),e((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[t,n]),Le(Zs,{children:Le("div",{className:kt.create("root",{fontFamily:yt.fontFamily,backgroundColor:yt.colors.background,minHeight:"100vh",color:yt.colors.foreground}),children:function(){switch(r.type){case"loading":return Le(Xo,{message:r.message});case"error":return ke(r.error)?Le(ns,{message:r.error.message}):Le(ts,{error:r.error});case"success":return Le(Us,{...r.formContextProps});default:return Le(ts,{})}}()})})}const Gs="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Js=globalThis,Qs="10.17.0";function Vs(){return Ks(Js),Js}function Ks(e){const t=e.oe=e.oe||{};return t.version=t.version||Qs,t[Qs]=t[Qs]||{}}function Xs(e,t,n=Js){const r=n.oe=n.oe||{},i=r[Qs]=r[Qs]||{};return i[e]||(i[e]=t())}const ea=["debug","info","warn","error","log","assert","trace"],ta={};function na(e){if(!("console"in Js))return e();const t=Js.console,n={},r=Object.keys(ta);r.forEach(e=>{const r=ta[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function ra(){return oa().enabled}function ia(e,...t){Gs&&ra()&&na(()=>{Js.console[e](`Sentry Logger [${e}]:`,...t)})}function oa(){return Gs?Xs("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const sa=function(){oa().enabled=!0},aa=function(...e){ia("log",...e)},ca=function(...e){ia("warn",...e)},la=function(...e){ia("error",...e)},ua="?",da=/\(error: (.*)\)/,ha=/captureMessage|captureException/;function ma(...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=da.test(n)?n.replace(da,"$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(fa(t).function||"")&&t.pop(),t.reverse(),ha.test(fa(t).function||"")&&(t.pop(),ha.test(fa(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||fa(t).filename,function:e.function||ua}))}(i.slice(r))}}function fa(e){return e[e.length-1]||{}}const pa="<anonymous>";function ga(e){try{return e&&"function"==typeof e&&e.name||pa}catch{return pa}}function ya(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 va={},wa={};function ba(e,t){va[e]=va[e]||[],va[e].push(t)}function xa(e,t){if(!wa[e]){wa[e]=!0;try{t()}catch(t){Gs&&la(`Error while instrumenting ${e}`,t)}}}function ka(e,t){const n=e&&va[e];if(n)for(const r of n)try{r(t)}catch(t){Gs&&la(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${ga(r)}\nError:`,t)}}let Sa=null;function Na(){Sa=Js.onerror,Js.onerror=function(e,t,n,r,i){return ka("error",{column:r,error:i,line:n,msg:e,url:t}),!!Sa&&Sa.apply(this,arguments)},Js.onerror.se=!0}let _a=null;function $a(){_a=Js.onunhandledrejection,Js.onunhandledrejection=function(e){return ka("unhandledrejection",e),!_a||_a.apply(this,arguments)},Js.onunhandledrejection.se=!0}const Ca={}.toString;function Ta(e){switch(Ca.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Aa(e,Error)}}function Ia(e,t){return Ca.call(e)===`[object ${t}]`}function Ea(e){return Ia(e,"ErrorEvent")}function Pa(e){return Ia(e,"DOMError")}function Da(e){return Ia(e,"String")}function Ma(e){return"object"==typeof e&&null!==e&&"ae"in e&&"ce"in e}function za(e){return null===e||Ma(e)||"object"!=typeof e&&"function"!=typeof e}function Ra(e){return Ia(e,"Object")}function Oa(e){return"undefined"!=typeof Event&&Aa(e,Event)}function ja(e){return Boolean(e?.then&&"function"==typeof e.then)}function Aa(e,t){try{return e instanceof t}catch{return!1}}function Wa(e){return!("object"!=typeof e||null===e||!e.le&&!e.ue)}const La=Js;function Ba(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=Fa(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 Fa(e,t){const n=e,r=[];if(!n?.tagName)return"";if(La.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&&Da(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 qa(){try{return La.document.location.href}catch{return""}}function Ha(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Ua(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{Wa(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Za(e,t,n=!1){return!!Da(e)&&(Ia(t,"RegExp")?t.test(e):!!Da(t)&&(n?e===t:e.includes(t)))}function Ya(e,t=[],n=!1){return t.some(t=>Za(e,t,n))}function Ga(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Qa(i,r);try{e[t]=i}catch{Gs&&aa(`Failed to replace method "${t}" in object`,e)}}function Ja(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Gs&&aa(`Failed to add non-enumerable property "${t}" to object`,e)}}function Qa(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Ja(e,"__sentry_original__",t)}catch{}}function Va(e){return e.de}function Ka(e){if(Ta(e))return{message:e.message,name:e.name,stack:e.stack,...ec(e)};if(Oa(e)){const t={type:e.type,target:Xa(e.target),currentTarget:Xa(e.currentTarget),...ec(e)};return"undefined"!=typeof CustomEvent&&Aa(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Xa(e){try{return"undefined"!=typeof Element&&Aa(e,Element)?Ba(e):{}.toString.call(e)}catch{return"<unknown>"}}function ec(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 tc(e=function(){const e=Js;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 nc(e){return e.exception?.values?.[0]}function rc(e){const{message:t,event_id:n}=e;if(t)return t;const r=nc(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ic(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 oc(e,t){const n=nc(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 sc(e){if(function(e){try{return e.he}catch{}}(e))return!0;try{Ja(e,"__sentry_captured__",!0)}catch{}return!1}function ac(){return Date.now()/1e3}let cc;function lc(){return(cc??(cc=function(){const{performance:e}=Js;if(!e?.now||!e.timeOrigin)return ac;const t=e.timeOrigin;return()=>(t+e.now())/1e3}()))()}function uc(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||lc(),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:tc()),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 dc(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]=dc(r[e],t[e],n-1));return r}function hc(){return tc()}function mc(){return tc().substring(16)}const fc="_sentrySpan";function pc(e,t){t?Ja(e,fc,t):delete e[fc]}function gc(e){return e[fc]}class yc{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:hc(),sampleRand:Math.random()}}clone(){const e=new yc;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,pc(e,gc(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&&uc(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 yc?t.getScopeData():Ra(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,pc(this,void 0),this.ye=[],this.setPropagationContext({traceId:hc(),sampleRand:Math.random()}),this.Ee(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:ac(),...e,message:e.message?Ha(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:gc(this)}}setSDKProcessingMetadata(e){return this.ke=dc(this.ke,e,2),this}setPropagationContext(e){return this.Se=e,this}getPropagationContext(){return this.Se}captureException(e,t){const n=t?.event_id||tc();if(!this.Te)return Gs&&ca("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||tc();if(!this.Te)return Gs&&ca("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||tc();return this.Te?(this.Te.captureEvent(e,{...t,event_id:n},this),n):(Gs&&ca("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 vc{constructor(e,t){let n,r;n=e||new yc,r=t||new yc,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 ja(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 wc(){const e=Ks(Vs());return e.stack=e.stack||new vc(Xs("defaultCurrentScope",()=>new yc),Xs("defaultIsolationScope",()=>new yc))}function bc(e){return wc().withScope(e)}function xc(e,t){const n=wc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function kc(e){return wc().withScope(()=>e(wc().getIsolationScope()))}function Sc(e){const t=Ks(e);return t.acs?t.acs:{withIsolationScope:kc,withScope:bc,withSetScope:xc,withSetIsolationScope:(e,t)=>kc(t),getCurrentScope:()=>wc().getScope(),getIsolationScope:()=>wc().getIsolationScope()}}function Nc(){return Sc(Vs()).getCurrentScope()}function _c(){return Sc(Vs()).getIsolationScope()}function $c(...e){const t=Sc(Vs());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Cc(){return Nc().getClient()}function Tc(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||mc()};return r&&(o.parent_span_id=r),o}const Ic="sentry.profile_id",Ec="sentry.exclusive_time";function Pc(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function Dc(e){const t=e;return{scope:t.Re,isolationScope:Pc(t.Oe)}}const Mc=/^sentry-/;function zc(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 Rc=/^o(\d+)\./,Oc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function jc(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 Ac(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Wc(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(Rc);return t?.[1]}(n)),r}let Lc=!1;function Bc(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Uc(e).parent_span_id,o=Dc(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||mc():t,trace_id:n}}function Fc(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 qc(e){return"number"==typeof e?Hc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Hc(e.getTime()):lc()}function Hc(e){return e>9999999999?e/1e3:e}function Uc(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:qc(i),timestamp:qc(s)||void 0,status:Zc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:Fc(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Zc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"unknown_error"}function Yc(e){return e.je||e}function Gc(){Lc||(na(()=>{}),Lc=!0)}function Jc(e){aa(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Qc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(Kc(n)){if(Za(e.description,n))return Gs&&Jc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||Za(e.description,n.name),r=!n.op||e.op&&Za(e.op,n.op);if(t&&r)return Gs&&Jc(e),!0}return!1}function Vc(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 Kc(e){return"string"==typeof e||e instanceof RegExp}const Xc="production";function el(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Xc,release:n.release,public_key:r,trace_id:e,org_id:Wc(t)};return t.emit("createDsc",i),i}function tl(e){const t=Cc();if(!t)return{};const n=Yc(e),r=Uc(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&&(Da(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=zc(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):zc(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.match(Mc)&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(l);if(u)return a(u);const d=el(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=Cc()?.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")??Dc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),t.emit("createDsc",d,n),d}function nl(e,t=100,n=1/0){try{return il("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function rl(e,t=3,n=102400){const r=nl(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?rl(e,t-1,n):r;var i}function il(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(Wa(t))return"[VueViewModel]";if(Ra(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: ${ga(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 il("",l.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=Ka(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]=il(e,t,c-1,r,i),d++}return s(t),u}function ol(e,t=[]){return[e,t]}function sl(e,t){const[n,r]=e;return[n,[...r,t]]}function al(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function cl(e){const t=Ks(Js);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function ll(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[cl(r),e]:r.push("string"==typeof e?cl(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(nl(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 ul(e){const t="string"==typeof e.data?cl(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const dl={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 hl(e){return dl[e]}function ml(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function fl(e){return new gl(t=>{t(e)})}function pl(e){return new gl((t,n)=>{n(e)})}class gl{constructor(e){this.Fe=0,this.qe=[],this.He(e)}then(e,t){return new gl((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 gl((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&&(ja(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 yl(e,t,n,r=0){try{const i=vl(t,n,e,r);return ja(i)?i:fl(i)}catch(e){return pl(e)}}function vl(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return Gs&&null===o&&aa(`Event processor "${i.id||"?"}" dropped event`),ja(o)?o.then(e=>vl(e,t,n,r+1)):vl(o,t,n,r+1)}function wl(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;bl(e,"extra",n),bl(e,"tags",r),bl(e,"user",i),bl(e,"contexts",o),e.sdkProcessingMetadata=dc(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 bl(e,t,n){e[t]=dc(e[t],n,1)}let xl,kl,Sl;function Nl(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||tc(),timestamp:t.timestamp||ac()},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||Xc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&(s.url=Ha(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=Js.Ye;if(!t)return{};const n=Object.keys(t);return Sl&&n.length===kl||(kl=n.length,Sl=n.reduce((n,r)=>{xl||(xl={});const i=xl[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,xl[r]=[s,a];break}}}return n},{})),Sl}(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 yc;return n.update(t),n}(r,n.captureContext);n.mechanism&&oc(c,n.mechanism);const d=i?i.getEventProcessors():[],h=Xs("globalScope",()=>new yc).getScopeData();o&&wl(h,o.getScopeData()),u&&wl(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:Bc(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:tl(t),...e.sdkProcessingMetadata};const n=Uc(Yc(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),yl([...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:nl(e.data,t,n)}}))},...e.user&&{user:nl(e.user,t,n)},...e.contexts&&{contexts:nl(e.contexts,t,n)},...e.extra&&{extra:nl(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=nl(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:nl(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=nl(e.contexts.flags,3,n)),r}(e,s,a):e))}function _l(e){return Nc().captureException(e,void 0)}function $l(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return Nc().captureMessage(e,n,r)}function Cl(e,t){return Nc().captureEvent(e,t)}function Tl(e){const t=_c(),n=Nc(),{userAgent:r}=Js.navigator||{},i=function(e){const t=lc(),n={sid:tc(),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&&uc(n,e),n}({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&uc(o,{status:"exited"}),Il(),t.setSession(i),i}function Il(){const e=_c(),t=Nc().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),uc(e,t)}(t),El(),e.setSession()}function El(){const e=_c(),t=Cc(),n=e.getSession();n&&t&&t.captureSession(n)}function Pl(e=!1){e?Il():El()}const Dl=[];function Ml(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 zl(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Rl(e,t,n){if(n[t.name])Gs&&aa(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===Dl.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),Dl.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)}Gs&&aa(`Integration installed: ${t.name}`)}}function Ol(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 jl="Not capturing exception because it's already been captured.",Al="Discarded session because of missing or non-string release",Wl=Symbol.for("SentryInternalError"),Ll=Symbol.for("SentryDoNotSendEventError");function Bl(e){return{message:e,[Wl]:!0}}function Fl(e){return{message:e,[Ll]:!0}}function ql(e){return!!e&&"object"==typeof e&&Wl in e}function Hl(e){return!!e&&"object"==typeof e&&Ll in e}class Ul{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=Oc.exec(e);if(!t)return void na(()=>{});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 Ac({host:o,pass:i,path:c,projectId:l,port:s,protocol:n,publicKey:r})}(e):Ac(e);if(t&&function(e){if(!Gs)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(la(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(la(`Invalid Sentry Dsn: Invalid port ${t}`),1):(la(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(la(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Gs&&ca("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=tc();if(sc(e))return Gs&&aa(jl),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:tc(),...n},o=Ma(e)?e:String(e),s=za(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=tc();if(t?.originalException&&sc(t.originalException))return Gs&&aa(jl),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),uc(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];Rl(this,e,this.Je),t||zl(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=ml(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:jc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,ol(s,[[{type:o},e]])}(e,this.Xe,this.Ge.et,this.Ge.tunnel);for(const e of t.attachments||[])n=sl(n,ul(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=Xc}=this.Ge;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Gs&&ca(Al));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(Gs&&ca(Al));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=ml(n);return ol({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:jc(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}`;Gs&&aa(`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 Gs&&la("Error while sending envelope:",e),{}}return Gs&&la("Transport disabled"),{}}ct(){const{integrations:e}=this.Ge;this.Je=function(e,t){const n={};return t.forEach(t=>{t&&Rl(e,t,n)}),n}(this,e),zl(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)&&(uc(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),Nl(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:Tc(n),...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||el(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}it(e,t={},n=Nc(),r=_c()){return Gs&&Zl(e)&&aa(`Captured error event \`${Ol(e)[0]||"<unknown>"}\``),this.ht(e,t,n,r).then(e=>e.event_id,e=>{Gs&&(Hl(e)?aa(e.message):ql(e)?ca(e.message):ca(e))})}ht(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Yl(e),a=Zl(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"),pl(Fl(`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),Fl("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(Zl(c)&&i)return i(c,r);if(Yl(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?.[Ic],exclusive_time:s?.[Ec],measurements:e.measurements,is_segment:!0}}(c);if(a?.length&&Qc(t,a))return null;if(s){const e=s(t);e?c=dc(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&&{[Ic]:l.profile_id},...l.exclusive_time&&{[Ec]:l.exclusive_time}}}},measurements:l.measurements}):Gc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(a?.length&&Qc(e,a))Vc(n,e);else if(s){const n=s(e);n?t.push(n):(Gc(),t.push(e))}else t.push(e);const r=c.spans.length-t.length;r&&e.recordDroppedEvent("before_send","span",r),c.spans=t}}if(o){if(c.spans){const e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return o(c,r)}}var l;return c}(this,i,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(ja(e))return e.then(e=>{if(!Ra(e)&&null!==e)throw Bl(n);return e},e=>{throw Bl(`${t} rejected with ${e}`)});if(!Ra(e)&&null!==e)throw Bl(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 Fl(`${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(Hl(e)||ql(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{ft:!0},originalException:e}),Bl(`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(){Gs&&aa("Flushing outcomes...");const e=this.gt();if(0===e.length)return void(Gs&&aa("No outcomes to send"));if(!this.Xe)return void(Gs&&aa("No dsn provided, will not send outcomes"));Gs&&aa("Sending outcomes:",e);const t=(n=e,ol((r=this.Ge.tunnel&&jc(this.Xe))?{dsn:r}:{},[[{type:"client_report"},{timestamp:ac(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function Zl(e){return void 0===e.type}function Yl(e){return"transaction"===e.type}function Gl(e){const t=function(e){return Jl().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=jc(r)),ol(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());Jl().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(r)}function Jl(){return Xs("clientToLogBufferMap",()=>new WeakMap)}const Ql=Symbol.for("SentryBufferFullError");function Vl(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 pl(Ql);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return fl(!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(al(i,(t,n)=>{const i=hl(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=ol(i[0],o),a=t=>{al(s,(n,r)=>{e.recordDroppedEvent(t,hl(r))})};return n.add(()=>t({body:ll(s)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Gs&&ca(`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"),Gs&&la("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Ql)return Gs&&la("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function Kl(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 Xl(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 eu=100;function tu(e,t){const n=Cc(),r=_c();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=eu}=n.getOptions();if(o<=0)return;const s={timestamp:ac(),...e},a=i?na(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let nu;const ru=new WeakMap,iu=()=>({name:"FunctionToString",setupOnce(){nu=function(){}.toString;try{Function.prototype.toString=function(...e){const t=Va(this),n=ru.has(Cc())&&void 0!==t?t:this;return nu.apply(n,e)}}catch{}},setup(e){ru.set(e,!0)}}),ou=[/^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$/],su=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=cu(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=cu(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&&Ya(n,t)}(e,t.ignoreTransactions))return Gs&&ca(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${rc(e)}`),!0}else{if(function(e,t){return!!t?.length&&Ol(e).some(e=>Ya(e,t))}(e,t.ignoreErrors))return Gs&&ca(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${rc(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 Gs&&ca(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${rc(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=lu(e);return!!n&&Ya(n,t)}(e,t.denyUrls))return Gs&&ca(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${rc(e)}.\nUrl: ${lu(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=lu(e);return!n||Ya(n,t)}(e,t.allowUrls))return Gs&&ca(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${rc(e)}.\nUrl: ${lu(e)}`),!0}return!1}(n,t)?null:n}}},au=(e={})=>({...su(e),name:"InboundFilters"});function cu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:ou],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function lu(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 Gs&&la(`Cannot extract url for event ${rc(e)}`),null}}function uu(e,t,n,r,i,o){if(!i.exception?.values||!o||!Aa(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=du(e,t,r,o.originalException,n,i.exception.values,s,0))}function du(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(Aa(r[i],Error)){hu(s,a);const o=e(t,r[i]),l=c.length;mu(o,i,l,a),c=du(e,t,n,r[i],i,[o,...c],o,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(Aa(r,Error)){hu(s,a);const l=e(t,r),u=c.length;mu(l,`errors[${o}]`,u,a),c=du(e,t,n,r,i,[l,...c],l,u)}}),c}function hu(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function mu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function fu(){"console"in Js&&ea.forEach(function(e){e in Js.console&&Ga(Js.console,e,function(t){return ta[e]=t,function(...t){ka("console",{args:t,level:e});const n=ta[e];n?.apply(Js.console,t)}})})}const pu=()=>{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&&(!!yu(e,t)&&!!gu(e,t))))}(e,t)||!!function(e,t){const n=vu(t),r=vu(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!yu(e,t)&&!!gu(e,t)))}(e,t))}(t,e))return Gs&&ca("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function gu(e,t){let n=ya(e),r=ya(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 yu(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 vu(e){return e.exception?.values?.[0]}function wu(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const bu=Js;function xu(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function ku(e,t){const n="fetch";ba(n,e),xa(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in bu))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(xu(bu.fetch))return!0;let e=!1;const t=bu.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=xu(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Gs&&ca("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||Ga(Js,"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:Nu(t),method:Su(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:Nu(t),method:Su(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*lc(),virtualError:n,headers:_u(t)};return ka("fetch",{...o}),e.apply(Js,t).then(async e=>(ka("fetch",{...o,endTimestamp:1e3*lc(),response:e}),e),e=>{if(ka("fetch",{...o,endTimestamp:1e3*lc(),error:e}),Ta(e)&&void 0===e.stack&&(e.stack=n.stack,Ja(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 Su(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Nu(e){return"string"==typeof e?e:e?Su(e,"url")?e.url:e.toString?e.toString():"":""}function _u(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&&Aa(t,Request))return new Headers(t.headers)}catch{}}const $u=Js;let Cu=0;function Tu(){return Cu>0}function Iu(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(Va(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>Iu(e,t));return e.apply(this,r)}catch(e){throw Cu++,setTimeout(()=>{Cu--}),$c(r=>{r.addEventProcessor(e=>(t.mechanism&&(ic(e,void 0),oc(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),_l(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Qa(n,e),Ja(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function Eu(e,t){const n=Du(e,t),r={type:Ru(t),value:Ou(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Pu(e,t){return{exception:{values:[Eu(e,t)]}}}function Du(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&Mu.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 Mu=/Minified React error #\d+;/i;function zu(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function Ru(e){const t=e?.name;return!t&&zu(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function Ou(e){const t=e?.message;return zu(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 ju(e,t,n,r,i){let o;if(Ea(t)&&t.error)return Pu(e,t.error);if(Pa(t)||Ia(t,"DOMException")){const i=t;if("stack"in t)o=Pu(e,t);else{const t=i.name||(Pa(i)?"DOMError":"DOMException"),s=i.message?`${t}: ${i.message}`:t;o=Au(e,s,n,r),ic(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Ta(t)?Pu(e,t):Ra(t)||Oa(t)?(o=function(e,t,n,r){const i=Cc(),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:rl(t,o)};if(s)return{exception:{values:[Eu(e,s)]},extra:a};const c={exception:{values:[{type:Oa(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Wu(t,{isUnhandledRejection:r})}]},extra:a};if(n){const t=Du(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),oc(o,{synthetic:!0}),o):(o=Au(e,t,n,r),ic(o,`${t}`),oc(o,{synthetic:!0}),o)}function Au(e,t,n,r){const i={};if(r&&n){const r=Du(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),oc(i,{synthetic:!0})}if(Ma(t)){const{ae:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Wu(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(Ka(e));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=t)return Ha(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:Ha(r,t)}return""}(e),r=t?"promise rejection":"exception";return Ea(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Oa(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 Lu extends Ul{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:$u.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:Qs})),version:Qs}),e.et=i}(t,"browser",["browser"],$u.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;$u.document&&(i||o)&&$u.document.addEventListener("visibilitychange",()=>{"hidden"===$u.document.visibilityState&&(i&&this.yt(),o&&Gl(this))}),o&&(this.on("flush",()=>{Gl(this)}),this.on("afterCaptureLog",()=>{this.bt&&clearTimeout(this.bt),this.bt=setTimeout(()=>{Gl(this)},5e3)})),r&&this.on("beforeSendSession",Xl)}eventFromException(e,t){return function(e,t,n,r){const i=ju(e,t,n?.syntheticException||void 0,r);return oc(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),fl(i)}(this.Ge.stackParser,e,t,this.Ge.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=Au(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),fl(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 Bu="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Fu=Js;let qu,Hu,Uu,Zu;function Yu(){if(!Fu.document)return;const e=ka.bind(null,"dom"),t=Gu(e,!0);Fu.document.addEventListener("click",t,!1),Fu.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=Fu,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ga(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=Gu(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),Ga(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 Gu(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;Ja(n,"_sentryCaptured",!0),r&&!r.St&&Ja(r,"_sentryId",tc());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==Hu)return!1;try{if(!e.target||e.target.St!==Uu)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),Hu=n.type,Uu=r?r.St:void 0),clearTimeout(qu),qu=Fu.setTimeout(()=>{Uu=void 0,Hu=void 0},1e3)}}function Ju(e){const t="history";ba(t,e),xa(t,Qu)}function Qu(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=Zu,i=function(e){try{return new URL(e,Fu.location.origin).toString()}catch{return e}}(String(n));if(Zu=i,r===i)return e.apply(this,t);ka("history",{from:r,to:i})}return e.apply(this,t)}}Fu.addEventListener("popstate",()=>{const e=Fu.location.href,t=Zu;Zu=e,t!==e&&ka("history",{from:t,to:e})}),"history"in bu&&bu.history&&(Ga(Fu.history,"pushState",e),Ga(Fu.history,"replaceState",e))}const Vu={},Ku="__sentry_xhr_v3__";function Xu(){if(!Fu.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*lc(),o=Da(n[0])?n[0].toUpperCase():void 0,s=function(e){if(Da(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[Ku]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.Nt=!0);const a=()=>{const e=t[Ku];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}ka("xhr",{endTimestamp:1e3*lc(),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[Ku];return o&&Da(r)&&Da(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[Ku];return r?(void 0!==n[0]&&(r.body=n[0]),ka("xhr",{startTimestamp:1e3*lc(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function ed(e,t=function(e){const t=Vu[e];if(t)return t;let n=Fu[e];if(xu(n))return Vu[e]=n.bind(Fu);const r=Fu.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){Bu&&ca(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?Vu[e]=n.bind(Fu):n}("fetch")){let n=0,r=0;return Vl(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 Vu.fetch=void 0,e}finally{n-=o,r--}})}function td(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?ua:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const nd=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,rd=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,id=/\((\S*)(?::(\d+))(?::(\d+))\)/,od=/at (.+?) ?\(data:(.+?),/,sd=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ad=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,cd=ma([30,e=>{const t=e.match(od);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=nd.exec(e);if(n){const[,e,t,r]=n;return td(e,ua,+t,+r)}const r=rd.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=id.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=ld(r[1]||ua,r[2]);return td(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=sd.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=ad.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]||ua;return[n,e]=ld(n,e),td(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),ld=(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]:ua,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},ud="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,dd=(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";ba(t,e),xa(t,fu)}(function(e){return function(t){if(Cc()!==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:Ua(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Ua(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}tu(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(Cc()!==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&&(ud&&ca(`\`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=Ba(t,{keyAttrs:o,maxStringLength:s}),i=function(e){if(!La.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}),tu(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),ba("dom",n),xa("dom",Yu)),t.xhr&&function(e){ba("xhr",e),xa("xhr",Xu)}(function(e){return function(t){if(Cc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[Ku];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:wu(a)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),tu(d,u)}}(e)),t.fetch&&ku(function(e){return function(t){if(Cc()!==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),tu(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:wu(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),tu(a,s)}}}(e)),t.history&&Ju(function(e){return function(t){if(Cc()!==e)return;let n=t.from,r=t.to;const i=Kl($u.location.href);let o=n?Kl(n):void 0;const s=Kl(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),tu({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){Cc()===e&&tu({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:rc(t)},{event:t})}}(e))}}},hd=["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"],md=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Ga($u,"setTimeout",fd),t.setInterval&&Ga($u,"setInterval",fd),t.requestAnimationFrame&&Ga($u,"requestAnimationFrame",pd),t.XMLHttpRequest&&"XMLHttpRequest"in $u&&Ga(XMLHttpRequest.prototype,"send",gd);const e=t.eventTarget;e&&(Array.isArray(e)?e:hd).forEach(e=>function(e,t){const n=$u,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ga(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=Iu(i.handleEvent,{mechanism:{data:{handler:ga(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,Iu(i,{mechanism:{data:{handler:ga(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),Ga(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 fd(e){return function(...t){const n=t[0];return t[0]=Iu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ga(e)}`}}),e.apply(this,t)}}function pd(e){return function(t){return e.apply(this,[Iu(t,{mechanism:{data:{handler:ga(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function gd(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&Ga(n,e,function(t){const n={mechanism:{data:{handler:ga(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Va(t);return r&&(n.mechanism.data.handler=ga(r)),Iu(t,n)})}),e.apply(this,t)}}const yd=(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";ba(t,t=>{const{stackParser:n,attachStacktrace:r}=wd();if(Cc()!==e||Tu())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(Da(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)??qa();return 0===c.length&&c.push({colno:l,filename:d,function:ua,in_app:!0,lineno:u}),e}(ju(n,c||i,void 0,r,!1),o,s,a);l.level="error",Cl(l,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),xa(t,Na)}()}(e),vd("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";ba(t,t=>{const{stackParser:n,attachStacktrace:r}=wd();if(Cc()!==e||Tu())return;const i=function(e){if(za(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=za(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:ju(n,i,void 0,r,!0);o.level="error",Cl(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),xa(t,$a)}()}(e),vd("onunhandledrejection"))}}};function vd(e){ud&&aa(`Global Handler attached: ${e}`)}function wd(){const e=Cc();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const bd=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){uu(Eu,i.getOptions().stackParser,n,t,e,r)}}};let xd=!1;function kd(t){if(xd)e();else if(t.enabled&&t.dsn)try{const n=t.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===$u.window)return!1;const e=$u;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=qa();return!($u===$u.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(e=>n.startsWith(`${e}://`)))}()&&(ud&&na(()=>{}),!0),n={...e,enabled:!t&&e.enabled,stackParser:(r=e.stackParser||cd,Array.isArray(r)?ma(...r):r),integrations:Ml({integrations:e.integrations,defaultIntegrations:null==e.defaultIntegrations?[au(),iu(),md(),dd(),yd(),bd(),pu(),{name:"HttpContext",preprocessEvent(e){if(!$u.navigator&&!$u.location&&!$u.document)return;const t=function(){const e=qa(),{referrer:t}=$u.document||{},{userAgent:n}=$u.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!==$u.document?(Tl({ignoreDuration:!0}),Pl(),Ju(({from:e,to:t})=>{void 0!==e&&e!==t&&(Tl({ignoreDuration:!0}),Pl())})):ud&&ca("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:e.defaultIntegrations}),transport:e.transport||ed};var r;!function(e,t){!0===t.debug&&(Gs?sa():na(()=>{})),Nc().update(t.initialScope);const n=new e(t);(function(e){Nc().setClient(e)})(n),n.init()}(Lu,n)}({dsn:t.dsn,environment:t.environment||"production",release:t.release,beforeSend:t=>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||"")))}(t,n)?(t.tags={...t.tags,source:"insureos-widget"},e(t.exception),t):(e(t.exception),null),allowUrls:n,sampleRate:t.sampleRate||1,tracesSampleRate:t.tracesSampleRate||.1,integrations:[dd({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),pu()],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"]}),xd=!0,e()}catch(e){}else e()}function Sd(t,n){if(xd)try{n?$c(e=>{Object.entries(n).forEach(([t,n])=>{e.setContext(t,n)}),_l(t)}):_l(t)}catch(t){e()}}function Nd(t,n="info",r){if(xd)try{r?$c(e=>{Object.entries(r).forEach(([t,n])=>{e.setContext(t,n)}),$l(t,n)}):$l(t,n)}catch(t){e()}}function _d(t){if(xd)try{!function(e){_c().setUser(e)}(t)}catch(t){e()}}function $d(t){if(xd)try{tu(t)}catch(t){e()}}function Cd(t,n){if(xd)try{!function(e,t){_c().setTag(e,t)}(t,n)}catch(t){e()}}function Td(){return xd}var Id=Object.freeze({__proto__:null,addBreadcrumb:$d,captureException:Sd,captureMessage:Nd,initializeSentry:kd,isSentryInitialized:Td,setTag:Cd,setUser:_d});const Ed="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",Pd="production",Dd="insureos-scripts",Md=!0,zd=1,Rd=.1;class Od{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(...t){this.config.debug&&e("[Analytics]",...t)}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 jd{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{kd({dsn:Ed,environment:Pd,release:Dd,enabled:Md,sampleRate:zd,tracesSampleRate:Rd}),this.sentryInitialized=!0,e()}catch(t){e()}}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(t){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new Od({enabled:null===(n=t.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=t.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=t.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=t.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:t.debug}),_e(this.analyticsManager),e()}catch(t){e()}}async mount(e,r){r.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(r),this.initializeSentryOnce(),this.initializeAnalyticsOnce(r),function(e,r){var i,o,s;r==document&&(r=document.documentElement),n.m&&n.m(e,r),i=r.i,o=[],s=[],z(r,e=r.i=b(k,null,[e]),i||f,f,r.namespaceURI,i?null:r.firstChild?t.call(r.childNodes):null,o,i?i.v:r.firstChild,!1,s),O(o,e,s)}(b(Ys,{config:r,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 Ae(t)}async initializeFormContext(t){const n=this.createHttpClient(t),r=new URLSearchParams(window.location.search).get("pl_ref");if(r)return e(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:r,signedUrl:void 0}};if("payment"===t.mode)return e(),{httpClient:n,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:t.paymentLinkId,signedUrl:t.signedUrl}};const i="sessionStorage"===t.storageType?new Y:new Z;i.isAvailable()?e(i.constructor.name):e();const o=new Q(i),s=new V(o),a=t.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&&!t.quoteIntentUrl&&!h){e();const t=await n.fetchAvailableProducts(l?void 0:a);if(e(),t.organisation&&t.organisation.theme)try{const n=await Promise.resolve().then(function(){return Ws}).then(e=>e.ThemeLoader);await n.loadTheme({slug:t.organisation.slug,theme_url:t.organisation.theme.css_url}),e()}catch(t){e()}return{httpClient:n,stateManager:o,quoteIntent:null,quoteIntentStore:s,formStateManager:null,availableProducts:t.products,productCodes:a}}let m;h?(e(),m=h,localStorage.removeItem("insure-os-selected-product")):d&&(m=a[0]);const f=async()=>{e();const r=t.quoteIntentUrl?await n.getQuoteIntent(t.quoteIntentUrl):await n.createQuoteIntent({code:m});return e(),{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:t.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 e=>{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(e);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:t.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(t.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")){e(),localStorage.clear(),g.delete("clear");const t=g.toString()?`${window.location.pathname}?${g.toString()}`:window.location.pathname;window.history.replaceState({},"",t),e()}let y=null,v=!1;try{const e=o.getQuoteIntent(t.orgId),n=await s.getOrCreateQuoteIntent(t.orgId,f,p);n.payment_return&&o.saveQuoteIntent(t.orgId,n),y=n,v=!e}catch(e){if(!(e instanceof F&&404===e.statusCode))throw e;s.clearQuoteIntent(t.orgId),y=await s.getOrCreateQuoteIntent(t.orgId,f,p),v=!0}if(v&&y&&Te(y),!y)throw new Error("Failed to initialize quote intent state");e(),e(y.payment_return),y.payment_return&&e(y.payment_return);const w=new Oe(y,n,s,{autoSave:!1,autoSaveInterval:y.form_definition.settings.autoSaveInterval});if(y.form_data&&w.restoreFormProgress(y.form_data),e(y.cached_result),y.cached_result?(e(y.cached_result),w.restoreCalculationResult(y.cached_result),e(),e(w.hasCalculationResponse())):e(),y.organisation&&y.organisation.theme)try{await As.loadTheme({slug:y.organisation.slug,theme_url:y.organisation.theme.css_url})}catch(t){e()}return await this.handleAutoCalculationIfComplete(w),{httpClient:n,stateManager:o,quoteIntent:y,quoteIntentStore:s,formStateManager:w}}async handleAutoCalculationIfComplete(t){try{const n=t.getQuoteIntent();if("paid"===n.status||"completed"===n.status)return void e();if(t.hasCalculationResponse())return void e();if(t.hasLastCalculationFailed())return void e();const r=t.getPageCompletionStatus(),{totalPages:i,completedPages:o}=r,s=o.length===i;e((o.length,t.getIsCalculating(),t.hasLastCalculationFailed())),s&&!t.getIsCalculating()&&(e(),await t.calculateQuote(),e())}catch(t){e()}}}const Ad=new jd;"undefined"!=typeof window&&(window.InsureOS=Ad,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 Ad.mount(r,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class Wd{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 Hd});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 Zd});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 Gd});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}}class Ld{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,Ld.instance)return Ld.instance;Ld.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 Ld).startMeasurement(e)}static endMeasurement(e){return(new Ld).endMeasurement(e)}static measureMemoryUsage(){return(new Ld).measureMemoryUsage()}static async measureApiCall(e,t){return(new Ld).measureApiCall(e,t)}static getMetrics(){return(new Ld).getMetrics()}static generateReport(){return(new Ld).generateReport()}}let Bd=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)}},Fd=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new Bd(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 Bd(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)}},qd=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new Bd(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 Hd=Object.freeze({__proto__:null,Headers:Bd,Request:Fd,Response:qd,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new Fd(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 Bd;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new qd(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 Ud{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 Ud((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof Ud?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof Ud?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 Ud(t=>t(e))}static reject(e){return new Ud((t,n)=>n(e))}static all(e){return new Ud((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 Zd=Object.freeze({__proto__:null,PromisePolyfill:Ud});class Yd{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 Gd=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 Yd(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:Yd});export{Od as DataLayerManager,U as EnhancedHttpClient,q as ErrorHandlingStrategy,m as ErrorType,Oe as FormStateManager,Ad as InsureOS,jd as InsureOSClient,F as InsureOSError,Q as LocalStateManager,Z as LocalStorageAdapter,G as MemoryStorageAdapter,Ld as PerformanceMonitor,Wd as PolyfillManager,H as RetryStrategy,Y as SessionStorageAdapter,As as ThemeLoader,$d as addBreadcrumb,Sd as captureException,Nd as captureMessage,fe as createAppError,$e as getAnalytics,Se as getSupportMessage,ue as groupErrorsByField,_e as initializeAnalytics,kd as initializeSentry,Td as isSentryInitialized,le as parseServerValidationErrors,Cd as setTag,_d as setUser,xe as shouldShowErrorPage,ke as shouldShowMaintenancePage,Ie as trackFormProgress,ze as trackPaymentCompleted,Re as trackPaymentFailed,Me as trackPaymentInitiated,Pe as trackQuoteAtCheckout,Ee as trackQuoteCalculated,De as trackQuoteReferred,Te as trackQuoteStarted,ae as validateField,ce as validatePage};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|